Skip to content

Commit

Permalink
Shortcuts dialog now remembers window state between uses
Browse files Browse the repository at this point in the history
  • Loading branch information
spilth committed Aug 9, 2011
1 parent 43e8321 commit e5f9462
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
25 changes: 25 additions & 0 deletions src/app/qgsconfigureshortcutsdialog.cpp
Expand Up @@ -43,8 +43,33 @@ QgsConfigureShortcutsDialog::QgsConfigureShortcutsDialog( QWidget* parent )
this, SLOT( actionChanged( QTreeWidgetItem*, QTreeWidgetItem* ) ) );

populateActions();

restoreState();
}

QgsConfigureShortcutsDialog::~QgsConfigureShortcutsDialog()
{
saveState();
}

/*!
* Function to save dialog window state
*/
void QgsConfigureShortcutsDialog::saveState()
{
QSettings settings;
settings.setValue( "/Windows/ShortcutsDialog/geometry", saveGeometry() );
}

/*!
* Function to restore dialog window state
*/
void QgsConfigureShortcutsDialog::restoreState()
{
QSettings settings;
restoreGeometry( settings.value( "/Windows/ShortcutsDialog/geometry" ).toByteArray() );
}

void QgsConfigureShortcutsDialog::populateActions()
{
QList<QAction*> actions = QgsShortcutsManager::instance()->listActions();
Expand Down
15 changes: 14 additions & 1 deletion src/app/qgsconfigureshortcutsdialog.h
Expand Up @@ -26,7 +26,8 @@ class QgsConfigureShortcutsDialog : public QDialog, private Ui::QgsConfigureShor

public:
QgsConfigureShortcutsDialog( QWidget* parent = NULL );

~QgsConfigureShortcutsDialog();

void populateActions();

protected:
Expand All @@ -51,6 +52,18 @@ class QgsConfigureShortcutsDialog : public QDialog, private Ui::QgsConfigureShor
protected:
bool mGettingShortcut;
int mModifiers, mKey;

private:
/*!
* Function to save dialog window state
*/
void saveState();

/*!
* Function to restore dialog window state
*/
void restoreState();

};

#endif

0 comments on commit e5f9462

Please sign in to comment.