From 949283fcf799e1ab850d52f8cb739c27477c2ac9 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 21 Jan 2015 15:58:36 -0500 Subject: Finish committing the last of the new distribution defaults framework. Also adjust the port plist, and add options to reset the system settings to default to lumina-config. --- libLumina/LuminaUtils.cpp | 120 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) (limited to 'libLumina/LuminaUtils.cpp') diff --git a/libLumina/LuminaUtils.cpp b/libLumina/LuminaUtils.cpp index c0d260dd..b82ee599 100644 --- a/libLumina/LuminaUtils.cpp +++ b/libLumina/LuminaUtils.cpp @@ -12,12 +12,18 @@ #include #include #include +#include #include +#include //============= // LUtils Functions //============= +QString LUtils::LuminaDesktopVersion(){ + return "0.8.1"; +} + int LUtils::runCmd(QString cmd, QStringList args){ QProcess *proc = new QProcess; proc->setProcessChannelMode(QProcess::MergedChannels); @@ -137,3 +143,117 @@ void LUtils::LoadTranslation(QApplication *app, QString appname){ //Load current encoding for this locale QTextCodec::setCodecForLocale( QTextCodec::codecForName(langEnc.toUtf8()) ); } + +void LUtils::LoadSystemDefaults(bool skipOS){ + //Will create the Lumina configuration files based on the current system template (if any) + QStringList sysDefaults; + if(!skipOS){ sysDefaults = LUtils::readFile(LOS::AppPrefix()+"etc/luminaDesktop.conf"); } + if(sysDefaults.isEmpty() && !skipOS){ sysDefaults = LUtils::readFile(LOS::AppPrefix()+"etc/luminaDesktop.conf.dist"); } + if(sysDefaults.isEmpty() && !skipOS) { sysDefaults = LUtils::readFile(LOS::SysPrefix()+"etc/luminaDesktop.conf"); } + if(sysDefaults.isEmpty() && !skipOS){ sysDefaults = LUtils::readFile(LOS::SysPrefix()+"etc/luminaDesktop.conf.dist"); } + if(sysDefaults.isEmpty()){ sysDefaults = LUtils::readFile(LOS::LuminaShare()+"luminaDesktop.conf"); } + //Find the number of the left-most desktop screen + QString screen = "0"; + QDesktopWidget *desk =QApplication::desktop(); + for(int i=0; iscreenCount(); i++){ + if(desk->screenGeometry(i).x()==0){ screen = QString::number(i); break; } + } + //Now setup the default "desktopsettings.conf" and "sessionsettings.conf" files + QStringList deskset, sesset; + //First start with any session settings + QStringList tmp = sysDefaults.filter("session."); + sesset << "[General]"; //everything is in this section + sesset << "DesktopVersion="+LUtils::LuminaDesktopVersion(); + for(int i=0; i