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.
20 #include "fmtxsettingsdialog.h"
21 #include "ui_fmtxsettingsdialog.h"
22 #include "someplayer.h"
24 using namespace SomePlayer::Storage;
26 FmtxSettingsDialog::FmtxSettingsDialog(QWidget *parent) :
28 ui(new Ui::FmtxSettingsDialog)
32 QString station_name = config.getValue("fmtx/station_name").toString();
33 if (station_name.isEmpty()) {
34 station_name = "S.P.";
35 config.setValue("fmtx/station_name", station_name);
37 int freq = config.getValue("fmtx/frequency").toInt();
38 ui->stationNameLineEdit->setText(station_name);
39 int freq_g = freq/1000;
40 int freq_s = (freq % 1000)/10;
41 freq_g = freq_g > 107 ? 107 : freq_g;
42 freq_g = freq_g < 88 ? 88 : freq_g;
43 ui->freqGWidget->scrollTo(ui->freqGWidget->model()->index(freq_g-88, 0));
44 ui->freqGWidget->setCurrentRow(freq_g-88);
45 ui->freqSWidget->scrollTo(ui->freqSWidget->model()->index(freq_s/5, 0));
46 ui->freqSWidget->setCurrentRow(freq_s/5);
49 FmtxSettingsDialog::~FmtxSettingsDialog()
54 QString FmtxSettingsDialog::stationName() {
55 return ui->stationNameLineEdit->text();
58 int FmtxSettingsDialog::frequency() {
59 return (88+ui->freqGWidget->currentRow())*1000+10*(ui->freqSWidget->currentRow()*5);