Skip to content

Commit

Permalink
Move some gui initialization to GuiApplication's constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-w committed Jan 6, 2015
1 parent 1ee9340 commit 0df3998
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
21 changes: 0 additions & 21 deletions src/core/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,26 +419,6 @@ int main( int argc, char * * argv )

if( render_out.isEmpty() )
{
// init style and palette
LmmsStyle * lmmsstyle = new LmmsStyle();
QApplication::setStyle( lmmsstyle );

LmmsPalette * lmmspal = new LmmsPalette( NULL, lmmsstyle );
QPalette lpal = lmmspal->palette();

QApplication::setPalette( lpal );
LmmsStyle::s_palette = &lpal;


// show splash screen
QSplashScreen splashScreen( embed::getIconPixmap( "splash" ) );
splashScreen.show();
splashScreen.showMessage( MainWindow::tr( "Version %1" ).arg( LMMS_VERSION ),
Qt::AlignRight | Qt::AlignBottom, Qt::white );
qApp->processEvents();

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

// re-intialize RNG - shared libraries might have srand() or
Expand Down Expand Up @@ -501,7 +481,6 @@ int main( int argc, char * * argv )
}
}

splashScreen.finish(gui->mainWindow());
}
else
{
Expand Down
29 changes: 28 additions & 1 deletion src/gui/GuiApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@

#include "GuiApplication.h"

#include "lmmsversion.h"

#include "LmmsStyle.h"
#include "LmmsPalette.h"

#include "AutomationEditor.h"
#include "BBEditor.h"
#include "ControllerRackView.h"
Expand All @@ -34,7 +39,8 @@
#include "ProjectNotes.h"
#include "SongEditor.h"

#include "QApplication"
#include <QApplication>
#include <QSplashScreen>

GuiApplication* GuiApplication::s_instance = nullptr;

Expand All @@ -47,6 +53,26 @@ GuiApplication::GuiApplication()
{
s_instance = this;

// Init style and palette
LmmsStyle* lmmsstyle = new LmmsStyle();
QApplication::setStyle(lmmsstyle);

LmmsPalette* lmmspal = new LmmsPalette(nullptr, lmmsstyle);
QPalette* lpal = new QPalette(lmmspal->palette());

QApplication::setPalette( *lpal );
LmmsStyle::s_palette = lpal;

// Show splash screen
QSplashScreen splashScreen( embed::getIconPixmap( "splash" ) );
splashScreen.show();
splashScreen.showMessage( MainWindow::tr( "Version %1" ).arg( LMMS_VERSION ),
Qt::AlignRight | Qt::AlignBottom, Qt::white );
qApp->processEvents();

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

m_mainWindow = new MainWindow;

m_songEditor = new SongEditorWindow(Engine::getSong());
Expand All @@ -58,6 +84,7 @@ GuiApplication::GuiApplication()
m_automationEditor = new AutomationEditorWindow;

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

Engine::s_hasGUI = true;
}
Expand Down

0 comments on commit 0df3998

Please sign in to comment.