File indexing completed on 2025-01-19 03:50:41
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2002-16-10 0007 * Description : main digiKam interface implementation - Configure 0008 * 0009 * SPDX-FileCopyrightText: 2002-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "digikamapp_p.h" 0016 0017 namespace Digikam 0018 { 0019 0020 bool DigikamApp::setup() 0021 { 0022 return Setup::execDialog(this, Setup::LastPageUsed); 0023 } 0024 0025 bool DigikamApp::setupICC() 0026 { 0027 return Setup::execSinglePage(this, Setup::ICCPage); 0028 } 0029 0030 void DigikamApp::slotSetup() 0031 { 0032 setup(); 0033 } 0034 0035 void DigikamApp::slotSetupChanged() 0036 { 0037 // raw loading options might have changed 0038 LoadingCacheInterface::cleanCache(); 0039 0040 // TODO: clear history when location changed 0041 /* 0042 if (ApplicationSettings::instance()->getAlbumLibraryPath() != AlbumManager::instance()->getLibraryPath()) 0043 { 0044 d->view->clearHistory(); 0045 } 0046 */ 0047 const DbEngineParameters prm = ApplicationSettings::instance()->getDbEngineParameters(); 0048 0049 if (!AlbumManager::instance()->databaseEqual(prm)) 0050 { 0051 AlbumManager::instance()->changeDatabase(ApplicationSettings::instance()->getDbEngineParameters()); 0052 } 0053 0054 if (ApplicationSettings::instance()->getShowFolderTreeViewItemsCount()) 0055 { 0056 AlbumManager::instance()->prepareItemCounts(); 0057 } 0058 0059 // Load full-screen options 0060 0061 KConfigGroup group = KSharedConfig::openConfig()->group(configGroupName()); 0062 readFullScreenSettings(group); 0063 0064 d->view->applySettings(); 0065 0066 AlbumThumbnailLoader::instance()->setThumbnailSize(ApplicationSettings::instance()->getTreeViewIconSize(), 0067 ApplicationSettings::instance()->getTreeViewFaceSize()); 0068 0069 if (LightTableWindow::lightTableWindowCreated()) 0070 { 0071 LightTableWindow::lightTableWindow()->applySettings(); 0072 } 0073 0074 if (QueueMgrWindow::queueManagerWindowCreated()) 0075 { 0076 QueueMgrWindow::queueManagerWindow()->applySettings(); 0077 } 0078 0079 d->config->sync(); 0080 } 0081 0082 void DigikamApp::slotEditKeys() 0083 { 0084 editKeyboardShortcuts(); 0085 } 0086 0087 void DigikamApp::slotThemeChanged() 0088 { 0089 ApplicationSettings* const settings = ApplicationSettings::instance(); 0090 QString theme = ThemeManager::instance()->currentThemeName(); 0091 0092 if (qApp->activeWindow() && 0093 (settings->getCurrentTheme() != theme)) 0094 { 0095 qApp->processEvents(); 0096 0097 QColor color = qApp->palette().color(qApp->activeWindow()->backgroundRole()); 0098 QString iconTheme; 0099 QString msgText; 0100 0101 if (color.lightness() > 127) 0102 { 0103 msgText = i18n("You have chosen a bright color scheme. We switch " 0104 "to a dark icon theme. The icon theme is " 0105 "available after a restart of digiKam."); 0106 0107 iconTheme = QLatin1String("breeze"); 0108 } 0109 else 0110 { 0111 msgText = i18n("You have chosen a dark color scheme. We switch " 0112 "to a bright icon theme. The icon theme is " 0113 "available after a restart of digiKam."); 0114 0115 iconTheme = QLatin1String("breeze-dark"); 0116 } 0117 0118 if (settings->getIconTheme() != iconTheme) 0119 { 0120 QMessageBox::information(qApp->activeWindow(), 0121 qApp->applicationName(), msgText); 0122 0123 settings->setIconTheme(iconTheme); 0124 } 0125 } 0126 0127 settings->setCurrentTheme(theme); 0128 } 0129 0130 } // namespace Digikam