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 QString language = config.getValue("ui/language").toString();
38 ui->albumsSortDButton->setChecked(true); // defaule sorting
39 ui->showTrackLenghtYButton->setChecked(true); // show by default
40 ui->orientationLButton->setChecked(true);
41 ui->iconsWButton->setChecked(true);
42 ui->gradientYButton->setChecked(true);
43 ui->engLangButton->setChecked(true);
44 if (albumSorting == "alphabet") {
45 ui->albumsSortAButton->setChecked(true);
47 if (showTrackLenght == "no") {
48 ui->showTrackLenghtNButton->setChecked(true);
50 if (orientation == "portrait") {
51 ui->orientationPButton->setChecked(true);
52 } else if (orientation == "auto") {
53 ui->orientationAButton->setChecked(true);
55 if (icons_theme == "black") {
56 ui->iconstBButton->setChecked(true);
58 if (gradient == "no") {
59 ui->gradientNButton->setChecked(true);
61 if (language == "ru") {
62 ui->ruLangButton->setChecked(true);
64 connect (ui->albumsSortAButton, SIGNAL(toggled(bool)), this, SLOT(_set_album_sorting_alphabet(bool)));
65 connect (ui->albumsSortDButton, SIGNAL(toggled(bool)), this, SLOT(_set_album_sorting_date(bool)));
66 connect (ui->showTrackLenghtNButton, SIGNAL(toggled(bool)), this, SLOT(_set_track_lenght_show_no(bool)));
67 connect (ui->showTrackLenghtYButton, SIGNAL(toggled(bool)), this, SLOT(_set_track_lenght_show_yes(bool)));
68 connect (ui->orientationAButton, SIGNAL(toggled(bool)), this, SLOT(_set_orientation_auto(bool)));
69 connect (ui->orientationLButton, SIGNAL(toggled(bool)), this, SLOT(_set_orientation_landscape(bool)));
70 connect (ui->orientationPButton, SIGNAL(toggled(bool)), this, SLOT(_set_orientation_portrait(bool)));
71 connect (ui->iconstBButton, SIGNAL(toggled(bool)), this, SLOT(_set_icons_black(bool)));
72 connect (ui->iconsWButton, SIGNAL(toggled(bool)), this, SLOT(_set_icons_white(bool)));
73 connect (ui->gradientNButton, SIGNAL(toggled(bool)), this, SLOT(_set_gradient_no(bool)));
74 connect (ui->gradientYButton, SIGNAL(toggled(bool)), this, SLOT(_set_gradient_yes(bool)));
75 connect (ui->engLangButton, SIGNAL(toggled(bool)), this, SLOT(_set_lang_en(bool)));
76 connect (ui->ruLangButton, SIGNAL(toggled(bool)), this, SLOT(_set_lang_ru(bool)));
79 SettingsDialog::~SettingsDialog()
84 void SettingsDialog::_set_album_sorting_date(bool checked) {
87 config.setValue("ui/albumsorting", "date");
90 void SettingsDialog::_set_album_sorting_alphabet(bool checked) {
93 config.setValue("ui/albumsorting", "alphabet");
96 void SettingsDialog::_set_track_lenght_show_no(bool checked) {
99 config.setValue("ui/showtracklenght", "no");
102 void SettingsDialog::_set_track_lenght_show_yes(bool checked) {
103 if (!checked) return;
105 config.setValue("ui/showtracklenght", "yes");
108 void SettingsDialog::_set_orientation_auto(bool checked) {
109 if (!checked) return;
111 config.setValue("ui/orientation", "auto");
114 void SettingsDialog::_set_orientation_landscape(bool checked) {
115 if (!checked) return;
117 config.setValue("ui/orientation", "landscape");
120 void SettingsDialog::_set_orientation_portrait(bool checked) {
121 if (!checked) return;
123 config.setValue("ui/orientation", "portrait");
126 void SettingsDialog::_set_icons_black(bool checked) {
127 if (!checked) return;
129 config.setValue("ui/iconstheme", "black");
132 void SettingsDialog::_set_icons_white(bool checked) {
133 if (!checked) return;
135 config.setValue("ui/iconstheme", "white");
138 void SettingsDialog::_set_gradient_no(bool checked) {
139 if (!checked) return;
141 config.setValue("ui/gradient", "no");
144 void SettingsDialog::_set_gradient_yes(bool checked) {
145 if (!checked) return;
147 config.setValue("ui/gradient", "yes");
150 void SettingsDialog::_set_lang_en(bool checked) {
151 if (!checked) return;
153 config.setValue("ui/language", "en");
156 void SettingsDialog::_set_lang_ru(bool checked) {
157 if (!checked) return;
159 config.setValue("ui/language", "ru");
162 void SettingsDialog::updateTranslations() {
163 ui->retranslateUi(this);