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()
KoColor cursorColor(KoColorSpaceRegistry::instance()->rgb8());
cursorColor.fromQColor(cfg.getCursorMainColor(true));
cursorColorBtutton->setColor(cursorColor);
}
CursorStyle GeneralTab::cursorStyle()
......@@ -1131,6 +1134,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("general");
page->setHeader(i18n("General"));
page->setIcon(KisIconUtils::loadIcon("go-home"));
m_pages << page;
addPage(page);
m_general = new GeneralTab(vbox);
......@@ -1140,6 +1144,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("shortcuts");
page->setHeader(i18n("Shortcuts"));
page->setIcon(KisIconUtils::loadIcon("document-export"));
m_pages << page;
addPage(page);
m_shortcutSettings = new ShortcutSettingsTab(vbox);
connect(this, SIGNAL(accepted()), m_shortcutSettings, SLOT(saveChanges()));
......@@ -1151,6 +1156,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setHeader(i18n("Canvas Input"));
page->setObjectName("canvasinput");
page->setIcon(KisIconUtils::loadIcon("configure"));
m_pages << page;
// Display
vbox = new KoVBox();
......@@ -1158,6 +1164,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("display");
page->setHeader(i18n("Display"));
page->setIcon(KisIconUtils::loadIcon("preferences-desktop-display"));
m_pages << page;
addPage(page);
m_displaySettings = new DisplaySettingsTab(vbox);
......@@ -1167,6 +1174,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("colormanagement");
page->setHeader(i18n("Color"));
page->setIcon(KisIconUtils::loadIcon("preferences-desktop-color"));
m_pages << page;
addPage(page);
m_colorSettings = new ColorSettingsTab(vbox);
......@@ -1176,6 +1184,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("performance");
page->setHeader(i18n("Performance"));
page->setIcon(KisIconUtils::loadIcon("applications-system"));
m_pages << page;
addPage(page);
m_performanceSettings = new PerformanceTab(vbox);
......@@ -1185,6 +1194,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("tablet");
page->setHeader(i18n("Tablet"));
page->setIcon(KisIconUtils::loadIcon("document-edit"));
m_pages << page;
addPage(page);
m_tabletSettings = new TabletSettingsTab(vbox);
......@@ -1194,6 +1204,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("canvasonly");
page->setHeader(i18n("Canvas-only"));
page->setIcon(KisIconUtils::loadIcon("folder-pictures"));
m_pages << page;
addPage(page);
m_fullscreenSettings = new FullscreenSettingsTab(vbox);
......@@ -1203,6 +1214,7 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
page->setObjectName("author");
page->setHeader(i18n("Author"));
page->setIcon(KisIconUtils::loadIcon("im-user"));
m_pages << page;
QPushButton *restoreDefaultsButton = button(QDialogButtonBox::RestoreDefaults);
......@@ -1226,13 +1238,22 @@ KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
connect(this, SIGNAL(accepted()), preferenceSet, SLOT(savePreferences()), Qt::UniqueConnection);
}
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()
{
KisConfig cfg(true);
cfg.writeEntry<QString>("KisDlgPreferences/CurrentPage", currentPage()->objectName());
}
void KisDlgPreferences::slotDefault()
......
......@@ -24,6 +24,8 @@
#include <QWidget>
#include <QButtonGroup>
#include <QMap>
#include <QString>
#include <kpagedialog.h>
#include <kis_config.h>
......@@ -338,6 +340,8 @@ protected:
KisInputConfigurationPage *m_inputConfiguration;
KoConfigAuthorPage *m_authorPage;
QList<KPageWidgetItem*> m_pages;
protected Q_SLOTS:
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