diff options
Diffstat (limited to 'src-qt5/core')
-rw-r--r-- | src-qt5/core/libLumina/LDesktopUtils.cpp | 5 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LSession.cpp | 16 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LSession.h | 2 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/main.cpp | 25 | ||||
-rw-r--r-- | src-qt5/core/lumina-session/main.cpp | 20 | ||||
-rw-r--r-- | src-qt5/core/lumina-session/session.cpp | 26 | ||||
-rw-r--r-- | src-qt5/core/lumina-session/session.h | 2 |
7 files changed, 54 insertions, 42 deletions
diff --git a/src-qt5/core/libLumina/LDesktopUtils.cpp b/src-qt5/core/libLumina/LDesktopUtils.cpp index fb13a2a3..c65f6faf 100644 --- a/src-qt5/core/libLumina/LDesktopUtils.cpp +++ b/src-qt5/core/libLumina/LDesktopUtils.cpp @@ -483,10 +483,7 @@ bool LDesktopUtils::checkUserFiles(QString lastversion, QString currentversion){ //Convert from the old desktop numbering system to the new one (change occured with 1.0.1) if(oldversion<=1000001){ QStringList DS = LUtils::readFile(dset); - char *tmp; - int tmpN = 0; - QApplication A(tmpN, &tmp); - QList<QScreen*> screens = A.screens(); + QList<QScreen*> screens = QApplication::screens(); for(int i=0; i<DS.length(); i++){ if(!DS[i].startsWith("[")){ continue; } if(DS[i].startsWith("[desktop-")){ diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index 0acd7303..fb24117d 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -384,20 +384,26 @@ void LSession::checkWindowGeoms(){ } } -void LSession::checkUserFiles(){ +bool LSession::checkUserFiles(){ //internal version conversion examples: // [1.0.0 -> 1000000], [1.2.3 -> 1002003], [0.6.1 -> 6001] + qDebug() << "Check User Files"; + //char tmp[] = "junk\0"; + //int tmpN = 0; + //QApplication A(tmpN, (char **)&tmp); QSettings sset("lumina-desktop", "sessionsettings"); QString OVS = sset.value("DesktopVersion","0").toString(); //Old Version String - char *tmp; - int tmpN = 0; - QApplication *A = new QApplication(tmpN, &tmp); + qDebug() << " - Old Version:" << OVS; + qDebug() << " - Current Version:" << LDesktopUtils::LuminaDesktopVersion(); bool changed = LDesktopUtils::checkUserFiles(OVS, LDesktopUtils::LuminaDesktopVersion()); + qDebug() << " - Made Changes:" << changed; if(changed){ //Save the current version of the session to the settings file (for next time) sset.setValue("DesktopVersion", LDesktopUtils::LuminaDesktopVersion()); } - delete A; + qDebug() << "Finished with user files check"; + //delete A; + return changed; } void LSession::refreshWindowManager(){ diff --git a/src-qt5/core/lumina-desktop/LSession.h b/src-qt5/core/lumina-desktop/LSession.h index 43cddac7..a25f3c15 100644 --- a/src-qt5/core/lumina-desktop/LSession.h +++ b/src-qt5/core/lumina-desktop/LSession.h @@ -52,7 +52,7 @@ public: LSession(int &argc, char **argv); ~LSession(); - static void checkUserFiles(); + static bool checkUserFiles(); //Functions to be called during startup void setupSession(); diff --git a/src-qt5/core/lumina-desktop/main.cpp b/src-qt5/core/lumina-desktop/main.cpp index c272f263..826d697c 100644 --- a/src-qt5/core/lumina-desktop/main.cpp +++ b/src-qt5/core/lumina-desktop/main.cpp @@ -76,36 +76,21 @@ int main(int argc, char ** argv) setenv("QT_QPA_PLATFORMTHEME", "lthemeengine", 1); unsetenv("QT_AUTO_SCREEN_SCALE_FACTOR"); //causes pixel-specific scaling issues with the desktop - turn this on after-the-fact for other apps //Startup the session - LSession::checkUserFiles(); //make sure to create any config files before creating the QApplication LSession a(argc, argv); if(!a.isPrimaryProcess()){ return 0; } + //Ensure that the user's config files exist + /*if( LSession::checkUserFiles() ){ //make sure to create any config files before creating the QApplication + qDebug() << "User files changed - restarting the desktop session"; + return 787; //return special restart code + }*/ //Setup the log file - /* logfile.setFileName( QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/logs/runtime.log" ); - qDebug() << "Lumina Log File:" << logfile.fileName(); - if(QFile::exists(logfile.fileName()+".old")){ QFile::remove(logfile.fileName()+".old"); } - if(logfile.exists()){ QFile::rename(logfile.fileName(), logfile.fileName()+".old"); } - //Make sure the parent directory exists - if(!QFile::exists(QDir::homePath()+"/.lumina/logs")){ - QDir dir; - dir.mkpath(QDir::homePath()+"/.lumina/logs"); - } - logfile.open(QIODevice::WriteOnly | QIODevice::Append);*/ QTime *timer=0; if(DEBUG){ timer = new QTime(); timer->start(); } - //Setup Log File - //qInstallMessageHandler(MessageOutput); - //if(DEBUG){ qDebug() << "Theme Init:" << timer->elapsed(); } - //LuminaThemeEngine theme(&a); - //QObject::connect(&theme, SIGNAL(updateIcons()), &a, SLOT(reloadIconTheme()) ); - //if(DEBUG){ qDebug() << "Load Locale:" << timer->elapsed(); } - //LUtils::LoadTranslation(&a, "lumina-desktop"); if(DEBUG){ qDebug() << "Session Setup:" << timer->elapsed(); } a.setupSession(); - //theme.refresh(); if(DEBUG){ qDebug() << "Exec Time:" << timer->elapsed(); delete timer;} int retCode = a.exec(); //qDebug() << "Stopping the window manager"; qDebug() << "Finished Closing Down Lumina"; - //logfile.close(); return retCode; } diff --git a/src-qt5/core/lumina-session/main.cpp b/src-qt5/core/lumina-session/main.cpp index 71244a8b..3b71bdca 100644 --- a/src-qt5/core/lumina-session/main.cpp +++ b/src-qt5/core/lumina-session/main.cpp @@ -55,14 +55,6 @@ int main(int argc, char ** argv) return QProcess::execute("xinit", args); } qDebug() << "Starting the Lumina desktop on current X11 session:" << disp; - //Setup any initialization values - LTHEME::LoadCustomEnvSettings(); - LXDG::setEnvironmentVars(); - setenv("DESKTOP_SESSION","Lumina",1); - setenv("XDG_CURRENT_DESKTOP","Lumina",1); - unsetenv("QT_QPA_PLATFORMTHEME"); //causes issues with Lumina themes - not many people have this by default... - //Check for any missing user config files - //Check for any stale desktop lock files and clean them up QString cfile = QDir::tempPath()+"/.LSingleApp-%1-%2-%3"; @@ -81,14 +73,22 @@ int main(int argc, char ** argv) } //Configure X11 monitors if needed - if(LUtils::isValidBinary("lumina-xconfig")){ + if(LUtils::isValidBinary("lumina-xconfig")){ qDebug() << " - Resetting monitor configuration to last-used settings"; QProcess::execute("lumina-xconfig --reset-monitors"); } qDebug() << " - Starting the session..."; + //Setup any initialization values + LTHEME::LoadCustomEnvSettings(); + LXDG::setEnvironmentVars(); + setenv("DESKTOP_SESSION","Lumina",1); + setenv("XDG_CURRENT_DESKTOP","Lumina",1); + unsetenv("QT_QPA_PLATFORMTHEME"); //causes issues with Lumina themes - not many people have this by default... //Startup the session - QCoreApplication a(argc, argv); + QApplication a(argc, argv); + setenv("QP_QPA_PLATFORMTHEME","lthemeengine",1); //make sure this is after the QApplication - not actually using the theme plugin for **this** process LSession sess; + sess.checkFiles(); //Make sure user files are created/installed first sess.start(unified); int retCode = a.exec(); qDebug() << "Finished Closing Down Lumina"; diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index 3fdf9e66..743fc396 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -15,6 +15,7 @@ #include <LUtils.h> #include <LuminaOS.h> +#include <LDesktopUtils.h> void LSession::stopall(){ stopping = true; @@ -38,8 +39,12 @@ void LSession::procFinished(){ stopped++; if(!stopping){ //See if this process is the main desktop binary - if(PROCS[i]->objectName()=="runtime"){ stopall(); } - else if(PROCS[i]->objectName()=="wm" && wmfails<2){ wmfails++; PROCS[i]->start(QIODevice::ReadOnly); wmTimer->start(); } //restart the WM + if(PROCS[i]->objectName()=="runtime"){ + qDebug() << "Got Desktop Process Finished:" << PROCS[i]->exitCode(); + //if(PROCS[i]->exitCode()==787){ PROCS[i]->start(QIODevice::ReadOnly); } //special internal restart code + //else{ + stopall(); //} + }else if(PROCS[i]->objectName()=="wm" && wmfails<2){ wmfails++; PROCS[i]->start(QIODevice::ReadOnly); wmTimer->start(); } //restart the WM //if(PROCS[i]->program().section("/",-1) == "lumina-desktop"){ stopall(); } //start closing down everything //else{ PROCS[i]->start(QIODevice::ReadOnly); } //restart the process //break; @@ -164,3 +169,20 @@ void LSession::start(bool unified){ startProcess("runtime","lumina-desktop-unified"); } } + +void LSession::checkFiles(){ +//internal version conversion examples: + // [1.0.0 -> 1000000], [1.2.3 -> 1002003], [0.6.1 -> 6001] + qDebug() << "[Lumina] Checking User Files"; + QSettings sset("lumina-desktop", "sessionsettings"); + QString OVS = sset.value("DesktopVersion","0").toString(); //Old Version String + qDebug() << " - Old Version:" << OVS; + qDebug() << " - Current Version:" << LDesktopUtils::LuminaDesktopVersion(); + bool changed = LDesktopUtils::checkUserFiles(OVS, LDesktopUtils::LuminaDesktopVersion()); + qDebug() << " - Made Changes:" << changed; + if(changed){ + //Save the current version of the session to the settings file (for next time) + sset.setValue("DesktopVersion", LDesktopUtils::LuminaDesktopVersion()); + } + qDebug() << "Finished with user files check"; +} diff --git a/src-qt5/core/lumina-session/session.h b/src-qt5/core/lumina-session/session.h index 5cf1ccfa..3bbcbb8e 100644 --- a/src-qt5/core/lumina-session/session.h +++ b/src-qt5/core/lumina-session/session.h @@ -83,4 +83,6 @@ public: void start(bool unified = false); + void checkFiles(); + }; |