Commit ed3cb847 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remember the last opened settings page

parent 902ea7ee
...@@ -246,6 +246,9 @@ void GeneralTab::setDefault() ...@@ -246,6 +246,9 @@ void GeneralTab::setDefault()
KoColor cursorColor(KoColorSpaceRegistry::instance()->rgb8()); KoColor cursorColor(KoColorSpaceRegistry::instance()->rgb8());
cursorColor.fromQColor(cfg.getCursorMainColor(true)); cursorColor.fromQColor(cfg.getCursorMainColor(true));
cursorColorBtutton->setColor(cursorColor); cursorColorBtutton->setColor(cursorColor);
} }
CursorStyle GeneralTab::cursorStyle() CursorStyle GeneralTab::cursorStyle()
...@@ -1131,6 +1134,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name) ...@@ -1131,6 +1134,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("general"); page->setObjectName("general");
page->setHeader(i18n("General")); page->setHeader(i18n("General"));
page->setIcon(KisIconUtils::loadIcon("go-home")); page->setIcon(KisIconUtils::loadIcon("go-home"));
m_pages << page;
addPage(page); addPage(page);
m_general = new GeneralTab(vbox); m_general = new GeneralTab(vbox);
...@@ -1140,6 +1144,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name) ...@@ -1140,6 +1144,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("shortcuts"); page->setObjectName("shortcuts");
page->setHeader(i18n("Shortcuts")); page->setHeader(i18n("Shortcuts"));
page->setIcon(KisIconUtils::loadIcon("document-export")); page->setIcon(KisIconUtils::loadIcon("document-export"));
m_pages << page;
addPage(page); addPage(page);
m_shortcutSettings = new ShortcutSettingsTab(vbox); m_shortcutSettings = new ShortcutSettingsTab(vbox);
connect(this, SIGNAL(accepted()), m_shortcutSettings, SLOT(saveChanges())); connect(this, SIGNAL(accepted()), m_shortcutSettings, SLOT(saveChanges()));
...@@ -1151,6 +1156,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name) ...@@ -1151,6 +1156,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setHeader(i18n("Canvas Input")); page->setHeader(i18n("Canvas Input"));
page->setObjectName("canvasinput"); page->setObjectName("canvasinput");
page->setIcon(KisIconUtils::loadIcon("configure")); page->setIcon(KisIconUtils::loadIcon("configure"));
m_pages << page;
// Display // Display
vbox = new KoVBox(); vbox = new KoVBox();
...@@ -1158,6 +1164,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name) ...@@ -1158,6 +1164,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("display"); page->setObjectName("display");
page->setHeader(i18n("Display")); page->setHeader(i18n("Display"));
page->setIcon(KisIconUtils::loadIcon("preferences-desktop-display")); page->setIcon(KisIconUtils::loadIcon("preferences-desktop-display"));
m_pages << page;
addPage(page); addPage(page);
m_displaySettings = new DisplaySettingsTab(vbox); m_displaySettings = new DisplaySettingsTab(vbox);
...@@ -1167,6 +1174,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name) ...@@ -1167,6 +1174,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("colormanagement"); page->setObjectName("colormanagement");
page->setHeader(i18n("Color")); page->setHeader(i18n("Color"));
page->setIcon(KisIconUtils::loadIcon("preferences-desktop-color")); page->setIcon(KisIconUtils::loadIcon("preferences-desktop-color"));
m_pages << page;
addPage(page); addPage(page);
m_colorSettings = new ColorSettingsTab(vbox); m_colorSettings = new ColorSettingsTab(vbox);
...@@ -1176,6 +1184,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name) ...@@ -1176,6 +1184,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("performance"); page->setObjectName("performance");
page->setHeader(i18n("Performance")); page->setHeader(i18n("Performance"));
page->setIcon(KisIconUtils::loadIcon("applications-system")); page->setIcon(KisIconUtils::loadIcon("applications-system"));
m_pages << page;
addPage(page); addPage(page);
m_performanceSettings = new PerformanceTab(vbox); m_performanceSettings = new PerformanceTab(vbox);
...@@ -1185,6 +1194,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name) ...@@ -1185,6 +1194,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("tablet"); page->setObjectName("tablet");
page->setHeader(i18n("Tablet")); page->setHeader(i18n("Tablet"));
page->setIcon(KisIconUtils::loadIcon("document-edit")); page->setIcon(KisIconUtils::loadIcon("document-edit"));
m_pages << page;
addPage(page); addPage(page);
m_tabletSettings = new TabletSettingsTab(vbox); m_tabletSettings = new TabletSettingsTab(vbox);
...@@ -1194,6 +1204,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name) ...@@ -1194,6 +1204,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("canvasonly"); page->setObjectName("canvasonly");
page->setHeader(i18n("Canvas-only")); page->setHeader(i18n("Canvas-only"));
page->setIcon(KisIconUtils::loadIcon("folder-pictures")); page->setIcon(KisIconUtils::loadIcon("folder-pictures"));
m_pages << page;
addPage(page); addPage(page);
m_fullscreenSettings = new FullscreenSettingsTab(vbox); m_fullscreenSettings = new FullscreenSettingsTab(vbox);
...@@ -1203,6 +1214,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name) ...@@ -1203,6 +1214,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("author"); page->setObjectName("author");
page->setHeader(i18n("Author")); page->setHeader(i18n("Author"));
page->setIcon(KisIconUtils::loadIcon("im-user")); page->setIcon(KisIconUtils::loadIcon("im-user"));
m_pages << page;
QPushButton *restoreDefaultsButton = button(QDialogButtonBox::RestoreDefaults); QPushButton *restoreDefaultsButton = button(QDialogButtonBox::RestoreDefaults);
...@@ -1226,13 +1238,22 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name) ...@@ -1226,13 +1238,22 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
connect(this, SIGNAL(accepted()), preferenceSet, SLOT(savePreferences()), Qt::UniqueConnection); connect(this, SIGNAL(accepted()), preferenceSet, SLOT(savePreferences()), Qt::UniqueConnection);
} }
connect(restoreDefaultsButton, SIGNAL(clicked(bool)), this, SLOT(slotDefault())); connect(restoreDefaultsButton, SIGNAL(clicked(bool)), this, SLOT(slotDefault()));
KisConfig cfg(true);
QString currentPageName = cfg.readEntry<QString>("KisDlgPreferences/CurrentPage");
Q_FOREACH(KPageWidgetItem *page, m_pages) {
if (page->objectName() == currentPageName) {
setCurrentPage(page);
break;
}
}
} }
KisDlgPreferences::~KisDlgPreferences() KisDlgPreferences::~KisDlgPreferences()
{ {
KisConfig cfg(true);
cfg.writeEntry<QString>("KisDlgPreferences/CurrentPage", currentPage()->objectName());
} }
void KisDlgPreferences::slotDefault() void KisDlgPreferences::slotDefault()
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <QWidget> #include <QWidget>
#include <QButtonGroup> #include <QButtonGroup>
#include <QMap>
#include <QString>
#include <kpagedialog.h> #include <kpagedialog.h>
#include <kis_config.h> #include <kis_config.h>
...@@ -338,6 +340,8 @@ protected: ...@@ -338,6 +340,8 @@ protected:
KisInputConfigurationPage *m_inputConfiguration; KisInputConfigurationPage *m_inputConfiguration;
KoConfigAuthorPage *m_authorPage; KoConfigAuthorPage *m_authorPage;
QList<KPageWidgetItem*> m_pages;
protected Q_SLOTS: protected Q_SLOTS:
void slotDefault(); void slotDefault();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment