2 * SomePlayer - An alternate music player for Maemo 5
3 * Copyright (C) 2010 Nikolay (somebody) Tischenko <niktischenko@gmail.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (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 Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "settingsdialog.h"
22 #include "ui_settingsdialog.h"
24 using namespace SomePlayer::Storage;
26 SettingsDialog::SettingsDialog(QWidget *parent) :
28 ui(new Ui::SettingsDialog)
32 QString albumSorting = config.getValue("ui/albumsorting").toString();
33 QString showTrackLenght = config.getValue("ui/showtracklenght").toString();
34 QString orientation = config.getValue("ui/orientation").toString();
35 QString icons_theme = config.getValue("ui/iconstheme").toString();
36 QString gradient = config.getValue("ui/gradient").toString();
37 ui->albumsSortDButton->setChecked(true); // defaule sorting
38 ui->showTrackLenghtYButton->setChecked(true); // show by default
39 ui->orientationLButton->setChecked(true);
40 ui->iconsWButton->setChecked(true);
41 ui->gradientYButton->setChecked(true);
42 if (albumSorting == "alphabet") {
43 ui->albumsSortAButton->setChecked(true);
45 if (showTrackLenght == "no") {
46 ui->showTrackLenghtNButton->setChecked(true);
48 if (orientation == "portrait") {
49 ui->orientationPButton->setChecked(true);
50 } else if (orientation == "auto") {
51 ui->orientationAButton->setChecked(true);
53 if (icons_theme == "black") {
54 ui->iconstBButton->setChecked(true);
56 if (gradient == "no") {
57 ui->gradientNButton->setChecked(true);
59 connect (ui->albumsSortAButton, SIGNAL(toggled(bool)), this, SLOT(_set_album_sorting_alphabet(bool)));
60 connect (ui->albumsSortDButton, SIGNAL(toggled(bool)), this, SLOT(_set_album_sorting_date(bool)));
61 connect (ui->showTrackLenghtNButton, SIGNAL(toggled(bool)), this, SLOT(_set_track_lenght_show_no(bool)));
62 connect (ui->showTrackLenghtYButton, SIGNAL(toggled(bool)), this, SLOT(_set_track_lenght_show_yes(bool)));
63 connect (ui->orientationAButton, SIGNAL(toggled(bool)), this, SLOT(_set_orientation_auto(bool)));
64 connect (ui->orientationLButton, SIGNAL(toggled(bool)), this, SLOT(_set_orientation_landscape(bool)));
65 connect (ui->orientationPButton, SIGNAL(toggled(bool)), this, SLOT(_set_orientation_portrait(bool)));
66 connect (ui->iconstBButton, SIGNAL(toggled(bool)), this, SLOT(_set_icons_black(bool)));
67 connect (ui->iconsWButton, SIGNAL(toggled(bool)), this, SLOT(_set_icons_white(bool)));
68 connect (ui->gradientNButton, SIGNAL(toggled(bool)), this, SLOT(_set_gradient_no(bool)));
69 connect (ui->gradientYButton, SIGNAL(toggled(bool)), this, SLOT(_set_gradient_yes(bool)));
72 SettingsDialog::~SettingsDialog()
77 void SettingsDialog::_set_album_sorting_date(bool checked) {
80 config.setValue("ui/albumsorting", "date");
83 void SettingsDialog::_set_album_sorting_alphabet(bool checked) {
86 config.setValue("ui/albumsorting", "alphabet");
89 void SettingsDialog::_set_track_lenght_show_no(bool checked) {
92 config.setValue("ui/showtracklenght", "no");
95 void SettingsDialog::_set_track_lenght_show_yes(bool checked) {
98 config.setValue("ui/showtracklenght", "yes");
101 void SettingsDialog::_set_orientation_auto(bool checked) {
102 if (!checked) return;
104 config.setValue("ui/orientation", "auto");
107 void SettingsDialog::_set_orientation_landscape(bool checked) {
108 if (!checked) return;
110 config.setValue("ui/orientation", "landscape");
113 void SettingsDialog::_set_orientation_portrait(bool checked) {
114 if (!checked) return;
116 config.setValue("ui/orientation", "portrait");
119 void SettingsDialog::_set_icons_black(bool checked) {
120 if (!checked) return;
122 config.setValue("ui/iconstheme", "black");
125 void SettingsDialog::_set_icons_white(bool checked) {
126 if (!checked) return;
128 config.setValue("ui/iconstheme", "white");
131 void SettingsDialog::_set_gradient_no(bool checked) {
132 if (!checked) return;
134 config.setValue("ui/gradient", "no");
137 void SettingsDialog::_set_gradient_yes(bool checked) {
138 if (!checked) return;
140 config.setValue("ui/gradient", "yes");