diff --git a/core/utilities/setup/setup.cpp b/core/utilities/setup/setup.cpp index 640ddd476f..1cba75a075 100644 --- a/core/utilities/setup/setup.cpp +++ b/core/utilities/setup/setup.cpp @@ -1,585 +1,602 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2003-02-03 * Description : digiKam setup dialog. * * Copyright (C) 2003-2005 by Renchi Raju * Copyright (C) 2003-2020 by Gilles Caulier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU Album * Public License as published by the Free Software Foundation; * either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Album Public License for more details. * * ============================================================ */ #include "setup.h" // Qt includes #include #include #include // KDE includes #include #include #include // Local includes #include "digikam_debug.h" #include "loadingcacheinterface.h" #include "applicationsettings.h" #include "setupalbumview.h" #include "setupcamera.h" #include "setupcollections.h" #include "setupeditor.h" #include "setupicc.h" #include "setuplighttable.h" #include "setupmetadata.h" #include "setupmisc.h" #include "setupslideshow.h" #include "setupimagequalitysorter.h" #include "setuptooltip.h" #include "setupdatabase.h" #include "setupplugins.h" #include "importsettings.h" #include "dxmlguiwindow.h" namespace Digikam { class Q_DECL_HIDDEN Setup::Private { public: explicit Private() : page_database(nullptr), page_collections(nullptr), page_albumView(nullptr), page_tooltip(nullptr), page_metadata(nullptr), page_template(nullptr), page_lighttable(nullptr), page_editor(nullptr), page_slideshow(nullptr), page_imagequalitysorter(nullptr), page_icc(nullptr), page_camera(nullptr), page_plugins(nullptr), page_misc(nullptr), databasePage(nullptr), collectionsPage(nullptr), albumViewPage(nullptr), tooltipPage(nullptr), metadataPage(nullptr), templatePage(nullptr), lighttablePage(nullptr), editorPage(nullptr), slideshowPage(nullptr), imageQualitySorterPage(nullptr), iccPage(nullptr), cameraPage(nullptr), pluginsPage(nullptr), miscPage(nullptr) { } DConfigDlgWdgItem* page_database; DConfigDlgWdgItem* page_collections; DConfigDlgWdgItem* page_albumView; DConfigDlgWdgItem* page_tooltip; DConfigDlgWdgItem* page_metadata; DConfigDlgWdgItem* page_template; DConfigDlgWdgItem* page_lighttable; DConfigDlgWdgItem* page_editor; DConfigDlgWdgItem* page_slideshow; DConfigDlgWdgItem* page_imagequalitysorter; DConfigDlgWdgItem* page_icc; DConfigDlgWdgItem* page_camera; DConfigDlgWdgItem* page_plugins; DConfigDlgWdgItem* page_misc; SetupDatabase* databasePage; SetupCollections* collectionsPage; SetupAlbumView* albumViewPage; SetupToolTip* tooltipPage; SetupMetadata* metadataPage; SetupTemplate* templatePage; SetupLightTable* lighttablePage; SetupEditor* editorPage; SetupSlideShow* slideshowPage; SetupImageQualitySorter* imageQualitySorterPage; SetupICC* iccPage; SetupCamera* cameraPage; SetupPlugins* pluginsPage; SetupMisc* miscPage; public: DConfigDlgWdgItem* pageItem(Setup::Page page) const; }; Setup::Setup(QWidget* const parent) : DConfigDlg(parent), d(new Private) { setWindowFlags((windowFlags() & ~Qt::Dialog) | Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowMinMaxButtonsHint); setWindowTitle(i18n("Configure")); setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel); button(QDialogButtonBox::Ok)->setDefault(true); setFaceType(List); setModal(true); d->databasePage = new SetupDatabase(); d->page_database = addPage(d->databasePage, i18n("Database")); d->page_database->setHeader(i18n("Database Settings
" "Customize database settings
")); d->page_database->setIcon(QIcon::fromTheme(QLatin1String("network-server-database"))); d->collectionsPage = new SetupCollections(); d->page_collections = addPage(d->collectionsPage, i18n("Collections")); d->page_collections->setHeader(i18n("Collections Settings
" "Set root albums locations
")); d->page_collections->setIcon(QIcon::fromTheme(QLatin1String("folder-pictures"))); d->albumViewPage = new SetupAlbumView(); d->page_albumView = addPage(d->albumViewPage, i18n("Views")); d->page_albumView->setHeader(i18n("Application Views Settings
" "Customize the look of the views
")); d->page_albumView->setIcon(QIcon::fromTheme(QLatin1String("view-list-icons"))); d->tooltipPage = new SetupToolTip(); d->page_tooltip = addPage(d->tooltipPage, i18n("Tool-Tip")); d->page_tooltip->setHeader(i18n("Items Tool-Tip Settings
" "Customize information in item tool-tips
")); d->page_tooltip->setIcon(QIcon::fromTheme(QLatin1String("dialog-information"))); d->metadataPage = new SetupMetadata(); d->page_metadata = addPage(d->metadataPage, i18n("Metadata")); d->page_metadata->setHeader(i18n("Embedded Image Information Management
" "Setup relations between images and metadata
")); d->page_metadata->setIcon(QIcon::fromTheme(QLatin1String("format-text-code"))); // krazy:exclude=iconnames d->templatePage = new SetupTemplate(); d->page_template = addPage(d->templatePage, i18n("Templates")); d->page_template->setHeader(i18n("Metadata templates
" "Manage your collection of metadata templates
")); d->page_template->setIcon(QIcon::fromTheme(QLatin1String("im-user"))); d->editorPage = new SetupEditor(); d->page_editor = addPage(d->editorPage, i18n("Image Editor")); d->page_editor->setHeader(i18n("Image Editor Settings
" "Customize the image editor settings
")); d->page_editor->setIcon(QIcon::fromTheme(QLatin1String("document-edit"))); d->iccPage = new SetupICC(buttonBox()); d->page_icc = addPage(d->iccPage, i18n("Color Management")); d->page_icc->setHeader(i18n("Settings for Color Management
" "Customize the color management settings
")); d->page_icc->setIcon(QIcon::fromTheme(QLatin1String("preferences-desktop-display-color"))); d->lighttablePage = new SetupLightTable(); d->page_lighttable = addPage(d->lighttablePage, i18n("Light Table")); d->page_lighttable->setHeader(i18n("Light Table Settings
" "Customize tool used to compare images
")); d->page_lighttable->setIcon(QIcon::fromTheme(QLatin1String("lighttable"))); d->slideshowPage = new SetupSlideShow(); d->page_slideshow = addPage(d->slideshowPage, i18n("Slide Show")); d->page_slideshow->setHeader(i18n("Slide Show Settings
" "Customize slideshow settings
")); d->page_slideshow->setIcon(QIcon::fromTheme(QLatin1String("view-presentation"))); d->imageQualitySorterPage = new SetupImageQualitySorter(); d->page_imagequalitysorter = addPage(d->imageQualitySorterPage, i18n("Image Quality Sorter")); d->page_imagequalitysorter->setHeader(i18n("Image Quality Sorter Settings")); d->page_imagequalitysorter->setIcon(QIcon::fromTheme(QLatin1String("flag-green"))); d->cameraPage = new SetupCamera(); d->page_camera = addPage(d->cameraPage, i18n("Cameras")); d->page_camera->setHeader(i18n("Camera Settings
" "Manage your camera devices
")); d->page_camera->setIcon(QIcon::fromTheme(QLatin1String("camera-photo"))); connect(d->cameraPage, SIGNAL(signalUseFileMetadataChanged(bool)), d->tooltipPage, SLOT(slotUseFileMetadataChanged(bool))); d->pluginsPage = new SetupPlugins(); d->page_plugins = addPage(d->pluginsPage, i18n("Plugins")); d->page_plugins->setHeader(i18n("Plug-in Settings
" "Set which plugins will be accessible from application
")); d->page_plugins->setIcon(QIcon::fromTheme(QLatin1String("preferences-plugin"))); d->miscPage = new SetupMisc(); d->page_misc = addPage(d->miscPage, i18n("Miscellaneous")); d->page_misc->setHeader(i18n("Miscellaneous Settings
" "Customize behavior of the other parts of digiKam
")); d->page_misc->setIcon(QIcon::fromTheme(QLatin1String("preferences-other"))); for (int i = 0 ; i != SetupPageEnumLast ; ++i) { DConfigDlgWdgItem* const item = d->pageItem((Page)i); if (!item) { continue; } QWidget* const wgt = item->widget(); QScrollArea* const scrollArea = qobject_cast(wgt); if (scrollArea) { scrollArea->setFrameShape(QFrame::NoFrame); } } connect(buttonBox(), SIGNAL(helpRequested()), this, SLOT(slotHelp())); connect(buttonBox()->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &Setup::slotOkClicked); KSharedConfig::Ptr config = KSharedConfig::openConfig(); KConfigGroup group = config->group(QLatin1String("Setup Dialog")); winId(); windowHandle()->resize(800, 600); DXmlGuiWindow::restoreWindowSize(windowHandle(), group); resize(windowHandle()->size()); } Setup::~Setup() { KSharedConfig::Ptr config = KSharedConfig::openConfig(); KConfigGroup group = config->group(QLatin1String("Setup Dialog")); group.writeEntry(QLatin1String("Setup Page"), (int)activePageIndex()); DXmlGuiWindow::saveWindowSize(windowHandle(), group); config->sync(); delete d; } void Setup::slotHelp() { DXmlGuiWindow::openHandbook(); } void Setup::setTemplate(const Template& t) { if (d->templatePage) { d->templatePage->setTemplate(t); } } QSize Setup::sizeHint() const { // The minimum size is very small. But the default initial size is such // that some important tabs get a scroll bar, although the dialog could be larger // on a normal display (QScrollArea size hint does not take widget into account) // Adjust size hint here so that certain selected tabs are display full per default. + QSize hint = DConfigDlg::sizeHint(); int maxHintHeight = 0; int maxWidgetHeight = 0; for (int page = 0 ; page != SetupPageEnumLast ; ++page) { // only take tabs into account here that should better be displayed without scrolling - if (page == CollectionsPage || - page == AlbumViewPage || - page == TemplatePage || - page == LightTablePage || - page == EditorPage || - page == PluginsPage || - page == MiscellaneousPage) + + if ( + (page == CollectionsPage) || + (page == AlbumViewPage) || + (page == TemplatePage) || + (page == LightTablePage) || + (page == EditorPage) || + (page == PluginsPage) || + (page == MiscellaneousPage) + ) { DConfigDlgWdgItem* const item = d->pageItem((Page)page); if (!item) { continue; } QWidget* const page = item->widget(); maxHintHeight = qMax(maxHintHeight, page->sizeHint().height()); QScrollArea* const scrollArea = qobject_cast(page); if (scrollArea) { maxWidgetHeight = qMax(maxWidgetHeight, scrollArea->widget()->sizeHint().height()); } } } // The additional 20 is a hack to make it work. // Don't know why, the largest page would have scroll bars without this + if (maxWidgetHeight > maxHintHeight) { hint.setHeight(hint.height() + (maxWidgetHeight - maxHintHeight) + 20); } return hint; } bool Setup::execDialog(Page page) { return execDialog(nullptr, page); } bool Setup::execDialog(QWidget* const parent, Page page) { QPointer setup = new Setup(parent); setup->showPage(page); bool success = (setup->DConfigDlg::exec() == QDialog::Accepted); delete setup; + return success; } bool Setup::execSinglePage(Page page) { return execSinglePage(nullptr, page); } bool Setup::execSinglePage(QWidget* const parent, Page page) { QPointer setup = new Setup(parent); setup->showPage(page); setup->setFaceType(Plain); bool success = (setup->DConfigDlg::exec() == QDialog::Accepted); delete setup; + return success; } bool Setup::execTemplateEditor(QWidget* const parent, const Template& t) { QPointer setup = new Setup(parent); setup->showPage(TemplatePage); setup->setFaceType(Plain); setup->setTemplate(t); bool success = (setup->DConfigDlg::exec() == QDialog::Accepted); delete setup; + return success; } bool Setup::execMetadataFilters(QWidget* const parent, int tab) { QPointer setup = new Setup(parent); setup->showPage(MetadataPage); setup->setFaceType(Plain); DConfigDlgWdgItem* const cur = setup->currentPage(); - if (!cur) return false; + + if (!cur) + { + return false; + } SetupMetadata* const widget = dynamic_cast(cur->widget()); - if (!widget) return false; + + if (!widget) + { + return false; + } widget->setActiveMainTab(SetupMetadata::Display); widget->setActiveSubTab(tab); bool success = (setup->DConfigDlg::exec() == QDialog::Accepted); delete setup; + return success; } void Setup::slotOkClicked() { if (!d->cameraPage->checkSettings()) { showPage(CameraPage); return; } qApp->setOverrideCursor(Qt::WaitCursor); d->cameraPage->applySettings(); d->databasePage->applySettings(); d->collectionsPage->applySettings(); d->albumViewPage->applySettings(); d->tooltipPage->applySettings(); d->metadataPage->applySettings(); d->templatePage->applySettings(); d->lighttablePage->applySettings(); d->editorPage->applySettings(); d->slideshowPage->applySettings(); d->imageQualitySorterPage->applySettings(); d->iccPage->applySettings(); d->pluginsPage->applySettings(); d->miscPage->applySettings(); ApplicationSettings::instance()->emitSetupChanged(); ImportSettings::instance()->emitSetupChanged(); qApp->restoreOverrideCursor(); if (d->metadataPage->exifAutoRotateHasChanged()) { LoadingCacheInterface::cleanThumbnailCache(); } accept(); } void Setup::showPage(Setup::Page page) { DConfigDlgWdgItem* item = nullptr; if (page == LastPageUsed) { KSharedConfig::Ptr config = KSharedConfig::openConfig(); KConfigGroup group = config->group(QLatin1String("Setup Dialog")); item = d->pageItem((Page)group.readEntry(QLatin1String("Setup Page"), (int)CollectionsPage)); } else { item = d->pageItem(page); } if (!item) { item = d->pageItem(CollectionsPage); } setCurrentPage(item); } Setup::Page Setup::activePageIndex() const { DConfigDlgWdgItem* const cur = currentPage(); if (cur == d->page_collections) { return CollectionsPage; } if (cur == d->page_albumView) { return AlbumViewPage; } if (cur == d->page_tooltip) { return ToolTipPage; } if (cur == d->page_metadata) { return MetadataPage; } if (cur == d->page_template) { return TemplatePage; } if (cur == d->page_lighttable) { return LightTablePage; } if (cur == d->page_editor) { return EditorPage; } if (cur == d->page_slideshow) { return SlideshowPage; } if (cur == d->page_imagequalitysorter) { return ImageQualityPage; } if (cur == d->page_icc) { return ICCPage; } if (cur == d->page_camera) { return CameraPage; } if (cur == d->page_plugins) { return PluginsPage; } if (cur == d->page_misc) { return MiscellaneousPage; } return DatabasePage; } DConfigDlgWdgItem* Setup::Private::pageItem(Setup::Page page) const { switch (page) { case Setup::DatabasePage: return page_database; case Setup::CollectionsPage: return page_collections; case Setup::AlbumViewPage: return page_albumView; case Setup::ToolTipPage: return page_tooltip; case Setup::MetadataPage: return page_metadata; case Setup::TemplatePage: return page_template; case Setup::LightTablePage: return page_lighttable; case Setup::EditorPage: return page_editor; case Setup::SlideshowPage: return page_slideshow; case Setup::ImageQualityPage: return page_imagequalitysorter; case Setup::ICCPage: return page_icc; case Setup::CameraPage: return page_camera; case Setup::PluginsPage: return page_plugins; case Setup::MiscellaneousPage: return page_misc; default: return nullptr; } } } // namespace Digikam diff --git a/core/utilities/setup/setup.h b/core/utilities/setup/setup.h index 3900d63860..5b10216365 100644 --- a/core/utilities/setup/setup.h +++ b/core/utilities/setup/setup.h @@ -1,109 +1,110 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2003-02-03 * Description : digiKam setup dialog. * * Copyright (C) 2003-2005 by Renchi Raju * Copyright (C) 2003-2020 by Gilles Caulier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ #ifndef DIGIKAM_SETUP_H #define DIGIKAM_SETUP_H // Local includes #include "digikam_config.h" #include "setuptemplate.h" #include "template.h" #include "searchtextbar.h" #include "dconfigdlg.h" namespace Digikam { class Setup : public DConfigDlg { Q_OBJECT public: enum Page { LastPageUsed = -1, DatabasePage = 0, CollectionsPage, AlbumViewPage, ToolTipPage, MetadataPage, TemplatePage, EditorPage, ICCPage, LightTablePage, SlideshowPage, ImageQualityPage, CameraPage, PluginsPage, MiscellaneousPage, + SetupPageEnumLast }; public: - /* + /** * Show a setup dialog. The specified page will be selected. * True is returned if the dialog was closed with Ok. */ static bool execDialog(Page page = LastPageUsed); static bool execDialog(QWidget* const parent, Page page = LastPageUsed); - /* + /** * Show a setup dialog. Only the specified page will be available. */ static bool execSinglePage(Page page); static bool execSinglePage(QWidget* const parent, Page page); static bool execTemplateEditor(QWidget* const parent, const Template& t); void setTemplate(const Template& t); static bool execMetadataFilters(QWidget* const parent, int tab); QSize sizeHint() const override; private Q_SLOTS: void slotHelp(); void slotOkClicked(); private: explicit Setup(QWidget* const parent = nullptr); ~Setup(); Setup::Page activePageIndex() const; void showPage(Setup::Page page); private: class Private; Private* const d; }; } // namespace Digikam #endif // DIGIKAM_SETUP_H diff --git a/core/utilities/setup/setupdatabase.cpp b/core/utilities/setup/setupdatabase.cpp index ceb6931e26..ed21c77ff3 100644 --- a/core/utilities/setup/setupdatabase.cpp +++ b/core/utilities/setup/setupdatabase.cpp @@ -1,323 +1,325 @@ /* ============================================================ * * This file is a part of digiKam project * https://www.digikam.org * * Date : 2009-11-14 * Description : database setup tab * * Copyright (C) 2009-2010 by Holger Foerster * Copyright (C) 2012-2020 by Gilles Caulier * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ #include "setupdatabase.h" // Qt includes #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // KDE includes #include // Local includes #include "albummanager.h" #include "applicationsettings.h" #include "coredbschemaupdater.h" #include "databaseserverstarter.h" #include "dbengineparameters.h" #include "dbsettingswidget.h" #include "digikam_debug.h" #include "scancontroller.h" #include "setuputils.h" namespace Digikam { class Q_DECL_HIDDEN SetupDatabase::Private { public: explicit Private() : databaseWidget(nullptr), updateBox(nullptr), hashesButton(nullptr), ignoreEdit(nullptr), ignoreLabel(nullptr) { } DatabaseSettingsWidget* databaseWidget; QGroupBox* updateBox; QPushButton* hashesButton; QLineEdit* ignoreEdit; QLabel* ignoreLabel; }; SetupDatabase::SetupDatabase(QWidget* const parent) : QScrollArea(parent), d(new Private) { QTabWidget* tab = new QTabWidget(viewport()); setWidget(tab); setWidgetResizable(true); // -------------------------------------------------------- QWidget* const settingsPanel = new QWidget(tab); QVBoxLayout* settingsLayout = new QVBoxLayout(settingsPanel); - d->databaseWidget = new DatabaseSettingsWidget; + d->databaseWidget = new DatabaseSettingsWidget; settingsLayout->addWidget(d->databaseWidget); if (!CoreDbSchemaUpdater::isUniqueHashUpToDate()) { createUpdateBox(); settingsLayout->addStretch(10); settingsLayout->addWidget(d->updateBox); } tab->insertTab(DbSettings, settingsPanel, i18nc("@title:tab", "Database Settings")); // -------------------------------------------------------- - QWidget* const ignorePanel = new QWidget(tab); + QWidget* const ignorePanel = new QWidget(tab); QGridLayout* ignoreLayout = new QGridLayout(ignorePanel); QLabel* const ignoreInfoLabel = new QLabel( i18n("

