Author: kmachalkova Date: Fri May 15 16:27:17 2009 New Revision: 57197 URL: http://svn.opensuse.org/viewcvs/yast?rev=57197&view=rev Log: persistent window size Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp?rev=57197&r1=57196&r2=57197&view=diff ============================================================================== --- branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp (original) +++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.cpp Fri May 15 16:27:17 2009 @@ -19,6 +19,7 @@ #include <QDockWidget> #include <QListView> #include <QDebug> +#include <QSettings> #include "kcategorizedsortfilterproxymodel.h" #include "kcategorizedview.h" @@ -29,6 +30,7 @@ #include "yqmodulegroupsmodel.h" //#include "moduleiconitem.h" +#define APP_NAME "y2controlcenter-qt" class MainWindow::Private { @@ -107,8 +109,10 @@ leftPanelLayout->addWidget( d->groupview ); groupdock->setWidget( leftPanel ); - + addDockWidget(Qt::LeftDockWidgetArea, groupdock); + + readSettings(); connect( d->groupview, SIGNAL( pressed( const QModelIndex & ) ), SLOT( slotGroupPressed( const QModelIndex & ) ) ); @@ -144,6 +148,29 @@ } +void MainWindow::readSettings() +{ + QSettings settings(APP_NAME); + + settings.beginGroup("MainWindow"); + resize(settings.value("Size", QSize(680,420)).toSize()); + settings.endGroup(); +} + +void MainWindow::writeSettings() +{ + QSettings settings(APP_NAME); + + settings.beginGroup("MainWindow"); + settings.setValue("Size", size()); + settings.endGroup(); +} + +void MainWindow::closeEvent (QCloseEvent *event) +{ + writeSettings(); + event->accept(); +} MainWindow::~MainWindow() { Modified: branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h?rev=57197&r1=57196&r2=57197&view=diff ============================================================================== --- branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h (original) +++ branches/tmp/tgoettlicher/yast2cc_rewrite/src/main_window.h Fri May 15 16:27:17 2009 @@ -18,6 +18,7 @@ #include <QMainWindow> +#include <QCloseEvent> /** * Main window of the control center @@ -37,9 +38,13 @@ void slotModulePressed( const QModelIndex &index ); protected: void initActions(); + void closeEvent( QCloseEvent *event); private: class Private; Private *const d; + + void writeSettings(); + void readSettings(); }; #endif -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org