SearchMusicListItem::SearchMusicListItem(QWidget *parent, Song* song, API *api, AudioPlayerBridge *apb, PlaylistHandler *plh, MessageHandler* messageHandler, Player *player) : QWidget(parent), ui(new Ui::SearchMusicListItem) { ui->setupUi(this); playerWasPlaying = false; this->song = song; this->player = player; ui->lblTitle->setText(QString::fromStdString(song->getSongName())); ui->lblArtist->setText(QString::fromStdString(song->getArtistName())); ui->lblAlbum->setText(QString::fromStdString(song->getAlbumName())); ui->lblArtist->setAttribute(Qt::WA_TransparentForMouseEvents); ui->lblArtistCaption->setAttribute(Qt::WA_TransparentForMouseEvents); ui->lblAlbum->setAttribute(Qt::WA_TransparentForMouseEvents); ui->lblAlbumCaption->setAttribute(Qt::WA_TransparentForMouseEvents); ui->lblTitle->setAttribute(Qt::WA_TransparentForMouseEvents); ui->lblTitleCaption->setAttribute(Qt::WA_TransparentForMouseEvents); ui->cmbAddTo->setCurrentIndex(0); MouseWheelDisabler* mwd = new MouseWheelDisabler(ui->cmbAddTo); ui->cmbAddTo->installEventFilter(mwd); connect(mwd, SIGNAL(playlistAddEvent()), this, SLOT(createNewPlaylist())); this->apb = apb; this->api = api; this->plh = plh; this->messageHandler = messageHandler; onPlaylistChange(plh->getPlaylists()); connect(plh, SIGNAL(playlistsChanged(std::vector<std::string>)), this, SLOT(onPlaylistChange(std::vector<std::string>))); this->setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showContextMenu(const QPoint&))); }
MenuBar::MenuBar() { init(); connect(newPlaylist, SIGNAL(triggered()), this, SLOT(createNewPlaylist())); connect(openFile, SIGNAL(triggered()), this, SLOT(open())); connect(delPlaylist, SIGNAL(triggered()), this, SLOT(deletePlaylist())); connect(close, SIGNAL(triggered()), this, SLOT(quit())); connect(optionsAction, SIGNAL(triggered()), this, SLOT(showOptions())); connect(playlistEditAction, SIGNAL(triggered()), this, SLOT(showPlaylistEditor())); connect(about, SIGNAL(triggered()), this, SLOT(aboutDialog())); }
VimeoPlaylistDialog::VimeoPlaylistDialog(VimeoVideo *video, QWidget *parent) : Dialog(parent), m_video(video), m_playlist(0), m_model(new VimeoPlaylistModel(this)), m_cache(new ImageCache), m_view(new ListView(this)), m_tabBar(new QTabBar(this)), m_stack(new QStackedWidget(this)), m_scrollArea(0), m_titleEdit(0), m_descriptionEdit(0), m_passwordEdit(0), 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 albums found")), this)), m_buttonBox(new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Vertical, this)), m_layout(new QGridLayout(this)) { setWindowTitle(tr("Add to album")); setMinimumHeight(340); m_view->setModel(m_model); m_view->setItemDelegate(new PlaylistDelegate(m_cache, VimeoPlaylistModel::DateRole, VimeoPlaylistModel::ThumbnailUrlRole, VimeoPlaylistModel::TitleRole, VimeoPlaylistModel::UsernameRole, VimeoPlaylistModel::VideoCountRole, m_view)); m_tabBar->addTab(tr("Albums")); m_tabBar->addTab(tr("New album")); m_tabBar->setExpanding(false); m_tabBar->setDrawBase(false); m_tabBar->setStyleSheet("QTabBar::tab { height: 40px; }"); m_stack->addWidget(m_view); m_stack->addWidget(m_label); m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); m_layout->addWidget(m_tabBar, 0, 0); m_layout->addWidget(m_stack, 1, 0); m_layout->addWidget(m_buttonBox, 1, 1, 2, 1); m_layout->setRowStretch(1, 1); connect(m_cache, SIGNAL(imageReady()), this, SLOT(onImageReady())); connect(m_model, SIGNAL(statusChanged(QVimeo::ResourcesRequest::Status)), this, SLOT(onModelStatusChanged(QVimeo::ResourcesRequest::Status))); connect(m_view, SIGNAL(activated(QModelIndex)), this, SLOT(addToPlaylist(QModelIndex))); connect(m_tabBar, SIGNAL(currentChanged(int)), this, SLOT(onTabIndexChanged(int))); connect(m_buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(createNewPlaylist())); }
void SearchMusicListItem::on_cmbAddTo_currentIndexChanged(int index) { if (index == 0 || working) return; if (index == ui->cmbAddTo->count() - 1) { createNewPlaylist(); return; } if (!plh->addEntry(song, ui->cmbAddTo->itemText(index).toStdString())) { QMessageBox::warning(this->parentWidget(), "GSP - Add song", QString::fromStdString("The song '" + song->getSongName() + "' is already inside the playlist '" + ui->cmbAddTo->itemText(index).toStdString() + "'!")); ui->cmbAddTo->setCurrentIndex(0); return; } messageHandler->addMessage("'" + song->getSongName() + "' was successfully added to '" + ui->cmbAddTo->itemText(index).toStdString() + "'!"); ui->cmbAddTo->setCurrentIndex(0); return; }