Set the names of directories that you want to ignore " "from your photo collections. The names are case sensitive " "and should be separated by a semicolon.

" "

This is for example useful when you store your photos " "on a Synology NAS (Network Attached Storage). In every " "directory the system creates a subdirectory @eaDir to " "store thumbnails. To avoid digiKam inserting the original " "photo and its corresponding thumbnail twice, @eaDir is " "ignored by default.

" "

To re-include directories that are ignored by default " "prefix it with a minus, e.g. -@eaDir.

"), ignorePanel); ignoreInfoLabel->setWordWrap(true); QLabel* const logoLabel1 = new QLabel(ignorePanel); logoLabel1->setPixmap(QIcon::fromTheme(QLatin1String("folder")).pixmap(48)); d->ignoreLabel = new QLabel(ignorePanel); d->ignoreLabel->setText(i18n("Additional directories to ignore " "(Currently ignored directories):")); d->ignoreEdit = new QLineEdit(ignorePanel); d->ignoreEdit->setClearButtonEnabled(true); d->ignoreEdit->setPlaceholderText(i18n("Enter directories that you want to " "ignore from adding to your collections.")); ignoreInfoLabel->setBuddy(d->ignoreEdit); int row = 0; ignoreLayout->addWidget(ignoreInfoLabel, row, 0, 1, 2); row++; ignoreLayout->addWidget(logoLabel1, row, 0, 2, 1); ignoreLayout->addWidget(d->ignoreLabel, row, 1, 1, 1); row++; ignoreLayout->addWidget(d->ignoreEdit, row, 1, 1, 1); row++; ignoreLayout->setColumnStretch(1, 10); ignoreLayout->setRowStretch(row, 10); const int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing); ignoreLayout->setContentsMargins(spacing, spacing, spacing, spacing); ignoreLayout->setSpacing(spacing); connect(d->ignoreLabel, SIGNAL(linkActivated(QString)), this, SLOT(slotShowCurrentIgnoredDirectoriesSettings())); tab->insertTab(IgnoreDirs, ignorePanel, i18nc("@title:tab", "Ignored Directories")); // -------------------------------------------------------- readSettings(); adjustSize(); } SetupDatabase::~SetupDatabase() { delete d; } void SetupDatabase::applySettings() { ApplicationSettings* const settings = ApplicationSettings::instance(); if (!settings) { return; } QString ignoreDirectory; CoreDbAccess().db()->getUserIgnoreDirectoryFilterSettings(&ignoreDirectory); if (d->ignoreEdit->text() != ignoreDirectory) { CoreDbAccess().db()->setUserIgnoreDirectoryFilterSettings( cleanUserFilterString(d->ignoreEdit->text(), true, true)); ScanController::instance()->completeCollectionScanInBackground(false); } if (d->databaseWidget->getDbEngineParameters() == d->databaseWidget->orgDatabasePrm()) { qCDebug(DIGIKAM_GENERAL_LOG) << "No DB settings changes. Do nothing..."; return; } if (!d->databaseWidget->checkDatabaseSettings()) { qCDebug(DIGIKAM_GENERAL_LOG) << "DB settings check invalid. Do nothing..."; return; } switch (d->databaseWidget->databaseType()) { case DatabaseSettingsWidget::SQlite: { qCDebug(DIGIKAM_GENERAL_LOG) << "Switch to SQlite DB config..."; DbEngineParameters params = d->databaseWidget->getDbEngineParameters(); settings->setDbEngineParameters(params); settings->saveSettings(); AlbumManager::instance()->changeDatabase(params); break; } + case DatabaseSettingsWidget::MysqlInternal: { qCDebug(DIGIKAM_GENERAL_LOG) << "Switch to Mysql Internal DB config..."; DbEngineParameters params = d->databaseWidget->getDbEngineParameters(); settings->setDbEngineParameters(params); settings->saveSettings(); AlbumManager::instance()->changeDatabase(params); break; } + default: // DatabaseSettingsWidget::MysqlServer { qCDebug(DIGIKAM_GENERAL_LOG) << "Switch to Mysql server DB config..."; DbEngineParameters params = d->databaseWidget->getDbEngineParameters(); settings->setDbEngineParameters(params); settings->saveSettings(); AlbumManager::instance()->changeDatabase(params); break; } } } void SetupDatabase::readSettings() { ApplicationSettings* const settings = ApplicationSettings::instance(); if (!settings) { return; } QString ignoreDirectory; CoreDbAccess().db()->getUserIgnoreDirectoryFilterSettings(&ignoreDirectory); d->ignoreEdit->setText(ignoreDirectory); d->databaseWidget->setParametersFromSettings(settings); } void SetupDatabase::upgradeUniqueHashes() { int result = QMessageBox::warning(this, qApp->applicationName(), i18nc("@info", "

