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/lumina-config/pages | |
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/lumina-config/pages')
4 files changed, 95 insertions, 11 deletions
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> |