]> cloud.milkyroute.net Git - dolphin.git/blob - src/settings/kcm/kcmdolphingeneral.cpp
Replace qAsConst with std::as_const
[dolphin.git] / src / settings / kcm / kcmdolphingeneral.cpp
1 /*
2 * SPDX-FileCopyrightText: 2009 Peter Penz <peter.penz19@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7 #include "kcmdolphingeneral.h"
8
9 #include "settings/interface/confirmationssettingspage.h"
10 #include "settings/interface/folderstabssettingspage.h"
11 #include "settings/interface/interfacesettingspage.h"
12 #include "settings/interface/previewssettingspage.h"
13
14 #include <KLocalizedString>
15 #include <KPluginFactory>
16 #include <kconfigwidgets_version.h>
17
18 #include <QTabWidget>
19 #include <QVBoxLayout>
20
21 K_PLUGIN_CLASS_WITH_JSON(DolphinGeneralConfigModule, "kcmdolphingeneral.json")
22
23 DolphinGeneralConfigModule::DolphinGeneralConfigModule(QObject *parent, const KPluginMetaData &data)
24 : KCModule(parent, data)
25 , m_pages()
26 {
27 setButtons(KCModule::Default | KCModule::Help | KCModule::Apply);
28
29 QVBoxLayout *topLayout = new QVBoxLayout(widget());
30 topLayout->setContentsMargins(0, 0, 0, 0);
31
32 QTabWidget *tabWidget = new QTabWidget(widget());
33
34 // initialize 'Folders & Tabs' tab
35 FoldersTabsSettingsPage *foldersTabsPage = new FoldersTabsSettingsPage(tabWidget);
36 tabWidget->addTab(foldersTabsPage, i18nc("@title:tab Behavior settings", "Behavior"));
37 connect(foldersTabsPage, &FoldersTabsSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged);
38
39 // initialize 'Previews' tab
40 PreviewsSettingsPage *previewsPage = new PreviewsSettingsPage(tabWidget);
41 tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews"));
42 connect(previewsPage, &PreviewsSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged);
43
44 // initialize 'Confirmations' tab
45 ConfirmationsSettingsPage *confirmationsPage = new ConfirmationsSettingsPage(tabWidget);
46 tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations"));
47 connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, &DolphinGeneralConfigModule::markAsChanged);
48 m_pages.append(foldersTabsPage);
49 m_pages.append(previewsPage);
50 m_pages.append(confirmationsPage);
51
52 topLayout->addWidget(tabWidget, 0, {});
53 }
54
55 DolphinGeneralConfigModule::~DolphinGeneralConfigModule()
56 {
57 }
58
59 void DolphinGeneralConfigModule::save()
60 {
61 for (SettingsPageBase *page : std::as_const(m_pages)) {
62 page->applySettings();
63 }
64 }
65
66 void DolphinGeneralConfigModule::defaults()
67 {
68 for (SettingsPageBase *page : std::as_const(m_pages)) {
69 page->applySettings();
70 }
71 }
72
73 #include "kcmdolphingeneral.moc"
74
75 #include "moc_kcmdolphingeneral.cpp"