diff options
4 files changed, 139 insertions, 155 deletions
diff --git a/src-qt5/core-utils/lumina-config/pages/page_session_options.cpp b/src-qt5/core-utils/lumina-config/pages/page_session_options.cpp index 4251eab6..5a1ed1d4 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_session_options.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_session_options.cpp @@ -34,7 +34,7 @@ page_session_options::page_session_options(QWidget *parent) : PageWidget(parent) connect(ui->check_autoapplinks, SIGNAL(toggled(bool)), this, SLOT(settingChanged()) ); connect(ui->check_watch_app_procs, SIGNAL(toggled(bool)), this, SLOT(settingChanged()) ); connect(ui->mywindowmanager, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged())); - updateIcons(); + updateIcons(); } page_session_options::~page_session_options(){ @@ -54,12 +54,12 @@ void page_session_options::SaveSettings(){ sessionsettings.setValue("DateFormat", ui->line_session_date->text()); sessionsettings.setValue("DateTimeOrder", ui->combo_session_datetimeorder->currentData().toString()); - QString my_win = ui->mywindowmanager->currentText(); + QString my_win = ui->mywindowmanager->currentData().toString(); // Warn user if they select a non-default window manager - if (! my_win.contains("Lumina") ) + if (! my_win.isEmpty() ) QMessageBox::information(this, tr("Window manager"), "Warning: Please note window managers other than Lumina are not supported." ); // If we selected "Lumina" as the window manager, leave the field blank to get default - if (! my_win.compare("Lumina")) + if ( my_win.isEmpty() ) sessionsettings.remove("WindowManager"); else sessionsettings.setValue("WindowManager", my_win); @@ -109,16 +109,16 @@ void page_session_options::LoadSettings(int){ // Check to see if old window manager is in our list and, if not, add it if ( old_wm.length() > 0 ) { - index = ui->mywindowmanager->findText( old_wm ); + index = ui->mywindowmanager->findData( old_wm ); if (index == -1) // did not find existing option in list, so add it { - ui->mywindowmanager->addItem( old_wm ); + ui->mywindowmanager->addItem( old_wm, old_wm); // Past window manager is now in list so we can select it, even if it did not exist before - index = ui->mywindowmanager->findText( old_wm ); + index = ui->mywindowmanager->findData( old_wm ); } } else // there was no "old" window manager, default to using Lumina/default - index = ui->mywindowmanager->findText( "Lumina" ); + index = 0; ui->mywindowmanager->setCurrentIndex(index); @@ -139,14 +139,23 @@ void page_session_options::updateIcons(){ } //================= -// PRIVATE +// PRIVATE //================= void page_session_options::FindWindowManagerOptions(){ // Try to find all available window managers and add them to drop-down box. ui->mywindowmanager->clear(); - ui->mywindowmanager->addItem("Lumina"); // make sure there is a default - if (QFileInfo::exists("/usr/bin/fluxbox")) + ui->mywindowmanager->addItem("Default (fluxbox)"); // make sure there is a default at position 0 + QStringList wms; wms << "kwin" << "openbox" << "i3"; + //NOTE: the "fluxbox" window manager is already assumed by the selection of the "Lumina" default + wms.sort(); + for(int i=0; i<wms.length(); i++){ + QString path = wms[i]; + if(LUtils::isValidBinary(path)){ //This will change the "path" variable to the full path if it exists + ui->mywindowmanager->addItem(wms[i], path); + } + } + /*if (QFileInfo::exists("/usr/bin/fluxbox")) ui->mywindowmanager->addItem("/usr/bin/fluxbox"); else if (QFileInfo::exists("/usr/local/bin/fluxbox")) ui->mywindowmanager->addItem("/usr/local/bin/fluxbox"); @@ -157,9 +166,13 @@ void page_session_options::FindWindowManagerOptions(){ if (QFileInfo::exists("/usr/bin/openbox")) ui->mywindowmanager->addItem("/usr/bin/openbox"); else if (QFileInfo::exists("/usr/local/bin/openbox")) - ui->mywindowmanager->addItem("/usr/local/bin/openbox"); + ui->mywindowmanager->addItem("/usr/local/bin/openbox");*/ } +bool page_session_options::verifySettingsReset(){ + bool ok =(QMessageBox::Yes == QMessageBox::warning(this, tr("Verify Settings Reset"), tr("Are you sure you want to reset your desktop settings? This change cannot be reversed!"), QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel) ); + return ok; +} //================= // PRIVATE SLOTS @@ -184,7 +197,7 @@ void page_session_options::sessionChangeUserIcon(){ } } }else{ - ui->push_session_setUserIcon->setWhatsThis(filepath); + ui->push_session_setUserIcon->setWhatsThis(filepath); } //Now re-load the icon in the UI QString path = ui->push_session_setUserIcon->whatsThis(); @@ -195,13 +208,15 @@ void page_session_options::sessionChangeUserIcon(){ } void page_session_options::sessionResetSys(){ + if( !verifySettingsReset() ){ return; } //cancelled LDesktopUtils::LoadSystemDefaults(); QTimer::singleShot(500,this, SLOT(LoadSettings()) ); } void page_session_options::sessionResetLumina(){ + if( !verifySettingsReset() ){ return; } //cancelled LDesktopUtils::LoadSystemDefaults(true); //skip OS customizations - QTimer::singleShot(500,this, SLOT(LoadSettings()) ); + QTimer::singleShot(500,this, SLOT(LoadSettings()) ); } void page_session_options::sessionLoadTimeSample(){ diff --git a/src-qt5/core-utils/lumina-config/pages/page_session_options.h b/src-qt5/core-utils/lumina-config/pages/page_session_options.h index 8e3805a6..689a6797 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_session_options.h +++ b/src-qt5/core-utils/lumina-config/pages/page_session_options.h @@ -2,7 +2,7 @@ // Lumina Desktop Source Code // Copyright (c) 2016, Ken Moore // Available under the 3-clause BSD license -// See the LICENSE file for full details +// See the LICENSE file for full details //=========================================== #ifndef _LUMINA_CONFIG_PAGE_SESSION_OPTIONS_H #define _LUMINA_CONFIG_PAGE_SESSION_OPTIONS_H @@ -31,6 +31,7 @@ private: Ui::page_session_options *ui; bool loading; void FindWindowManagerOptions(); + bool verifySettingsReset(); private slots: void sessionChangeUserIcon(); diff --git a/src-qt5/core-utils/lumina-config/pages/page_session_options.ui b/src-qt5/core-utils/lumina-config/pages/page_session_options.ui index 1e0e37ba..25c92919 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_session_options.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_session_options.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>400</width> + <width>512</width> <height>300</height> </rect> </property> @@ -204,9 +204,9 @@ </property> </widget> </item> - <item row="4" column="1"> - <widget class="QComboBox" name="combo_session_datetimeorder"/> - </item> + <item row="4" column="1"> + <widget class="QComboBox" name="combo_session_datetimeorder"/> + </item> <item row="5" column="1"> <widget class="QComboBox" name="mywindowmanager"> <property name="toolTip"> @@ -221,7 +221,7 @@ </property> </widget> </item> - </layout> + </layout> </item> <item row="1" column="0"> <spacer name="verticalSpacer_2"> @@ -264,14 +264,14 @@ <item> <widget class="QPushButton" name="push_session_resetSysDefaults"> <property name="text"> - <string>Return to system defaults</string> + <string>Restore system defaults</string> </property> </widget> </item> <item> <widget class="QPushButton" name="push_session_resetLuminaDefaults"> <property name="text"> - <string>Return to Lumina defaults</string> + <string>Restore Lumina defaults</string> </property> </widget> </item> diff --git a/src-qt5/core-utils/lumina-config/pages/page_soundtheme.ui b/src-qt5/core-utils/lumina-config/pages/page_soundtheme.ui index 329b68a4..6544451a 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_soundtheme.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_soundtheme.ui @@ -13,141 +13,109 @@ <property name="windowTitle"> <string>Form</string> </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QCheckBox" name="checkBox_startup"> - <property name="text"> - <string>Enabled</string> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_startup"> - <property name="text"> - <string>TextLabel</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <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="pushButton_startup"> - <property name="text"> - <string>Set Startup Audio</string> - </property> - </widget> - </item> - </layout> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="2"> + <widget class="QPushButton" name="pushButton_startup"> + <property name="text"> + <string>Set Startup Audio</string> + </property> + </widget> </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QCheckBox" name="checkBox_logout"> - <property name="text"> - <string>Enabled</string> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_logout"> - <property name="text"> - <string>TextLabel</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <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="pushButton_logout"> - <property name="text"> - <string>Set Logout Audio</string> - </property> - </widget> - </item> - </layout> + <item row="1" column="0"> + <widget class="QCheckBox" name="checkBox_logout"> + <property name="text"> + <string>Enabled</string> + </property> + </widget> </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QCheckBox" name="checkBox_battery"> - <property name="text"> - <string>Enabled</string> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_battery"> - <property name="text"> - <string>TextLabel</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <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="pushButton_battery"> - <property name="text"> - <string>Set Battery Audio</string> - </property> - </widget> - </item> - </layout> + <item row="0" column="0"> + <widget class="QCheckBox" name="checkBox_startup"> + <property name="text"> + <string>Enabled</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QPushButton" name="pushButton_battery"> + <property name="text"> + <string>Set Battery Audio</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="pushButton_logout"> + <property name="text"> + <string>Set Logout Audio</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="label_battery"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>TextLabel</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QCheckBox" name="checkBox_battery"> + <property name="text"> + <string>Enabled</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_startup"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>TextLabel</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="label_logout"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>TextLabel</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="3" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> </item> </layout> </widget> |