The process of updating the file hashes takes a few minutes.

" "

Please ensure that any important collections on removable media are connected. " "After the upgrade you cannot use your database with a digiKam version " "prior to 2.0.

" "

Do you want to begin the update?

"), QMessageBox::Yes | QMessageBox::No); if (result == QMessageBox::Yes) { ScanController::instance()->updateUniqueHash(); } } void SetupDatabase::createUpdateBox() { d->updateBox = new QGroupBox(i18nc("@title:group", "Updates")); QGridLayout* const updateLayout = new QGridLayout; d->hashesButton = new QPushButton(i18nc("@action:button", "Update File Hashes")); d->hashesButton->setWhatsThis(i18nc("@info:tooltip", "File hashes are used to identify identical files and to display thumbnails. " "A new, improved algorithm to create the hash is now used. " "The old algorithm, though, still works quite well, so it is recommended to " "carry out this upgrade, but not required.
" "After the upgrade you cannot use your database with a digiKam version " "prior to 2.0.
")); QPushButton* const infoHash = new QPushButton; infoHash->setIcon(QIcon::fromTheme(QLatin1String("dialog-information"))); infoHash->setToolTip(i18nc("@info:tooltip", "Get information about Update File Hashes")); updateLayout->addWidget(d->hashesButton, 0, 0); updateLayout->addWidget(infoHash, 0, 1); updateLayout->setColumnStretch(2, 1); d->updateBox->setLayout(updateLayout); connect(d->hashesButton, SIGNAL(clicked()), this, SLOT(upgradeUniqueHashes())); connect(infoHash, SIGNAL(clicked()), this, SLOT(showHashInformation())); } void SetupDatabase::showHashInformation() { qApp->postEvent(d->hashesButton, new QHelpEvent(QEvent::WhatsThis, QPoint(0, 0), QCursor::pos())); } void SetupDatabase::slotShowCurrentIgnoredDirectoriesSettings() const { QStringList ignoreDirectoryList; CoreDbAccess().db()->getIgnoreDirectoryFilterSettings(&ignoreDirectoryList); QString text = i18n("

Directories starting with a dot are ignored by " "default.
%1

", ignoreDirectoryList.join(QLatin1Char(';'))); QWhatsThis::showText(d->ignoreLabel->mapToGlobal(QPoint(0, 0)), text, d->ignoreLabel); } } // namespace Digikam