1 /* ============================================================ 2 * 3 * This file is a part of digiKam project 4 * https://www.digikam.org 5 * 6 * Date : 2002-16-10 7 * Description : main digiKam interface implementation - Configure 8 * 9 * Copyright (C) 2002-2021 by Gilles Caulier <caulier dot gilles at gmail dot com> 10 * 11 * This program is free software; you can redistribute it 12 * and/or modify it under the terms of the GNU General 13 * Public License as published by the Free Software Foundation; 14 * either version 2, or (at your option) 15 * any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * ============================================================ */ 23 24 #include "digikamapp_p.h" 25 26 namespace Digikam 27 { 28 setup()29bool DigikamApp::setup() 30 { 31 return Setup::execDialog(this, Setup::LastPageUsed); 32 } 33 setupICC()34bool DigikamApp::setupICC() 35 { 36 return Setup::execSinglePage(this, Setup::ICCPage); 37 } 38 slotSetup()39void DigikamApp::slotSetup() 40 { 41 setup(); 42 } 43 slotSetupChanged()44void DigikamApp::slotSetupChanged() 45 { 46 // raw loading options might have changed 47 LoadingCacheInterface::cleanCache(); 48 49 // TODO: clear history when location changed 50 /* 51 if (ApplicationSettings::instance()->getAlbumLibraryPath() != AlbumManager::instance()->getLibraryPath()) 52 { 53 d->view->clearHistory(); 54 } 55 */ 56 const DbEngineParameters prm = ApplicationSettings::instance()->getDbEngineParameters(); 57 58 if (!AlbumManager::instance()->databaseEqual(prm)) 59 { 60 AlbumManager::instance()->changeDatabase(ApplicationSettings::instance()->getDbEngineParameters()); 61 } 62 63 if (ApplicationSettings::instance()->getShowFolderTreeViewItemsCount()) 64 { 65 AlbumManager::instance()->prepareItemCounts(); 66 } 67 68 // Load full-screen options 69 70 KConfigGroup group = KSharedConfig::openConfig()->group(configGroupName()); 71 readFullScreenSettings(group); 72 73 d->view->applySettings(); 74 75 AlbumThumbnailLoader::instance()->setThumbnailSize(ApplicationSettings::instance()->getTreeViewIconSize(), 76 ApplicationSettings::instance()->getTreeViewFaceSize()); 77 78 if (LightTableWindow::lightTableWindowCreated()) 79 { 80 LightTableWindow::lightTableWindow()->applySettings(); 81 } 82 83 if (QueueMgrWindow::queueManagerWindowCreated()) 84 { 85 QueueMgrWindow::queueManagerWindow()->applySettings(); 86 } 87 88 d->config->sync(); 89 } 90 slotEditKeys()91void DigikamApp::slotEditKeys() 92 { 93 editKeyboardShortcuts(); 94 } 95 slotThemeChanged()96void DigikamApp::slotThemeChanged() 97 { 98 ApplicationSettings* const settings = ApplicationSettings::instance(); 99 QString theme = ThemeManager::instance()->currentThemeName(); 100 101 if (qApp->activeWindow() && 102 !settings->getIconTheme().isEmpty() && 103 (settings->getCurrentTheme() != theme)) 104 { 105 qApp->processEvents(); 106 107 QColor color = qApp->palette().color(qApp->activeWindow()->backgroundRole()); 108 QString iconTheme; 109 QString msgText; 110 111 if (color.lightness() > 127) 112 { 113 msgText = i18n("You have chosen a bright color scheme. We switch " 114 "to a dark icon theme. The icon theme is " 115 "available after a restart of digiKam."); 116 117 iconTheme = QLatin1String("breeze"); 118 } 119 else 120 { 121 msgText = i18n("You have chosen a dark color scheme. We switch " 122 "to a bright icon theme. The icon theme is " 123 "available after a restart of digiKam."); 124 125 iconTheme = QLatin1String("breeze-dark"); 126 } 127 128 if (settings->getIconTheme() != iconTheme) 129 { 130 QMessageBox::information(qApp->activeWindow(), 131 qApp->applicationName(), msgText); 132 133 settings->setIconTheme(iconTheme); 134 } 135 } 136 137 settings->setCurrentTheme(theme); 138 } 139 140 } // namespace Digikam 141