diff options
author | Ken Moore <moorekou@gmail.com> | 2016-06-22 16:31:09 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-06-22 16:31:09 -0400 |
commit | 4f5edf23d6ea103cfd05bb7a4afb0c0db1a0ed11 (patch) | |
tree | b8888da1a524b7c5822350d2fac673be4ad0b9f1 /src-qt5/core-utils/lumina-config | |
parent | Get the new lumina-config UI all setup and tied into the build for compilatio... (diff) | |
download | lumina-4f5edf23d6ea103cfd05bb7a4afb0c0db1a0ed11.tar.gz lumina-4f5edf23d6ea103cfd05bb7a4afb0c0db1a0ed11.tar.bz2 lumina-4f5edf23d6ea103cfd05bb7a4afb0c0db1a0ed11.zip |
Get the general page loading system all setup for the new mainWindow class.
Diffstat (limited to 'src-qt5/core-utils/lumina-config')
-rw-r--r-- | src-qt5/core-utils/lumina-config/mainWindow.cpp | 43 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/mainWindow.h | 7 | ||||
-rw-r--r-- | src-qt5/core-utils/lumina-config/pages/PageWidget.h | 2 |
3 files changed, 49 insertions, 3 deletions
diff --git a/src-qt5/core-utils/lumina-config/mainWindow.cpp b/src-qt5/core-utils/lumina-config/mainWindow.cpp index aec92bf9..45008b07 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.cpp +++ b/src-qt5/core-utils/lumina-config/mainWindow.cpp @@ -8,12 +8,14 @@ #include "ui_mainWindow.h" #include "globals.h" +#include "pages/getPage.h" + //============= // PUBLIC //============= mainWindow::mainWindow() : QMainWindow(), ui(new Ui::mainWindow()){ ui->setupUi(this); - + changePage(""); //load the default main page } mainWindow::~mainWindow(){ @@ -24,17 +26,52 @@ mainWindow::~mainWindow(){ // PUBLIC SLOTS //============== void mainWindow::slotSingleInstance(){ - + this->showNormal(); //just in case it is hidden/minimized } void mainWindow::setupIcons(){ - + ui->actionSave->setIcon( LXDG::findIcon("document-save","") ); } //============= // 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)) ); + //Now load the new page + page->LoadSettings(0); //need to make this show the current screen as needed + //Now update this UI a bit based on page settings + bool needscreen = page->needsScreenSelector(); + this->showNormal(); +} //================ // PRIVATE SLOTS //================ +//Page signal handling +void mainWindow::pageCanSave(bool save){ + ui->actionSave->setVisible(save); + ui->actionSave->setEnabled(save); +} + +void mainWindow::pageSetTitle(QString title){ + this->setWindowTitle(title); +} + +void mainWindow::page_change(QString id){ + if(ui->actionSave->isEnabled()){ + //unsaved changed available - prompt to save first + // TO-DO + } + changePage(id); +} diff --git a/src-qt5/core-utils/lumina-config/mainWindow.h b/src-qt5/core-utils/lumina-config/mainWindow.h index a3dba53b..3a6e0161 100644 --- a/src-qt5/core-utils/lumina-config/mainWindow.h +++ b/src-qt5/core-utils/lumina-config/mainWindow.h @@ -24,8 +24,15 @@ public slots: 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); }; #endif diff --git a/src-qt5/core-utils/lumina-config/pages/PageWidget.h b/src-qt5/core-utils/lumina-config/pages/PageWidget.h index ab81ba1b..937e6692 100644 --- a/src-qt5/core-utils/lumina-config/pages/PageWidget.h +++ b/src-qt5/core-utils/lumina-config/pages/PageWidget.h @@ -31,6 +31,8 @@ public: PageWidget(QWidget *parent) : QWidget(parent){} ~PageWidget(){} + virtual bool needsScreenSelector(){ return false; } //change this to true for pages which load/set options on a per-screen basis + signals: //emit this when the page has changes which are waiting to be saved void HasPendingChanges(bool); |