From f678f275a58840ad7fb61c1035e4e9c18307e703 Mon Sep 17 00:00:00 2001 From: q5sys Date: Wed, 30 Mar 2016 13:50:17 -0400 Subject: Update MainUI.cpp tentative replacement of initial size function --- lumina-fm/MainUI.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lumina-fm/MainUI.cpp') diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index a9dda19e..f72f34bf 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -30,11 +30,8 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ //syncTimer->setInterval(200); //1/5 second (collect as many signals/slots as necessary //syncTimer->setSingleShot(true); //Reset the UI to the previously used size (if possible) - if(DEBUG){ qDebug() << " - Reset window size"; } - int height = settings->value("geometry/height",-1).toInt(); - if(height>100 && height <= QApplication::desktop()->availableGeometry(this).height()){ this->resize(this->width(), height); } - int width = settings->value("geometry/width",-1).toInt(); - if(width>100 && width <= QApplication::desktop()->availableGeometry(this).width()){ this->resize(width, this->height() ); } +QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize(); + if(!orig.isEmpty() && orig.isValid()){ //initialize the non-ui widgets if(DEBUG){ qDebug() << " - Tab Bar Setup"; } tabBar = new QTabBar(this); -- cgit From 9d0d7b7a4e0d5eaf17c6cb51e1dbe25af465d865 Mon Sep 17 00:00:00 2001 From: q5sys Date: Wed, 30 Mar 2016 13:51:54 -0400 Subject: Update MainUI.cpp --- lumina-fm/MainUI.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lumina-fm/MainUI.cpp') diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index f72f34bf..48f7a6b2 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -32,6 +32,10 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ //Reset the UI to the previously used size (if possible) QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize(); if(!orig.isEmpty() && orig.isValid()){ + //Make sure the old size is larger than the default size hint + if(orig.width() < this->sizeHint().width()){ orig.setWidth(this->sizeHint().width()); } + if(orig.height() < this->sizeHint().height()){ orig.setHeight(this->sizeHint().height()); } + //initialize the non-ui widgets if(DEBUG){ qDebug() << " - Tab Bar Setup"; } tabBar = new QTabBar(this); -- cgit From f1d4e95a0be80f6ea93dde4de4b5f356058807b1 Mon Sep 17 00:00:00 2001 From: q5sys Date: Wed, 30 Mar 2016 13:52:16 -0400 Subject: Update MainUI.cpp --- lumina-fm/MainUI.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lumina-fm/MainUI.cpp') diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 48f7a6b2..70d5ab08 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -35,7 +35,10 @@ QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize(); //Make sure the old size is larger than the default size hint if(orig.width() < this->sizeHint().width()){ orig.setWidth(this->sizeHint().width()); } if(orig.height() < this->sizeHint().height()){ orig.setHeight(this->sizeHint().height()); } - + //Also ensure the old size is smaller than the current screen size + QSize screen = QApplication::desktop()->availableGeometry(this).size(); + if(orig.width() > screen.width()){ orig.setWidth(screen.width()); } + if(orig.height() > screen.height()){ orig.setHeight(screen.height()); } //initialize the non-ui widgets if(DEBUG){ qDebug() << " - Tab Bar Setup"; } tabBar = new QTabBar(this); -- cgit From 6f631d14a0e5513ee18000d739873cfb53b2f48f Mon Sep 17 00:00:00 2001 From: q5sys Date: Wed, 30 Mar 2016 13:52:51 -0400 Subject: Update MainUI.cpp --- lumina-fm/MainUI.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lumina-fm/MainUI.cpp') diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 70d5ab08..6db4b932 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -39,6 +39,8 @@ QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize(); QSize screen = QApplication::desktop()->availableGeometry(this).size(); if(orig.width() > screen.width()){ orig.setWidth(screen.width()); } if(orig.height() > screen.height()){ orig.setHeight(screen.height()); } + //Now resize the window + this->resize(orig); //initialize the non-ui widgets if(DEBUG){ qDebug() << " - Tab Bar Setup"; } tabBar = new QTabBar(this); -- cgit From 421db2abf7d3c224c2988a3327ae05c6e0239a3f Mon Sep 17 00:00:00 2001 From: q5sys Date: Wed, 30 Mar 2016 13:53:32 -0400 Subject: Update MainUI.cpp fixed spacing and cleaned up order --- lumina-fm/MainUI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lumina-fm/MainUI.cpp') diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index 6db4b932..2e226e12 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -32,10 +32,10 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){ //Reset the UI to the previously used size (if possible) QSize orig = settings->value("preferences/MainWindowSize", QSize()).toSize(); if(!orig.isEmpty() && orig.isValid()){ - //Make sure the old size is larger than the default size hint + //Make sure the old size is larger than the default size hint if(orig.width() < this->sizeHint().width()){ orig.setWidth(this->sizeHint().width()); } if(orig.height() < this->sizeHint().height()){ orig.setHeight(this->sizeHint().height()); } - //Also ensure the old size is smaller than the current screen size + //Also ensure the old size is smaller than the current screen size QSize screen = QApplication::desktop()->availableGeometry(this).size(); if(orig.width() > screen.width()){ orig.setWidth(screen.width()); } if(orig.height() > screen.height()){ orig.setHeight(screen.height()); } -- cgit