diff options
Diffstat (limited to 'src-qt5/core-utils')
8 files changed, 331 insertions, 7 deletions
diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.cpp b/src-qt5/core-utils/lumina-config/pages/getPage.cpp index 7274ae3f..c3f88e2c 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.cpp +++ b/src-qt5/core-utils/lumina-config/pages/getPage.cpp @@ -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" @@ -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"); @@ -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_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_wallpaper.cpp b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp index 6842dce4..839269ca 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp @@ -221,7 +221,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); } diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index ce167d27..585a2922 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -13,8 +13,9 @@ 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 @@ -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 @@ -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 diff --git a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp index 3c0edc76..a9d40554 100644 --- a/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp +++ b/src-qt5/core-utils/lumina-xconfig/ScreenSettings.cpp @@ -13,6 +13,7 @@ void RRSettings::ApplyPrevious(){ QList<ScreenInfo> screens; QSettings set("lumina-desktop","lumina-xconfig"); + if(set.allKeys().isEmpty()){ return; } QString profile = set.value("default_profile","").toString(); if(profile.isEmpty() || !savedProfiles().contains(profile) ){ screens = PreviousSettings(); } else{ screens = PreviousSettings(profile); } @@ -167,6 +168,13 @@ bool RRSettings::SaveScreens(QList<ScreenInfo> screens, QString profile){ //Apply screen configuration void RRSettings::Apply(QList<ScreenInfo> screens){ + //Verify that there is at least 1 active/enabled monitor first + bool foundactive = false; + for(int i=0; i<screens.length() && !foundactive; i++){ + if(screens[i].isactive){ foundactive = (screens[i].applyChange!=1); } //make sure we are not turning it off + else{ foundactive = (screens[i].applyChange==2); } + } + if(!foundactive){ return; } //never disable all screens //Read all the settings and create the xrandr options to maintain these settings QStringList opts; //qDebug() << "Apply:" << screens.length(); |