File indexing completed on 2025-01-05 04:00:14
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2003-02-03 0007 * Description : digiKam setup dialog. 0008 * 0009 * SPDX-FileCopyrightText: 2003-2005 by Renchi Raju <renchi dot raju at gmail dot com> 0010 * SPDX-FileCopyrightText: 2003-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0011 * 0012 * SPDX-License-Identifier: GPL-2.0-or-later 0013 * 0014 * ============================================================ */ 0015 0016 #include "setup.h" 0017 0018 // Qt includes 0019 0020 #include <QPointer> 0021 #include <QApplication> 0022 #include <QMessageBox> 0023 0024 // KDE includes 0025 0026 #include <kconfiggroup.h> 0027 #include <klocalizedstring.h> 0028 #include <ksharedconfig.h> 0029 0030 // Local includes 0031 0032 #include "digikam_debug.h" 0033 #include "loadingcacheinterface.h" 0034 #include "applicationsettings.h" 0035 #include "setupalbumview.h" 0036 #include "setupcamera.h" 0037 #include "setupcollections.h" 0038 #include "setupeditor.h" 0039 #include "setupicc.h" 0040 #include "setuplighttable.h" 0041 #include "setupmetadata.h" 0042 #include "setupmisc.h" 0043 #include "setupimagequalitysorter.h" 0044 #include "setuptooltip.h" 0045 #include "setupdatabase.h" 0046 #include "setupplugins.h" 0047 #include "importsettings.h" 0048 #include "dxmlguiwindow.h" 0049 #include "onlineversiondlg.h" 0050 0051 #ifdef HAVE_GEOLOCATION 0052 # include "setupgeolocation.h" 0053 #endif 0054 0055 namespace Digikam 0056 { 0057 0058 class Q_DECL_HIDDEN Setup::Private 0059 { 0060 public: 0061 0062 explicit Private() 0063 : page_database (nullptr), 0064 page_collections (nullptr), 0065 page_albumView (nullptr), 0066 page_tooltip (nullptr), 0067 page_metadata (nullptr), 0068 page_template (nullptr), 0069 page_lighttable (nullptr), 0070 0071 #ifdef HAVE_GEOLOCATION 0072 0073 page_geolocation (nullptr), 0074 0075 #endif 0076 0077 page_editor (nullptr), 0078 page_imagequalitysorter (nullptr), 0079 page_icc (nullptr), 0080 page_camera (nullptr), 0081 page_plugins (nullptr), 0082 page_misc (nullptr), 0083 databasePage (nullptr), 0084 collectionsPage (nullptr), 0085 albumViewPage (nullptr), 0086 tooltipPage (nullptr), 0087 metadataPage (nullptr), 0088 templatePage (nullptr), 0089 lighttablePage (nullptr), 0090 0091 #ifdef HAVE_GEOLOCATION 0092 0093 geolocationPage (nullptr), 0094 0095 #endif 0096 0097 editorPage (nullptr), 0098 imageQualitySorterPage (nullptr), 0099 iccPage (nullptr), 0100 cameraPage (nullptr), 0101 pluginsPage (nullptr), 0102 miscPage (nullptr) 0103 { 0104 } 0105 0106 DConfigDlgWdgItem* page_database; 0107 DConfigDlgWdgItem* page_collections; 0108 DConfigDlgWdgItem* page_albumView; 0109 DConfigDlgWdgItem* page_tooltip; 0110 DConfigDlgWdgItem* page_metadata; 0111 DConfigDlgWdgItem* page_template; 0112 DConfigDlgWdgItem* page_lighttable; 0113 0114 #ifdef HAVE_GEOLOCATION 0115 0116 DConfigDlgWdgItem* page_geolocation; 0117 0118 #endif 0119 0120 DConfigDlgWdgItem* page_editor; 0121 DConfigDlgWdgItem* page_imagequalitysorter; 0122 DConfigDlgWdgItem* page_icc; 0123 DConfigDlgWdgItem* page_camera; 0124 DConfigDlgWdgItem* page_plugins; 0125 DConfigDlgWdgItem* page_misc; 0126 0127 SetupDatabase* databasePage; 0128 SetupCollections* collectionsPage; 0129 SetupAlbumView* albumViewPage; 0130 SetupToolTip* tooltipPage; 0131 SetupMetadata* metadataPage; 0132 SetupTemplate* templatePage; 0133 SetupLightTable* lighttablePage; 0134 0135 #ifdef HAVE_GEOLOCATION 0136 0137 SetupGeolocation* geolocationPage; 0138 0139 #endif 0140 0141 SetupEditor* editorPage; 0142 SetupImageQualitySorter* imageQualitySorterPage; 0143 SetupICC* iccPage; 0144 SetupCamera* cameraPage; 0145 SetupPlugins* pluginsPage; 0146 SetupMisc* miscPage; 0147 0148 public: 0149 0150 DConfigDlgWdgItem* pageItem(Setup::Page page) const; 0151 }; 0152 0153 Setup::Setup(QWidget* const parent) 0154 : DConfigDlg(parent), 0155 d (new Private) 0156 { 0157 setWindowFlags((windowFlags() & ~Qt::Dialog) | 0158 Qt::Window | 0159 Qt::WindowCloseButtonHint | 0160 Qt::WindowMinMaxButtonsHint); 0161 0162 setWindowTitle(i18nc("@title:window", "Configure")); 0163 setStandardButtons(QDialogButtonBox::Help | QDialogButtonBox::Ok | QDialogButtonBox::Cancel); 0164 button(QDialogButtonBox::Ok)->setDefault(true); 0165 setFaceType(List); 0166 setModal(true); 0167 0168 d->databasePage = new SetupDatabase(); 0169 d->page_database = addPage(d->databasePage, i18nc("@title: settings section", "Database")); 0170 d->page_database->setHeader(i18nc("@title", "Database Settings\nCustomize database settings")); 0171 d->page_database->setIcon(QIcon::fromTheme(QLatin1String("network-server-database"))); 0172 0173 d->collectionsPage = new SetupCollections(); 0174 d->page_collections = addPage(d->collectionsPage, i18nc("@title: settings section", "Collections")); 0175 d->page_collections->setHeader(i18nc("@title", "Collections Settings\nSet root albums locations")); 0176 d->page_collections->setIcon(QIcon::fromTheme(QLatin1String("folder-pictures"))); 0177 0178 d->albumViewPage = new SetupAlbumView(); 0179 d->page_albumView = addPage(d->albumViewPage, i18nc("@title: settings section", "Views")); 0180 d->page_albumView->setHeader(i18nc("@title", "Application Views Settings\nCustomize the look of the views")); 0181 d->page_albumView->setIcon(QIcon::fromTheme(QLatin1String("view-list-icons"))); 0182 0183 d->tooltipPage = new SetupToolTip(); 0184 d->page_tooltip = addPage(d->tooltipPage, i18nc("@title: settings section", "Tool-Tip")); 0185 d->page_tooltip->setHeader(i18nc("@title", "Items Tool-Tip Settings\nCustomize information in item tool-tips")); 0186 d->page_tooltip->setIcon(QIcon::fromTheme(QLatin1String("dialog-information"))); 0187 0188 d->metadataPage = new SetupMetadata(); 0189 d->page_metadata = addPage(d->metadataPage, i18nc("@title: settings section", "Metadata")); 0190 d->page_metadata->setHeader(i18nc("@title", "Embedded Image Information Management\nSetup relations between images and metadata")); 0191 d->page_metadata->setIcon(QIcon::fromTheme(QLatin1String("format-text-code"))); 0192 0193 d->templatePage = new SetupTemplate(); 0194 d->page_template = addPage(d->templatePage, i18nc("@title: settings section", "Templates")); 0195 d->page_template->setHeader(i18nc("@title", "Metadata templates\nManage your collection of metadata templates")); 0196 d->page_template->setIcon(QIcon::fromTheme(QLatin1String("im-user"))); 0197 0198 d->editorPage = new SetupEditor(); 0199 d->page_editor = addPage(d->editorPage, i18nc("@title: settings section", "Image Editor")); 0200 d->page_editor->setHeader(i18nc("@title", "Image Editor Settings\nCustomize the image editor settings")); 0201 d->page_editor->setIcon(QIcon::fromTheme(QLatin1String("document-edit"))); 0202 0203 d->iccPage = new SetupICC(buttonBox()); 0204 d->page_icc = addPage(d->iccPage, i18nc("@title: settings section", "Color Management")); 0205 d->page_icc->setHeader(i18nc("@title", "Settings for Color Management\nCustomize the color management settings")); 0206 d->page_icc->setIcon(QIcon::fromTheme(QLatin1String("preferences-desktop-display-color"))); 0207 0208 d->lighttablePage = new SetupLightTable(); 0209 d->page_lighttable = addPage(d->lighttablePage, i18nc("@title: settings section", "Light Table")); 0210 d->page_lighttable->setHeader(i18nc("@title", "Light Table Settings\nCustomize tool used to compare items")); 0211 d->page_lighttable->setIcon(QIcon::fromTheme(QLatin1String("lighttable"))); 0212 0213 #ifdef HAVE_GEOLOCATION 0214 0215 d->geolocationPage = new SetupGeolocation(); 0216 d->page_geolocation = addPage(d->geolocationPage, i18nc("@title: settings section", "Geolocation")); 0217 d->page_geolocation->setHeader(i18nc("@title", "Geolocation Settings\nCustomize view to geolocalize items")); 0218 d->page_geolocation->setIcon(QIcon::fromTheme(QLatin1String("map-globe"))); 0219 0220 #endif 0221 0222 d->imageQualitySorterPage = new SetupImageQualitySorter(); 0223 d->page_imagequalitysorter = addPage(d->imageQualitySorterPage, i18nc("@title: settings section", "Image Quality Sorter")); 0224 d->page_imagequalitysorter->setHeader(i18nc("@title", "Image Quality Sorter Settings\nCustomize default settings to perform image triaging by quality")); 0225 d->page_imagequalitysorter->setIcon(QIcon::fromTheme(QLatin1String("flag-green"))); 0226 0227 d->cameraPage = new SetupCamera(); 0228 d->page_camera = addPage(d->cameraPage, i18nc("@title: settings section", "Cameras")); 0229 d->page_camera->setHeader(i18nc("@title", "Camera Settings\nManage your camera devices")); 0230 d->page_camera->setIcon(QIcon::fromTheme(QLatin1String("camera-photo"))); 0231 0232 connect(d->cameraPage, SIGNAL(signalUseFileMetadataChanged(bool)), 0233 d->tooltipPage, SLOT(slotUseFileMetadataChanged(bool))); 0234 0235 d->pluginsPage = new SetupPlugins(); 0236 d->page_plugins = addPage(d->pluginsPage, i18nc("@title: settings section", "Plugins")); 0237 d->page_plugins->setHeader(i18nc("@title", "Plug-in Settings\nSet which plugins will be accessible from application")); 0238 d->page_plugins->setIcon(QIcon::fromTheme(QLatin1String("preferences-plugin"))); 0239 0240 d->miscPage = new SetupMisc(this); 0241 d->page_misc = addPage(d->miscPage, i18nc("@title: settings section", "Miscellaneous")); 0242 d->page_misc->setHeader(i18nc("@title", "Miscellaneous Settings\nCustomize behavior of the other parts of digiKam")); 0243 d->page_misc->setIcon(QIcon::fromTheme(QLatin1String("preferences-other"))); 0244 0245 for (int i = 0 ; i != SetupPageEnumLast ; ++i) 0246 { 0247 DConfigDlgWdgItem* const item = d->pageItem((Page)i); 0248 0249 if (!item) 0250 { 0251 continue; 0252 } 0253 0254 QWidget* const wgt = item->widget(); 0255 QScrollArea* const scrollArea = qobject_cast<QScrollArea*>(wgt); 0256 0257 if (scrollArea) 0258 { 0259 scrollArea->setFrameShape(QFrame::NoFrame); 0260 } 0261 } 0262 0263 connect(buttonBox(), SIGNAL(helpRequested()), 0264 this, SLOT(slotHelp())); 0265 0266 connect(buttonBox()->button(QDialogButtonBox::Ok), &QPushButton::clicked, 0267 this, &Setup::slotOkClicked); 0268 0269 connect(buttonBox()->button(QDialogButtonBox::Cancel), &QPushButton::clicked, 0270 this, &Setup::slotCancelClicked); 0271 0272 KSharedConfig::Ptr config = KSharedConfig::openConfig(); 0273 KConfigGroup group = config->group(QLatin1String("Setup Dialog")); 0274 0275 winId(); 0276 DXmlGuiWindow::setGoodDefaultWindowSize(windowHandle()); 0277 DXmlGuiWindow::restoreWindowSize(windowHandle(), group); 0278 resize(windowHandle()->size()); 0279 } 0280 0281 Setup::~Setup() 0282 { 0283 KSharedConfig::Ptr config = KSharedConfig::openConfig(); 0284 KConfigGroup group = config->group(QLatin1String("Setup Dialog")); 0285 group.writeEntry(QLatin1String("Setup Page"), (int)activePageIndex()); 0286 group.writeEntry(QLatin1String("Albumview Tab"), (int)d->albumViewPage->activeTab()); 0287 group.writeEntry(QLatin1String("ToolTip Tab"), (int)d->tooltipPage->activeTab()); 0288 group.writeEntry(QLatin1String("Metadata Tab"), (int)d->metadataPage->activeTab()); 0289 group.writeEntry(QLatin1String("Metadata SubTab"), (int)d->metadataPage->activeSubTab()); 0290 group.writeEntry(QLatin1String("Editor Tab"), (int)d->editorPage->activeTab()); 0291 0292 #ifdef HAVE_GEOLOCATION 0293 0294 group.writeEntry(QLatin1String("Geolocation Tab"), (int)d->geolocationPage->activeTab()); 0295 0296 #endif 0297 0298 group.writeEntry(QLatin1String("ICC Tab"), (int)d->iccPage->activeTab()); 0299 group.writeEntry(QLatin1String("Camera Tab"), (int)d->cameraPage->activeTab()); 0300 group.writeEntry(QLatin1String("Plugin Tab"), (int)d->pluginsPage->activeTab()); 0301 group.writeEntry(QLatin1String("Misc Tab"), (int)d->miscPage->activeTab()); 0302 DXmlGuiWindow::saveWindowSize(windowHandle(), group); 0303 config->sync(); 0304 0305 delete d; 0306 } 0307 0308 void Setup::slotHelp() 0309 { 0310 openOnlineDocumentation(QLatin1String("setup_application")); 0311 } 0312 0313 void Setup::setTemplate(const Template& t) 0314 { 0315 if (d->templatePage) 0316 { 0317 d->templatePage->setTemplate(t); 0318 } 0319 } 0320 0321 QSize Setup::sizeHint() const 0322 { 0323 // The minimum size is very small. But the default initial size is such 0324 // that some important tabs get a scroll bar, although the dialog could be larger 0325 // on a normal display (QScrollArea size hint does not take widget into account) 0326 // Adjust size hint here so that certain selected tabs are display full per default. 0327 0328 QSize hint = DConfigDlg::sizeHint(); 0329 int maxHintHeight = 0; 0330 int maxWidgetHeight = 0; 0331 0332 for (int page = 0 ; page != SetupPageEnumLast ; ++page) 0333 { 0334 // only take tabs into account here that should better be displayed without scrolling 0335 0336 if ( 0337 (page == CollectionsPage) || 0338 (page == AlbumViewPage) || 0339 (page == TemplatePage) || 0340 (page == LightTablePage) || 0341 (page == EditorPage) || 0342 (page == PluginsPage) || 0343 (page == MiscellaneousPage) 0344 ) 0345 { 0346 DConfigDlgWdgItem* const item = d->pageItem((Page)page); 0347 0348 if (!item) 0349 { 0350 continue; 0351 } 0352 0353 QWidget* const wdg = item->widget(); 0354 maxHintHeight = qMax(maxHintHeight, wdg->sizeHint().height()); 0355 QScrollArea* const scrollArea = qobject_cast<QScrollArea*>(wdg); 0356 0357 if (scrollArea) 0358 { 0359 maxWidgetHeight = qMax(maxWidgetHeight, scrollArea->widget()->sizeHint().height()); 0360 } 0361 } 0362 } 0363 0364 // The additional 20 is a hack to make it work. 0365 // Don't know why, the largest page would have scroll bars without this 0366 0367 if (maxWidgetHeight > maxHintHeight) 0368 { 0369 hint.setHeight(hint.height() + (maxWidgetHeight - maxHintHeight) + 20); 0370 } 0371 0372 return hint; 0373 } 0374 0375 bool Setup::execDialog(Page page) 0376 { 0377 return execDialog(nullptr, page); 0378 } 0379 0380 bool Setup::execDialog(QWidget* const parent, Page page) 0381 { 0382 QPointer<Setup> setup = new Setup(parent); 0383 setup->showPage(page); 0384 bool success = (setup->DConfigDlg::exec() == QDialog::Accepted); 0385 delete setup; 0386 0387 return success; 0388 } 0389 0390 bool Setup::execSinglePage(Page page) 0391 { 0392 return execSinglePage(nullptr, page); 0393 } 0394 0395 bool Setup::execSinglePage(QWidget* const parent, Page page) 0396 { 0397 QPointer<Setup> setup = new Setup(parent); 0398 setup->showPage(page); 0399 setup->setFaceType(Plain); 0400 bool success = (setup->DConfigDlg::exec() == QDialog::Accepted); 0401 delete setup; 0402 0403 return success; 0404 } 0405 0406 bool Setup::execTemplateEditor(QWidget* const parent, const Template& t) 0407 { 0408 QPointer<Setup> setup = new Setup(parent); 0409 setup->showPage(TemplatePage); 0410 setup->setFaceType(Plain); 0411 setup->setTemplate(t); 0412 bool success = (setup->DConfigDlg::exec() == QDialog::Accepted); 0413 delete setup; 0414 0415 return success; 0416 } 0417 0418 #ifdef HAVE_GEOLOCATION 0419 0420 bool Setup::execGeolocation(QWidget* const parent, int tab) 0421 { 0422 QPointer<Setup> setup = new Setup(parent); 0423 setup->showPage(GeolocationPage); 0424 setup->setFaceType(Plain); 0425 0426 DConfigDlgWdgItem* const cur = setup->currentPage(); 0427 0428 if (!cur) 0429 { 0430 return false; 0431 } 0432 0433 SetupGeolocation* const widget = dynamic_cast<SetupGeolocation*>(cur->widget()); 0434 0435 if (!widget) 0436 { 0437 return false; 0438 } 0439 0440 widget->setActiveTab((SetupGeolocation::GeolocationTab)tab); 0441 0442 bool success = (setup->DConfigDlg::exec() == QDialog::Accepted); 0443 delete setup; 0444 0445 return success; 0446 } 0447 0448 #endif 0449 0450 bool Setup::execMetadataFilters(QWidget* const parent, int tab) 0451 { 0452 QPointer<Setup> setup = new Setup(parent); 0453 setup->showPage(MetadataPage); 0454 setup->setFaceType(Plain); 0455 0456 DConfigDlgWdgItem* const cur = setup->currentPage(); 0457 0458 if (!cur) 0459 { 0460 return false; 0461 } 0462 0463 SetupMetadata* const widget = dynamic_cast<SetupMetadata*>(cur->widget()); 0464 0465 if (!widget) 0466 { 0467 return false; 0468 } 0469 0470 widget->setActiveTab(SetupMetadata::Display); 0471 widget->setActiveSubTab((SetupMetadata::MetadataSubTab)tab); 0472 0473 bool success = (setup->DConfigDlg::exec() == QDialog::Accepted); 0474 delete setup; 0475 0476 return success; 0477 } 0478 0479 bool Setup::execExifTool(QWidget* const parent) 0480 { 0481 QPointer<Setup> setup = new Setup(parent); 0482 setup->showPage(MetadataPage); 0483 setup->setFaceType(Plain); 0484 0485 DConfigDlgWdgItem* const cur = setup->currentPage(); 0486 0487 if (!cur) 0488 { 0489 return false; 0490 } 0491 0492 SetupMetadata* const widget = dynamic_cast<SetupMetadata*>(cur->widget()); 0493 0494 if (!widget) 0495 { 0496 return false; 0497 } 0498 0499 widget->setActiveTab(SetupMetadata::ExifTool); 0500 0501 bool success = (setup->DConfigDlg::exec() == QDialog::Accepted); 0502 delete setup; 0503 0504 return success; 0505 } 0506 0507 bool Setup::execLocalize(QWidget* const parent) 0508 { 0509 QPointer<Setup> setup = new Setup(parent); 0510 setup->showPage(MiscellaneousPage); 0511 setup->setFaceType(Plain); 0512 0513 DConfigDlgWdgItem* const cur = setup->currentPage(); 0514 0515 if (!cur) 0516 { 0517 return false; 0518 } 0519 0520 SetupMisc* const widget = dynamic_cast<SetupMisc*>(cur->widget()); 0521 0522 if (!widget) 0523 { 0524 return false; 0525 } 0526 0527 widget->setActiveTab(SetupMisc::Localize); 0528 0529 bool success = (setup->DConfigDlg::exec() == QDialog::Accepted); 0530 delete setup; 0531 0532 return success; 0533 } 0534 0535 bool Setup::execImageQualitySorter(QWidget* const parent) 0536 { 0537 QPointer<Setup> setup = new Setup(parent); 0538 setup->showPage(ImageQualityPage); 0539 setup->setFaceType(Plain); 0540 0541 DConfigDlgWdgItem* const cur = setup->currentPage(); 0542 0543 if (!cur) 0544 { 0545 return false; 0546 } 0547 0548 SetupImageQualitySorter* const widget = dynamic_cast<SetupImageQualitySorter*>(cur->widget()); 0549 0550 if (!widget) 0551 { 0552 return false; 0553 } 0554 0555 bool success = (setup->DConfigDlg::exec() == QDialog::Accepted); 0556 delete setup; 0557 0558 return success; 0559 } 0560 0561 void Setup::slotOkClicked() 0562 { 0563 if (!d->cameraPage->checkSettings()) 0564 { 0565 showPage(CameraPage); 0566 return; 0567 } 0568 0569 if (!d->miscPage->checkSettings()) 0570 { 0571 showPage(MiscellaneousPage); 0572 return; 0573 } 0574 0575 qApp->setOverrideCursor(Qt::WaitCursor); 0576 0577 d->cameraPage->applySettings(); 0578 d->databasePage->applySettings(); 0579 d->collectionsPage->applySettings(); 0580 d->albumViewPage->applySettings(); 0581 d->tooltipPage->applySettings(); 0582 d->metadataPage->applySettings(); 0583 d->templatePage->applySettings(); 0584 d->lighttablePage->applySettings(); 0585 0586 #ifdef HAVE_GEOLOCATION 0587 0588 d->geolocationPage->applySettings(); 0589 0590 #endif 0591 0592 d->editorPage->applySettings(); 0593 d->imageQualitySorterPage->applySettings(); 0594 d->iccPage->applySettings(); 0595 d->pluginsPage->applySettings(); 0596 d->miscPage->applySettings(); 0597 0598 ApplicationSettings::instance()->emitSetupChanged(); 0599 ImportSettings::instance()->emitSetupChanged(); 0600 0601 qApp->restoreOverrideCursor(); 0602 0603 if (d->metadataPage->exifAutoRotateHasChanged()) 0604 { 0605 LoadingCacheInterface::cleanThumbnailCache(); 0606 } 0607 0608 accept(); 0609 } 0610 0611 void Setup::slotCancelClicked() 0612 { 0613 0614 #ifdef HAVE_GEOLOCATION 0615 0616 d->geolocationPage->cancel(); 0617 0618 #endif 0619 0620 } 0621 0622 void Setup::showPage(Setup::Page page) 0623 { 0624 DConfigDlgWdgItem* item = nullptr; 0625 0626 if (page == LastPageUsed) 0627 { 0628 KSharedConfig::Ptr config = KSharedConfig::openConfig(); 0629 KConfigGroup group = config->group(QLatin1String("Setup Dialog")); 0630 0631 item = d->pageItem((Page)group.readEntry(QLatin1String("Setup Page"), (int)CollectionsPage)); 0632 d->albumViewPage->setActiveTab((SetupAlbumView::AlbumTab)group.readEntry(QLatin1String("AlbumView Tab"), (int)SetupAlbumView::IconView)); 0633 d->tooltipPage->setActiveTab((SetupToolTip::ToolTipTab)group.readEntry(QLatin1String("ToolTip Tab"), (int)SetupToolTip::IconItems)); 0634 d->metadataPage->setActiveTab((SetupMetadata::MetadataTab)group.readEntry(QLatin1String("Metadata Tab"), (int)SetupMetadata::Behavior)); 0635 d->metadataPage->setActiveSubTab((SetupMetadata::MetadataSubTab)group.readEntry(QLatin1String("Metadata SubTab"), (int)SetupMetadata::ExifViewer)); 0636 0637 #ifdef HAVE_GEOLOCATION 0638 0639 d->geolocationPage->setActiveTab((SetupGeolocation::GeolocationTab)group.readEntry(QLatin1String("Geolocation Tab"), (int)SetupGeolocation::MarbleView)); 0640 0641 #endif 0642 0643 d->editorPage->setActiveTab((SetupEditor::EditorTab)group.readEntry(QLatin1String("Editor Tab"), (int)SetupEditor::EditorWindow)); 0644 d->iccPage->setActiveTab((SetupICC::ICCTab)group.readEntry(QLatin1String("ICC Tab"), (int)SetupICC::Behavior)); 0645 d->cameraPage->setActiveTab((SetupCamera::CameraTab)group.readEntry(QLatin1String("Camera Tab"), (int)SetupCamera::Devices)); 0646 d->pluginsPage->setActiveTab((SetupPlugins::PluginTab)group.readEntry(QLatin1String("Plugin Tab"), (int)SetupPlugins::Generic)); 0647 d->miscPage->setActiveTab((SetupMisc::MiscTab)group.readEntry(QLatin1String("Misc Tab"), (int)SetupMisc::Behaviour)); 0648 } 0649 else 0650 { 0651 item = d->pageItem(page); 0652 } 0653 0654 if (!item) 0655 { 0656 item = d->pageItem(CollectionsPage); 0657 } 0658 0659 setCurrentPage(item); 0660 } 0661 0662 Setup::Page Setup::activePageIndex() const 0663 { 0664 DConfigDlgWdgItem* const cur = currentPage(); 0665 0666 if (cur == d->page_collections) 0667 { 0668 return CollectionsPage; 0669 } 0670 0671 if (cur == d->page_albumView) 0672 { 0673 return AlbumViewPage; 0674 } 0675 0676 if (cur == d->page_tooltip) 0677 { 0678 return ToolTipPage; 0679 } 0680 0681 if (cur == d->page_metadata) 0682 { 0683 return MetadataPage; 0684 } 0685 0686 if (cur == d->page_template) 0687 { 0688 return TemplatePage; 0689 } 0690 0691 if (cur == d->page_lighttable) 0692 { 0693 return LightTablePage; 0694 } 0695 0696 #ifdef HAVE_GEOLOCATION 0697 0698 if (cur == d->page_geolocation) 0699 { 0700 return GeolocationPage; 0701 } 0702 0703 #endif 0704 0705 if (cur == d->page_editor) 0706 { 0707 return EditorPage; 0708 } 0709 0710 if (cur == d->page_imagequalitysorter) 0711 { 0712 return ImageQualityPage; 0713 } 0714 0715 if (cur == d->page_icc) 0716 { 0717 return ICCPage; 0718 } 0719 0720 if (cur == d->page_camera) 0721 { 0722 return CameraPage; 0723 } 0724 0725 if (cur == d->page_plugins) 0726 { 0727 return PluginsPage; 0728 } 0729 0730 if (cur == d->page_misc) 0731 { 0732 return MiscellaneousPage; 0733 } 0734 0735 return DatabasePage; 0736 } 0737 0738 DConfigDlgWdgItem* Setup::Private::pageItem(Setup::Page page) const 0739 { 0740 switch (page) 0741 { 0742 case Setup::DatabasePage: 0743 { 0744 return page_database; 0745 } 0746 0747 case Setup::CollectionsPage: 0748 { 0749 return page_collections; 0750 } 0751 0752 case Setup::AlbumViewPage: 0753 { 0754 return page_albumView; 0755 } 0756 0757 case Setup::ToolTipPage: 0758 { 0759 return page_tooltip; 0760 } 0761 0762 case Setup::MetadataPage: 0763 { 0764 return page_metadata; 0765 } 0766 0767 case Setup::TemplatePage: 0768 { 0769 return page_template; 0770 } 0771 0772 case Setup::LightTablePage: 0773 { 0774 return page_lighttable; 0775 } 0776 0777 #ifdef HAVE_GEOLOCATION 0778 0779 case Setup::GeolocationPage: 0780 { 0781 return page_geolocation; 0782 } 0783 0784 #endif 0785 0786 case Setup::EditorPage: 0787 { 0788 return page_editor; 0789 } 0790 0791 case Setup::ImageQualityPage: 0792 { 0793 return page_imagequalitysorter; 0794 } 0795 0796 case Setup::ICCPage: 0797 { 0798 return page_icc; 0799 } 0800 0801 case Setup::CameraPage: 0802 { 0803 return page_camera; 0804 } 0805 0806 case Setup::PluginsPage: 0807 { 0808 return page_plugins; 0809 } 0810 0811 case Setup::MiscellaneousPage: 0812 { 0813 return page_misc; 0814 } 0815 0816 default: 0817 { 0818 return nullptr; 0819 } 0820 } 0821 } 0822 0823 void Setup::onlineVersionCheck() 0824 { 0825 OnlineVersionDlg* const dlg = new OnlineVersionDlg(qApp->activeWindow(), 0826 QLatin1String(digikam_version_short), 0827 digiKamBuildDate(), 0828 ApplicationSettings::instance()->getUpdateType(), 0829 ApplicationSettings::instance()->getUpdateWithDebug()); 0830 0831 connect(dlg, &OnlineVersionDlg::signalSetupUpdate, 0832 [=]() 0833 { 0834 Setup::execSinglePage(nullptr, Setup::MiscellaneousPage); 0835 } 0836 ); 0837 0838 dlg->exec(); 0839 } 0840 0841 } // namespace Digikam 0842 0843 #include "moc_setup.cpp"