From da01d191816c678dcdabbf93942094eb3c6ed78b Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 22 Jun 2016 23:21:22 -0400 Subject: Get a lot more of the new lumina-config layout all setup. Now the main page has all the loading/parsing routines built in, and the main window will perform the button actions as needed. --- src-qt5/core-utils/lumina-config/globals.h | 2 +- src-qt5/core-utils/lumina-config/mainWindow.cpp | 14 +++++ src-qt5/core-utils/lumina-config/mainWindow.h | 3 + src-qt5/core-utils/lumina-config/pages/getPage.h | 4 +- .../core-utils/lumina-config/pages/page_main.cpp | 70 +++++++++++++++++++--- src-qt5/core-utils/lumina-config/pages/page_main.h | 5 +- .../core-utils/lumina-config/pages/page_main.ui | 27 +++++++++ 7 files changed, 113 insertions(+), 12 deletions(-) diff --git a/src-qt5/core-utils/lumina-config/globals.h b/src-qt5/core-utils/lumina-config/globals.h index 11bfaeb3..cddc76a6 100644 --- a/src-qt5/core-utils/lumina-config/globals.h +++ b/src-qt5/core-utils/lumina-config/globals.h @@ -13,7 +13,7 @@ #include #include #include - +#include //Now the Lumina Library classes #include #include diff --git a/src-qt5/core-utils/lumina-config/mainWindow.cpp b/src-qt5/core-utils/lumina-config/mainWindow.cpp index 45008b07..31d746d5 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.cpp +++ b/src-qt5/core-utils/lumina-config/mainWindow.cpp @@ -15,6 +15,7 @@ //============= mainWindow::mainWindow() : QMainWindow(), ui(new Ui::mainWindow()){ ui->setupUi(this); + setupIcons(); changePage(""); //load the default main page } @@ -31,6 +32,7 @@ void mainWindow::slotSingleInstance(){ void mainWindow::setupIcons(){ ui->actionSave->setIcon( LXDG::findIcon("document-save","") ); + ui->actionBack->setIcon( LXDG::findIcon("go-previous-view","") ); } //============= @@ -75,3 +77,15 @@ void mainWindow::page_change(QString id){ } changePage(id); } + +void mainWindow::on_actionSave_triggered(){ + pageCanSave(false); //disable for the moment (page might re-enable later) + static_cast(this->centralWidget())->SaveSettings(); + +} + +void mainWindow::on_actionBack_triggered(){ + if(cpage.isEmpty()){ this->close(); } //main menu - go ahead and close it + else{ page_change(""); } //Use the interactive wrapper (check for save state, etc). +} + diff --git a/src-qt5/core-utils/lumina-config/mainWindow.h b/src-qt5/core-utils/lumina-config/mainWindow.h index 3a6e0161..76478692 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.h +++ b/src-qt5/core-utils/lumina-config/mainWindow.h @@ -33,6 +33,9 @@ private slots: void pageCanSave(bool); void pageSetTitle(QString); void page_change(QString); + //Toolbar actions + void on_actionSave_triggered(); + void on_actionBack_triggered(); }; #endif diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index 96e22985..9e6b3612 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -26,8 +26,8 @@ static QList KnownPages(){ // Valid Groups: ["appearance", "interface", "session", "apps"] QList list; //Reminder: , , , <icon>, <comment>, <category>, <server subsytem list>, <search tags> - - return list; + list << PageInfo("wallpapers", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "theme"); + return list; } //Add any sub-pages here 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 a45c0477..c853f06c 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_main.cpp @@ -6,20 +6,63 @@ //=========================================== #include "page_main.h" #include "ui_page_main.h" +#include "getPage.h" //========== // PUBLIC //========== page_main::page_main(QWidget *parent) : PageWidget(parent), ui(new Ui::page_main()){ ui->setupUi(this); - + connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); } page_main::~page_main(){ } - +void page_main::UpdateItems(QString search){ + ui->treeWidget->clear(); + //First create the categories + QTreeWidgetItem *interface = new QTreeWidgetItem(); + interface->setIcon(0, LXDG::findIcon("preferences-desktop","")); + interface->setText(0, tr("Interface Configuration")); + QTreeWidgetItem *appearance = new QTreeWidgetItem(); + appearance->setIcon(0, LXDG::findIcon("preferences-desktop-color","")); + appearance->setText(0, tr("Appearance")); + QTreeWidgetItem *session = new QTreeWidgetItem(); + session->setIcon(0, LXDG::findIcon("preferences-system-session-services","")); + session->setText(0, tr("Desktop Session Options")); + QTreeWidgetItem *apps = new QTreeWidgetItem(); + apps->setIcon(0, LXDG::findIcon("preferences-desktop-filetype-association","")); + apps->setText(0, tr("Application Settings")); + //Now go through and add in the known pages for each category + for(int i=0; i<INFO.length(); i++){ + if(!search.isEmpty() ){ + //See if this item needs to be included or not + QStringList info; info << INFO[i].name.split(" ") << INFO[i].title.split(" ") << INFO[i].comment.split(" ") << INFO[i].search_tags; + info.removeDuplicates(); //remove any duplicate terms/info first + info << search.split(" "); //add the terms we want to search for + if(0<info.removeDuplicates()){ continue; } //no duplicates between search terms and available info + } + qDebug() << "Item Found:" << INFO[i].id << INFO[i].title; + QTreeWidgetItem *it = new QTreeWidgetItem(); + it->setIcon(0, LXDG::findIcon(INFO[i].icon,"") ); + it->setText(0, INFO[i].name); + it->setStatusTip(0, INFO[i].comment); + it->setToolTip(0, INFO[i].comment); + it->setWhatsThis(0, INFO[i].id); + if(INFO[i].category=="interface"){ interface->addChild(it); } + else if(INFO[i].category=="appearance"){ appearance->addChild(it); } + else if(INFO[i].category=="session"){ session->addChild(it); } + else if(INFO[i].category=="apps"){ apps->addChild(it); } + else{ ui->treeWidget->addTopLevelItem(it); } + } + //Now add the categories to the tree widget if they are non-empty + if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); } + if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); } + if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); } + if(apps->childCount()>0){ ui->treeWidget->addTopLevelItem(apps); } +} //================ // PUBLIC SLOTS @@ -28,14 +71,25 @@ void page_main::SaveSettings(){ } -void page_main::LoadSettings(int screennum){ - +void page_main::LoadSettings(int){ + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Desktop Settings") ); + INFO.clear(); + INFO = KnownPages(); + UpdateItems(""); } void page_main::updateIcons(){ - + UpdateItems(""); } -//=========== -// PRIVATE -//=========== +//================= +// PRIVATE SLOTS +//================= +void page_main::itemTriggered(QTreeWidgetItem *it){ + if(it->childCount()>0){ + it->setExpanded( !it->isExpanded() ); + }else if(!it->whatsThis(0).isEmpty()){ + emit ChangePage(it->whatsThis(0)); + } +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_main.h b/src-qt5/core-utils/lumina-config/pages/page_main.h index d5c5c8be..0b24b6da 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.h +++ b/src-qt5/core-utils/lumina-config/pages/page_main.h @@ -26,8 +26,11 @@ public slots: private: Ui::page_main *ui; + QList<PAGEINFO> INFO; + + void UpdateItems(QString search); private slots: - + void itemTriggered(QTreeWidgetItem*); }; #endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_main.ui b/src-qt5/core-utils/lumina-config/pages/page_main.ui index 31cb372f..3d9626c1 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_main.ui @@ -31,9 +31,36 @@ <property name="styleSheet"> <string notr="true">QTreeWidget{background: transparent; }</string> </property> + <property name="editTriggers"> + <set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> + <property name="indentation"> + <number>20</number> + </property> + <property name="uniformRowHeights"> + <bool>true</bool> + </property> <property name="sortingEnabled"> <bool>true</bool> </property> + <property name="animated"> + <bool>true</bool> + </property> + <property name="allColumnsShowFocus"> + <bool>false</bool> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="expandsOnDoubleClick"> + <bool>false</bool> + </property> <attribute name="headerVisible"> <bool>false</bool> </attribute> -- cgit From d99c0e514a7c977b8ab671bc0b20adce9a2f66ff Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Thu, 23 Jun 2016 13:13:14 -0400 Subject: Cleaning up the lumina FreeBSD makefile. --- port-files/FreeBSD/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/port-files/FreeBSD/Makefile b/port-files/FreeBSD/Makefile index 033fcb7e..5ae992a6 100644 --- a/port-files/FreeBSD/Makefile +++ b/port-files/FreeBSD/Makefile @@ -13,13 +13,13 @@ COMMENT= Lumina Desktop Environment LICENSE= BSD3CLAUSE -RUN_DEPENDS= xorg>=0:${PORTSDIR}/x11/xorg \ +RUN_DEPENDS= xorg>=0:${PORTSDIR}/x11/xorg-minimal \ fluxbox>=0:${PORTSDIR}/x11-wm/fluxbox \ - fluxbox-tenr-styles-pack>=0:${PORTSDIR}/x11-themes/fluxbox-tenr-styles-pack \ kde4-icons-oxygen>=0:${PORTSDIR}/x11-themes/kde4-icons-oxygen \ xscreensaver:${PORTSDIR}/x11/xscreensaver \ - xscreensaver-demo:${PORTSDIR}/x11/xscreensaver \ xbrightness:${PORTSDIR}/x11/xbrightness \ + xcompmgr:$PORTSDIR}/x11-wm/xcompmgr + xrandr:${PORTSDIR}/x11/xrandr \ numlockx:${PORTSDIR}/x11/numlockx CONFLICTS= lumina-devel-0* @@ -38,10 +38,10 @@ RUN_DEPENDS+= gstreamer1-plugins-core>=0:${PORTSDIR}/multimedia/gstreamer1-plugi MAKE_JOBS_UNSAFE=yes USE_XORG= x11 xdamage -USE_XCB= x11extras wm +USE_XCB= x11extras wm USE_LDCONFIG= yes USE_QT5= core gui network svg multimedia imageformats \ - buildtools x11extras concurrent + buildtools_build x11extras concurrent USES= desktop-file-utils qmake USE_GITHUB= yes GH_ACCOUNT= pcbsd -- cgit From f20ec66f6a90d108ece31a192acd1f89b52b9931 Mon Sep 17 00:00:00 2001 From: q5sys <jt@obs-sec.com> Date: Thu, 23 Jun 2016 17:44:11 -0400 Subject: Add keyboard shortcut for showing/hiding hidden files --- src-qt5/desktop-utils/lumina-fm/MainUI.cpp | 14 ++++++++++++-- src-qt5/desktop-utils/lumina-fm/MainUI.h | 7 +++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp index a422e012..30267439 100644 --- a/src-qt5/desktop-utils/lumina-fm/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-fm/MainUI.cpp @@ -94,7 +94,8 @@ QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize(); if(DEBUG){ qDebug() << " - Keyboard Shortcuts"; } nextTabLShort = new QShortcut( QKeySequence(tr("Shift+Left")), this); nextTabRShort = new QShortcut( QKeySequence(tr("Shift+Right")), this); - + togglehiddenfilesShort = new QShortcut( QKeySequence(tr("Ctrl+H")), this); + //Finish loading the interface workThread->start(); if(DEBUG){ qDebug() << " - Icons"; } @@ -240,7 +241,7 @@ void MainUI::setupConnections(){ connect(tabBar, SIGNAL(tabCloseRequested(int)), this, SLOT(tabClosed(int)) ); connect(ui->menuBookmarks, SIGNAL(triggered(QAction*)), this, SLOT(goToBookmark(QAction*)) ); connect(ui->menuExternal_Devices, SIGNAL(triggered(QAction*)), this, SLOT(goToDevice(QAction*)) ); - + //Radio Buttons connect(radio_view_details, SIGNAL(toggled(bool)), this, SLOT(viewModeChanged(bool)) ); connect(radio_view_list, SIGNAL(toggled(bool)), this, SLOT(viewModeChanged(bool)) ); @@ -250,6 +251,15 @@ void MainUI::setupConnections(){ //Special Keyboard Shortcuts connect(nextTabLShort, SIGNAL(activated()), this, SLOT( prevTab() ) ); connect(nextTabRShort, SIGNAL(activated()), this, SLOT( nextTab() ) ); + connect(togglehiddenfilesShort, SIGNAL(activated()), this, SLOT( togglehiddenfiles() ) ); +} + +void MainUI::togglehiddenfiles() +{ + //change setChecked to inverse value + ui->actionView_Hidden_Files->setChecked( !settings->value("showhidden", true).toBool() ); + // then trigger function + on_actionView_Hidden_Files_triggered(); } void MainUI::loadSettings(){ diff --git a/src-qt5/desktop-utils/lumina-fm/MainUI.h b/src-qt5/desktop-utils/lumina-fm/MainUI.h index e0bae254..4522b7f6 100644 --- a/src-qt5/desktop-utils/lumina-fm/MainUI.h +++ b/src-qt5/desktop-utils/lumina-fm/MainUI.h @@ -88,7 +88,7 @@ private: SlideshowWidget *SW; QSettings *settings; - QShortcut *nextTabLShort, *nextTabRShort; + QShortcut *nextTabLShort, *nextTabRShort, *togglehiddenfilesShort; QCompleter *dirCompleter; //Simplification Functions @@ -138,7 +138,10 @@ private slots: void tabClosed(int tab = -1); void nextTab(); //For keyboard shortcuts void prevTab(); //For keyboard shortcuts - + + //Other Shortcuts + void togglehiddenfiles(); + //Backend Info passing void DirDataAvailable(QString, QString, LFileInfoList); void SnapshotDataAvailable(QString, QString, QStringList); -- cgit From 75303d3d2c6db7640bbbb4be283d578aef35e9a7 Mon Sep 17 00:00:00 2001 From: q5sys <jt@obs-sec.com> Date: Thu, 23 Jun 2016 18:11:36 -0400 Subject: Change references to PC-BSD to TrueOS --- DEPENDENCIES | 2 +- README.md | 4 ++-- ROADMAP | 4 ++-- port-files/FreeBSD/Makefile | 2 +- src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp | 8 ++++---- src-qt5/core/lumina-desktop/AppMenu.cpp | 2 +- src-qt5/core/lumina-desktop/audiofiles/LICENCE | 2 +- src-qt5/core/lumina-desktop/lumina-desktop.pro | 2 +- .../core/lumina-desktop/panel-plugins/appmenu/LAppMenuPlugin.cpp | 2 +- src-qt5/core/lumina-info/MainUI.ui | 2 +- src-qt5/core/lumina-wm-INCOMPLETE/DEPENDENCIES | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-) diff --git a/DEPENDENCIES b/DEPENDENCIES index 1a4dd5ec..a77786c0 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -45,7 +45,7 @@ Additional Binaries/Packages (runtime): ==== OS-SPECIFIC UTILITIES ===== ======================= -=== FreeBSD/PC-BSD === +=== FreeBSD/TrueOS === Required Tools xbrightness (x11/xbrightness) (Screen Brightness Control) diff --git a/README.md b/README.md index 4c8ea27a..f446986b 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,13 @@ NOTE: Starting with version 0.8.4, you may also find packaged versions of the so Translations ---- -All the translation files for Lumina are available through the PC-BSD pootle translations systems, which are then auto-committed to the pcbsd/lumina-i18n repo (Qt5+ only). This provides an easy interface through which to contribute translations while also ensuring that the translation files are kept in sync with the Lumina source files, and it is highly recommended that translators use this interface. +All the translation files for Lumina are available through the TrueOS pootle translations systems, which are then auto-committed to the pcbsd/lumina-i18n repo (Qt5+ only). This provides an easy interface through which to contribute translations while also ensuring that the translation files are kept in sync with the Lumina source files, and it is highly recommended that translators use this interface. Translation Website URL: http://translate.pcbsd.org/ How to file bug reports or feature requests ---- -Please submit any bug reports or feature requests through the PC-BSD bug tracker, as this ensures that your submissions will be addressed in a timely manner (developers on GitHub may also create a ticket through the GitHub issues tracker, although it is not as feature-full as the PC-BSD bug tracker). If you want to send in patches or other source contributions, please send in a GitHub pull request so that it can get reviewed/committed to the main repo as quickly as possible. +Please submit any bug reports or feature requests through the TrueOS bug tracker, as this ensures that your submissions will be addressed in a timely manner (developers on GitHub may also create a ticket through the GitHub issues tracker, although it is not as feature-full as the TrueOS bug tracker). If you want to send in patches or other source contributions, please send in a GitHub pull request so that it can get reviewed/committed to the main repo as quickly as possible. Bug Tracker: https://bugs.pcbsd.org/projects/pcbsd diff --git a/ROADMAP b/ROADMAP index fb6dfe54..f7ed9964 100644 --- a/ROADMAP +++ b/ROADMAP @@ -20,7 +20,7 @@ Add network probing functionality (for lumina-fm mainly) - Will need integration into LuminaOS and possible LuminaUtils - Will need an OS-specific method of requesting that the system mount the network drive on the system - - Use "avahi-browse" on PC-BSD? + - Use "avahi-browse" on TrueOS? Add OS-specific suspend/resume functionality - Will be integrated into lumina-screensaver primarily @@ -48,7 +48,7 @@ New Frameworks: - LuminaThemeEngine library for use by all Qt applications (binary module/wrapper around the current theme engine functionality) -PDF Viewing Capabilities (Extremely Low Priority: just created pc-pdfviewer for PC-BSD) +PDF Viewing Capabilities (Extremely Low Priority: just created pc-pdfviewer for TrueOS) - Could be a new utility, but would prefer the functionality be put into libLumina so that lumina-fm can also use it. - Great for quickly viewing/printing PDF files (since most PDF utilities appear to be DE-specific) diff --git a/port-files/FreeBSD/Makefile b/port-files/FreeBSD/Makefile index 5ae992a6..34004c0b 100644 --- a/port-files/FreeBSD/Makefile +++ b/port-files/FreeBSD/Makefile @@ -27,7 +27,7 @@ CONFLICTS= lumina-devel-0* OPTIONS_DEFINE= MULTIMEDIA PCBSD OPTIONS_DEFAULT= MULTIMEDIA MULTIMEDIA_DESC= Install multimedia support backend (gstreamer) -PCBSD_DESC= Use the PC-BSD system interface settings. +PCBSD_DESC= Use the TrueOS system interface settings. .include <bsd.port.options.mk> diff --git a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp index 0a544165..ab68361e 100644 --- a/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp +++ b/src-qt5/core/libLumina/LuminaOS-FreeBSD.cpp @@ -30,7 +30,7 @@ QString LOS::AppStoreShortcut(){ return "/usr/local/share/applications/appcafe.d QStringList LOS::RSSFeeds(){ QStringList feeds; feeds << "FreeBSD News Feed::::https://www.freebsd.org/news/rss.xml"; - feeds << "PC-BSD News Feed::::https://blog.pcbsd.org/?feed=rss2"; + feeds << "TrueOS News Feed::::https://blog.pcbsd.org/?feed=rss2"; return feeds; } @@ -90,9 +90,9 @@ void LOS::setScreenBrightness(int percent){ else if(percent>100){ percent=100; } //Run the command(s) bool success = false; - // - try hardware setting first (PC-BSD || or intel_backlight) + // - try hardware setting first (TrueOS || or intel_backlight) if( LUtils::isValidBinary("pc-sysconfig") ){ - //Use PC-BSD tool (direct sysctl control) + //Use TrueOS tool (direct sysctl control) QString ret = LUtils::getCmdOutput("pc-sysconfig", QStringList() <<"setscreenbrightness "+QString::number(percent)).join(""); success = ret.toLower().contains("success"); qDebug() << "Set hardware brightness:" << percent << success; @@ -216,7 +216,7 @@ void LOS::systemRestart(){ //start reboot sequence //Check for suspend support bool LOS::systemCanSuspend(){ - //This will only function on PC-BSD + //This will only function on TrueOS //(permissions issues on standard FreeBSD unless setup a special way) bool ok = QFile::exists("/usr/local/bin/pc-sysconfig"); if(ok){ diff --git a/src-qt5/core/lumina-desktop/AppMenu.cpp b/src-qt5/core/lumina-desktop/AppMenu.cpp index 0b8aeace..ad3a2695 100644 --- a/src-qt5/core/lumina-desktop/AppMenu.cpp +++ b/src-qt5/core/lumina-desktop/AppMenu.cpp @@ -9,7 +9,7 @@ #include <LuminaOS.h> AppMenu::AppMenu(QWidget* parent) : QMenu(parent){ - appstorelink = LOS::AppStoreShortcut(); //Default application "store" to display (AppCafe in PC-BSD) + appstorelink = LOS::AppStoreShortcut(); //Default application "store" to display (AppCafe in TrueOS) controlpanellink = LOS::ControlPanelShortcut(); //Default control panel APPS.clear(); watcher = new QFileSystemWatcher(this); diff --git a/src-qt5/core/lumina-desktop/audiofiles/LICENCE b/src-qt5/core/lumina-desktop/audiofiles/LICENCE index 2929216f..898894f6 100644 --- a/src-qt5/core/lumina-desktop/audiofiles/LICENCE +++ b/src-qt5/core/lumina-desktop/audiofiles/LICENCE @@ -1 +1 @@ -These audio files are BSD-licensed and were created/owned by the PC-BSD Project +These audio files are BSD-licensed and were created/owned by the TrueOS Project diff --git a/src-qt5/core/lumina-desktop/lumina-desktop.pro b/src-qt5/core/lumina-desktop/lumina-desktop.pro index 5169476c..33c20502 100644 --- a/src-qt5/core/lumina-desktop/lumina-desktop.pro +++ b/src-qt5/core/lumina-desktop/lumina-desktop.pro @@ -87,7 +87,7 @@ defaults.path = $${L_SHAREDIR}/lumina-desktop/ conf.path = $${L_ETCDIR} -#Now do any PC-BSD defaults (if set) +#Now do any TrueOS defaults (if set) PCBSD{ conf.extra = cp defaults/luminaDesktop.pcbsd.conf $(INSTALL_ROOT)$${L_ETCDIR}/luminaDesktop.conf.dist defaults.extra = cp defaults/desktop-background.pcbsd.jpg $(INSTALL_ROOT)$${L_SHAREDIR}/lumina-desktop/desktop-background.jpg diff --git a/src-qt5/core/lumina-desktop/panel-plugins/appmenu/LAppMenuPlugin.cpp b/src-qt5/core/lumina-desktop/panel-plugins/appmenu/LAppMenuPlugin.cpp index 57e84a1d..5d20e3ec 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/appmenu/LAppMenuPlugin.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/appmenu/LAppMenuPlugin.cpp @@ -36,7 +36,7 @@ LAppMenuPlugin::~LAppMenuPlugin(){ void LAppMenuPlugin::updateButtonVisuals(){ button->setToolTip( tr("Quickly launch applications or open files")); button->setText( tr("Applications") ); - //Use the PC-BSD icon by default (or the Lumina icon for non-PC-BSD systems) + //Use the TrueOS icon by default (or the Lumina icon for non-TrueOS systems) button->setIcon( LXDG::findIcon("start-here-lumina","Lumina-DE") ); } diff --git a/src-qt5/core/lumina-info/MainUI.ui b/src-qt5/core/lumina-info/MainUI.ui index 175497bd..f30d0e04 100644 --- a/src-qt5/core/lumina-info/MainUI.ui +++ b/src-qt5/core/lumina-info/MainUI.ui @@ -356,7 +356,7 @@ </property> <item> <property name="text"> - <string notr="true">PC-BSD</string> + <string notr="true">TrueOS</string> </property> <property name="toolTip"> <string notr="true">www.pcbsd.org</string> diff --git a/src-qt5/core/lumina-wm-INCOMPLETE/DEPENDENCIES b/src-qt5/core/lumina-wm-INCOMPLETE/DEPENDENCIES index 63b18ab7..fa0ce486 100644 --- a/src-qt5/core/lumina-wm-INCOMPLETE/DEPENDENCIES +++ b/src-qt5/core/lumina-wm-INCOMPLETE/DEPENDENCIES @@ -3,7 +3,7 @@ DEPENDENCIES file in the directory above this one. The following are dependencies specific to Lumina's window manager. -FreeBSD/PC-BSD +FreeBSD/TrueOS ======================= -- cgit From 6017ca54a7ae9ff2faa53aae08aacbc84a597343 Mon Sep 17 00:00:00 2001 From: q5sys <jt@obs-sec.com> Date: Thu, 23 Jun 2016 18:15:48 -0400 Subject: Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f446986b..23fb6583 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ How to build from source * PREFIX: Determines the base directory used to install/run Lumina ("/usr/local" by default) * LIBPREFIX: Determines the location to install the Lumina library ("PREFIX/lib" by default) * DESTDIR: An optional directory where the compiled files will be placed temporary (such as for packaging/distributing via some other system). - * WITH_I18N: (not recommended) Generate/install the partially-localized translation files. This option is typically only used by developers who need to test the localization systems. If you wish to install the full localization/translation files, please use the pcbsd/lumina-i18n repo instead. + * WITH_I18N: (not recommended) Generate/install the partially-localized translation files. This option is typically only used by developers who need to test the localization systems. If you wish to install the full localization/translation files, please use the trueos/lumina-i18n repo instead. 4) Run "make" to compile all the Lumina projects (can be done as user) -- cgit From caaac75fac084157f578e30178b65fdcbe6b5a32 Mon Sep 17 00:00:00 2001 From: q5sys <jt@obs-sec.com> Date: Thu, 23 Jun 2016 19:42:48 -0400 Subject: Changing PC-BSD logo to TrueOS logo --- src-qt5/core/lumina-info/Images/pcbsd_logo.png | Bin 7539 -> 0 bytes src-qt5/core/lumina-info/MainUI.ui | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 src-qt5/core/lumina-info/Images/pcbsd_logo.png diff --git a/src-qt5/core/lumina-info/Images/pcbsd_logo.png b/src-qt5/core/lumina-info/Images/pcbsd_logo.png deleted file mode 100644 index c118a865..00000000 Binary files a/src-qt5/core/lumina-info/Images/pcbsd_logo.png and /dev/null differ diff --git a/src-qt5/core/lumina-info/MainUI.ui b/src-qt5/core/lumina-info/MainUI.ui index f30d0e04..d5d229e7 100644 --- a/src-qt5/core/lumina-info/MainUI.ui +++ b/src-qt5/core/lumina-info/MainUI.ui @@ -366,7 +366,7 @@ </property> <property name="icon"> <iconset resource="lumina-info.qrc"> - <normaloff>:/Images/pcbsd_logo.png</normaloff>:/Images/pcbsd_logo.png</iconset> + <normaloff>:/Images/trueos_logo.png</normaloff>:/Images/trueos_logo.png</iconset> </property> </item> <item> -- cgit From fb7cb9482d8c1a37445f1f1476886b7785808d13 Mon Sep 17 00:00:00 2001 From: q5sys <jt@obs-sec.com> Date: Thu, 23 Jun 2016 19:57:30 -0400 Subject: updating qrc --- src-qt5/core/lumina-info/lumina-info.qrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-qt5/core/lumina-info/lumina-info.qrc b/src-qt5/core/lumina-info/lumina-info.qrc index c26c5ef6..9f74a682 100644 --- a/src-qt5/core/lumina-info/lumina-info.qrc +++ b/src-qt5/core/lumina-info/lumina-info.qrc @@ -1,6 +1,6 @@ <RCC> <qresource> - <file>Images/pcbsd_logo.png</file> + <file>Images/trueos_logo.png</file> <file>Images/ix_logo.png</file> <file>Images/Lumina-logo.png</file> <file>LICENSE</file> -- cgit From b943840b3a3d6c3549018c49b8e99f3080ddc2f5 Mon Sep 17 00:00:00 2001 From: q5sys <jt@obs-sec.com> Date: Thu, 23 Jun 2016 19:59:05 -0400 Subject: adding logo file --- src-qt5/core/lumina-info/Images/trueos_logo.png | Bin 0 -> 5182 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src-qt5/core/lumina-info/Images/trueos_logo.png diff --git a/src-qt5/core/lumina-info/Images/trueos_logo.png b/src-qt5/core/lumina-info/Images/trueos_logo.png new file mode 100644 index 00000000..08ab8581 Binary files /dev/null and b/src-qt5/core/lumina-info/Images/trueos_logo.png differ -- cgit From d8ae2ae4d6f483ff52bf3de7866e6389d2e901df Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Fri, 24 Jun 2016 14:09:08 -0400 Subject: Get the new "wallpaper" page all setup and functional, as well as finish testing the new page loading and monitor-changing systems. --- src-qt5/core-utils/lumina-config/globals.h | 7 + src-qt5/core-utils/lumina-config/mainWindow.cpp | 73 ++++-- src-qt5/core-utils/lumina-config/mainWindow.h | 5 +- src-qt5/core-utils/lumina-config/mainWindow.ui | 23 +- src-qt5/core-utils/lumina-config/pages/getPage.h | 5 +- .../lumina-config/pages/page_wallpaper.cpp | 282 +++++++++++++++++++++ .../lumina-config/pages/page_wallpaper.h | 52 ++++ .../lumina-config/pages/page_wallpaper.ui | 8 +- src-qt5/core-utils/lumina-config/pages/pages.pri | 15 +- 9 files changed, 440 insertions(+), 30 deletions(-) create mode 100644 src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp create mode 100644 src-qt5/core-utils/lumina-config/pages/page_wallpaper.h diff --git a/src-qt5/core-utils/lumina-config/globals.h b/src-qt5/core-utils/lumina-config/globals.h index cddc76a6..f3921976 100644 --- a/src-qt5/core-utils/lumina-config/globals.h +++ b/src-qt5/core-utils/lumina-config/globals.h @@ -12,8 +12,15 @@ #include <QList> #include <QWidget> #include <QDesktopWidget> +#include <QScreen> #include <QMainWindow> #include <QTreeWidgetItem> +#include <QToolButton> +#include <QSettings> +#include <QFileDialog> +#include <QColorDialog> +#include <QMessageBox> + //Now the Lumina Library classes #include <LuminaXDG.h> #include <LuminaUtils.h> diff --git a/src-qt5/core-utils/lumina-config/mainWindow.cpp b/src-qt5/core-utils/lumina-config/mainWindow.cpp index 31d746d5..95a420e8 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.cpp +++ b/src-qt5/core-utils/lumina-config/mainWindow.cpp @@ -15,7 +15,13 @@ //============= mainWindow::mainWindow() : QMainWindow(), ui(new Ui::mainWindow()){ ui->setupUi(this); + cpage = "somerandomjunktostartwith"; + //Need to insert a spacer action in the toolbar + QWidget *tmp = new QWidget(this); + tmp->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + ui->toolBar->insertWidget(ui->actionSave, tmp); //after the save button setupIcons(); + loadMonitors(); changePage(""); //load the default main page } @@ -33,27 +39,53 @@ void mainWindow::slotSingleInstance(){ void mainWindow::setupIcons(){ ui->actionSave->setIcon( LXDG::findIcon("document-save","") ); ui->actionBack->setIcon( LXDG::findIcon("go-previous-view","") ); + ui->actionMonitor->setIcon(LXDG::findIcon("preferences-desktop-display","") ); +} + +void mainWindow::loadMonitors(){ + if(ui->actionMonitor->menu()==0){ + ui->actionMonitor->setMenu( new QMenu(this) ); + ui->actionMonitor->setWhatsThis("0"); + connect( ui->actionMonitor->menu(), SIGNAL(triggered(QAction*)), this, SLOT(changeMonitor(QAction*)) ); + QToolButton *b = static_cast<QToolButton*>(ui->toolBar->widgetForAction(ui->actionMonitor)); + b->setPopupMode(QToolButton::InstantPopup); + } + int cnum = ui->actionMonitor->whatsThis().toInt(); + ui->actionMonitor->menu()->clear(); + QList<QScreen*> SL = QApplication::screens(); + for(int i=0; i<SL.length(); i++){ + QAction *tmp = ui->actionMonitor->menu()->addAction( QString("%1: %2").arg(QString::number(i), SL[i]->name()) ); + tmp->setWhatsThis(QString::number(i)); + if(i==cnum || (i==0 && cnum>= SL.length()) ){ + ui->actionMonitor->setText( tmp->text() ); + ui->actionMonitor->setWhatsThis(tmp->whatsThis() ); + } + } + } //============= // PRIVATE //============= void mainWindow::changePage(QString id){ - PageWidget *page = GetNewPage(id, this); - if(page==0){ return; } - qDebug() << "Changing page:" << id; - cpage = id; - QWidget *old = this->centralWidget(); - this->setCentralWidget(page); - if(old!=0 && old!=ui->centralwidget){ old->disconnect(); old->deleteLater(); } - //Connect the new page - connect(page, SIGNAL(HasPendingChanges(bool)), this, SLOT(pageCanSave(bool)) ); - connect(page, SIGNAL(ChangePageTitle(QString)), this, SLOT(pageSetTitle(QString)) ); - connect(page, SIGNAL(ChangePage(QString)), this, SLOT(page_change(QString)) ); + PageWidget *page = 0; + if(id!=cpage){ + page = GetNewPage(id, this); + if(page==0){ return; } + qDebug() << "Changing page:" << id; + cpage = id; + QWidget *old = this->centralWidget(); + this->setCentralWidget(page); + if(old!=0 && old!=ui->centralwidget){ old->disconnect(); old->deleteLater(); } + //Connect the new page + connect(page, SIGNAL(HasPendingChanges(bool)), this, SLOT(pageCanSave(bool)) ); + connect(page, SIGNAL(ChangePageTitle(QString)), this, SLOT(pageSetTitle(QString)) ); + connect(page, SIGNAL(ChangePage(QString)), this, SLOT(page_change(QString)) ); + } //Now load the new page - page->LoadSettings(0); //need to make this show the current screen as needed + page->LoadSettings(ui->actionMonitor->whatsThis().toInt()); //need to make this show the current screen as needed //Now update this UI a bit based on page settings - bool needscreen = page->needsScreenSelector(); + ui->actionMonitor->setVisible( page->needsScreenSelector() );// && ui->actionMonitor->menu()->actions().length()>1 ); this->showNormal(); } @@ -70,12 +102,15 @@ void mainWindow::pageSetTitle(QString title){ this->setWindowTitle(title); } -void mainWindow::page_change(QString id){ +bool mainWindow::page_change(QString id){ if(ui->actionSave->isEnabled()){ //unsaved changed available - prompt to save first - // TO-DO + QMessageBox::StandardButton result = QMessageBox::question(this, tr("Unsaved Changes"), tr("This page currently has unsaved changes, do you wish to save them now?"), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, QMessageBox::No); + if(result == QMessageBox::Yes){ on_actionSave_triggered(); } + else if(result == QMessageBox::Cancel){ return false; } //stop now } changePage(id); + return true; } void mainWindow::on_actionSave_triggered(){ @@ -89,3 +124,11 @@ void mainWindow::on_actionBack_triggered(){ else{ page_change(""); } //Use the interactive wrapper (check for save state, etc). } +void mainWindow::changeMonitor(QAction *act){ + QString oldWT = ui->actionMonitor->whatsThis(); + //Update the current selection shown on the button + ui->actionMonitor->setWhatsThis( act->whatsThis() ); + //Now prompt the current page to re-load settings + if( page_change(cpage) ){ ui->actionMonitor->setText(act->text()); } + else{ ui->actionMonitor->setWhatsThis(oldWT); } //cancelled - go back to old setting +} diff --git a/src-qt5/core-utils/lumina-config/mainWindow.h b/src-qt5/core-utils/lumina-config/mainWindow.h index 76478692..3e632f4d 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.h +++ b/src-qt5/core-utils/lumina-config/mainWindow.h @@ -21,21 +21,24 @@ public: public slots: void slotSingleInstance(); void setupIcons(); + void loadMonitors(); private: Ui::mainWindow *ui; QString cpage; //current page + void changePage(QString id); private slots: //Page signals void pageCanSave(bool); void pageSetTitle(QString); - void page_change(QString); + bool page_change(QString); //Toolbar actions void on_actionSave_triggered(); void on_actionBack_triggered(); + void changeMonitor(QAction*); }; #endif diff --git a/src-qt5/core-utils/lumina-config/mainWindow.ui b/src-qt5/core-utils/lumina-config/mainWindow.ui index 55e39233..538d1864 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.ui +++ b/src-qt5/core-utils/lumina-config/mainWindow.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>486</width> + <width>504</width> <height>388</height> </rect> </property> @@ -28,6 +28,12 @@ <property name="allowedAreas"> <set>Qt::TopToolBarArea</set> </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + <property name="floatable"> + <bool>false</bool> + </property> <attribute name="toolBarArea"> <enum>TopToolBarArea</enum> </attribute> @@ -37,6 +43,7 @@ <addaction name="actionBack"/> <addaction name="separator"/> <addaction name="actionSave"/> + <addaction name="actionMonitor"/> </widget> <action name="actionSave"> <property name="text"> @@ -63,6 +70,20 @@ <string>Esc</string> </property> </action> + <action name="actionMonitor"> + <property name="text"> + <string notr="true">Monitor</string> + </property> + <property name="toolTip"> + <string>Select monitor/desktop to configure</string> + </property> + <property name="statusTip"> + <string>Select monitor/desktop to configure</string> + </property> + <property name="menuRole"> + <enum>QAction::ApplicationSpecificRole</enum> + </property> + </action> </widget> <resources/> <connections/> diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index 9e6b3612..cecc3d87 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -26,16 +26,17 @@ static QList<PAGEINFO> KnownPages(){ // Valid Groups: ["appearance", "interface", "session", "apps"] QList<PAGEINFO> list; //Reminder: <ID>, <name>, <title>, <icon>, <comment>, <category>, <server subsytem list>, <search tags> - list << PageInfo("wallpapers", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "theme"); + list << PageInfo("wallpaper", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "theme"); return list; } //Add any sub-pages here #include "page_main.h" +#include "page_wallpaper.h" static PageWidget* GetNewPage(QString id, QWidget *parent){ //Find the page that matches this "id" - //if(id=="page_beadm"){ return new beadm_page(parent, core); } + if(id=="wallpaper"){ return new page_wallpaper(parent); } //Return the main control_panel page as the fallback/default return new page_main(parent); } diff --git a/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp new file mode 100644 index 00000000..b54e07bd --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.cpp @@ -0,0 +1,282 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_wallpaper.h" +#include "ui_page_wallpaper.h" +#include "getPage.h" + +//========== +// PUBLIC +//========== +page_wallpaper::page_wallpaper(QWidget *parent) : PageWidget(parent), ui(new Ui::page_wallpaper()){ + ui->setupUi(this); + DEFAULTBG = LOS::LuminaShare()+"/desktop-background.jpg"; + updateIcons(); + connect(ui->combo_desk_bg, SIGNAL(currentIndexChanged(int)), this, SLOT(deskbgchanged()) ); + connect(ui->radio_desk_multi, SIGNAL(toggled(bool)), this, SLOT(desktimechanged()) ); + connect(ui->tool_desk_addbg, SIGNAL(clicked()), this, SLOT(deskbgadded()) ); + connect(ui->tool_desk_rmbg, SIGNAL(clicked()), this, SLOT(deskbgremoved()) ); + connect(ui->spin_desk_min, SIGNAL(valueChanged(int)), this, SLOT(desktimechanged()) ); + connect(ui->combo_desk_layout, SIGNAL(currentIndexChanged(int)), this, SLOT(desktimechanged()) ); //just need to poke the save routines +} + +page_wallpaper::~page_wallpaper(){ + +} + +//================ +// PUBLIC SLOTS +//================ +void page_wallpaper::SaveSettings(){ + QSettings settings("lumina-desktop","desktopsettings"); + QString DPrefix = "desktop-"+QString::number(cScreen)+"/"; + QStringList bgs; //get the list of backgrounds to use + if(ui->radio_desk_multi->isChecked()){ + for(int i=0; i<ui->combo_desk_bg->count(); i++){ + bgs << ui->combo_desk_bg->itemData(i).toString(); + } + }else if(ui->combo_desk_bg->count() > 0){ + bgs << ui->combo_desk_bg->itemData( ui->combo_desk_bg->currentIndex() ).toString(); + bgs.removeAll("default"); + } + if(bgs.isEmpty()){ bgs << "default"; } //Make sure to always fall back on the default + settings.setValue(DPrefix+"background/filelist", bgs); + settings.setValue(DPrefix+"background/minutesToChange", ui->spin_desk_min->value()); + settings.setValue(DPrefix+"background/format", ui->combo_desk_layout->currentData().toString()); + + emit HasPendingChanges(false); +} + +void page_wallpaper::LoadSettings(int screennum){ + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Wallpaper Settings") ); + cScreen = screennum; //save for later + loading = true; + QSettings settings("lumina-desktop","desktopsettings"); + QString DPrefix = "desktop-"+QString::number(cScreen)+"/"; + + QStringList bgs = settings.value(DPrefix+"background/filelist", QStringList()<<"default").toStringList(); + ui->combo_desk_bg->clear(); + for(int i=0; i<bgs.length(); i++){ + if(bgs[i]=="default"){ ui->combo_desk_bg->addItem( QIcon(DEFAULTBG), tr("System Default"), bgs[i] ); } + else if(bgs[i].startsWith("rgb(")){ui->combo_desk_bg->addItem(QString(tr("Solid Color: %1")).arg(bgs[i]), bgs[i]); } + //else{ ui->combo_desk_bg->addItem( QIcon(QPixmap(bgs[i]).scaled(64,64)), bgs[i].section("/",-1), bgs[i] ); } + else{ ui->combo_desk_bg->addItem( bgs[i].section("/",-1), bgs[i] ); } //disable the thumbnail - takes a long time for large collections of files + } + + ui->radio_desk_multi->setEnabled(bgs.length()>1); + if(bgs.length()>1){ ui->radio_desk_multi->setChecked(true);} + else{ ui->radio_desk_single->setChecked(true); } + ui->spin_desk_min->setValue( settings.value(DPrefix+"background/minutesToChange", 5).toInt() ); + desktimechanged(); //ensure the display gets updated (in case the radio selection did not change); + QRect geom = QApplication::desktop()->screenGeometry(cScreen); + ui->label_desk_res->setText( tr("Screen Resolution:")+"\n"+QString::number(geom.width())+"x"+QString::number(geom.height()) ); + int tmp = ui->combo_desk_layout->findData(settings.value(DPrefix+"background/format","stretch")); + if(tmp>=0){ ui->combo_desk_layout->setCurrentIndex(tmp); } + loading = false; +} + +void page_wallpaper::updateIcons(){ + ui->tool_desk_addbg->setIcon( LXDG::findIcon("list-add","") ); + ui->tool_desk_rmbg->setIcon( LXDG::findIcon("list-remove","") ); + updateMenus(); +} + +//================= +// PRIVATE +//================= +QString page_wallpaper::getColorStyle(QString current, bool allowTransparency){ + QString out; + //Convert the current color string into a QColor + QStringList col = current.section(")",0,0).section("(",1,1).split(","); + if(col.length()!=4){ col.clear(); col << "255" << "255" << "255" << "255"; } + QColor ccol = QColor(col[0].toInt(), col[1].toInt(), col[2].toInt(), col[3].toInt()); //RGBA + QColor ncol; + if(allowTransparency){ ncol= QColorDialog::getColor(ccol, this, tr("Select Color"), QColorDialog::ShowAlphaChannel); } + else{ ncol= QColorDialog::getColor(ccol, this, tr("Select Color")); } + //Now convert the new color into a usable string and return + if(ncol.isValid()){ //if the dialog was not cancelled + if(allowTransparency){ + out = "rgba("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+","+QString::number(ncol.alpha())+")"; + }else{ + out = "rgb("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+")"; + } + } + return out; +} + +//================= +// PRIVATE SLOTS +//================= +void page_wallpaper::updateMenus(){ + //Background file menu (different ways of loading files) + if(ui->tool_desk_addbg->menu()==0){ ui->tool_desk_addbg->setMenu(new QMenu(this)); } + ui->tool_desk_addbg->menu()->clear(); + ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("document-new",""), tr("File(s)"), this, SLOT(deskbgadded()) ); + ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("folder-new",""), tr("Directory (Single)"), this, SLOT(deskbgdiradded()) ); + ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("document-open-folder",""), tr("Directory (Recursive)"), this, SLOT(deskbgdirradded()) ); + ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("format-fill-color",""), tr("Solid Color"), this, SLOT(deskbgcoloradded()) ); + + //Available Wallpaper layout options + ui->combo_desk_layout->clear(); + ui->combo_desk_layout->addItem(tr("Automatic"), "stretch"); + ui->combo_desk_layout->addItem(tr("Fullscreen"), "full"); + ui->combo_desk_layout->addItem(tr("Fit screen"), "fit"); + ui->combo_desk_layout->addItem(tr("Tile"), "tile"); + ui->combo_desk_layout->addItem(tr("Center"), "center"); + ui->combo_desk_layout->addItem(tr("Top Left"), "topleft"); + ui->combo_desk_layout->addItem(tr("Top Right"), "topright"); + ui->combo_desk_layout->addItem(tr("Bottom Left"), "bottomleft"); + ui->combo_desk_layout->addItem(tr("Bottom Right"), "bottomright"); + +} + +void page_wallpaper::deskbgchanged(){ + //Load the new image preview + if(ui->combo_desk_bg->count()==0){ + ui->label_desk_bgview->setPixmap(QPixmap()); + ui->label_desk_bgview->setText(tr("No Background")+"\n"+tr("(use system default)")); + ui->label_desk_bgview->setStyleSheet(""); + }else{ + QString path = ui->combo_desk_bg->itemData( ui->combo_desk_bg->currentIndex() ).toString(); + if(path=="default"){ path = DEFAULTBG; } + 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()) ); + //Update the preview/thumbnail for this item + QPixmap pix(path); + 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(""); + }else if(path.startsWith("rgb(")){ + ui->label_desk_bgview->setPixmap(QPixmap()); + ui->label_desk_bgview->setText(""); + ui->label_desk_bgview->setStyleSheet("background-color: "+path+";"); + }else{ + ui->label_desk_bgview->setPixmap(QPixmap()); + ui->label_desk_bgview->setText(tr("File does not exist")); + ui->label_desk_bgview->setStyleSheet(""); + } + } + //See if this constitues a change to the current settings and enable the save button + if(!loading && ui->radio_desk_single->isChecked() && cBG!=ui->combo_desk_bg->currentIndex()){ emit HasPendingChanges(true); } + cBG = ui->combo_desk_bg->currentIndex(); //keep track of this for later + //Disable the background rotation option if only one background selected + if(ui->combo_desk_bg->count()<2){ + ui->radio_desk_single->setChecked(true); + ui->radio_desk_multi->setEnabled(false); + ui->spin_desk_min->setEnabled(false); + }else{ + ui->radio_desk_multi->setEnabled(true); + ui->spin_desk_min->setEnabled(ui->radio_desk_multi->isChecked()); + } + + //Disable the bg remove button if no backgrounds loaded + ui->tool_desk_rmbg->setEnabled(ui->combo_desk_bg->count()>0); + ui->label_desk_bgview->setMinimumSize(10,10); +} + +void page_wallpaper::desktimechanged(){ + ui->spin_desk_min->setEnabled(ui->radio_desk_multi->isChecked()); + if(!loading){ emit HasPendingChanges(true); } +} + +void page_wallpaper::deskbgremoved(){ + if(ui->combo_desk_bg->count()<1){ return; } //nothing to remove + ui->combo_desk_bg->removeItem( ui->combo_desk_bg->currentIndex() ); + emit HasPendingChanges(true); +} + +void page_wallpaper::deskbgadded(){ + //Prompt the user to find an image file to use for a background + QString dir = LOS::LuminaShare().section("/lumina-desktop",0,0)+"/wallpapers/Lumina-DE"; + qDebug() << "Looking for wallpaper dir:" << dir; + if( !QFile::exists(dir) ){ dir = QDir::homePath(); } + QStringList imgs = LUtils::imageExtensions(); + for(int i=0; i<imgs.length(); i++){ imgs[i].prepend("*."); } + QStringList bgs = QFileDialog::getOpenFileNames(this, tr("Find Background Image(s)"), dir, "Images ("+imgs.join(" ")+");;All Files (*)"); + if(bgs.isEmpty()){ return; } + for(int i=0; i<bgs.length(); i++){ + ui->combo_desk_bg->addItem( QIcon(bgs[i]), bgs[i].section("/",-1), bgs[i]); + } + //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()){ + ui->radio_desk_multi->setChecked(true); + } + emit HasPendingChanges(true); +} + +void page_wallpaper::deskbgcoloradded(){ + //Prompt the user to select a color (no transparency allowed) + QString color = getColorStyle("",false); //no initial color + if(color.isEmpty()){ return; } + //Add it to the list + 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); +} + +void page_wallpaper::deskbgdiradded(){ + //Add the files from a single directory + QString dir = LOS::LuminaShare().section("/lumina-desktop",0,0)+"/wallpapers/Lumina-DE"; + qDebug() << "Looking for wallpaper dir:" << dir; + if( !QFile::exists(dir) ){ dir = QDir::homePath(); } + 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])); + } + //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()){ + ui->radio_desk_multi->setChecked(true); + } + emit HasPendingChanges(true); +} + +void page_wallpaper::deskbgdirradded(){ + //Recursively add files from a directory + QString dir = LOS::LuminaShare().section("/lumina-desktop",0,0)+"/wallpapers/Lumina-DE"; + qDebug() << "Looking for wallpaper dir:" << dir; + if( !QFile::exists(dir) ){ dir = QDir::homePath(); } + dir = QFileDialog::getExistingDirectory(this, tr("Find Background Image Directory"), dir, QFileDialog::ReadOnly); + if(dir.isEmpty()){ return; } + //Got a directory - go ahead and get all the valid image file formats + QStringList imgs = LUtils::imageExtensions(); + for(int i=0; i<imgs.length(); i++){ imgs[i].prepend("*."); } + //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] ); + } + //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()){ + ui->radio_desk_multi->setChecked(true); + } + emit HasPendingChanges(true); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_wallpaper.h b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.h new file mode 100644 index 00000000..ece613f9 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.h @@ -0,0 +1,52 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_WALLPAPER_H +#define _LUMINA_CONFIG_PAGE_WALLPAPER_H +#include "../globals.h" +#include "PageWidget.h" + +namespace Ui{ + class page_wallpaper; +}; + +class page_wallpaper : public PageWidget{ + Q_OBJECT +public: + page_wallpaper(QWidget *parent); + ~page_wallpaper(); + + bool needsScreenSelector(){ return true; } + +public slots: + void SaveSettings(); + void LoadSettings(int screennum); + void updateIcons(); + +private: + Ui::page_wallpaper *ui; + int cScreen, cBG; //current screen number/background + QString DEFAULTBG; + bool loading; + + QString getColorStyle(QString current, bool allowTransparency); + +private slots: + void updateMenus(); + void deskbgchanged(); + void desktimechanged(); + void deskbgremoved(); + void deskbgadded(); + void deskbgcoloradded(); + void deskbgdiradded(); + void deskbgdirradded(); + +protected: + void resizeEvent(QResizeEvent*){ + deskbgchanged(); //update the wallpaper preview + } +}; +#endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_wallpaper.ui b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.ui index 9dfbef2c..ca927c69 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_wallpaper.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_wallpaper.ui @@ -15,16 +15,16 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="leftMargin"> - <number>0</number> + <number>9</number> </property> <property name="topMargin"> - <number>0</number> + <number>9</number> </property> <property name="rightMargin"> - <number>0</number> + <number>9</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>9</number> </property> <item> <layout class="QHBoxLayout" name="horizontalLayout_4"> diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index 2ebf2c46..c282a02c 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -1,7 +1,8 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/PageWidget.h \ - $${PWD}/page_main.h + $${PWD}/page_main.h \ + $${PWD}/page_wallpaper.h # $${PWD}/page_autostart.h \ # $${PWD}/page_defaultapps.h \ # $${PWD}/page_fluxbox_keys.h \ @@ -12,10 +13,10 @@ HEADERS += $${PWD}/getPage.h \ # $${PWD}/page_session_locale.h \ # $${PWD}/page_session_options.h \ # $${PWD}/page_theme.h \ -# $${PWD}/page_wallpaper.h - -SOURCES += $${PWD}/page_main.cpp + +SOURCES += $${PWD}/page_main.cpp \ + $${PWD}/page_wallpaper.cpp # $${PWD}/page_autostart.cpp \ # $${PWD}/page_defaultapps.cpp \ # $${PWD}/page_fluxbox_keys.cpp \ @@ -26,9 +27,10 @@ SOURCES += $${PWD}/page_main.cpp # $${PWD}/page_session_locale.cpp \ # $${PWD}/page_session_options.cpp \ # $${PWD}/page_theme.cpp \ -# $${PWD}/page_wallpaper.cpp + -FORMS += $${PWD}/page_main.ui +FORMS += $${PWD}/page_main.ui \ + $${PWD}/page_wallpaper.ui # $${PWD}/page_autostart.ui \ # $${PWD}/page_defaultapps.ui \ # $${PWD}/page_fluxbox_keys.ui \ @@ -39,4 +41,3 @@ FORMS += $${PWD}/page_main.ui # $${PWD}/page_session_locale.ui \ # $${PWD}/page_session_options.ui \ # $${PWD}/page_theme.ui \ -# $${PWD}/page_wallpaper.ui -- cgit From 751e3203f7285e68f9c307c6d1ddac6414367db8 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Fri, 24 Jun 2016 21:25:10 -0400 Subject: Get the new theme page all setup and functional. --- src-qt5/core-utils/lumina-config/globals.h | 1 + src-qt5/core-utils/lumina-config/main.cpp | 4 +- src-qt5/core-utils/lumina-config/pages/getPage.h | 3 + .../core-utils/lumina-config/pages/page_theme.cpp | 168 +++++++++++++++++++++ .../core-utils/lumina-config/pages/page_theme.h | 42 ++++++ .../core-utils/lumina-config/pages/page_theme.ui | 8 +- src-qt5/core-utils/lumina-config/pages/pages.pri | 12 +- 7 files changed, 226 insertions(+), 12 deletions(-) create mode 100644 src-qt5/core-utils/lumina-config/pages/page_theme.cpp create mode 100644 src-qt5/core-utils/lumina-config/pages/page_theme.h diff --git a/src-qt5/core-utils/lumina-config/globals.h b/src-qt5/core-utils/lumina-config/globals.h index f3921976..04c680f4 100644 --- a/src-qt5/core-utils/lumina-config/globals.h +++ b/src-qt5/core-utils/lumina-config/globals.h @@ -26,5 +26,6 @@ #include <LuminaUtils.h> #include <LuminaX11.h> #include <LuminaOS.h> +#include <LuminaThemes.h> #endif diff --git a/src-qt5/core-utils/lumina-config/main.cpp b/src-qt5/core-utils/lumina-config/main.cpp index a63e0fbe..20d517b2 100644 --- a/src-qt5/core-utils/lumina-config/main.cpp +++ b/src-qt5/core-utils/lumina-config/main.cpp @@ -19,8 +19,8 @@ int main(int argc, char ** argv) LuminaThemeEngine theme(&a); - MainUI w; - //mainWindow w; + //MainUI w; + mainWindow w; QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(slotSingleInstance()) ); QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); w.show(); diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index cecc3d87..8d3feb0f 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -27,16 +27,19 @@ static QList<PAGEINFO> KnownPages(){ QList<PAGEINFO> list; //Reminder: <ID>, <name>, <title>, <icon>, <comment>, <category>, <server subsytem list>, <search tags> list << PageInfo("wallpaper", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "theme"); + list << PageInfo("theme", QObject::tr("Change Desktop Theme"), QObject::tr("Theme Settings"), "preferences-desktop-color",QObject::tr("Change interface fonts and colors"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "theme" << "plugins"); return list; } //Add any sub-pages here #include "page_main.h" #include "page_wallpaper.h" +#include "page_theme.h" static PageWidget* GetNewPage(QString id, QWidget *parent){ //Find the page that matches this "id" if(id=="wallpaper"){ return new page_wallpaper(parent); } + else if(id=="theme"){ return new page_theme(parent); } //Return the main control_panel page as the fallback/default return new page_main(parent); } diff --git a/src-qt5/core-utils/lumina-config/pages/page_theme.cpp b/src-qt5/core-utils/lumina-config/pages/page_theme.cpp new file mode 100644 index 00000000..781e650d --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_theme.cpp @@ -0,0 +1,168 @@ +//=========================================== +// Lumina-DE source code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_theme.h" +#include "ui_page_theme.h" + +#include "../ColorDialog.h" +#include "../ThemeDialog.h" +//========== +// PUBLIC +//========== +page_theme::page_theme(QWidget *parent) : PageWidget(parent), ui(new Ui::page_theme()){ + ui->setupUi(this); + loading = false; + PINFO = new LPlugins(); //load the info class + connect(ui->spin_session_fontsize, SIGNAL(valueChanged(int)), this, SLOT(settingsChanged()) ); + connect(ui->combo_session_themefile, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsChanged()) ); + connect(ui->combo_session_colorfile, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsChanged()) ); + connect(ui->combo_session_icontheme, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsChanged()) ); + connect(ui->font_session_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(settingsChanged()) ); + connect(ui->tool_session_newcolor, SIGNAL(clicked()), this, SLOT(sessionEditColor()) ); + connect(ui->tool_session_newtheme, SIGNAL(clicked()), this, SLOT(sessionEditTheme()) ); + + updateIcons(); +} + +page_theme::~page_theme(){ + +} + +//================ +// PUBLIC SLOTS +//================ +void page_theme::SaveSettings(){ + QString themefile = ui->combo_session_themefile->itemData( ui->combo_session_themefile->currentIndex() ).toString(); + QString colorfile = ui->combo_session_colorfile->itemData( ui->combo_session_colorfile->currentIndex() ).toString(); + QString iconset = ui->combo_session_icontheme->currentText(); + QString font = ui->font_session_theme->currentFont().family(); + QString fontsize = QString::number(ui->spin_session_fontsize->value())+"pt"; + //qDebug() << "Saving theme options:" << themefile << colorfile << iconset << font << fontsize; + LTHEME::setCurrentSettings( themefile, colorfile, iconset, font, fontsize); + LTHEME::setCursorTheme(ui->combo_session_cursortheme->currentText()); + emit HasPendingChanges(false); +} + +void page_theme::LoadSettings(int){ + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Theme Settings") ); + + loading = true; + //Load the available settings + ui->combo_session_cursortheme->clear(); + ui->combo_session_cursortheme->addItems( LTHEME::availableSystemCursors() ); + +ui->combo_session_themefile->clear(); + ui->combo_session_colorfile->clear(); + ui->combo_session_icontheme->clear(); + QStringList current = LTHEME::currentSettings(); + // - local theme templates + QStringList tmp = LTHEME::availableLocalThemes(); + tmp.sort(); + 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++){ + 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++){ + 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++){ + 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++){ + ui->combo_session_icontheme->addItem(tmp[i]); + if(tmp[i]==current[2]){ ui->combo_session_icontheme->setCurrentIndex(i); } + } + // - Font + 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); } + + QApplication::processEvents(); + loading = false; +} + +void page_theme::updateIcons(){ + ui->tool_session_newtheme->setIcon( LXDG::findIcon("preferences-desktop-theme","") ); + ui->tool_session_newcolor->setIcon( LXDG::findIcon("preferences-desktop-color","") ); +} + +//================= +// PRIVATE SLOTS +//================= +void page_theme::sessionEditColor(){ + //Get the current color file + QString file = ui->combo_session_colorfile->itemData( ui->combo_session_colorfile->currentIndex() ).toString(); + //Open the color edit dialog + ColorDialog dlg(this, PINFO, file); + dlg.exec(); + //Check whether the file got saved/changed + if(dlg.colorname.isEmpty() || dlg.colorpath.isEmpty() ){ return; } //cancelled + //Reload the color list and activate the new color + // - local color schemes + ui->combo_session_colorfile->clear(); + QStringList tmp = LTHEME::availableLocalColors(); + tmp.sort(); + 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++){ + 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); } + } + emit HasPendingChanges(true); +} + +void page_theme::sessionEditTheme(){ + QString file = ui->combo_session_themefile->itemData( ui->combo_session_themefile->currentIndex() ).toString(); + //Open the theme editor dialog + ThemeDialog dlg(this, PINFO, file); + dlg.exec(); + //Check for file change/save + if(dlg.themename.isEmpty() || dlg.themepath.isEmpty()){ return; } //cancelled + //Reload the theme list and activate the new theme + ui->combo_session_themefile->clear(); + // - local theme templates + QStringList tmp = LTHEME::availableLocalThemes(); + tmp.sort(); + 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++){ + 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); } + } + emit HasPendingChanges(true); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_theme.h b/src-qt5/core-utils/lumina-config/pages/page_theme.h new file mode 100644 index 00000000..a56fba7b --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_theme.h @@ -0,0 +1,42 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_THEME_H +#define _LUMINA_CONFIG_PAGE_THEME_H +#include "../globals.h" +#include "PageWidget.h" + +#include "../LPlugins.h" + +namespace Ui{ + class page_theme; +}; + +class page_theme : public PageWidget{ + Q_OBJECT +public: + page_theme(QWidget *parent); + ~page_theme(); + +public slots: + void SaveSettings(); + void LoadSettings(int screennum); + void updateIcons(); + +private: + Ui::page_theme *ui; + LPlugins *PINFO; + bool loading; + +private slots: + void settingsChanged(){ + //qDebug() << "Setting Changed:" << !loading; + if(!loading){ emit HasPendingChanges(true); } + } + void sessionEditColor(); + void sessionEditTheme(); +}; +#endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_theme.ui b/src-qt5/core-utils/lumina-config/pages/page_theme.ui index 9c5e2064..decd543f 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_theme.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_theme.ui @@ -15,16 +15,16 @@ </property> <layout class="QFormLayout" name="formLayout"> <property name="leftMargin"> - <number>0</number> + <number>9</number> </property> <property name="topMargin"> - <number>0</number> + <number>9</number> </property> <property name="rightMargin"> - <number>0</number> + <number>9</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>9</number> </property> <item row="0" column="0"> <widget class="QLabel" name="label_12"> diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index c282a02c..7fd3b19c 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -2,7 +2,8 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/PageWidget.h \ $${PWD}/page_main.h \ - $${PWD}/page_wallpaper.h + $${PWD}/page_wallpaper.h \ + $${PWD}/page_theme.h # $${PWD}/page_autostart.h \ # $${PWD}/page_defaultapps.h \ # $${PWD}/page_fluxbox_keys.h \ @@ -12,11 +13,11 @@ HEADERS += $${PWD}/getPage.h \ # $${PWD}/page_interface_panels.h \ # $${PWD}/page_session_locale.h \ # $${PWD}/page_session_options.h \ -# $${PWD}/page_theme.h \ SOURCES += $${PWD}/page_main.cpp \ - $${PWD}/page_wallpaper.cpp + $${PWD}/page_wallpaper.cpp \ + $${PWD}/page_theme.cpp # $${PWD}/page_autostart.cpp \ # $${PWD}/page_defaultapps.cpp \ # $${PWD}/page_fluxbox_keys.cpp \ @@ -26,11 +27,11 @@ SOURCES += $${PWD}/page_main.cpp \ # $${PWD}/page_interface_panels.cpp \ # $${PWD}/page_session_locale.cpp \ # $${PWD}/page_session_options.cpp \ -# $${PWD}/page_theme.cpp \ FORMS += $${PWD}/page_main.ui \ - $${PWD}/page_wallpaper.ui + $${PWD}/page_wallpaper.ui \ + $${PWD}/page_theme.ui # $${PWD}/page_autostart.ui \ # $${PWD}/page_defaultapps.ui \ # $${PWD}/page_fluxbox_keys.ui \ @@ -40,4 +41,3 @@ FORMS += $${PWD}/page_main.ui \ # $${PWD}/page_interface_panels.ui \ # $${PWD}/page_session_locale.ui \ # $${PWD}/page_session_options.ui \ -# $${PWD}/page_theme.ui \ -- cgit From bbb523a3b6b204e4f127f45dc151165086eb970c Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Fri, 24 Jun 2016 21:50:04 -0400 Subject: Switch back to the old UI for now (new one still not finished yet). Also have the monitor selection on the new UI hidden if there is only one monitor available. --- src-qt5/core-utils/lumina-config/main.cpp | 4 ++-- src-qt5/core-utils/lumina-config/mainWindow.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src-qt5/core-utils/lumina-config/main.cpp b/src-qt5/core-utils/lumina-config/main.cpp index 20d517b2..a63e0fbe 100644 --- a/src-qt5/core-utils/lumina-config/main.cpp +++ b/src-qt5/core-utils/lumina-config/main.cpp @@ -19,8 +19,8 @@ int main(int argc, char ** argv) LuminaThemeEngine theme(&a); - //MainUI w; - mainWindow w; + MainUI w; + //mainWindow w; QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(slotSingleInstance()) ); QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); w.show(); diff --git a/src-qt5/core-utils/lumina-config/mainWindow.cpp b/src-qt5/core-utils/lumina-config/mainWindow.cpp index 95a420e8..9121d295 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.cpp +++ b/src-qt5/core-utils/lumina-config/mainWindow.cpp @@ -85,7 +85,7 @@ void mainWindow::changePage(QString id){ //Now load the new page page->LoadSettings(ui->actionMonitor->whatsThis().toInt()); //need to make this show the current screen as needed //Now update this UI a bit based on page settings - ui->actionMonitor->setVisible( page->needsScreenSelector() );// && ui->actionMonitor->menu()->actions().length()>1 ); + ui->actionMonitor->setVisible( page->needsScreenSelector() && ui->actionMonitor->menu()->actions().length()>1 ); this->showNormal(); } -- cgit From 190781e33b6a94b0708a76fa3a2b8d6a50bf7107 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Mon, 27 Jun 2016 13:03:08 -0400 Subject: Add in the search capabilities within the new lumina-config UI. --- src-qt5/core-utils/lumina-config/KeyCatch.h | 106 --------------------- src-qt5/core-utils/lumina-config/KeyCatch.ui | 88 ----------------- src-qt5/core-utils/lumina-config/lumina-config.pro | 4 +- src-qt5/core-utils/lumina-config/main.cpp | 4 +- .../core-utils/lumina-config/pages/page_main.cpp | 21 ++-- src-qt5/core-utils/lumina-config/pages/page_main.h | 1 + .../core-utils/lumina-config/pages/page_main.ui | 14 ++- 7 files changed, 31 insertions(+), 207 deletions(-) delete mode 100644 src-qt5/core-utils/lumina-config/KeyCatch.h delete mode 100644 src-qt5/core-utils/lumina-config/KeyCatch.ui diff --git a/src-qt5/core-utils/lumina-config/KeyCatch.h b/src-qt5/core-utils/lumina-config/KeyCatch.h deleted file mode 100644 index 03193972..00000000 --- a/src-qt5/core-utils/lumina-config/KeyCatch.h +++ /dev/null @@ -1,106 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -// This is the dialog for catching keyboard events and converting them to X11 keycodes -//=========================================== -#ifndef _LUMINA_FILE_MANAGER_KEY_CATCH_DIALOG_H -#define _LUMINA_FILE_MANAGER_KEY_CATCH_DIALOG_H - -// Qt includes -#include <QDialog> -#include <QKeyEvent> -#include <QString> -#include <QDebug> - -#include "ui_KeyCatch.h" - -namespace Ui{ - class KeyCatch; -}; - -class KeyCatch : public QDialog{ - Q_OBJECT - -private: - Ui::KeyCatch *ui; - QList<int> mods; -public: - QString xkeys, qkeys; - bool cancelled; - - KeyCatch(QWidget *parent = 0) : QDialog(parent), ui(new Ui::KeyCatch){ - ui->setupUi(this); - mods << Qt::Key_Escape << Qt::Key_Tab << Qt::Key_Enter << Qt::Key_Return << Qt::Key_Shift << Qt::Key_Control << Qt::Key_Meta << Qt::Key_Alt; - cancelled=true; //assume cancelled in case the user closes the window - this->show(); - this->grabKeyboard(); //will automatically release when the window closes - } - ~KeyCatch(){} - -private slots: - void on_buttonBox_rejected(){ - cancelled=true; - this->close(); - } - -protected: - void keyPressEvent(QKeyEvent *event){ - //Don't catch if the main key is a modifier (shift,ctrl,alt,other..) - if(event->key()==0 && event->nativeVirtualKey()==0){ return; } //invalid "special" key - else if( !mods.contains(event->key()) ){ - //Get the modifiers first (if any) - if(!QKeySequence(event->modifiers()).toString().isEmpty()){// && event->nativeModifiers()!=16){ - if(event->modifiers()!=Qt::KeypadModifier){ - qkeys = QKeySequence(event->modifiers()).toString(); - } - - /*//Ignore modifiers that result in a different keycode entirely (shift+a != (shift) + (a) ) - if(event->modifiers()!=Qt::ShiftModifier && event->modifiers()!=Qt::KeypadModifier){ - //Convert the modifier to the fluxbox equivilent - QStringList mod = qkeys.split("+"); - for(int i=0; i<mod.length(); i++){ - QString key = mod[i].toLower(); - if(key=="shift"){} //this is also a valid fluxbox code - else if(key=="meta"){ key = "Mod4"; } - else if(key=="ctrl"){ key = "control"; } - else if(key=="alt"){ key = "Mod1"; } - else{ key.clear(); } //unknown fluxbox modifier - if(!key.isEmpty()){ xkeys.append(key+" "); } - } - }*/ - - } - //Now get the main key - qkeys.replace("+"," "); - if(event->key()==0){ - if(qkeys.isEmpty()){ qkeys="None "; } //For Fluxbox, need "None <X Key number>" - qkeys.append( QString::number(event->nativeVirtualKey()) ); - }else{ - qkeys.append( QKeySequence(event->key()).toString() ); //also save the text version (for display) - } - //Remove the modifier if it is only "shift", and the main key is not a symbol - xkeys = qkeys; - qkeys.remove("None "); //The display/Qt keycode does not need to show this - if(!xkeys.section(" ",-1).isEmpty() && xkeys.contains("Shift ")){ - if(!xkeys.section(" ",-1).at(0).isLetter()){ - xkeys.remove("Shift "); //The symbol/keycode is already different - qkeys.remove("Shift "); - } - } - qDebug() << "Found Key Press:"; - qDebug() << " - Native Virtual Key:" << event->nativeVirtualKey(); - qDebug() << " - Qt Key Sequence:" << QKeySequence(event->key()).toString(); - qDebug() << " - Full Detected Sequence (Display):" << qkeys; - qDebug() << " - Full Detected Sequence (backend):" << xkeys; - //Now close the dialog - cancelled=false; - this->close(); - } - } - -}; - -#endif diff --git a/src-qt5/core-utils/lumina-config/KeyCatch.ui b/src-qt5/core-utils/lumina-config/KeyCatch.ui deleted file mode 100644 index 99f4095d..00000000 --- a/src-qt5/core-utils/lumina-config/KeyCatch.ui +++ /dev/null @@ -1,88 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>KeyCatch</class> - <widget class="QDialog" name="KeyCatch"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>439</width> - <height>147</height> - </rect> - </property> - <property name="windowTitle"> - <string>Key Press Detection</string> - </property> - <property name="modal"> - <bool>false</bool> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="label"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Press the keys you wish to assign.</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item> - <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> - <item> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Notes: -Special keys can only be detected if the proper keyboard driver is in use. -Current keyboard bindings will also be ignored.</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QDialogButtonBox" name="buttonBox"> - <property name="standardButtons"> - <set>QDialogButtonBox::Cancel</set> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src-qt5/core-utils/lumina-config/lumina-config.pro b/src-qt5/core-utils/lumina-config/lumina-config.pro index 4560036c..f7359df9 100644 --- a/src-qt5/core-utils/lumina-config/lumina-config.pro +++ b/src-qt5/core-utils/lumina-config/lumina-config.pro @@ -22,7 +22,6 @@ SOURCES += main.cpp \ HEADERS += mainUI.h \ mainWindow.h \ LPlugins.h \ - KeyCatch.h \ AppDialog.h \ ColorDialog.h \ ThemeDialog.h \ @@ -31,7 +30,6 @@ HEADERS += mainUI.h \ FORMS += mainUI.ui \ mainWindow.ui \ - KeyCatch.ui \ AppDialog.ui \ ColorDialog.ui \ ThemeDialog.ui \ @@ -45,7 +43,7 @@ include("pages/pages.pri") LIBS += -lLuminaUtils -DEPENDPATH += ../libLumina +DEPENDPATH += ../../core/libLumina TRANSLATIONS = i18n/lumina-config_af.ts \ i18n/lumina-config_ar.ts \ diff --git a/src-qt5/core-utils/lumina-config/main.cpp b/src-qt5/core-utils/lumina-config/main.cpp index a63e0fbe..20d517b2 100644 --- a/src-qt5/core-utils/lumina-config/main.cpp +++ b/src-qt5/core-utils/lumina-config/main.cpp @@ -19,8 +19,8 @@ int main(int argc, char ** argv) LuminaThemeEngine theme(&a); - MainUI w; - //mainWindow w; + //MainUI w; + mainWindow w; QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(slotSingleInstance()) ); QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); w.show(); 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 c853f06c..02065b78 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_main.cpp @@ -14,6 +14,7 @@ page_main::page_main(QWidget *parent) : PageWidget(parent), ui(new Ui::page_main()){ ui->setupUi(this); connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); + connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(searchChanged(QString)) ); } page_main::~page_main(){ @@ -36,13 +37,17 @@ void page_main::UpdateItems(QString search){ apps->setIcon(0, LXDG::findIcon("preferences-desktop-filetype-association","")); apps->setText(0, tr("Application Settings")); //Now go through and add in the known pages for each category + QStringList SL = search.split(" "); //search list for(int i=0; i<INFO.length(); i++){ if(!search.isEmpty() ){ //See if this item needs to be included or not QStringList info; info << INFO[i].name.split(" ") << INFO[i].title.split(" ") << INFO[i].comment.split(" ") << INFO[i].search_tags; info.removeDuplicates(); //remove any duplicate terms/info first - info << search.split(" "); //add the terms we want to search for - if(0<info.removeDuplicates()){ continue; } //no duplicates between search terms and available info + bool ok = true; + for(int s=0; s<SL.length() && ok; s++){ + ok = !info.filter(SL[s]).isEmpty(); + } + if(!ok){ continue; } //no duplicates between search terms and available info } qDebug() << "Item Found:" << INFO[i].id << INFO[i].title; QTreeWidgetItem *it = new QTreeWidgetItem(); @@ -58,10 +63,10 @@ void page_main::UpdateItems(QString search){ else{ ui->treeWidget->addTopLevelItem(it); } } //Now add the categories to the tree widget if they are non-empty - if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); } - if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); } - if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); } - if(apps->childCount()>0){ ui->treeWidget->addTopLevelItem(apps); } + if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); interface->setExpanded(true); } + if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); appearance->setExpanded(true); } + if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); session->setExpanded(true); } + if(apps->childCount()>0){ ui->treeWidget->addTopLevelItem(apps); apps->setExpanded(true); } } //================ @@ -93,3 +98,7 @@ void page_main::itemTriggered(QTreeWidgetItem *it){ emit ChangePage(it->whatsThis(0)); } } + +void page_main::searchChanged(QString txt){ + UpdateItems(txt.simplified()); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_main.h b/src-qt5/core-utils/lumina-config/pages/page_main.h index 0b24b6da..2e38eb64 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.h +++ b/src-qt5/core-utils/lumina-config/pages/page_main.h @@ -32,5 +32,6 @@ private: private slots: void itemTriggered(QTreeWidgetItem*); + void searchChanged(QString); }; #endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_main.ui b/src-qt5/core-utils/lumina-config/pages/page_main.ui index 3d9626c1..2331152b 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_main.ui @@ -15,19 +15,29 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="leftMargin"> - <number>0</number> + <number>2</number> </property> <property name="topMargin"> <number>0</number> </property> <property name="rightMargin"> - <number>0</number> + <number>2</number> </property> <property name="bottomMargin"> <number>0</number> </property> + <item> + <widget class="QLineEdit" name="lineEdit"> + <property name="placeholderText"> + <string>Search for....</string> + </property> + </widget> + </item> <item> <widget class="QTreeWidget" name="treeWidget"> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> <property name="styleSheet"> <string notr="true">QTreeWidget{background: transparent; }</string> </property> -- cgit From 97ebf1fe2679724a889e123a9c07b59f2f6eac89 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Mon, 27 Jun 2016 13:16:41 -0400 Subject: Finish up the interactions on the main selection page in the new UI. --- src-qt5/core-utils/lumina-config/pages/page_main.cpp | 2 ++ 1 file changed, 2 insertions(+) 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 02065b78..67e41cc4 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_main.cpp @@ -13,7 +13,9 @@ //========== page_main::page_main(QWidget *parent) : PageWidget(parent), ui(new Ui::page_main()){ ui->setupUi(this); + ui->treeWidget->setMouseTracking(true); connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); + connect(ui->treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(searchChanged(QString)) ); } -- cgit From 1010381477f79fd229503bfe66c75073952e3fb7 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Mon, 27 Jun 2016 14:35:00 -0400 Subject: Add in the new autostart services UI page. Also cleanup a bit more of the shortcuts and page interactions. --- src-qt5/core-utils/lumina-config/globals.h | 1 + src-qt5/core-utils/lumina-config/mainWindow.cpp | 7 +- src-qt5/core-utils/lumina-config/mainWindow.h | 1 + src-qt5/core-utils/lumina-config/mainWindow.ui | 4 +- .../core-utils/lumina-config/pages/PageWidget.h | 4 +- src-qt5/core-utils/lumina-config/pages/getPage.h | 7 +- .../lumina-config/pages/page_autostart.cpp | 153 +++++++++++++++++++++ .../lumina-config/pages/page_autostart.h | 38 +++++ .../lumina-config/pages/page_autostart.ui | 128 ++++++++++------- .../core-utils/lumina-config/pages/page_main.cpp | 1 + src-qt5/core-utils/lumina-config/pages/pages.pri | 12 +- 11 files changed, 292 insertions(+), 64 deletions(-) create mode 100644 src-qt5/core-utils/lumina-config/pages/page_autostart.cpp create mode 100644 src-qt5/core-utils/lumina-config/pages/page_autostart.h diff --git a/src-qt5/core-utils/lumina-config/globals.h b/src-qt5/core-utils/lumina-config/globals.h index 04c680f4..b7468970 100644 --- a/src-qt5/core-utils/lumina-config/globals.h +++ b/src-qt5/core-utils/lumina-config/globals.h @@ -20,6 +20,7 @@ #include <QFileDialog> #include <QColorDialog> #include <QMessageBox> +#include <QShortcut> //Now the Lumina Library classes #include <LuminaXDG.h> diff --git a/src-qt5/core-utils/lumina-config/mainWindow.cpp b/src-qt5/core-utils/lumina-config/mainWindow.cpp index 9121d295..3102fe7b 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.cpp +++ b/src-qt5/core-utils/lumina-config/mainWindow.cpp @@ -20,6 +20,8 @@ mainWindow::mainWindow() : QMainWindow(), ui(new Ui::mainWindow()){ QWidget *tmp = new QWidget(this); tmp->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); ui->toolBar->insertWidget(ui->actionSave, tmp); //after the save button + backShortcut = new QShortcut(Qt::Key_Escape, this); + connect(backShortcut, SIGNAL(activated()), this, SLOT(on_actionBack_triggered()) ); setupIcons(); loadMonitors(); changePage(""); //load the default main page @@ -37,6 +39,7 @@ void mainWindow::slotSingleInstance(){ } void mainWindow::setupIcons(){ + this->setWindowIcon( LXDG::findIcon("preferences-desktop") ); ui->actionSave->setIcon( LXDG::findIcon("document-save","") ); ui->actionBack->setIcon( LXDG::findIcon("go-previous-view","") ); ui->actionMonitor->setIcon(LXDG::findIcon("preferences-desktop-display","") ); @@ -81,12 +84,14 @@ void mainWindow::changePage(QString id){ connect(page, SIGNAL(HasPendingChanges(bool)), this, SLOT(pageCanSave(bool)) ); connect(page, SIGNAL(ChangePageTitle(QString)), this, SLOT(pageSetTitle(QString)) ); connect(page, SIGNAL(ChangePage(QString)), this, SLOT(page_change(QString)) ); + page->setFocus(); + ui->toolBar->setVisible( !cpage.isEmpty() ); } //Now load the new page page->LoadSettings(ui->actionMonitor->whatsThis().toInt()); //need to make this show the current screen as needed //Now update this UI a bit based on page settings ui->actionMonitor->setVisible( page->needsScreenSelector() && ui->actionMonitor->menu()->actions().length()>1 ); - + this->showNormal(); } //================ diff --git a/src-qt5/core-utils/lumina-config/mainWindow.h b/src-qt5/core-utils/lumina-config/mainWindow.h index 3e632f4d..14969473 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.h +++ b/src-qt5/core-utils/lumina-config/mainWindow.h @@ -25,6 +25,7 @@ public slots: private: Ui::mainWindow *ui; + QShortcut *backShortcut; QString cpage; //current page diff --git a/src-qt5/core-utils/lumina-config/mainWindow.ui b/src-qt5/core-utils/lumina-config/mainWindow.ui index 538d1864..0a9f6896 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.ui +++ b/src-qt5/core-utils/lumina-config/mainWindow.ui @@ -66,8 +66,8 @@ <property name="statusTip"> <string>Back to overall settings</string> </property> - <property name="shortcut"> - <string>Esc</string> + <property name="shortcutContext"> + <enum>Qt::ApplicationShortcut</enum> </property> </action> <action name="actionMonitor"> diff --git a/src-qt5/core-utils/lumina-config/pages/PageWidget.h b/src-qt5/core-utils/lumina-config/pages/PageWidget.h index 937e6692..bee27d24 100644 --- a/src-qt5/core-utils/lumina-config/pages/PageWidget.h +++ b/src-qt5/core-utils/lumina-config/pages/PageWidget.h @@ -28,7 +28,9 @@ class PageWidget : public QWidget{ public: //Main constructor/destructor (create/destroy any interface items) - PageWidget(QWidget *parent) : QWidget(parent){} + PageWidget(QWidget *parent) : QWidget(parent){ + //this->setFocusPolicy(Qt::NoFocus); + } ~PageWidget(){} virtual bool needsScreenSelector(){ return false; } //change this to true for pages which load/set options on a per-screen basis diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index 8d3feb0f..33b0e77a 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -26,8 +26,9 @@ static QList<PAGEINFO> KnownPages(){ // Valid Groups: ["appearance", "interface", "session", "apps"] QList<PAGEINFO> list; //Reminder: <ID>, <name>, <title>, <icon>, <comment>, <category>, <server subsytem list>, <search tags> - list << PageInfo("wallpaper", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "theme"); - list << PageInfo("theme", QObject::tr("Change Desktop Theme"), QObject::tr("Theme Settings"), "preferences-desktop-color",QObject::tr("Change interface fonts and colors"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "theme" << "plugins"); + list << PageInfo("wallpaper", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "image"); + list << PageInfo("theme", QObject::tr("Change Desktop Theme"), QObject::tr("Theme Settings"), "preferences-desktop-theme",QObject::tr("Change interface fonts and colors"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "theme" << "plugins"); + list << PageInfo("autostart", QObject::tr("Startup Services and Applications"), QObject::tr("Startup Settings"), "preferences-system-session-services",QObject::tr("Automatically start applications or services"), "session", QStringList(), QStringList() << "apps" << "autostart" << "services" << "xdg" << "startup" << "session"); return list; } @@ -35,11 +36,13 @@ static QList<PAGEINFO> KnownPages(){ #include "page_main.h" #include "page_wallpaper.h" #include "page_theme.h" +#include "page_autostart.h" static PageWidget* GetNewPage(QString id, QWidget *parent){ //Find the page that matches this "id" if(id=="wallpaper"){ return new page_wallpaper(parent); } else if(id=="theme"){ return new page_theme(parent); } + else if(id=="autostart"){ return new page_autostart(parent); } //Return the main control_panel page as the fallback/default return new page_main(parent); } diff --git a/src-qt5/core-utils/lumina-config/pages/page_autostart.cpp b/src-qt5/core-utils/lumina-config/pages/page_autostart.cpp new file mode 100644 index 00000000..b7c52fb7 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_autostart.cpp @@ -0,0 +1,153 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_autostart.h" +#include "ui_page_autostart.h" +#include "getPage.h" + +#include "../AppDialog.h" +//========== +// PUBLIC +//========== +page_autostart::page_autostart(QWidget *parent) : PageWidget(parent), ui(new Ui::page_autostart()){ + ui->setupUi(this); + ui->list_session_start->setMouseTracking(true); + updateIcons(); + connect(ui->tool_session_addapp, SIGNAL(clicked()), this, SLOT(addsessionstartapp()) ); + connect(ui->tool_session_addbin, SIGNAL(clicked()), this, SLOT(addsessionstartbin()) ); + connect(ui->tool_session_addfile, SIGNAL(clicked()), this, SLOT(addsessionstartfile()) ); + connect(ui->list_session_start, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(settingChanged()) ); +} + +page_autostart::~page_autostart(){ + +} + + + +//================ +// PUBLIC SLOTS +//================ +void page_autostart::SaveSettings(){ + QList<XDGDesktop> STARTAPPS = LXDG::findAutoStartFiles(true); //also want invalid/disabled items + //bool newstartapps = false; + for(int i=0; i<ui->list_session_start->count(); i++){ + QString file = ui->list_session_start->item(i)->whatsThis(); + bool enabled = ui->list_session_start->item(i)->checkState()==Qt::Checked; + bool found = false; + for(int i=0; i<STARTAPPS.length(); i++){ + if(STARTAPPS[i].filePath==file){ + found = true; + if(enabled != !STARTAPPS[i].isHidden){ + //value is different + qDebug() << "Setting Autostart:" << enabled << STARTAPPS[i].filePath; + LXDG::setAutoStarted(enabled, STARTAPPS[i]); + } + break; + } + } + if(!found && enabled){ + //New file/binary/app + qDebug() << "Adding new AutoStart File:" << file; + LXDG::setAutoStarted(enabled, file); + //newstartapps = true; + } + } +} + +void page_autostart::LoadSettings(int){ + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Startup Services") ); + QList<XDGDesktop> STARTAPPS = LXDG::findAutoStartFiles(true); //also want invalid/disabled items + //qDebug() << "StartApps:"; + ui->list_session_start->clear(); + for(int i=0; i<STARTAPPS.length(); i++){ + //qDebug() << STARTAPPS[i].filePath +" -> " +STARTAPPS[i].name << STARTAPPS[i].isHidden; + if( !LXDG::checkValidity(STARTAPPS[i],false) || !QFile::exists(STARTAPPS[i].filePath) ){ continue; } + QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(STARTAPPS[i].icon,"application-x-executable"), STARTAPPS[i].name ); + it->setWhatsThis(STARTAPPS[i].filePath); //keep the file location + it->setToolTip(STARTAPPS[i].comment); + if(STARTAPPS[i].isHidden){ it->setCheckState( Qt::Unchecked); } + else{it->setCheckState( Qt::Checked); } + ui->list_session_start->addItem(it); + } +} + +void page_autostart::updateIcons(){ + ui->tool_session_addapp->setIcon( LXDG::findIcon("system-run","") ); + ui->tool_session_addbin->setIcon( LXDG::findIcon("system-search","") ); + ui->tool_session_addfile->setIcon( LXDG::findIcon("run-build-file","") ); +} + +//================= +// PRIVATE +//================= +XDGDesktop page_autostart::getSysApp(bool allowreset){ + AppDialog dlg(this, LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ) ); + dlg.allowReset(allowreset); + dlg.exec(); + XDGDesktop desk; + if(dlg.appreset && allowreset){ + desk.filePath = "reset"; //special internal flag + }else{ + desk = dlg.appselected; + } + return desk; +} + +//================= +// PRIVATE SLOTS +//================= +void page_autostart::rmsessionstartitem(){ + if(ui->list_session_start->currentRow() < 0){ return; } //no item selected + delete ui->list_session_start->takeItem(ui->list_session_start->currentRow()); + settingChanged(); +} + +void page_autostart::addsessionstartapp(){ + //Prompt for the application to start + XDGDesktop desk = getSysApp(false); //no reset + if(desk.filePath.isEmpty()){ return; } //cancelled + QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name ); + it->setWhatsThis(desk.filePath); + it->setToolTip(desk.comment); + it->setCheckState(Qt::Checked); + + ui->list_session_start->addItem(it); + ui->list_session_start->setCurrentItem(it); + settingChanged(); +} + +void page_autostart::addsessionstartbin(){ + QString chkpath = LOS::AppPrefix() + "bin"; + if(!QFile::exists(chkpath)){ chkpath = QDir::homePath(); } + QString bin = QFileDialog::getOpenFileName(this, tr("Select Binary"), chkpath, tr("Application Binaries (*)") ); + if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled + if( !QFileInfo(bin).isExecutable() ){ + QMessageBox::warning(this, tr("Invalid Binary"), tr("The selected file is not executable!")); + return; + } + QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon("application-x-executable",""), bin.section("/",-1) ); + it->setWhatsThis(bin); //command to be saved/run + it->setToolTip(bin); + it->setCheckState(Qt::Checked); + ui->list_session_start->addItem(it); + ui->list_session_start->setCurrentItem(it); + settingChanged(); +} + +void page_autostart::addsessionstartfile(){ + QString chkpath = QDir::homePath(); + QString bin = QFileDialog::getOpenFileName(this, tr("Select File"), chkpath, tr("All Files (*)") ); + if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled + QListWidgetItem *it = new QListWidgetItem( LXDG::findMimeIcon(bin), bin.section("/",-1) ); + it->setWhatsThis(bin); //file to be saved/run + it->setToolTip(bin); + it->setCheckState(Qt::Checked); + ui->list_session_start->addItem(it); + ui->list_session_start->setCurrentItem(it); + settingChanged(); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_autostart.h b/src-qt5/core-utils/lumina-config/pages/page_autostart.h new file mode 100644 index 00000000..88f1ef94 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_autostart.h @@ -0,0 +1,38 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_AUTOSTART_H +#define _LUMINA_CONFIG_PAGE_AUTOSTART_H +#include "../globals.h" +#include "PageWidget.h" + +namespace Ui{ + class page_autostart; +}; + +class page_autostart : public PageWidget{ + Q_OBJECT +public: + page_autostart(QWidget *parent); + ~page_autostart(); + +public slots: + void SaveSettings(); + void LoadSettings(int screennum); + void updateIcons(); + +private: + Ui::page_autostart *ui; + + XDGDesktop getSysApp(bool allowreset); + +private slots: + void rmsessionstartitem(); + void addsessionstartapp(); + void addsessionstartbin(); + void addsessionstartfile(); +}; +#endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_autostart.ui b/src-qt5/core-utils/lumina-config/pages/page_autostart.ui index 0d49005d..b286b4a5 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_autostart.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_autostart.ui @@ -15,71 +15,95 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="leftMargin"> - <number>0</number> + <number>9</number> </property> <property name="topMargin"> - <number>0</number> + <number>6</number> </property> <property name="rightMargin"> - <number>0</number> + <number>9</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>9</number> </property> <item> - <layout class="QHBoxLayout" name="horizontalLayout_18"> - <item> - <spacer name="horizontalSpacer_15"> - <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="QToolButton" name="tool_session_addapp_2"> - <property name="text"> - <string>Application</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_session_addbin_2"> - <property name="text"> - <string>Binary</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_session_addfile_2"> - <property name="text"> - <string>File</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QListWidget" name="list_session_start_2"> + <widget class="QListWidget" name="list_session_start"> <property name="sortingEnabled"> <bool>true</bool> </property> </widget> </item> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Add New Startup Service</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_18"> + <item> + <spacer name="horizontalSpacer_15"> + <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="QToolButton" name="tool_session_addapp"> + <property name="text"> + <string>Application</string> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_session_addbin"> + <property name="text"> + <string>Binary</string> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="tool_session_addfile"> + <property name="text"> + <string>File</string> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> </layout> </widget> <resources/> 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 67e41cc4..f8168e0b 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_main.cpp @@ -84,6 +84,7 @@ void page_main::LoadSettings(int){ INFO.clear(); INFO = KnownPages(); UpdateItems(""); + ui->lineEdit->setFocus(); } void page_main::updateIcons(){ diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index 7fd3b19c..7610e946 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -3,8 +3,8 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/PageWidget.h \ $${PWD}/page_main.h \ $${PWD}/page_wallpaper.h \ - $${PWD}/page_theme.h -# $${PWD}/page_autostart.h \ + $${PWD}/page_theme.h \ + $${PWD}/page_autostart.h # $${PWD}/page_defaultapps.h \ # $${PWD}/page_fluxbox_keys.h \ # $${PWD}/page_fluxbox_settings.h \ @@ -17,8 +17,8 @@ HEADERS += $${PWD}/getPage.h \ SOURCES += $${PWD}/page_main.cpp \ $${PWD}/page_wallpaper.cpp \ - $${PWD}/page_theme.cpp -# $${PWD}/page_autostart.cpp \ + $${PWD}/page_theme.cpp \ + $${PWD}/page_autostart.cpp # $${PWD}/page_defaultapps.cpp \ # $${PWD}/page_fluxbox_keys.cpp \ # $${PWD}/page_fluxbox_settings.cpp \ @@ -31,8 +31,8 @@ SOURCES += $${PWD}/page_main.cpp \ FORMS += $${PWD}/page_main.ui \ $${PWD}/page_wallpaper.ui \ - $${PWD}/page_theme.ui -# $${PWD}/page_autostart.ui \ + $${PWD}/page_theme.ui \ + $${PWD}/page_autostart.ui # $${PWD}/page_defaultapps.ui \ # $${PWD}/page_fluxbox_keys.ui \ # $${PWD}/page_fluxbox_settings.ui \ -- cgit From b0cb61b91a58de6b506c336af6d2328e60c43939 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Mon, 27 Jun 2016 15:00:45 -0400 Subject: Add in sample page files for copy/modify later. --- .../core-utils/lumina-config/pages/page_sample.cpp | 42 ++++++++++++++++++++++ .../core-utils/lumina-config/pages/page_sample.h | 33 +++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 src-qt5/core-utils/lumina-config/pages/page_sample.cpp create mode 100644 src-qt5/core-utils/lumina-config/pages/page_sample.h diff --git a/src-qt5/core-utils/lumina-config/pages/page_sample.cpp b/src-qt5/core-utils/lumina-config/pages/page_sample.cpp new file mode 100644 index 00000000..5273b14b --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_sample.cpp @@ -0,0 +1,42 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_sample.h" +#include "ui_page_sample.h" +#include "getPage.h" + +//========== +// PUBLIC +//========== +page_sample::page_sample(QWidget *parent) : PageWidget(parent), ui(new Ui::page_sample()){ + ui->setupUi(this); + +} + +page_sample::~page_sample(){ + +} + +//================ +// PUBLIC SLOTS +//================ +void page_sample::SaveSettings(){ + +} + +void page_sample::LoadSettings(int){ + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Desktop Settings") ); + +} + +void page_sample::updateIcons(){ + +} + +//================= +// PRIVATE SLOTS +//================= diff --git a/src-qt5/core-utils/lumina-config/pages/page_sample.h b/src-qt5/core-utils/lumina-config/pages/page_sample.h new file mode 100644 index 00000000..f31e981d --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_sample.h @@ -0,0 +1,33 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_SAMPLE_H +#define _LUMINA_CONFIG_PAGE_SAMPLE_H +#include "../globals.h" +#include "PageWidget.h" + +namespace Ui{ + class page_sample; +}; + +class page_sample : public PageWidget{ + Q_OBJECT +public: + page_sample(QWidget *parent); + ~page_sample(); + +public slots: + void SaveSettings(); + void LoadSettings(int screennum); + void updateIcons(); + +private: + Ui::page_sample *ui; + +private slots: + +}; +#endif -- cgit From 8dbf33f6986cc1ccef4bd3c8b615d9aa7835cdfb Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Mon, 27 Jun 2016 15:02:47 -0400 Subject: Allow the "save file as" option to always be available (not dependant on changes to the file). --- src-qt5/desktop-utils/lumina-textedit/MainUI.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp index b5d65559..86fada43 100644 --- a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp @@ -220,7 +220,6 @@ void MainUI::updateTab(QString file){ //qDebug() << "Update Tab:" << file << cur << changes; ui->tabWidget->setTabText(index,(changes ? "*" : "") + file.section("/",-1)); ui->actionSave_File->setEnabled(changes); - ui->actionSave_File_As->setEnabled(changes); this->setWindowTitle( ui->tabWidget->tabText( ui->tabWidget->currentIndex() ) ); } @@ -230,7 +229,6 @@ void MainUI::tabChanged(){ if(cur==0){ return; } //should never happen though bool changes = cur->hasChange(); ui->actionSave_File->setEnabled(changes); - ui->actionSave_File_As->setEnabled(changes); this->setWindowTitle( ui->tabWidget->tabText( ui->tabWidget->currentIndex() ) ); if(!ui->line_find->hasFocus() && !ui->line_replace->hasFocus()){ ui->tabWidget->currentWidget()->setFocus(); } } -- cgit From 8e491cc5f4f300738b5c3d29e5067392014953d6 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Mon, 27 Jun 2016 15:41:10 -0400 Subject: Get the default apps page all converted over to the new UI. --- src-qt5/core-utils/lumina-config/pages/getPage.h | 3 + .../lumina-config/pages/page_defaultapps.cpp | 430 +++++++++++++++++++++ .../lumina-config/pages/page_defaultapps.h | 45 +++ .../lumina-config/pages/page_defaultapps.ui | 19 +- src-qt5/core-utils/lumina-config/pages/pages.pri | 12 +- 5 files changed, 495 insertions(+), 14 deletions(-) create mode 100644 src-qt5/core-utils/lumina-config/pages/page_defaultapps.cpp create mode 100644 src-qt5/core-utils/lumina-config/pages/page_defaultapps.h diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index 33b0e77a..47bb276f 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -29,6 +29,7 @@ static QList<PAGEINFO> KnownPages(){ list << PageInfo("wallpaper", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "image"); list << PageInfo("theme", QObject::tr("Change Desktop Theme"), QObject::tr("Theme Settings"), "preferences-desktop-theme",QObject::tr("Change interface fonts and colors"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "theme" << "plugins"); list << PageInfo("autostart", QObject::tr("Startup Services and Applications"), 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 << PageInfo("defaultapps", QObject::tr("Default Applications for File Type"), QObject::tr("Mimetype Settings"), "preferences-desktop-filetype-association",QObject::tr("Change default applications"), "apps", QStringList(), QStringList() << "apps" << "default" << "services" << "xdg" << "session"); return list; } @@ -37,12 +38,14 @@ static QList<PAGEINFO> KnownPages(){ #include "page_wallpaper.h" #include "page_theme.h" #include "page_autostart.h" +#include "page_defaultapps.h" static PageWidget* GetNewPage(QString id, QWidget *parent){ //Find the page that matches this "id" if(id=="wallpaper"){ return new page_wallpaper(parent); } else if(id=="theme"){ return new page_theme(parent); } else if(id=="autostart"){ return new page_autostart(parent); } + else if(id=="defaultapps"){ return new page_defaultapps(parent); } //Return the main control_panel page as the fallback/default return new page_main(parent); } diff --git a/src-qt5/core-utils/lumina-config/pages/page_defaultapps.cpp b/src-qt5/core-utils/lumina-config/pages/page_defaultapps.cpp new file mode 100644 index 00000000..e55beba6 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_defaultapps.cpp @@ -0,0 +1,430 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_defaultapps.h" +#include "ui_page_defaultapps.h" +#include "getPage.h" +#include "../AppDialog.h" + +//========== +// PUBLIC +//========== +page_defaultapps::page_defaultapps(QWidget *parent) : PageWidget(parent), ui(new Ui::page_defaultapps()){ + ui->setupUi(this); + + connect(ui->tool_default_filemanager, SIGNAL(clicked()), this, SLOT(changeDefaultFileManager()) ); + connect(ui->tool_default_terminal, SIGNAL(clicked()), this, SLOT(changeDefaultTerminal()) ); + connect(ui->tool_default_webbrowser, SIGNAL(clicked()), this, SLOT(changeDefaultBrowser()) ); + connect(ui->tool_default_email, SIGNAL(clicked()), this, SLOT(changeDefaultEmail()) ); + connect(ui->tool_defaults_clear, SIGNAL(clicked()), this, SLOT(cleardefaultitem()) ); + connect(ui->tool_defaults_set, SIGNAL(clicked()), this, SLOT(setdefaultitem()) ); + connect(ui->tool_defaults_setbin, SIGNAL(clicked()), this, SLOT(setdefaultbinary()) ); + connect(ui->tree_defaults, SIGNAL(itemSelectionChanged()), this, SLOT(checkdefaulticons()) ); + updateIcons(); + ui->tabWidget_apps->setCurrentWidget(ui->tab_auto); +} + +page_defaultapps::~page_defaultapps(){ + +} + +//================ +// PUBLIC SLOTS +//================ +void page_defaultapps::SaveSettings(){ + +} + +void page_defaultapps::LoadSettings(int){ + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Default Applications") ); + +//First load the lumina-open specific defaults + // - Default File Manager + QString tmp = LXDG::findDefaultAppForMime("inode/directory"); + if(tmp.isEmpty()){ tmp = "lumina-fm"; } + if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings + if(tmp.endsWith(".desktop")){ + bool ok = false; + XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); + if(!ok || file.filePath.isEmpty()){ + //Might be a binary - just print out the raw "path" + ui->tool_default_filemanager->setText(tmp.section("/",-1)); + ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") ); + }else{ + ui->tool_default_filemanager->setText(file.name); + ui->tool_default_filemanager->setIcon(LXDG::findIcon(file.icon,"") ); + } + }else if(tmp.isEmpty()){ + ui->tool_default_filemanager->setText(tr("Click to Set")); + ui->tool_default_filemanager->setIcon( LXDG::findIcon("system-help","") ); + }else{ + //Might be a binary - just print out the raw "path" + ui->tool_default_filemanager->setText(tmp.section("/",-1)); + ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") ); + } + // - Default Terminal + tmp =LXDG::findDefaultAppForMime("application/terminal"); //sessionsettings->value("default-terminal", "xterm").toString(); + if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings + if(tmp.endsWith(".desktop")){ + bool ok = false; + XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); + if(!ok || file.filePath.isEmpty()){ + //Might be a binary - just print out the raw "path" + ui->tool_default_terminal->setText(tmp.section("/",-1)); + ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); + }else{ + ui->tool_default_terminal->setText(file.name); + ui->tool_default_terminal->setIcon(LXDG::findIcon(file.icon,"") ); + } + }else if(tmp.isEmpty()){ + ui->tool_default_terminal->setText(tr("Click to Set")); + ui->tool_default_terminal->setIcon( LXDG::findIcon("system-help","") ); + }else{ + //Might be a binary - just print out the raw "path" + ui->tool_default_terminal->setText(tmp.section("/",-1)); + ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); + } + // - Default Web Browser + tmp = LXDG::findDefaultAppForMime("x-scheme-handler/http"); //appsettings->value("default/webbrowser", "").toString(); + if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings + if(tmp.endsWith(".desktop")){ + bool ok = false; + XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); + if(!ok || file.filePath.isEmpty()){ + //Might be a binary - just print out the raw "path" + ui->tool_default_webbrowser->setText(tmp.section("/",-1)); + ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") ); + }else{ + ui->tool_default_webbrowser->setText(file.name); + ui->tool_default_webbrowser->setIcon(LXDG::findIcon(file.icon,"") ); + } + }else if(tmp.isEmpty()){ + ui->tool_default_webbrowser->setText(tr("Click to Set")); + ui->tool_default_webbrowser->setIcon( LXDG::findIcon("system-help","") ); + }else{ + //Might be a binary - just print out the raw "path" + ui->tool_default_webbrowser->setText(tmp.section("/",-1)); + ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") ); + } + // - Default Email Client + tmp = LXDG::findDefaultAppForMime("application/email"); //appsettings->value("default/email", "").toString(); + if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings + if(tmp.endsWith(".desktop")){ + bool ok = false; + XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); + if(!ok || file.filePath.isEmpty()){ + //Might be a binary - just print out the raw "path" + ui->tool_default_email->setText(tmp.section("/",-1)); + ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") ); + }else{ + ui->tool_default_email->setText(file.name); + ui->tool_default_email->setIcon(LXDG::findIcon(file.icon,"") ); + } + }else if(tmp.isEmpty()){ + ui->tool_default_email->setText(tr("Click to Set")); + ui->tool_default_email->setIcon( LXDG::findIcon("system-help","") ); + }else{ + //Might be a binary - just print out the raw "path" + ui->tool_default_email->setText(tmp.section("/",-1)); + ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") ); + } + + //Now load the XDG mime defaults + ui->tree_defaults->clear(); + QStringList defMimeList = LXDG::listFileMimeDefaults(); + //qDebug() << "Mime List:\n" << defMimeList.join("\n"); + defMimeList.sort(); //sort by group/mime + //Now fill the tree by group/mime + QTreeWidgetItem *group = new QTreeWidgetItem(0); //nothing at the moment + QString ccat; + for(int i=0; i<defMimeList.length(); i++){ + //Get the info from this entry + QString mime = defMimeList[i].section("::::",0,0); + QString cat = mime.section("/",0,0); + QString extlist = defMimeList[i].section("::::",1,1); + QString def = defMimeList[i].section("::::",2,2); + QString comment = defMimeList[i].section("::::",3,50); + //Now check if this is a new category + if(ccat!=cat){ + //New group + group = new QTreeWidgetItem(0); + group->setText(0, cat); //add translations for known/common groups later + ui->tree_defaults->addTopLevelItem(group); + ccat = cat; + } + //Now create the entry + QTreeWidgetItem *it = new QTreeWidgetItem(); + it->setWhatsThis(0,mime); // full mimetype + it->setText(0, QString(tr("%1 (%2)")).arg(mime.section("/",-1), extlist) ); + it->setText(2,comment); + it->setToolTip(0, comment); it->setToolTip(1,comment); + //Now load the default (if there is one) + it->setWhatsThis(1,def); //save for later + if(def.endsWith(".desktop")){ + bool ok = false; + XDGDesktop file = LXDG::loadDesktopFile(def, ok); + if(!ok || file.filePath.isEmpty()){ + //Might be a binary - just print out the raw "path" + it->setText(1,def.section("/",-1)); + it->setIcon(1, LXDG::findIcon("application-x-executable","") ); + }else{ + it->setText(1, file.name); + it->setIcon(1, LXDG::findIcon(file.icon,"") ); + } + }else if(!def.isEmpty()){ + //Binary/Other default + it->setText(1, def.section("/",-1)); + it->setIcon(1, LXDG::findIcon("application-x-executable","") ); + } + group->addChild(it); + } + + ui->tree_defaults->sortItems(0,Qt::AscendingOrder); + + checkdefaulticons(); +} + +void page_defaultapps::updateIcons(){ + ui->tool_defaults_clear->setIcon( LXDG::findIcon("edit-clear","") ); + ui->tool_defaults_set->setIcon( LXDG::findIcon("system-run","") ); + ui->tool_defaults_setbin->setIcon( LXDG::findIcon("application-x-executable","") ); + ui->tabWidget_apps->setTabIcon( ui->tabWidget_apps->indexOf(ui->tab_auto), LXDG::findIcon("system-run", "") ); + ui->tabWidget_apps->setTabIcon( ui->tabWidget_apps->indexOf(ui->tab_defaults), LXDG::findIcon("preferences-desktop-filetype-association", "") ); +} + +//================= +// PRIVATE +//================= +XDGDesktop page_defaultapps::getSysApp(bool allowreset){ + AppDialog dlg(this, LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ) ); + dlg.allowReset(allowreset); + dlg.exec(); + XDGDesktop desk; + if(dlg.appreset && allowreset){ + desk.filePath = "reset"; //special internal flag + }else{ + desk = dlg.appselected; + } + return desk; +} + +//================= +// PRIVATE SLOTS +//================= +void page_defaultapps::changeDefaultBrowser(){ + //Prompt for the new app + XDGDesktop desk = getSysApp(true); + if(desk.filePath.isEmpty()){ return; }//nothing selected + if(desk.filePath=="reset"){ + desk.filePath=""; + } + //save the new app setting and adjust the button appearance + //appsettings->setValue("default/webbrowser", desk.filePath); + LXDG::setDefaultAppForMime("x-scheme-handler/http", desk.filePath.section("/",-1)); + LXDG::setDefaultAppForMime("x-scheme-handler/https", desk.filePath.section("/",-1)); + QString tmp = desk.filePath; + if(tmp.endsWith(".desktop")){ + bool ok = false; + XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); + if(!ok || file.filePath.isEmpty()){ + //Might be a binary - just print out the raw "path" + ui->tool_default_webbrowser->setText(tmp.section("/",-1)); + ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") ); + }else{ + ui->tool_default_webbrowser->setText(desk.name); + ui->tool_default_webbrowser->setIcon(LXDG::findIcon(desk.icon,"") ); + } + }else if(tmp.isEmpty()){ + ui->tool_default_webbrowser->setText(tr("Click to Set")); + ui->tool_default_webbrowser->setIcon( LXDG::findIcon("system-help","") ); + }else{ + //Might be a binary - just print out the raw "path" + ui->tool_default_webbrowser->setText(tmp.section("/",-1)); + ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") ); + } +} + +void page_defaultapps::changeDefaultEmail(){ + //Prompt for the new app + XDGDesktop desk = getSysApp(true); //allow reset to default + if(desk.filePath.isEmpty()){ return; }//nothing selected + if(desk.filePath=="reset"){ + desk.filePath=""; + } + //save the new app setting and adjust the button appearance + LXDG::setDefaultAppForMime("application/email",desk.filePath); + // appsettings->setValue("default/email", desk.filePath); + QString tmp = desk.filePath; + if(tmp.endsWith(".desktop")){ + bool ok = false; + XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); + if(!ok || file.filePath.isEmpty()){ + //Might be a binary - just print out the raw "path" + ui->tool_default_email->setText(tmp.section("/",-1)); + ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") ); + }else{ + ui->tool_default_email->setText(file.name); + ui->tool_default_email->setIcon(LXDG::findIcon(file.icon,"") ); + } + }else if(tmp.isEmpty()){ + ui->tool_default_email->setText(tr("Click to Set")); + ui->tool_default_email->setIcon( LXDG::findIcon("system-help","") ); + }else{ + //Might be a binary - just print out the raw "path" + ui->tool_default_email->setText(tmp.section("/",-1)); + ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") ); + } +} + +void page_defaultapps::changeDefaultFileManager(){ + //Prompt for the new app + XDGDesktop desk = getSysApp(true); + if(desk.filePath.isEmpty()){ return; }//nothing selected + if(desk.filePath=="reset"){ + desk.filePath="lumina-fm"; + } + //save the new app setting and adjust the button appearance + //appsettings->setValue("default/directory", desk.filePath); + //sessionsettings->setValue("default-filemanager", desk.filePath); + LXDG::setDefaultAppForMime("inode/directory", desk.filePath.section("/",-1)); + QString tmp = desk.filePath; + if(tmp.endsWith(".desktop")){ + bool ok = false; + XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); + if(!ok || file.filePath.isEmpty()){ + //Might be a binary - just print out the raw "path" + ui->tool_default_filemanager->setText(tmp.section("/",-1)); + ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") ); + }else{ + ui->tool_default_filemanager->setText(file.name); + ui->tool_default_filemanager->setIcon(LXDG::findIcon(file.icon,"") ); + } + }else if(tmp.isEmpty()){ + ui->tool_default_filemanager->setText(tr("Click to Set")); + ui->tool_default_filemanager->setIcon( LXDG::findIcon("system-help","") ); + }else{ + //Might be a binary - just print out the raw "path" + ui->tool_default_filemanager->setText(tmp.section("/",-1)); + ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") ); + } +} + +void page_defaultapps::changeDefaultTerminal(){ + //Prompt for the new app + XDGDesktop desk = getSysApp(true); + if(desk.filePath.isEmpty()){ return; }//nothing selected + if(desk.filePath=="reset"){ + desk.filePath="xterm"; + } + //save the new app setting and adjust the button appearance + LXDG::setDefaultAppForMime("application/terminal",desk.filePath); + //sessionsettings->setValue("default-terminal", desk.filePath); + QString tmp = desk.filePath; + if(tmp.endsWith(".desktop")){ + bool ok = false; + XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); + if(!ok || file.filePath.isEmpty()){ + //Might be a binary - just print out the raw "path" + ui->tool_default_terminal->setText(tmp.section("/",-1)); + ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); + }else{ + ui->tool_default_terminal->setText(file.name); + ui->tool_default_terminal->setIcon(LXDG::findIcon(file.icon,"") ); + } + }else if(tmp.isEmpty()){ + ui->tool_default_terminal->setText(tr("Click to Set")); + ui->tool_default_terminal->setIcon( LXDG::findIcon("system-help","") ); + }else{ + //Might be a binary - just print out the raw "path" + ui->tool_default_terminal->setText(tmp.section("/",-1)); + ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); + } +} + +void page_defaultapps::cleardefaultitem(){ + QTreeWidgetItem *it = ui->tree_defaults->currentItem(); + if(it==0){ return; } //no item selected + QList<QTreeWidgetItem*> list; + for(int i=0; i<it->childCount(); i++){ + list << it->child(i); + } + if(list.isEmpty()){ list << it; } //just do the current item + //Now clear the items + for(int i=0; i<list.length(); i++){ + //Clear it in the back end + LXDG::setDefaultAppForMime(list[i]->whatsThis(0), ""); + //Now clear it in the UI + list[i]->setWhatsThis(1,""); //clear the app path + list[i]->setIcon(1,QIcon()); //clear the icon + list[i]->setText(1,""); //clear the name + } + +} + +void page_defaultapps::setdefaultitem(){ + QTreeWidgetItem *it = ui->tree_defaults->currentItem(); + if(it==0){ return; } //no item selected + QList<QTreeWidgetItem*> list; + for(int i=0; i<it->childCount(); i++){ + list << it->child(i); + } + if(list.isEmpty()){ list << it; } //just do the current item + //Prompt for which application to use + XDGDesktop desk = getSysApp(false); //no "reset" option + if(desk.filePath.isEmpty()){ return; }//nothing selected + //Now set the items + for(int i=0; i<list.length(); i++){ + //Set it in the back end + LXDG::setDefaultAppForMime(list[i]->whatsThis(0), desk.filePath); + //Set it in the UI + list[i]->setWhatsThis(1,desk.filePath); //app path + list[i]->setIcon(1,LXDG::findIcon(desk.icon,"")); //reset the icon + list[i]->setText(1,desk.name); //reset the name + } + +} + +void page_defaultapps::setdefaultbinary(){ + QTreeWidgetItem *it = ui->tree_defaults->currentItem(); + if(it==0){ return; } //no item selected + QList<QTreeWidgetItem*> list; + for(int i=0; i<it->childCount(); i++){ + list << it->child(i); + } + if(list.isEmpty()){ list << it; } //just do the current item + //Prompt for which binary to use + QFileDialog dlg(this); + //dlg.setFilter(QDir::Executable | QDir::Files); //Does not work! Filters executable files as well as breaks browsing capabilities + dlg.setFileMode(QFileDialog::ExistingFile); + dlg.setDirectory( LOS::AppPrefix()+"bin" ); + dlg.setWindowTitle(tr("Select Binary")); + if( !dlg.exec() || dlg.selectedFiles().isEmpty() ){ + return; //cancelled + } + QString path = dlg.selectedFiles().first(); + //Make sure it is executable + if( !QFileInfo(path).isExecutable()){ + QMessageBox::warning(this, tr("Invalid Binary"), tr("The selected binary is not executable!")); + return; + } + //Now set the items + for(int i=0; i<list.length(); i++){ + //Set it in the back end + LXDG::setDefaultAppForMime(list[i]->whatsThis(0), path); + //Set it in the UI + list[i]->setWhatsThis(1,path); //app path + list[i]->setIcon(1,LXDG::findIcon("application-x-executable","")); //clear the icon + list[i]->setText(1,path.section("/",-1)); //clear the name + } +} + +void page_defaultapps::checkdefaulticons(){ + QTreeWidgetItem *it = ui->tree_defaults->currentItem(); + ui->tool_defaults_set->setEnabled(it!=0); + ui->tool_defaults_clear->setEnabled(it!=0); + ui->tool_defaults_setbin->setEnabled(it!=0); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_defaultapps.h b/src-qt5/core-utils/lumina-config/pages/page_defaultapps.h new file mode 100644 index 00000000..afe99d4b --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_defaultapps.h @@ -0,0 +1,45 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_DEFAULTAPPS_H +#define _LUMINA_CONFIG_PAGE_DEFAULTAPPS_H +#include "../globals.h" +#include "PageWidget.h" + +namespace Ui{ + class page_defaultapps; +}; + +class page_defaultapps : public PageWidget{ + Q_OBJECT +public: + page_defaultapps(QWidget *parent); + ~page_defaultapps(); + +public slots: + void SaveSettings(); + void LoadSettings(int screennum); + void updateIcons(); + +private: + Ui::page_defaultapps *ui; + + XDGDesktop getSysApp(bool allowreset); + +private slots: + //Simple defaults tab + void changeDefaultBrowser(); + void changeDefaultEmail(); + void changeDefaultFileManager(); + void changeDefaultTerminal(); + //Advanced defaults tab + void cleardefaultitem(); + void setdefaultitem(); + void setdefaultbinary(); + void checkdefaulticons(); + +}; +#endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_defaultapps.ui b/src-qt5/core-utils/lumina-config/pages/page_defaultapps.ui index 16e65bdf..ef72c4f1 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_defaultapps.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_defaultapps.ui @@ -15,25 +15,28 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="leftMargin"> - <number>0</number> + <number>6</number> </property> <property name="topMargin"> - <number>0</number> + <number>6</number> </property> <property name="rightMargin"> - <number>0</number> + <number>6</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>6</number> </property> <item> <widget class="QTabWidget" name="tabWidget_apps"> <property name="currentIndex"> - <number>0</number> + <number>1</number> + </property> + <property name="movable"> + <bool>false</bool> </property> <widget class="QWidget" name="tab_defaults"> <attribute name="title"> - <string>File Defaults</string> + <string>Advanced</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_6"> <property name="leftMargin"> @@ -160,9 +163,9 @@ </item> </layout> </widget> - <widget class="QWidget" name="tab_2"> + <widget class="QWidget" name="tab_auto"> <attribute name="title"> - <string>Common Applications</string> + <string>Basic Settings</string> </attribute> <layout class="QVBoxLayout" name="verticalLayout_7"> <item> diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index 7610e946..7c0f6538 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -4,8 +4,8 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/page_main.h \ $${PWD}/page_wallpaper.h \ $${PWD}/page_theme.h \ - $${PWD}/page_autostart.h -# $${PWD}/page_defaultapps.h \ + $${PWD}/page_autostart.h \ + $${PWD}/page_defaultapps.h # $${PWD}/page_fluxbox_keys.h \ # $${PWD}/page_fluxbox_settings.h \ # $${PWD}/page_interface_desktop.h \ @@ -18,8 +18,8 @@ HEADERS += $${PWD}/getPage.h \ SOURCES += $${PWD}/page_main.cpp \ $${PWD}/page_wallpaper.cpp \ $${PWD}/page_theme.cpp \ - $${PWD}/page_autostart.cpp -# $${PWD}/page_defaultapps.cpp \ + $${PWD}/page_autostart.cpp \ + $${PWD}/page_defaultapps.cpp # $${PWD}/page_fluxbox_keys.cpp \ # $${PWD}/page_fluxbox_settings.cpp \ # $${PWD}/page_interface_desktop.cpp \ @@ -32,8 +32,8 @@ SOURCES += $${PWD}/page_main.cpp \ FORMS += $${PWD}/page_main.ui \ $${PWD}/page_wallpaper.ui \ $${PWD}/page_theme.ui \ - $${PWD}/page_autostart.ui -# $${PWD}/page_defaultapps.ui \ + $${PWD}/page_autostart.ui \ + $${PWD}/page_defaultapps.ui # $${PWD}/page_fluxbox_keys.ui \ # $${PWD}/page_fluxbox_settings.ui \ # $${PWD}/page_interface_desktop.ui \ -- cgit From c91c9c6b92eeb8293ca4cd5d7fee155de50a7fbc Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Mon, 27 Jun 2016 15:43:16 -0400 Subject: Switch back to the old UI for now. --- src-qt5/core-utils/lumina-config/main.cpp | 4 ++-- src-qt5/core-utils/lumina-config/pages/getPage.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src-qt5/core-utils/lumina-config/main.cpp b/src-qt5/core-utils/lumina-config/main.cpp index 20d517b2..a63e0fbe 100644 --- a/src-qt5/core-utils/lumina-config/main.cpp +++ b/src-qt5/core-utils/lumina-config/main.cpp @@ -19,8 +19,8 @@ int main(int argc, char ** argv) LuminaThemeEngine theme(&a); - //MainUI w; - mainWindow w; + MainUI w; + //mainWindow w; QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(slotSingleInstance()) ); QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); w.show(); diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index 47bb276f..959cd4a2 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -29,7 +29,7 @@ static QList<PAGEINFO> KnownPages(){ list << PageInfo("wallpaper", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "image"); list << PageInfo("theme", QObject::tr("Change Desktop Theme"), QObject::tr("Theme Settings"), "preferences-desktop-theme",QObject::tr("Change interface fonts and colors"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "theme" << "plugins"); list << PageInfo("autostart", QObject::tr("Startup Services and Applications"), 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 << PageInfo("defaultapps", QObject::tr("Default Applications for File Type"), QObject::tr("Mimetype Settings"), "preferences-desktop-filetype-association",QObject::tr("Change default applications"), "apps", QStringList(), QStringList() << "apps" << "default" << "services" << "xdg" << "session"); + list << PageInfo("defaultapps", QObject::tr("Default Applications for File Type"), QObject::tr("Mimetype Settings"), "preferences-desktop-filetype-association",QObject::tr("Change default applications"), "session", QStringList(), QStringList() << "apps" << "default" << "services" << "xdg" << "session"); return list; } -- cgit From e630667a18729e9b4f37c83fbbc4afc2fdd562dd Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Mon, 27 Jun 2016 20:53:48 -0400 Subject: Get the new fluxbox-keys page all converted over to the new UI. --- src-qt5/core-utils/lumina-config/main.cpp | 4 +- src-qt5/core-utils/lumina-config/pages/getPage.h | 6 + .../lumina-config/pages/page_fluxbox_keys.cpp | 200 +++++++++++++++++++++ .../lumina-config/pages/page_fluxbox_keys.h | 44 +++++ .../lumina-config/pages/page_fluxbox_keys.ui | 12 +- .../lumina-config/pages/page_fluxbox_settings.ui | 16 +- src-qt5/core-utils/lumina-config/pages/pages.pri | 12 +- 7 files changed, 278 insertions(+), 16 deletions(-) create mode 100644 src-qt5/core-utils/lumina-config/pages/page_fluxbox_keys.cpp create mode 100644 src-qt5/core-utils/lumina-config/pages/page_fluxbox_keys.h diff --git a/src-qt5/core-utils/lumina-config/main.cpp b/src-qt5/core-utils/lumina-config/main.cpp index a63e0fbe..20d517b2 100644 --- a/src-qt5/core-utils/lumina-config/main.cpp +++ b/src-qt5/core-utils/lumina-config/main.cpp @@ -19,8 +19,8 @@ int main(int argc, char ** argv) LuminaThemeEngine theme(&a); - MainUI w; - //mainWindow w; + //MainUI w; + mainWindow w; QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(slotSingleInstance()) ); QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); w.show(); diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index 959cd4a2..5add9e78 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -30,6 +30,8 @@ static QList<PAGEINFO> KnownPages(){ list << PageInfo("theme", QObject::tr("Change Desktop Theme"), QObject::tr("Theme Settings"), "preferences-desktop-theme",QObject::tr("Change interface fonts and colors"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "theme" << "plugins"); list << PageInfo("autostart", QObject::tr("Startup Services and Applications"), 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 << PageInfo("defaultapps", QObject::tr("Default Applications for File Type"), QObject::tr("Mimetype Settings"), "preferences-desktop-filetype-association",QObject::tr("Change default applications"), "session", QStringList(), QStringList() << "apps" << "default" << "services" << "xdg" << "session"); + list << PageInfo("fluxbox-keys", QObject::tr("Keyboard Shortcuts"), QObject::tr("Keyboard Shortcuts"), "preferences-desktop-keyboard",QObject::tr("Change keyboard shortcuts"), "session", QStringList(), QStringList() << "apps" << "fluxbox" << "keys" << "keyboard" << "session" << "launch"); + list << PageInfo("fluxbox-settings", QObject::tr("Window Manager"), QObject::tr("Window Settings"), "preferences-system-windows",QObject::tr("Change window settings and appearances"), "appearance", QStringList(), QStringList() << "window" << "frame" << "border" << "workspace" << "theme" << "fluxbox" << "session"); return list; } @@ -39,6 +41,8 @@ static QList<PAGEINFO> KnownPages(){ #include "page_theme.h" #include "page_autostart.h" #include "page_defaultapps.h" +#include "page_fluxbox_keys.h" +//#include "page_fluxbox_settings.h" static PageWidget* GetNewPage(QString id, QWidget *parent){ //Find the page that matches this "id" @@ -46,6 +50,8 @@ static PageWidget* GetNewPage(QString id, QWidget *parent){ else if(id=="theme"){ return new page_theme(parent); } else if(id=="autostart"){ return new page_autostart(parent); } else if(id=="defaultapps"){ return new page_defaultapps(parent); } + else if(id=="fluxbox-keys"){ return new page_fluxbox_keys(parent); } +// else if(id=="fluxbox-session"){ return new page_fluxbox_settings(parent); } //Return the main control_panel page as the fallback/default return new page_main(parent); } diff --git a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_keys.cpp b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_keys.cpp new file mode 100644 index 00000000..ed382bb8 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_keys.cpp @@ -0,0 +1,200 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_fluxbox_keys.h" +#include "ui_page_fluxbox_keys.h" +#include "getPage.h" + +//========== +// PUBLIC +//========== +page_fluxbox_keys::page_fluxbox_keys(QWidget *parent) : PageWidget(parent), ui(new Ui::page_fluxbox_keys()){ + ui->setupUi(this); + + connect(ui->tool_shortcut_clear, SIGNAL(clicked()), this, SLOT(clearKeyBinding()) ); + connect(ui->tool_shortcut_set, SIGNAL(clicked()), this, SLOT(applyKeyBinding()) ); + connect(ui->tree_shortcut, SIGNAL(itemSelectionChanged()), this, SLOT(updateKeyConfig()) ); + updateIcons(); +} + +page_fluxbox_keys::~page_fluxbox_keys(){ + +} + +//================ +// PUBLIC SLOTS +//================ +void page_fluxbox_keys::SaveSettings(){ +QStringList current; + for(int i=0; i<ui->tree_shortcut->topLevelItemCount(); i++){ + QTreeWidgetItem *it = ui->tree_shortcut->topLevelItem(i); + current << it->whatsThis(1)+" :"+it->whatsThis(0); //Full Fluxbox command line + } + + QStringList info = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-keys"); + for(int i=0; i<info.length(); i++){ + if(info[i].isEmpty() || info[i].startsWith("#") || info[i].startsWith("!")){ continue; } + if(current.filter(info[i].section(":",1,-1)).length() > 0){ + //Found Item to be replaced/removed + QString it = current.filter(info[i].section(":",1,10)).join("\n").section("\n",0,0); //ensure only the first match + if(it.section(" :",0,0).isEmpty()){ info.removeAt(i); i--; } //remove this entry + else{ info[i] = it; } //replace this entry + current.removeAll(it); //already taken care of - remove it from the current list + } + } + //Now save the new contents + for(int i=0; i<current.length(); i++){ + if(!current[i].section(" :",0,0).isEmpty()){ info << current[i]; } + } + bool ok = overwriteFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-keys", info); + if(!ok){ qDebug() << "Warning: Could not save fluxbox-keys"; } + emit HasPendingChanges(false); +} + +void page_fluxbox_keys::LoadSettings(int){ + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Keyboard Shortcuts") ); + +ui->tree_shortcut->clear(); + QStringList info = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-keys"); + //First take care of the special Lumina options + QStringList special; + special << "Exec lumina-open -volumeup::::"+tr("Audio Volume Up") \ + << "Exec lumina-open -volumedown::::"+tr("Audio Volume Down") \ + << "Exec lumina-open -brightnessup::::"+tr("Screen Brightness Up") \ + << "Exec lumina-open -brightnessdown::::"+tr("Screen Brightness Down") \ + << "Exec lumina-screenshot::::"+tr("Take Screenshot") \ + << "Exec xscreensaver-command -lock::::"+tr("Lock Screen"); + for(int i=0; i<special.length(); i++){ + QString spec = info.filter(":"+special[i].section("::::",0,0)).join("").simplified(); + QTreeWidgetItem *it = new QTreeWidgetItem(); + it->setText(0, special[i].section("::::",1,1)); + it->setWhatsThis(0, special[i].section("::::",0,0)); + if(!spec.isEmpty()){ + info.removeAll(spec); //this line has been dealt with - remove it + it->setText(1, fluxToDispKeys(spec.section(":",0,0)) ); //need to make this easier to read later + it->setWhatsThis(1, spec.section(":",0,0) ); + } + ui->tree_shortcut->addTopLevelItem(it); + } + //Now add support for all the other fluxbox shortcuts + for(int i=0; i<info.length(); i++){ + //skip empty/invalid lines, as well as non-global shortcuts (OnMenu, OnWindow, etc..) + if(info[i].isEmpty() || info[i].startsWith("#") || info[i].startsWith("!") || info[i].startsWith("On")){ continue; } + QString exec = info[i].section(":",1,100); + QString showexec = exec; + if(showexec.startsWith("If {Matches")){ showexec = showexec.section("{",2,2).section("}",0,0); } + if(showexec.startsWith("Exec ")){ showexec.replace("Exec ","Run "); } + else{ showexec = showexec.section("(",0,0).section("{",0,0); } //built-in command - remove the extra commands on some of them + QTreeWidgetItem *it = new QTreeWidgetItem(); + it->setText(0, showexec.simplified() ); + it->setWhatsThis(0, exec); + it->setText(1, fluxToDispKeys(info[i].section(":",0,0)) ); //need to make this easier to read later + it->setWhatsThis(1, info[i].section(":",0,0) ); + ui->tree_shortcut->addTopLevelItem(it); + } + +} + +void page_fluxbox_keys::updateIcons(){ + ui->tool_shortcut_set->setIcon( LXDG::findIcon("input-keyboard","") ); + ui->tool_shortcut_clear->setIcon( LXDG::findIcon("edit-clear","") ); +} + +//================= +// PRIVATE +//================= +//Convert to/from fluxbox key codes +QString page_fluxbox_keys::dispToFluxKeys(QString in){ + in.replace("Ctrl", "Control"); + in.replace("Shift", "Shift"); + in.replace("Alt", "Mod1"); + in.replace("Meta", "Mod4"); + in.replace("PgUp", "Prior"); + in.replace("PgDown", "Next"); + in.replace("Del", "Delete"); + in.replace("Backspace", "BackSpace"); + in.replace("Ins","Insert"); + in.replace("Volume Up", "XF86AudioRaiseVolume"); //multimedia key + in.replace("Volume Down", "XF86AudioLowerVolume"); //multimedia key + in.replace("+"," "); + return in; +} + +QString page_fluxbox_keys::fluxToDispKeys(QString in){ + in.replace("Control", "Ctrl"); + in.replace("Shift", "Shift"); + in.replace("Mod1", "Alt"); + in.replace("Mod4", "Meta"); + in.replace("Prior", "PgUp"); + in.replace("Next", "PgDown"); + //in.replace("Delete", "Del"); //the "Delete" is better looking + in.replace("BackSpace", "Backspace"); + //in.replace("Insert", "Ins"); //the "Insert" is better looking + in.replace("XF86AudioRaiseVolume", "Volume Up"); //multimedia key + in.replace("XF86AudioLowerVolume", "Volume Down"); //multimedia key + return in; +} + +//Read/overwrite a text file +QStringList page_fluxbox_keys::readFile(QString path){ + QStringList out; + QFile file(path); + if(file.open(QIODevice::ReadOnly | QIODevice::Text)){ + QTextStream txt(&file); + while(!txt.atEnd()){ + out << txt.readLine(); + } + file.close(); + } + return out; +} + +bool page_fluxbox_keys::overwriteFile(QString path, QStringList contents){ + QFile file(path); + if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)){ + QTextStream txt(&file); + for(int i=0; i<contents.length(); i++){ + txt << contents[i]+"\n"; + } + file.close(); + return true; + } + return false; +} + +//================= +// PRIVATE SLOTS +//================= +void page_fluxbox_keys::clearKeyBinding(){ + if(ui->tree_shortcut->currentItem()==0){ return; } + ui->tree_shortcut->currentItem()->setText(1,""); + ui->tree_shortcut->currentItem()->setWhatsThis(1,""); + settingChanged(); +} + +void page_fluxbox_keys::applyKeyBinding(){ + QKeySequence seq = ui->keyEdit_shortcut->keySequence(); + qDebug() << "New Key Sequence:" << seq.toString(QKeySequence::NativeText) << seq.toString(QKeySequence::PortableText); + if(seq.isEmpty()){ + //Verify removal of the action first + + //Now remove the action + delete ui->tree_shortcut->currentItem(); + }else{ + QTreeWidgetItem *it = ui->tree_shortcut->currentItem(); + it->setText(1,seq.toString(QKeySequence::NativeText)); + it->setWhatsThis(1,dispToFluxKeys(seq.toString(QKeySequence::PortableText))); + qDebug() << " - Flux Sequence:" << it->whatsThis(1); + } + ui->keyEdit_shortcut->clear(); + settingChanged(); +} + +void page_fluxbox_keys::updateKeyConfig(){ + ui->group_shortcut_modify->setEnabled(ui->tree_shortcut->currentItem()!=0); + ui->keyEdit_shortcut->clear(); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_keys.h b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_keys.h new file mode 100644 index 00000000..7fc143ff --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_keys.h @@ -0,0 +1,44 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_FLUXBOX_KEYS_H +#define _LUMINA_CONFIG_PAGE_FLUXBOX_KEYS_H +#include "../globals.h" +#include "PageWidget.h" + +namespace Ui{ + class page_fluxbox_keys; +}; + +class page_fluxbox_keys : public PageWidget{ + Q_OBJECT +public: + page_fluxbox_keys(QWidget *parent); + ~page_fluxbox_keys(); + +public slots: + void SaveSettings(); + void LoadSettings(int screennum); + void updateIcons(); + +private: + Ui::page_fluxbox_keys *ui; + + //Convert to/from fluxbox keyboard shortcuts + QString dispToFluxKeys(QString); + QString fluxToDispKeys(QString); + + //Read/overwrite a text file + QStringList readFile(QString path); + bool overwriteFile(QString path, QStringList contents); + +private slots: + void clearKeyBinding(); + void applyKeyBinding(); + void updateKeyConfig(); + +}; +#endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_keys.ui b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_keys.ui index 0c950672..2ded896e 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_keys.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_keys.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Form</class> - <widget class="QWidget" name="Form"> + <class>page_fluxbox_keys</class> + <widget class="QWidget" name="page_fluxbox_keys"> <property name="geometry"> <rect> <x>0</x> @@ -15,16 +15,16 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="leftMargin"> - <number>0</number> + <number>6</number> </property> <property name="topMargin"> - <number>0</number> + <number>6</number> </property> <property name="rightMargin"> - <number>0</number> + <number>6</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>6</number> </property> <item> <widget class="QTreeWidget" name="tree_shortcut"> diff --git a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.ui b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.ui index e15f1dd9..677eac62 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.ui @@ -14,6 +14,18 @@ <string>Form</string> </property> <layout class="QVBoxLayout" name="verticalLayout"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="topMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> <item> <layout class="QFormLayout" name="formLayout_4"> <item row="0" column="0"> @@ -87,8 +99,8 @@ <rect> <x>0</x> <y>0</y> - <width>356</width> - <height>109</height> + <width>362</width> + <height>115</height> </rect> </property> <property name="sizePolicy"> diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index 7c0f6538..4e433725 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -5,8 +5,8 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/page_wallpaper.h \ $${PWD}/page_theme.h \ $${PWD}/page_autostart.h \ - $${PWD}/page_defaultapps.h -# $${PWD}/page_fluxbox_keys.h \ + $${PWD}/page_defaultapps.h \ + $${PWD}/page_fluxbox_keys.h # $${PWD}/page_fluxbox_settings.h \ # $${PWD}/page_interface_desktop.h \ # $${PWD}/page_interface_menu.h \ @@ -19,8 +19,8 @@ SOURCES += $${PWD}/page_main.cpp \ $${PWD}/page_wallpaper.cpp \ $${PWD}/page_theme.cpp \ $${PWD}/page_autostart.cpp \ - $${PWD}/page_defaultapps.cpp -# $${PWD}/page_fluxbox_keys.cpp \ + $${PWD}/page_defaultapps.cpp \ + $${PWD}/page_fluxbox_keys.cpp # $${PWD}/page_fluxbox_settings.cpp \ # $${PWD}/page_interface_desktop.cpp \ # $${PWD}/page_interface_menu.cpp \ @@ -33,8 +33,8 @@ FORMS += $${PWD}/page_main.ui \ $${PWD}/page_wallpaper.ui \ $${PWD}/page_theme.ui \ $${PWD}/page_autostart.ui \ - $${PWD}/page_defaultapps.ui -# $${PWD}/page_fluxbox_keys.ui \ + $${PWD}/page_defaultapps.ui \ + $${PWD}/page_fluxbox_keys.ui # $${PWD}/page_fluxbox_settings.ui \ # $${PWD}/page_interface_desktop.ui \ # $${PWD}/page_interface_menu.ui \ -- cgit From d7491543b698cc7ce1d5ea03f1b2d74277f30ea0 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Mon, 27 Jun 2016 21:21:26 -0400 Subject: Get the Fluxbox settings page all converted over. --- .../core-utils/lumina-config/pages/PageWidget.h | 2 +- src-qt5/core-utils/lumina-config/pages/getPage.h | 4 +- .../lumina-config/pages/page_fluxbox_settings.cpp | 170 +++++++++++++++++++++ .../lumina-config/pages/page_fluxbox_settings.h | 43 ++++++ .../core-utils/lumina-config/pages/page_sample.cpp | 1 + src-qt5/core-utils/lumina-config/pages/pages.pri | 22 +-- 6 files changed, 228 insertions(+), 14 deletions(-) create mode 100644 src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.cpp create mode 100644 src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.h diff --git a/src-qt5/core-utils/lumina-config/pages/PageWidget.h b/src-qt5/core-utils/lumina-config/pages/PageWidget.h index bee27d24..66fce36a 100644 --- a/src-qt5/core-utils/lumina-config/pages/PageWidget.h +++ b/src-qt5/core-utils/lumina-config/pages/PageWidget.h @@ -50,7 +50,7 @@ public slots: virtual void updateIcons(){} //Simplification function for widget connections - void settingChanged(){ + virtual void settingChanged(){ emit HasPendingChanges(true); } }; diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index 5add9e78..6844a8e6 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -42,7 +42,7 @@ static QList<PAGEINFO> KnownPages(){ #include "page_autostart.h" #include "page_defaultapps.h" #include "page_fluxbox_keys.h" -//#include "page_fluxbox_settings.h" +#include "page_fluxbox_settings.h" static PageWidget* GetNewPage(QString id, QWidget *parent){ //Find the page that matches this "id" @@ -51,7 +51,7 @@ static PageWidget* GetNewPage(QString id, QWidget *parent){ else if(id=="autostart"){ return new page_autostart(parent); } else if(id=="defaultapps"){ return new page_defaultapps(parent); } else if(id=="fluxbox-keys"){ return new page_fluxbox_keys(parent); } -// else if(id=="fluxbox-session"){ return new page_fluxbox_settings(parent); } + else if(id=="fluxbox-settings"){ return new page_fluxbox_settings(parent); } //Return the main control_panel page as the fallback/default return new page_main(parent); } diff --git a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.cpp b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.cpp new file mode 100644 index 00000000..8f075488 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.cpp @@ -0,0 +1,170 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_fluxbox_settings.h" +#include "ui_page_fluxbox_settings.h" +#include "getPage.h" + +//========== +// PUBLIC +//========== +page_fluxbox_settings::page_fluxbox_settings(QWidget *parent) : PageWidget(parent), ui(new Ui::page_fluxbox_settings()){ + ui->setupUi(this); + loading= false; + connect(ui->combo_session_wfocus, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) ); + connect(ui->combo_session_wloc, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) ); + connect(ui->combo_session_wtheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionthemechanged()) ); + connect(ui->spin_session_wkspaces, SIGNAL(valueChanged(int)), this, SLOT(settingChanged()) ); + updateIcons(); +} + +page_fluxbox_settings::~page_fluxbox_settings(){ + +} + +//================ +// PUBLIC SLOTS +//================ +void page_fluxbox_settings::SaveSettings(){ + QStringList FB = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init"); + // - window placement + int index = FB.indexOf( FB.filter("session.screen0.windowPlacement:").join("") ); + QString line = "session.screen0.windowPlacement:\t"+ui->combo_session_wloc->itemData( ui->combo_session_wloc->currentIndex() ).toString(); + if(index < 0){ FB << line; } //add line to the end of the file + else{ FB[index] = line; } //replace the current setting with the new one + // - window focus + index = FB.indexOf( FB.filter("session.screen0.focusModel:").join("") ); + line = "session.screen0.focusModel:\t"+ui->combo_session_wfocus->itemData( ui->combo_session_wfocus->currentIndex() ).toString(); + if(index < 0){ FB << line; } //add line to the end of the file + else{ FB[index] = line; } //replace the current setting with the new one + // - window theme + index = FB.indexOf( FB.filter("session.styleFile:").join("") ); + line = "session.styleFile:\t"+ui->combo_session_wtheme->itemData( ui->combo_session_wtheme->currentIndex() ).toString(); + if(index < 0){ FB << line; } //add line to the end of the file + else{ FB[index] = line; } //replace the current setting with the new one + // - workspace number + index = FB.indexOf( FB.filter("session.screen0.workspaces:").join("") ); + line = "session.screen0.workspaces:\t"+QString::number(ui->spin_session_wkspaces->value()); + if(index < 0){ FB << line; } //add line to the end of the file + else{ FB[index] = line; } //replace the current setting with the new one + + //Save the fluxbox settings + bool ok = overwriteFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init", FB); + if(!ok){ qDebug() << "Warning: Could not save fluxbox-init"; } + emit HasPendingChanges(false); +} + +void page_fluxbox_settings::LoadSettings(int){ + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Window Manager Settings") ); + loading = true; + ui->combo_session_wfocus->clear(); + ui->combo_session_wfocus->addItem( tr("Click To Focus"), "ClickToFocus"); + ui->combo_session_wfocus->addItem( tr("Active Mouse Focus"), "MouseFocus"); + ui->combo_session_wfocus->addItem( tr("Strict Mouse Focus"), "StrictMouseFocus"); + + ui->combo_session_wloc->clear(); + ui->combo_session_wloc->addItem( tr("Align in a Row"), "RowSmartPlacement"); + ui->combo_session_wloc->addItem( tr("Align in a Column"), "ColSmartPlacement"); + ui->combo_session_wloc->addItem( tr("Cascade"), "CascadePlacement"); + ui->combo_session_wloc->addItem( tr("Underneath Mouse"), "UnderMousePlacement"); + + ui->combo_session_wtheme->clear(); + QStringList dirs; dirs << LOS::AppPrefix()+"share/fluxbox/styles" << QDir::homePath()+"/.fluxbox/styles"; + QFileInfoList fbstyles; + for(int i=0; i<dirs.length(); i++){ + QDir fbdir(dirs[i]); + fbstyles << fbdir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase); + } + QString lastdir; + for(int i=0; i<fbstyles.length(); i++){ + if(lastdir!=fbstyles[i].absolutePath()){ + lastdir = fbstyles[i].absolutePath(); //save for checking later + if(ui->combo_session_wtheme->count()>0){ ui->combo_session_wtheme->insertSeparator(ui->combo_session_wtheme->count()); } + } + ui->combo_session_wtheme->addItem(fbstyles[i].fileName(), fbstyles[i].absoluteFilePath()); + } + + QStringList FB = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init"); + QString val; + //Do the window placement + val = FB.filter("session.screen0.windowPlacement:").join("").section(":",1,1).simplified(); + //qDebug() << "Window Placement:" << val; + int index = ui->combo_session_wloc->findData(val); + if(index<0){ index = 0;} //use the default + ui->combo_session_wloc->setCurrentIndex(index); + + //Do the window focus + val = FB.filter("session.screen0.focusModel:").join("").section(":",1,1).simplified(); + //qDebug() << "Window Focus:" << val; + index = ui->combo_session_wfocus->findData(val); + if(index<0){ index = 0;} //use the default + ui->combo_session_wfocus->setCurrentIndex(index); + + //Do the window theme + val = FB.filter("session.styleFile:").join("").section(":",1,1).simplified(); + //qDebug() << "Window Theme:" << val; + index = ui->combo_session_wtheme->findData(val); + if(index<0){ index = 0;} //use the default + ui->combo_session_wtheme->setCurrentIndex(index); + + //Now the number of workspaces + val = FB.filter("session.screen0.workspaces:").join("").section(":",1,1).simplified(); + //qDebug() << "Number of Workspaces:" << val; + if(!val.isEmpty()){ ui->spin_session_wkspaces->setValue(val.toInt()); } + + QApplication::processEvents(); + loading = false; +} + +void page_fluxbox_settings::updateIcons(){ + +} + +//================= +// PRIVATE +//================= +//Read/overwrite a text file +QStringList page_fluxbox_settings::readFile(QString path){ + QStringList out; + QFile file(path); + if(file.open(QIODevice::ReadOnly | QIODevice::Text)){ + QTextStream txt(&file); + while(!txt.atEnd()){ + out << txt.readLine(); + } + file.close(); + } + return out; +} + +bool page_fluxbox_settings::overwriteFile(QString path, QStringList contents){ + QFile file(path); + if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)){ + QTextStream txt(&file); + for(int i=0; i<contents.length(); i++){ + txt << contents[i]+"\n"; + } + file.close(); + return true; + } + return false; +} + +//================= +// PRIVATE SLOTS +//================= +void page_fluxbox_settings::sessionthemechanged(){ + //Update the Fluxbox Theme preview + QString previewfile = ui->combo_session_wtheme->itemData( ui->combo_session_wtheme->currentIndex() ).toString(); + previewfile.append( (previewfile.endsWith("/") ? "preview.jpg": "/preview.jpg") ); + if(QFile::exists(previewfile)){ + ui->label_session_wpreview->setPixmap(QPixmap(previewfile)); + }else{ + ui->label_session_wpreview->setText(tr("No Preview Available")); + } + settingChanged(); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.h b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.h new file mode 100644 index 00000000..b78b204b --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_fluxbox_settings.h @@ -0,0 +1,43 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_FLUXBOX_SETTINGS_H +#define _LUMINA_CONFIG_PAGE_FLUXBOX_SETTINGS_H +#include "../globals.h" +#include "PageWidget.h" + +namespace Ui{ + class page_fluxbox_settings; +}; + +class page_fluxbox_settings : public PageWidget{ + Q_OBJECT +public: + page_fluxbox_settings(QWidget *parent); + ~page_fluxbox_settings(); + +public slots: + void SaveSettings(); + void LoadSettings(int screennum); + void updateIcons(); + +private: + Ui::page_fluxbox_settings *ui; + bool loading; + + //Read/overwrite a text file + QStringList readFile(QString path); + bool overwriteFile(QString path, QStringList contents); + +private slots: + //Simplification function for widget connections + void settingChanged(){ + if(!loading){ emit HasPendingChanges(true); } + } + + void sessionthemechanged(); +}; +#endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_sample.cpp b/src-qt5/core-utils/lumina-config/pages/page_sample.cpp index 5273b14b..32742873 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_sample.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_sample.cpp @@ -25,6 +25,7 @@ page_sample::~page_sample(){ //================ void page_sample::SaveSettings(){ + emit HasPendingChanged(false); } void page_sample::LoadSettings(int){ diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index 4e433725..742063c8 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -6,8 +6,8 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/page_theme.h \ $${PWD}/page_autostart.h \ $${PWD}/page_defaultapps.h \ - $${PWD}/page_fluxbox_keys.h -# $${PWD}/page_fluxbox_settings.h \ + $${PWD}/page_fluxbox_keys.h \ + $${PWD}/page_fluxbox_settings.h # $${PWD}/page_interface_desktop.h \ # $${PWD}/page_interface_menu.h \ # $${PWD}/page_interface_panels.h \ @@ -20,8 +20,8 @@ SOURCES += $${PWD}/page_main.cpp \ $${PWD}/page_theme.cpp \ $${PWD}/page_autostart.cpp \ $${PWD}/page_defaultapps.cpp \ - $${PWD}/page_fluxbox_keys.cpp -# $${PWD}/page_fluxbox_settings.cpp \ + $${PWD}/page_fluxbox_keys.cpp \ + $${PWD}/page_fluxbox_settings.cpp # $${PWD}/page_interface_desktop.cpp \ # $${PWD}/page_interface_menu.cpp \ # $${PWD}/page_interface_panels.cpp \ @@ -34,10 +34,10 @@ FORMS += $${PWD}/page_main.ui \ $${PWD}/page_theme.ui \ $${PWD}/page_autostart.ui \ $${PWD}/page_defaultapps.ui \ - $${PWD}/page_fluxbox_keys.ui -# $${PWD}/page_fluxbox_settings.ui \ -# $${PWD}/page_interface_desktop.ui \ -# $${PWD}/page_interface_menu.ui \ -# $${PWD}/page_interface_panels.ui \ -# $${PWD}/page_session_locale.ui \ -# $${PWD}/page_session_options.ui \ + $${PWD}/page_fluxbox_keys.ui \ + $${PWD}/page_fluxbox_settings.ui \ + $${PWD}/page_interface_desktop.ui \ + $${PWD}/page_interface_menu.ui \ + $${PWD}/page_interface_panels.ui \ + $${PWD}/page_session_locale.ui \ + $${PWD}/page_session_options.ui -- cgit From 1b5d90ee6babf02222b5c3a8b41208bfef70d7d9 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Mon, 27 Jun 2016 22:22:39 -0400 Subject: Get the desktop interface page all converted over to the new UI. --- src-qt5/core-utils/lumina-config/pages/getPage.h | 11 +- .../lumina-config/pages/page_interface_desktop.cpp | 151 +++++++++++++++++++++ .../lumina-config/pages/page_interface_desktop.h | 42 ++++++ .../core-utils/lumina-config/pages/page_sample.cpp | 5 + src-qt5/core-utils/lumina-config/pages/pages.pri | 8 +- 5 files changed, 212 insertions(+), 5 deletions(-) create mode 100644 src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp create mode 100644 src-qt5/core-utils/lumina-config/pages/page_interface_desktop.h diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index 6844a8e6..21830a5c 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -29,9 +29,12 @@ static QList<PAGEINFO> KnownPages(){ list << PageInfo("wallpaper", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "image"); list << PageInfo("theme", QObject::tr("Change Desktop Theme"), QObject::tr("Theme Settings"), "preferences-desktop-theme",QObject::tr("Change interface fonts and colors"), "appearance", QStringList(), QStringList() << "background" << "interface" << "color" << "theme" << "plugins"); list << PageInfo("autostart", QObject::tr("Startup Services and Applications"), 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 << PageInfo("defaultapps", QObject::tr("Default Applications for File Type"), QObject::tr("Mimetype Settings"), "preferences-desktop-filetype-association",QObject::tr("Change default applications"), "session", QStringList(), QStringList() << "apps" << "default" << "services" << "xdg" << "session"); + list << PageInfo("defaultapps", QObject::tr("Default Applications for File Type"), QObject::tr("Mimetype Settings"), "preferences-desktop-default-applications",QObject::tr("Change default applications"), "session", QStringList(), QStringList() << "apps" << "default" << "services" << "xdg" << "session"); list << PageInfo("fluxbox-keys", QObject::tr("Keyboard Shortcuts"), QObject::tr("Keyboard Shortcuts"), "preferences-desktop-keyboard",QObject::tr("Change keyboard shortcuts"), "session", QStringList(), QStringList() << "apps" << "fluxbox" << "keys" << "keyboard" << "session" << "launch"); list << PageInfo("fluxbox-settings", QObject::tr("Window Manager"), QObject::tr("Window Settings"), "preferences-system-windows",QObject::tr("Change window settings and appearances"), "appearance", QStringList(), QStringList() << "window" << "frame" << "border" << "workspace" << "theme" << "fluxbox" << "session"); + list << PageInfo("interface-desktop", QObject::tr("Desktop Icons and Plugins"), QObject::tr("Desktop Plugins"), "preferences-desktop-icons",QObject::tr("Change what icons or tools are embedded on the desktop"), "interface", QStringList(), QStringList() << "desktop" << "plugins" << "embed" << "icons" << "utilities"); + list << PageInfo("interface-panel", QObject::tr("Floating Panels and Plugins"), QObject::tr("Panels and Plugins"), "configure-toolbars",QObject::tr("Change any floating panels and what they show"), "interface", QStringList(), QStringList() << "desktop" << "toolbar" << "panel" << "floating" << "plugins"); + list << PageInfo("interface-menu", QObject::tr("Context Menu and Plugins"), QObject::tr("Menu Plugins"), "preferences-plugin",QObject::tr("Change what options are shown on the desktop context menu"), "interface", QStringList(), QStringList() << "desktop" << "menu" << "plugins" << "shortcuts"); return list; } @@ -43,6 +46,9 @@ static QList<PAGEINFO> KnownPages(){ #include "page_defaultapps.h" #include "page_fluxbox_keys.h" #include "page_fluxbox_settings.h" +#include "page_interface_desktop.h" +//#include "page_interface_panels.h" +//#include "page_interface_menu.h" static PageWidget* GetNewPage(QString id, QWidget *parent){ //Find the page that matches this "id" @@ -52,6 +58,9 @@ static PageWidget* GetNewPage(QString id, QWidget *parent){ else if(id=="defaultapps"){ return new page_defaultapps(parent); } else if(id=="fluxbox-keys"){ return new page_fluxbox_keys(parent); } else if(id=="fluxbox-settings"){ return new page_fluxbox_settings(parent); } + else if(id=="interface-desktop"){ return new page_interface_desktop(parent); } +// else if(id=="interface-panel"){ return new page_interface_panels(parent); } +// else if(id=="interface-menu"){ return new page_interface_menu(parent); } //Return the main control_panel page as the fallback/default return new page_main(parent); } diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp b/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp new file mode 100644 index 00000000..bd617464 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp @@ -0,0 +1,151 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_interface_desktop.h" +#include "ui_page_interface_desktop.h" +#include "getPage.h" +#include "../GetPluginDialog.h" +#include "../AppDialog.h" + +//========== +// PUBLIC +//========== +page_interface_desktop::page_interface_desktop(QWidget *parent) : PageWidget(parent), ui(new Ui::page_interface_desktop()){ + ui->setupUi(this); + PINFO = new LPlugins(); + connect(ui->tool_desktop_addplugin, SIGNAL(clicked()), this, SLOT(deskplugadded()) ); + connect(ui->tool_desktop_rmplugin, SIGNAL(clicked()), this, SLOT(deskplugremoved()) ); + updateIcons(); +} + +page_interface_desktop::~page_interface_desktop(){ + delete PINFO; +} + +//================ +// PUBLIC SLOTS +//================ +void page_interface_desktop::SaveSettings(){ + QSettings settings("lumina-desktop","desktopsettings"); + QString DPrefix = "desktop-"+QString::number(cscreen)+"/"; + + QStringList plugs; + for(int i=0; i<ui->list_desktop_plugins->count(); i++){ + plugs << ui->list_desktop_plugins->item(i)->whatsThis(); + } + if(settings.value(DPrefix+"pluginlist",QStringList()).toStringList() != plugs){ + settings.setValue(DPrefix+"pluginlist", plugs); + } + //The plugin ID's will be changed to unique ID's by the desktop - reload in a moment + emit HasPendingChanges(false); + QTimer::singleShot(1000, this, SLOT(LoadSettings()) ); +} + +void page_interface_desktop::LoadSettings(int screennum){ + if(screennum>=0){ + cscreen = screennum; + } + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Desktop Settings") ); + QSettings settings("lumina-desktop","desktopsettings"); + QString DPrefix = "desktop-"+QString::number(cscreen)+"/"; + + QStringList dplugs = settings.value(DPrefix+"pluginlist",QStringList()).toStringList(); + ui->list_desktop_plugins->clear(); + for(int i=0; i<dplugs.length(); i++){ + QListWidgetItem* it = new QListWidgetItem(); + it->setWhatsThis(dplugs[i]); //save the full thing instantly + //Now load the rest of the info about the plugin + QString num; + if(dplugs[i].contains("---")){ + num = dplugs[i].section("---",1,1).section(".",1,1).simplified(); //Skip the screen number + if(num=="1"){ num.clear(); } //don't bother showing the number + dplugs[i] = dplugs[i].section("---",0,0); + } + if(dplugs[i].startsWith("applauncher::")){ + bool ok = false; + XDGDesktop app = LXDG::loadDesktopFile(dplugs[i].section("::",1,50), ok); + if(!ok){ continue; } //invalid for some reason + //Now fill the item with the necessary info + it->setText(app.name); + it->setIcon(LXDG::findIcon(app.icon,"") ); + it->setToolTip(app.comment); + }else{ + //Load the info for this plugin + LPI info = PINFO->desktopPluginInfo(dplugs[i]); + if( info.ID.isEmpty() ){ continue; } //invalid plugin for some reason + it->setText(info.name); + it->setToolTip(info.description); + it->setIcon( LXDG::findIcon(info.icon,"") ); + } + if(!num.isEmpty()){ it->setText( it->text()+" ("+num+")"); } //append the number + ui->list_desktop_plugins->addItem(it); + } +} + +void page_interface_desktop::updateIcons(){ + ui->tool_desktop_addplugin->setIcon( LXDG::findIcon("list-add","") ); + ui->tool_desktop_rmplugin->setIcon( LXDG::findIcon("list-remove","") ); +} + +//================= +// PRIVATE +//================= +XDGDesktop page_interface_desktop::getSysApp(bool allowreset){ + AppDialog dlg(this, LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ) ); + dlg.allowReset(allowreset); + dlg.exec(); + XDGDesktop desk; + if(dlg.appreset && allowreset){ + desk.filePath = "reset"; //special internal flag + }else{ + desk = dlg.appselected; + } + return desk; +} + +//================= +// PRIVATE SLOTS +//================= +void page_interface_desktop::deskplugadded(){ + GetPluginDialog dlg(this); + dlg.LoadPlugins("desktop", PINFO); + dlg.exec(); + if( !dlg.selected ){ return; } //cancelled + QString newplug = dlg.plugID; + QListWidgetItem *it = new QListWidgetItem(); + if(newplug=="applauncher"){ + //Prompt for the application to add + XDGDesktop app = getSysApp(); + if(app.filePath.isEmpty()){ return; } //cancelled + newplug.append("::"+app.filePath); + //Now fill the item with the necessary info + it->setWhatsThis(newplug); + it->setText(app.name); + it->setIcon(LXDG::findIcon(app.icon,"") ); + it->setToolTip(app.comment); + }else{ + //Load the info for this plugin + LPI info = PINFO->desktopPluginInfo(newplug); + if( info.ID.isEmpty() ){ return; } //invalid plugin for some reason (should never happen) + it->setWhatsThis(newplug); + it->setText(info.name); + it->setToolTip(info.description); + it->setIcon( LXDG::findIcon(info.icon,"") ); + } + ui->list_desktop_plugins->addItem(it); + ui->list_desktop_plugins->scrollToItem(it); + settingChanged(); +} + +void page_interface_desktop::deskplugremoved(){ + QList<QListWidgetItem*> sel = ui->list_desktop_plugins->selectedItems(); + if(sel.isEmpty()){ return; } //nothing to do + for(int i=0; i<sel.length(); i++){ + delete sel[i]; + } + settingChanged(); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.h b/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.h new file mode 100644 index 00000000..e212182a --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.h @@ -0,0 +1,42 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_INTERFACE_DESKTOP_H +#define _LUMINA_CONFIG_PAGE_INTERFACE_DESKTOP_H +#include "../globals.h" +#include "PageWidget.h" +#include "../LPlugins.h" + +namespace Ui{ + class page_interface_desktop; +}; + +class page_interface_desktop : public PageWidget{ + Q_OBJECT +public: + page_interface_desktop(QWidget *parent); + ~page_interface_desktop(); + + bool needsScreenSelector(){ return true; } + +public slots: + void SaveSettings(); + void LoadSettings(int screennum = -1); + void updateIcons(); + +private: + Ui::page_interface_desktop *ui; + int cscreen; //current monitor/screen number + LPlugins *PINFO; + + //Get an application on the system + XDGDesktop getSysApp(bool allowreset = false); + +private slots: + void deskplugadded(); + void deskplugremoved(); +}; +#endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_sample.cpp b/src-qt5/core-utils/lumina-config/pages/page_sample.cpp index 32742873..0256df8d 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_sample.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_sample.cpp @@ -14,6 +14,7 @@ page_sample::page_sample(QWidget *parent) : PageWidget(parent), ui(new Ui::page_sample()){ ui->setupUi(this); + updateIcons(); } page_sample::~page_sample(){ @@ -38,6 +39,10 @@ void page_sample::updateIcons(){ } +//================= +// PRIVATE +//================= + //================= // PRIVATE SLOTS //================= diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index 742063c8..8d2f1dec 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -7,8 +7,8 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/page_autostart.h \ $${PWD}/page_defaultapps.h \ $${PWD}/page_fluxbox_keys.h \ - $${PWD}/page_fluxbox_settings.h -# $${PWD}/page_interface_desktop.h \ + $${PWD}/page_fluxbox_settings.h \ + $${PWD}/page_interface_desktop.h # $${PWD}/page_interface_menu.h \ # $${PWD}/page_interface_panels.h \ # $${PWD}/page_session_locale.h \ @@ -21,8 +21,8 @@ SOURCES += $${PWD}/page_main.cpp \ $${PWD}/page_autostart.cpp \ $${PWD}/page_defaultapps.cpp \ $${PWD}/page_fluxbox_keys.cpp \ - $${PWD}/page_fluxbox_settings.cpp -# $${PWD}/page_interface_desktop.cpp \ + $${PWD}/page_fluxbox_settings.cpp \ + $${PWD}/page_interface_desktop.cpp # $${PWD}/page_interface_menu.cpp \ # $${PWD}/page_interface_panels.cpp \ # $${PWD}/page_session_locale.cpp \ -- cgit From 254941f51c444e9edea99bf82ff02e6f05fdfb81 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Mon, 27 Jun 2016 22:52:39 -0400 Subject: Get the panel interface page all converted over to the new UI. --- src-qt5/core-utils/lumina-config/pages/getPage.h | 4 ++-- src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp | 1 + src-qt5/core-utils/lumina-config/pages/pages.pri | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index 21830a5c..ad0fea08 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -47,7 +47,7 @@ static QList<PAGEINFO> KnownPages(){ #include "page_fluxbox_keys.h" #include "page_fluxbox_settings.h" #include "page_interface_desktop.h" -//#include "page_interface_panels.h" +#include "page_interface_panels.h" //#include "page_interface_menu.h" static PageWidget* GetNewPage(QString id, QWidget *parent){ @@ -59,7 +59,7 @@ static PageWidget* GetNewPage(QString id, QWidget *parent){ else if(id=="fluxbox-keys"){ return new page_fluxbox_keys(parent); } else if(id=="fluxbox-settings"){ return new page_fluxbox_settings(parent); } else if(id=="interface-desktop"){ return new page_interface_desktop(parent); } -// else if(id=="interface-panel"){ return new page_interface_panels(parent); } + else if(id=="interface-panel"){ return new page_interface_panels(parent); } // else if(id=="interface-menu"){ return new page_interface_menu(parent); } //Return the main control_panel page as the fallback/default return new page_main(parent); diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp b/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp index bd617464..9c319780 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_desktop.cpp @@ -18,6 +18,7 @@ page_interface_desktop::page_interface_desktop(QWidget *parent) : PageWidget(par PINFO = new LPlugins(); connect(ui->tool_desktop_addplugin, SIGNAL(clicked()), this, SLOT(deskplugadded()) ); connect(ui->tool_desktop_rmplugin, SIGNAL(clicked()), this, SLOT(deskplugremoved()) ); + connect(ui->check_desktop_autolaunchers, SIGNAL(clicked()), this, SLOT(settingChanged()) ); updateIcons(); } diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index 8d2f1dec..ebf6f892 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -8,9 +8,9 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/page_defaultapps.h \ $${PWD}/page_fluxbox_keys.h \ $${PWD}/page_fluxbox_settings.h \ - $${PWD}/page_interface_desktop.h + $${PWD}/page_interface_desktop.h \ # $${PWD}/page_interface_menu.h \ -# $${PWD}/page_interface_panels.h \ + $${PWD}/page_interface_panels.h # $${PWD}/page_session_locale.h \ # $${PWD}/page_session_options.h \ @@ -22,9 +22,9 @@ SOURCES += $${PWD}/page_main.cpp \ $${PWD}/page_defaultapps.cpp \ $${PWD}/page_fluxbox_keys.cpp \ $${PWD}/page_fluxbox_settings.cpp \ - $${PWD}/page_interface_desktop.cpp + $${PWD}/page_interface_desktop.cpp \ # $${PWD}/page_interface_menu.cpp \ -# $${PWD}/page_interface_panels.cpp \ + $${PWD}/page_interface_panels.cpp # $${PWD}/page_session_locale.cpp \ # $${PWD}/page_session_options.cpp \ -- cgit From 43b41a4a7fa570408045f5d7de4207312d941ecd Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Mon, 27 Jun 2016 23:09:43 -0400 Subject: Get the new menu interface page converted over. --- src-qt5/core-utils/lumina-config/pages/getPage.h | 4 +- .../lumina-config/pages/page_interface_menu.cpp | 164 +++++++++++++++++++++ .../lumina-config/pages/page_interface_menu.h | 41 ++++++ .../lumina-config/pages/page_interface_menu.ui | 8 +- src-qt5/core-utils/lumina-config/pages/pages.pri | 4 +- 5 files changed, 213 insertions(+), 8 deletions(-) create mode 100644 src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp create mode 100644 src-qt5/core-utils/lumina-config/pages/page_interface_menu.h diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index ad0fea08..90358edf 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -48,7 +48,7 @@ static QList<PAGEINFO> KnownPages(){ #include "page_fluxbox_settings.h" #include "page_interface_desktop.h" #include "page_interface_panels.h" -//#include "page_interface_menu.h" +#include "page_interface_menu.h" static PageWidget* GetNewPage(QString id, QWidget *parent){ //Find the page that matches this "id" @@ -60,7 +60,7 @@ static PageWidget* GetNewPage(QString id, QWidget *parent){ else if(id=="fluxbox-settings"){ return new page_fluxbox_settings(parent); } else if(id=="interface-desktop"){ return new page_interface_desktop(parent); } else if(id=="interface-panel"){ return new page_interface_panels(parent); } -// else if(id=="interface-menu"){ return new page_interface_menu(parent); } + else if(id=="interface-menu"){ return new page_interface_menu(parent); } //Return the main control_panel page as the fallback/default return new page_main(parent); } diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp b/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp new file mode 100644 index 00000000..742c5728 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp @@ -0,0 +1,164 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_interface_menu.h" +#include "ui_page_interface_menu.h" +#include "getPage.h" +#include "../AppDialog.h" +#include "../GetPluginDialog.h" + +//========== +// PUBLIC +//========== +page_interface_menu::page_interface_menu(QWidget *parent) : PageWidget(parent), ui(new Ui::page_interface_menu()){ + ui->setupUi(this); + PINFO = new LPlugins(); + connect(ui->tool_menu_add, SIGNAL(clicked()), this, SLOT(addmenuplugin()) ); + connect(ui->tool_menu_rm, SIGNAL(clicked()), this, SLOT(rmmenuplugin()) ); + connect(ui->tool_menu_up, SIGNAL(clicked()), this, SLOT(upmenuplugin()) ); + connect(ui->tool_menu_dn, SIGNAL(clicked()), this, SLOT(downmenuplugin()) ); + connect(ui->list_menu, SIGNAL(currentRowChanged(int)), this, SLOT(checkmenuicons()) ); + + updateIcons(); +} + +page_interface_menu::~page_interface_menu(){ + delete PINFO; +} + +//================ +// PUBLIC SLOTS +//================ +void page_interface_menu::SaveSettings(){ + QSettings settings("lumina-desktop","desktopsettings"); + QStringList items; + for(int i=0; i<ui->list_menu->count(); i++){ + items << ui->list_menu->item(i)->whatsThis(); + } + settings.setValue("menu/itemlist", items); + emit HasPendingChanges(false); +} + +void page_interface_menu::LoadSettings(int){ + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Desktop Settings") ); + QSettings settings("lumina-desktop","desktopsettings"); + +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++){ + LPI info = PINFO->menuPluginInfo(items[i]); + if(items[i].startsWith("app::::")){ + bool ok = false; + XDGDesktop desk = LXDG::loadDesktopFile(items[i].section("::::",1,1), ok); + if(!ok){ continue; } //invalid application file (no longer installed?) + QListWidgetItem *item = new QListWidgetItem(); + item->setWhatsThis( items[i] ); + item->setIcon( LXDG::findIcon(desk.icon) ); + item->setText( desk.name ); + item->setToolTip( desk.comment ); + ui->list_menu->addItem(item); + continue; //now go to the next item + } + if(info.ID.isEmpty()){ continue; } //invalid plugin + //qDebug() << "Add Menu Item:" << info.ID; + QListWidgetItem *item = new QListWidgetItem(); + item->setWhatsThis( info.ID ); + item->setIcon( LXDG::findIcon(info.icon,"") ); + item->setText( info.name ); + item->setToolTip( info.description ); + ui->list_menu->addItem(item); + } + checkmenuicons(); //update buttons +} + +void page_interface_menu::updateIcons(){ + ui->tool_menu_add->setIcon( LXDG::findIcon("list-add","") ); + ui->tool_menu_rm->setIcon( LXDG::findIcon("list-remove","") ); + ui->tool_menu_up->setIcon( LXDG::findIcon("go-up","") ); + ui->tool_menu_dn->setIcon( LXDG::findIcon("go-down","") ); +} + +//================= +// PRIVATE +//================= +XDGDesktop page_interface_menu::getSysApp(bool allowreset){ + AppDialog dlg(this, LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ) ); + dlg.allowReset(allowreset); + dlg.exec(); + XDGDesktop desk; + if(dlg.appreset && allowreset){ + desk.filePath = "reset"; //special internal flag + }else{ + desk = dlg.appselected; + } + return desk; +} + +//================= +// PRIVATE SLOTS +//================= +void page_interface_menu::addmenuplugin(){ + GetPluginDialog dlg(this); + dlg.LoadPlugins("menu", PINFO); + dlg.exec(); + if(!dlg.selected){ return; } //cancelled + QString plug = dlg.plugID; + //Now add the item to the list + LPI info = PINFO->menuPluginInfo(plug); + QListWidgetItem *it; + if(info.ID=="app"){ + //Need to prompt for the exact application to add to the menu + // Note: whatsThis() format: "app::::< *.desktop file path >" + XDGDesktop desk = getSysApp(); + if(desk.filePath.isEmpty()){ return; }//nothing selected + //Create the item for the list + it = new QListWidgetItem(LXDG::findIcon(desk.icon,""), desk.name ); + it->setWhatsThis(info.ID+"::::"+desk.filePath); + it->setToolTip( desk.comment ); + }else{ + it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name ); + it->setWhatsThis(info.ID); + it->setToolTip( info.description ); + } + ui->list_menu->addItem(it); + ui->list_menu->setCurrentRow(ui->list_menu->count()-1); //make sure it is auto-selected + settingChanged(); +} + +void page_interface_menu::rmmenuplugin(){ + if(ui->list_menu->currentRow() < 0){ return; } //no selection + delete ui->list_menu->takeItem( ui->list_menu->currentRow() ); + settingChanged(); +} + +void page_interface_menu::upmenuplugin(){ + int row = ui->list_menu->currentRow(); + if(row <= 0){ return; } + ui->list_menu->insertItem(row-1, ui->list_menu->takeItem(row)); + ui->list_menu->setCurrentRow(row-1); + + checkmenuicons(); + settingChanged(); +} + +void page_interface_menu::downmenuplugin(){ + int row = ui->list_menu->currentRow(); + if(row < 0 || row >= (ui->list_menu->count()-1) ){ return; } + ui->list_menu->insertItem(row+1, ui->list_menu->takeItem(row)); + ui->list_menu->setCurrentRow(row+1); + + checkmenuicons(); + settingChanged(); +} + +void page_interface_menu::checkmenuicons(){ + ui->tool_menu_up->setEnabled( ui->list_menu->currentRow() > 0 ); + ui->tool_menu_dn->setEnabled( ui->list_menu->currentRow() < (ui->list_menu->count()-1) ); + ui->tool_menu_rm->setEnabled( ui->list_menu->currentRow() >=0 ); +} diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_menu.h b/src-qt5/core-utils/lumina-config/pages/page_interface_menu.h new file mode 100644 index 00000000..f2a53007 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_menu.h @@ -0,0 +1,41 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_INTERFACE_MENU_H +#define _LUMINA_CONFIG_PAGE_INTERFACE_MENU_H +#include "../globals.h" +#include "PageWidget.h" +#include "../LPlugins.h" + +namespace Ui{ + class page_interface_menu; +}; + +class page_interface_menu : public PageWidget{ + Q_OBJECT +public: + page_interface_menu(QWidget *parent); + ~page_interface_menu(); + +public slots: + void SaveSettings(); + void LoadSettings(int screennum); + void updateIcons(); + +private: + Ui::page_interface_menu *ui; + LPlugins *PINFO; + //Get an application on the system + XDGDesktop getSysApp(bool allowreset = false); + +private slots: + void addmenuplugin(); + void rmmenuplugin(); + void upmenuplugin(); + void downmenuplugin(); + void checkmenuicons(); +}; +#endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_menu.ui b/src-qt5/core-utils/lumina-config/pages/page_interface_menu.ui index 1d230494..4579ef54 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_interface_menu.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_menu.ui @@ -15,16 +15,16 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <property name="leftMargin"> - <number>0</number> + <number>6</number> </property> <property name="topMargin"> - <number>0</number> + <number>6</number> </property> <property name="rightMargin"> - <number>0</number> + <number>6</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>6</number> </property> <item> <widget class="QLabel" name="label_10"> diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index ebf6f892..ab97e07d 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -9,7 +9,7 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/page_fluxbox_keys.h \ $${PWD}/page_fluxbox_settings.h \ $${PWD}/page_interface_desktop.h \ -# $${PWD}/page_interface_menu.h \ + $${PWD}/page_interface_menu.h \ $${PWD}/page_interface_panels.h # $${PWD}/page_session_locale.h \ # $${PWD}/page_session_options.h \ @@ -23,7 +23,7 @@ SOURCES += $${PWD}/page_main.cpp \ $${PWD}/page_fluxbox_keys.cpp \ $${PWD}/page_fluxbox_settings.cpp \ $${PWD}/page_interface_desktop.cpp \ -# $${PWD}/page_interface_menu.cpp \ + $${PWD}/page_interface_menu.cpp \ $${PWD}/page_interface_panels.cpp # $${PWD}/page_session_locale.cpp \ # $${PWD}/page_session_options.cpp \ -- cgit From 6eca90c6691a4b215406df0d4fc087c376020eb6 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Mon, 27 Jun 2016 23:10:51 -0400 Subject: Re-enable the old UI - only 2 more pages left to convert before switching to the new interface completely. --- src-qt5/core-utils/lumina-config/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src-qt5/core-utils/lumina-config/main.cpp b/src-qt5/core-utils/lumina-config/main.cpp index 20d517b2..a63e0fbe 100644 --- a/src-qt5/core-utils/lumina-config/main.cpp +++ b/src-qt5/core-utils/lumina-config/main.cpp @@ -19,8 +19,8 @@ int main(int argc, char ** argv) LuminaThemeEngine theme(&a); - //MainUI w; - mainWindow w; + MainUI w; + //mainWindow w; QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(slotSingleInstance()) ); QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); w.show(); -- cgit From e44b85bd20abbd174523de548d5167a03d80b4d3 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Tue, 28 Jun 2016 06:54:09 -0400 Subject: Oops - forgot to add the page_interface_panels files to git. --- .../lumina-config/pages/page_interface_panels.cpp | 143 +++++++++++++++++++++ .../lumina-config/pages/page_interface_panels.h | 48 +++++++ 2 files changed, 191 insertions(+) create mode 100644 src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp create mode 100644 src-qt5/core-utils/lumina-config/pages/page_interface_panels.h 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 new file mode 100644 index 00000000..9d940033 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.cpp @@ -0,0 +1,143 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_interface_panels.h" +#include "ui_page_interface_panels.h" +#include "getPage.h" +#include "../GetPluginDialog.h" +#include "../AppDialog.h" + +//========== +// PUBLIC +//========== +page_interface_panels::page_interface_panels(QWidget *parent) : PageWidget(parent), ui(new Ui::page_interface_panels()){ + ui->setupUi(this); + loading = false; + PINFO = new LPlugins(); + settings = new QSettings("lumina-desktop","desktopsettings"); + connect(ui->tool_panels_add, SIGNAL(clicked()), this, SLOT(newPanel()) ); + updateIcons(); +} + +page_interface_panels::~page_interface_panels(){ + delete PINFO; +} + +//================ +// PUBLIC SLOTS +//================ +void page_interface_panels::SaveSettings(){ + QString DPrefix = "desktop-"+QString::number(cscreen)+"/"; + settings->setValue(DPrefix+"panels", PANELS.length()); + for(int i=0; i<PANELS.length(); i++){ + PANELS[i]->SaveSettings(settings); + } + //The plugin ID's will be changed to unique ID's by the desktop - reload in a moment + emit HasPendingChanges(false); + settings->sync(); //save to disk right now + QTimer::singleShot(1000, this, SLOT(LoadSettings()) ); +} + +void page_interface_panels::LoadSettings(int screennum){ + if(screennum>=0){ + cscreen = screennum; + } + loading = true; + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Desktop Settings") ); + QString DPrefix = "desktop-"+QString::number(cscreen)+"/"; + int panelnumber = settings->value(DPrefix+"panels",-1).toInt(); + +//First clean any current panels + for(int i=0; i<PANELS.length(); i++){ delete PANELS.takeAt(i); i--; } + //Now create new panels + if(ui->scroll_panels->widget()->layout()==0){ + ui->scroll_panels->widget()->setLayout( new QHBoxLayout() ); + ui->scroll_panels->widget()->layout()->setContentsMargins(0,0,0,0); + } + ui->scroll_panels->widget()->layout()->setAlignment(Qt::AlignLeft); + //Clear anything left over in the layout + for(int i=0; i<ui->scroll_panels->widget()->layout()->count(); i++){ + delete ui->scroll_panels->widget()->layout()->takeAt(i); + } + for(int i=0; i<panelnumber; i++){ + PanelWidget *tmp = new PanelWidget(ui->scroll_panels->widget(), this, PINFO); + tmp->LoadSettings(settings, cscreen, i); + PANELS << tmp; + connect(tmp, SIGNAL(PanelChanged()), this, SLOT(panelValChanged()) ); + connect(tmp, SIGNAL(PanelRemoved(int)), this, SLOT(removePanel(int)) ); + ui->scroll_panels->widget()->layout()->addWidget(tmp); + } + static_cast<QHBoxLayout*>(ui->scroll_panels->widget()->layout())->addStretch(); + + QApplication::processEvents(); + loading = false; +} + +void page_interface_panels::updateIcons(){ + ui->tool_panels_add->setIcon( LXDG::findIcon("list-add","") ); +} + +//================= +// PRIVATE +//================= +/*XDGDesktop page_interface_panels::getSysApp(bool allowreset){ + AppDialog dlg(this, LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ) ); + dlg.allowReset(allowreset); + dlg.exec(); + XDGDesktop desk; + if(dlg.appreset && allowreset){ + desk.filePath = "reset"; //special internal flag + }else{ + desk = dlg.appselected; + } + return desk; +}*/ + +//================= +// PRIVATE SLOTS +//================= +void page_interface_panels::panelValChanged(){ + ui->tool_panels_add->setEnabled(panelnumber < 12); + if(!loading){ settingChanged(); } +} + +void page_interface_panels::newPanel(){ + if(panelnumber<0){ panelnumber=0; } //just in case + panelnumber++; + //Now create a new Panel widget with this number + PanelWidget *tmp = new PanelWidget(ui->scroll_panels->widget(), this, PINFO); + tmp->LoadSettings(settings, cscreen, panelnumber-1); + PANELS << tmp; + connect(tmp, SIGNAL(PanelChanged()), this, SLOT(panelValChanged()) ); + connect(tmp, SIGNAL(PanelRemoved(int)), this, SLOT(removePanel(int)) ); + static_cast<QBoxLayout*>(ui->scroll_panels->widget()->layout())->insertWidget(PANELS.length()-1, tmp); + //update the widget first (2 necessary for scroll below to work) + ui->scroll_panels->update(); + QApplication::processEvents(); + QApplication::processEvents(); + ui->scroll_panels->ensureWidgetVisible(tmp); + panelValChanged(); +} + +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++){ + int num = PANELS[i]->PanelNumber(); + if(num==pan){ + delete PANELS.takeAt(i); + i--; + changed = true; + }else if(num > pan){ + PANELS[i]->ChangePanelNumber(num-1); + changed = true; + } + } + if(!changed){ return; } //nothing done + panelnumber--; + panelValChanged(); +} 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 new file mode 100644 index 00000000..308bbd9a --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_panels.h @@ -0,0 +1,48 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_INTERFACE_PANELS_H +#define _LUMINA_CONFIG_PAGE_INTERFACE_PANELS_H +#include "../globals.h" +#include "PageWidget.h" +#include "../LPlugins.h" +#include "../PanelWidget.h" + +namespace Ui{ + class page_interface_panels; +}; + +class page_interface_panels : public PageWidget{ + Q_OBJECT +public: + page_interface_panels(QWidget *parent); + ~page_interface_panels(); + + bool needsScreenSelector(){ return true; } + +public slots: + void SaveSettings(); + void LoadSettings(int screennum = -1); + void updateIcons(); + +private: + Ui::page_interface_panels *ui; + bool loading; + int cscreen; //current monitor/screen number + int panelnumber; //current number of panels + QSettings *settings; + LPlugins *PINFO; + QList<PanelWidget*> PANELS; + + //Get an application on the system + //XDGDesktop getSysApp(bool allowreset = false); + +private slots: + void panelValChanged(); + void newPanel(); + void removePanel(int); //connected to a signal from the panel widget +}; +#endif -- cgit From 7738a79cdf92bc10a9bd6679d1753f0587573ffc Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Tue, 28 Jun 2016 07:59:30 -0400 Subject: Add in the last 2 converted pages (session_[locale/options]). Leave the new UI enabled now. --- src-qt5/core-utils/lumina-config/globals.h | 1 + src-qt5/core-utils/lumina-config/main.cpp | 3 +- src-qt5/core-utils/lumina-config/pages/getPage.h | 8 +- .../core-utils/lumina-config/pages/page_main.cpp | 12 +- .../lumina-config/pages/page_session_locale.cpp | 113 ++++++++++++++ .../lumina-config/pages/page_session_locale.h | 35 +++++ .../lumina-config/pages/page_session_locale.ui | 8 +- .../lumina-config/pages/page_session_options.cpp | 172 +++++++++++++++++++++ .../lumina-config/pages/page_session_options.h | 39 +++++ .../lumina-config/pages/page_session_options.ui | 8 +- src-qt5/core-utils/lumina-config/pages/pages.pri | 12 +- 11 files changed, 388 insertions(+), 23 deletions(-) create mode 100644 src-qt5/core-utils/lumina-config/pages/page_session_locale.cpp create mode 100644 src-qt5/core-utils/lumina-config/pages/page_session_locale.h create mode 100644 src-qt5/core-utils/lumina-config/pages/page_session_options.cpp create mode 100644 src-qt5/core-utils/lumina-config/pages/page_session_options.h diff --git a/src-qt5/core-utils/lumina-config/globals.h b/src-qt5/core-utils/lumina-config/globals.h index b7468970..c96aaaa3 100644 --- a/src-qt5/core-utils/lumina-config/globals.h +++ b/src-qt5/core-utils/lumina-config/globals.h @@ -21,6 +21,7 @@ #include <QColorDialog> #include <QMessageBox> #include <QShortcut> +#include <QImageReader> //Now the Lumina Library classes #include <LuminaXDG.h> diff --git a/src-qt5/core-utils/lumina-config/main.cpp b/src-qt5/core-utils/lumina-config/main.cpp index a63e0fbe..8056a083 100644 --- a/src-qt5/core-utils/lumina-config/main.cpp +++ b/src-qt5/core-utils/lumina-config/main.cpp @@ -19,8 +19,7 @@ int main(int argc, char ** argv) LuminaThemeEngine theme(&a); - MainUI w; - //mainWindow w; + mainWindow w; QObject::connect(&a, SIGNAL(InputsAvailable(QStringList)), &w, SLOT(slotSingleInstance()) ); QObject::connect(&theme, SIGNAL(updateIcons()), &w, SLOT(setupIcons()) ); w.show(); diff --git a/src-qt5/core-utils/lumina-config/pages/getPage.h b/src-qt5/core-utils/lumina-config/pages/getPage.h index 90358edf..b38e614f 100644 --- a/src-qt5/core-utils/lumina-config/pages/getPage.h +++ b/src-qt5/core-utils/lumina-config/pages/getPage.h @@ -23,7 +23,7 @@ static PAGEINFO PageInfo(QString ID, QString i_name, QString i_title, QString i_ //List all the known pages // **** Add new page entries here **** static QList<PAGEINFO> KnownPages(){ - // Valid Groups: ["appearance", "interface", "session", "apps"] + // Valid Groups: ["appearance", "interface", "session", "user"] QList<PAGEINFO> list; //Reminder: <ID>, <name>, <title>, <icon>, <comment>, <category>, <server subsytem list>, <search tags> list << PageInfo("wallpaper", QObject::tr("Change Wallpaper"), QObject::tr("Wallpaper Settings"), "preferences-desktop-wallpaper",QObject::tr("Change background image(s)"), "appearance", QStringList(), QStringList() << "background" << "wallpaper" << "color" << "image"); @@ -35,6 +35,8 @@ static QList<PAGEINFO> KnownPages(){ list << PageInfo("interface-desktop", QObject::tr("Desktop Icons and Plugins"), QObject::tr("Desktop Plugins"), "preferences-desktop-icons",QObject::tr("Change what icons or tools are embedded on the desktop"), "interface", QStringList(), QStringList() << "desktop" << "plugins" << "embed" << "icons" << "utilities"); list << PageInfo("interface-panel", QObject::tr("Floating Panels and Plugins"), QObject::tr("Panels and Plugins"), "configure-toolbars",QObject::tr("Change any floating panels and what they show"), "interface", QStringList(), QStringList() << "desktop" << "toolbar" << "panel" << "floating" << "plugins"); list << PageInfo("interface-menu", QObject::tr("Context Menu and Plugins"), QObject::tr("Menu Plugins"), "preferences-plugin",QObject::tr("Change what options are shown on the desktop context menu"), "interface", QStringList(), QStringList() << "desktop" << "menu" << "plugins" << "shortcuts"); + list << PageInfo("session-locale", QObject::tr("Localization Options"), 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 << 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"); return list; } @@ -49,6 +51,8 @@ static QList<PAGEINFO> KnownPages(){ #include "page_interface_desktop.h" #include "page_interface_panels.h" #include "page_interface_menu.h" +#include "page_session_locale.h" +#include "page_session_options.h" static PageWidget* GetNewPage(QString id, QWidget *parent){ //Find the page that matches this "id" @@ -61,6 +65,8 @@ static PageWidget* GetNewPage(QString id, QWidget *parent){ else if(id=="interface-desktop"){ return new page_interface_desktop(parent); } else if(id=="interface-panel"){ return new page_interface_panels(parent); } else if(id=="interface-menu"){ return new page_interface_menu(parent); } + else if(id=="session-locale"){ return new page_session_locale(parent); } + else if(id=="session-options"){ return new page_session_options(parent); } //Return the main control_panel page as the fallback/default return new page_main(parent); } 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 f8168e0b..ec03f8a5 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_main.cpp @@ -35,9 +35,9 @@ void page_main::UpdateItems(QString search){ QTreeWidgetItem *session = new QTreeWidgetItem(); session->setIcon(0, LXDG::findIcon("preferences-system-session-services","")); session->setText(0, tr("Desktop Session Options")); - QTreeWidgetItem *apps = new QTreeWidgetItem(); - apps->setIcon(0, LXDG::findIcon("preferences-desktop-filetype-association","")); - apps->setText(0, tr("Application Settings")); + QTreeWidgetItem *user = new QTreeWidgetItem(); + user->setIcon(0, LXDG::findIcon("preferences-desktop-user","")); + user->setText(0, tr("User Settings")); //Now go through and add in the known pages for each category QStringList SL = search.split(" "); //search list for(int i=0; i<INFO.length(); i++){ @@ -51,7 +51,7 @@ void page_main::UpdateItems(QString search){ } if(!ok){ continue; } //no duplicates between search terms and available info } - qDebug() << "Item Found:" << INFO[i].id << INFO[i].title; + //qDebug() << "Item Found:" << INFO[i].id << INFO[i].title; QTreeWidgetItem *it = new QTreeWidgetItem(); it->setIcon(0, LXDG::findIcon(INFO[i].icon,"") ); it->setText(0, INFO[i].name); @@ -61,14 +61,14 @@ void page_main::UpdateItems(QString search){ if(INFO[i].category=="interface"){ interface->addChild(it); } else if(INFO[i].category=="appearance"){ appearance->addChild(it); } else if(INFO[i].category=="session"){ session->addChild(it); } - else if(INFO[i].category=="apps"){ apps->addChild(it); } + else if(INFO[i].category=="user"){ user->addChild(it); } else{ ui->treeWidget->addTopLevelItem(it); } } //Now add the categories to the tree widget if they are non-empty if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); interface->setExpanded(true); } if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); appearance->setExpanded(true); } if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); session->setExpanded(true); } - if(apps->childCount()>0){ ui->treeWidget->addTopLevelItem(apps); apps->setExpanded(true); } + if(user->childCount()>0){ ui->treeWidget->addTopLevelItem(user); user->setExpanded(true); } } //================ diff --git a/src-qt5/core-utils/lumina-config/pages/page_session_locale.cpp b/src-qt5/core-utils/lumina-config/pages/page_session_locale.cpp new file mode 100644 index 00000000..ad5aa7f7 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_session_locale.cpp @@ -0,0 +1,113 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_session_locale.h" +#include "ui_page_session_locale.h" +#include "getPage.h" + +//========== +// PUBLIC +//========== +page_session_locale::page_session_locale(QWidget *parent) : PageWidget(parent), ui(new Ui::page_session_locale()){ + ui->setupUi(this); + setupLocales(); + connect(ui->combo_locale_lang, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) ); + connect(ui->combo_locale_collate, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) ); + connect(ui->combo_locale_ctype, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) ); + connect(ui->combo_locale_message, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) ); + connect(ui->combo_locale_monetary, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) ); + connect(ui->combo_locale_numeric, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) ); + connect(ui->combo_locale_time, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) ); + updateIcons(); +} + +page_session_locale::~page_session_locale(){ + +} + +//================ +// PUBLIC SLOTS +//================ +void page_session_locale::SaveSettings(){ + QSettings sessionsettings("lumina-desktop","sessionsettings"); + sessionsettings.setValue("InitLocale/LANG", ui->combo_locale_lang->currentData().toString() ); + sessionsettings.setValue("InitLocale/LC_MESSAGES", ui->combo_locale_message->currentData().toString() ); + sessionsettings.setValue("InitLocale/LC_TIME", ui->combo_locale_time->currentData().toString() ); + sessionsettings.setValue("InitLocale/LC_NUMERIC", ui->combo_locale_numeric->currentData().toString() ); + sessionsettings.setValue("InitLocale/LC_MONETARY", ui->combo_locale_monetary->currentData().toString() ); + sessionsettings.setValue("InitLocale/LC_COLLATE", ui->combo_locale_collate->currentData().toString() ); + sessionsettings.setValue("InitLocale/LC_CTYPE", ui->combo_locale_ctype->currentData().toString() ); + emit HasPendingChanges(false); +} + +void page_session_locale::LoadSettings(int){ + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Desktop Settings") ); + QSettings sessionsettings("lumina-desktop","sessionsettings"); + + QString val = sessionsettings.value("InitLocale/LANG", "").toString(); + int index = ui->combo_locale_lang->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_lang->setCurrentIndex(index); + val = sessionsettings.value("InitLocale/LC_MESSAGES", "").toString(); + index = ui->combo_locale_message->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_message->setCurrentIndex(index); + val = sessionsettings.value("InitLocale/LC_TIME", "").toString(); + index = ui->combo_locale_time->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_time->setCurrentIndex(index); + val = sessionsettings.value("InitLocale/NUMERIC", "").toString(); + index = ui->combo_locale_numeric->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_numeric->setCurrentIndex(index); + val = sessionsettings.value("InitLocale/MONETARY", "").toString(); + index = ui->combo_locale_monetary->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_monetary->setCurrentIndex(index); + val = sessionsettings.value("InitLocale/COLLATE", "").toString(); + index = ui->combo_locale_collate->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_collate->setCurrentIndex(index); + val = sessionsettings.value("InitLocale/CTYPE", "").toString(); + index = ui->combo_locale_ctype->findData(val); + if(index<0){ index = 0; } //system default + ui->combo_locale_ctype->setCurrentIndex(index); +} + +void page_session_locale::updateIcons(){ + +} + +//================= +// PRIVATE +//================= +void page_session_locale::setupLocales(){ +//Available localizations + QStringList langs = LUtils::knownLocales(); + langs.sort(); + QString def = tr("System Default"); + ui->combo_locale_lang->addItem(def,""); + ui->combo_locale_collate->addItem(def,""); + ui->combo_locale_ctype->addItem(def,""); + ui->combo_locale_message->addItem(def,""); + ui->combo_locale_monetary->addItem(def,""); + ui->combo_locale_numeric->addItem(def,""); + ui->combo_locale_time->addItem(def,""); + for(int i=0; i<langs.length(); i++){ + QString lan = QLocale(langs[i]).nativeLanguageName(); + ui->combo_locale_lang->addItem(lan,langs[i]); + ui->combo_locale_collate->addItem(lan,langs[i]); + ui->combo_locale_ctype->addItem(lan,langs[i]); + ui->combo_locale_message->addItem(lan,langs[i]); + ui->combo_locale_monetary->addItem(lan,langs[i]); + ui->combo_locale_numeric->addItem(lan,langs[i]); + ui->combo_locale_time->addItem(lan,langs[i]); + } +} +//================= +// PRIVATE SLOTS +//================= diff --git a/src-qt5/core-utils/lumina-config/pages/page_session_locale.h b/src-qt5/core-utils/lumina-config/pages/page_session_locale.h new file mode 100644 index 00000000..57b06081 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_session_locale.h @@ -0,0 +1,35 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_SESSION_LOCALE_H +#define _LUMINA_CONFIG_PAGE_SESSION_LOCALE_H +#include "../globals.h" +#include "PageWidget.h" + +namespace Ui{ + class page_session_locale; +}; + +class page_session_locale : public PageWidget{ + Q_OBJECT +public: + page_session_locale(QWidget *parent); + ~page_session_locale(); + +public slots: + void SaveSettings(); + void LoadSettings(int screennum); + void updateIcons(); + +private: + Ui::page_session_locale *ui; + + void setupLocales(); + +private slots: + +}; +#endif diff --git a/src-qt5/core-utils/lumina-config/pages/page_session_locale.ui b/src-qt5/core-utils/lumina-config/pages/page_session_locale.ui index 90cd4ca1..d514e5f2 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_session_locale.ui +++ b/src-qt5/core-utils/lumina-config/pages/page_session_locale.ui @@ -15,16 +15,16 @@ </property> <layout class="QFormLayout" name="formLayout"> <property name="leftMargin"> - <number>0</number> + <number>6</number> </property> <property name="topMargin"> - <number>0</number> + <number>6</number> </property> <property name="rightMargin"> - <number>0</number> + <number>6</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>6</number> </property> <item row="0" column="0" colspan="2"> <widget class="QLabel" name="label_30"> 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 new file mode 100644 index 00000000..4f678ab3 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_session_options.cpp @@ -0,0 +1,172 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "page_session_options.h" +#include "ui_page_session_options.h" +#include "getPage.h" + +//========== +// PUBLIC +//========== +page_session_options::page_session_options(QWidget *parent) : PageWidget(parent), ui(new Ui::page_session_options()){ + ui->setupUi(this); + + //Display formats for panel clock + ui->combo_session_datetimeorder->clear(); + ui->combo_session_datetimeorder->addItem( tr("Time (Date as tooltip)"), "timeonly"); + ui->combo_session_datetimeorder->addItem( tr("Date (Time as tooltip)"), "dateonly"); + ui->combo_session_datetimeorder->addItem( tr("Time first then Date"), "timedate"); + ui->combo_session_datetimeorder->addItem( tr("Date first then Time"), "datetime"); + + 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()) ); + connect(ui->tool_help_time, SIGNAL(clicked()), this, SLOT(sessionShowTimeCodes()) ); + connect(ui->tool_help_date, SIGNAL(clicked()), this, SLOT(sessionShowDateCodes()) ); + connect(ui->line_session_time, SIGNAL(textChanged(QString)), this, SLOT(sessionLoadTimeSample()) ); + connect(ui->line_session_date, SIGNAL(textChanged(QString)), this, SLOT(sessionLoadDateSample()) ); + connect(ui->combo_session_datetimeorder, SIGNAL(currentIndexChanged(int)), this, SLOT(settingChanged()) ); + updateIcons(); + +} + +page_session_options::~page_session_options(){ + +} + +//================ +// PUBLIC SLOTS +//================ +void page_session_options::SaveSettings(){ + QSettings sessionsettings("lumina-desktop","sessionsettings"); + sessionsettings.setValue("EnableNumlock", ui->check_session_numlock->isChecked()); + sessionsettings.setValue("PlayStartupAudio", ui->check_session_playloginaudio->isChecked()); + sessionsettings.setValue("PlayLogoutAudio", ui->check_session_playlogoutaudio->isChecked()); + sessionsettings.setValue("TimeFormat", ui->line_session_time->text()); + sessionsettings.setValue("DateFormat", ui->line_session_date->text()); + sessionsettings.setValue("DateTimeOrder", ui->combo_session_datetimeorder->currentData().toString()); + emit HasPendingChanges(false); +} + +void page_session_options::LoadSettings(int){ + emit HasPendingChanges(false); + emit ChangePageTitle( tr("Desktop Settings") ); + QSettings sessionsettings("lumina-desktop","sessionsettings"); + ui->check_session_numlock->setChecked( sessionsettings.value("EnableNumlock", true).toBool() ); + ui->check_session_playloginaudio->setChecked( sessionsettings.value("PlayStartupAudio",true).toBool() ); + ui->check_session_playlogoutaudio->setChecked( sessionsettings.value("PlayLogoutAudio",true).toBool() ); + ui->push_session_setUserIcon->setIcon( LXDG::findIcon(QDir::homePath()+"/.loginIcon.png", "user-identity") ); + ui->line_session_time->setText( sessionsettings.value("TimeFormat","").toString() ); + ui->line_session_date->setText( sessionsettings.value("DateFormat","").toString() ); + int index = ui->combo_session_datetimeorder->findData( sessionsettings.value("DateTimeOrder","timeonly").toString() ); + ui->combo_session_datetimeorder->setCurrentIndex(index); + + sessionLoadTimeSample(); + sessionLoadDateSample(); +} + +void page_session_options::updateIcons(){ + ui->push_session_resetSysDefaults->setIcon( LXDG::findIcon("start-here-lumina","view-refresh") ); + ui->push_session_resetLuminaDefaults->setIcon( LXDG::findIcon("Lumina-DE","") ); + ui->tool_help_time->setIcon( LXDG::findIcon("help-about","") ); + ui->tool_help_date->setIcon( LXDG::findIcon("help-about","") ); +} + +//================= +// PRIVATE +//================= + +//================= +// PRIVATE SLOTS +//================= +void page_session_options::sessionChangeUserIcon(){ + //Prompt for a new image file + QStringList imgformats; + QList<QByteArray> fmts = QImageReader::supportedImageFormats(); + for(int i=0; i<fmts.length(); i++){ + imgformats << "*."+QString(fmts[i]); + } + QString filepath = QFileDialog::getOpenFileName(this, tr("Select an image"), QDir::homePath(), \ + tr("Images")+" ("+imgformats.join(" ")+")"); + if(filepath.isEmpty()){ + //User cancelled the operation + if(QFile::exists(QDir::homePath()+"/.loginIcon.png")){ + if(QMessageBox::Yes == QMessageBox::question(this,tr("Reset User Image"), tr("Would you like to reset the user image to the system default?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){ + //QFile::remove(QDir::homePath()+"/.loginIcon.png"); + ui->push_session_setUserIcon->setWhatsThis("reset"); + }else{ + return; + } + } + }else{ + ui->push_session_setUserIcon->setWhatsThis(filepath); + } + //Now re-load the icon in the UI + QString path = ui->push_session_setUserIcon->whatsThis(); + if(path.isEmpty()){ path = QDir::homePath()+"/.loginIcon.png"; } + if(path=="reset"){ path.clear(); } + ui->push_session_setUserIcon->setIcon( LXDG::findIcon(path, "user-identity") ); + settingChanged(); +} + +void page_session_options::sessionResetSys(){ + LUtils::LoadSystemDefaults(); + QTimer::singleShot(500,this, SLOT(LoadSettings()) ); +} + +void page_session_options::sessionResetLumina(){ + LUtils::LoadSystemDefaults(true); //skip OS customizations + QTimer::singleShot(500,this, SLOT(LoadSettings()) ); +} + +void page_session_options::sessionLoadTimeSample(){ + if(ui->line_session_time->text().simplified().isEmpty()){ + ui->label_session_timesample->setText( QTime::currentTime().toString(Qt::DefaultLocaleShortDate) ); + }else{ + ui->label_session_timesample->setText( QTime::currentTime().toString( ui->line_session_time->text() ) ); + } + settingChanged(); +} + +void page_session_options::sessionShowTimeCodes(){ + QStringList msg; + msg << tr("Valid Time Codes:") << "\n"; + msg << QString(tr("%1: Hour without leading zero (1)")).arg("h"); + msg << QString(tr("%1: Hour with leading zero (01)")).arg("hh"); + msg << QString(tr("%1: Minutes without leading zero (2)")).arg("m"); + msg << QString(tr("%1: Minutes with leading zero (02)")).arg("mm"); + msg << QString(tr("%1: Seconds without leading zero (3)")).arg("s"); + msg << QString(tr("%1: Seconds with leading zero (03)")).arg("ss"); + msg << QString(tr("%1: AM/PM (12-hour) clock (upper or lower case)")).arg("A or a"); + msg << QString(tr("%1: Timezone")).arg("t"); + QMessageBox::information(this, tr("Time Codes"), msg.join("\n") ); +} + +void page_session_options::sessionLoadDateSample(){ + if(ui->line_session_date->text().simplified().isEmpty()){ + ui->label_session_datesample->setText( QDate::currentDate().toString(Qt::DefaultLocaleShortDate) ); + }else{ + ui->label_session_datesample->setText( QDate::currentDate().toString( ui->line_session_date->text() ) ); + } + settingChanged(); +} + +void page_session_options::sessionShowDateCodes(){ + QStringList msg; + msg << tr("Valid Date Codes:") << "\n"; + msg << QString(tr("%1: Numeric day without a leading zero (1)")).arg("d"); + msg << QString(tr("%1: Numeric day with leading zero (01)")).arg("dd"); + msg << QString(tr("%1: Day as abbreviation (localized)")).arg("ddd"); + msg << QString(tr("%1: Day as full name (localized)")).arg("dddd"); + msg << QString(tr("%1: Numeric month without leading zero (2)")).arg("M"); + msg << QString(tr("%1: Numeric month with leading zero (02)")).arg("MM"); + msg << QString(tr("%1: Month as abbreviation (localized)")).arg("MMM"); + msg << QString(tr("%1: Month as full name (localized)")).arg("MMMM"); + msg << QString(tr("%1: Year as 2-digit number (15)")).arg("yy"); + msg << QString(tr("%1: Year as 4-digit number (2015)")).arg("yyyy"); + msg << tr("Text may be contained within single-quotes to ignore replacements"); + QMessageBox::information(this, tr("Date Codes"), msg.join("\n") ); +} 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 new file mode 100644 index 00000000..bd293972 --- /dev/null +++ b/src-qt5/core-utils/lumina-config/pages/page_session_options.h @@ -0,0 +1,39 @@ +//=========================================== +// Lumina Desktop Source Code +// Copyright (c) 2016, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#ifndef _LUMINA_CONFIG_PAGE_SESSION_OPTIONS_H +#define _LUMINA_CONFIG_PAGE_SESSION_OPTIONS_H +#include "../globals.h" +#include "PageWidget.h" + +namespace Ui{ + class page_session_options; +}; + +class page_session_options : public PageWidget{ + Q_OBJECT +public: + page_session_options(QWidget *parent); + ~page_session_options(); + +public slots: + void SaveSettings(); + void LoadSettings(int screennum = -1); + void updateIcons(); + +private: + Ui::page_session_options *ui; + +private slots: + void sessionChangeUserIcon(); + void sessionResetSys(); + void sessionResetLumina(); + void sessionLoadTimeSample(); + void sessionShowTimeCodes(); + void sessionLoadDateSample(); + void sessionShowDateCodes(); +}; +#endif 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 03453d6d..b0e5fb91 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 @@ -15,16 +15,16 @@ </property> <layout class="QGridLayout" name="gridLayout"> <property name="leftMargin"> - <number>0</number> + <number>6</number> </property> <property name="topMargin"> - <number>0</number> + <number>6</number> </property> <property name="rightMargin"> - <number>0</number> + <number>6</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>6</number> </property> <item row="0" column="0"> <layout class="QVBoxLayout" name="verticalLayout_4"> diff --git a/src-qt5/core-utils/lumina-config/pages/pages.pri b/src-qt5/core-utils/lumina-config/pages/pages.pri index ab97e07d..5e4ffca9 100644 --- a/src-qt5/core-utils/lumina-config/pages/pages.pri +++ b/src-qt5/core-utils/lumina-config/pages/pages.pri @@ -10,9 +10,9 @@ HEADERS += $${PWD}/getPage.h \ $${PWD}/page_fluxbox_settings.h \ $${PWD}/page_interface_desktop.h \ $${PWD}/page_interface_menu.h \ - $${PWD}/page_interface_panels.h -# $${PWD}/page_session_locale.h \ -# $${PWD}/page_session_options.h \ + $${PWD}/page_interface_panels.h \ + $${PWD}/page_session_locale.h \ + $${PWD}/page_session_options.h SOURCES += $${PWD}/page_main.cpp \ @@ -24,9 +24,9 @@ SOURCES += $${PWD}/page_main.cpp \ $${PWD}/page_fluxbox_settings.cpp \ $${PWD}/page_interface_desktop.cpp \ $${PWD}/page_interface_menu.cpp \ - $${PWD}/page_interface_panels.cpp -# $${PWD}/page_session_locale.cpp \ -# $${PWD}/page_session_options.cpp \ + $${PWD}/page_interface_panels.cpp \ + $${PWD}/page_session_locale.cpp \ + $${PWD}/page_session_options.cpp FORMS += $${PWD}/page_main.ui \ -- cgit From 79f1863b83d0b3df619eb3e96c01c06dd12cb72f Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Tue, 28 Jun 2016 09:42:19 -0400 Subject: Finish up the switch over to the new UI for lumina-config --- src-qt5/core-utils/lumina-config/PanelWidget.cpp | 44 +- src-qt5/core-utils/lumina-config/PanelWidget.h | 9 +- src-qt5/core-utils/lumina-config/lumina-config.pro | 7 +- src-qt5/core-utils/lumina-config/main.cpp | 2 +- src-qt5/core-utils/lumina-config/mainUI.cpp | 1932 -------------------- src-qt5/core-utils/lumina-config/mainUI.h | 171 -- src-qt5/core-utils/lumina-config/mainUI.ui | 1792 ------------------ src-qt5/core-utils/lumina-config/mainWindow.cpp | 4 + .../core-utils/lumina-config/pages/page_main.cpp | 10 +- 9 files changed, 52 insertions(+), 3919 deletions(-) delete mode 100644 src-qt5/core-utils/lumina-config/mainUI.cpp delete mode 100644 src-qt5/core-utils/lumina-config/mainUI.h delete mode 100644 src-qt5/core-utils/lumina-config/mainUI.ui diff --git a/src-qt5/core-utils/lumina-config/PanelWidget.cpp b/src-qt5/core-utils/lumina-config/PanelWidget.cpp index 49b3d797..10e12cbb 100644 --- a/src-qt5/core-utils/lumina-config/PanelWidget.cpp +++ b/src-qt5/core-utils/lumina-config/PanelWidget.cpp @@ -7,13 +7,8 @@ #include "PanelWidget.h" #include "ui_PanelWidget.h" -#include "LPlugins.h" #include "GetPluginDialog.h" -#include "mainUI.h" -#include <LuminaXDG.h> - -#include <QSettings> -#include <QStringList> +#include "AppDialog.h" PanelWidget::PanelWidget(QWidget *parent, QWidget *Main, LPlugins *Pinfo) : QWidget(parent), ui(new Ui::PanelWidget){ @@ -126,6 +121,39 @@ void PanelWidget::reloadColorSample(){ ui->label_color_sample->setStyleSheet("background: "+ui->label_color_sample->whatsThis()); } +XDGDesktop PanelWidget::getSysApp(bool allowreset){ + AppDialog dlg(this, LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ) ); + dlg.allowReset(allowreset); + dlg.exec(); + XDGDesktop desk; + if(dlg.appreset && allowreset){ + desk.filePath = "reset"; //special internal flag + }else{ + desk = dlg.appselected; + } + return desk; +} + +QString PanelWidget::getColorStyle(QString current, bool allowTransparency){ + QString out; + //Convert the current color string into a QColor + QStringList col = current.section(")",0,0).section("(",1,1).split(","); + if(col.length()!=4){ col.clear(); col << "255" << "255" << "255" << "255"; } + QColor ccol = QColor(col[0].toInt(), col[1].toInt(), col[2].toInt(), col[3].toInt()); //RGBA + QColor ncol; + if(allowTransparency){ ncol= QColorDialog::getColor(ccol, this, tr("Select Color"), QColorDialog::ShowAlphaChannel); } + else{ ncol= QColorDialog::getColor(ccol, this, tr("Select Color")); } + //Now convert the new color into a usable string and return + if(ncol.isValid()){ //if the dialog was not cancelled + if(allowTransparency){ + out = "rgba("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+","+QString::number(ncol.alpha())+")"; + }else{ + out = "rgb("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+")"; + } + } + return out; +} + void PanelWidget::on_tool_rm_clicked(){ emit PanelRemoved(pnum); } @@ -140,7 +168,7 @@ void PanelWidget::UseColorChanged(){ } void PanelWidget::on_tool_selectcolor_clicked(){ - QString color = static_cast<MainUI*>(mainui)->getColorStyle(ui->label_color_sample->whatsThis()); + QString color = getColorStyle(ui->label_color_sample->whatsThis()); if( color.isEmpty()){ return; } ui->label_color_sample->setWhatsThis(color); reloadColorSample(); @@ -155,7 +183,7 @@ void PanelWidget::on_tool_addplugin_clicked(){ QString pan = dlg.plugID; //getNewPanelPlugin(); if(pan == "applauncher"){ //Prompt for the application to add - XDGDesktop app = static_cast<MainUI*>(mainui)->getSysApp(); + XDGDesktop app =getSysApp(); if(app.filePath.isEmpty()){ return; } //cancelled pan.append("::"+app.filePath); QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(app.icon,""), app.name); diff --git a/src-qt5/core-utils/lumina-config/PanelWidget.h b/src-qt5/core-utils/lumina-config/PanelWidget.h index e407391e..3f3cb360 100644 --- a/src-qt5/core-utils/lumina-config/PanelWidget.h +++ b/src-qt5/core-utils/lumina-config/PanelWidget.h @@ -7,11 +7,8 @@ #ifndef _LUMINA_CONFIG_PANEL_WIDGET_H #define _LUMINA_CONFIG_PANEL_WIDGET_H -#include <QWidget> -#include <QObject> -#include <QSettings> +#include "globals.h" -//#include "mainUI.h" #include "LPlugins.h" //namespace for using the *.ui file @@ -42,7 +39,8 @@ private: int dnum, pnum; void reloadColorSample(); - + XDGDesktop getSysApp(bool allowreset = false); + QString getColorStyle(QString current, bool allowTransparency = true); private slots: void on_tool_rm_clicked(); void ItemChanged(); @@ -60,4 +58,3 @@ signals: }; #endif - diff --git a/src-qt5/core-utils/lumina-config/lumina-config.pro b/src-qt5/core-utils/lumina-config/lumina-config.pro index f7359df9..2e950fe1 100644 --- a/src-qt5/core-utils/lumina-config/lumina-config.pro +++ b/src-qt5/core-utils/lumina-config/lumina-config.pro @@ -11,7 +11,6 @@ target.path = $${L_BINDIR} TEMPLATE = app SOURCES += main.cpp \ - mainUI.cpp \ mainWindow.cpp \ LPlugins.cpp \ ColorDialog.cpp \ @@ -19,8 +18,7 @@ SOURCES += main.cpp \ GetPluginDialog.cpp \ PanelWidget.cpp -HEADERS += mainUI.h \ - mainWindow.h \ +HEADERS += mainWindow.h \ LPlugins.h \ AppDialog.h \ ColorDialog.h \ @@ -28,8 +26,7 @@ HEADERS += mainUI.h \ GetPluginDialog.h \ PanelWidget.h -FORMS += mainUI.ui \ - mainWindow.ui \ +FORMS += mainWindow.ui \ AppDialog.ui \ ColorDialog.ui \ ThemeDialog.ui \ diff --git a/src-qt5/core-utils/lumina-config/main.cpp b/src-qt5/core-utils/lumina-config/main.cpp index 8056a083..856570c0 100644 --- a/src-qt5/core-utils/lumina-config/main.cpp +++ b/src-qt5/core-utils/lumina-config/main.cpp @@ -4,7 +4,7 @@ #include <QDebug> #include <QFile> -#include "mainUI.h" + #include "mainWindow.h" #include <LuminaOS.h> #include <LuminaUtils.h> diff --git a/src-qt5/core-utils/lumina-config/mainUI.cpp b/src-qt5/core-utils/lumina-config/mainUI.cpp deleted file mode 100644 index 36e45a9e..00000000 --- a/src-qt5/core-utils/lumina-config/mainUI.cpp +++ /dev/null @@ -1,1932 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#include "mainUI.h" -#include "ui_mainUI.h" //the designer *.ui file - -#include <LuminaOS.h> -#include <QImageReader> -#include <QTime> -#include <QDate> -//#include <QTimeZone> -#include <QScrollBar> - -#include <unistd.h> - -MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){ - ui->setupUi(this); //load the designer file - this->setWindowIcon( LXDG::findIcon("preferences-desktop-display","") ); - PINFO = new LPlugins(); //load the info class - panadjust = false; - DEFAULTBG = LOS::LuminaShare()+"desktop-background.jpg"; - //Be careful about the QSettings setup, it must match the lumina-desktop setup - settings = new QSettings( QSettings::UserScope, "lumina-desktop", "desktopsettings", this); - appsettings = new QSettings( QSettings::UserScope, "lumina-desktop", "lumina-open", this); - sessionsettings = new QSettings( QSettings::UserScope, "lumina-desktop","sessionsettings", this); - qDebug() << "Settings File:" << settings->fileName(); - desktop = new QDesktopWidget(); - ui->spin_screen->setMinimum(1); - //Make sure this is only allows the current number of screens - ui->spin_screen->setMaximum(desktop->screenCount()); - ui->spin_screen->setValue(desktop->screenNumber(this->mapToGlobal(this->geometry().center()))+1); //have the current screen auto-selected - //qDebug() << "Number of Screens:" << desktop->screenCount(); - sysApps = LXDG::sortDesktopNames( LXDG::systemDesktopFiles() ); - //Add a couple spacers to center the toolbar items - QWidget *tmp = new QWidget(this); - tmp->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - ui->toolBar->insertWidget(ui->actionDesktop, tmp); - tmp = new QWidget(this); - tmp->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - ui->toolBar->addWidget(tmp); - //Now finish setting up the UI - setupIcons(); - setupMenus(); - setupConnections(); - - //Start on the Desktop page (and first tab for all tab widgets) - ui->stackedWidget->setCurrentWidget(ui->page_desktop); - ui->tabWidget_desktop->setCurrentWidget(ui->tab_wallpaper); - ui->tabWidget_session->setCurrentIndex(0); - ui->tabWidget_apps->setCurrentIndex(0); - ui->tabWidget_panels->setCurrentIndex(0); - - slotChangePage(false); - - QTimer::singleShot(10, this, SLOT(loadCurrentSettings()) ); - - //Disable the incomplete pages/items at the moment - -} - -MainUI::~MainUI(){ - -} - -void MainUI::slotSingleInstance(){ - //Make sure this window is visible - this->showNormal(); - this->activateWindow(); - this->raise(); -} - -//================ -// PRIVATE FUNCTIONS -//================ -void MainUI::setupIcons(){ - //Pull all the icons from the current theme using libLumina (LXDG) - - //General UI - ui->actionDesktop->setIcon( LXDG::findIcon("preferences-desktop-display","") ); - ui->actionPanels->setIcon( LXDG::findIcon("preferences-desktop-icons","") ); - //ui->actionMenu->setIcon( LXDG::findIcon("preferences-desktop-icons","") ); - ui->actionShortcuts->setIcon( LXDG::findIcon("configure-shortcuts","") ); - ui->actionDefaults->setIcon( LXDG::findIcon("preferences-system-windows","") ); - ui->actionSession->setIcon( LXDG::findIcon("preferences-system-session-services","") ); - ui->push_save->setIcon( LXDG::findIcon("document-save","") ); - - - //Desktop Page - ui->tool_desk_addbg->setIcon( LXDG::findIcon("list-add","") ); - ui->tool_desk_rmbg->setIcon( LXDG::findIcon("list-remove","") ); - ui->tabWidget_desktop->setTabIcon( ui->tabWidget_desktop->indexOf(ui->tab_wallpaper), LXDG::findIcon("preferences-desktop-wallpaper","") ); - ui->tabWidget_desktop->setTabIcon( ui->tabWidget_desktop->indexOf(ui->tab_themes), LXDG::findIcon("preferences-desktop-theme","") ); - ui->tool_desktop_addplugin->setIcon( LXDG::findIcon("list-add","") ); - ui->tool_desktop_rmplugin->setIcon( LXDG::findIcon("list-remove","") ); - - //Panels Page - ui->tool_panels_add->setIcon( LXDG::findIcon("list-add","") ); - - //Menu Page - ui->tool_menu_add->setIcon( LXDG::findIcon("list-add","") ); - ui->tool_menu_rm->setIcon( LXDG::findIcon("list-remove","") ); - ui->tool_menu_up->setIcon( LXDG::findIcon("go-up","") ); - ui->tool_menu_dn->setIcon( LXDG::findIcon("go-down","") ); - - //Shortcuts Page - ui->tool_shortcut_set->setIcon( LXDG::findIcon("input-keyboard","") ); - ui->tool_shortcut_clear->setIcon( LXDG::findIcon("edit-clear","") ); - - //Defaults Page - //ui->tool_defaults_addextension->setIcon( LXDG::findIcon("list-add","") ); - //ui->tool_defaults_addgroup->setIcon( LXDG::findIcon("list-add","") ); - ui->tool_defaults_clear->setIcon( LXDG::findIcon("edit-clear","") ); - ui->tool_defaults_set->setIcon( LXDG::findIcon("system-run","") ); - ui->tool_defaults_setbin->setIcon( LXDG::findIcon("application-x-executable","") ); - ui->tabWidget_apps->setTabIcon( ui->tabWidget_apps->indexOf(ui->tab_auto), LXDG::findIcon("system-run", "") ); - ui->tabWidget_apps->setTabIcon( ui->tabWidget_apps->indexOf(ui->tab_defaults), LXDG::findIcon("preferences-desktop-filetype-association", "") ); - - //Session Page - //ui->tool_session_rmapp->setIcon( LXDG::findIcon("list-remove","") ); - ui->tool_session_addapp->setIcon( LXDG::findIcon("system-run","") ); - ui->tool_session_addbin->setIcon( LXDG::findIcon("system-search","") ); - 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","") ); - ui->tool_help_time->setIcon( LXDG::findIcon("help-about","") ); - ui->tool_help_date->setIcon( LXDG::findIcon("help-about","") ); -} - -void MainUI::setupConnections(){ - //General UI - connect(ui->actionDesktop, SIGNAL(triggered(bool)), this, SLOT( slotChangePage(bool)) ); - connect(ui->actionPanels, SIGNAL(triggered(bool)), this, SLOT( slotChangePage(bool)) ); - //connect(ui->actionMenu, SIGNAL(triggered(bool)), this, SLOT( slotChangePage(bool)) ); - connect(ui->actionShortcuts, SIGNAL(triggered(bool)), this, SLOT( slotChangePage(bool)) ); - connect(ui->actionDefaults, SIGNAL(triggered(bool)), this, SLOT( slotChangePage(bool)) ); - connect(ui->actionSession, SIGNAL(triggered(bool)), this, SLOT( slotChangePage(bool)) ); - connect(ui->push_save, SIGNAL(clicked()), this, SLOT(saveCurrentSettings()) ); - connect(ui->spin_screen, SIGNAL(valueChanged(int)), this, SLOT(slotChangeScreen()) ); - - //Desktop Page - //connect(ui->combo_desk_plugs, SIGNAL(currentIndexChanged(int)), this, SLOT(deskplugchanged()) ); - connect(ui->combo_desk_bg, SIGNAL(currentIndexChanged(int)), this, SLOT(deskbgchanged()) ); - connect(ui->radio_desk_multi, SIGNAL(toggled(bool)), this, SLOT(desktimechanged()) ); - connect(ui->tool_desktop_addplugin, SIGNAL(clicked()), this, SLOT(deskplugadded()) ); - connect(ui->tool_desktop_rmplugin, SIGNAL(clicked()), this, SLOT(deskplugremoved()) ); - connect(ui->tool_desk_addbg, SIGNAL(clicked()), this, SLOT(deskbgadded()) ); - connect(ui->tool_desk_rmbg, SIGNAL(clicked()), this, SLOT(deskbgremoved()) ); - connect(ui->spin_desk_min, SIGNAL(valueChanged(int)), this, SLOT(desktimechanged()) ); - connect(ui->check_desktop_autolaunchers, SIGNAL(clicked()), this, SLOT(desktimechanged()) ); //just need to poke the save routines - connect(ui->combo_desk_layout, SIGNAL(currentIndexChanged(int)), this, SLOT(desktimechanged()) ); //just need to poke the save routines - - //Panels Page - connect(ui->tool_panels_add, SIGNAL(clicked()), this, SLOT(newPanel()) ); - - //Menu Page - connect(ui->tool_menu_add, SIGNAL(clicked()), this, SLOT(addmenuplugin()) ); - connect(ui->tool_menu_rm, SIGNAL(clicked()), this, SLOT(rmmenuplugin()) ); - connect(ui->tool_menu_up, SIGNAL(clicked()), this, SLOT(upmenuplugin()) ); - connect(ui->tool_menu_dn, SIGNAL(clicked()), this, SLOT(downmenuplugin()) ); - connect(ui->list_menu, SIGNAL(currentRowChanged(int)), this, SLOT(checkmenuicons()) ); - - //Shortcuts Page - connect(ui->tool_shortcut_clear, SIGNAL(clicked()), this, SLOT(clearKeyBinding()) ); - connect(ui->tool_shortcut_set, SIGNAL(clicked()), this, SLOT(applyKeyBinding()) ); - connect(ui->tree_shortcut, SIGNAL(itemSelectionChanged()), this, SLOT(updateKeyConfig()) ); - - //Defaults Page - connect(ui->tool_default_filemanager, SIGNAL(clicked()), this, SLOT(changeDefaultFileManager()) ); - connect(ui->tool_default_terminal, SIGNAL(clicked()), this, SLOT(changeDefaultTerminal()) ); - connect(ui->tool_default_webbrowser, SIGNAL(clicked()), this, SLOT(changeDefaultBrowser()) ); - connect(ui->tool_default_email, SIGNAL(clicked()), this, SLOT(changeDefaultEmail()) ); - connect(ui->tool_defaults_clear, SIGNAL(clicked()), this, SLOT(cleardefaultitem()) ); - connect(ui->tool_defaults_set, SIGNAL(clicked()), this, SLOT(setdefaultitem()) ); - connect(ui->tool_defaults_setbin, SIGNAL(clicked()), this, SLOT(setdefaultbinary()) ); - connect(ui->tree_defaults, SIGNAL(itemSelectionChanged()), this, SLOT(checkdefaulticons()) ); - - //Session Page - connect(ui->tool_session_addapp, SIGNAL(clicked()), this, SLOT(addsessionstartapp()) ); - connect(ui->tool_session_addbin, SIGNAL(clicked()), this, SLOT(addsessionstartbin()) ); - connect(ui->tool_session_addfile, SIGNAL(clicked()), this, SLOT(addsessionstartfile()) ); - connect(ui->combo_session_wfocus, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_session_wloc, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_session_wtheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionthemechanged()) ); - connect(ui->combo_session_cursortheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionCursorChanged()) ); - connect(ui->check_session_numlock, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->check_session_playloginaudio, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->check_session_playlogoutaudio, SIGNAL(stateChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->spin_session_wkspaces, SIGNAL(valueChanged(int)), this, SLOT(sessionoptchanged()) ); - //connect(ui->list_session_start, SIGNAL(currentRowChanged(int)), this, SLOT(sessionstartchanged()) ); - connect(ui->list_session_start, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(sessionoptchanged()) ); - connect(ui->spin_session_fontsize, SIGNAL(valueChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_session_themefile, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_session_colorfile, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_session_icontheme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->font_session_theme, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - 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()) ); - connect(ui->tool_help_time, SIGNAL(clicked()), this, SLOT(sessionShowTimeCodes()) ); - connect(ui->tool_help_date, SIGNAL(clicked()), this, SLOT(sessionShowDateCodes()) ); - connect(ui->line_session_time, SIGNAL(textChanged(QString)), this, SLOT(sessionLoadTimeSample()) ); - connect(ui->line_session_date, SIGNAL(textChanged(QString)), this, SLOT(sessionLoadDateSample()) ); - connect(ui->combo_session_datetimeorder, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_lang, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_collate, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_ctype, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_message, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_monetary, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_numeric, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); - connect(ui->combo_locale_time, SIGNAL(currentIndexChanged(int)), this, SLOT(sessionoptchanged()) ); -} - -void MainUI::setupMenus(){ - //Background file menu (different ways of loading files) - if(ui->tool_desk_addbg->menu()==0){ ui->tool_desk_addbg->setMenu(new QMenu(this)); } - ui->tool_desk_addbg->menu()->clear(); - ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("document-new",""), tr("File(s)"), this, SLOT(deskbgadded()) ); - ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("folder-new",""), tr("Directory (Single)"), this, SLOT(deskbgdiradded()) ); - ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("document-open-folder",""), tr("Directory (Recursive)"), this, SLOT(deskbgdirradded()) ); - ui->tool_desk_addbg->menu()->addAction(LXDG::findIcon("format-fill-color",""), tr("Solid Color"), this, SLOT(deskbgcoloradded()) ); - - //Session window manager settings - ui->combo_session_wfocus->clear(); - ui->combo_session_wfocus->addItem( tr("Click To Focus"), "ClickToFocus"); - ui->combo_session_wfocus->addItem( tr("Active Mouse Focus"), "MouseFocus"); - ui->combo_session_wfocus->addItem( tr("Strict Mouse Focus"), "StrictMouseFocus"); - ui->combo_session_wloc->clear(); - ui->combo_session_wloc->addItem( tr("Align in a Row"), "RowSmartPlacement"); - ui->combo_session_wloc->addItem( tr("Align in a Column"), "ColSmartPlacement"); - ui->combo_session_wloc->addItem( tr("Cascade"), "CascadePlacement"); - ui->combo_session_wloc->addItem( tr("Underneath Mouse"), "UnderMousePlacement"); - ui->combo_session_wtheme->clear(); - QStringList dirs; dirs << LOS::AppPrefix()+"share/fluxbox/styles" << QDir::homePath()+"/.fluxbox/styles"; - QFileInfoList fbstyles; - for(int i=0; i<dirs.length(); i++){ - QDir fbdir(dirs[i]); - fbstyles << fbdir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase); - } - QString lastdir; - for(int i=0; i<fbstyles.length(); i++){ - if(lastdir!=fbstyles[i].absolutePath()){ - lastdir = fbstyles[i].absolutePath(); //save for checking later - if(ui->combo_session_wtheme->count()>0){ ui->combo_session_wtheme->insertSeparator(ui->combo_session_wtheme->count()); } - } - ui->combo_session_wtheme->addItem(fbstyles[i].fileName(), fbstyles[i].absoluteFilePath()); - } - //Display formats for panel clock - ui->combo_session_datetimeorder->clear(); - ui->combo_session_datetimeorder->addItem( tr("Time (Date as tooltip)"), "timeonly"); - ui->combo_session_datetimeorder->addItem( tr("Date (Time as tooltip)"), "dateonly"); - ui->combo_session_datetimeorder->addItem( tr("Time first then Date"), "timedate"); - ui->combo_session_datetimeorder->addItem( tr("Date first then Time"), "datetime"); - - //Available Cursor Themes - ui->combo_session_cursortheme->clear(); - ui->combo_session_cursortheme->addItems( LTHEME::availableSystemCursors() ); - //int cur = ui->combo_session_cursortheme->findText( LTHEME::currentCursor() ); - //if(cur>=0){ ui->combo_session_cursortheme->setCurrentIndex(cur); } - - //Available Wallpaper layout options - ui->combo_desk_layout->clear(); - ui->combo_desk_layout->addItem(tr("Automatic"), "stretch"); - ui->combo_desk_layout->addItem(tr("Fullscreen"), "full"); - ui->combo_desk_layout->addItem(tr("Fit screen"), "fit"); - ui->combo_desk_layout->addItem(tr("Tile"), "tile"); - ui->combo_desk_layout->addItem(tr("Center"), "center"); - ui->combo_desk_layout->addItem(tr("Top Left"), "topleft"); - ui->combo_desk_layout->addItem(tr("Top Right"), "topright"); - ui->combo_desk_layout->addItem(tr("Bottom Left"), "bottomleft"); - ui->combo_desk_layout->addItem(tr("Bottom Right"), "bottomright"); - - - - //Available localizations - QStringList langs = LUtils::knownLocales(); - langs.sort(); - QString def = tr("System Default"); - ui->combo_locale_lang->addItem(def,""); - ui->combo_locale_collate->addItem(def,""); - ui->combo_locale_ctype->addItem(def,""); - ui->combo_locale_message->addItem(def,""); - ui->combo_locale_monetary->addItem(def,""); - ui->combo_locale_numeric->addItem(def,""); - ui->combo_locale_time->addItem(def,""); - for(int i=0; i<langs.length(); i++){ - QString lan = QLocale(langs[i]).nativeLanguageName(); - ui->combo_locale_lang->addItem(lan,langs[i]); - ui->combo_locale_collate->addItem(lan,langs[i]); - ui->combo_locale_ctype->addItem(lan,langs[i]); - ui->combo_locale_message->addItem(lan,langs[i]); - ui->combo_locale_monetary->addItem(lan,langs[i]); - ui->combo_locale_numeric->addItem(lan,langs[i]); - ui->combo_locale_time->addItem(lan,langs[i]); - } -} - -int MainUI::currentDesktop(){ - return ui->spin_screen->value()-1; //backend starts at 0, not 1 -} - -QString MainUI::getColorStyle(QString current, bool allowTransparency){ - QString out; - //Convert the current color string into a QColor - QStringList col = current.section(")",0,0).section("(",1,1).split(","); - if(col.length()!=4){ col.clear(); col << "255" << "255" << "255" << "255"; } - QColor ccol = QColor(col[0].toInt(), col[1].toInt(), col[2].toInt(), col[3].toInt()); //RGBA - QColor ncol; - if(allowTransparency){ ncol= QColorDialog::getColor(ccol, this, tr("Select Color"), QColorDialog::ShowAlphaChannel); } - else{ ncol= QColorDialog::getColor(ccol, this, tr("Select Color")); } - //Now convert the new color into a usable string and return - if(ncol.isValid()){ //if the dialog was not cancelled - if(allowTransparency){ - out = "rgba("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+","+QString::number(ncol.alpha())+")"; - }else{ - out = "rgb("+QString::number(ncol.red())+","+QString::number(ncol.green())+","+QString::number(ncol.blue())+")"; - } - } - return out; -} - -XDGDesktop MainUI::getSysApp(bool allowreset){ - AppDialog dlg(this, sysApps); - dlg.allowReset(allowreset); - dlg.exec(); - XDGDesktop desk; - if(dlg.appreset && allowreset){ - desk.filePath = "reset"; //special internal flag - }else{ - desk = dlg.appselected; - } - return desk; -} - -//Convert to/from fluxbox key codes -QString MainUI::dispToFluxKeys(QString in){ - in.replace("Ctrl", "Control"); - in.replace("Shift", "Shift"); - in.replace("Alt", "Mod1"); - in.replace("Meta", "Mod4"); - in.replace("PgUp", "Prior"); - in.replace("PgDown", "Next"); - in.replace("Del", "Delete"); - in.replace("Backspace", "BackSpace"); - in.replace("Ins","Insert"); - in.replace("Volume Up", "XF86AudioRaiseVolume"); //multimedia key - in.replace("Volume Down", "XF86AudioLowerVolume"); //multimedia key - in.replace("+"," "); - return in; -} - -QString MainUI::fluxToDispKeys(QString in){ - in.replace("Control", "Ctrl"); - in.replace("Shift", "Shift"); - in.replace("Mod1", "Alt"); - in.replace("Mod4", "Meta"); - in.replace("Prior", "PgUp"); - in.replace("Next", "PgDown"); - //in.replace("Delete", "Del"); //the "Delete" is better looking - in.replace("BackSpace", "Backspace"); - //in.replace("Insert", "Ins"); //the "Insert" is better looking - in.replace("XF86AudioRaiseVolume", "Volume Up"); //multimedia key - in.replace("XF86AudioLowerVolume", "Volume Down"); //multimedia key - return in; -} - -//Read/overwrite a text file -QStringList MainUI::readFile(QString path){ - QStringList out; - QFile file(path); - if(file.open(QIODevice::ReadOnly | QIODevice::Text)){ - QTextStream txt(&file); - while(!txt.atEnd()){ - out << txt.readLine(); - } - file.close(); - } - return out; -} - -bool MainUI::overwriteFile(QString path, QStringList contents){ - QFile file(path); - if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)){ - QTextStream txt(&file); - for(int i=0; i<contents.length(); i++){ - txt << contents[i]+"\n"; - } - file.close(); - return true; - } - return false; -} - -//================ -// PRIVATE SLOTS -//================ -void MainUI::slotChangePage(bool enabled){ - //Do not allow the user to de-select a button (make them act like radio buttons) - //qDebug() << "Page Change:" << enabled; - bool showScreen = false; //set this for pages that have per-screen settings - if(!enabled){ - //Re-enable the current button - ui->actionDesktop->setChecked(ui->stackedWidget->currentWidget()==ui->page_desktop); - ui->actionPanels->setChecked(ui->stackedWidget->currentWidget()==ui->page_panels); - //ui->actionMenu->setChecked(ui->stackedWidget->currentWidget()==ui->page_menu); - ui->actionShortcuts->setChecked(ui->stackedWidget->currentWidget()==ui->page_shortcuts); - ui->actionDefaults->setChecked(ui->stackedWidget->currentWidget()==ui->page_defaults); - ui->actionSession->setChecked(ui->stackedWidget->currentWidget()==ui->page_session); - showScreen = (ui->actionDesktop->isChecked() || ui->actionPanels->isChecked()); - //Ask if they want to reset any changes on the current page - - }else{ - //uncheck the button associated with the currently open page - if(ui->stackedWidget->currentWidget()==ui->page_desktop){ ui->actionDesktop->setChecked(false); } - if(ui->stackedWidget->currentWidget()==ui->page_panels){ ui->actionPanels->setChecked(false); } - //if(ui->stackedWidget->currentWidget()==ui->page_menu){ ui->actionMenu->setChecked(false); } - if(ui->stackedWidget->currentWidget()==ui->page_shortcuts){ ui->actionShortcuts->setChecked(false); } - if(ui->stackedWidget->currentWidget()==ui->page_defaults){ ui->actionDefaults->setChecked(false); } - if(ui->stackedWidget->currentWidget()==ui->page_session){ ui->actionSession->setChecked(false); } - //switch to the new page - if(ui->actionDesktop->isChecked()){ ui->stackedWidget->setCurrentWidget(ui->page_desktop); showScreen=true;} - else if(ui->actionPanels->isChecked()){ ui->stackedWidget->setCurrentWidget(ui->page_panels); showScreen=true; } - //else if(ui->actionMenu->isChecked()){ ui->stackedWidget->setCurrentWidget(ui->page_menu); } - else if(ui->actionShortcuts->isChecked()){ ui->stackedWidget->setCurrentWidget(ui->page_shortcuts); } - else if(ui->actionDefaults->isChecked()){ ui->stackedWidget->setCurrentWidget(ui->page_defaults); } - else if(ui->actionSession->isChecked()){ ui->stackedWidget->setCurrentWidget(ui->page_session); } - } - ui->group_screen->setVisible(showScreen && (ui->spin_screen->maximum()>1) ); - //Hide the save button for particular pages - //ui->push_save->setVisible(!ui->actionDefaults->isChecked() || moddesk || modpan || modmenu || modshort || moddef || modses); //hide on the default page if nothing waiting to be saved - //Special functions for particular pages - //if(ui->page_panels->isVisible()){ checkpanels(); } - -} - -void MainUI::slotChangeScreen(){ - static int cscreen = 0; //current screen - int newscreen = currentDesktop(); - if(cscreen!=newscreen){ - if(moddesk || modpan){ - if(QMessageBox::Yes == QMessageBox::question(this, tr("Save Changes?"), tr("You currently have unsaved changes for this screen. Do you want to save them first?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) ){ - ui->spin_screen->setValue(cscreen+1); //Make sure the old screen is selected for a moment - saveCurrentSettings(true); //only save current screen settings - ui->spin_screen->setValue(newscreen+1); //Now reset back to the new screen - } - } - loadCurrentSettings(true); - cscreen = newscreen; //save that this screen is current now - } -} - -void MainUI::saveAndQuit(){ - saveCurrentSettings(); - this->close(); -} - -//General Utility Functions -void MainUI::loadCurrentSettings(bool screenonly){ - loading = true; - settings->sync(); - appsettings->sync(); - int cdesk = currentDesktop(); - QString DPrefix = "desktop-"+QString::number(cdesk)+"/"; - bool primary = (desktop->screenGeometry(cdesk).x()==0); - - //Desktop Page - QStringList bgs = settings->value(DPrefix+"background/filelist", QStringList()<<"default").toStringList(); - ui->combo_desk_bg->clear(); - for(int i=0; i<bgs.length(); i++){ - if(bgs[i]=="default"){ ui->combo_desk_bg->addItem( QIcon(DEFAULTBG), tr("System Default"), bgs[i] ); } - else if(bgs[i].startsWith("rgb(")){ui->combo_desk_bg->addItem(QString(tr("Solid Color: %1")).arg(bgs[i]), bgs[i]); } - //else{ ui->combo_desk_bg->addItem( QIcon(QPixmap(bgs[i]).scaled(64,64)), bgs[i].section("/",-1), bgs[i] ); } - else{ ui->combo_desk_bg->addItem( bgs[i].section("/",-1), bgs[i] ); } //disable the thumbnail - takes a long time for large collections of files - } - ui->check_desktop_autolaunchers->setChecked(settings->value(DPrefix+"generateDesktopIcons", false).toBool()); - ui->radio_desk_multi->setEnabled(bgs.length()>1); - if(bgs.length()>1){ ui->radio_desk_multi->setChecked(true);} - else{ ui->radio_desk_single->setChecked(true); } - ui->spin_desk_min->setValue( settings->value(DPrefix+"background/minutesToChange", 5).toInt() ); - desktimechanged(); //ensure the display gets updated (in case the radio selection did not change); - ui->label_desk_res->setText( tr("Screen Resolution:")+"\n"+QString::number(desktop->screenGeometry(cdesk).width())+"x"+QString::number(desktop->screenGeometry(cdesk).height()) ); - int tmp = ui->combo_desk_layout->findData(settings->value(DPrefix+"background/format","stretch")); - if(tmp>=0){ ui->combo_desk_layout->setCurrentIndex(tmp); } - QStringList dplugs = settings->value(DPrefix+"pluginlist",QStringList()).toStringList(); - ui->list_desktop_plugins->clear(); - for(int i=0; i<dplugs.length(); i++){ - QListWidgetItem* it = new QListWidgetItem(); - it->setWhatsThis(dplugs[i]); //save the full thing instantly - //Now load the rest of the info about the plugin - QString num; - if(dplugs[i].contains("---")){ - num = dplugs[i].section("---",1,1).section(".",1,1).simplified(); //Skip the screen number - if(num=="1"){ num.clear(); } //don't bother showing the number - dplugs[i] = dplugs[i].section("---",0,0); - } - if(dplugs[i].startsWith("applauncher::")){ - bool ok = false; - XDGDesktop app = LXDG::loadDesktopFile(dplugs[i].section("::",1,50), ok); - if(!ok){ continue; } //invalid for some reason - //Now fill the item with the necessary info - it->setText(app.name); - it->setIcon(LXDG::findIcon(app.icon,"") ); - it->setToolTip(app.comment); - }else{ - //Load the info for this plugin - LPI info = PINFO->desktopPluginInfo(dplugs[i]); - if( info.ID.isEmpty() ){ continue; } //invalid plugin for some reason - it->setText(info.name); - it->setToolTip(info.description); - it->setIcon( LXDG::findIcon(info.icon,"") ); - } - if(!num.isEmpty()){ it->setText( it->text()+" ("+num+")"); } //append the number - ui->list_desktop_plugins->addItem(it); - } - - //Panels Page - int panels = settings->value(DPrefix+"panels",-1).toInt(); - if(panels==-1 && primary){ panels=1; } - panelnumber = panels; - loadPanels(); - - if(!screenonly){ - // Menu Page - //Default terminal and filemanager binary - //ui->line_menu_term->setText( settings->value("default-terminal","xterm").toString() ); - //ui->line_menu_fm->setText( settings->value("default-filemanager","lumina-fm").toString() ); - //Menu Items - 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++){ - LPI info = PINFO->menuPluginInfo(items[i]); - if(items[i].startsWith("app::::")){ - bool ok = false; - XDGDesktop desk = LXDG::loadDesktopFile(items[i].section("::::",1,1), ok); - if(!ok){ continue; } //invalid application file (no longer installed?) - QListWidgetItem *item = new QListWidgetItem(); - item->setWhatsThis( items[i] ); - item->setIcon( LXDG::findIcon(desk.icon) ); - item->setText( desk.name ); - item->setToolTip( desk.comment ); - ui->list_menu->addItem(item); - continue; //now go to the next item - } - if(info.ID.isEmpty()){ continue; } //invalid plugin - //qDebug() << "Add Menu Item:" << info.ID; - QListWidgetItem *item = new QListWidgetItem(); - item->setWhatsThis( info.ID ); - item->setIcon( LXDG::findIcon(info.icon,"") ); - item->setText( info.name ); - item->setToolTip( info.description ); - ui->list_menu->addItem(item); - } - checkmenuicons(); //update buttons - } - //Shortcuts Page - if(!screenonly){ loadKeyboardShortcuts(); } - - //Defaults Page - if(!screenonly){ loadDefaultSettings(); } - - //Session Page - if(!screenonly){ loadSessionSettings(); } - - //Now disable the save button since nothing has changed yet - loading = false; - moddesk = modpan =false; - if(!screenonly){ modmenu = modshort = moddef = modses = false; }//all setup back to original - ui->push_save->setEnabled(modmenu || modshort || moddef || modses); -} - -void MainUI::saveCurrentSettings(bool screenonly){ - QString DPrefix = "desktop-"+QString::number(currentDesktop())+"/"; - bool needreload = false; - // Desktop Page - if(moddesk){ - QStringList bgs; //get the list of backgrounds to use - if(ui->radio_desk_multi->isChecked()){ - for(int i=0; i<ui->combo_desk_bg->count(); i++){ - bgs << ui->combo_desk_bg->itemData(i).toString(); - } - }else if(ui->combo_desk_bg->count() > 0){ - bgs << ui->combo_desk_bg->itemData( ui->combo_desk_bg->currentIndex() ).toString(); - bgs.removeAll("default"); - } - if(bgs.isEmpty()){ bgs << "default"; } //Make sure to always fall back on the default - settings->setValue(DPrefix+"background/filelist", bgs); - settings->setValue(DPrefix+"background/minutesToChange", ui->spin_desk_min->value()); - settings->setValue(DPrefix+"generateDesktopIcons", ui->check_desktop_autolaunchers->isChecked()); - settings->setValue(DPrefix+"background/format", ui->combo_desk_layout->currentData().toString()); - QStringList plugs; - for(int i=0; i<ui->list_desktop_plugins->count(); i++){ - plugs << ui->list_desktop_plugins->item(i)->whatsThis(); - } - if(settings->value(DPrefix+"pluginlist",QStringList()).toStringList() != plugs){ - settings->setValue(DPrefix+"pluginlist", plugs); - needreload = true; - } - } - - // Panels Page - if(modpan){ - settings->setValue(DPrefix+"panels", PANELS.length()); - savePanels(); - } - - // Menu Page - if(modmenu && !screenonly){ - QStringList items; - for(int i=0; i<ui->list_menu->count(); i++){ - items << ui->list_menu->item(i)->whatsThis(); - } - settings->setValue("menu/itemlist", items); - } - - //Shortcuts page - if(modshort && !screenonly){ - saveKeyboardShortcuts(); - } - - //Defaults page - if(moddef && !screenonly){ - //saveDefaultSettings(); - } - - //Session Page - if(modses && !screenonly){ - saveSessionSettings(); - } - - //All done - make sure the changes get saved to file right now - settings->sync(); - appsettings->sync(); - moddesk = modpan = false; - if(!screenonly){ modmenu = modshort = moddef = modses = false; } - ui->push_save->setEnabled(modmenu || modshort || moddef || modses); //wait for new changes - //ui->push_save->setVisible(!ui->actionDefaults->isChecked() || modmenu || modshort || moddef || modses); - if(needreload){ - //Wait 1 second - for(int i=0; i<10; i++){ QApplication::processEvents(); usleep(100000); } - loadCurrentSettings(screenonly); - } -} - - -//=============== -// DESKTOP PAGE -//=============== -void MainUI::deskbgchanged(){ - //Load the new image preview - if(ui->combo_desk_bg->count()==0){ - ui->label_desk_bgview->setPixmap(QPixmap()); - ui->label_desk_bgview->setText(tr("No Background")+"\n"+tr("(use system default)")); - ui->label_desk_bgview->setStyleSheet(""); - }else{ - QString path = ui->combo_desk_bg->itemData( ui->combo_desk_bg->currentIndex() ).toString(); - if(path=="default"){ path = DEFAULTBG; } - 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()) ); - //Update the preview/thumbnail for this item - QPixmap pix(path); - 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(""); - }else if(path.startsWith("rgb(")){ - ui->label_desk_bgview->setPixmap(QPixmap()); - ui->label_desk_bgview->setText(""); - ui->label_desk_bgview->setStyleSheet("background-color: "+path+";"); - }else{ - ui->label_desk_bgview->setPixmap(QPixmap()); - ui->label_desk_bgview->setText(tr("File does not exist")); - ui->label_desk_bgview->setStyleSheet(""); - } - } - //See if this constitues a change to the current settings and enable the save button - if(!loading && ui->radio_desk_single->isChecked()){ ui->push_save->setEnabled(true); moddesk=true;} - //Disable the background rotation option if only one background selected - if(ui->combo_desk_bg->count()<2){ - ui->radio_desk_single->setChecked(true); - ui->radio_desk_multi->setEnabled(false); - ui->spin_desk_min->setEnabled(false); - }else{ - ui->radio_desk_multi->setEnabled(true); - ui->spin_desk_min->setEnabled(ui->radio_desk_multi->isChecked()); - } - - //Disable the bg remove button if no backgrounds loaded - ui->tool_desk_rmbg->setEnabled(ui->combo_desk_bg->count()>0); -} - -void MainUI::desktimechanged(){ - ui->spin_desk_min->setEnabled(ui->radio_desk_multi->isChecked()); - if(!loading){ ui->push_save->setEnabled(true); moddesk = true; } -} - -void MainUI::deskbgremoved(){ - if(ui->combo_desk_bg->count()<1){ return; } //nothing to remove - ui->combo_desk_bg->removeItem( ui->combo_desk_bg->currentIndex() ); - ui->push_save->setEnabled(true); - moddesk = true; -} - -void MainUI::deskbgadded(){ - //Prompt the user to find an image file to use for a background - QString dir = LOS::LuminaShare().section("/lumina-desktop",0,0)+"/wallpapers/Lumina-DE"; - qDebug() << "Looking for wallpaper dir:" << dir; - if( !QFile::exists(dir) ){ dir = QDir::homePath(); } - QStringList imgs = LUtils::imageExtensions(); - for(int i=0; i<imgs.length(); i++){ imgs[i].prepend("*."); } - QStringList bgs = QFileDialog::getOpenFileNames(this, tr("Find Background Image(s)"), dir, "Images ("+imgs.join(" ")+");;All Files (*)"); - if(bgs.isEmpty()){ return; } - for(int i=0; i<bgs.length(); i++){ - ui->combo_desk_bg->addItem( QIcon(bgs[i]), bgs[i].section("/",-1), bgs[i]); - } - //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()){ - ui->radio_desk_multi->setChecked(true); - } - ui->push_save->setEnabled(true); //this is definitely a change - moddesk = true; -} - -void MainUI::deskbgcoloradded(){ - //Prompt the user to select a color (no transparency allowed) - QString color = getColorStyle("",false); //no initial color - if(color.isEmpty()){ return; } - //Add it to the list - 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 ); - - ui->push_save->setEnabled(true); //this is definitely a change - moddesk = true; -} - -void MainUI::deskbgdiradded(){ - //Add the files from a single directory - QString dir = LOS::LuminaShare().section("/lumina-desktop",0,0)+"/wallpapers/Lumina-DE"; - qDebug() << "Looking for wallpaper dir:" << dir; - if( !QFile::exists(dir) ){ dir = QDir::homePath(); } - 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])); - } - //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()){ - ui->radio_desk_multi->setChecked(true); - } - ui->push_save->setEnabled(true); //this is definitely a change - moddesk = true; -} - -void MainUI::deskbgdirradded(){ - //Recursively add files from a directory - QString dir = LOS::LuminaShare().section("/lumina-desktop",0,0)+"/wallpapers/Lumina-DE"; - qDebug() << "Looking for wallpaper dir:" << dir; - if( !QFile::exists(dir) ){ dir = QDir::homePath(); } - dir = QFileDialog::getExistingDirectory(this, tr("Find Background Image Directory"), dir, QFileDialog::ReadOnly); - if(dir.isEmpty()){ return; } - //Got a directory - go ahead and get all the valid image file formats - QStringList imgs = LUtils::imageExtensions(); - for(int i=0; i<imgs.length(); i++){ imgs[i].prepend("*."); } - //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] ); - } - //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()){ - ui->radio_desk_multi->setChecked(true); - } - ui->push_save->setEnabled(true); //this is definitely a change - moddesk = true; -} - - -void MainUI::deskplugadded(){ - GetPluginDialog dlg(this); - dlg.LoadPlugins("desktop", PINFO); - dlg.exec(); - if( !dlg.selected ){ return; } //cancelled - QString newplug = dlg.plugID; - QListWidgetItem *it = new QListWidgetItem(); - if(newplug=="applauncher"){ - //Prompt for the application to add - XDGDesktop app = getSysApp(); - if(app.filePath.isEmpty()){ return; } //cancelled - newplug.append("::"+app.filePath); - //Now fill the item with the necessary info - it->setWhatsThis(newplug); - it->setText(app.name); - it->setIcon(LXDG::findIcon(app.icon,"") ); - it->setToolTip(app.comment); - }else{ - //Load the info for this plugin - LPI info = PINFO->desktopPluginInfo(newplug); - if( info.ID.isEmpty() ){ return; } //invalid plugin for some reason (should never happen) - it->setWhatsThis(newplug); - it->setText(info.name); - it->setToolTip(info.description); - it->setIcon( LXDG::findIcon(info.icon,"") ); - } - ui->list_desktop_plugins->addItem(it); - ui->list_desktop_plugins->scrollToItem(it); - ui->push_save->setEnabled(true); - moddesk = true; -} - -void MainUI::deskplugremoved(){ - QList<QListWidgetItem*> sel = ui->list_desktop_plugins->selectedItems(); - if(sel.isEmpty()){ return; } //nothing to do - for(int i=0; i<sel.length(); i++){ - delete sel[i]; - } - ui->push_save->setEnabled(true); - moddesk = true; -} - -//============= -// PANELS PAGE -//============= -void MainUI::panelValChanged(){ - ui->tool_panels_add->setEnabled(panelnumber < 12); - if(!loading){ ui->push_save->setEnabled(true); modpan = true; } -} - -void MainUI::newPanel(){ - - if(panelnumber<0){ panelnumber=0; } //just in case - panelnumber++; - //Now create a new Panel widget with this number - PanelWidget *tmp = new PanelWidget(ui->scroll_panels->widget(), this, PINFO); - tmp->LoadSettings(settings, currentDesktop(), panelnumber-1); - PANELS << tmp; - connect(tmp, SIGNAL(PanelChanged()), this, SLOT(panelValChanged()) ); - connect(tmp, SIGNAL(PanelRemoved(int)), this, SLOT(removePanel(int)) ); - static_cast<QBoxLayout*>(ui->scroll_panels->widget()->layout())->insertWidget(PANELS.length()-1, tmp); - //update the widget first (2 necessary for scroll below to work) - ui->scroll_panels->update(); - QApplication::processEvents(); - QApplication::processEvents(); - ui->scroll_panels->ensureWidgetVisible(tmp); - panelValChanged(); -} - -void MainUI::removePanel(int pan){ - //connected to a signal from the panel widget - bool changed = false; - for(int i=0; i<PANELS.length(); i++){ - int num = PANELS[i]->PanelNumber(); - if(num==pan){ - delete PANELS.takeAt(i); - i--; - changed = true; - }else if(num > pan){ - PANELS[i]->ChangePanelNumber(num-1); - changed = true; - } - } - if(!changed){ return; } //nothing done - panelnumber--; - panelValChanged(); -} - -void MainUI::loadPanels(){ - //First clean any current panels - for(int i=0; i<PANELS.length(); i++){ delete PANELS.takeAt(i); i--; } - //Now create new panels - int dnum = currentDesktop(); - if(ui->scroll_panels->widget()->layout()==0){ - ui->scroll_panels->widget()->setLayout( new QHBoxLayout() ); - ui->scroll_panels->widget()->layout()->setContentsMargins(0,0,0,0); - } - ui->scroll_panels->widget()->layout()->setAlignment(Qt::AlignLeft); - //Clear anything left over in the layout - for(int i=0; i<ui->scroll_panels->widget()->layout()->count(); i++){ - delete ui->scroll_panels->widget()->layout()->takeAt(i); - } - for(int i=0; i<panelnumber; i++){ - PanelWidget *tmp = new PanelWidget(ui->scroll_panels->widget(), this, PINFO); - tmp->LoadSettings(settings, dnum, i); - PANELS << tmp; - connect(tmp, SIGNAL(PanelChanged()), this, SLOT(panelValChanged()) ); - connect(tmp, SIGNAL(PanelRemoved(int)), this, SLOT(removePanel(int)) ); - ui->scroll_panels->widget()->layout()->addWidget(tmp); - } - static_cast<QHBoxLayout*>(ui->scroll_panels->widget()->layout())->addStretch(); -} - -void MainUI::savePanels(){ - for(int i=0; i<PANELS.length(); i++){ - PANELS[i]->SaveSettings(settings); - } -} - -//============ -// MENU PAGE -//============ -void MainUI::addmenuplugin(){ - GetPluginDialog dlg(this); - dlg.LoadPlugins("menu", PINFO); - dlg.exec(); - if(!dlg.selected){ return; } //cancelled - QString plug = dlg.plugID; - //Now add the item to the list - LPI info = PINFO->menuPluginInfo(plug); - QListWidgetItem *it; - if(info.ID=="app"){ - //Need to prompt for the exact application to add to the menu - // Note: whatsThis() format: "app::::< *.desktop file path >" - XDGDesktop desk = getSysApp(); - if(desk.filePath.isEmpty()){ return; }//nothing selected - //Create the item for the list - it = new QListWidgetItem(LXDG::findIcon(desk.icon,""), desk.name ); - it->setWhatsThis(info.ID+"::::"+desk.filePath); - it->setToolTip( desk.comment ); - }else{ - it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name ); - it->setWhatsThis(info.ID); - it->setToolTip( info.description ); - } - ui->list_menu->addItem(it); - ui->list_menu->setCurrentRow(ui->list_menu->count()-1); //make sure it is auto-selected - ui->push_save->setEnabled(true); - modmenu = true; -} - -void MainUI::rmmenuplugin(){ - if(ui->list_menu->currentRow() < 0){ return; } //no selection - delete ui->list_menu->takeItem( ui->list_menu->currentRow() ); - ui->push_save->setEnabled(true); - modmenu = true; -} - -void MainUI::upmenuplugin(){ - int row = ui->list_menu->currentRow(); - if(row <= 0){ return; } - ui->list_menu->insertItem(row-1, ui->list_menu->takeItem(row)); - ui->list_menu->setCurrentRow(row-1); - ui->push_save->setEnabled(true); - checkmenuicons(); - modmenu = true; -} - -void MainUI::downmenuplugin(){ - int row = ui->list_menu->currentRow(); - if(row < 0 || row >= (ui->list_menu->count()-1) ){ return; } - ui->list_menu->insertItem(row+1, ui->list_menu->takeItem(row)); - ui->list_menu->setCurrentRow(row+1); - ui->push_save->setEnabled(true); - checkmenuicons(); - modmenu = true; -} - -void MainUI::checkmenuicons(){ - ui->tool_menu_up->setEnabled( ui->list_menu->currentRow() > 0 ); - ui->tool_menu_dn->setEnabled( ui->list_menu->currentRow() < (ui->list_menu->count()-1) ); - ui->tool_menu_rm->setEnabled( ui->list_menu->currentRow() >=0 ); -} - -//=========== -// Shortcuts Page -//=========== -void MainUI::loadKeyboardShortcuts(){ - ui->tree_shortcut->clear(); - QStringList info = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-keys"); - //First take care of the special Lumina options - QStringList special; - special << "Exec lumina-open -volumeup::::"+tr("Audio Volume Up") \ - << "Exec lumina-open -volumedown::::"+tr("Audio Volume Down") \ - << "Exec lumina-open -brightnessup::::"+tr("Screen Brightness Up") \ - << "Exec lumina-open -brightnessdown::::"+tr("Screen Brightness Down") \ - << "Exec lumina-screenshot::::"+tr("Take Screenshot") \ - << "Exec xscreensaver-command -lock::::"+tr("Lock Screen"); - for(int i=0; i<special.length(); i++){ - QString spec = info.filter(":"+special[i].section("::::",0,0)).join("").simplified(); - QTreeWidgetItem *it = new QTreeWidgetItem(); - it->setText(0, special[i].section("::::",1,1)); - it->setWhatsThis(0, special[i].section("::::",0,0)); - if(!spec.isEmpty()){ - info.removeAll(spec); //this line has been dealt with - remove it - it->setText(1, fluxToDispKeys(spec.section(":",0,0)) ); //need to make this easier to read later - it->setWhatsThis(1, spec.section(":",0,0) ); - } - ui->tree_shortcut->addTopLevelItem(it); - } - //Now add support for all the other fluxbox shortcuts - for(int i=0; i<info.length(); i++){ - //skip empty/invalid lines, as well as non-global shortcuts (OnMenu, OnWindow, etc..) - if(info[i].isEmpty() || info[i].startsWith("#") || info[i].startsWith("!") || info[i].startsWith("On")){ continue; } - QString exec = info[i].section(":",1,100); - QString showexec = exec; - if(showexec.startsWith("If {Matches")){ showexec = showexec.section("{",2,2).section("}",0,0); } - if(showexec.startsWith("Exec ")){ showexec.replace("Exec ","Run "); } - else{ showexec = showexec.section("(",0,0).section("{",0,0); } //built-in command - remove the extra commands on some of them - QTreeWidgetItem *it = new QTreeWidgetItem(); - it->setText(0, showexec.simplified() ); - it->setWhatsThis(0, exec); - it->setText(1, fluxToDispKeys(info[i].section(":",0,0)) ); //need to make this easier to read later - it->setWhatsThis(1, info[i].section(":",0,0) ); - ui->tree_shortcut->addTopLevelItem(it); - } -} - -void MainUI::saveKeyboardShortcuts(){ - //First get all the current listings - QStringList current; - for(int i=0; i<ui->tree_shortcut->topLevelItemCount(); i++){ - QTreeWidgetItem *it = ui->tree_shortcut->topLevelItem(i); - current << it->whatsThis(1)+" :"+it->whatsThis(0); //Full Fluxbox command line - } - - QStringList info = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-keys"); - for(int i=0; i<info.length(); i++){ - if(info[i].isEmpty() || info[i].startsWith("#") || info[i].startsWith("!")){ continue; } - if(current.filter(info[i].section(":",1,10)).length() > 0){ - //Found Item to be replaced/removed - QString it = current.filter(info[i].section(":",1,10)).join("\n").section("\n",0,0); //ensure only the first match - if(it.section(" :",0,0).isEmpty()){ info.removeAt(i); i--; } //remove this entry - else{ info[i] = it; } //replace this entry - current.removeAll(it); //already taken care of - remove it from the current list - } - } - //Now save the new contents - for(int i=0; i<current.length(); i++){ - if(!current[i].section(" :",0,0).isEmpty()){ info << current[i]; } - } - bool ok = overwriteFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-keys", info); - if(!ok){ qDebug() << "Warning: Could not save ~/.lumina/fluxbox-keys"; } -} - -void MainUI::clearKeyBinding(){ - if(ui->tree_shortcut->currentItem()==0){ return; } - ui->tree_shortcut->currentItem()->setText(1,""); - ui->tree_shortcut->currentItem()->setWhatsThis(1,""); - ui->push_save->setEnabled(true); - modshort=true; -} - -void MainUI::applyKeyBinding(){ - QKeySequence seq = ui->keyEdit_shortcut->keySequence(); - qDebug() << "New Key Sequence:" << seq.toString(QKeySequence::NativeText) << seq.toString(QKeySequence::PortableText); - if(seq.isEmpty()){ - //Verify removal of the action first - - //Now remove the action - delete ui->tree_shortcut->currentItem(); - }else{ - QTreeWidgetItem *it = ui->tree_shortcut->currentItem(); - it->setText(1,seq.toString(QKeySequence::NativeText)); - it->setWhatsThis(1,dispToFluxKeys(seq.toString(QKeySequence::PortableText))); - qDebug() << " - Flux Sequence:" << it->whatsThis(1); - } - ui->keyEdit_shortcut->clear(); - ui->push_save->setEnabled(true); - modshort=true; -} - -void MainUI::updateKeyConfig(){ - ui->group_shortcut_modify->setEnabled(ui->tree_shortcut->currentItem()!=0); - ui->keyEdit_shortcut->clear(); -} - -//=========== -// Defaults Page -//=========== -void MainUI::changeDefaultBrowser(){ - //Prompt for the new app - XDGDesktop desk = getSysApp(true); - if(desk.filePath.isEmpty()){ return; }//nothing selected - if(desk.filePath=="reset"){ - desk.filePath=""; - } - //save the new app setting and adjust the button appearance - appsettings->setValue("default/webbrowser", desk.filePath); - LXDG::setDefaultAppForMime("x-scheme-handler/http", desk.filePath.section("/",-1)); - LXDG::setDefaultAppForMime("x-scheme-handler/https", desk.filePath.section("/",-1)); - QString tmp = desk.filePath; - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_webbrowser->setText(tmp.section("/",-1)); - ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_webbrowser->setText(desk.name); - ui->tool_default_webbrowser->setIcon(LXDG::findIcon(desk.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_webbrowser->setText(tr("Click to Set")); - ui->tool_default_webbrowser->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_webbrowser->setText(tmp.section("/",-1)); - ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") ); - } -} - -void MainUI::changeDefaultEmail(){ - //Prompt for the new app - XDGDesktop desk = getSysApp(true); //allow reset to default - if(desk.filePath.isEmpty()){ return; }//nothing selected - if(desk.filePath=="reset"){ - desk.filePath=""; - } - //save the new app setting and adjust the button appearance - LXDG::setDefaultAppForMime("application/email",desk.filePath); - // appsettings->setValue("default/email", desk.filePath); - QString tmp = desk.filePath; - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_email->setText(tmp.section("/",-1)); - ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_email->setText(file.name); - ui->tool_default_email->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_email->setText(tr("Click to Set")); - ui->tool_default_email->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_email->setText(tmp.section("/",-1)); - ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") ); - } -} - -void MainUI::changeDefaultFileManager(){ - //Prompt for the new app - XDGDesktop desk = getSysApp(true); - if(desk.filePath.isEmpty()){ return; }//nothing selected - if(desk.filePath=="reset"){ - desk.filePath="lumina-fm"; - } - //save the new app setting and adjust the button appearance - //appsettings->setValue("default/directory", desk.filePath); - //sessionsettings->setValue("default-filemanager", desk.filePath); - LXDG::setDefaultAppForMime("inode/directory", desk.filePath.section("/",-1)); - QString tmp = desk.filePath; - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_filemanager->setText(tmp.section("/",-1)); - ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_filemanager->setText(file.name); - ui->tool_default_filemanager->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_filemanager->setText(tr("Click to Set")); - ui->tool_default_filemanager->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_filemanager->setText(tmp.section("/",-1)); - ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") ); - } -} - -void MainUI::changeDefaultTerminal(){ - //Prompt for the new app - XDGDesktop desk = getSysApp(true); - if(desk.filePath.isEmpty()){ return; }//nothing selected - if(desk.filePath=="reset"){ - desk.filePath="xterm"; - } - //save the new app setting and adjust the button appearance - LXDG::setDefaultAppForMime("application/terminal",desk.filePath); - //sessionsettings->setValue("default-terminal", desk.filePath); - QString tmp = desk.filePath; - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_terminal->setText(tmp.section("/",-1)); - ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_terminal->setText(file.name); - ui->tool_default_terminal->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_terminal->setText(tr("Click to Set")); - ui->tool_default_terminal->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_terminal->setText(tmp.section("/",-1)); - ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); - } -} - -void MainUI::loadDefaultSettings(){ - //First load the lumina-open specific defaults - // - Default File Manager - QString tmp = LXDG::findDefaultAppForMime("inode/directory"); - if(tmp.isEmpty()){ tmp = "lumina-fm"; } - if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_filemanager->setText(tmp.section("/",-1)); - ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_filemanager->setText(file.name); - ui->tool_default_filemanager->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_filemanager->setText(tr("Click to Set")); - ui->tool_default_filemanager->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_filemanager->setText(tmp.section("/",-1)); - ui->tool_default_filemanager->setIcon( LXDG::findIcon("application-x-executable","") ); - } - // - Default Terminal - tmp =LXDG::findDefaultAppForMime("application/terminal"); //sessionsettings->value("default-terminal", "xterm").toString(); - if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_terminal->setText(tmp.section("/",-1)); - ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_terminal->setText(file.name); - ui->tool_default_terminal->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_terminal->setText(tr("Click to Set")); - ui->tool_default_terminal->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_terminal->setText(tmp.section("/",-1)); - ui->tool_default_terminal->setIcon( LXDG::findIcon("application-x-executable","") ); - } - // - Default Web Browser - tmp = LXDG::findDefaultAppForMime("x-scheme-handler/http"); //appsettings->value("default/webbrowser", "").toString(); - if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_webbrowser->setText(tmp.section("/",-1)); - ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_webbrowser->setText(file.name); - ui->tool_default_webbrowser->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_webbrowser->setText(tr("Click to Set")); - ui->tool_default_webbrowser->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_webbrowser->setText(tmp.section("/",-1)); - ui->tool_default_webbrowser->setIcon( LXDG::findIcon("application-x-executable","") ); - } - // - Default Email Client - tmp = LXDG::findDefaultAppForMime("application/email"); //appsettings->value("default/email", "").toString(); - if( !QFile::exists(tmp) && !LUtils::isValidBinary(tmp) ){ qDebug() << "Invalid Settings:" << tmp; tmp.clear(); } //invalid settings - if(tmp.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(tmp, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - ui->tool_default_email->setText(tmp.section("/",-1)); - ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") ); - }else{ - ui->tool_default_email->setText(file.name); - ui->tool_default_email->setIcon(LXDG::findIcon(file.icon,"") ); - } - }else if(tmp.isEmpty()){ - ui->tool_default_email->setText(tr("Click to Set")); - ui->tool_default_email->setIcon( LXDG::findIcon("system-help","") ); - }else{ - //Might be a binary - just print out the raw "path" - ui->tool_default_email->setText(tmp.section("/",-1)); - ui->tool_default_email->setIcon( LXDG::findIcon("application-x-executable","") ); - } - - //Now load the XDG mime defaults - ui->tree_defaults->clear(); - QStringList defMimeList = LXDG::listFileMimeDefaults(); - //qDebug() << "Mime List:\n" << defMimeList.join("\n"); - defMimeList.sort(); //sort by group/mime - //Now fill the tree by group/mime - QTreeWidgetItem *group = new QTreeWidgetItem(0); //nothing at the moment - QString ccat; - for(int i=0; i<defMimeList.length(); i++){ - //Get the info from this entry - QString mime = defMimeList[i].section("::::",0,0); - QString cat = mime.section("/",0,0); - QString extlist = defMimeList[i].section("::::",1,1); - QString def = defMimeList[i].section("::::",2,2); - QString comment = defMimeList[i].section("::::",3,50); - //Now check if this is a new category - if(ccat!=cat){ - //New group - group = new QTreeWidgetItem(0); - group->setText(0, cat); //add translations for known/common groups later - ui->tree_defaults->addTopLevelItem(group); - ccat = cat; - } - //Now create the entry - QTreeWidgetItem *it = new QTreeWidgetItem(); - it->setWhatsThis(0,mime); // full mimetype - it->setText(0, QString(tr("%1 (%2)")).arg(mime.section("/",-1), extlist) ); - it->setText(2,comment); - it->setToolTip(0, comment); it->setToolTip(1,comment); - //Now load the default (if there is one) - it->setWhatsThis(1,def); //save for later - if(def.endsWith(".desktop")){ - bool ok = false; - XDGDesktop file = LXDG::loadDesktopFile(def, ok); - if(!ok || file.filePath.isEmpty()){ - //Might be a binary - just print out the raw "path" - it->setText(1,def.section("/",-1)); - it->setIcon(1, LXDG::findIcon("application-x-executable","") ); - }else{ - it->setText(1, file.name); - it->setIcon(1, LXDG::findIcon(file.icon,"") ); - } - }else if(!def.isEmpty()){ - //Binary/Other default - it->setText(1, def.section("/",-1)); - it->setIcon(1, LXDG::findIcon("application-x-executable","") ); - } - group->addChild(it); - } - - ui->tree_defaults->sortItems(0,Qt::AscendingOrder); - - checkdefaulticons(); -} - -void MainUI::cleardefaultitem(){ - QTreeWidgetItem *it = ui->tree_defaults->currentItem(); - if(it==0){ return; } //no item selected - QList<QTreeWidgetItem*> list; - for(int i=0; i<it->childCount(); i++){ - list << it->child(i); - } - if(list.isEmpty()){ list << it; } //just do the current item - //Now clear the items - for(int i=0; i<list.length(); i++){ - //Clear it in the back end - LXDG::setDefaultAppForMime(list[i]->whatsThis(0), ""); - //Now clear it in the UI - list[i]->setWhatsThis(1,""); //clear the app path - list[i]->setIcon(1,QIcon()); //clear the icon - list[i]->setText(1,""); //clear the name - } - //ui->push_save->setEnabled(true); - //moddef = true; -} - -void MainUI::setdefaultitem(){ - QTreeWidgetItem *it = ui->tree_defaults->currentItem(); - if(it==0){ return; } //no item selected - QList<QTreeWidgetItem*> list; - for(int i=0; i<it->childCount(); i++){ - list << it->child(i); - } - if(list.isEmpty()){ list << it; } //just do the current item - //Prompt for which application to use - XDGDesktop desk = getSysApp(); - if(desk.filePath.isEmpty()){ return; }//nothing selected - //Now set the items - for(int i=0; i<list.length(); i++){ - //Set it in the back end - LXDG::setDefaultAppForMime(list[i]->whatsThis(0), desk.filePath); - //Set it in the UI - list[i]->setWhatsThis(1,desk.filePath); //app path - list[i]->setIcon(1,LXDG::findIcon(desk.icon,"")); //reset the icon - list[i]->setText(1,desk.name); //reset the name - } - //ui->push_save->setEnabled(true); - //moddef = true; -} - -void MainUI::setdefaultbinary(){ - QTreeWidgetItem *it = ui->tree_defaults->currentItem(); - if(it==0){ return; } //no item selected - QList<QTreeWidgetItem*> list; - for(int i=0; i<it->childCount(); i++){ - list << it->child(i); - } - if(list.isEmpty()){ list << it; } //just do the current item - //Prompt for which binary to use - QFileDialog dlg(this); - //dlg.setFilter(QDir::Executable | QDir::Files); //Does not work! Filters executable files as well as breaks browsing capabilities - dlg.setFileMode(QFileDialog::ExistingFile); - dlg.setDirectory( LOS::AppPrefix()+"bin" ); - dlg.setWindowTitle(tr("Select Binary")); - if( !dlg.exec() || dlg.selectedFiles().isEmpty() ){ - return; //cancelled - } - QString path = dlg.selectedFiles().first(); - //Make sure it is executable - if( !QFileInfo(path).isExecutable()){ - QMessageBox::warning(this, tr("Invalid Binary"), tr("The selected binary is not executable!")); - return; - } - //Now set the items - for(int i=0; i<list.length(); i++){ - //Set it in the back end - LXDG::setDefaultAppForMime(list[i]->whatsThis(0), path); - //Set it in the UI - list[i]->setWhatsThis(1,path); //app path - list[i]->setIcon(1,LXDG::findIcon("application-x-executable","")); //clear the icon - list[i]->setText(1,path.section("/",-1)); //clear the name - } - //ui->push_save->setEnabled(true); - //moddef = true; -} - -void MainUI::checkdefaulticons(){ - QTreeWidgetItem *it = ui->tree_defaults->currentItem(); - ui->tool_defaults_set->setEnabled(it!=0); - ui->tool_defaults_clear->setEnabled(it!=0); - ui->tool_defaults_setbin->setEnabled(it!=0); -} - -//=========== -// Session Page -//=========== -void MainUI::loadSessionSettings(){ - QStringList FB = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init"); - QString val; - //Do the window placement - val = FB.filter("session.screen0.windowPlacement:").join("").section(":",1,1).simplified(); - //qDebug() << "Window Placement:" << val; - int index = ui->combo_session_wloc->findData(val); - if(index<0){ index = 0;} //use the default - ui->combo_session_wloc->setCurrentIndex(index); - - //Do the window focus - val = FB.filter("session.screen0.focusModel:").join("").section(":",1,1).simplified(); - //qDebug() << "Window Focus:" << val; - index = ui->combo_session_wfocus->findData(val); - if(index<0){ index = 0;} //use the default - ui->combo_session_wfocus->setCurrentIndex(index); - - //Do the window theme - val = FB.filter("session.styleFile:").join("").section(":",1,1).simplified(); - //qDebug() << "Window Theme:" << val; - index = ui->combo_session_wtheme->findData(val); - if(index<0){ index = 0;} //use the default - ui->combo_session_wtheme->setCurrentIndex(index); - - //Now the number of workspaces - val = FB.filter("session.screen0.workspaces:").join("").section(":",1,1).simplified(); - //qDebug() << "Number of Workspaces:" << val; - if(!val.isEmpty()){ ui->spin_session_wkspaces->setValue(val.toInt()); } - - //Now do the startup applications - STARTAPPS = LXDG::findAutoStartFiles(true); //also want invalid/disabled items - //qDebug() << "StartApps:"; - ui->list_session_start->clear(); - for(int i=0; i<STARTAPPS.length(); i++){ - //qDebug() << STARTAPPS[i].filePath +" -> " +STARTAPPS[i].name << STARTAPPS[i].isHidden; - if( !LXDG::checkValidity(STARTAPPS[i],false) || !QFile::exists(STARTAPPS[i].filePath) ){ continue; } - QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(STARTAPPS[i].icon,"application-x-executable"), STARTAPPS[i].name ); - it->setWhatsThis(STARTAPPS[i].filePath); //keep the file location - it->setToolTip(STARTAPPS[i].comment); - if(STARTAPPS[i].isHidden){ it->setCheckState( Qt::Unchecked); } - else{it->setCheckState( Qt::Checked); } - ui->list_session_start->addItem(it); - } - - - //Now do the general session options - ui->check_session_numlock->setChecked( sessionsettings->value("EnableNumlock", true).toBool() ); - ui->check_session_playloginaudio->setChecked( sessionsettings->value("PlayStartupAudio",true).toBool() ); - ui->check_session_playlogoutaudio->setChecked( sessionsettings->value("PlayLogoutAudio",true).toBool() ); - ui->push_session_setUserIcon->setIcon( LXDG::findIcon(QDir::homePath()+"/.loginIcon.png", "user-identity") ); - ui->line_session_time->setText( sessionsettings->value("TimeFormat","").toString() ); - ui->line_session_date->setText( sessionsettings->value("DateFormat","").toString() ); - index = ui->combo_session_datetimeorder->findData( sessionsettings->value("DateTimeOrder","timeonly").toString() ); - ui->combo_session_datetimeorder->setCurrentIndex(index); - - //Now do the localization settings - val = sessionsettings->value("InitLocale/LANG", "").toString(); - index = ui->combo_locale_lang->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_lang->setCurrentIndex(index); - val = sessionsettings->value("InitLocale/LC_MESSAGES", "").toString(); - index = ui->combo_locale_message->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_message->setCurrentIndex(index); - val = sessionsettings->value("InitLocale/LC_TIME", "").toString(); - index = ui->combo_locale_time->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_time->setCurrentIndex(index); - val = sessionsettings->value("InitLocale/NUMERIC", "").toString(); - index = ui->combo_locale_numeric->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_numeric->setCurrentIndex(index); - val = sessionsettings->value("InitLocale/MONETARY", "").toString(); - index = ui->combo_locale_monetary->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_monetary->setCurrentIndex(index); - val = sessionsettings->value("InitLocale/COLLATE", "").toString(); - index = ui->combo_locale_collate->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_collate->setCurrentIndex(index); - val = sessionsettings->value("InitLocale/CTYPE", "").toString(); - index = ui->combo_locale_ctype->findData(val); - if(index<0){ index = 0; } //system default - ui->combo_locale_ctype->setCurrentIndex(index); - - //Now do the session theme options - ui->combo_session_themefile->clear(); - ui->combo_session_colorfile->clear(); - ui->combo_session_icontheme->clear(); - QStringList current = LTHEME::currentSettings(); - // - local theme templates - QStringList tmp = LTHEME::availableLocalThemes(); - tmp.sort(); - 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++){ - 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++){ - 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++){ - 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++){ - ui->combo_session_icontheme->addItem(tmp[i]); - if(tmp[i]==current[2]){ ui->combo_session_icontheme->setCurrentIndex(i); } - } - // - Font - 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); } - - //sessionstartchanged(); //make sure to update buttons - sessionLoadTimeSample(); - sessionLoadDateSample(); - sessionCursorChanged(); -} - -void MainUI::saveSessionSettings(){ - //Do the fluxbox settings first - QStringList FB = readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init"); - // - window placement - int index = FB.indexOf( FB.filter("session.screen0.windowPlacement:").join("") ); - QString line = "session.screen0.windowPlacement:\t"+ui->combo_session_wloc->itemData( ui->combo_session_wloc->currentIndex() ).toString(); - if(index < 0){ FB << line; } //add line to the end of the file - else{ FB[index] = line; } //replace the current setting with the new one - // - window focus - index = FB.indexOf( FB.filter("session.screen0.focusModel:").join("") ); - line = "session.screen0.focusModel:\t"+ui->combo_session_wfocus->itemData( ui->combo_session_wfocus->currentIndex() ).toString(); - if(index < 0){ FB << line; } //add line to the end of the file - else{ FB[index] = line; } //replace the current setting with the new one - // - window theme - index = FB.indexOf( FB.filter("session.styleFile:").join("") ); - line = "session.styleFile:\t"+ui->combo_session_wtheme->itemData( ui->combo_session_wtheme->currentIndex() ).toString(); - if(index < 0){ FB << line; } //add line to the end of the file - else{ FB[index] = line; } //replace the current setting with the new one - // - workspace number - index = FB.indexOf( FB.filter("session.screen0.workspaces:").join("") ); - line = "session.screen0.workspaces:\t"+QString::number(ui->spin_session_wkspaces->value()); - if(index < 0){ FB << line; } //add line to the end of the file - else{ FB[index] = line; } //replace the current setting with the new one - - //Save the fluxbox settings - bool ok = overwriteFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/fluxbox-init", FB); - if(!ok){ qDebug() << "Warning: Could not save ~/.lumina/fluxbox-init"; } - - //Now do the start apps - bool newstartapps = false; - for(int i=0; i<ui->list_session_start->count(); i++){ - QString file = ui->list_session_start->item(i)->whatsThis(); - bool enabled = ui->list_session_start->item(i)->checkState()==Qt::Checked; - bool found = false; - for(int i=0; i<STARTAPPS.length(); i++){ - if(STARTAPPS[i].filePath==file){ - found = true; - if(enabled != !STARTAPPS[i].isHidden){ - //value is different - qDebug() << "Setting Autostart:" << enabled << STARTAPPS[i].filePath; - LXDG::setAutoStarted(enabled, STARTAPPS[i]); - } - break; - } - } - if(!found && enabled){ - //New file/binary/app - qDebug() << "Adding new AutoStart File:" << file; - LXDG::setAutoStarted(enabled, file); - newstartapps = true; - } - } - - - - if( !ui->push_session_setUserIcon->whatsThis().isEmpty()){ - QString filepath = ui->push_session_setUserIcon->whatsThis(); - if(filepath.isEmpty()){ filepath = QDir::homePath()+"/.loginIcon.png"; } - if(filepath=="reset"){ - QFile::remove(QDir::homePath()+"/.loginIcon.png"); - }else{ - QPixmap pix(filepath); - //Now scale it down if necessary - if(pix.width() > 64 || pix.height()>64){ - pix = pix.scaled(64,64,Qt::KeepAspectRatio, Qt::SmoothTransformation); - } - //Now save that to the icon file (will automatically convert it to a PNG file format) - pix.save(QDir::homePath()+"/.loginIcon.png"); - } - ui->push_session_setUserIcon->setWhatsThis(""); //clear it for later - //Now touch the settings file so that it re-loads the panel - QProcess::startDetached("touch \""+settings->fileName()+"\""); - } - - //Now do the general session options - sessionsettings->setValue("EnableNumlock", ui->check_session_numlock->isChecked()); - sessionsettings->setValue("PlayStartupAudio", ui->check_session_playloginaudio->isChecked()); - sessionsettings->setValue("PlayLogoutAudio", ui->check_session_playlogoutaudio->isChecked()); - sessionsettings->setValue("TimeFormat", ui->line_session_time->text()); - sessionsettings->setValue("DateFormat", ui->line_session_date->text()); - sessionsettings->setValue("DateTimeOrder", ui->combo_session_datetimeorder->currentData().toString()); - - //Now do the locale settings - sessionsettings->setValue("InitLocale/LANG", ui->combo_locale_lang->currentData().toString() ); - sessionsettings->setValue("InitLocale/LC_MESSAGES", ui->combo_locale_message->currentData().toString() ); - sessionsettings->setValue("InitLocale/LC_TIME", ui->combo_locale_time->currentData().toString() ); - sessionsettings->setValue("InitLocale/LC_NUMERIC", ui->combo_locale_numeric->currentData().toString() ); - sessionsettings->setValue("InitLocale/LC_MONETARY", ui->combo_locale_monetary->currentData().toString() ); - sessionsettings->setValue("InitLocale/LC_COLLATE", ui->combo_locale_collate->currentData().toString() ); - sessionsettings->setValue("InitLocale/LC_CTYPE", ui->combo_locale_ctype->currentData().toString() ); - - - //Now do the theme options - QString themefile = ui->combo_session_themefile->itemData( ui->combo_session_themefile->currentIndex() ).toString(); - QString colorfile = ui->combo_session_colorfile->itemData( ui->combo_session_colorfile->currentIndex() ).toString(); - QString iconset = ui->combo_session_icontheme->currentText(); - QString font = ui->font_session_theme->currentFont().family(); - QString fontsize = QString::number(ui->spin_session_fontsize->value())+"pt"; - //qDebug() << "Saving theme options:" << themefile << colorfile << iconset << font << fontsize; - LTHEME::setCurrentSettings( themefile, colorfile, iconset, font, fontsize); - LTHEME::setCursorTheme(ui->combo_session_cursortheme->currentText()); - if(newstartapps){ loadSessionSettings(); } //make sure to re-load the session settings to catch the new files -} - -void MainUI::rmsessionstartitem(){ - if(ui->list_session_start->currentRow() < 0){ return; } //no item selected - delete ui->list_session_start->takeItem(ui->list_session_start->currentRow()); - sessionoptchanged(); -} - -void MainUI::addsessionstartapp(){ - //Prompt for the application to start - XDGDesktop desk = getSysApp(); - if(desk.filePath.isEmpty()){ return; } //cancelled - QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon(desk.icon,""), desk.name ); - it->setWhatsThis(desk.filePath); - it->setToolTip(desk.comment); - it->setCheckState(Qt::Checked); - - ui->list_session_start->addItem(it); - ui->list_session_start->setCurrentItem(it); - sessionoptchanged(); -} - -void MainUI::addsessionstartbin(){ - QString chkpath = LOS::AppPrefix() + "bin"; - if(!QFile::exists(chkpath)){ chkpath = QDir::homePath(); } - QString bin = QFileDialog::getOpenFileName(this, tr("Select Binary"), chkpath, tr("Application Binaries (*)") ); - if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled - if( !QFileInfo(bin).isExecutable() ){ - QMessageBox::warning(this, tr("Invalid Binary"), tr("The selected file is not executable!")); - return; - } - QListWidgetItem *it = new QListWidgetItem( LXDG::findIcon("application-x-executable",""), bin.section("/",-1) ); - it->setWhatsThis(bin); //command to be saved/run - it->setToolTip(bin); - it->setCheckState(Qt::Checked); - ui->list_session_start->addItem(it); - ui->list_session_start->setCurrentItem(it); - sessionoptchanged(); -} - -void MainUI::addsessionstartfile(){ - QString chkpath = QDir::homePath(); - QString bin = QFileDialog::getOpenFileName(this, tr("Select File"), chkpath, tr("All Files (*)") ); - if( bin.isEmpty() || !QFile::exists(bin) ){ return; } //cancelled - QListWidgetItem *it = new QListWidgetItem( LXDG::findMimeIcon(bin), bin.section("/",-1) ); - it->setWhatsThis(bin); //file to be saved/run - it->setToolTip(bin); - it->setCheckState(Qt::Checked); - ui->list_session_start->addItem(it); - ui->list_session_start->setCurrentItem(it); - sessionoptchanged(); -} - -void MainUI::sessionoptchanged(){ - if(!loading){ - ui->push_save->setEnabled(true); - modses = true; - } -} - -void MainUI::sessionthemechanged(){ - //Update the Fluxbox Theme preview - QString previewfile = ui->combo_session_wtheme->itemData( ui->combo_session_wtheme->currentIndex() ).toString(); - previewfile.append( (previewfile.endsWith("/") ? "preview.jpg": "/preview.jpg") ); - if(QFile::exists(previewfile)){ - ui->label_session_wpreview->setPixmap(QPixmap(previewfile)); - }else{ - ui->label_session_wpreview->setText(tr("No Preview Available")); - } - sessionoptchanged(); -} - -void MainUI::sessionCursorChanged(){ - //Update the Cursor Theme preview - QStringList info = LTHEME::cursorInformation(ui->combo_session_cursortheme->currentText()); - // - info format: [name, comment. sample file] - qDebug() << "Cursor Information:" << ui->combo_session_cursortheme->currentText() << info; - QPixmap img(info[2]); - //qDebug() << "Image Data:" << img.isNull() << img.size(); - if(!img.isNull()){ - ui->label_cursor_sample->setPixmap( img.scaledToHeight(ui->label_cursor_sample->height(), Qt::SmoothTransformation) ); - } - ui->label_cursor_sample->setToolTip(info[1]); - ui->combo_session_cursortheme->setToolTip(info[1]); - sessionoptchanged(); -} - -void MainUI::sessionEditColor(){ - //Get the current color file - QString file = ui->combo_session_colorfile->itemData( ui->combo_session_colorfile->currentIndex() ).toString(); - //Open the color edit dialog - ColorDialog dlg(this, PINFO, file); - dlg.exec(); - //Check whether the file got saved/changed - if(dlg.colorname.isEmpty() || dlg.colorpath.isEmpty() ){ return; } //cancelled - //Reload the color list and activate the new color - // - local color schemes - ui->combo_session_colorfile->clear(); - QStringList tmp = LTHEME::availableLocalColors(); - tmp.sort(); - 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++){ - 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); } - } - -} - -void MainUI::sessionEditTheme(){ - QString file = ui->combo_session_themefile->itemData( ui->combo_session_themefile->currentIndex() ).toString(); - //Open the theme editor dialog - ThemeDialog dlg(this, PINFO, file); - dlg.exec(); - //Check for file change/save - if(dlg.themename.isEmpty() || dlg.themepath.isEmpty()){ return; } //cancelled - //Reload the theme list and activate the new theme - ui->combo_session_themefile->clear(); - // - local theme templates - QStringList tmp = LTHEME::availableLocalThemes(); - tmp.sort(); - 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++){ - 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); } - } -} - -void MainUI::sessionChangeUserIcon(){ - //Prompt for a new image file - QStringList imgformats; - QList<QByteArray> fmts = QImageReader::supportedImageFormats(); - for(int i=0; i<fmts.length(); i++){ - imgformats << "*."+QString(fmts[i]); - } - QString filepath = QFileDialog::getOpenFileName(this, tr("Select an image"), QDir::homePath(), \ - tr("Images")+" ("+imgformats.join(" ")+")"); - if(filepath.isEmpty()){ - //User cancelled the operation - if(QFile::exists(QDir::homePath()+"/.loginIcon.png")){ - if(QMessageBox::Yes == QMessageBox::question(this,tr("Reset User Image"), tr("Would you like to reset the user image to the system default?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){ - //QFile::remove(QDir::homePath()+"/.loginIcon.png"); - ui->push_session_setUserIcon->setWhatsThis("reset"); - }else{ - return; - } - } - }else{ - ui->push_session_setUserIcon->setWhatsThis(filepath); - } - //Now re-load the icon in the UI - QString path = ui->push_session_setUserIcon->whatsThis(); - if(path.isEmpty()){ path = QDir::homePath()+"/.loginIcon.png"; } - if(path=="reset"){ path.clear(); } - ui->push_session_setUserIcon->setIcon( LXDG::findIcon(path, "user-identity") ); - sessionoptchanged(); -} - -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()) ); -} - -void MainUI::sessionLoadTimeSample(){ - if(ui->line_session_time->text().simplified().isEmpty()){ - ui->label_session_timesample->setText( QTime::currentTime().toString(Qt::DefaultLocaleShortDate) ); - }else{ - ui->label_session_timesample->setText( QTime::currentTime().toString( ui->line_session_time->text() ) ); - } - sessionoptchanged(); -} - -void MainUI::sessionShowTimeCodes(){ - QStringList msg; - msg << tr("Valid Time Codes:") << "\n"; - msg << QString(tr("%1: Hour without leading zero (1)")).arg("h"); - msg << QString(tr("%1: Hour with leading zero (01)")).arg("hh"); - msg << QString(tr("%1: Minutes without leading zero (2)")).arg("m"); - msg << QString(tr("%1: Minutes with leading zero (02)")).arg("mm"); - msg << QString(tr("%1: Seconds without leading zero (3)")).arg("s"); - msg << QString(tr("%1: Seconds with leading zero (03)")).arg("ss"); - msg << QString(tr("%1: AM/PM (12-hour) clock (upper or lower case)")).arg("A or a"); - msg << QString(tr("%1: Timezone")).arg("t"); - QMessageBox::information(this, tr("Time Codes"), msg.join("\n") ); -} - -void MainUI::sessionLoadDateSample(){ - if(ui->line_session_date->text().simplified().isEmpty()){ - ui->label_session_datesample->setText( QDate::currentDate().toString(Qt::DefaultLocaleShortDate) ); - }else{ - ui->label_session_datesample->setText( QDate::currentDate().toString( ui->line_session_date->text() ) ); - } - sessionoptchanged(); -} - -void MainUI::sessionShowDateCodes(){ - QStringList msg; - msg << tr("Valid Date Codes:") << "\n"; - msg << QString(tr("%1: Numeric day without a leading zero (1)")).arg("d"); - msg << QString(tr("%1: Numeric day with leading zero (01)")).arg("dd"); - msg << QString(tr("%1: Day as abbreviation (localized)")).arg("ddd"); - msg << QString(tr("%1: Day as full name (localized)")).arg("dddd"); - msg << QString(tr("%1: Numeric month without leading zero (2)")).arg("M"); - msg << QString(tr("%1: Numeric month with leading zero (02)")).arg("MM"); - msg << QString(tr("%1: Month as abbreviation (localized)")).arg("MMM"); - msg << QString(tr("%1: Month as full name (localized)")).arg("MMMM"); - msg << QString(tr("%1: Year as 2-digit number (15)")).arg("yy"); - msg << QString(tr("%1: Year as 4-digit number (2015)")).arg("yyyy"); - msg << tr("Text may be contained within single-quotes to ignore replacements"); - QMessageBox::information(this, tr("Date Codes"), msg.join("\n") ); -} diff --git a/src-qt5/core-utils/lumina-config/mainUI.h b/src-qt5/core-utils/lumina-config/mainUI.h deleted file mode 100644 index da267948..00000000 --- a/src-qt5/core-utils/lumina-config/mainUI.h +++ /dev/null @@ -1,171 +0,0 @@ -//=========================================== -// Lumina-DE source code -// Copyright (c) 2014-2015, Ken Moore -// Available under the 3-clause BSD license -// See the LICENSE file for full details -//=========================================== -#ifndef _LUMINA_CONFIG_MAIN_UI_H -#define _LUMINA_CONFIG_MAIN_UI_H - -// Qt includes -#include <QMainWindow> -#include <QDir> -#include <QDesktopWidget> -#include <QSettings> -#include <QStringList> -#include <QString> -#include <QIcon> -#include <QTimer> -#include <QFileDialog> -#include <QFile> -#include <QTextStream> -#include <QMessageBox> -#include <QColorDialog> -#include <QColor> -#include <QInputDialog> -#include <QListWidgetItem> - -// libLumina includes -#include <LuminaXDG.h> -#include <LuminaThemes.h> - -// local includes -#include "LPlugins.h" -//#include "KeyCatch.h" -#include "AppDialog.h" -#include "ColorDialog.h" -#include "ThemeDialog.h" -#include "GetPluginDialog.h" -#include "PanelWidget.h" - -//namespace for using the *.ui file -namespace Ui{ - class MainUI; -}; - -class MainUI : public QMainWindow{ - Q_OBJECT -public: - MainUI(); - ~MainUI(); - - //Panels Page simplifications - QString getColorStyle(QString current, bool allowTransparency = true); - - //Get an application on the system - XDGDesktop getSysApp(bool allowreset = false); - -private: - Ui::MainUI *ui; //the *.ui file access - QSettings *settings, *appsettings, *sessionsettings; - QDesktopWidget *desktop; - LPlugins *PINFO; - QMenu *ppmenu, *mpmenu; - QString panelcolor; - QString DEFAULTBG; - QList<XDGDesktop> sysApps; - QList<XDGDesktop> STARTAPPS; - bool loading, panadjust; - bool moddesk, modpan, modmenu, modshort, moddef, modses; //page modified flags - int panelnumber; - QList<PanelWidget*> PANELS; - - //General purpose functions (not connected to buttons) - void setupMenus(); //called during initialization - void setupConnections(); //called during intialization - - int currentDesktop(); //the number for the current desktop - - //Convert to/from fluxbox keyboard shortcuts - QString dispToFluxKeys(QString); - QString fluxToDispKeys(QString); - - //Read/overwrite a text file - QStringList readFile(QString path); - bool overwriteFile(QString path, QStringList contents); - -public slots: - void setupIcons(); //called during initialization - -private slots: - void slotSingleInstance(); - - //General UI Behavior - void slotChangePage(bool enabled); - void slotChangeScreen(); - void saveAndQuit(); - - //General Utility Functions - void loadCurrentSettings(bool screenonly = false); - void saveCurrentSettings(bool screenonly = false); - - //Desktop Page - //void deskplugchanged(); - void deskbgchanged(); - void desktimechanged(); - void deskbgremoved(); - void deskbgadded(); - void deskbgcoloradded(); - void deskbgdiradded(); - void deskbgdirradded(); - void deskplugadded(); - void deskplugremoved(); - - - //Panels Page - void panelValChanged(); - void newPanel(); - void removePanel(int); //connected to a signal from the panel widget - void loadPanels(); - void savePanels(); - - //Menu Page/Tab - void addmenuplugin(); - void rmmenuplugin(); - void upmenuplugin(); - void downmenuplugin(); - void checkmenuicons(); - - //Shortcuts Page - void loadKeyboardShortcuts(); - void saveKeyboardShortcuts(); - void clearKeyBinding(); - void applyKeyBinding(); - void updateKeyConfig(); - //void getKeyPress(); - - //Defaults Page - void changeDefaultBrowser(); - void changeDefaultEmail(); - void changeDefaultFileManager(); - void changeDefaultTerminal(); - void loadDefaultSettings(); - //void saveDefaultSettings(); - void cleardefaultitem(); - void setdefaultitem(); - void setdefaultbinary(); - void checkdefaulticons(); - - //Session Page - void loadSessionSettings(); - void saveSessionSettings(); - void rmsessionstartitem(); - void addsessionstartapp(); - void addsessionstartbin(); - void addsessionstartfile(); - void sessionoptchanged(); - void sessionthemechanged(); - void sessionCursorChanged(); - //void sessionstartchanged(); - void sessionEditColor(); - void sessionEditTheme(); - void sessionChangeUserIcon(); - void sessionResetSys(); - void sessionResetLumina(); - void sessionLoadTimeSample(); - void sessionShowTimeCodes(); - void sessionLoadDateSample(); - void sessionShowDateCodes(); -}; - -#endif diff --git a/src-qt5/core-utils/lumina-config/mainUI.ui b/src-qt5/core-utils/lumina-config/mainUI.ui deleted file mode 100644 index 9edff2e7..00000000 --- a/src-qt5/core-utils/lumina-config/mainUI.ui +++ /dev/null @@ -1,1792 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MainUI</class> - <widget class="QMainWindow" name="MainUI"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>660</width> - <height>448</height> - </rect> - </property> - <property name="windowTitle"> - <string>Lumina Settings</string> - </property> - <property name="animated"> - <bool>true</bool> - </property> - <property name="documentMode"> - <bool>false</bool> - </property> - <property name="unifiedTitleAndToolBarOnMac"> - <bool>false</bool> - </property> - <widget class="QWidget" name="centralwidget"> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <item> - <widget class="QFrame" name="group_screen"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Raised</enum> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_18"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>1</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>1</number> - </property> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>195</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="label_screen"> - <property name="text"> - <string>Screen Number:</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="spin_screen"> - <property name="minimum"> - <number>1</number> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_4"> - <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> - <item> - <widget class="QStackedWidget" name="stackedWidget"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="currentIndex"> - <number>4</number> - </property> - <widget class="QWidget" name="page_desktop"> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QTabWidget" name="tabWidget_desktop"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab_wallpaper"> - <attribute name="title"> - <string>Wallpaper</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_16"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QToolButton" name="tool_desk_addbg"> - <property name="text"> - <string notr="true"/> - </property> - <property name="popupMode"> - <enum>QToolButton::InstantPopup</enum> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_desk_rmbg"> - <property name="text"> - <string notr="true">rm</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="combo_desk_bg"/> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_5"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="Line" name="line_4"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_desk_res"> - <property name="text"> - <string notr="true">(Resolution)</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radio_desk_single"> - <property name="text"> - <string>Single Background</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radio_desk_multi"> - <property name="text"> - <string>Rotate Background</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="spin_desk_min"> - <property name="suffix"> - <string> Minutes</string> - </property> - <property name="prefix"> - <string>Every </string> - </property> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>120</number> - </property> - <property name="value"> - <number>5</number> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_26"> - <property name="text"> - <string>Layout:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="combo_desk_layout"/> - </item> - <item> - <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> - </item> - <item> - <widget class="QLabel" name="label_desk_bgview"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> - </property> - <property name="text"> - <string notr="true">BG-sample</string> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_themes"> - <attribute name="title"> - <string>Theme</string> - </attribute> - <layout class="QFormLayout" name="formLayout_5"> - <item row="0" column="0"> - <widget class="QLabel" name="label_12"> - <property name="text"> - <string>Font:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QFontComboBox" name="font_session_theme"> - <property name="editable"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_14"> - <property name="text"> - <string>Font Size:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="spin_session_fontsize"> - <property name="suffix"> - <string> point</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_16"> - <property name="text"> - <string>Theme Template:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_12"> - <item> - <widget class="QComboBox" name="combo_session_themefile"> - <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToContents</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_session_newtheme"> - <property name="toolTip"> - <string>Create/Edit a theme template (Advanced)</string> - </property> - <property name="statusTip"> - <string/> - </property> - <property name="text"> - <string>Edit</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_17"> - <property name="text"> - <string>Color Scheme:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_19"> - <item> - <widget class="QComboBox" name="combo_session_colorfile"> - <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToContents</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_session_newcolor"> - <property name="toolTip"> - <string>Create/Edit a color scheme</string> - </property> - <property name="statusTip"> - <string/> - </property> - <property name="text"> - <string>Edit</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_18"> - <property name="text"> - <string>Icon Pack:</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="combo_session_icontheme"/> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_31"> - <property name="text"> - <string>Mouse Cursors:</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QComboBox" name="combo_session_cursortheme"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_cursor_sample"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string notr="true"/> - </property> - <property name="text"> - <string notr="true"/> - </property> - <property name="scaledContents"> - <bool>true</bool> - </property> - <property name="alignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_panels"> - <layout class="QVBoxLayout" name="verticalLayout_17"> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QTabWidget" name="tabWidget_panels"> - <property name="currentIndex"> - <number>1</number> - </property> - <widget class="QWidget" name="tab_desktopInterface"> - <attribute name="title"> - <string>Desktop</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_3"> - <item row="0" column="0"> - <widget class="QLabel" name="label_10"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Quick-Access Menu</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item row="0" column="1" rowspan="5"> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - </widget> - </item> - <item row="0" column="2" colspan="2"> - <widget class="QLabel" name="label_15"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Embedded Utilities</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item row="1" column="0" rowspan="2"> - <widget class="QListWidget" name="list_menu"/> - </item> - <item row="1" column="2" colspan="2"> - <widget class="QListWidget" name="list_desktop_plugins"> - <property name="selectionMode"> - <enum>QAbstractItemView::ExtendedSelection</enum> - </property> - <property name="sortingEnabled"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="2" column="3"> - <layout class="QHBoxLayout" name="horizontalLayout_6"> - <item> - <widget class="QToolButton" name="tool_desktop_addplugin"> - <property name="text"> - <string notr="true">add</string> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_desktop_rmplugin"> - <property name="text"> - <string notr="true">rem</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_5"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>10</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="3" column="0" rowspan="2"> - <layout class="QHBoxLayout" name="horizontalLayout_13"> - <item> - <widget class="QToolButton" name="tool_menu_add"> - <property name="text"> - <string notr="true">add</string> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_menu_rm"> - <property name="text"> - <string notr="true">rem</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_9"> - <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="QToolButton" name="tool_menu_up"> - <property name="text"> - <string notr="true">up</string> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_menu_dn"> - <property name="text"> - <string notr="true">dn</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="4" column="3"> - <widget class="QCheckBox" name="check_desktop_autolaunchers"> - <property name="text"> - <string>Display Desktop Folder Contents</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_panels"> - <attribute name="title"> - <string>Panels</string> - </attribute> - <layout class="QGridLayout" name="gridLayout_panels" rowstretch="0" columnstretch="0,0"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="rightMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <property name="horizontalSpacing"> - <number>2</number> - </property> - <item row="0" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_5"> - <item> - <widget class="QToolButton" name="tool_panels_add"> - <property name="text"> - <string notr="true">add</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer_3"> - <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> - </item> - <item row="0" column="1"> - <widget class="QScrollArea" name="scroll_panels"> - <property name="sizeAdjustPolicy"> - <enum>QAbstractScrollArea::AdjustToContents</enum> - </property> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents_2"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>98</width> - <height>28</height> - </rect> - </property> - </widget> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_shortcuts"> - <layout class="QVBoxLayout" name="verticalLayout_8"> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QTreeWidget" name="tree_shortcut"> - <property name="indentation"> - <number>0</number> - </property> - <property name="rootIsDecorated"> - <bool>false</bool> - </property> - <property name="itemsExpandable"> - <bool>false</bool> - </property> - <property name="sortingEnabled"> - <bool>true</bool> - </property> - <property name="expandsOnDoubleClick"> - <bool>false</bool> - </property> - <attribute name="headerDefaultSectionSize"> - <number>200</number> - </attribute> - <attribute name="headerHighlightSections"> - <bool>true</bool> - </attribute> - <attribute name="headerMinimumSectionSize"> - <number>200</number> - </attribute> - <attribute name="headerShowSortIndicator" stdset="0"> - <bool>true</bool> - </attribute> - <column> - <property name="text"> - <string>Action</string> - </property> - </column> - <column> - <property name="text"> - <string>Keyboard Shortcut</string> - </property> - </column> - </widget> - </item> - <item> - <widget class="QGroupBox" name="group_shortcut_modify"> - <property name="title"> - <string>Modify Shortcut</string> - </property> - <layout class="QGridLayout" name="gridLayout_4"> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item row="0" column="3"> - <widget class="QKeySequenceEdit" name="keyEdit_shortcut"/> - </item> - <item row="0" column="0"> - <widget class="QToolButton" name="tool_shortcut_clear"> - <property name="text"> - <string>Clear Shortcut</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="QToolButton" name="tool_shortcut_set"> - <property name="text"> - <string>Apply Change</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QLabel" name="label_32"> - <property name="text"> - <string>Change Key Binding:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <spacer name="horizontalSpacer_10"> - <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> - <item> - <widget class="QLabel" name="label_11"> - <property name="text"> - <string>Note: Current key bindings need to be cleared and saved before they can be re-used.</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_defaults"> - <layout class="QVBoxLayout" name="verticalLayout_9"> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QTabWidget" name="tabWidget_apps"> - <property name="currentIndex"> - <number>0</number> - </property> - <widget class="QWidget" name="tab_auto"> - <attribute name="title"> - <string>Auto-Started</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_19"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_17"> - <item> - <spacer name="horizontalSpacer_14"> - <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="QToolButton" name="tool_session_addapp"> - <property name="text"> - <string>Application</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_session_addbin"> - <property name="text"> - <string>Binary</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_session_addfile"> - <property name="text"> - <string>File</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QListWidget" name="list_session_start"> - <property name="sortingEnabled"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_defaults"> - <attribute name="title"> - <string>File Defaults</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_6"> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>3</number> - </property> - <property name="bottomMargin"> - <number>3</number> - </property> - <item> - <widget class="QGroupBox" name="group_default_filetypes"> - <property name="font"> - <font> - <italic>false</italic> - </font> - </property> - <property name="title"> - <string>Specific File Types</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_15"> - <property name="leftMargin"> - <number>2</number> - </property> - <property name="rightMargin"> - <number>2</number> - </property> - <item> - <widget class="QTreeWidget" name="tree_defaults"> - <property name="iconSize"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - <property name="indentation"> - <number>20</number> - </property> - <property name="sortingEnabled"> - <bool>true</bool> - </property> - <property name="animated"> - <bool>true</bool> - </property> - <property name="allColumnsShowFocus"> - <bool>true</bool> - </property> - <attribute name="headerDefaultSectionSize"> - <number>200</number> - </attribute> - <attribute name="headerMinimumSectionSize"> - <number>150</number> - </attribute> - <column> - <property name="text"> - <string>Type/Group</string> - </property> - </column> - <column> - <property name="text"> - <string>Default Application</string> - </property> - </column> - <column> - <property name="text"> - <string>Description</string> - </property> - </column> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_16"> - <item> - <widget class="QToolButton" name="tool_defaults_clear"> - <property name="text"> - <string>Clear</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_13"> - <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="QToolButton" name="tool_defaults_set"> - <property name="text"> - <string>Set App</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="tool_defaults_setbin"> - <property name="text"> - <string>Set Binary</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_2"> - <attribute name="title"> - <string>Common Applications</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_7"> - <item> - <layout class="QGridLayout" name="gridLayout_6"> - <item row="0" column="0"> - <layout class="QFormLayout" name="formLayout_10"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::ExpandingFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_37"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Web Browser:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QToolButton" name="tool_default_webbrowser"> - <property name="text"> - <string notr="true">...</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_38"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>E-Mail Client:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QToolButton" name="tool_default_email"> - <property name="text"> - <string notr="true">...</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </item> - <item row="0" column="1"> - <layout class="QFormLayout" name="formLayout_11"> - <item row="0" column="0"> - <widget class="QLabel" name="label_39"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>File Manager:</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_40"> - <property name="font"> - <font> - <weight>75</weight> - <bold>true</bold> - </font> - </property> - <property name="text"> - <string>Virtual Terminal:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QToolButton" name="tool_default_filemanager"> - <property name="text"> - <string>...</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QToolButton" name="tool_default_terminal"> - <property name="text"> - <string>...</string> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextBesideIcon</enum> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer_4"> - <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> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_session"> - <layout class="QVBoxLayout" name="verticalLayout_10"> - <property name="leftMargin"> - <number>3</number> - </property> - <property name="topMargin"> - <number>2</number> - </property> - <property name="bottomMargin"> - <number>2</number> - </property> - <item> - <widget class="QTabWidget" name="tabWidget_session"> - <property name="toolTip"> - <string/> - </property> - <property name="currentIndex"> - <number>2</number> - </property> - <widget class="QWidget" name="tab"> - <attribute name="title"> - <string>General Options</string> - </attribute> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <item> - <widget class="QCheckBox" name="check_session_numlock"> - <property name="text"> - <string>Enable numlock on startup</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="check_session_playloginaudio"> - <property name="text"> - <string>Play chimes on startup</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="check_session_playlogoutaudio"> - <property name="text"> - <string>Play chimes on exit</string> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_14"> - <item> - <widget class="QPushButton" name="push_session_setUserIcon"> - <property name="text"> - <string>Change User Icon</string> - </property> - <property name="iconSize"> - <size> - <width>32</width> - <height>32</height> - </size> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_16"> - <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> - </item> - </layout> - </item> - <item row="6" column="0" colspan="2"> - <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> - <item row="0" column="1" rowspan="2"> - <layout class="QFormLayout" name="formLayout_3"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <property name="labelAlignment"> - <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="label_24"> - <property name="text"> - <string>Time Format:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLineEdit" name="line_session_time"/> - </item> - <item> - <widget class="QToolButton" name="tool_help_time"> - <property name="toolTip"> - <string>View format codes</string> - </property> - <property name="text"> - <string notr="true">...</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_28"> - <property name="text"> - <string>Sample:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="label_session_timesample"> - <property name="text"> - <string notr="true"/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_25"> - <property name="text"> - <string>Date Format:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <layout class="QHBoxLayout" name="horizontalLayout_21"> - <item> - <widget class="QLineEdit" name="line_session_date"/> - </item> - <item> - <widget class="QToolButton" name="tool_help_date"> - <property name="toolTip"> - <string>View format codes</string> - </property> - <property name="text"> - <string notr="true">...</string> - </property> - <property name="autoRaise"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_29"> - <property name="text"> - <string>Sample:</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLabel" name="label_session_datesample"> - <property name="text"> - <string notr="true"/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_27"> - <property name="text"> - <string>Display Format</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="combo_session_datetimeorder"/> - </item> - </layout> - </item> - <item row="1" column="0"> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>128</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_locale"> - <attribute name="title"> - <string>Locale</string> - </attribute> - <layout class="QFormLayout" name="formLayout"> - <item row="1" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Language</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="combo_locale_lang"/> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_4"> - <property name="text"> - <string>Messages</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="combo_locale_message"/> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string>Time</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QComboBox" name="combo_locale_time"/> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="label_7"> - <property name="text"> - <string>Numeric</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QComboBox" name="combo_locale_numeric"/> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="label_8"> - <property name="text"> - <string>Monetary</string> - </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QComboBox" name="combo_locale_monetary"/> - </item> - <item row="6" column="0"> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>Collate</string> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QComboBox" name="combo_locale_collate"/> - </item> - <item row="7" column="0"> - <widget class="QLabel" name="label_23"> - <property name="text"> - <string>CType</string> - </property> - </widget> - </item> - <item row="7" column="1"> - <widget class="QComboBox" name="combo_locale_ctype"/> - </item> - <item row="0" column="0" colspan="2"> - <widget class="QLabel" name="label_30"> - <property name="text"> - <string>System localization settings (restart required)</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="tab_fluxbox"> - <attribute name="title"> - <string>Window System</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_14"> - <item> - <layout class="QFormLayout" name="formLayout_4"> - <item row="0" column="0"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Number of Workspaces</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QSpinBox" name="spin_session_wkspaces"> - <property name="minimum"> - <number>1</number> - </property> - <property name="maximum"> - <number>10</number> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>New Window Placement</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QComboBox" name="combo_session_wloc"/> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Focus Policy</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="combo_session_wfocus"/> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="label_13"> - <property name="text"> - <string>Window Theme</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="QComboBox" name="combo_session_wtheme"/> - </item> - </layout> - </item> - <item> - <widget class="QGroupBox" name="group_session_preview"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Window Theme Preview</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_12"> - <item> - <widget class="QScrollArea" name="scrollArea"> - <property name="widgetResizable"> - <bool>true</bool> - </property> - <widget class="QWidget" name="scrollAreaWidgetContents"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>573</width> - <height>97</height> - </rect> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <layout class="QVBoxLayout" name="verticalLayout_13"> - <property name="leftMargin"> - <number>1</number> - </property> - <property name="topMargin"> - <number>1</number> - </property> - <property name="rightMargin"> - <number>1</number> - </property> - <property name="bottomMargin"> - <number>1</number> - </property> - <item> - <widget class="QLabel" name="label_session_wpreview"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - <property name="text"> - <string>No Preview Available</string> - </property> - <property name="scaledContents"> - <bool>false</bool> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <property name="topMargin"> - <number>4</number> - </property> - <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="push_save"> - <property name="text"> - <string>Save Changes</string> - </property> - <property name="shortcut"> - <string>Ctrl+S</string> - </property> - <property name="flat"> - <bool>false</bool> - </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> - </layout> - </item> - </layout> - </widget> - <widget class="QToolBar" name="toolBar"> - <property name="minimumSize"> - <size> - <width>120</width> - <height>0</height> - </size> - </property> - <property name="contextMenuPolicy"> - <enum>Qt::CustomContextMenu</enum> - </property> - <property name="windowTitle"> - <string>toolBar</string> - </property> - <property name="movable"> - <bool>false</bool> - </property> - <property name="toolButtonStyle"> - <enum>Qt::ToolButtonTextUnderIcon</enum> - </property> - <property name="floatable"> - <bool>false</bool> - </property> - <attribute name="toolBarArea"> - <enum>TopToolBarArea</enum> - </attribute> - <attribute name="toolBarBreak"> - <bool>false</bool> - </attribute> - <addaction name="actionDesktop"/> - <addaction name="actionPanels"/> - <addaction name="actionDefaults"/> - <addaction name="actionShortcuts"/> - <addaction name="actionSession"/> - </widget> - <action name="actionDesktop"> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="text"> - <string>Appearance</string> - </property> - <property name="iconText"> - <string> Appearance </string> - </property> - <property name="toolTip"> - <string>Desktop Appearance</string> - </property> - </action> - <action name="actionPanels"> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="text"> - <string> Interface </string> - </property> - <property name="iconText"> - <string> Interface </string> - </property> - <property name="toolTip"> - <string>Interface Configuration</string> - </property> - </action> - <action name="actionSession"> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="text"> - <string> Session </string> - </property> - <property name="iconText"> - <string> Session </string> - </property> - <property name="toolTip"> - <string>Session Options</string> - </property> - </action> - <action name="actionDefaults"> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="text"> - <string>Applications</string> - </property> - <property name="iconText"> - <string> Applications </string> - </property> - <property name="toolTip"> - <string>Application Management</string> - </property> - </action> - <action name="actionShortcuts"> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="text"> - <string>Shortcuts</string> - </property> - <property name="iconText"> - <string> Shortcuts </string> - </property> - <property name="toolTip"> - <string>Keyboard Shortcuts</string> - </property> - </action> - </widget> - <resources/> - <connections/> -</ui> diff --git a/src-qt5/core-utils/lumina-config/mainWindow.cpp b/src-qt5/core-utils/lumina-config/mainWindow.cpp index 3102fe7b..0bb3cbf0 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.cpp +++ b/src-qt5/core-utils/lumina-config/mainWindow.cpp @@ -86,6 +86,10 @@ void mainWindow::changePage(QString id){ connect(page, SIGNAL(ChangePage(QString)), this, SLOT(page_change(QString)) ); page->setFocus(); ui->toolBar->setVisible( !cpage.isEmpty() ); + }else{ + //No change in page (some other refresh) + // just re-use the current widget + page = static_cast<PageWidget*>(this->centralWidget()); } //Now load the new page page->LoadSettings(ui->actionMonitor->whatsThis().toInt()); //need to make this show the current screen as needed 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 ec03f8a5..976e7c69 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_main.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_main.cpp @@ -14,6 +14,7 @@ page_main::page_main(QWidget *parent) : PageWidget(parent), ui(new Ui::page_main()){ ui->setupUi(this); ui->treeWidget->setMouseTracking(true); + ui->treeWidget->setSortingEnabled(false); //the QTreeView sort flag always puts them in backwards (reverse-alphabetical) connect(ui->treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); connect(ui->treeWidget, SIGNAL(itemClicked(QTreeWidgetItem*,int)), this, SLOT(itemTriggered(QTreeWidgetItem*)) ); connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(searchChanged(QString)) ); @@ -65,10 +66,11 @@ void page_main::UpdateItems(QString search){ else{ ui->treeWidget->addTopLevelItem(it); } } //Now add the categories to the tree widget if they are non-empty - if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); interface->setExpanded(true); } - if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); appearance->setExpanded(true); } - if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); session->setExpanded(true); } - if(user->childCount()>0){ ui->treeWidget->addTopLevelItem(user); user->setExpanded(true); } + if(interface->childCount()>0){ ui->treeWidget->addTopLevelItem(interface); interface->setExpanded(!search.isEmpty()); } + if(appearance->childCount()>0){ ui->treeWidget->addTopLevelItem(appearance); appearance->setExpanded(!search.isEmpty()); } + if(session->childCount()>0){ ui->treeWidget->addTopLevelItem(session); session->setExpanded(!search.isEmpty()); } + if(user->childCount()>0){ ui->treeWidget->addTopLevelItem(user); user->setExpanded(!search.isEmpty()); } + ui->treeWidget->sortItems(0, Qt::AscendingOrder); } //================ -- cgit From f7e5fc2a5fc9795fa7cc3203d133d2eb5b1d09a5 Mon Sep 17 00:00:00 2001 From: q5sys <jt@obs-sec.com> Date: Tue, 28 Jun 2016 10:28:45 -0400 Subject: Add files via upload --- .../defaults/desktop-background-trueos.jpg | Bin 0 -> 4005674 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg diff --git a/src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg b/src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg new file mode 100644 index 00000000..de11074e Binary files /dev/null and b/src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg differ -- cgit From 89cf83b31069cd3358ef31083faaa717f551eec9 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Tue, 28 Jun 2016 11:22:58 -0400 Subject: Commit some WIP (but disabled) to get the panels using the compositing WM for transparency effects (issues with xcompmgr at the moment?). --- src-qt5/core/lumina-desktop/LPanel.cpp | 29 ++++++++++++++--------- src-qt5/core/lumina-desktop/LPanel.h | 2 +- src-qt5/core/lumina-desktop/panel-plugins/NewPP.h | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src-qt5/core/lumina-desktop/LPanel.cpp b/src-qt5/core/lumina-desktop/LPanel.cpp index 7c0630f5..55ec5469 100644 --- a/src-qt5/core/lumina-desktop/LPanel.cpp +++ b/src-qt5/core/lumina-desktop/LPanel.cpp @@ -13,6 +13,7 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ //Take care of inputs this->setMouseTracking(true); + hascompositer = false; //LUtils::isValidBinary("xcompmgr"); //NOT WORKING YET - xcompmgr issue with special window flags? if(DEBUG){ qDebug() << " - Creating Panel:" << scr << num; } bgWindow = parent; //save for later //Setup the widget overlay for the entire panel to provide transparency effects @@ -42,7 +43,7 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ this->setWindowTitle("LuminaPanel"); this->setObjectName("LuminaPanelBackgroundWidget"); - this->setStyleSheet("QToolButton::menu-indicator{ image: none; }"); + this->setStyleSheet("QToolButton::menu-indicator{ image: none; } QWidget#LuminaPanelBackgroundWidget{ background: transparent; }"); panelArea->setObjectName("LuminaPanelColor"); layout = new QBoxLayout(QBoxLayout::LeftToRight); layout->setContentsMargins(0,0,0,0); @@ -53,7 +54,11 @@ LPanel::LPanel(QSettings *file, int scr, int num, QWidget *parent) : QWidget(){ this->show(); LSession::handle()->XCB->SetAsPanel(this->winId()); LSession::handle()->XCB->SetAsSticky(this->winId()); - + if(hascompositer){ + //qDebug() << "Enable Panel compositing"; + this->setWindowOpacity(0.0); //fully transparent background for the main widget + panelArea->setWindowOpacity(0.0); + } QTimer::singleShot(1,this, SLOT(UpdatePanel()) ); //start this in a new thread //connect(screen, SIGNAL(resized(int)), this, SLOT(UpdatePanel()) ); //in case the screen resolution changes } @@ -309,15 +314,17 @@ void LPanel::checkPanelFocus(){ // PROTECTED //=========== void LPanel::paintEvent(QPaintEvent *event){ - QPainter *painter = new QPainter(this); - //qDebug() << "Paint Tray:"; - //Make sure the base background of the event rectangle is the associated rectangle from the BGWindow - QRect rec = this->geometry(); //start with the global geometry of the panel - //Need to translate that rectangle to the background image coordinates - //qDebug() << " - Rec:" << rec << hidden << this->geometry(); - rec.moveTo( rec.x()-LSession::handle()->screenGeom(screennum).x(), rec.y() ); - //qDebug() << " - Adjusted Global Rec:" << rec; - painter->drawPixmap(QRect(0,0,this->width(), this->height()), bgWindow->grab(rec) ); + if(!hascompositer){ + QPainter *painter = new QPainter(this); + //qDebug() << "Paint Tray:"; + //Make sure the base background of the event rectangle is the associated rectangle from the BGWindow + QRect rec = this->geometry(); //start with the global geometry of the panel + //Need to translate that rectangle to the background image coordinates + //qDebug() << " - Rec:" << rec << hidden << this->geometry(); + rec.moveTo( rec.x()-LSession::handle()->screenGeom(screennum).x(), rec.y() ); + //qDebug() << " - Adjusted Global Rec:" << rec; + painter->drawPixmap(QRect(0,0,this->width(), this->height()), bgWindow->grab(rec) ); + } QWidget::paintEvent(event); //now pass the event along to the normal painting event } diff --git a/src-qt5/core/lumina-desktop/LPanel.h b/src-qt5/core/lumina-desktop/LPanel.h index 396ffecc..b3c9ba60 100644 --- a/src-qt5/core/lumina-desktop/LPanel.h +++ b/src-qt5/core/lumina-desktop/LPanel.h @@ -36,7 +36,7 @@ private: QDesktopWidget *screen; QWidget *bgWindow, *panelArea; QPoint hidepoint, showpoint; //for hidden panels: locations when hidden/visible - bool defaultpanel, horizontal, hidden; + bool defaultpanel, horizontal, hidden, hascompositer; int screennum; int panelnum; int viswidth; diff --git a/src-qt5/core/lumina-desktop/panel-plugins/NewPP.h b/src-qt5/core/lumina-desktop/panel-plugins/NewPP.h index 50bf2232..2641ad79 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/NewPP.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/NewPP.h @@ -50,7 +50,7 @@ public: plug = new LSysTray(parent, plugin, horizontal); }else if(plugin.startsWith("desktopswitcher---")){ plug = new LDesktopSwitcher(parent, plugin, horizontal); - }else if(plugin.startsWith("battery---")){ + }else if(plugin.startsWith("battery---") && LOS::hasBattery()){ plug = new LBattery(parent, plugin, horizontal); }else if(plugin.startsWith("clock---")){ plug = new LClock(parent, plugin, horizontal); -- cgit From 2979715098badeeedca5709817d7944ca16d2d69 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Tue, 28 Jun 2016 12:50:54 -0400 Subject: Cleanup the build system for how the special OS-specific config file/wallpaper are added into the build. This now means that we can commit any generic *-${OS}.[jpg/conf] here to the defaults directory and it will automatically get pulled in at build time. --- .../core/lumina-desktop/defaults/defaultapps.conf | 1 - .../defaults/desktop-background-TrueOS.jpg | Bin 0 -> 4005674 bytes .../defaults/desktop-background-trueos.jpg | Bin 4005674 -> 0 bytes .../defaults/desktop-background.pcbsd.jpg | Bin 3237484 -> 0 bytes .../lumina-desktop/defaults/desktopsettings.conf | 1 - .../defaults/luminaDesktop-TrueOS.conf | 98 +++++++++++++++++++ .../lumina-desktop/defaults/luminaDesktop.conf | 2 +- .../defaults/luminaDesktop.pcbsd.conf | 105 --------------------- src-qt5/core/lumina-desktop/lumina-desktop.pro | 18 +++- 9 files changed, 113 insertions(+), 112 deletions(-) delete mode 100644 src-qt5/core/lumina-desktop/defaults/defaultapps.conf create mode 100644 src-qt5/core/lumina-desktop/defaults/desktop-background-TrueOS.jpg delete mode 100644 src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg delete mode 100644 src-qt5/core/lumina-desktop/defaults/desktop-background.pcbsd.jpg delete mode 100644 src-qt5/core/lumina-desktop/defaults/desktopsettings.conf create mode 100644 src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf delete mode 100644 src-qt5/core/lumina-desktop/defaults/luminaDesktop.pcbsd.conf diff --git a/src-qt5/core/lumina-desktop/defaults/defaultapps.conf b/src-qt5/core/lumina-desktop/defaults/defaultapps.conf deleted file mode 100644 index 8b137891..00000000 --- a/src-qt5/core/lumina-desktop/defaults/defaultapps.conf +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src-qt5/core/lumina-desktop/defaults/desktop-background-TrueOS.jpg b/src-qt5/core/lumina-desktop/defaults/desktop-background-TrueOS.jpg new file mode 100644 index 00000000..de11074e Binary files /dev/null and b/src-qt5/core/lumina-desktop/defaults/desktop-background-TrueOS.jpg differ diff --git a/src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg b/src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg deleted file mode 100644 index de11074e..00000000 Binary files a/src-qt5/core/lumina-desktop/defaults/desktop-background-trueos.jpg and /dev/null differ diff --git a/src-qt5/core/lumina-desktop/defaults/desktop-background.pcbsd.jpg b/src-qt5/core/lumina-desktop/defaults/desktop-background.pcbsd.jpg deleted file mode 100644 index 80c3cf02..00000000 Binary files a/src-qt5/core/lumina-desktop/defaults/desktop-background.pcbsd.jpg and /dev/null differ diff --git a/src-qt5/core/lumina-desktop/defaults/desktopsettings.conf b/src-qt5/core/lumina-desktop/defaults/desktopsettings.conf deleted file mode 100644 index 8b137891..00000000 --- a/src-qt5/core/lumina-desktop/defaults/desktopsettings.conf +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf new file mode 100644 index 00000000..f3f4a7bc --- /dev/null +++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop-TrueOS.conf @@ -0,0 +1,98 @@ +#This is the configuration file that generates all the default settings files for the Lumina desktop +# For any setting that can take a list of values, each vale needs to be seperated by a comma and a space (", ") +# Example: some_setting=item1, item2, item3 + +#NOTE: To pre-setup default applications for particular mime-types, you need to create *.desktop entries on +# system corresponding to the XDG mime-type specifications for default applications +# See Here for specifications: http://www.freedesktop.org/wiki/Specifications/mime-apps-spec/ + +# Possible Desktop Plugins (Lumina version 0.9.1): +# calendar, applauncher[::absolute path to *.desktop file], desktopview, notepad, audioplayer, rssreader +# Possible Panel Plugins (Lumina version 0.9.1): +# userbutton, desktopbar, spacer, desktopswitcher, battery, clock, systemdashboard, systemstart +# taskmanager[-nogroups], systemtray, homebutton, appmenu, applauncher[::absolute path to *.desktop file] +# Possible Menu Plugins (Lumina version 0.9.1): +# terminal, filemanager, applications, line, settings, windowlist, app::<absolute path to *.desktop file> + +#GENERAL SESSION SETTINGS +session_enablenumlock=false #[true/false] Enable numlock on login using "numlockx" +session_playloginaudio=true #[true/false] Play the audio chimes on log in +session_playlogoutaudio=true #[true/false] Play the audio chimes on log out + +# DEFAULT UTILITIES +# Provide the full path to *.desktop file, or a binary name which exists on PATH +# *.desktop files provide better support for input formats, and are recommended +#Note: the last "ifexists" entry has the highest priority for each session utility +session_default_terminal_ifexists=xterm.desktop +session_default_terminal_ifexists=lumina-terminal.desktop +session_default_filemanager=lumina-fm.desktop +session_default_webbrowser_ifexists=chromium-browser.desktop +session_default_webbrowser_ifexists=firefox.desktop +session_default_webbrowser_ifexists=qupzilla.desktop +session_default_email_ifexists=trojita.desktop + +#DEFAULT UTILITIES FOR INDIVIDUAL MIME TYPES +# Format: mime_default_<mimetype>[_ifexists]=<*.desktop file> +mime_default_text/*_ifexists=lumina-textedit.desktop +mime_default_audio/*_ifexists=vlc.desktop +mime_default_video/*_ifexists=vlc.desktop +mime_default_application/zip_ifexists=peazip.desktop +mime_default_application/x-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-bzip-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-lrzip-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-lzma-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-xz-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-tar_ifexists=peazip.desktop +mime_default_unknown/*=lumina-textedit.desktop +mime_default_application/x-shellscript=lumina-textedit.desktop + +#THEME SETTINGS +theme_themefile=Glass #Name of the theme to use (disable for Lumina-Default) +theme_colorfile=Grey-Dark #Name of the color spec file to use for theming +theme_iconset=oxygen #Name of the icon theme to use +theme_font=Arial #Name of the font family to use +theme_fontsize=10pt #Default size of the fonts to use on the desktop (can also use a percentage of the screen height (<number>%) ) + +#DESKTOP SETTINGS (used for the primary screen in multi-screen setups) +desktop_visiblepanels=2 #[0 - 12] The number of panels visible by default +#desktop.backgroundfiles= #list of absolute file paths for image files (disable for Lumina default) +desktop_backgroundrotateminutes=5 #[positive integer] number of minutes between background rotations (if multiple files) +desktop_plugins=rssreader #list of plugins to be shown on the desktop by default +desktop_generate_icons=true #[true/false] Auto-generate launchers for ~/Desktop items + +#PANEL SETTINGS (preface with panel1.<setting> or panel2.<setting>, depending on the number of panels you have visible by default) +panel1_location=bottom #[top/bottom/left/right] Screen edge the panel should be on +panel1_pixelsize=3.5%H #number of pixels wide/high the panel should be (or <number>%[W/H] for a percentage of the screen width/height) +panel1_autohide=false #[true/false] Have the panel become visible on mouse-over +panel1_plugins=systemstart, taskmanager-nogroups, spacer, systemtray, clock, battery #list of plugins for the panel +panel1_pinlocation=center #[left/center/right] Note:[left/right] corresponds to [top/bottom] for vertical panels +panel1_edgepercent=99 #[1->100] percentage of the screen edge to use + +#MENU SETTINGS (right-click menu) +menu_plugins=terminal, filemanager, applications, line, settings #list of menu plugins to show + +#FAVORITES CUSTOMIZATION +#favorites_add=<file/dir path> #Create a favorites entry for this file/dir +#favorites_remove=<file/dir path> #Remove a favorites entry for this file/dir +#favorites_add_ifexists=<file/dir path> #Create a favorites entry for this file/dir if the file/dir exists +favorites_add_ifexists=firefox.desktop +favorites_add_ifexists=chromium-browser.desktop +favorites_add_ifexists=qupzilla.desktop +favorites_add_ifexists=thunderbird.desktop +favorites_add_ifexists=trojita.desktop +favorites_add_ifexists=smplayer.desktop +favorites_add_ifexists=vlc.desktop +favorites_add_ifexists=pithos.desktop +favorites_add_ifexists=~/Documents +favorites_add_ifexists=~/Downloads +favorites_add_ifexists=~/Pictures +favorites_add_ifexists=~/Videos + +#QUICKLAUNCH CUSTOMIZATION (requires the use of the "systemstart" panel plugin) +#quicklaunch_add=<file/dir path> #Create a quicklaunch shortcut for this file/dir +#quicklaunch_add_ifexists=<file/dir path> #Create a quicklaunch shortcut for this file/dir if the file/dir exists + +#Generic scripts/utilities to run for any additional setup procedures +# These are always run after all other settings are saved +#Format: usersetup_run=<generic command to run> +usersetup_run=xdg-user-dirs-update diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf index 68ea1f3c..7f8e363c 100644 --- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf +++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf @@ -64,7 +64,7 @@ desktop_generate_icons=true #[true/false] Auto-generate launchers for ~/Desktop panel1_location=bottom #[top/bottom/left/right] Screen edge the panel should be on panel1_pixelsize=3.5%H #number of pixels wide/high the panel should be (or <number>%[W/H] for a percentage of the screen width/height) panel1_autohide=false #[true/false] Have the panel become visible on mouse-over -panel1_plugins=systemstart, taskmanager-nogroups, spacer, systemtray, clock #list of plugins for the panel +panel1_plugins=systemstart, taskmanager-nogroups, spacer, systemtray, clock, battery #list of plugins for the panel panel1_pinlocation=center #[left/center/right] Note:[left/right] corresponds to [top/bottom] for vertical panels panel1_edgepercent=99 #[1->100] percentage of the screen edge to use diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.pcbsd.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.pcbsd.conf deleted file mode 100644 index 3d434501..00000000 --- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.pcbsd.conf +++ /dev/null @@ -1,105 +0,0 @@ -#This is the configuration file that generates all the default settings files for the Lumina desktop -# For any setting that can take a list of values, each vale needs to be seperated by a comma and a space (", ") -# Example: some_setting=item1, item2, item3 - -#NOTE: To pre-setup default applications for particular mime-types, you need to create *.desktop entries on -# system corresponding to the XDG mime-type specifications for default applications -# See Here for specifications: http://www.freedesktop.org/wiki/Specifications/mime-apps-spec/ - -# Possible Desktop Plugins (Lumina version 0.9.1): -# calendar, applauncher[::absolute path to *.desktop file], desktopview, notepad, audioplayer, rssreader -# Possible Panel Plugins (Lumina version 0.9.1): -# userbutton, desktopbar, spacer, desktopswitcher, battery, clock, systemdashboard, systemstart -# taskmanager[-nogroups], systemtray, homebutton, appmenu, applauncher[::absolute path to *.desktop file] -# Possible Menu Plugins (Lumina version 0.9.1): -# terminal, filemanager, applications, line, settings, windowlist, app::<absolute path to *.desktop file> - -#GENERAL SESSION SETTINGS -session_enablenumlock=false #[true/false] Enable numlock on login using "numlockx" -session_playloginaudio=true #[true/false] Play the audio chimes on log in -session_playlogoutaudio=true #[true/false] Play the audio chimes on log out - -# DEFAULT UTILITIES -# Provide the full path to *.desktop file, or a binary name which exists on PATH -# *.desktop files provide better support for input formats, and are recommended -#Note: the last "ifexists" entry has the highest priority for each session utility -session_default_terminal_ifexists=xterm.desktop -session_default_terminal_ifexists=lumina-terminal.desktop -session_default_filemanager=lumina-fm.desktop -session_default_webbrowser_ifexists=chromium-browser.desktop -session_default_webbrowser_ifexists=firefox.desktop -session_default_webbrowser_ifexists=qupzilla.desktop -session_default_email_ifexists=trojita.desktop - -#DEFAULT UTILITIES FOR INDIVIDUAL MIME TYPES -# Format: mime_default_<mimetype>[_ifexists]=<*.desktop file> -mime_default_text/*_ifexists=lumina-textedit.desktop -mime_default_audio/*_ifexists=vlc.desktop -mime_default_video/*_ifexists=vlc.desktop -mime_default_application/zip_ifexists=peazip.desktop -mime_default_application/x-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-bzip-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-lrzip-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-lzma-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-xz-compressed-tar_ifexists=peazip.desktop -mime_default_application/x-tar_ifexists=peazip.desktop -mime_default_unknown/*=lumina-textedit.desktop -mime_default_application/x-shellscript=lumina-textedit.desktop - -#THEME SETTINGS -theme_themefile=Glass #Name of the theme to use (disable for Lumina-Default) -theme_colorfile=Grey-Dark #Name of the color spec file to use for theming -theme_iconset=oxygen #Name of the icon theme to use -theme_font=Arial #Name of the font family to use -theme_fontsize=10pt #Default size of the fonts to use on the desktop (can also use a percentage of the screen height (<number>%) ) - -#DESKTOP SETTINGS (used for the primary screen in multi-screen setups) -desktop_visiblepanels=2 #[0 - 12] The number of panels visible by default -#desktop.backgroundfiles= #list of absolute file paths for image files (disable for Lumina default) -desktop_backgroundrotateminutes=5 #[positive integer] number of minutes between background rotations (if multiple files) -desktop_plugins=rssreader #list of plugins to be shown on the desktop by default -desktop_generate_icons=true #[true/false] Auto-generate launchers for ~/Desktop items - -#PANEL SETTINGS (preface with panel1.<setting> or panel2.<setting>, depending on the number of panels you have visible by default) -panel1_location=bottom #[top/bottom/left/right] Screen edge the panel should be on -panel1_pixelsize=3.5%H #number of pixels wide/high the panel should be (or <number>%[W/H] for a percentage of the screen width/height) -panel1_autohide=false #[true/false] Have the panel become visible on mouse-over -panel1_plugins=systemstart, taskmanager-nogroups, spacer, systemtray, clock #list of plugins for the panel -panel1_pinlocation=center #[left/center/right] Note:[left/right] corresponds to [top/bottom] for vertical panels -panel1_edgepercent=99 #[1->100] percentage of the screen edge to use - -panel2_location=top -panel2_pixelsize=3%H -panel2_autohide=true -panel2_plugins=spacer, desktopbar, spacer -panel2_pinlocation=center -panel2_edgepercent=10 - -#MENU SETTINGS (right-click menu) -menu_plugins=terminal, filemanager, applications, line, settings #list of menu plugins to show - -#FAVORITES CUSTOMIZATION -#favorites_add=<file/dir path> #Create a favorites entry for this file/dir -#favorites_remove=<file/dir path> #Remove a favorites entry for this file/dir -#favorites_add_ifexists=<file/dir path> #Create a favorites entry for this file/dir if the file/dir exists -favorites_add_ifexists=firefox.desktop -favorites_add_ifexists=chromium-browser.desktop -favorites_add_ifexists=qupzilla.desktop -favorites_add_ifexists=thunderbird.desktop -favorites_add_ifexists=trojita.desktop -favorites_add_ifexists=smplayer.desktop -favorites_add_ifexists=vlc.desktop -favorites_add_ifexists=pithos.desktop -favorites_add_ifexists=~/Documents -favorites_add_ifexists=~/Downloads -favorites_add_ifexists=~/Pictures -favorites_add_ifexists=~/Videos - -#QUICKLAUNCH CUSTOMIZATION (requires the use of the "systemstart" panel plugin) -#quicklaunch_add=<file/dir path> #Create a quicklaunch shortcut for this file/dir -#quicklaunch_add_ifexists=<file/dir path> #Create a quicklaunch shortcut for this file/dir if the file/dir exists - -#Generic scripts/utilities to run for any additional setup procedures -# These are always run after all other settings are saved -#Format: usersetup_run=<generic command to run> -usersetup_run=xdg-user-dirs-update diff --git a/src-qt5/core/lumina-desktop/lumina-desktop.pro b/src-qt5/core/lumina-desktop/lumina-desktop.pro index 33c20502..4bf38a08 100644 --- a/src-qt5/core/lumina-desktop/lumina-desktop.pro +++ b/src-qt5/core/lumina-desktop/lumina-desktop.pro @@ -87,12 +87,22 @@ defaults.path = $${L_SHAREDIR}/lumina-desktop/ conf.path = $${L_ETCDIR} -#Now do any TrueOS defaults (if set) -PCBSD{ - conf.extra = cp defaults/luminaDesktop.pcbsd.conf $(INSTALL_ROOT)$${L_ETCDIR}/luminaDesktop.conf.dist - defaults.extra = cp defaults/desktop-background.pcbsd.jpg $(INSTALL_ROOT)$${L_SHAREDIR}/lumina-desktop/desktop-background.jpg +#Now do any OS-specific defaults (if available) +#First see if there is a known OS override first +TRUEOS{ + message("Installing defaults for OS: TrueOS") + OS=TrueOS +} +exists("defaults/luminaDesktop-$${OS}.conf"){ + message(" -- Found OS-specific system config file: $${OS}"); + conf.extra = cp defaults/luminaDesktop-$${OS}.conf $(INSTALL_ROOT)$${L_ETCDIR}/luminaDesktop.conf.dist }else{ conf.extra = cp defaults/luminaDesktop.conf $(INSTALL_ROOT)$${L_ETCDIR}/luminaDesktop.conf.dist +} +exists("defaults/desktop-background-$${OS}.jpg"){ + message(" -- Found OS-specific background image: $${OS}"); + defaults.extra = cp defaults/desktop-background-$${OS}.jpg $(INSTALL_ROOT)$${L_SHAREDIR}/lumina-desktop/desktop-background.jpg +}else{ defaults.extra = cp defaults/desktop-background.jpg $(INSTALL_ROOT)$${L_SHAREDIR}/lumina-desktop/desktop-background.jpg } -- cgit From c1ef1645eb0ca856f5f5cb6c4acb9fc1115ca88f Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Tue, 28 Jun 2016 13:14:39 -0400 Subject: Update the coming-soon 0.9.1 port makefile for FreeBSD, and also setup the "DEFAULT_SETTINGS=<OS>" build flag for installing config files or desktop wallpapers for other OS's. --- port-files/FreeBSD/Makefile | 11 ++++++----- src-qt5/core/lumina-desktop/lumina-desktop.pro | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/port-files/FreeBSD/Makefile b/port-files/FreeBSD/Makefile index 34004c0b..989a0b8f 100644 --- a/port-files/FreeBSD/Makefile +++ b/port-files/FreeBSD/Makefile @@ -24,10 +24,10 @@ RUN_DEPENDS= xorg>=0:${PORTSDIR}/x11/xorg-minimal \ CONFLICTS= lumina-devel-0* -OPTIONS_DEFINE= MULTIMEDIA PCBSD +OPTIONS_DEFINE= MULTIMEDIA TRUEOS OPTIONS_DEFAULT= MULTIMEDIA MULTIMEDIA_DESC= Install multimedia support backend (gstreamer) -PCBSD_DESC= Use the TrueOS system interface settings. +TRUEOS_DESC= Use the TrueOS system interface settings. .include <bsd.port.options.mk> @@ -44,11 +44,12 @@ USE_QT5= core gui network svg multimedia imageformats \ buildtools_build x11extras concurrent USES= desktop-file-utils qmake USE_GITHUB= yes -GH_ACCOUNT= pcbsd +GH_ACCOUNT= trueos #Setup the qmake configuration options -.if {PORT_OPTIONS:MPCBSD} -QMAKE_ARGS= CONFIG+="configure PCBSD" +.if {PORT_OPTIONS:MTRUEOS} +QMAKE_ARGS= CONFIG+="configure" \ + DEFAULT_SETTINGS=TrueOS .endif .include <bsd.port.mk> diff --git a/src-qt5/core/lumina-desktop/lumina-desktop.pro b/src-qt5/core/lumina-desktop/lumina-desktop.pro index 4bf38a08..4cebf3de 100644 --- a/src-qt5/core/lumina-desktop/lumina-desktop.pro +++ b/src-qt5/core/lumina-desktop/lumina-desktop.pro @@ -89,9 +89,9 @@ conf.path = $${L_ETCDIR} #Now do any OS-specific defaults (if available) #First see if there is a known OS override first -TRUEOS{ - message("Installing defaults for OS: TrueOS") - OS=TrueOS +!isEmpty(DEFAULT_SETTINGS){ + message("Installing defaults settings for OS: $${DEFAULT_SETTINGS}") + OS=$${DEFAULT_SETTINGS} } exists("defaults/luminaDesktop-$${OS}.conf"){ message(" -- Found OS-specific system config file: $${OS}"); -- cgit From c5b037322dcfcc4d11e000a83060355c4013527b Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Tue, 28 Jun 2016 13:30:38 -0400 Subject: Update the README to account for the new build system flags. --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 23fb6583..93ad00af 100644 --- a/README.md +++ b/README.md @@ -50,10 +50,15 @@ How to build from source * Build Note: Compile-time options may be set at this time using qmake. The syntax for this is typically: `qmake CONFIG+="PREFIX=/some/prefix LIBPREFIX=/some/lib/prefix DESTDIR=/some/temporary/packaging/dir"`. This is typically not needed unless you are setting up Lumina for automated build/packaging. If the automatically-detected build settings for your particular OS are invalid or need adjustment, please update the "OS-detect.pri" file as needed and send in your changes. * PREFIX: Determines the base directory used to install/run Lumina ("/usr/local" by default) + Example: `qmake PREFIX=/usr/local` * LIBPREFIX: Determines the location to install the Lumina library ("PREFIX/lib" by default) + Example: `qmake LIBPREFIX=/usr/local/lib` * DESTDIR: An optional directory where the compiled files will be placed temporary (such as for packaging/distributing via some other system). + Example: `qmake DESTDIR=/my/build/dir` * WITH_I18N: (not recommended) Generate/install the partially-localized translation files. This option is typically only used by developers who need to test the localization systems. If you wish to install the full localization/translation files, please use the trueos/lumina-i18n repo instead. - + Example: `qmake CONFIG+=WITH_I18N` + * debug: (not recommended for release builds) Do not strip all the debugging information out of the binaries (used for performing backtraces on builds that crash or for other development tests) + Example: `qmake CONFIG+=debug` 4) Run "make" to compile all the Lumina projects (can be done as user) -- cgit From 845d9ff9425a18d11dc9934891d16c3e1a2542ed Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Tue, 28 Jun 2016 13:31:34 -0400 Subject: Also add info about the new "DEFAULT_SETTINGS" build flag to the readme. --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 93ad00af..aba4870a 100644 --- a/README.md +++ b/README.md @@ -48,16 +48,18 @@ How to build from source > Project MESSAGE: Build Settings Loaded: FreeBSD - * Build Note: Compile-time options may be set at this time using qmake. The syntax for this is typically: `qmake CONFIG+="PREFIX=/some/prefix LIBPREFIX=/some/lib/prefix DESTDIR=/some/temporary/packaging/dir"`. This is typically not needed unless you are setting up Lumina for automated build/packaging. If the automatically-detected build settings for your particular OS are invalid or need adjustment, please update the "OS-detect.pri" file as needed and send in your changes. + * Build Note: Compile-time options may be set at this time using qmake. This is typically not needed unless you are setting up Lumina for automated build/packaging. If the automatically-detected build settings for your particular OS are invalid or need adjustment, please update the "OS-detect.pri" file as needed and send in your changes so that it can be corrected for future builds. * PREFIX: Determines the base directory used to install/run Lumina ("/usr/local" by default) Example: `qmake PREFIX=/usr/local` * LIBPREFIX: Determines the location to install the Lumina library ("PREFIX/lib" by default) Example: `qmake LIBPREFIX=/usr/local/lib` * DESTDIR: An optional directory where the compiled files will be placed temporary (such as for packaging/distributing via some other system). Example: `qmake DESTDIR=/my/build/dir` + * DEFAULT_SETTINGS: An optional flag to install the default settings/wallpaper for some other operating system (Note: Make sure the OS name is capitalized appropriately!) + Example: `qmake DEFAULT_SETTINGS=TrueOS` * WITH_I18N: (not recommended) Generate/install the partially-localized translation files. This option is typically only used by developers who need to test the localization systems. If you wish to install the full localization/translation files, please use the trueos/lumina-i18n repo instead. Example: `qmake CONFIG+=WITH_I18N` - * debug: (not recommended for release builds) Do not strip all the debugging information out of the binaries (used for performing backtraces on builds that crash or for other development tests) + * debug: (not recommended for release builds) Do not strip all the debugging information out of the binaries (useful for performing backtraces on builds that crash or for other development tests) Example: `qmake CONFIG+=debug` 4) Run "make" to compile all the Lumina projects (can be done as user) -- cgit From 683d9c73717007b402e53de84d74a3c064b5ae01 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Tue, 28 Jun 2016 13:53:24 -0400 Subject: Update the FreeBSD port makefile and pkg-description --- port-files/FreeBSD/Makefile | 18 +++++++++--------- port-files/FreeBSD/pkg-descr | 8 +++++++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/port-files/FreeBSD/Makefile b/port-files/FreeBSD/Makefile index 989a0b8f..5561b613 100644 --- a/port-files/FreeBSD/Makefile +++ b/port-files/FreeBSD/Makefile @@ -13,14 +13,14 @@ COMMENT= Lumina Desktop Environment LICENSE= BSD3CLAUSE -RUN_DEPENDS= xorg>=0:${PORTSDIR}/x11/xorg-minimal \ - fluxbox>=0:${PORTSDIR}/x11-wm/fluxbox \ - kde4-icons-oxygen>=0:${PORTSDIR}/x11-themes/kde4-icons-oxygen \ - xscreensaver:${PORTSDIR}/x11/xscreensaver \ - xbrightness:${PORTSDIR}/x11/xbrightness \ - xcompmgr:$PORTSDIR}/x11-wm/xcompmgr - xrandr:${PORTSDIR}/x11/xrandr \ - numlockx:${PORTSDIR}/x11/numlockx +RUN_DEPENDS= xorg>=0:x11/xorg-minimal \ + fluxbox>=0:x11-wm/fluxbox \ + kde4-icons-oxygen>=0:x11-themes/kde4-icons-oxygen \ + xscreensaver:x11/xscreensaver \ + xbrightness:x11/xbrightness \ + xcompmgr:x11-wm/xcompmgr \ + xrandr:x11/xrandr \ + numlockx:x11/numlockx CONFLICTS= lumina-devel-0* @@ -32,7 +32,7 @@ TRUEOS_DESC= Use the TrueOS system interface settings. .include <bsd.port.options.mk> .if ${PORT_OPTIONS:MMULTIMEDIA} -RUN_DEPENDS+= gstreamer1-plugins-core>=0:${PORTSDIR}/multimedia/gstreamer1-plugins-core +RUN_DEPENDS+= gstreamer1-plugins-core>=0:multimedia/gstreamer1-plugins-core .endif MAKE_JOBS_UNSAFE=yes diff --git a/port-files/FreeBSD/pkg-descr b/port-files/FreeBSD/pkg-descr index 0240a632..59c19f0d 100644 --- a/port-files/FreeBSD/pkg-descr +++ b/port-files/FreeBSD/pkg-descr @@ -1,3 +1,9 @@ -The Lumina Desktop Environment is a lightweight system interface that is designed for use on any Unix-like operating system. It takes a plugin-based approach, allowing the entire interface to be assembled/arranged by each individual user as desired, with a system-wide default layout which can be customized by the system administrator. This allows every system (or user session) to be designed to maximize the individual user's productivity. +The Lumina Desktop Environment is a lightweight system interface that is +designed for use on any Unix-like operating system. It takes a +plugin-based approach, allowing the entire interface to be assembled or +arranged by each individual user as desired, with a system-wide default +layout which can be customized by the system administrator. This allows +every system (or user session) to be designed to maximize the individual +user's productivity. WWW: https://github.com/pcbsd/lumina -- cgit From 01cdeba80820966cec48ee251955da76762dcff3 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Tue, 28 Jun 2016 14:06:35 -0400 Subject: Another couple updates to the FreeBSD port files. --- port-files/FreeBSD/pkg-descr | 2 +- port-files/FreeBSD/pkg-message | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 port-files/FreeBSD/pkg-message diff --git a/port-files/FreeBSD/pkg-descr b/port-files/FreeBSD/pkg-descr index 59c19f0d..ce2d052a 100644 --- a/port-files/FreeBSD/pkg-descr +++ b/port-files/FreeBSD/pkg-descr @@ -6,4 +6,4 @@ layout which can be customized by the system administrator. This allows every system (or user session) to be designed to maximize the individual user's productivity. -WWW: https://github.com/pcbsd/lumina +WWW: http://lumina-desktop.org diff --git a/port-files/FreeBSD/pkg-message b/port-files/FreeBSD/pkg-message new file mode 100644 index 00000000..c3742ad9 --- /dev/null +++ b/port-files/FreeBSD/pkg-message @@ -0,0 +1,7 @@ +The Lumina Desktop Environment has been installed! + +An entry for for launching Lumina from a graphical login manager has already been added to the system, but if you with to start Lumina manually, you will need to do one of the following: +1) Run "start-lumina-desktop" directly from the command line after logging in. +2) Put the line "exec start-lumina-desktop" at the end of your user's "~/.xinitrc" file before running startx with any special X11 flags + +Also note that the system-wide default settings for Lumina are contained in ${PREFIX}/etc/luminaDesktop.conf[.dist]. While it is possible to customize the desktop to the user's liking after logging in, you may want to adjust the default settings as necessary if there are multiple user accounts on this system. -- cgit From 06ffd6146b0082f5d2d1124e4b3a65fb19219a68 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Tue, 28 Jun 2016 14:07:45 -0400 Subject: Tag version 0.9.1-Release. --- src-qt5/core/libLumina/LuminaUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp index 72b451ab..55bfdc5a 100644 --- a/src-qt5/core/libLumina/LuminaUtils.cpp +++ b/src-qt5/core/libLumina/LuminaUtils.cpp @@ -49,7 +49,7 @@ inline QStringList ProcessRun(QString cmd, QStringList args){ // LUtils Functions //============= QString LUtils::LuminaDesktopVersion(){ - QString ver = "0.9.1-devel"; + QString ver = "0.9.1-Release"; #ifdef GIT_VERSION ver.append( QString(" (Git Revision: %1)").arg(GIT_VERSION) ); #endif -- cgit From 22b7283ba23b53d7747475f17c90e2f4b982cf60 Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Tue, 28 Jun 2016 15:03:58 -0400 Subject: Fix the symlink creation routine in lumina-textedit to work with package systems. --- src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro b/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro index 9db0db68..cfb4abf3 100644 --- a/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro +++ b/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro @@ -93,7 +93,7 @@ desktop.files=lumina-textedit.desktop desktop.path=$${L_SHAREDIR}/applications/ link.path=$${L_BINDIR} -link.extra=ln -sf $${L_BINDIR}/lumina-textedit $${L_BINDIR}/lte +link.extra=ln -sf $(INSTALL_ROOT)$${L_BINDIR}/lumina-textedit $(INSTALL_ROOT)$${L_BINDIR}/lte INSTALLS += target desktop link -- cgit From 0e151a7348541025ff4ff8486292257cdf5bf2dc Mon Sep 17 00:00:00 2001 From: Ken Moore <moorekou@gmail.com> Date: Tue, 28 Jun 2016 15:06:12 -0400 Subject: Another couple quick fixes for the FreeBSD port files. --- port-files/FreeBSD/Makefile | 6 +++--- port-files/FreeBSD/distinfo | 5 +++-- port-files/FreeBSD/pkg-plist | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/port-files/FreeBSD/Makefile b/port-files/FreeBSD/Makefile index 5561b613..85f5234c 100644 --- a/port-files/FreeBSD/Makefile +++ b/port-files/FreeBSD/Makefile @@ -37,10 +37,10 @@ RUN_DEPENDS+= gstreamer1-plugins-core>=0:multimedia/gstreamer1-plugins-core MAKE_JOBS_UNSAFE=yes -USE_XORG= x11 xdamage -USE_XCB= x11extras wm +USE_XORG= x11 xdamage xcb +USE_XCB= x11extras wm ewmh util-wm USE_LDCONFIG= yes -USE_QT5= core gui network svg multimedia imageformats \ +USE_QT5= core gui widgets network svg multimedia imageformats \ buildtools_build x11extras concurrent USES= desktop-file-utils qmake USE_GITHUB= yes diff --git a/port-files/FreeBSD/distinfo b/port-files/FreeBSD/distinfo index aaefc4dd..9570700a 100644 --- a/port-files/FreeBSD/distinfo +++ b/port-files/FreeBSD/distinfo @@ -1,2 +1,3 @@ -SHA256 (lumina-0.8.4.tar.bz2) = 5fdfbb6b75d86d3cb68dce0453d4675dd7e24312de445e188d5a988512ee9bd3 -SIZE (lumina-0.8.4.tar.bz2) = 23262377 +TIMESTAMP = 1467137694 +SHA256 (trueos-lumina-v0.9.1-Release_GH0.tar.gz) = f62d033b585d46815089a3dce5703c626af23c50db1281a3f1c662fc39cf6006 +SIZE (trueos-lumina-v0.9.1-Release_GH0.tar.gz) = 54665105 diff --git a/port-files/FreeBSD/pkg-plist b/port-files/FreeBSD/pkg-plist index 715e6dc8..fe6ce23e 100644 --- a/port-files/FreeBSD/pkg-plist +++ b/port-files/FreeBSD/pkg-plist @@ -33,7 +33,6 @@ share/pixmaps/Lumina-DE.png share/pixmaps/Insight-FileManager.png share/xsessions/Lumina-DE.desktop share/lumina-desktop/desktop-background.jpg -share/lumina-desktop/defaultapps.conf share/lumina-desktop/luminaDesktop.conf share/lumina-desktop/fluxbox-init-rc share/lumina-desktop/fluxbox-keys -- cgit