From fde5c86ac077622d2f1a13e8b8ef896ba98eb7ff Mon Sep 17 00:00:00 2001 From: nils Date: Wed, 7 Apr 2010 23:45:10 +0000 Subject: added window size save on exit in settings git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@291 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- gpgwin.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'gpgwin.cpp') diff --git a/gpgwin.cpp b/gpgwin.cpp index 477f566..2962e7b 100644 --- a/gpgwin.cpp +++ b/gpgwin.cpp @@ -63,29 +63,33 @@ GpgWin::GpgWin() void GpgWin::restoreSettings() { - // Restore window size & location - // TODO: is this a good idea for a portable app? screen size & resolution may vary QSettings settings; //restoreGeometry(settings.value("window/geometry").toByteArray()); - QPoint pos = settings.value("window/pos", QPoint(100, 100)).toPoint(); - QSize size = settings.value("window/size", QSize(800, 450)).toSize(); + + // Restore window size & location + Qt::CheckState windowSave = static_cast(settings.value("window/windowSave", Qt::Unchecked).toUInt()); + if (windowSave == Qt::Checked) { + QPoint pos = settings.value("window/pos", QPoint(100, 100)).toPoint(); + QSize size = settings.value("window/size", QSize(800, 450)).toSize(); + this->resize(size); + this->move(pos); + } else { + this->resize(QSize(800,450)); + this->move(QPoint(100, 100)); + } + + // Iconsize QSize iconSize = settings.value("toolbar/iconsize", QSize(32, 32)).toSize(); - Qt::ToolButtonStyle buttonStyle = static_cast(settings.value("toolbar/iconstyle", Qt::ToolButtonTextUnderIcon).toUInt()); - - this->resize(size); - this->move(pos); this->setIconSize(iconSize); + + // Iconstyle + Qt::ToolButtonStyle buttonStyle = static_cast(settings.value("toolbar/iconstyle", Qt::ToolButtonTextUnderIcon).toUInt()); this->setToolButtonStyle(buttonStyle); // state sets pos & size of dock-widgets this->restoreState(settings.value("window/windowState").toByteArray()); } -/* void GpgWin::dropEvent(QDropEvent *event) - { - edit->setPlainText(event->mimeData()->text()); - event->acceptProposedAction(); - } -*/ + void GpgWin::createActions() { /** Main Menu @@ -147,8 +151,7 @@ void GpgWin::restoreSettings() selectallAct->setToolTip(tr("Select the whole text")); connect(selectallAct, SIGNAL(triggered()), edit, SLOT(selectAll())); - openSettingsAct = new QAction(tr("Settings"), this); -// openSettingsAct->setIcon(QIcon(iconPath + "fileencrytion.png")); + openSettingsAct = new QAction(tr("Se&ttings"), this); openSettingsAct->setToolTip(tr("Open settings dialog")); connect(openSettingsAct, SIGNAL(triggered()), this, SLOT(openSettingsDialog())); -- cgit v1.2.3