summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLubos Dolezel <lubos@dolezel.info>2015-06-11 15:54:22 +0200
committerLubos Dolezel <lubos@dolezel.info>2015-06-11 15:54:22 +0200
commit027b9815b89ec82b7ff46115df1c5e2ce0ac1c4d (patch)
tree0b14d878e5f732fea710e6f252c058f582a73a3a /src
parent987e283e9f3aa052669c3902f1a910a0501b75bc (diff)
downloadtwinkle-027b9815b89ec82b7ff46115df1c5e2ce0ac1c4d.tar
twinkle-027b9815b89ec82b7ff46115df1c5e2ce0ac1c4d.tar.gz
twinkle-027b9815b89ec82b7ff46115df1c5e2ce0ac1c4d.tar.lz
twinkle-027b9815b89ec82b7ff46115df1c5e2ce0ac1c4d.tar.xz
twinkle-027b9815b89ec82b7ff46115df1c5e2ce0ac1c4d.zip
Save window state/geometry, incl. main splitter (resolves #7)
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui.cpp11
-rw-r--r--src/gui/mphoneform.cpp8
-rw-r--r--src/gui/mphoneform.ui4
3 files changed, 17 insertions, 6 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 9c9762f..737379b 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -70,6 +70,7 @@
#include "qstring.h"
#include "qtextcodec.h"
#include "qtooltip.h"
+#include <QSettings>
extern string user_host;
extern pthread_t thread_id_main;
@@ -77,6 +78,8 @@ extern pthread_t thread_id_main;
// External command arguments
extern t_command_args g_cmd_args;
+extern QSettings* g_gui_state;
+
QString str2html(const QString &s)
{
QString result(s);
@@ -798,10 +801,10 @@ void t_gui::run(void) {
mainWindow->populateBuddyList();
// Set width of window to width of tool bar
- int widthToolBar = mainWindow->callToolbar->width();
- QSize sizeMainWin = mainWindow->size();
- sizeMainWin.setWidth(widthToolBar);
- mainWindow->resize(sizeMainWin);
+ // int widthToolBar = mainWindow->callToolbar->width();
+ // QSize sizeMainWin = mainWindow->size();
+ // sizeMainWin.setWidth(widthToolBar);
+ // mainWindow->resize(sizeMainWin);
// Start QApplication/KApplication
if (qApp->isSessionRestored() &&
diff --git a/src/gui/mphoneform.cpp b/src/gui/mphoneform.cpp
index 1fc86e2..d28d3e1 100644
--- a/src/gui/mphoneform.cpp
+++ b/src/gui/mphoneform.cpp
@@ -253,10 +253,18 @@ void MphoneForm::init()
#ifndef WITH_DIAMONDCARD
Diamondcard->menuAction()->setVisible(false);
#endif
+
+ restoreState(g_gui_state->value("mainwindow/state").toByteArray());
+ restoreGeometry(g_gui_state->value("mainwindow/geometry").toByteArray());
+ splitter2->restoreState(g_gui_state->value("mainwindow/mainsplitter").toByteArray());
}
void MphoneForm::destroy()
{
+ g_gui_state->setValue("mainwindow/state", saveState());
+ g_gui_state->setValue("mainwindow/geometry", saveGeometry());
+ g_gui_state->setValue("mainwindow/mainsplitter", splitter2->saveState());
+
if (dtmfForm) {
MEMMAN_DELETE(dtmfForm);
delete dtmfForm;
diff --git a/src/gui/mphoneform.ui b/src/gui/mphoneform.ui
index 093945b..196b098 100644
--- a/src/gui/mphoneform.ui
+++ b/src/gui/mphoneform.ui
@@ -21,7 +21,7 @@
</property>
<property name="minimumSize">
<size>
- <width>714</width>
+ <width>500</width>
<height>693</height>
</size>
</property>
@@ -1058,7 +1058,7 @@
<x>0</x>
<y>0</y>
<width>733</width>
- <height>20</height>
+ <height>17</height>
</rect>
</property>
<widget class="QMenu" name="fileMenu">