diff options
3 files changed, 311 insertions, 0 deletions
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> |