File indexing completed on 2025-11-09 04:13:38

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2004-08-23
0007  * Description : mics configuration setup tab
0008  *
0009  * SPDX-FileCopyrightText: 2004      by Renchi Raju <renchi dot raju at gmail dot com>
0010  * SPDX-FileCopyrightText: 2005-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0011  * SPDX-FileCopyrightText: 2017      by Simon Frei <freisim93 at gmail dot com>
0012  *
0013  * SPDX-License-Identifier: GPL-2.0-or-later
0014  *
0015  * ============================================================ */
0016 
0017 #include "setupmisc_p.h"
0018 
0019 namespace Digikam
0020 {
0021 
0022 SetupMisc::SetupMisc(QWidget* const parent)
0023     : QScrollArea(parent),
0024       d          (new Private)
0025 {
0026     d->tab            = new QTabWidget(viewport());
0027     setWidget(d->tab);
0028     setWidgetResizable(true);
0029 
0030     const int spacing = qMin(QApplication::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing),
0031                              QApplication::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing));
0032 
0033     // -- Application Behavior Options --------------------------------------------------------
0034 
0035     QWidget* const behaviourPanel = new QWidget(d->tab);
0036     QGridLayout* const layout     = new QGridLayout(behaviourPanel);
0037 
0038     DHBox* const albumDateSourceHbox  = new DHBox(behaviourPanel);
0039     d->albumDateSourceLabel           = new QLabel(i18n("Get album date source:"), albumDateSourceHbox);
0040     d->albumDateSource                = new QComboBox(albumDateSourceHbox);
0041     d->albumDateSource->addItem(i18nc("method to get the album date", "From The Newest Item Date"), MetaEngineSettingsContainer::NewestItemDate);
0042     d->albumDateSource->addItem(i18nc("method to get the album date", "From The Oldest Item Date"), MetaEngineSettingsContainer::OldestItemDate);
0043     d->albumDateSource->addItem(i18nc("method to get the album date", "From The Average Date"),     MetaEngineSettingsContainer::AverageDate);
0044     d->albumDateSource->addItem(i18nc("method to get the album date", "From The Folder Date"),      MetaEngineSettingsContainer::FolderDate);
0045     d->albumDateSource->addItem(i18nc("method to get the album date", "No Change Of Date"),         MetaEngineSettingsContainer::IgnoreDate);
0046     d->albumDateSource->setToolTip(i18n("The album date is adjusted depending on the option set "
0047                                         "when new items are found during scanning."));
0048 
0049     DHBox* const stringComparisonHbox = new DHBox(behaviourPanel);
0050     d->stringComparisonTypeLabel      = new QLabel(i18n("String comparison type:"), stringComparisonHbox);
0051     d->stringComparisonType           = new QComboBox(stringComparisonHbox);
0052     d->stringComparisonType->addItem(i18nc("method to compare strings", "Natural"), ApplicationSettings::Natural);
0053     d->stringComparisonType->addItem(i18nc("method to compare strings", "Normal"),  ApplicationSettings::Normal);
0054     d->stringComparisonType->setToolTip(i18n("<qt>Sets the way in which strings are compared inside digiKam. "
0055                                              "This eg. influences the sorting of the tree views.<br/>"
0056                                              "<b>Natural</b> tries to compare strings in a way that regards some normal conventions "
0057                                              "and will eg. result in sorting numbers naturally even if they have a different number of digits.<br/>"
0058                                              "<b>Normal</b> uses a more technical approach. "
0059                                              "Use this style if you eg. want to entitle albums with ISO dates (201006 or 20090523) "
0060                                              "and the albums should be sorted according to these dates.</qt>"));
0061 
0062     // --------------------------------------------------------
0063 
0064     d->showTrashDeleteDialogCheck     = new QCheckBox(i18n("Confirm when moving items to the &trash"), behaviourPanel);
0065     d->showPermanentDeleteDialogCheck = new QCheckBox(i18n("Confirm when permanently deleting items"), behaviourPanel);
0066     d->sidebarApplyDirectlyCheck      = new QCheckBox(i18n("Do not confirm when applying changes in the &right sidebar"), behaviourPanel);
0067     d->scanAtStart                    = new QCheckBox(i18n("&Scan for new items at startup (makes startup slower)"), behaviourPanel);
0068     d->scanAtStart->setToolTip(i18n("Set this option to force digiKam to scan all collections for new items to\n"
0069                                     "register new elements in database. The scan is performed in the background through\n"
0070                                     "the progress manager available in the statusbar\n when digiKam main interface\n"
0071                                     "is loaded. If your computer is fast enough, this will have no effect on usability\n"
0072                                     "of digiKam while scanning. If your collections are huge or if you use a remote database,\n"
0073                                     "this can introduce low latency, and it is recommended to disable this option and to plan\n"
0074                                     "a manual scan through the maintenance tool at the right moment."));
0075 
0076     d->useFastScan                    = new QCheckBox(i18n("Fast scan (detects new, deleted and renamed items)"), behaviourPanel);
0077     d->useFastScan->setToolTip(i18n("Set this option to significantly speed up the scan. New items, deleted and also\n"
0078                                     "renamed items are found. In order to find items that have been changed, this\n"
0079                                     "option must be deactivated."));
0080 
0081     d->useFastScan->setEnabled(false);
0082 
0083     d->detectFaces                    = new QCheckBox(i18n("Detect faces in newly added images"), behaviourPanel);
0084 
0085     d->cleanAtStart                   = new QCheckBox(i18n("Remove obsolete core database objects (makes startup slower)"), behaviourPanel);
0086     d->cleanAtStart->setToolTip(i18n("Set this option to force digiKam to clean up the core database from obsolete item entries.\n"
0087                                      "Entries are only deleted if the connected image/video/audio file was already removed, i.e.\n"
0088                                      "the database object wastes space.\n"
0089                                      "This option does not clean up other databases as the thumbnails or recognition db.\n"
0090                                      "For clean up routines for other databases, please use the maintenance."));
0091 
0092     d->expandNewCurrentItemCheck              = new QCheckBox(i18n("Expand current tree item with a single mouse click"), behaviourPanel);
0093     d->scrollItemToCenterCheck                = new QCheckBox(i18n("Scroll current item to center of thumbbar"), behaviourPanel);
0094     d->showOnlyPersonTagsInPeopleSidebarCheck = new QCheckBox(i18n("Show only face tags for assigning names in people sidebar"), behaviourPanel);
0095 
0096 
0097     // ---------------------------------------------------------
0098 
0099     DHBox* const minSimilarityBoundHbox       = new DHBox(behaviourPanel);
0100     d->minSimilarityBoundLabel                = new QLabel(i18n("Lower bound for minimum similarity:"), minSimilarityBoundHbox);
0101     d->minimumSimilarityBound                 = new QSpinBox(minSimilarityBoundHbox);
0102     d->minimumSimilarityBound->setSuffix(QLatin1String("%"));
0103     d->minimumSimilarityBound->setRange(1, 100);
0104     d->minimumSimilarityBound->setSingleStep(1);
0105     d->minimumSimilarityBound->setValue(40);
0106     d->minimumSimilarityBound->setToolTip(i18n("Select here the lower bound of "
0107                                                "the minimum similarity threshold "
0108                                                "for fuzzy and duplicates searches. "
0109                                                "The default value is 40. Selecting "
0110                                                "a lower value than 40 can make the search <b>really</b> slow."));
0111     d->minSimilarityBoundLabel->setBuddy(d->minimumSimilarityBound);
0112 
0113     // ---------------------------------------------------------
0114 
0115     QGroupBox* const upOptionsGroup = new QGroupBox(i18n("Updates"), behaviourPanel);
0116     QVBoxLayout* const gLayout5     = new QVBoxLayout();
0117 
0118     DHBox* const updateHbox = new DHBox(upOptionsGroup);
0119     d->updateTypeLabel      = new QLabel(i18n("Check for new version:"), updateHbox);
0120     d->updateType           = new QComboBox(updateHbox);
0121     d->updateType->addItem(i18n("Only For Stable Releases"), 0);
0122     d->updateType->addItem(i18n("Weekly Pre-Releases"),      1);
0123     d->updateType->setToolTip(i18n("Set this option to configure which kind of new versions must be check for updates.\n"
0124                                    "\"Stable\" releases are official versions safe to use in production.\n"
0125                                    "\"Pre-releases\" are proposed weekly to tests quickly new features\n"
0126                                    "and are not recommended to use in production as bugs can remain."));
0127 
0128     d->updateWithDebug = new QCheckBox(i18n("Use Version With Debug Symbols"), upOptionsGroup);
0129     d->updateWithDebug->setWhatsThis(i18n("If this option is enabled, a version including debug symbols will be used for updates.\n"
0130                                           "This version is more heavy but can help developers to trace dysfunctions in debugger."));
0131 
0132     DHBox* const updateHbox2     = new DHBox(upOptionsGroup);
0133     QLabel* const lastCheckLabel = new QLabel(updateHbox2);
0134     lastCheckLabel->setText(i18n("Last check: %1", OnlineVersionChecker::lastCheckDate()));
0135     QPushButton* const updateNow = new QPushButton(i18n("Check now..."), updateHbox2);
0136 
0137     connect(updateNow, &QPushButton::pressed,
0138             this, [=]()
0139         {
0140             if (!checkSettings())
0141             {
0142                 return;
0143             }
0144 
0145             applySettings();
0146 
0147             if (parent)
0148             {
0149                 parent->close();
0150             }
0151 
0152             Setup::onlineVersionCheck();
0153         }
0154     );
0155 
0156     gLayout5->addWidget(updateHbox);
0157     gLayout5->addWidget(d->updateWithDebug);
0158     gLayout5->addWidget(updateHbox2);
0159     upOptionsGroup->setLayout(gLayout5);
0160 
0161     // ---------------------------------------------------------
0162 
0163     layout->setContentsMargins(spacing, spacing, spacing, spacing);
0164     layout->setSpacing(spacing);
0165     layout->addWidget(d->scanAtStart,                             0, 0, 1, 4);
0166     layout->addWidget(d->useFastScan,                             1, 3, 1, 1);
0167     layout->addWidget(d->detectFaces,                             2, 0, 1, 4);
0168     layout->addWidget(d->cleanAtStart,                            3, 0, 1, 4);
0169     layout->addWidget(new DLineWidget(Qt::Horizontal),            4, 0, 1, 4);
0170     layout->addWidget(d->showTrashDeleteDialogCheck,              5, 0, 1, 4);
0171     layout->addWidget(d->showPermanentDeleteDialogCheck,          6, 0, 1, 4);
0172     layout->addWidget(d->sidebarApplyDirectlyCheck,               7, 0, 1, 4);
0173     layout->addWidget(d->showOnlyPersonTagsInPeopleSidebarCheck,  8, 0, 1, 4);
0174     layout->addWidget(d->expandNewCurrentItemCheck,               9, 0, 1, 4);
0175     layout->addWidget(d->scrollItemToCenterCheck,                10, 0, 1, 4);
0176     layout->addWidget(albumDateSourceHbox,                       11, 0, 1, 4);
0177     layout->addWidget(stringComparisonHbox,                      12, 0, 1, 4);
0178     layout->addWidget(minSimilarityBoundHbox,                    13, 0, 1, 4);
0179     layout->addWidget(upOptionsGroup,                            14, 0, 1, 4);
0180     layout->setColumnStretch(3, 10);
0181     layout->setRowStretch(15, 10);
0182 
0183     // --------------------------------------------------------
0184 
0185     connect(d->scanAtStart, SIGNAL(toggled(bool)),
0186             d->useFastScan, SLOT(setEnabled(bool)));
0187 
0188     // --------------------------------------------------------
0189 
0190     d->tab->insertTab(Behaviour, behaviourPanel, i18nc("@title:tab", "Behaviour"));
0191 
0192     // -- Application Appearance Options --------------------------------------------------------
0193 
0194     QWidget* const appearancePanel = new QWidget(d->tab);
0195     QVBoxLayout* const layout2     = new QVBoxLayout(appearancePanel);
0196 
0197     d->showSplashCheck             = new QCheckBox(i18n("&Show splash screen at startup"), appearancePanel);
0198     d->useNativeFileDialogCheck    = new QCheckBox(i18n("Use native file dialogs from system"), appearancePanel);
0199     d->drawFramesToGroupedCheck    = new QCheckBox(i18n("Draw frames around grouped items"), appearancePanel);
0200 
0201     DHBox* const tabStyleHbox = new DHBox(appearancePanel);
0202     d->sidebarTypeLabel       = new QLabel(i18n("Sidebar tab title:"), tabStyleHbox);
0203     d->sidebarType            = new QComboBox(tabStyleHbox);
0204     d->sidebarType->addItem(i18n("Only For Active Tab"), 0);
0205     d->sidebarType->addItem(i18n("For All Tabs"),        1);
0206     d->sidebarType->setToolTip(i18n("Set this option to configure how sidebar tab titles are visible. "
0207                                     "Use \"Only For Active Tab\" option if you use a small screen resolution as with a laptop computer."));
0208 
0209     DHBox* const appStyleHbox = new DHBox(appearancePanel);
0210     d->applicationStyleLabel  = new QLabel(i18n("Widget style:"), appStyleHbox);
0211     d->applicationStyle       = new QComboBox(appStyleHbox);
0212     d->applicationStyle->setToolTip(i18n("Set this option to choose the default window decoration and looks."));
0213 
0214     Q_FOREACH (const QString& style, QStyleFactory::keys())
0215     {
0216         QString sitem = style;
0217         sitem[0]      = sitem[0].toUpper();
0218 
0219         if (sitem != QLatin1String("Macintosh"))        // See bug #475572
0220         {
0221             d->applicationStyle->addItem(sitem, sitem.toLower());
0222         }
0223     }
0224 
0225 #ifndef HAVE_APPSTYLE_SUPPORT
0226 
0227     // See Bug #365262
0228 
0229     appStyleHbox->setVisible(false);
0230 
0231 #endif
0232 
0233     DHBox* const iconThemeHbox = new DHBox(appearancePanel);
0234     d->applicationIconLabel    = new QLabel(i18n("Icon theme (changes after restart):"), iconThemeHbox);
0235     d->applicationIcon         = new QComboBox(iconThemeHbox);
0236     d->applicationIcon->setToolTip(i18n("Set this option to choose the default icon theme."));
0237 
0238     QMap<QString, QString> iconThemes;
0239     QMap<QString, QString> themeWhiteList;
0240     themeWhiteList.insert(QLatin1String("adwaita"),         i18nc("icon theme", "Adwaita"));
0241     themeWhiteList.insert(QLatin1String("breeze"),          i18nc("icon theme", "Breeze"));
0242     themeWhiteList.insert(QLatin1String("breeze-dark"),     i18nc("icon theme", "Breeze Dark"));
0243     themeWhiteList.insert(QLatin1String("faenza"),          i18nc("icon theme", "Faenza"));
0244     themeWhiteList.insert(QLatin1String("faenza-ambiance"), i18nc("icon theme", "Ambiance"));
0245     themeWhiteList.insert(QLatin1String("humanity"),        i18nc("icon theme", "Humanity"));
0246     themeWhiteList.insert(QLatin1String("oxygen"),          i18nc("icon theme", "Oxygen"));
0247 
0248     Q_FOREACH (const QString& path, QIcon::themeSearchPaths())
0249     {
0250         QDirIterator it(path, QDir::Dirs       |
0251                               QDir::NoSymLinks |
0252                               QDir::NoDotAndDotDot);
0253 
0254         while (it.hasNext())
0255         {
0256             if (QFile::exists(it.next() + QLatin1String("/index.theme")))
0257             {
0258                 QString iconKey = it.fileInfo().fileName().toLower();
0259 
0260                 if (themeWhiteList.contains(iconKey))
0261                 {
0262                     iconThemes[themeWhiteList.value(iconKey)] = it.fileInfo().fileName();
0263                 }
0264             }
0265         }
0266     }
0267 
0268     QMap<QString, QString>::const_iterator it = iconThemes.constBegin();
0269     d->applicationIcon->addItem(i18n("Use Icon Theme From System"), QString());
0270 
0271     for ( ; it != iconThemes.constEnd() ; ++it)
0272     {
0273         d->applicationIcon->addItem(it.key(), it.value());
0274     }
0275 
0276     d->applicationFont = new DFontSelect(i18n("Application font:"), appearancePanel);
0277     d->applicationFont->setToolTip(i18n("Select here the font used to display text in whole application."));
0278 
0279     // --------------------------------------------------------
0280 
0281     layout2->setContentsMargins(spacing, spacing, spacing, spacing);
0282     layout2->setSpacing(spacing);
0283     layout2->addWidget(d->showSplashCheck);
0284     layout2->addWidget(d->useNativeFileDialogCheck);
0285     layout2->addWidget(d->drawFramesToGroupedCheck);
0286     layout2->addWidget(tabStyleHbox);
0287     layout2->addWidget(appStyleHbox);
0288     layout2->addWidget(iconThemeHbox);
0289     layout2->addWidget(d->applicationFont);
0290     layout2->addStretch();
0291 
0292     d->tab->insertTab(Appearance, appearancePanel, i18nc("@title:tab", "Appearance"));
0293 
0294     // -- Grouping Options -------------------------------------
0295 
0296     QWidget* const groupingPanel = new QWidget(d->tab);
0297     QGridLayout* const grid      = new QGridLayout(groupingPanel);
0298 
0299     QLabel* const description    = new QLabel(i18n("Perform the following operations on all group members:"), groupingPanel);
0300     description->setToolTip(i18n("When images are grouped the following operations<br/>"
0301                                  "are performed only on the displayed item (No)<br/>"
0302                                  "or on all the hidden items in the group as well (Yes).<br/>"
0303                                  "If Ask is selected, there will be a prompt every<br/>"
0304                                  "time this operation is executed."));
0305 
0306     QLabel* const noLabel        = new QLabel(i18nc("@label: grouped image ops", "No"),  groupingPanel);
0307     QLabel* const yesLabel       = new QLabel(i18nc("@label: grouped image ops", "Yes"), groupingPanel);
0308     QLabel* const askLabel       = new QLabel(i18nc("@label: grouped image ops", "Ask"), groupingPanel);
0309 
0310     QHash<int, QLabel*> labels;
0311 
0312     for (int i = 0 ; i != ApplicationSettings::Unspecified ; ++i)
0313     {
0314         labels.insert(i, new QLabel(ApplicationSettings::operationTypeTitle(
0315                                     (ApplicationSettings::OperationType)i), groupingPanel));
0316         QString explanation = ApplicationSettings::operationTypeExplanation(
0317                               (ApplicationSettings::OperationType)i);
0318 
0319         if (!explanation.isEmpty())
0320         {
0321             labels.value(i)->setToolTip(explanation);
0322         }
0323 
0324         d->groupingButtons.insert(i, new QButtonGroup(groupingPanel));
0325         d->groupingButtons.value(i)->addButton(new QRadioButton(groupingPanel), 0);
0326         d->groupingButtons.value(i)->addButton(new QRadioButton(groupingPanel), 1);
0327         d->groupingButtons.value(i)->addButton(new QRadioButton(groupingPanel), 2);
0328     }
0329 
0330     grid->addWidget(description, 0, 0, 1, 4);
0331     grid->addWidget(noLabel,     1, 1, 1, 1);
0332     grid->addWidget(yesLabel,    1, 2, 1, 1);
0333     grid->addWidget(askLabel,    1, 3, 1, 1);
0334 
0335     for (int i = 0 ; i != ApplicationSettings::Unspecified ; ++i)
0336     {
0337         grid->addWidget(labels.value(i),                        i+2, 0, 1, 1);
0338         grid->addWidget(d->groupingButtons.value(i)->button(0), i+2, 1, 1, 1);
0339         grid->addWidget(d->groupingButtons.value(i)->button(1), i+2, 2, 1, 1);
0340         grid->addWidget(d->groupingButtons.value(i)->button(2), i+2, 3, 1, 1);
0341     }
0342 
0343     grid->setContentsMargins(spacing, spacing, spacing, spacing);
0344     grid->setSpacing(spacing);
0345     grid->setColumnStretch(0, 10);
0346     grid->setColumnMinimumWidth(1, 30);
0347     grid->setColumnMinimumWidth(2, 30);
0348     grid->setColumnMinimumWidth(3, 30);
0349     grid->setRowStretch(20, 10);
0350 
0351     d->tab->insertTab(Grouping, groupingPanel, i18nc("@title:tab", "Grouping"));
0352 
0353     // -- Spell Check and localize Options --------------------------------------
0354 
0355 #ifdef HAVE_SONNET
0356 
0357     d->spellCheckWidget = new SpellCheckConfig(d->tab);
0358 
0359     d->tab->insertTab(SpellCheck, d->spellCheckWidget, i18nc("@title:tab", "Spellcheck"));
0360 
0361 #endif
0362 
0363     d->localizeWidget = new LocalizeConfig(d->tab);
0364 
0365     d->tab->insertTab(Localize, d->localizeWidget, i18nc("@title:tab", "Localize"));
0366 
0367     // -- System Options --------------------------------------------------------
0368 
0369     d->systemSettingsWidget = new SystemSettingsWidget(d->tab);
0370 
0371     d->tab->insertTab(System, d->systemSettingsWidget, i18nc("@title:tab", "System"));
0372 
0373     // --------------------------------------------------------
0374 
0375     readSettings();
0376     adjustSize();
0377 }
0378 
0379 SetupMisc::~SetupMisc()
0380 {
0381     delete d;
0382 }
0383 
0384 void SetupMisc::setActiveTab(MiscTab tab)
0385 {
0386     d->tab->setCurrentIndex(tab);
0387 }
0388 
0389 SetupMisc::MiscTab SetupMisc::activeTab() const
0390 {
0391     return (MiscTab)d->tab->currentIndex();
0392 }
0393 
0394 bool SetupMisc::checkSettings()
0395 {
0396     // If check for new version use weekly pre-releases, warn end-user.
0397 
0398     if ((d->updateType->currentIndex()                    == 1) &&
0399         (ApplicationSettings::instance()->getUpdateType() == 0))
0400     {
0401         d->tab->setCurrentIndex(0);
0402 
0403         int result = QMessageBox::warning(this, qApp->applicationName(),
0404                                           i18n("Check for new version option will verify the pre-releases.\n"
0405                                                "\"Pre-releases\" are proposed weekly to tests quickly new features.\n"
0406                                                "It's not recommended to use pre-release in production as bugs can remain,\n"
0407                                                "unless you know what you are doing.\n"
0408                                                "Do you want to continue?"),
0409                                                 QMessageBox::Yes | QMessageBox::No);
0410         if (result == QMessageBox::Yes)
0411         {
0412             return true;
0413         }
0414 
0415         return false;
0416     }
0417 
0418     return true;
0419 }
0420 
0421 void SetupMisc::applySettings()
0422 {
0423     d->systemSettingsWidget->saveSettings();
0424 
0425     ApplicationSettings* const settings      = ApplicationSettings::instance();
0426     MetaEngineSettingsContainer metaSettings = MetaEngineSettings::instance()->settings();
0427 
0428     settings->setShowSplashScreen(d->showSplashCheck->isChecked());
0429     settings->setShowTrashDeleteDialog(d->showTrashDeleteDialogCheck->isChecked());
0430     settings->setShowPermanentDeleteDialog(d->showPermanentDeleteDialogCheck->isChecked());
0431     settings->setMinimumSimilarityBound(d->minimumSimilarityBound->value());
0432     settings->setApplySidebarChangesDirectly(d->sidebarApplyDirectlyCheck->isChecked());
0433     settings->setScanAtStart(d->scanAtStart->isChecked());
0434     settings->setDetectFacesInNewImages(d->detectFaces->isChecked());
0435     settings->setCleanAtStart(d->cleanAtStart->isChecked());
0436     settings->setUseNativeFileDialog(d->useNativeFileDialogCheck->isChecked());
0437     settings->setDrawFramesToGrouped(d->drawFramesToGroupedCheck->isChecked());
0438     settings->setExpandNewCurrentItem(d->expandNewCurrentItemCheck->isChecked());
0439     settings->setScrollItemToCenter(d->scrollItemToCenterCheck->isChecked());
0440     settings->setShowOnlyPersonTagsInPeopleSidebar(d->showOnlyPersonTagsInPeopleSidebarCheck->isChecked());
0441     settings->setSidebarTitleStyle(d->sidebarType->currentIndex() == 0 ? DMultiTabBar::ActiveIconText : DMultiTabBar::AllIconsText);
0442     settings->setUpdateType(d->updateType->currentIndex());
0443     settings->setUpdateWithDebug(d->updateWithDebug->isChecked());
0444     settings->setStringComparisonType((ApplicationSettings::StringComparisonType)
0445                                       d->stringComparisonType->itemData(d->stringComparisonType->currentIndex()).toInt());
0446 
0447     metaSettings.useFastScan = d->scanAtStart->isChecked() ? d->useFastScan->isChecked() : false;
0448     metaSettings.albumDateFrom = (MetaEngineSettingsContainer::AlbumDateSource)
0449                                  d->albumDateSource->itemData(d->albumDateSource->currentIndex()).toInt();
0450     MetaEngineSettings::instance()->setSettings(metaSettings);
0451 
0452     for (int i = 0 ; i != ApplicationSettings::Unspecified ; ++i)
0453     {
0454         settings->setGroupingOperateOnAll((ApplicationSettings::OperationType)i,
0455                                           (ApplicationSettings::ApplyToEntireGroup)d->groupingButtons.value(i)->checkedId());
0456     }
0457 
0458 #ifdef HAVE_APPSTYLE_SUPPORT
0459 
0460     if (settings->getApplicationStyle().compare(d->applicationStyle->currentText(), Qt::CaseInsensitive) != 0)
0461     {
0462         settings->setApplicationStyle(d->applicationStyle->currentText());
0463         ThemeManager::instance()->updateThemeMenu();
0464     }
0465 
0466 #endif
0467 
0468     settings->setIconTheme(d->applicationIcon->currentData().toString());
0469     settings->setApplicationFont(d->applicationFont->font());
0470     settings->saveSettings();
0471 
0472 #ifdef HAVE_SONNET
0473 
0474     d->spellCheckWidget->applySettings();
0475 
0476 #endif
0477 
0478     d->localizeWidget->applySettings();
0479 }
0480 
0481 void SetupMisc::readSettings()
0482 {
0483     d->systemSettingsWidget->readSettings();
0484 
0485     ApplicationSettings* const settings = ApplicationSettings::instance();
0486 
0487     d->showSplashCheck->setChecked(settings->getShowSplashScreen());
0488     d->showTrashDeleteDialogCheck->setChecked(settings->getShowTrashDeleteDialog());
0489     d->showPermanentDeleteDialogCheck->setChecked(settings->getShowPermanentDeleteDialog());
0490     d->minimumSimilarityBound->setValue(settings->getMinimumSimilarityBound());
0491     d->sidebarApplyDirectlyCheck->setChecked(settings->getApplySidebarChangesDirectly());
0492     d->sidebarApplyDirectlyCheck->setChecked(settings->getApplySidebarChangesDirectly());
0493     d->scanAtStart->setChecked(settings->getScanAtStart());
0494     d->detectFaces->setChecked(settings->getDetectFacesInNewImages());
0495     d->cleanAtStart->setChecked(settings->getCleanAtStart());
0496     d->useNativeFileDialogCheck->setChecked(settings->getUseNativeFileDialog());
0497     d->drawFramesToGroupedCheck->setChecked(settings->getDrawFramesToGrouped());
0498     d->expandNewCurrentItemCheck->setChecked(settings->getExpandNewCurrentItem());
0499     d->scrollItemToCenterCheck->setChecked(settings->getScrollItemToCenter());
0500     d->showOnlyPersonTagsInPeopleSidebarCheck->setChecked(settings->showOnlyPersonTagsInPeopleSidebar());
0501     d->sidebarType->setCurrentIndex(settings->getSidebarTitleStyle() == DMultiTabBar::ActiveIconText ? 0 : 1);
0502     d->updateType->setCurrentIndex(settings->getUpdateType());
0503     d->updateWithDebug->setChecked(settings->getUpdateWithDebug());
0504     d->stringComparisonType->setCurrentIndex(settings->getStringComparisonType());
0505 
0506     MetaEngineSettingsContainer metaSettings = MetaEngineSettings::instance()->settings();
0507     d->albumDateSource->setCurrentIndex((int)metaSettings.albumDateFrom);
0508     d->useFastScan->setChecked(metaSettings.useFastScan);
0509 
0510     for (int i = 0 ; i != ApplicationSettings::Unspecified ; ++i)
0511     {
0512         d->groupingButtons.value(i)->button((int)settings->getGroupingOperateOnAll((ApplicationSettings::OperationType)i))->setChecked(true);
0513     }
0514 
0515 #ifdef HAVE_APPSTYLE_SUPPORT
0516 
0517     d->applicationStyle->setCurrentIndex(d->applicationStyle->findData(settings->getApplicationStyle().toLower()));
0518 
0519 #endif
0520 
0521     d->applicationIcon->setCurrentIndex(d->applicationIcon->findData(settings->getIconTheme()));
0522     d->applicationFont->setFont(settings->getApplicationFont());
0523 
0524     // NOTE: Spellcheck and Localize read settings is done in widget constructor.
0525 }
0526 
0527 } // namespace Digikam
0528 
0529 #include "moc_setupmisc.cpp"