aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core-utils
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2018-04-16 09:08:08 -0400
committerKen Moore <ken@ixsystems.com>2018-04-16 09:08:08 -0400
commitd36a94b449cb09d91827347b3ef2933bda50d1c0 (patch)
tree2bbe302f33d909758ffeb9a82b67732be53fb69d /src-qt5/core-utils
parentMerge pull request #570 from rodlie/lthemeengine_fix_dirs (diff)
downloadlumina-d36a94b449cb09d91827347b3ef2933bda50d1c0.tar.gz
lumina-d36a94b449cb09d91827347b3ef2933bda50d1c0.tar.bz2
lumina-d36a94b449cb09d91827347b3ef2933bda50d1c0.zip
Setup lumina-config with window geometry save/restore.
Diffstat (limited to 'src-qt5/core-utils')
-rw-r--r--src-qt5/core-utils/lumina-config/mainWindow.cpp20
-rw-r--r--src-qt5/core-utils/lumina-config/mainWindow.h19
2 files changed, 36 insertions, 3 deletions
diff --git a/src-qt5/core-utils/lumina-config/mainWindow.cpp b/src-qt5/core-utils/lumina-config/mainWindow.cpp
index 566cd412..0dafc1da 100644
--- a/src-qt5/core-utils/lumina-config/mainWindow.cpp
+++ b/src-qt5/core-utils/lumina-config/mainWindow.cpp
@@ -11,14 +11,22 @@
#include "pages/getPage.h"
#include "pages/page_main.h"
+#include <QSettings>
+
//=============
// PUBLIC
//=============
mainWindow::mainWindow() : QMainWindow(), ui(new Ui::mainWindow()){
ui->setupUi(this);
+ geomTimer = new QTimer(this);
+ geomTimer->setSingleShot(true);
+ geomTimer->setInterval(1000); //1 second
+ connect(geomTimer, SIGNAL(timeout()), this, SLOT(saveWinGeometry()) );
+
APPSLIST = new XDGDesktopList(this, true); //keep this up to date while the app is open
QTimer::singleShot(100, APPSLIST, SLOT(updateList())); //don't let this hold up the initial application loading
cpage = "somerandomjunktostartwith";
+
//Need to insert a spacer action in the toolbar
QWidget *tmp = new QWidget(this);
tmp->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
@@ -30,6 +38,9 @@ mainWindow::mainWindow() : QMainWindow(), ui(new Ui::mainWindow()){
setupIcons();
loadMonitors();
//changePage(""); //load the default main page
+ QSettings S("lumina-desktop","lumina-config");
+ QRect geom = S.value("window_geometry", QRect()).toRect();
+ if(!geom.isNull()){ this->setGeometry(geom); }
}
mainWindow::~mainWindow(){
@@ -58,7 +69,7 @@ void mainWindow::setupIcons(){
}
void mainWindow::loadMonitors(){
- if(ui->actionMonitor->menu()==0){
+ 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*)) );
@@ -76,7 +87,7 @@ void mainWindow::loadMonitors(){
ui->actionMonitor->setWhatsThis(tmp->whatsThis() );
}
}
-
+
}
//=============
@@ -114,6 +125,11 @@ void mainWindow::changePage(QString id){
//================
// PRIVATE SLOTS
//================
+void mainWindow::saveWinGeometry(){
+ QSettings S("lumina-desktop","lumina-config");
+ S.setValue("window_geometry", this->geometry());
+}
+
//Page signal handling
void mainWindow::pageCanSave(bool save){
ui->actionSave->setVisible(save);
diff --git a/src-qt5/core-utils/lumina-config/mainWindow.h b/src-qt5/core-utils/lumina-config/mainWindow.h
index 958daff9..c441de61 100644
--- a/src-qt5/core-utils/lumina-config/mainWindow.h
+++ b/src-qt5/core-utils/lumina-config/mainWindow.h
@@ -9,6 +9,9 @@
#include "globals.h"
//#include "pages/getPage.h"
+#include <QResizeEvent>
+#include <QMoveEvent>
+
namespace Ui{
class mainWindow;
};
@@ -28,11 +31,13 @@ private:
Ui::mainWindow *ui;
QShortcut *backShortcut, *quitShortcut;
QString cpage; //current page
-
+ QTimer *geomTimer;
void changePage(QString id);
private slots:
+ void saveWinGeometry();
+
//Page signals
void pageCanSave(bool);
void pageSetTitle(QString);
@@ -42,5 +47,17 @@ private slots:
void on_actionBack_triggered();
void changeMonitor(QAction*);
void quitShortcut_Triggered();
+
+protected:
+ void resizeEvent(QResizeEvent *ev){
+ if(geomTimer->isActive()){ geomTimer->stop(); }
+ geomTimer->start();
+ QMainWindow::resizeEvent(ev);
+ }
+ void moveEvent(QMoveEvent *ev){
+ if(geomTimer->isActive()){ geomTimer->stop(); }
+ geomTimer->start();
+ QMainWindow::moveEvent(ev);
+ }
};
#endif
bgstack15