예제 #1
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);


    QCoreApplication::setOrganizationName("foo");
    QCoreApplication::setApplicationName("mpdControl");
    QSettings settings;

    // letzte Verbindungsdaten laden ...
    int mpd_port = settings.value("port").toInt();
    QString mpd_host = settings.value("host").toString();

    // default values
    if (mpd_port == 0){ mpd_port = 6600; }
    if (mpd_host == NULL){ mpd_host = "localhost"; }

    this->ui->options_host->setText(mpd_host);
    this->ui->options_port->setText(QString::number(mpd_port));

    mpdmanager = new MpdManager();
    mpdmanager->mpdConnect(mpd_host, mpd_port);
    connect(mpdmanager, SIGNAL(songUpdate(QString, QString, QString, QString)), this, SLOT(updateSong(QString, QString, QString, QString)));
    connect(mpdmanager, SIGNAL(playlistUpdate(QList<MpdPlaylistEntry*>)), this, SLOT(updatePlaylist(QList<MpdPlaylistEntry*>)));
    connect(mpdmanager, SIGNAL(volChanged(int)), this->ui->volumeSlider, SLOT(setValue(int)));
    connect(ui->btnPlayPause, SIGNAL(clicked()), mpdmanager, SLOT(toggelPause()));
    connect(ui->btnStop, SIGNAL(clicked()), mpdmanager, SLOT(stop()));
    connect(ui->btnNext, SIGNAL(clicked()), mpdmanager, SLOT(next()));
    connect(ui->btnPrevious, SIGNAL(clicked()), mpdmanager, SLOT(previous()));
    connect(ui->volumeSlider, SIGNAL(valueChanged(int)), mpdmanager, SLOT(setVolume(int)));
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), mpdmanager, SLOT(getCurrentSong()));
    timer->start(1000);

    connect(this->ui->listWidget_playlist, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(playlistEntryClicked(QListWidgetItem*)));
}
예제 #2
0
void Settings::writeSettings()
{
    setValue(KEY_LANGUAGE, language());

    setValue(KEY_SESSION_AUTOPLAY, sessionAutoplay());
    setValue(KEY_SESSION_CHANNEL, sessionChannel());
    setValue(KEY_SESSION_REMEMBER_VOLUME, sessionRememberVolume());
    setValue(KEY_SESSION_VOLUME, sessionVolume());

    if (globalConfig && globalConfig->disableSettings("channels")) {
        remove("channels");
    } else {
        setValue(KEY_PLAYLIST, playlist());
        setValue(KEY_PLAYLIST_UPDATE, playlistUpdate());
        setValue(KEY_PLAYLIST_UPDATE_URL, playlistUpdateUrl());
        setValue(KEY_RADIO_CATEGORY, radioCategory());
        setValue(KEY_HD_CATEGORY, hdCategory());
        setValue(KEY_UDPXY, udpxy());
        setValue(KEY_UDPXY_URL, udpxyUrl());
        setValue(KEY_UDPXY_PORT, udpxyPort());
    }

    if (globalConfig && globalConfig->disableSettings("gui")) {
        remove("gui");
    } else {
        setValue(KEY_WIDTH, width());
        setValue(KEY_HEIGHT, height());
        setValue(KEY_POS_X, posX());
        setValue(KEY_POS_Y, posY());

        setValue(KEY_OSD, osd());
        setValue(KEY_TRAY_ENABLED, trayEnabled());
        setValue(KEY_HIDE_TO_TRAY, hideToTray());
        setValue(KEY_MOUSE_WHEEL, mouseWheel());
        setValue(KEY_REMEMBER_GUI_SESSION, rememberGuiSession());
        setValue(KEY_ICONS, icons());
    }

    if (globalConfig && globalConfig->disableSettings("backend")) {
        remove("backend");
    } else {
        setValue(KEY_VOUT, vout());
        setValue(KEY_AOUT, aout());
        setValue(KEY_YUV_TO_RGB, yuvToRgb());
        setValue(KEY_SPDIF, spdif());

        setValue(KEY_REMEMBER_VIDEO_SETTINGS, rememberVideoSettings());
        setValue(KEY_REMEMBER_VIDEO_PER_CHANNEL, rememberVideoPerChannel());
        setValue(KEY_ASPECT_RATIO, aspectRatio());
        setValue(KEY_CROP_RATIO, cropRatio());
        setValue(KEY_DEINTERLACING, deinterlacing());
        setValue(KEY_AUDIO_LANGUAGE, audioLanguage());
        setValue(KEY_SUBTITLE_LANGUAGE, subtitleLanguage());

        setValue(KEY_MUTE_ON_MINIMIZE, muteOnMinimize());
        setValue(KEY_TELETEXT, teletext());
    }

    if (globalConfig && globalConfig->disableSettings("recorder")) {
        remove("recorder");
    } else {
        setValue(KEY_RECORDER_DIRECTORY, recorderDirectory());
        setValue(KEY_SNAPSHOTS_DIRECTORY, snapshotsDirectory());
    }

    if (globalConfig && globalConfig->disableSettings("xmltv")) {
        remove("xmltv");
    } else {
        setValue(KEY_XMLTV_UPDATE, xmltvUpdate());
        setValue(KEY_XMLTV_UPDATE_LOCATION, xmltvUpdateLocation());
        setValue(KEY_XMLTV_UPDATE_REMOTE, xmltvUpdateRemote());
    }

    sync();
}