aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libLumina/LuminaUtils.cpp120
-rw-r--r--libLumina/LuminaUtils.h7
-rw-r--r--lumina-config/mainUI.cpp24
-rw-r--r--lumina-config/mainUI.h2
-rw-r--r--lumina-config/mainUI.ui63
-rw-r--r--port-files/pkg-plist3
6 files changed, 208 insertions, 11 deletions
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 <QObject>
#include <QTextCodec>
#include <QDebug>
+#include <QDesktopWidget>
#include <LuminaOS.h>
+#include <LuminaThemes.h>
//=============
// 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; i<desk->screenCount(); 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<tmp.length(); i++){
+ if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; }
+ QString var = tmp[i].section("=",0,0).toLower().simplified();
+ QString val = tmp[i].section("=",1,1).section("#",0,0).toLower().simplified();
+ QString istrue = (val=="true") ? "true": "false";
+ //Now parse the variable and put the value in the proper file
+
+ if(var=="session.enablenumlock"){ sesset << "EnableNumlock="+ istrue; }
+ else if(var=="session.playloginaudio"){ sesset << "PlayStartupAudio="+istrue; }
+ else if(var=="session.playlogoutaudio"){ sesset << "PlayLogoutAudio="+istrue; }
+ }
+ //Now do any desktop settings (only works for the primary desktop at the moment)
+ tmp = sysDefaults.filter("desktop.");
+ if(!tmp.isEmpty()){deskset << "[desktop-"+screen+"]"; }
+ for(int i=0; i<tmp.length(); i++){
+ if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; }
+ QString var = tmp[i].section("=",0,0).toLower().simplified();
+ QString val = tmp[i].section("=",1,1).section("#",0,0).toLower().simplified();
+ //Now parse the variable and put the value in the proper file
+ if(var=="desktop.visiblepanels"){ deskset << "panels="+val; }
+ else if(var=="desktop.backgroundfiles"){ deskset << "background\\filelist="+val; }
+ else if(var=="desktop.backgroundrotateminutes"){ deskset << "background\\minutesToChange="+val; }
+ else if(var=="desktop.plugins"){ deskset << "pluginlist="+val; }
+ }
+ if(!tmp.isEmpty()){ deskset << ""; } //space between sections
+ //Now do any panel1 settings (only works for the primary desktop at the moment)
+ tmp = sysDefaults.filter("panel1.");
+ if(!tmp.isEmpty()){deskset << "[panel"+screen+".0]"; }
+ for(int i=0; i<tmp.length(); i++){
+ if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; }
+ QString var = tmp[i].section("=",0,0).toLower().simplified();
+ QString val = tmp[i].section("=",1,1).section("#",0,0).toLower().simplified();
+ QString istrue = (val=="true") ? "true": "false";
+ //Now parse the variable and put the value in the proper file
+ if(var=="panel1.pixelsize"){ deskset << "height="+val; }
+ else if(var=="panel1.autohide"){ deskset << "hidepanel="+istrue; }
+ else if(var=="panel1.location"){ deskset << "location="+val; }
+ else if(var=="panel1.plugins"){ deskset << "pluginlist="+val; }
+ }
+ if(!tmp.isEmpty()){ deskset << ""; } //space between sections
+ //Now do any panel2 settings (only works for the primary desktop at the moment)
+ tmp = sysDefaults.filter("panel2.");
+ if(!tmp.isEmpty()){deskset << "[panel"+screen+".1]"; }
+ for(int i=0; i<tmp.length(); i++){
+ if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; }
+ QString var = tmp[i].section("=",0,0).toLower().simplified();
+ QString val = tmp[i].section("=",1,1).section("#",0,0).toLower().simplified();
+ QString istrue = (val=="true") ? "true": "false";
+ //Now parse the variable and put the value in the proper file
+ if(var=="panel2.pixelsize"){ deskset << "height="+val; }
+ else if(var=="panel2.autohide"){ deskset << "hidepanel="+istrue; }
+ else if(var=="panel2.location"){ deskset << "location="+val; }
+ else if(var=="panel2.plugins"){ deskset << "pluginlist="+val; }
+ }
+ if(!tmp.isEmpty()){ deskset << ""; } //space between sections
+ //Now do any menu settings
+ tmp = sysDefaults.filter("menu.");
+ if(!tmp.isEmpty()){deskset << "[menu]"; }
+ for(int i=0; i<tmp.length(); i++){
+ if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; }
+ QString var = tmp[i].section("=",0,0).toLower().simplified();
+ QString val = tmp[i].section("=",1,1).section("#",0,0).toLower().simplified();
+ //Now parse the variable and put the value in the proper file
+ if(var=="menu.plugins"){ deskset << "itemlist="+val; }
+ }
+ if(!tmp.isEmpty()){ deskset << ""; } //space between sections
+ //Now do any theme settings
+ QStringList themesettings = LTHEME::currentSettings();
+ //List: [theme path, colorspath, iconsname, font, fontsize]
+ tmp = sysDefaults.filter("theme.");
+ bool setTheme = !tmp.isEmpty();
+ for(int i=0; i<tmp.length(); i++){
+ if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; }
+ QString var = tmp[i].section("=",0,0).toLower().simplified();
+ QString val = tmp[i].section("=",1,1).section("#",0,0).toLower().simplified();
+ //Now parse the variable and put the value in the proper file
+ if(var=="theme.themefile"){ themesettings[0] = val; }
+ else if(var=="theme.colorfile"){ themesettings[1] = val; }
+ else if(var=="theme.iconset"){ themesettings[2] = val; }
+ else if(var=="theme.font"){ themesettings[3] = val; }
+ else if(var=="theme.fontsize"){ themesettings[4] = val; }
+ }
+ //Ensure that the settings directory exists
+ QString setdir = QDir::homePath()+"/.lumina/LuminaDE";
+ if(!QFile::exists(setdir)){
+ QDir dir;
+ dir.mkpath(setdir);
+ }
+ //Now save the settings files
+ if(setTheme){ LTHEME::setCurrentSettings( themesettings[0], themesettings[1], themesettings[2], themesettings[3], themesettings[4]); }
+ LUtils::writeFile(setdir+"/sessionsettings.conf", sesset, true);
+ LUtils::writeFile(setdir+"/desktopsettings.conf", deskset, true);
+} \ No newline at end of file
diff --git a/libLumina/LuminaUtils.h b/libLumina/LuminaUtils.h
index 28deb59a..ee716167 100644
--- a/libLumina/LuminaUtils.h
+++ b/libLumina/LuminaUtils.h
@@ -22,6 +22,9 @@
class LUtils{
public:
+ //Get the current version of the Lumina desktop
+ static QString LuminaDesktopVersion();
+
//Run an external command and return the exit code
static int runCmd(QString cmd, QStringList args = QStringList());
//Run an external command and return any text output (one line per entry)
@@ -40,6 +43,10 @@ public:
//Load a translation file for a Lumina Project
static void LoadTranslation(QApplication *app, QString appname);
+
+ //Load the default setup for the system
+ static void LoadSystemDefaults(bool skipOS = false);
+
};
#endif
diff --git a/lumina-config/mainUI.cpp b/lumina-config/mainUI.cpp
index c1f5b222..2e7b55ac 100644
--- a/lumina-config/mainUI.cpp
+++ b/lumina-config/mainUI.cpp
@@ -40,8 +40,7 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){
QTimer::singleShot(10, this, SLOT(loadCurrentSettings()) );
//Disable the incomplete pages/items at the moment
- //ui->check_session_playloginaudio->setVisible(false);
- //ui->check_session_playlogoutaudio->setVisible(false);
+
}
MainUI::~MainUI(){
@@ -120,6 +119,8 @@ void MainUI::setupIcons(){
ui->tool_session_addfile->setIcon( LXDG::findIcon("run-build-file","") );
ui->tool_session_newtheme->setIcon( LXDG::findIcon("preferences-desktop-theme","") );
ui->tool_session_newcolor->setIcon( LXDG::findIcon("preferences-desktop-color","") );
+ ui->push_session_resetSysDefaults->setIcon( LXDG::findIcon("pcbsd","view-refresh") );
+ ui->push_session_resetLuminaDefaults->setIcon( LXDG::findIcon("Lumina-DE","") );
}
@@ -213,6 +214,8 @@ void MainUI::setupConnections(){
connect(ui->tool_session_newcolor, SIGNAL(clicked()), this, SLOT(sessionEditColor()) );
connect(ui->tool_session_newtheme, SIGNAL(clicked()), this, SLOT(sessionEditTheme()) );
connect(ui->push_session_setUserIcon, SIGNAL(clicked()), this, SLOT(sessionChangeUserIcon()) );
+ connect(ui->push_session_resetSysDefaults, SIGNAL(clicked()), this, SLOT(sessionResetSys()) );
+ connect(ui->push_session_resetLuminaDefaults, SIGNAL(clicked()), this, SLOT(sessionResetLumina()) );
}
void MainUI::setupMenus(){
@@ -529,8 +532,8 @@ void MainUI::loadCurrentSettings(bool screenonly){
QStringList items = settings->value("menu/itemlist", QStringList() ).toStringList();
if(items.isEmpty()){ items << "terminal" << "filemanager" << "applications" << "line" << "settings"; }
//qDebug() << "Menu Items:" << items;
- ui->list_menu->clear();
- for(int i=0; i<items.length(); i++){
+ ui->list_menu->clear();
+ for(int i=0; i<items.length(); i++){
LPI info = PINFO->menuPluginInfo(items[i]);
if(items[i].startsWith("app::::")){
bool ok = false;
@@ -552,7 +555,7 @@ void MainUI::loadCurrentSettings(bool screenonly){
item->setText( info.name );
item->setToolTip( info.description );
ui->list_menu->addItem(item);
- }
+ }
checkmenuicons(); //update buttons
}
//Shortcuts Page
@@ -1918,4 +1921,13 @@ void MainUI::sessionChangeUserIcon(){
//Now re-load the icon in the UI
ui->push_session_setUserIcon->setIcon( LXDG::findIcon(QDir::homePath()+"/.loginIcon.png", "user-identity") );
}
- \ No newline at end of file
+
+void MainUI::sessionResetSys(){
+ LUtils::LoadSystemDefaults();
+ QTimer::singleShot(500,this, SLOT(loadCurrentSettings()) );
+}
+
+void MainUI::sessionResetLumina(){
+ LUtils::LoadSystemDefaults(true); //skip OS customizations
+ QTimer::singleShot(500,this, SLOT(loadCurrentSettings()) );
+}
diff --git a/lumina-config/mainUI.h b/lumina-config/mainUI.h
index 4c13f978..d3c622be 100644
--- a/lumina-config/mainUI.h
+++ b/lumina-config/mainUI.h
@@ -161,6 +161,8 @@ private slots:
void sessionEditColor();
void sessionEditTheme();
void sessionChangeUserIcon();
+ void sessionResetSys();
+ void sessionResetLumina();
};
#endif
diff --git a/lumina-config/mainUI.ui b/lumina-config/mainUI.ui
index 6486ed6c..5d016d6c 100644
--- a/lumina-config/mainUI.ui
+++ b/lumina-config/mainUI.ui
@@ -384,8 +384,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>265</width>
- <height>184</height>
+ <width>214</width>
+ <height>140</height>
</rect>
</property>
<attribute name="label">
@@ -621,8 +621,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>266</width>
- <height>184</height>
+ <width>214</width>
+ <height>140</height>
</rect>
</property>
<attribute name="label">
@@ -1410,6 +1410,61 @@
</property>
</spacer>
</item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="font">
+ <font>
+ <weight>50</weight>
+ <bold>false</bold>
+ </font>
+ </property>
+ <property name="title">
+ <string>Reset Desktop Settings</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_20">
+ <item>
+ <spacer name="horizontalSpacer_18">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="push_session_resetSysDefaults">
+ <property name="text">
+ <string>Return to system defaults</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="push_session_resetLuminaDefaults">
+ <property name="text">
+ <string>Return to Lumina defaults</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_17">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
diff --git a/port-files/pkg-plist b/port-files/pkg-plist
index ddbadd55..d31664e2 100644
--- a/port-files/pkg-plist
+++ b/port-files/pkg-plist
@@ -4,6 +4,7 @@ bin/lumina-config
bin/lumina-fm
bin/lumina-screenshot
bin/lumina-search
+etc/luminaDesktop.conf.dist
lib/libLuminaUtils.so
lib/libLuminaUtils.so.1
lib/libLuminaUtils.so.1.0
@@ -22,7 +23,7 @@ share/pixmaps/Insight-FileManager.png
share/xsessions/Lumina-DE.desktop
share/Lumina-DE/desktop-background.jpg
share/Lumina-DE/defaultapps.conf
-share/Lumina-DE/desktopsettings.conf
+share/Lumina-DE/luminaDesktop.conf
share/Lumina-DE/fluxbox-init-rc
share/Lumina-DE/fluxbox-keys
share/Lumina-DE/Login.ogg
bgstack15