1/*
2 Copyright (C) 2014-2019 Harald Sitter <sitter@kde.org>
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) version 3.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#include "settings.h"
21#include "ui_settings.h"
22
23#include <QApplication>
24
25Settings::Settings(QWidget *parent)
26 : QDialog(parent)
27 , ui(new Ui::Settings)
28{
29 ui->setupUi(this);
30 ui->devicePreference->load();
31 ui->backendSelection->load();
32
33 // Force first tab regardless of what the UI file wants.
34 ui->tabs->setCurrentIndex(0);
35
36 connect(ui->buttonBox, &QDialogButtonBox::accepted,
37 this, [=] {
38 save();
39 qApp->quit();
40 });
41 connect(ui->buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked,
42 this, &Settings::save);
43 connect(ui->buttonBox, &QDialogButtonBox::rejected,
44 qApp, &QApplication::quit);
45}
46
47Settings::~Settings()
48{
49 delete ui;
50}
51
52void Settings::save()
53{
54 ui->devicePreference->save();
55 ui->backendSelection->save();
56}
57

source code of phonon/settings/settings.cpp