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 iconsTheme = config.getValue("ui/iconstheme").toString();
33 QString albumSorting = config.getValue("ui/albumsorting").toString();
34 QString showTrackLenght = config.getValue("ui/showtracklenght").toString();
35 QString portraitEnabled = config.getValue("ui/portraitmode").toString();
36 ui->iconsWButton->setChecked(true); // "white" by default
37 ui->albumsSortAButton->setChecked(true); // defaule sorting
38 ui->showTrackLenghtYButton->setChecked(true); // show by default
39 ui->portraitEnableButton->setChecked(true); // enabled by default
40 if (iconsTheme == "black") {
41 ui->iconsBButton->setChecked(true);
43 if (albumSorting == "date") {
44 ui->albumsSortDButton->setChecked(true);
46 if (showTrackLenght == "no") {
47 ui->showTrackLenghtNButton->setChecked(true);
49 if (portraitEnabled == "disabled") {
50 ui->portraitDisableButton->setChecked(true);
52 connect (ui->iconsBButton, SIGNAL(toggled(bool)), this, SLOT(_set_icons_black(bool)));
53 connect (ui->iconsWButton, SIGNAL(toggled(bool)), this, SLOT(_set_icons_white(bool)));
54 connect (ui->albumsSortAButton, SIGNAL(toggled(bool)), this, SLOT(_set_album_sorting_alphabet(bool)));
55 connect (ui->albumsSortDButton, SIGNAL(toggled(bool)), this, SLOT(_set_album_sorting_date(bool)));
56 connect (ui->showTrackLenghtNButton, SIGNAL(toggled(bool)), this, SLOT(_set_track_lenght_show_no(bool)));
57 connect (ui->showTrackLenghtYButton, SIGNAL(toggled(bool)), this, SLOT(_set_track_lenght_show_yes(bool)));
58 connect (ui->portraitDisableButton, SIGNAL(toggled(bool)), this, SLOT(_set_portrait_disabled(bool)));
59 connect (ui->portraitEnableButton, SIGNAL(toggled(bool)), this, SLOT(_set_portrait_enabled(bool)));
62 ui->albumSortingGroupBox->setVisible(false);
65 SettingsDialog::~SettingsDialog()
70 void SettingsDialog::_set_icons_black(bool checked) {
73 config.setValue("ui/iconstheme", "black");
76 void SettingsDialog::_set_icons_white(bool checked) {
79 config.setValue("ui/iconstheme", "white");
82 void SettingsDialog::_set_album_sorting_date(bool checked) {
85 config.setValue("ui/albumsorting", "date");
88 void SettingsDialog::_set_album_sorting_alphabet(bool checked) {
91 config.setValue("ui/albumsorting", "alphabet");
94 void SettingsDialog::_set_track_lenght_show_no(bool checked) {
97 config.setValue("ui/showtracklenght", "no");
100 void SettingsDialog::_set_track_lenght_show_yes(bool checked) {
101 if (!checked) return;
103 config.setValue("ui/showtracklenght", "yes");
106 void SettingsDialog::_set_portrait_disabled(bool checked) {
107 if (!checked) return;
109 config.setValue("ui/portraitmode", "disabled");
112 void SettingsDialog::_set_portrait_enabled(bool checked) {
113 if (!checked) return;
115 config.setValue("ui/portraitmode", "enabled");