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 ui->albumsSortAButton->setChecked(true); // defaule sorting
36 ui->showTrackLenghtYButton->setChecked(true); // show by default
37 ui->orientationLButton->setChecked(true);
38 if (albumSorting == "date") {
39 ui->albumsSortDButton->setChecked(true);
41 if (showTrackLenght == "no") {
42 ui->showTrackLenghtNButton->setChecked(true);
44 if (orientation == "portrait") {
45 ui->orientationPButton->setChecked(true);
46 } else if (orientation == "auty") {
47 ui->orientationAButton->setChecked(true);
49 connect (ui->albumsSortAButton, SIGNAL(toggled(bool)), this, SLOT(_set_album_sorting_alphabet(bool)));
50 connect (ui->albumsSortDButton, SIGNAL(toggled(bool)), this, SLOT(_set_album_sorting_date(bool)));
51 connect (ui->showTrackLenghtNButton, SIGNAL(toggled(bool)), this, SLOT(_set_track_lenght_show_no(bool)));
52 connect (ui->showTrackLenghtYButton, SIGNAL(toggled(bool)), this, SLOT(_set_track_lenght_show_yes(bool)));
53 connect (ui->orientationAButton, SIGNAL(toggled(bool)), this, SLOT(_set_orientation_auto(bool)));
54 connect (ui->orientationLButton, SIGNAL(toggled(bool)), this, SLOT(_set_orientation_landscape(bool)));
55 connect (ui->orientationPButton, SIGNAL(toggled(bool)), this, SLOT(_set_orientation_portrait(bool)));
58 ui->albumSortingGroupBox->setVisible(false);
61 SettingsDialog::~SettingsDialog()
66 void SettingsDialog::_set_album_sorting_date(bool checked) {
69 config.setValue("ui/albumsorting", "date");
72 void SettingsDialog::_set_album_sorting_alphabet(bool checked) {
75 config.setValue("ui/albumsorting", "alphabet");
78 void SettingsDialog::_set_track_lenght_show_no(bool checked) {
81 config.setValue("ui/showtracklenght", "no");
84 void SettingsDialog::_set_track_lenght_show_yes(bool checked) {
87 config.setValue("ui/showtracklenght", "yes");
90 void SettingsDialog::_set_orientation_auto(bool checked) {
93 config.setValue("ui/orientation", "auto");
96 void SettingsDialog::_set_orientation_landscape(bool checked) {
99 config.setValue("ui/orientation", "landscape");
102 void SettingsDialog::_set_orientation_portrait(bool checked) {
103 if (!checked) return;
105 config.setValue("ui/orientation", "portrait");