From 3464e681e6eebe8022b75750405770e8dfe7db87 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Sat, 12 Nov 2016 09:19:29 -0500 Subject: Speed up the initial loading of the desktop at start, and delay the auto-started apps by 1/2 second. --- src-qt5/core/lumina-desktop/LPanel.cpp | 4 ++-- src-qt5/core/lumina-desktop/LSession.cpp | 22 +++++----------------- .../applauncher/AppLauncherPlugin.cpp | 3 ++- .../desktop-plugins/notepad/NotepadPlugin.cpp | 2 +- 4 files changed, 10 insertions(+), 21 deletions(-) (limited to 'src-qt5/core/lumina-desktop') diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index 62534acb..43584ffc 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -67,7 +67,7 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ //this->setWindowOpacity(0.5); //fully transparent background for the main widget //panelArea->setWindowOpacity(1.0); //fully opaque for the widget on top (apply stylesheet transparencies) } - QTimer::singleShot(1,this, SLOT(UpdatePanel()) ); //start this in a new thread + QTimer::singleShot(1,this, SLOT(UpdatePanel()) ); //connect(screen, SIGNAL(resized(int)), this, SLOT(UpdatePanel()) ); //in case the screen resolution changes } @@ -246,7 +246,7 @@ void LPanel::UpdatePanel(bool geomonly){ //Make sure the plugin layout has the correct orientation if(horizontal){PLUGINS[p]->layout()->setDirection(QBoxLayout::LeftToRight); } else{ PLUGINS[p]->layout()->setDirection(QBoxLayout::TopToBottom); } - QTimer::singleShot(0,PLUGINS[p], SLOT( OrientationChange() ) ); + PLUGINS[p]->OrientationChange(); //Now check the location of the plugin in the panel if(p!=i){ //wrong place in the panel layout->takeAt(p); //remove the item from the current location diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index f383c163..22439911 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -120,12 +120,6 @@ void LSession::setupSession(){ if(DEBUG){ qDebug() << " - Init System Tray:" << timer->elapsed();} startSystemTray(); - //Launch Fluxbox - //splash.showScreen("wm"); - //if(DEBUG){ qDebug() << " - Init WM:" << timer->elapsed();} - //WM = new WMProcess(); - //WM->startWM(); - //Initialize the global menus qDebug() << " - Initialize system menus"; splash.showScreen("apps"); @@ -143,7 +137,8 @@ void LSession::setupSession(){ if(DEBUG){ qDebug() << " - Init Desktops:" << timer->elapsed();} desktopFiles = QDir(QDir::homePath()+"/Desktop").entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs, QDir::Name | QDir::IgnoreCase | QDir::DirsFirst); updateDesktops(); - + for(int i=0; i<6; i++){ LSession::processEvents(); } //Run through this a few times so the interface systems get up and running + //Now setup the system watcher for changes splash.showScreen("final"); qDebug() << " - Initialize file system watcher"; @@ -154,25 +149,18 @@ void LSession::setupSession(){ watcherChange( confdir+"/desktopsettings.conf" ); watcherChange( confdir+"/fluxbox-init" ); watcherChange( confdir+"/fluxbox-keys" ); - //watcher->addPath( sessionsettings->fileName() ); - //watcher->addPath( confdir+"/desktopsettings.conf" ); - //watcher->addPath( confdir+"/fluxbox-init" ); - //watcher->addPath( confdir+"/fluxbox-keys" ); //Try to watch the localized desktop folder too if(QFile::exists(QDir::homePath()+"/"+tr("Desktop"))){ watcherChange( QDir::homePath()+"/"+tr("Desktop") ); } watcherChange( QDir::homePath()+"/Desktop" ); //connect internal signals/slots - //connect(this->desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(screensChanged()) ); - //connect(this->desktop(), SIGNAL(resized(int)), this, SLOT(screenResized(int)) ); connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherChange(QString)) ); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(watcherChange(QString)) ); connect(this, SIGNAL(aboutToQuit()), this, SLOT(SessionEnding()) ); if(DEBUG){ qDebug() << " - Init Finished:" << timer->elapsed(); delete timer;} - QApplication::processEvents(); - launchStartupApps(); - //QTimer::singleShot(500, this, SLOT(launchStartupApps()) ); - //QApplication::processEvents(); + for(int i=0; i<4; i++){ LSession::processEvents(); } //Again, just a few event loops here so thing can settle before we close the splash screen + //launchStartupApps(); + QTimer::singleShot(500, this, SLOT(launchStartupApps()) ); splash.close(); } diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp index 708355cd..3be19faa 100644 --- a/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp +++ b/src-qt5/core/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp @@ -20,7 +20,8 @@ AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(par connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT( loadButton()) ); connect(this, SIGNAL(PluginActivated()), this, SLOT(buttonClicked()) ); //in case they use the context menu to launch it. - QTimer::singleShot(200,this, SLOT(loadButton()) ); + loadButton(); + //QTimer::singleShot(0,this, SLOT(loadButton()) ); } void AppLauncherPlugin::Cleanup(){ diff --git a/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp b/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp index fe26941e..6d321305 100644 --- a/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp +++ b/src-qt5/core/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp @@ -66,7 +66,7 @@ NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID) //qDebug() << "Saving a new setting"; this->saveSetting("customFile",""); //always clear this when the plugin is initialized (only maintained per-session) //qDebug() << "Loading Notes Dir"; - QTimer::singleShot(2000, this, SLOT(notesDirChanged())); + QTimer::singleShot(10, this, SLOT(notesDirChanged())); //qDebug() << "Set Sizing"; //qDebug() << "Connect Signals/slots"; -- cgit