diff --git a/libs/image/kis_image_config.cpp b/libs/image/kis_image_config.cpp --- a/libs/image/kis_image_config.cpp +++ b/libs/image/kis_image_config.cpp @@ -223,12 +223,12 @@ { QString swap = QDir::tempPath(); return !requestDefault ? - m_config.readEntry("swaplocation", swap) : swap; + m_config.readPathEntry("swaplocation", swap) : swap; } void KisImageConfig::setSwapDir(const QString &swapDir) { - m_config.writeEntry("swaplocation", swapDir); + m_config.writePathEntry("swaplocation", swapDir); } int KisImageConfig::numberOfOnionSkins() const diff --git a/libs/ui/dialogs/kis_dlg_preferences.h b/libs/ui/dialogs/kis_dlg_preferences.h --- a/libs/ui/dialogs/kis_dlg_preferences.h +++ b/libs/ui/dialogs/kis_dlg_preferences.h @@ -84,6 +84,7 @@ private Q_SLOTS: void getBackgroundImage(); void clearBackgroundImage(); + void selectResourceFolderLocation(); }; diff --git a/libs/ui/dialogs/kis_dlg_preferences.cc b/libs/ui/dialogs/kis_dlg_preferences.cc --- a/libs/ui/dialogs/kis_dlg_preferences.cc +++ b/libs/ui/dialogs/kis_dlg_preferences.cc @@ -129,6 +129,9 @@ connect(m_bnFileName, SIGNAL(clicked()), SLOT(getBackgroundImage())); connect(clearBgImageButton, SIGNAL(clicked()), SLOT(clearBackgroundImage())); + + lblResourceFolderLocation->setText(cfg.resourceFolderLocation()); + connect(bnResourceFolderSelector, SIGNAL(clicked()), SLOT(selectResourceFolderLocation())); } void GeneralTab::setDefault() @@ -157,6 +160,7 @@ m_radioToolOptionsInDocker->setChecked(cfg.toolOptionsInDocker(true)); m_chkSwitchSelectionCtrlAlt->setChecked(cfg.switchSelectionCtrlAlt(true)); m_chkConvertOnImport->setChecked(cfg.convertToImageColorspaceOnImport(true)); + lblResourceFolderLocation->setText(cfg.resourceFolderLocation(true)); } @@ -261,6 +265,14 @@ m_backgroundimage->setText(""); } +void GeneralTab::selectResourceFolderLocation() +{ + KisConfig cfg; + QString resourceFolderLocation = cfg.resourceFolderLocation(); + resourceFolderLocation = QFileDialog::getExistingDirectory(0, i18nc("@title:window", "Select the location for your custom resources."), resourceFolderLocation); + lblResourceFolderLocation->setText(resourceFolderLocation); +} + ShortcutSettingsTab::ShortcutSettingsTab(QWidget *parent, const char *name) : QWidget(parent) { @@ -973,6 +985,7 @@ cfg.setToolOptionsInDocker(dialog->m_general->toolOptionsInDocker()); cfg.setSwitchSelectionCtrlAlt(dialog->m_general->switchSelectionCtrlAlt()); cfg.setConvertToImageColorspaceOnImport(dialog->m_general->convertToImageColorspaceOnImport()); + cfg.setResourceFolderLocation(dialog->m_general->lblResourceFolderLocation->text()); KisPart *part = KisPart::instance(); if (part) { diff --git a/libs/ui/forms/wdggeneralsettings.ui b/libs/ui/forms/wdggeneralsettings.ui --- a/libs/ui/forms/wdggeneralsettings.ui +++ b/libs/ui/forms/wdggeneralsettings.ui @@ -6,7 +6,7 @@ 0 0 - 552 + 633 295 @@ -25,11 +25,11 @@ Qt::LeftToRight - + - 0 + 3 @@ -464,212 +464,214 @@ Miscellaneous - + - - - 10 + + + + 0 + 0 + - - 10 + + Qt::RightToLeft - - 10 + + Autosave every: - - 10 + + true - + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + min + + + 1 + + + 1440 + + + 5 + + + 15 + + + + + + + Compress .kra files more (slows loading/saving) + + + + + + + Create backup file + + + + + + + On importing images as layers, convert to the image colorspace + + + + + + + + 0 + 0 + + + + Undo stack size: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + + 0 + + + 1000 + + + 5 + + + 30 + + + + + + + + 0 + 0 + + + + Favorite presets: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 75 + 0 + + + 10 - - - - - 0 - 0 - - - - Qt::RightToLeft - - - Autosave every: - - - true - - - - - - - - 0 - 0 - - - - Undo stack size: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Compress .kra files more (slows loading/saving) - - - - - - - Create backup file - - - - - - - - 0 - 0 - - - - - 75 - 0 - - - - 10 - - - 30 - - - - - - - - 0 - 0 - - - - Favorite presets: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 75 - 0 - - - - min - - - 1 - - - 1440 - - - 5 - - - 15 - - - - - + + 30 + + + + + + + Show root layer + + + + + + + Hide splash screen on startup + + + + + + + Resource Folder + + + + + + + - + 0 0 - - - 75 - 0 - - - - 0 - - - 1000 - - - 5 - - - 30 - - - - - - Show root layer + TextLabel - - - - Hide splash screen on startup + + + + Select the location where Krita writes its swap files. - - - - - On importing images as layers, convert to the image colorspace + ... - - - - Qt::Vertical - - - - 20 - 40 - - - - - + Qt::Vertical @@ -694,11 +696,6 @@ QPushButton
kis_color_button.h
- - KisIntParseSpinBox - QSpinBox -
kis_int_parse_spin_box.h
-
diff --git a/libs/ui/kis_config.h b/libs/ui/kis_config.h --- a/libs/ui/kis_config.h +++ b/libs/ui/kis_config.h @@ -438,7 +438,7 @@ bool useEraserBrushOpacity(bool defaultValue = false) const; void setUseEraserBrushOpacity(bool value); - + QColor getMDIBackgroundColor(bool defaultValue = false) const; void setMDIBackgroundColor(const QColor & v) const; @@ -488,6 +488,9 @@ QString brushHudSetting(bool defaultValue = false) const; void setBrushHudSetting(const QString &value) const; + QString resourceFolderLocation(bool defaultValue = false) const; + void setResourceFolderLocation(const QString &value) const; + template void writeEntry(const QString& name, const T& value) { m_cfg.writeEntry(name, value); diff --git a/libs/ui/kis_config.cc b/libs/ui/kis_config.cc --- a/libs/ui/kis_config.cc +++ b/libs/ui/kis_config.cc @@ -27,7 +27,7 @@ #include #include #include - +#include #include @@ -1722,3 +1722,19 @@ { m_cfg.writeEntry("brushHudSettings", value); } + +QString KisConfig::resourceFolderLocation(bool defaultValue) const +{ + if (defaultValue) { + return ""; + } + KConfigGroup cg(KSharedConfig::openConfig(), "resource_folder"); + return cg.readPathEntry("saveLocation", ""); +} + +void KisConfig::setResourceFolderLocation(const QString &value) const +{ + KConfigGroup cg(KSharedConfig::openConfig(), "resource_folder"); + cg.writePathEntry("saveLocation", value); + +} diff --git a/libs/widgetutils/KoResourcePaths.cpp b/libs/widgetutils/KoResourcePaths.cpp --- a/libs/widgetutils/KoResourcePaths.cpp +++ b/libs/widgetutils/KoResourcePaths.cpp @@ -29,6 +29,9 @@ #include #include "kis_debug.h" +#include +#include + #include "WidgetUtilsDebug.h" Q_GLOBAL_STATIC(KoResourcePaths, s_instance); @@ -477,12 +480,22 @@ QString KoResourcePaths::saveLocationInternal(const QString &type, const QString &suffix, bool create) { QStringList aliases = d->aliases(type); - QString path; + + KConfigGroup cg(KSharedConfig::openConfig(), "resource_folder"); + QString path = cg.readPathEntry("saveLocation", path); + if (aliases.size() > 0) { - path = QStandardPaths::writableLocation(d->mapTypeToQStandardPaths(type)) + '/' + aliases.first(); + if (path.isEmpty()) { + path = QStandardPaths::writableLocation(d->mapTypeToQStandardPaths(type)) + '/' + aliases.first(); + } + else { + path += '/' + aliases.first(); + } } - else { + else if (path.isEmpty()) { + path = QStandardPaths::writableLocation(d->mapTypeToQStandardPaths(type)); + if (!path.endsWith("krita")) { path += "/krita"; }