using namespace SomePlayer::DataObjects;
using namespace SomePlayer::Storage;
+using namespace SomePlayer::Playback;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
connect(_settings_form, SIGNAL(trackColorChanged()), _player_form, SLOT(updateTrackColor()));
connect(_settings_form, SIGNAL(hwZoomPolicyChanged()), this, SLOT(_hw_zoom_policy_changed()));
connect(&_dbus_client, SIGNAL(displayStateChanged(bool)), this, SLOT(_set_display_state(bool)));
+ connect(_settings_form, SIGNAL(fmtxSettingsChanged()), this, SLOT(_fmtx_settings_changed()));
_player_form->reload(true);
QString mode = config.getValue("ui/orientation").toString();
if (mode == "landscape") {
_library_form->checkGradient();
_directory_form->checkGradient();
_hw_zoom_policy_changed();
+ config.setValue("fmtx/enabled", "no");
setWindowTitle("SomePlayer");
}
void MainWindow::_set_display_state(bool state) {
_display_unlocked = state;
+ if (!_display_unlocked) { // remember volume level when blocking screen
+ _system_volume = _dbus_client.getVolume();
+ }
}
void MainWindow::_zoom_key_pressed(quint32 code) {
if (code == MM_KEY_DOWN) {
if (behavior == "track") {
_player_form->prev();
+ _dbus_client.setVolume(_system_volume);
}
} else if (code == MM_KEY_UP) {
if (behavior == "track") {
_player_form->next();
+ _dbus_client.setVolume(_system_volume);
}
}
}
+
+void MainWindow::_fmtx_settings_changed() {
+ Config config;
+ if (config.getValue("fmtx/enabled").toString() == "yes") {
+ QString station_name = config.getValue("fmtx/station_name").toString();
+ int frequency = config.getValue("fmtx/frequency").toInt();
+ system(QString("fmtx_client -p1 -f%1 -s\"%2\" -t\"%3\" 2>&1 >/dev/null")
+ .arg(frequency)
+ .arg(station_name)
+ .arg(_player_form->playerCaption()).toAscii());
+ } else {
+ system("fmtx_client -p 0 2>&1 >/dev/null");
+ }
+}