diff options
author | Ken Moore <moorekou@gmail.com> | 2016-06-22 23:21:22 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-06-22 23:21:22 -0400 |
commit | da01d191816c678dcdabbf93942094eb3c6ed78b (patch) | |
tree | cd2307465cefa1a81c53b4a55520a8e82e3ff8e2 /src-qt5/core-utils | |
parent | Get the general page loading system all setup for the new mainWindow class. (diff) | |
download | lumina-da01d191816c678dcdabbf93942094eb3c6ed78b.tar.gz lumina-da01d191816c678dcdabbf93942094eb3c6ed78b.tar.bz2 lumina-da01d191816c678dcdabbf93942094eb3c6ed78b.zip |
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.
Diffstat (limited to 'src-qt5/core-utils')
-rw-r--r-- | src-qt5/core-utils/lumina-config/globals.h | 2 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/mainWindow.cpp | 14 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/mainWindow.h | 3 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/pages/getPage.h | 4 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/pages/page_main.cpp | 70 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/pages/page_main.h | 5 | ||||
-rw-r--r-- | src-qt5/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 <QWidget> #include <QDesktopWidget> #include <QMainWindow> - +#include <QTreeWidgetItem> //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 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<PageWidget*>(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<PAGEINFO> KnownPages(){ // Valid Groups: ["appearance", "interface", "session", "apps"] QList<PAGEINFO> list; //Reminder: <ID>, <name>, <title>, <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> |