Move some gui initialization to GuiApplication's constructor

This commit is contained in:
Lukas W
2015-01-06 15:59:15 +01:00
parent 1ee93409d1
commit 0df3998f95
2 changed files with 28 additions and 22 deletions

View File

@@ -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
@@ -501,7 +481,6 @@ int main( int argc, char * * argv )
}
}
splashScreen.finish(gui->mainWindow());
}
else
{

View File

@@ -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"
@@ -34,7 +39,8 @@
#include "ProjectNotes.h"
#include "SongEditor.h"
#include "QApplication"
#include <QApplication>
#include <QSplashScreen>
GuiApplication* GuiApplication::s_instance = nullptr;
@@ -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());
@@ -58,6 +84,7 @@ GuiApplication::GuiApplication()
m_automationEditor = new AutomationEditorWindow;
m_mainWindow->finalize();
splashScreen.finish(m_mainWindow);
Engine::s_hasGUI = true;
}