aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-qt5/core-utils/lumina-config/mainWindow.cpp43
-rw-r--r--src-qt5/core-utils/lumina-config/mainWindow.h7
-rw-r--r--src-qt5/core-utils/lumina-config/pages/PageWidget.h2
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);
bgstack15