Transport::Transport(Ui::CommAudioClass* gui, QWidget* parent) : QObject(parent), ui(gui), playingState(STOPPED) { connect(ui->playPushButton, SIGNAL(clicked()), this, SLOT(onPlayClicked())); connect(ui->stopPushButton, SIGNAL(clicked()), this, SLOT(onStopClicked())); connect(ui->previousPushButton, SIGNAL(clicked()), this, SLOT(onPreviousClicked())); connect(ui->nextPushButton, SIGNAL(clicked()), this, SLOT(onNextClicked())); connect(ui->shufflePushButton, SIGNAL(clicked()), this, SLOT(onShuffleClicked())); connect(ui->loopPushButton, SIGNAL(clicked()), this, SLOT(onLoopClicked())); connect(this, SIGNAL(songChanged()), parent, SLOT(changeDisplayedSong())); connect(this, SIGNAL(songStopped()), parent, SLOT(clearDisplayedSong())); QSettings settings; loop = !settings.value("loop", false).toBool(); onLoopClicked(); shuffle = !settings.value("shuffle", false).toBool(); onShuffleClicked(); }
void Transport::onSongFinished() { ui->playPushButton->setIcon(QIcon(ICON_PLAY)); playingState = STOPPED; onNextClicked(); if (!loop) { ((CommAudio*) parent())->getUserSongs()->clearSelectedItems(); } }
SummaryPage* SummaryPageController::createSummaryPage(bool therapist) { SummaryPage::Mode mode = therapist ? SummaryPage::TherapistMode : SummaryPage::PatientMode; SummaryPage* page = new SummaryPage(mode); page->setScoreLabelText(tr("This time you scored: ")); CENT::connect(page, SIGNAL(playAgain()), this, SLOT(onPlayAgain())); CENT::connect(page, SIGNAL(nextClicked()), this, SLOT(onNextClicked())); CENT::connect(page, SIGNAL(changeParams()), this, SLOT(onParamsChangeRequest())); CENT::connect(page, SIGNAL(changeGame()), this, SLOT(onChangeGameRequest())); return page; }
MpdClientDialog::MpdClientDialog(QWidget *parent) : QDialog(parent, Qt::FramelessWindowHint) , vbox_(this) , titlebar_widget_(this) , titlebar_layout_(&titlebar_widget_) , titlebar_icon_(0) , titlebar_label_(0) , close_button_("", 0) , title_layout_(0) , title_icon_(0) , title_label_(0) , artist_layout_(0) , artist_icon_(0) , artist_label_(0) , hor_separator_(this) , button_widget_(this) , button_layout_(&button_widget_) , prev_button_("", 0) , play_button_("", 0) , stop_button_("", 0) , next_button_("", 0) , mode_button_("", 0) { QIcon icon; QSize icon_size; setModal(true); setAutoFillBackground(true); setBackgroundRole(QPalette::Base); titlebar_icon_.setPixmap(QPixmap(":/images/music_player_small.png")); QFont titlebar_font(titlebar_label_.font()); titlebar_font.setPointSize(25); titlebar_label_.setFont(titlebar_font); titlebar_label_.setAlignment(Qt::AlignLeft|Qt::AlignVCenter); titlebar_label_.setIndent(10); titlebar_label_.setText(QCoreApplication::tr("Music Player")); icon = loadIcon(":/images/close.png", icon_size); close_button_.setStyleSheet(PAGE_BUTTON_STYLE); close_button_.setIconSize(icon_size); close_button_.setIcon(icon); close_button_.setFocusPolicy(Qt::NoFocus); titlebar_layout_.setSpacing(2); titlebar_layout_.setContentsMargins(5, 0, 5, 0); titlebar_layout_.addWidget(&titlebar_icon_, 10); titlebar_layout_.addWidget(&titlebar_label_, 300); titlebar_layout_.addWidget(&close_button_); titlebar_widget_.setAutoFillBackground(true); titlebar_widget_.setBackgroundRole(QPalette::Dark); titlebar_widget_.setContentsMargins(0, 0, 0, 0); titlebar_widget_.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); title_icon_.setPixmap(QPixmap(":/images/title.png")); QFont title_font(title_label_.font()); title_font.setPointSize(28); title_label_.setFont(title_font); title_label_.setAlignment(Qt::AlignLeft|Qt::AlignVCenter); title_label_.setContentsMargins(10, 0, 5, 0); title_label_.setMaximumWidth(400); title_layout_.setSpacing(2); title_layout_.setContentsMargins(5, 5, 5, 0); title_layout_.addWidget(&title_icon_, 10); title_layout_.addWidget(&title_label_, 200); artist_icon_.setPixmap(QPixmap(":/images/artist.png")); QFont artist_font(artist_label_.font()); artist_font.setPointSize(20); artist_label_.setFont(artist_font); artist_label_.setAlignment(Qt::AlignLeft|Qt::AlignVCenter); artist_label_.setContentsMargins(10, 0, 5, 0); artist_label_.setMaximumWidth(400); artist_layout_.setSpacing(2); artist_layout_.setContentsMargins(5, 0, 5, 0); artist_layout_.addWidget(&artist_icon_, 10); artist_layout_.addWidget(&artist_label_, 200); album_icon_.setPixmap(QPixmap(":/images/album.png")); QFont album_font(album_label_.font()); album_font.setPointSize(20); album_label_.setFont(album_font); album_label_.setAlignment(Qt::AlignLeft|Qt::AlignVCenter); album_label_.setContentsMargins(10, 0, 5, 0); album_label_.setMaximumWidth(400); album_layout_.setSpacing(2); album_layout_.setContentsMargins(5, 0, 5, 5); album_layout_.addWidget(&album_icon_, 10); album_layout_.addWidget(&album_label_, 200); progress_bar_.setMinimum(0); progress_bar_.setMaximum(0); progress_bar_.setContentsMargins(2, 1, 2, 1); QFont progress_font(progress_label_.font()); progress_font.setPointSize(12); progress_font.setBold(true); progress_label_.setFont(progress_font); progress_label_.setAlignment(Qt::AlignLeft|Qt::AlignVCenter); progress_label_.setIndent(10); progress_layout_.setSpacing(2); progress_layout_.setContentsMargins(5, 0, 5, 5); progress_layout_.addWidget(&progress_bar_); progress_layout_.addWidget(&progress_label_); hor_separator_.setFixedHeight(1); hor_separator_.setFocusPolicy(Qt::NoFocus); hor_separator_.setFrameShape(QFrame::HLine); hor_separator_.setAutoFillBackground(true); hor_separator_.setBackgroundRole(QPalette::Light); icon = loadIcon(":/images/play_prev.png", icon_size); prev_button_.setStyleSheet(PAGE_BUTTON_STYLE); prev_button_.setIconSize(icon_size); prev_button_.setIcon(icon); prev_button_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); prev_button_.setFocusPolicy(Qt::TabFocus); play_button_.setStyleSheet(PAGE_BUTTON_STYLE); play_button_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); play_button_.setFocusPolicy(Qt::TabFocus); stop_button_.setStyleSheet(PAGE_BUTTON_STYLE); stop_button_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); stop_button_.setFocusPolicy(Qt::TabFocus); icon = loadIcon(":/images/play_next.png", icon_size); next_button_.setStyleSheet(PAGE_BUTTON_STYLE); next_button_.setIconSize(icon_size); next_button_.setIcon(icon); next_button_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); next_button_.setFocusPolicy(Qt::TabFocus); mode_button_.setStyleSheet(PAGE_BUTTON_STYLE); mode_button_.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); mode_button_.setFocusPolicy(Qt::TabFocus); button_layout_.setSpacing(2); button_layout_.setContentsMargins(5, 5, 5, 5); button_layout_.addStretch(); button_layout_.addWidget(&prev_button_); button_layout_.addWidget(&play_button_); button_layout_.addWidget(&stop_button_); button_layout_.addWidget(&next_button_); button_layout_.addWidget(&mode_button_); button_layout_.addStretch(); button_widget_.setContentsMargins(0, 0, 0, 0); button_widget_.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); vbox_.setSpacing(0); vbox_.setContentsMargins(0, 0, 0, 0); vbox_.addWidget(&titlebar_widget_); vbox_.addLayout(&title_layout_); vbox_.addLayout(&artist_layout_); vbox_.addLayout(&album_layout_); vbox_.addLayout(&progress_layout_); vbox_.addWidget(&hor_separator_); vbox_.addWidget(&button_widget_); connect(&close_button_, SIGNAL(clicked()), this, SLOT(done())); connect(&prev_button_, SIGNAL(clicked()), this, SLOT(onPrevClicked())); connect(&play_button_, SIGNAL(clicked()), this, SLOT(onPlayClicked())); connect(&stop_button_, SIGNAL(clicked()), this, SLOT(onStopClicked())); connect(&next_button_, SIGNAL(clicked()), this, SLOT(onNextClicked())); connect(&mode_button_, SIGNAL(clicked()), this, SLOT(onModeClicked())); timer_ = new QTimer(this); timer_->setSingleShot(false); timer_->setInterval(2 * 1000); QMpdClient &mpdClient = QMpdClient::instance(); connect(&mpdClient, SIGNAL(stateChanged(QMpdStatus::State)), this, SLOT(onStateChanged(QMpdStatus::State))); connect(&mpdClient, SIGNAL(modeChanged(QMpdStatus::Mode)), this, SLOT(onModeChanged(QMpdStatus::Mode))); connect(&mpdClient, SIGNAL(songChanged(const QMpdSong &)), this, SLOT(onSongChanged(const QMpdSong &))); connect(&mpdClient, SIGNAL(elapsedSecondsAtStatusChange(int)), this, SLOT(onElapsedSecondsAtStatusChange(int))); connect(timer_, SIGNAL(timeout()), this, SLOT(onTimeout())); onStateChanged(mpdClient.status().state()); onModeChanged(mpdClient.status().mode()); onSongChanged(mpdClient.song()); onElapsedSecondsAtStatusChange(mpdClient.status().elapsedSeconds()); show(); sys::SysStatus::instance().setSystemBusy(false); onyx::screen::instance().flush(this, onyx::screen::ScreenProxy::GC, false); }