diff options
Diffstat (limited to 'src-qt5/core-utils/lumina-config/pages')
12 files changed, 460 insertions, 124 deletions
diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.cpp b/src-qt5/core-utils/lumina-config/pages/getPage.cpp index 79eb18f6..c3f88e2c 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.cpp +++ b/src-qt5/core-utils/lumina-config/pages/getPage.cpp @@ -9,7 +9,7 @@ //Add any sub-pages here #include "page_main.h" #include "page_wallpaper.h" -#include "page_theme.h" +//#include "page_theme.h" #include "page_autostart.h" #include "page_defaultapps.h" #include "page_fluxbox_keys.h" @@ -20,6 +20,7 @@ #include "page_session_locale.h" #include "page_session_options.h" #include "page_compton.h" +#include "page_soundtheme.h" // #include "page_mouse_trueos.h" // #include "page_bluetooth_trueos.h" @@ -40,7 +41,7 @@ QList<PAGEINFO> Pages::KnownPages(){ QList<PAGEINFO> list; //Reminder: <ID>, <name>, <title>, <icon>, <comment>, <category>, <server subsytem list>, <search tags> list << Pages::PageInfo("wallpaper", QObject::tr("Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "image"); - list << Pages::PageInfo("theme", QObject::tr("Theme"), QObject::tr("Theme Settings"), "preferences-desktop-theme",QObject::tr("Change interface fonts and colors"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "theme" << "plugins"); + list << Pages::PageInfo(LUtils::AppToAbsolute("lthemeengine.desktop"), QObject::tr("Theme"), QObject::tr("Theme Settings"), "preferences-desktop-theme",QObject::tr("Change interface fonts and colors"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "theme" << "plugins"); list << Pages::PageInfo("compton", QObject::tr("Window Effects"), QObject::tr("Window Effects"), "window-duplicate",QObject::tr("Adjust transparency levels and window effects"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "transparency" << "windows" << "compositing"); list << Pages::PageInfo("autostart", QObject::tr("Autostart"), QObject::tr("Startup Settings"), "preferences-system-session-services",QObject::tr("Automatically start applications or services"), "session", QStringList(), QStringList() << "apps" << "autostart" << "services" << "xdg" << "startup" << "session"); list << Pages::PageInfo("defaultapps", QObject::tr("Applications"), QObject::tr("Mimetype Settings"), "preferences-desktop-default-applications",QObject::tr("Change default applications"), "session", QStringList(), QStringList() << "apps" << "default" << "services" << "xdg" << "session"); @@ -51,6 +52,7 @@ QList<PAGEINFO> Pages::KnownPages(){ list << Pages::PageInfo("interface-menu", QObject::tr("Menu"), QObject::tr("Menu Plugins"), "format-list-unordered",QObject::tr("Change what options are shown on the desktop context menu"), "interface", QStringList(), QStringList() << "desktop" << "menu" << "plugins" << "shortcuts"); list << Pages::PageInfo("session-locale", QObject::tr("Localization"), QObject::tr("Locale Settings"), "preferences-desktop-locale",QObject::tr("Change the default locale settings for this user"), "user", QStringList(), QStringList() << "user"<<"locale"<<"language"<<"translations"); list << Pages::PageInfo("session-options", QObject::tr("General Options"), QObject::tr("User Settings"), "configure",QObject::tr("Change basic user settings such as time/date formats"), "user", QStringList(), QStringList() << "user"<<"settings"<<"time"<<"date"<<"icon"<<"reset"<<"numlock"<<"clock"); + list << Pages::PageInfo("soundtheme", QObject::tr("Sound Themeing"), QObject::tr("Theme"), "media-playlist-audio",QObject::tr("Change basic sound settings"), "session", QStringList(), QStringList() << "session"<<"settings"<<"sound"<<"theme"); // list << Pages::PageInfo("mouse-settings", QObject::tr("TrueOS Mouse Settings"), QObject::tr("TrueOS Mouse Settings"), "preferences-desktop-mouse",QObject::tr("Adjust mouse devices"), "user", QStringList(), QStringList() << "user"<<"speed"<<"accel"<<"mouse"); // list << Pages::PageInfo("bluetooth-settings", QObject::tr("TrueOS Bluetooth Settings"), QObject::tr("TrueOS Bluetooth Settings"), "preferences-desktop-bluetooth",QObject::tr("Setup Bluetooth devices"), "user", QStringList(), QStringList() << "user"<<"bluetooth"<<"audio"); @@ -61,7 +63,7 @@ PageWidget* Pages::GetNewPage(QString id, QWidget *parent){ //Find the page that matches this "id" PageWidget* page = 0; if(id=="wallpaper"){ page = new page_wallpaper(parent); } - else if(id=="theme"){ page = new page_theme(parent); } + //else if(id=="theme"){ page = new page_theme(parent); } else if(id=="autostart"){ page = new page_autostart(parent); } else if(id=="defaultapps"){ page = new page_defaultapps(parent); } else if(id=="fluxbox-keys"){ page = new page_fluxbox_keys(parent); } @@ -72,7 +74,7 @@ PageWidget* Pages::GetNewPage(QString id, QWidget *parent){ else if(id=="session-locale"){ page = new page_session_locale(parent); } else if(id=="session-options"){ page = new page_session_options(parent); } else if(id=="compton"){ page = new page_compton(parent); } - + else if(id=="soundtheme"){ page = new page_soundtheme(parent); } // else if(id=="mouse-settings"){ page = new page_mouse_trueos(parent); } // else if(id=="bluetooth-settings"){ page = new page_bluetooth_trueos(parent); } //Return the main control_panel page as the fallback/default diff --git a/src-qt5/core-utils/lumina-config/pages/page_defaultapps.cpp b/src-qt5/core-utils/lumina-config/pages/page_defaultapps.cpp index c2d689ec..df7ae516 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_defaultapps.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_defaultapps.cpp @@ -245,7 +245,7 @@ void page_defaultapps::setdefaultitem(){ //Now set the items for(int i=0; i<list.length(); i++){ //Set it in the back end - LXDG::setDefaultAppForMime(list[i]->whatsThis(0), app.section("/",-1)); + LXDG::setDefaultAppForMime(list[i]->whatsThis(0), app); //Set it in the UI XDGDesktop desk(app); list[i]->setWhatsThis(1,app); //app path diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp index 48f1d17c..61c089fa 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp @@ -6,6 +6,8 @@ //=========================================== #include "page_interface_panels.h" #include "ui_page_interface_panels.h" +#include <QInputDialog> + #include "../GetPluginDialog.h" #include "../AppDialog.h" @@ -19,7 +21,6 @@ page_interface_panels::page_interface_panels(QWidget *parent) : PageWidget(paren settings = new QSettings("lumina-desktop","desktopsettings"); connect(ui->tool_panels_add, SIGNAL(clicked()), this, SLOT(newPanel()) ); updateIcons(); - setupProfiles(); //Create panels container QHBoxLayout *panels_layout = new QHBoxLayout(); @@ -61,7 +62,7 @@ void page_interface_panels::LoadSettings(int screennum){ int panelnumber = settings->value(DPrefix+"panels",-1).toInt(); if(panelnumber<0){ panelnumber = 0; } QHBoxLayout *panels_layout = static_cast<QHBoxLayout*>(ui->scroll_panels->widget()->layout()); - + //Remove extra panels (if any) for(int i=panelnumber; i<PANELS.length(); i++){ PanelWidget *tmp = PANELS.takeAt(i); @@ -87,20 +88,25 @@ void page_interface_panels::LoadSettings(int screennum){ QApplication::processEvents(); loading = false; - setupImports(); + setupProfiles(); } void page_interface_panels::updateIcons(){ ui->tool_panels_add->setIcon( LXDG::findIcon("list-add","") ); - ui->tool_profile->setIcon( LXDG::findIcon("border-color","") ); - ui->tool_import->setIcon( LXDG::findIcon("document-import","") ); + ui->tool_profile->setIcon( LXDG::findIcon("document-import","") ); } //================= -// PRIVATE +// PRIVATE //================= void page_interface_panels::setupProfiles(){ - ui->tool_profile->setMenu( new QMenu(this) ); + //qDebug() << "Start loading profiles"; + if(ui->tool_profile->menu()==0){ + ui->tool_profile->setMenu( new QMenu(this) ); + connect(ui->tool_profile->menu(), SIGNAL(triggered(QAction*)), this, SLOT(applyProfile(QAction*)) ); + } + else{ ui->tool_profile->menu()->clear(); } + ui->tool_profile->menu()->addSection("Profiles"); QAction *act = ui->tool_profile->menu()->addAction(tr("No Panels")); act->setWhatsThis("none"); act = ui->tool_profile->menu()->addAction("Windows"); @@ -110,29 +116,39 @@ void page_interface_panels::setupProfiles(){ act = ui->tool_profile->menu()->addAction("XFCE"); act->setWhatsThis("xfce"); act = ui->tool_profile->menu()->addAction("Mac OSX"); - act->setWhatsThis("osx"); - connect(ui->tool_profile->menu(), SIGNAL(triggered(QAction*)), this, SLOT(applyProfile(QAction*)) ); -} + act->setWhatsThis("osx"); -void page_interface_panels::setupImports(){ - if(ui->tool_import->menu()==0){ ui->tool_import->setMenu( new QMenu(this) ); } - else{ ui->tool_import->menu()->clear(); } - //Read all the various disk settings currently saved - QStringList other = settings->childGroups().filter("panel_"); - qDebug() << "Found Other Settings:" << other; - for(int i=0; i<other.length(); i++){ - other[i] = other[i].section("_",1,-1).section(".",0,-2); - } - other.removeDuplicates(); + //Add in any custom profiles + //qDebug() << " - read settings"; + QStringList profilesAll = settings->childGroups().filter("panel_"); + //qDebug() << " - get current screen"; QString current = QApplication::screens().at(cscreen)->name(); - for(int i=0; i<other.length(); i++){ - if(other[i]==current){ continue; } //don't show the current settings - QAction *act = ui->tool_import->menu()->addAction(other[i]); - act->setWhatsThis(other[i]); + //qDebug() << " - filter list"; + for(int i=0; i<profilesAll.length(); i++){ + profilesAll[i] = profilesAll[i].section("_",1,-1).section(".",0,-2); + } + //qDebug() << "Found Profiles:" << profilesAll; + profilesAll.removeDuplicates(); + profilesAll.removeAll(current); + QStringList profiles = profilesAll.filter("profile_"); + for(int p=0; p<2; p++){ + if(p==1){ profiles = profilesAll; } //use whats left of the total list + ui->tool_profile->menu()->addSection( p==0 ? tr("Custom Profiles") : tr("Copy Screen") ); + for(int i=0; i<profiles.length(); i++){ + if(p==0){ profilesAll.removeAll(profiles[i]); } //handling it now + QString title = profiles[i]; + if(title.startsWith("profile_")){ title = title.section("profile_",-1); } + QMenu *tmp = new QMenu(ui->tool_profile->menu()); + tmp->setTitle(title); + tmp->addAction(LXDG::findIcon("dialog-ok-apply",""), tr("Apply"))->setWhatsThis("profile_apply::::"+profiles[i]); + tmp->addAction(LXDG::findIcon("list-remove",""), tr("Delete"))->setWhatsThis("profile_remove::::"+profiles[i]); + ui->tool_profile->menu()->addMenu(tmp); + } + if(p==0){ + //Now add the option to create a new profile + ui->tool_profile->menu()->addAction(LXDG::findIcon("list-add",""), tr("Create Profile"))->setWhatsThis("profile_new"); + } } - - connect(ui->tool_import->menu(), SIGNAL(triggered(QAction*)), this, SLOT(applyImport(QAction*)) ); - ui->tool_import->setEnabled(!ui->tool_import->menu()->isEmpty()); } //================= @@ -161,7 +177,7 @@ void page_interface_panels::newPanel(){ panelValChanged(); } -void page_interface_panels::removePanel(int pan){ +void page_interface_panels::removePanel(int pan){ //connected to a signal from the panel widget bool changed = false; for(int i=0; i<PANELS.length(); i++){ @@ -180,6 +196,35 @@ void page_interface_panels::removePanel(int pan){ } void page_interface_panels::applyProfile(QAction *act){ + QString wt = act->whatsThis(); + if(wt.startsWith("profile_")){ + //qDebug() << "Got Profile Action:" << wt; + if(wt=="profile_new"){ + bool ok = false; + QString pname = QInputDialog::getText(this, tr("Create Profile"), tr("Name:"), QLineEdit::Normal, "", &ok,Qt::WindowFlags(), Qt::ImhUppercaseOnly | Qt::ImhLowercaseOnly ); + if(!ok || pname.isEmpty()){ return; } //cancelled + pname = pname.replace(".","_").replace("/","_"); + qDebug() << " - Make new profile:" << pname; + pname.prepend("profile_"); + settings->setValue("desktop-"+pname+"/panels", PANELS.length()); + for(int i=0; i<PANELS.length(); i++){ + PANELS[i]->SaveSettings(settings, pname); + } + settings->sync(); //save to disk right now + setupProfiles(); + }else if(wt.startsWith("profile_apply::::") ){ + applyImport(wt.section("::::",-1) ); + }else if(wt.startsWith("profile_remove::::") ){ + QString pname = wt.section("::::",-1); + QStringList keys = settings->allKeys().filter(pname); + for(int i=0; i<keys.length(); i++){ + if(keys[i].section("/",0,0).contains(pname)){ settings->remove(keys[i]); } + } + setupProfiles(); + } + return; + } + //Manually saving settings based on built-in profile QString screenID = QApplication::screens().at(cscreen)->name(); QString DPrefix = "desktop-"+screenID+"/"; QString PPrefix = "panel_"+screenID+"."; //NEED TO APPEND PANEL NUMBER (0+) @@ -261,14 +306,22 @@ void page_interface_panels::applyProfile(QAction *act){ } void page_interface_panels::applyImport(QAction *act){ + applyImport(act->whatsThis()); +} + +void page_interface_panels::applyImport(QString fromID){ QString cID = QApplication::screens().at(cscreen)->name(); - QString fromID = act->whatsThis(); //QString DPrefix = "desktop-"+screenID+"/"; qDebug() << "Import Panels from " << fromID << " to " << cID; - //First change the number of panels on the desktop settings - settings->setValue("desktop-"+cID+"/panels", settings->value("desktop-"+fromID+"/panels")); - //Now move over all the panels associated with the fromID - QStringList pans = settings->allKeys().filter("panel_"+fromID); + //First find all the values associated with this ID + int pannum = settings->value("desktop-"+fromID+"/panels").toInt(); + QStringList pans = settings->allKeys().filter("panel_"+fromID); + fromID.prepend("panel_"); + + //save the number of panels which is active + settings->setValue("desktop-"+cID+"/panels", pannum); + //Now move over all the panel settings associated with the fromID + cID.prepend("panel_"); for(int i=0; i<pans.length(); i++){ QString newvar = pans[i]; newvar.replace(fromID, cID); diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.h b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.h index 0008b75f..163fd9f4 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.h +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.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_INTERFACE_PANELS_H #define _LUMINA_CONFIG_PAGE_INTERFACE_PANELS_H @@ -37,7 +37,6 @@ private: QList<PanelWidget*> PANELS; void setupProfiles(); - void setupImports(); private slots: void panelValChanged(); @@ -45,5 +44,6 @@ private slots: void removePanel(int); //connected to a signal from the panel widget void applyProfile(QAction*); void applyImport(QAction*); + void applyImport(QString fromID); }; #endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.ui b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.ui index 412d19f6..e8c2a029 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_interface_panels.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.ui @@ -112,40 +112,6 @@ </property> </widget> </item> - <item> - <widget class="QToolButton" name="tool_import"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="toolTip"> - <string>Import</string> - </property> - <property name="text"> - <string/> - </property> - <property name="iconSize"> - <size> - <width>25</width> - <height>25</height> - </size> - </property> - <property name="popupMode"> - <enum>QToolButton::InstantPopup</enum> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonIconOnly</enum> - </property> - </widget> - </item> </layout> </item> <item> @@ -164,7 +130,7 @@ <rect> <x>0</x> <y>0</y> - <width>358</width> + <width>357</width> <height>298</height> </rect> </property> diff --git a/src-qt5/core-utils/lumina-config/pages/page_main.cpp b/src-qt5/core-utils/lumina-config/pages/page_main.cpp index 13a3cfbd..bb0de962 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_main.cpp @@ -44,7 +44,7 @@ void page_main::setPreviousPage(QString id){ } } } - + } void page_main::UpdateItems(QString search){ @@ -87,15 +87,15 @@ void page_main::UpdateItems(QString search){ //qDebug() << "Item Found:" << INFO[i].id << INFO[i].title; int col = 0; QTreeWidgetItem *lastIt = 0; - if(INFO[i].category=="interface" && interface->childCount()>0 ){ + if(INFO[i].category=="interface" && interface->childCount()>0 ){ if( interface->child( interface->childCount()-1)->text(1).isEmpty() ){ lastIt = interface->child(interface->childCount()-1); } }else if(INFO[i].category=="appearance" && appearance->childCount()>0 ){ if( appearance->child(appearance->childCount()-1)->text(1).isEmpty() ){ lastIt = appearance->child(appearance->childCount()-1); } - }else if(INFO[i].category=="session" && session->childCount()>0 ){ + }else if(INFO[i].category=="session" && session->childCount()>0 ){ if( session->child( session->childCount()-1)->text(1).isEmpty() ){ lastIt = session->child(session->childCount()-1); } - }else if(INFO[i].category=="user" && user->childCount()>0 ){ + }else if(INFO[i].category=="user" && user->childCount()>0 ){ if( user->child( user->childCount()-1)->text(1).isEmpty() ){ lastIt = user->child(user->childCount()-1); } - }else if(INFO[i].category=="system" && system->childCount()>0 ){ + }else if(INFO[i].category=="system" && system->childCount()>0 ){ if( system->child( system->childCount()-1)->text(1).isEmpty() ){ lastIt = system->child(system->childCount()-1); } } if(lastIt==0){ lastIt = new QTreeWidgetItem(); col = 0;} @@ -125,7 +125,7 @@ void page_main::UpdateItems(QString search){ ui->treeWidget->resizeColumnToContents(1); //Now make sure the width of the tree widget is greater/equal to the recommended size - int wid = ui->treeWidget->indentation() + 10; + int wid = ui->treeWidget->indentation() + 10; for(int i=0; i<ui->treeWidget->columnCount(); i++){ wid += ui->treeWidget->columnWidth(i); } @@ -194,7 +194,7 @@ void page_main::showFind(){ void page_main::itemTriggered(QTreeWidgetItem *it, int col){ if(it->childCount()>0){ - it->setExpanded( !it->isExpanded() ); + it->setExpanded( !it->isExpanded() ); it->setSelected(false); }else if(!it->whatsThis(col).isEmpty()){ QString id = it->whatsThis(col); diff --git a/src-qt5/core-utils/lumina-config/pages/page_soundtheme.cpp b/src-qt5/core-utils/lumina-config/pages/page_soundtheme.cpp new file mode 100644 index 00000000..fbb0e7e7 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_soundtheme.cpp @@ -0,0 +1,113 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2017, JT (q5sys) +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_soundtheme.h" +#include "ui_page_soundtheme.h" +#include "../AppDialog.h" + +//========== +// PUBLIC +//========== +page_soundtheme::page_soundtheme(QWidget *parent) : PageWidget(parent), ui(new Ui::page_soundtheme()){ + ui->setupUi(this); +} + +page_soundtheme::~page_soundtheme(){ + +} + +//================ +// PUBLIC SLOTS +//================ +void page_soundtheme::SaveSettings(){ + sessionsettings = new QSettings("lumina-desktop", "sessionsettings"); + + sessionsettings->setValue("PlayStartupAudio", ui->checkBox_startup->isChecked()); + sessionsettings->setValue("audiofiles/login", ui->label_startup->whatsThis()); + + sessionsettings->setValue("PlayLogoutAudio", ui->checkBox_logout->isChecked()); + sessionsettings->setValue("audiofiles/logout", ui->label_logout->whatsThis()); + + sessionsettings->setValue("PlayBatteryLowAudio", ui->checkBox_battery->isChecked()); + sessionsettings->setValue("audiofiles/batterylow", ui->label_battery->whatsThis()); + +} + +void page_soundtheme::LoadSettings(int){ + emit ChangePageTitle( tr("Sound Themes") ); + + sessionsettings = new QSettings("lumina-desktop", "sessionsettings"); + + ui->label_startup->setText(sessionsettings->value("audiofiles/login").toString().section("/",-1)); + ui->label_startup->setToolTip(sessionsettings->value("audiofiles/batterylow").toString()); + ui->label_startup->setWhatsThis(sessionsettings->value("audiofiles/login").toString()); + bool playstartup = sessionsettings->value("PlayStartupAudio").toBool(); + if( playstartup ){ ui->checkBox_startup->setChecked(true); } + + ui->label_logout->setText(sessionsettings->value("audiofiles/logout").toString().section("/",-1)); + ui->label_startup->setToolTip(sessionsettings->value("audiofiles/batterylow").toString()); + ui->label_logout->setWhatsThis(sessionsettings->value("audiofiles/logout").toString()); + bool playlogout = sessionsettings->value("PlayLogoutAudio").toBool(); + if( playlogout ){ ui->checkBox_logout->setChecked(true); } + + ui->label_battery->setText(sessionsettings->value("audiofiles/batterylow").toString().section("/",-1)); + ui->label_startup->setToolTip(sessionsettings->value("audiofiles/batterylow").toString()); + ui->label_battery->setWhatsThis(sessionsettings->value("audiofiles/batterylow").toString()); + bool playbattery = sessionsettings->value("PlayBatteryLowAudio").toBool(); + if( playbattery ){ ui->checkBox_battery->setChecked(true);} + emit HasPendingChanges(false); +} + +//================= +// PRIVATE +//================= + +//================= +// PRIVATE SLOTS +//================= + +void page_soundtheme::on_pushButton_startup_clicked(){ + QString startupsound = QFileDialog::getOpenFileName(this, tr("Select Startup Sound"), QDir::homePath()); + if(startupsound.isEmpty()){ return; } + ui->label_startup->setText(startupsound.section("/",-1)); + ui->label_startup->setToolTip(startupsound); + ui->label_startup->setWhatsThis(startupsound); + settingChanged(); + qDebug() << "startup whats this" << startupsound; +} + +void page_soundtheme::on_pushButton_logout_clicked(){ + QString logoutsound = QFileDialog::getOpenFileName(this, tr("Select Logout Sound"), QDir::homePath()); + if(logoutsound.isEmpty()){ return; } + ui->label_logout->setText(logoutsound.section("/",-1)); + ui->label_logout->setToolTip(logoutsound); + ui->label_logout->setWhatsThis(logoutsound); + qDebug() << "startup whats this" << logoutsound; + settingChanged(); +} + +void page_soundtheme::on_pushButton_battery_clicked(){ + QString batterysound = QFileDialog::getOpenFileName(this, tr("Select Low Battery Sound"), QDir::homePath()); + if(batterysound.isEmpty()){ return; } + ui->label_battery->setText(batterysound.section("/",-1)); + ui->label_battery->setToolTip(batterysound); + ui->label_battery->setWhatsThis(batterysound); + qDebug() << "startup whats this" << batterysound; + settingChanged(); +} + + +void page_soundtheme::on_checkBox_startup_toggled(bool checked){ + settingChanged(); +} + +void page_soundtheme::on_checkBox_logout_toggled(bool checked){ + settingChanged(); +} + +void page_soundtheme::on_checkBox_battery_toggled(bool checked){ + settingChanged(); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_soundtheme.h b/src-qt5/core-utils/lumina-config/pages/page_soundtheme.h new file mode 100644 index 00000000..5d3bed66 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_soundtheme.h @@ -0,0 +1,42 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2017, JT (q5sys) +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_SOUNDTHEME_H +#define _LUMINA_CONFIG_PAGE_SOUNDTHEME_H +#include "../globals.h" +#include "PageWidget.h" + +namespace Ui{ + class page_soundtheme; +}; + +class page_soundtheme : public PageWidget{ + Q_OBJECT +public: + page_soundtheme(QWidget *parent); + ~page_soundtheme(); + +public slots: + + void SaveSettings(); + void LoadSettings(int screennum); + + +private: + Ui::page_soundtheme *ui; + QString startupsound, logoutsound, batterysound; + QSettings *sessionsettings; + +private slots: + + void on_pushButton_startup_clicked(); + void on_pushButton_logout_clicked(); + void on_pushButton_battery_clicked(); + void on_checkBox_startup_toggled(bool checked); + void on_checkBox_logout_toggled(bool checked); + void on_checkBox_battery_toggled(bool checked); +}; +#endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_soundtheme.ui b/src-qt5/core-utils/lumina-config/pages/page_soundtheme.ui new file mode 100644 index 00000000..329b68a4 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_soundtheme.ui @@ -0,0 +1,156 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>page_soundtheme</class> + <widget class="QWidget" name="page_soundtheme"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>455</width> + <height>326</height> + </rect> + </property> + <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> + </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> + <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> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/src-qt5/core-utils/lumina-config/pages/page_theme.cpp b/src-qt5/core-utils/lumina-config/pages/page_theme.cpp index 52579ec2..42f7d9de 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_theme.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_theme.cpp @@ -69,35 +69,35 @@ ui->combo_session_themefile->clear(); // - local theme templates QStringList tmp = LTHEME::availableLocalThemes(); tmp.sort(); - for(int i=0; i<tmp.length(); i++){ + for(int i=0; i<tmp.length(); i++){ ui->combo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1)); if(tmp[i].section("::::",1,1)==current[0]){ ui->combo_session_themefile->setCurrentIndex(ui->combo_session_themefile->count()-1); } } // - system theme templates tmp = LTHEME::availableSystemThemes(); tmp.sort(); - for(int i=0; i<tmp.length(); i++){ + for(int i=0; i<tmp.length(); i++){ ui->combo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1)); if(tmp[i].section("::::",1,1)==current[0]){ ui->combo_session_themefile->setCurrentIndex(ui->combo_session_themefile->count()-1); } } // - local color schemes tmp = LTHEME::availableLocalColors(); tmp.sort(); - for(int i=0; i<tmp.length(); i++){ + for(int i=0; i<tmp.length(); i++){ ui->combo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1)); if(tmp[i].section("::::",1,1)==current[1]){ ui->combo_session_colorfile->setCurrentIndex(ui->combo_session_colorfile->count()-1); } } // - system color schemes tmp = LTHEME::availableSystemColors(); tmp.sort(); - for(int i=0; i<tmp.length(); i++){ + for(int i=0; i<tmp.length(); i++){ ui->combo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1)); if(tmp[i].section("::::",1,1)==current[1]){ ui->combo_session_colorfile->setCurrentIndex(ui->combo_session_colorfile->count()-1); } } // - icon themes tmp = LTHEME::availableSystemIcons(); tmp.sort(); - for(int i=0; i<tmp.length(); i++){ + for(int i=0; i<tmp.length(); i++){ ui->combo_session_icontheme->addItem(tmp[i]); if(tmp[i]==current[2]){ ui->combo_session_icontheme->setCurrentIndex(i); } } @@ -105,14 +105,14 @@ ui->combo_session_themefile->clear(); ui->font_session_theme->setCurrentFont( QFont(current[3]) ); // - Font Size ui->spin_session_fontsize->setValue( current[4].section("p",0,0).toInt() ); - + int cur = ui->combo_session_cursortheme->findText( LTHEME::currentCursor() ); if(cur>=0){ ui->combo_session_cursortheme->setCurrentIndex(cur); } QSettings sessionsettings("lumina-desktop","sessionsettings"); - QString qt5theme = sessionsettings.value("Qt5_theme_engine", "").toString(); + QString qt5theme = sessionsettings.value("Qt5_theme_engine", "lthemeengine").toString(); int index = ui->combo_qt5_theme->findData(qt5theme); - if(index <0){ + if(index <0){ ui->line_qt5_custom_theme->setText(qt5theme); index = ui->combo_qt5_theme->findData("internal_custom"); } @@ -130,7 +130,7 @@ void page_theme::updateIcons(){ } //================= -// PRIVATE +// PRIVATE //================= void page_theme::findQt5Themes(){ ui->combo_qt5_theme->clear(); @@ -169,14 +169,14 @@ void page_theme::sessionEditColor(){ ui->combo_session_colorfile->clear(); QStringList tmp = LTHEME::availableLocalColors(); tmp.sort(); - for(int i=0; i<tmp.length(); i++){ + for(int i=0; i<tmp.length(); i++){ ui->combo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1)); if(tmp[i].section("::::",1,1)==dlg.colorpath){ ui->combo_session_colorfile->setCurrentIndex(ui->combo_session_colorfile->count()-1); } } // - system color schemes tmp = LTHEME::availableSystemColors(); tmp.sort(); - for(int i=0; i<tmp.length(); i++){ + for(int i=0; i<tmp.length(); i++){ ui->combo_session_colorfile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1)); if(tmp[i].section("::::",1,1)==dlg.colorpath){ ui->combo_session_colorfile->setCurrentIndex(ui->combo_session_colorfile->count()-1); } } @@ -195,14 +195,14 @@ void page_theme::sessionEditTheme(){ // - local theme templates QStringList tmp = LTHEME::availableLocalThemes(); tmp.sort(); - for(int i=0; i<tmp.length(); i++){ + for(int i=0; i<tmp.length(); i++){ ui->combo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("Local")+")", tmp[i].section("::::",1,1)); if(tmp[i].section("::::",1,1)==dlg.themepath){ ui->combo_session_themefile->setCurrentIndex(ui->combo_session_themefile->count()-1); } } // - system theme templates tmp = LTHEME::availableSystemThemes(); tmp.sort(); - for(int i=0; i<tmp.length(); i++){ + for(int i=0; i<tmp.length(); i++){ ui->combo_session_themefile->addItem(tmp[i].section("::::",0,0)+" ("+tr("System")+")", tmp[i].section("::::",1,1)); if(tmp[i].section("::::",1,1)==dlg.themepath){ ui->combo_session_themefile->setCurrentIndex(ui->combo_session_themefile->count()-1); } } diff --git a/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp index 6842dce4..aef0493f 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp @@ -144,7 +144,19 @@ void page_wallpaper::deskbgchanged(){ }else{ QString path = ui->combo_desk_bg->itemData( ui->combo_desk_bg->currentIndex() ).toString(); if(path=="default"){ path = DEFAULTBG; } - if(QFile::exists(path)){ + if(QFileInfo(path).isDir()){ + QDir dir(path); + //Got a directory - go ahead and get all the valid image files + QStringList imgs = LUtils::imageExtensions(); + for(int i=0; i<imgs.length(); i++){ imgs[i].prepend("*."); } + QStringList files = dir.entryList(imgs, QDir::Files | QDir::NoDotAndDotDot, QDir::Name); + //Now update the item/text + ui->combo_desk_bg->setItemIcon(ui->combo_desk_bg->currentIndex(), LXDG::findIcon("folder-image","folder")); + ui->label_desk_bgview->setPixmap(QPixmap()); + ui->label_desk_bgview->setText( QString(tr("Image Directory: %1 valid images")).arg(QString::number(files.length()) )); + ui->label_desk_bgview->setStyleSheet(""); + ui->label_desk_bgview->setToolTip(files.join("\n")); + }else if(QFile::exists(path)){ QSize sz = ui->label_desk_bgview->size(); sz.setWidth( sz.width() - (2*ui->label_desk_bgview->frameWidth()) ); sz.setHeight( sz.height() - (2*ui->label_desk_bgview->frameWidth()) ); @@ -153,14 +165,17 @@ void page_wallpaper::deskbgchanged(){ ui->label_desk_bgview->setPixmap( pix.scaled(sz, Qt::KeepAspectRatio, Qt::SmoothTransformation) ); ui->combo_desk_bg->setItemIcon(ui->combo_desk_bg->currentIndex(), pix.scaled(64,64) ); ui->label_desk_bgview->setStyleSheet(""); + ui->label_desk_bgview->setToolTip(""); }else if(path.startsWith("rgb(")){ ui->label_desk_bgview->setPixmap(QPixmap()); ui->label_desk_bgview->setText(""); ui->label_desk_bgview->setStyleSheet("background-color: "+path+";"); + ui->label_desk_bgview->setToolTip(""); }else{ ui->label_desk_bgview->setPixmap(QPixmap()); ui->label_desk_bgview->setText(tr("File does not exist")); ui->label_desk_bgview->setStyleSheet(""); + ui->label_desk_bgview->setToolTip(""); } } //See if this constitues a change to the current settings and enable the save button @@ -221,7 +236,7 @@ void page_wallpaper::deskbgcoloradded(){ ui->combo_desk_bg->addItem( QString(tr("Solid Color: %1")).arg(color), color); //Now move to the last item in the list (the new image(s)); ui->combo_desk_bg->setCurrentIndex( ui->combo_desk_bg->count()-1 ); - + emit HasPendingChanges(true); } @@ -233,20 +248,13 @@ void page_wallpaper::deskbgdiradded(){ dir = QFileDialog::getExistingDirectory(this, tr("Find Background Image Directory"), dir, QFileDialog::ReadOnly); if(dir.isEmpty()){ return; } //Got a directory - go ahead and find all the valid image files within it - QStringList imgs = LUtils::imageExtensions(); - for(int i=0; i<imgs.length(); i++){ imgs[i].prepend("*."); } - QDir qdir(dir); - QStringList bgs = qdir.entryList(imgs, QDir::Files | QDir::NoDotAndDotDot, QDir::Name); - if(bgs.isEmpty()){ return; } - for(int i=0; i<bgs.length(); i++){ - ui->combo_desk_bg->addItem( bgs[i], qdir.absoluteFilePath(bgs[i])); - } + ui->combo_desk_bg->addItem(dir.section("/",-1), dir); //Now move to the last item in the list (the new image(s)); ui->combo_desk_bg->setCurrentIndex( ui->combo_desk_bg->count()-1 ); //If multiple items selected, automatically enable the background rotation option - if(bgs.length() > 1 && !ui->radio_desk_multi->isChecked()){ + /*if(bgs.length() > 1 && !ui->radio_desk_multi->isChecked()){ ui->radio_desk_multi->setChecked(true); - } + }*/ emit HasPendingChanges(true); } @@ -263,21 +271,14 @@ void page_wallpaper::deskbgdirradded(){ //Now load the directory and add all the valid files QStringList dirs = LUtils::listSubDirectories(dir, true); //find/list all the dirs dirs.prepend(dir); //make sure the main dir is also listed - QStringList bgs; for(int d=0; d<dirs.length(); d++){ - QDir qdir(dirs[d]); - QStringList tmp = qdir.entryList(imgs, QDir::Files | QDir::NoDotAndDotDot, QDir::Name); - for(int j=0; j<tmp.length(); j++){ bgs << qdir.absoluteFilePath(tmp[j]); } - } - //Now add all the files into the widget - for(int i=0; i<bgs.length(); i++){ - ui->combo_desk_bg->addItem( bgs[i].section("/",-1), bgs[i] ); + ui->combo_desk_bg->addItem(dirs[d].section("/",-1), dirs[d]); } //Now move to the last item in the list (the new image(s)); ui->combo_desk_bg->setCurrentIndex( ui->combo_desk_bg->count()-1 ); //If multiple items selected, automatically enable the background rotation option - if(bgs.length() > 1 && !ui->radio_desk_multi->isChecked()){ + if(dirs.length() > 1 && !ui->radio_desk_multi->isChecked()){ ui->radio_desk_multi->setChecked(true); } - emit HasPendingChanges(true); + emit HasPendingChanges(true); } diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index 136a8613..585a2922 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -3,7 +3,7 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/PageWidget.h \ $${PWD}/page_main.h \ $${PWD}/page_wallpaper.h \ - $${PWD}/page_theme.h \ +# $${PWD}/page_theme.h \ $${PWD}/page_autostart.h \ $${PWD}/page_defaultapps.h \ $${PWD}/page_fluxbox_keys.h \ @@ -13,15 +13,16 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/page_interface_panels.h \ $${PWD}/page_session_locale.h \ $${PWD}/page_session_options.h \ - $${PWD}/page_compton.h -# $${PWD}/page_bluetooth_trueos.h + $${PWD}/page_compton.h \ + $$PWD/page_soundtheme.h +# $${PWD}/page_bluetooth_trueos.h # $${PWD}/page_mouse_trueos.h SOURCES += $${PWD}/getPage.cpp \ $${PWD}/page_main.cpp \ $${PWD}/page_wallpaper.cpp \ - $${PWD}/page_theme.cpp \ +# $${PWD}/page_theme.cpp \ $${PWD}/page_autostart.cpp \ $${PWD}/page_defaultapps.cpp \ $${PWD}/page_fluxbox_keys.cpp \ @@ -31,7 +32,8 @@ SOURCES += $${PWD}/getPage.cpp \ $${PWD}/page_interface_panels.cpp \ $${PWD}/page_session_locale.cpp \ $${PWD}/page_session_options.cpp \ - $${PWD}/page_compton.cpp + $${PWD}/page_compton.cpp \ + $$PWD/page_soundtheme.cpp # $${PWD}/page_bluetooth_trueos.cpp # $${PWD}/page_mouse_trueos.cpp @@ -39,7 +41,7 @@ SOURCES += $${PWD}/getPage.cpp \ FORMS += $${PWD}/page_main.ui \ $${PWD}/page_wallpaper.ui \ - $${PWD}/page_theme.ui \ +# $${PWD}/page_theme.ui \ $${PWD}/page_autostart.ui \ $${PWD}/page_defaultapps.ui \ $${PWD}/page_fluxbox_keys.ui \ @@ -49,6 +51,7 @@ FORMS += $${PWD}/page_main.ui \ $${PWD}/page_interface_panels.ui \ $${PWD}/page_session_locale.ui \ $${PWD}/page_session_options.ui \ - $${PWD}/page_compton.ui + $${PWD}/page_compton.ui \ + $$PWD/page_soundtheme.ui # $${PWD}/page_bluetooth_trueos.ui # $${PWD}/page_mouse_trueos.ui |