void savePlaylistState() { if(playlist_stateFile) { FILE * fp; char tmp[MAXPATHLEN+1]; snprintf(tmp,MAXPATHLEN,"%s.%05d.%ld",playlist_stateFile, getpid(),time(NULL)); while(!(fp = fopen(tmp,"w")) && errno==EINTR); if(!fp) { ERROR("problems opening state file \"%s\" for " "writing\n",playlist_stateFile); return; } myfprintf(fp,"%s",PLAYLIST_STATE_FILE_STATE); switch(playlist_state) { case PLAYLIST_STATE_PLAY: switch(getPlayerState()) { case PLAYER_STATE_PAUSE: myfprintf(fp,"%s\n", PLAYLIST_STATE_FILE_STATE_PAUSE); break; default: myfprintf(fp,"%s\n", PLAYLIST_STATE_FILE_STATE_PLAY); } myfprintf(fp,"%s%i\n",PLAYLIST_STATE_FILE_CURRENT, playlist.order[playlist.current]); myfprintf(fp,"%s%i\n",PLAYLIST_STATE_FILE_TIME, getPlayerElapsedTime()); break; default: myfprintf(fp,"%s\n",PLAYLIST_STATE_FILE_STATE_STOP); break; } myfprintf(fp,"%s%i\n",PLAYLIST_STATE_FILE_RANDOM, playlist.random); myfprintf(fp,"%s%i\n",PLAYLIST_STATE_FILE_REPEAT, playlist.repeat); myfprintf(fp,"%s%i\n",PLAYLIST_STATE_FILE_CROSSFADE, (int)(getPlayerCrossFade())); myfprintf(fp,"%s\n",PLAYLIST_STATE_FILE_PLAYLIST_BEGIN); showPlaylist(fp); myfprintf(fp,"%s\n",PLAYLIST_STATE_FILE_PLAYLIST_END); while(fclose(fp) && errno==EINTR); rename(tmp,playlist_stateFile); } }
VerticalMenuWidget::VerticalMenuWidget(QWidget *parent) : AbstractMenuWidget(parent), ui(new Ui::VerticalMenuWidget) { ui->setupUi(this); connect(ui->btnAbout,SIGNAL(clicked()),this,SIGNAL(showAbout())); connect(ui->btnExit,SIGNAL(clicked()),this,SIGNAL(exitClicked())); connect(ui->btnFiles,SIGNAL(clicked()),this,SIGNAL(showFiles())); connect(ui->btnArtists,SIGNAL(clicked()),this,SIGNAL(showArtists())); connect(ui->btnAlbums,SIGNAL(clicked()),this,SIGNAL(showAlbums())); connect(ui->btnConnect,SIGNAL(clicked()),this,SIGNAL(connectClicked())); connect(ui->btnCurrentSong,SIGNAL(clicked()),this,SIGNAL(showCurrentSong())); connect(ui->btnSettings,SIGNAL(clicked()),this,SIGNAL(showSettings())); connect(ui->btnPlaylists,SIGNAL(clicked()),this,SIGNAL(showPlaylist())); }
void Cleps_VidPlayer::contextMenuEvent(QContextMenuEvent *event) { QMenu menu(this); menu.addAction(tr("View Playlist"), this->parent(), SLOT(showPlaylist())); menu.addAction(tr("Add Media"), this->parent(), SLOT(open())); menu.addSeparator(); menu.addAction(tr("Toggle Fullscreen"),this, SLOT(fullScreen())); menu.addSeparator(); menu.addAction(tr("Play/Pause"),this->parent(), SLOT(play())); menu.addAction(tr("Previous"),this->parent(), SLOT(previousMedia())); menu.addAction(tr("Next"),this->parent(), SLOT(nextMedia())); menu.addAction(tr("Stop"),this->parent(), SLOT(stop())); menu.addSeparator(); menu.addAction(tr("Quit"),this->parent(), SLOT(quit())); menu.exec(event->globalPos()); }
SoundCloudPlaylistsWindow::SoundCloudPlaylistsWindow(StackedWindow *parent) : StackedWindow(parent), m_model(new SoundCloudPlaylistModel(this)), m_cache(new ImageCache), m_nowPlayingAction(new NowPlayingAction(this)), m_view(new ListView(this)), m_reloadAction(new QAction(tr("Reload"), this)), m_label(new QLabel(QString("<p align='center'; style='font-size: 40px; color: %1'>%2</p>") .arg(palette().color(QPalette::Mid).name()).arg(tr("No sets found")), this)) { setWindowTitle(tr("Sets")); setCentralWidget(new QWidget); m_view->setModel(m_model); m_view->setItemDelegate(new PlaylistDelegate(m_cache, SoundCloudPlaylistModel::ArtistRole, SoundCloudPlaylistModel::DateRole, SoundCloudPlaylistModel::ThumbnailUrlRole, SoundCloudPlaylistModel::TitleRole, SoundCloudPlaylistModel::TrackCountRole, m_view)); m_reloadAction->setEnabled(false); m_label->hide(); m_layout = new QVBoxLayout(centralWidget()); m_layout->addWidget(m_view); m_layout->addWidget(m_label); m_layout->setContentsMargins(0, 0, 0, 0); menuBar()->addAction(m_reloadAction); menuBar()->addAction(m_nowPlayingAction); connect(m_model, SIGNAL(statusChanged(QSoundCloud::ResourcesRequest::Status)), this, SLOT(onModelStatusChanged(QSoundCloud::ResourcesRequest::Status))); connect(m_cache, SIGNAL(imageReady()), this, SLOT(onImageReady())); connect(m_view, SIGNAL(activated(QModelIndex)), this, SLOT(showPlaylist(QModelIndex))); connect(m_reloadAction, SIGNAL(triggered()), m_model, SLOT(reload())); }