Exemplo n.º 1
0
SoundPref::SoundPref(QWidget *parent)
	: PrefWidget(parent)
{
	ui.setupUi(this);

	AmeDirs *ame = AmeDirs::global();
	stg1 = new AmeSettings(ame->stdDir(AmeDirs::Configs) + "/Sound", QSettings::IniFormat);

	readSettings();

	// Sound effects tab
	ui.soundsLst->setColumnCount(2);
	ui.soundsLst->setColumnWidth(0, 420);

	QStringList hdr;
	hdr << "Name" << "Enabled";
	ui.soundsLst->setHeaderLabels(hdr);
	Sounds lst = AmeSoundTheme::global()->getAll();
	for (int i=0; i<lst.size(); i++) {
		QTreeWidgetItem *it = new QTreeWidgetItem(ui.soundsLst);
		it->setText(0, lst.at(i)->name);
		it->setText(1, "");
		if (lst.at(i)->enabled)
			it->setCheckState(1, Qt::Checked);
		else
			it->setCheckState(1, Qt::Unchecked);
		it->setData(1, Qt::UserRole, QVariant(lst.at(i)->soundId));
	}

	connect(ui.soundsLst, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(onSoundItemChange(QTreeWidgetItem *, int)));
	connect(ui.soundsLst, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(onSoundItem(QTreeWidgetItem *, int)));

	ui.volumeSldr->setMinimum(0);
	ui.volumeSldr->setMaximum(100);
	connect(ui.volumeSldr, SIGNAL(sliderMoved(int)), this, SLOT(onSlider(int)));
	connect(ui.volumeSldr, SIGNAL(sliderReleased()), this, SLOT(onSliderRelease()));

	connect(ui.muteChk, SIGNAL(clicked()), this, SLOT(onMute()));
	connect(ui.sndVolFeedbackChk, SIGNAL(clicked()),this, SLOT(onVolumeFeedback()));
	connect(ui.showCtrlChk, SIGNAL(clicked()), this, SLOT(onShowHideVolumeCtrl()));

	timer = new QTimer();
	connect(timer, SIGNAL(timeout()), this, SLOT(checkVolume()));
	timer->start(100);

	// Output settings tab
	hwList = new hwDevices();
	getHwList(modePlayback);
	getMixerDevices(modePlayback);

	connect(ui.playbackMixerDeviceCmb, SIGNAL(activated(const QString &)), this, SLOT(onMixerDevice(const QString &)));

	refresh();

	moduleName = "Sound";
}
Exemplo n.º 2
0
MainWindow::MainWindow(QWidget *widget, Qt::WFlags fl)
  : QMainWindow(widget, fl)
  , Ui::MainWindow()
{
    setupUi(this);

    Ui_MainWindow::mainToolBar->setIconSize(QSize(35, 35));

    connect(actionVolumeUp, SIGNAL(triggered()), this, SLOT(onVolumeUp()));
    connect(actionVolumeDown, SIGNAL(triggered()), this, SLOT(onVolumeDown()));
    connect(actionMute, SIGNAL(triggered()), this, SLOT(onMute()));
    connect(actionSkip, SIGNAL(triggered()), this, SLOT(onSkip()));
    connect(actionStop, SIGNAL(triggered()), this, SLOT(onStop()));
    connect(actionPlay, SIGNAL(triggered()), this, SLOT(onUnpause()));
    connect(actionPause, SIGNAL(triggered()), this, SLOT(onPause()));

    actionPlay->setVisible(false);

    connect(actionLogoutAndQuit, SIGNAL(triggered()), qApp, SLOT(logoutAndQuit()));
    connect(actionQuit, SIGNAL(triggered()), qApp, SLOT(logout()));
    connect(actionAbout, SIGNAL(triggered()), this, SLOT(showAboutSpotfm()));

    m_settingsDlg = new SettingsDialog(this);
    connect(actionSettings, SIGNAL(triggered()), m_settingsDlg, SLOT(show()));

    Radio *radio = SpotFm::app()->radio();
    connect(radio, SIGNAL(trackStarted(Track)), this, SLOT(onTrackStarted(Track)));
    connect(radio, SIGNAL(skipsLeft(int)), this, SLOT(enableSkipButton(int)));
    connect(radio, SIGNAL(trackProgress(int)), this, SLOT(onTrackProgress(int)));
    connect(radio, SIGNAL(error(int, QString)), this, SLOT(onRadioError(int, QString)));

    connect(volumeSlider, SIGNAL(valueChanged(int)), radio, SLOT(setVolume(int)));

    connect(stationWidget, SIGNAL(clicked()), this, SLOT(onNewStation()));
    stationWidget->setFocus();

    QSettings *s = SpotFm::app()->settings();
    volumeSlider->setValue(s->value("volume", 80).toInt());
    radio->setVolume(volumeSlider->value());
    m_lastVolume = volumeSlider->value();

    defaultWindow();
    setupTrayIcon();
    loadExtensions();
}