aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@pcbsd.org>2014-09-15 09:42:39 -0400
committerKen Moore <ken@pcbsd.org>2014-09-15 09:42:39 -0400
commitb5850d3e0e4c31476eb6d6ef02870e7a775650ef (patch)
tree7455ca15c4d777d91584d5e32d6738636268048a
parentMerge branch 'master' of github.com:pcbsd/lumina (diff)
downloadlumina-b5850d3e0e4c31476eb6d6ef02870e7a775650ef.tar.gz
lumina-b5850d3e0e4c31476eb6d6ef02870e7a775650ef.tar.bz2
lumina-b5850d3e0e4c31476eb6d6ef02870e7a775650ef.zip
Have lumina-fm save/remember the last-used size and open itself with that size (if smaller than the screen size).
-rw-r--r--lumina-fm/MainUI.cpp11
-rw-r--r--lumina-fm/MainUI.h5
2 files changed, 16 insertions, 0 deletions
diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp
index ad73b407..5fa0a30d 100644
--- a/lumina-fm/MainUI.cpp
+++ b/lumina-fm/MainUI.cpp
@@ -12,6 +12,11 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
//Be careful about the QSettings setup, it must match the lumina-desktop setup
QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina");
settings = new QSettings( QSettings::UserScope, "LuminaDE", "lumina-fm", this);
+ //Reset the UI to the previously used size (if possible)
+ 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() ); }
//initialize the non-ui widgets
tabBar = new QTabBar(this);
tabBar->setTabsClosable(true);
@@ -1222,3 +1227,9 @@ void MainUI::PasteItems(){
}
}
+
+void MainUI::resizeEvent(QResizeEvent *event){
+ //Save the new size internally
+ settings->setValue("geometry/height", event->size().height());
+ settings->setValue("geometry/width", event->size().width());
+}
diff --git a/lumina-fm/MainUI.h b/lumina-fm/MainUI.h
index 5679d4ed..886d3fa7 100644
--- a/lumina-fm/MainUI.h
+++ b/lumina-fm/MainUI.h
@@ -35,6 +35,8 @@
#include <QImageReader>
#include <QScrollBar>
#include <QFileDialog>
+#include <QResizeEvent>
+#include <QDesktopWidget>
//Phonon widgets
#include <Phonon/BackendCapabilities>
@@ -193,6 +195,9 @@ private slots:
void CopyItems();
void PasteItems();
+protected:
+ void resizeEvent(QResizeEvent*);
+
};
#endif \ No newline at end of file
bgstack15