Init the main window class in a slot called with a single shot timer to speed

up perceived startup time for the application.

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=954798
This commit is contained in:
Volker Lanz 2009-04-16 11:37:00 +00:00
parent f7177b8319
commit 9bda1ce0e4
2 changed files with 9 additions and 3 deletions

View File

@ -104,21 +104,26 @@ MainWindow::MainWindow(QWidget* parent, KActionCollection* coll) :
m_ActionCollection(coll) m_ActionCollection(coll)
{ {
setupUi(this); setupUi(this);
QTimer::singleShot(0, this, SLOT(init()));
}
FileSystemFactory::init(); void MainWindow::init()
{
connect(GlobalLog::instance(), SIGNAL(newMessage(log::Level, const QString&)), SLOT(onNewLogMessage(log::Level, const QString&))); connect(GlobalLog::instance(), SIGNAL(newMessage(log::Level, const QString&)), SLOT(onNewLogMessage(log::Level, const QString&)));
setupActions(); setupActions();
setupStatusBar(); setupStatusBar();
setupConnections(); setupConnections();
// If we were called with an action collection we're supposed to be a KPart, so don't // If we were called with an action collection we're supposed to be a KPart, so don't
// create the GUI in that case. // create the GUI in that case.
if (coll != NULL) if (m_ActionCollection != NULL)
setupGUI(ToolBar | Keys | StatusBar | Save); setupGUI(ToolBar | Keys | StatusBar | Save);
else else
setupGUI(ToolBar | Keys | StatusBar | Save | Create); setupGUI(ToolBar | Keys | StatusBar | Save | Create);
FileSystemFactory::init();
loadConfig(); loadConfig();
dockInformation().setWidget(&infoPane()); dockInformation().setWidget(&infoPane());

View File

@ -160,6 +160,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT MainWindow : public KXmlGuiWindow, publi
void onNewLogMessage(log::Level logLevel, const QString& s); void onNewLogMessage(log::Level logLevel, const QString& s);
void onFinished(); void onFinished();
void scanDevices(); void scanDevices();
void init();
private: private:
LibParted m_LibParted; LibParted m_LibParted;