]>
cloud.milkyroute.net Git - dolphin.git/blob - src/settings/viewmodes/viewsettingspage.cpp
1 /***************************************************************************
2 * Copyright (C) 2006 by Peter Penz *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #include "viewsettingspage.h"
23 #include <views/dolphinview.h>
24 #include "viewsettingstab.h"
26 #include <QVBoxLayout>
29 #include <KLocalizedString>
31 ViewSettingsPage::ViewSettingsPage(QWidget
* parent
) :
32 SettingsPageBase(parent
),
35 QVBoxLayout
* topLayout
= new QVBoxLayout(this);
36 topLayout
->setMargin(0);
38 QTabWidget
* tabWidget
= new QTabWidget(this);
40 // Initialize 'Icons' tab
41 ViewSettingsTab
* iconsTab
= new ViewSettingsTab(ViewSettingsTab::IconsMode
, tabWidget
);
42 tabWidget
->addTab(iconsTab
, QIcon::fromTheme(QStringLiteral("view-list-icons")), i18nc("@title:tab", "Icons"));
43 connect(iconsTab
, &ViewSettingsTab::changed
, this, &ViewSettingsPage::changed
);
45 // Initialize 'Compact' tab
46 ViewSettingsTab
* compactTab
= new ViewSettingsTab(ViewSettingsTab::CompactMode
, tabWidget
);
47 tabWidget
->addTab(compactTab
, QIcon::fromTheme(QStringLiteral("view-list-details")), i18nc("@title:tab", "Compact"));
48 connect(compactTab
, &ViewSettingsTab::changed
, this, &ViewSettingsPage::changed
);
50 // Initialize 'Details' tab
51 ViewSettingsTab
* detailsTab
= new ViewSettingsTab(ViewSettingsTab::DetailsMode
, tabWidget
);
52 tabWidget
->addTab(detailsTab
, QIcon::fromTheme(QStringLiteral("view-list-tree")), i18nc("@title:tab", "Details"));
53 connect(detailsTab
, &ViewSettingsTab::changed
, this, &ViewSettingsPage::changed
);
55 m_tabs
.append(iconsTab
);
56 m_tabs
.append(compactTab
);
57 m_tabs
.append(detailsTab
);
59 topLayout
->addWidget(tabWidget
, 0, nullptr);
62 ViewSettingsPage::~ViewSettingsPage()
66 void ViewSettingsPage::applySettings()
68 foreach (ViewSettingsTab
* tab
, m_tabs
) {
73 void ViewSettingsPage::restoreDefaults()
75 foreach (ViewSettingsTab
* tab
, m_tabs
) {
76 tab
->restoreDefaultSettings();