Skip to content

Commit

Permalink
Remove Engine's has_gui option
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-w committed Jan 6, 2015
1 parent 748cccd commit e0dbfa6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
12 changes: 4 additions & 8 deletions include/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,10 @@ class ControllerRackView;
class EXPORT Engine
{
public:
static void init( const bool _has_gui = true );
static void init();
static void destroy();

static bool hasGUI()
{
return s_hasGUI;
}
static bool hasGUI();

static void setSuppressMessages( bool _on )
{
Expand All @@ -68,7 +65,7 @@ class EXPORT Engine

static bool suppressMessages()
{
return !s_hasGUI || s_suppressMessages;
return !hasGUI() || s_suppressMessages;
}

// core
Expand Down Expand Up @@ -130,7 +127,6 @@ class EXPORT Engine
delete tmp;
}

static bool s_hasGUI;
static bool s_suppressMessages;
static float s_framesPerTick;

Expand All @@ -149,7 +145,7 @@ class EXPORT Engine
static void initPluginFileHandling();

friend class GuiApplication;
} ;
};



Expand Down
12 changes: 8 additions & 4 deletions src/core/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@
#include "Song.h"
#include "BandLimitedWave.h"

#include "GuiApplication.h"


bool Engine::s_hasGUI = true;
bool Engine::s_suppressMessages = false;
float Engine::s_framesPerTick;
Mixer* Engine::s_mixer = NULL;
Expand All @@ -54,10 +55,8 @@ QMap<QString, QString> Engine::s_pluginFileHandling;



void Engine::init( const bool _has_gui )
void Engine::init()
{
s_hasGUI = _has_gui;

// generate (load from file) bandlimited wavetables
BandLimitedWave::generateWaves();

Expand Down Expand Up @@ -109,6 +108,11 @@ void Engine::destroy()
delete ConfigManager::inst();
}

bool Engine::hasGUI()
{
return gui != nullptr;
}




Expand Down
2 changes: 1 addition & 1 deletion src/core/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ int main( int argc, char * * argv )
else
{
// we're going to render our song
Engine::init( false );
Engine::init();

printf( "loading project...\n" );
Engine::getSong()->loadProject( file_to_load );
Expand Down
9 changes: 4 additions & 5 deletions src/gui/GuiApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ GuiApplication* GuiApplication::instance()

GuiApplication::GuiApplication()
{
s_instance = this;

// Init style and palette
LmmsStyle* lmmsstyle = new LmmsStyle();
QApplication::setStyle(lmmsstyle);
Expand All @@ -71,7 +69,9 @@ GuiApplication::GuiApplication()
qApp->processEvents();

// Init central engine which handles all components of LMMS
Engine::init(false);
Engine::init();

s_instance = this;

m_mainWindow = new MainWindow;

Expand All @@ -85,11 +85,10 @@ GuiApplication::GuiApplication()

m_mainWindow->finalize();
splashScreen.finish(m_mainWindow);

Engine::s_hasGUI = true;
}

GuiApplication::~GuiApplication()
{
InstrumentTrackView::cleanupWindowCache();
s_instance = nullptr;
}

1 comment on commit e0dbfa6

@tresf
Copy link
Member

@tresf tresf commented on e0dbfa6 Jan 7, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Please sign in to comment.