void Gui::AddElement(GuiElement* elem, bool asBackground) { if (elements.empty()) { inputConBlock.unblock(); } toBeAdded.push_back(GuiItem(elem,asBackground)); }
TrackOrganiser::TrackOrganiser(QWidget *parent) : SongDialog(parent, "TrackOrganiser", QSize(800, 500)) , schemeDlg(0) , autoSkip(false) , paused(false) , updated(false) , alwaysUpdate(false) { iCount++; setButtons(Ok|Cancel); setCaption(i18n("Organize Files")); setAttribute(Qt::WA_DeleteOnClose); QWidget *mainWidet = new QWidget(this); setupUi(mainWidet); setMainWidget(mainWidet); configFilename->setIcon(Icons::self()->configureIcon); setButtonGuiItem(Ok, GuiItem(i18n("Rename"), "edit-rename")); connect(this, SIGNAL(update()), MPDConnection::self(), SLOT(update())); progress->setVisible(false); files->setItemDelegate(new BasicItemDelegate(files)); files->setAlternatingRowColors(false); files->setContextMenuPolicy(Qt::ActionsContextMenu); files->setSelectionMode(QAbstractItemView::ExtendedSelection); removeAct=new Action(i18n("Remove From List"), files); removeAct->setEnabled(false); files->addAction(removeAct); connect(files, SIGNAL(itemSelectionChanged()), SLOT(controlRemoveAct())); connect(removeAct, SIGNAL(triggered()), SLOT(removeItems())); }
void Gui::RmElement(GuiElement* elem) { // has to be delayed, otherwise deleting a button during a callback would segfault for (ElList::iterator it = elements.begin(); it != elements.end(); ++it) { if ((*it).element == elem) { toBeRemoved.push_back(GuiItem(elem,true)); return; } } }
GuiItem stop() { return GuiItem(QObject::tr("&Stop"), FontAwesome::times); }
GuiItem help() { return GuiItem(i18n("&Help"), "help-contents"); }
TagEditor::TagEditor(QWidget *parent, const QList<Song> &songs, const QSet<QString> &existingArtists, const QSet<QString> &existingAlbumArtists, const QSet<QString> &existingComposers, const QSet<QString> &existingAlbums, const QSet<QString> &existingGenres, const QString &udi) : Dialog(parent, "TagEditor", QSize(500, 200)) #ifdef ENABLE_DEVICES_SUPPORT , deviceUdi(udi) #endif , currentSongIndex(-1) , updating(false) , haveArtists(false) , haveAlbumArtists(false) , haveComposers(false) , haveAlbums(false) , haveGenres(false) , saving(false) { iCount++; foreach (const Song &s, songs) { if (CueFile::isCue(s.file)) { continue; } if (s.guessed) { Song song(s); song.revertGuessedTags(); original.append(song); } else { original.append(s); } } if (original.isEmpty()) { deleteLater(); return; } #ifdef ENABLE_DEVICES_SUPPORT if (deviceUdi.isEmpty()) { baseDir=MPDConnection::self()->getDetails().dir; } else { Device *dev=getDevice(udi, parentWidget()); if (!dev) { deleteLater(); return; } baseDir=dev->path(); } #else Q_UNUSED(udi) baseDir=MPDConnection::self()->getDetails().dir; #endif qSort(original); QWidget *mainWidet = new QWidget(this); setupUi(mainWidet); track->setAllowEmpty(); disc->setAllowEmpty(); year->setAllowEmpty(); setMainWidget(mainWidet); ButtonCodes buttons=Ok|Cancel|Reset|User3; if (songs.count()>1) { buttons|=User2|User1; } setButtons(buttons); setCaption(i18n("Tags")); progress->setVisible(false); if (songs.count()>1) { setButtonGuiItem(User2, StdGuiItem::back(true)); setButtonGuiItem(User1,StdGuiItem::forward(true)); enableButton(User1, false); enableButton(User2, false); } setButtonGuiItem(Ok, StdGuiItem::save()); setButtonGuiItem(User3, GuiItem(i18n("Tools"), "tools-wizard")); QMenu *toolsMenu=new QMenu(this); toolsMenu->addAction(i18n("Apply \"Various Artists\" Workaround"), this, SLOT(applyVa())); toolsMenu->addAction(i18n("Revert \"Various Artists\" Workaround"), this, SLOT(revertVa())); toolsMenu->addAction(i18n("Set 'Album Artist' from 'Artist'"), this, SLOT(setAlbumArtistFromArtist())); toolsMenu->addAction(i18n("Capitalize"), this, SLOT(capitalise())); toolsMenu->addAction(i18n("Adjust Track Numbers"), this, SLOT(adjustTrackNumbers())); setButtonMenu(User3, toolsMenu, InstantPopup); enableButton(Ok, false); enableButton(Reset, false); setAttribute(Qt::WA_DeleteOnClose); QStringList strings=existingArtists.toList(); strings.sort(); artist->clear(); artist->insertItems(0, strings); strings=existingAlbumArtists.toList(); strings.sort(); albumArtist->clear(); albumArtist->insertItems(0, strings); strings=existingComposers.toList(); strings.sort(); composer->clear(); composer->insertItems(0, strings); strings=existingAlbums.toList(); strings.sort(); album->clear(); album->insertItems(0, strings); strings=existingGenres.toList(); strings.sort(); genre->clear(); genre->insertItems(0, strings); trackName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); trackName->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); trackName->view()->setTextElideMode(Qt::ElideLeft); if (original.count()>1) { QSet<QString> songArtists; QSet<QString> songAlbumArtists; QSet<QString> songAlbums; QSet<QString> songGenres; QSet<QString> songComposers; QSet<int> songYears; QSet<int> songDiscs; foreach (const Song &s, original) { if (!s.artist.isEmpty()) { songArtists.insert(s.artist); } if (!s.albumartist.isEmpty()) { songAlbumArtists.insert(s.albumartist); } if (!s.album.isEmpty()) { songAlbums.insert(s.album); } if (!s.genre.isEmpty()) { songGenres.insert(s.genre); } if (!s.composer.isEmpty()) { songComposers.insert(s.composer); } songYears.insert(s.year); songDiscs.insert(s.disc); if (songArtists.count()>1 && songAlbumArtists.count()>1 && songAlbums.count()>1 && songGenres.count()>1 && songYears.count()>1 && songDiscs.count()>1 && songComposers.count()>=1) { break; } } Song all; all.file.clear(); all.title.clear(); all.track=0; all.artist=1==songArtists.count() ? *(songArtists.begin()) : QString(); all.composer=1==songComposers.count() ? *(songComposers.begin()) : QString(); all.albumartist=1==songAlbumArtists.count() ? *(songAlbumArtists.begin()) : QString(); all.album=1==songAlbums.count() ? *(songAlbums.begin()) : QString(); all.genre=1==songGenres.count() ? *(songGenres.begin()) : QString(); all.year=1==songYears.count() ? *(songYears.begin()) : 0; all.disc=1==songDiscs.count() ? *(songDiscs.begin()) : 0; original.prepend(all); artist->setFocus(); haveArtists=!songArtists.isEmpty(); haveAlbumArtists=!songAlbumArtists.isEmpty(); haveAlbums=!songAlbums.isEmpty(); haveGenres=!songGenres.isEmpty(); haveComposers=!songComposers.isEmpty(); } else {
void TrackOrganiser::slotButtonClicked(int button) { switch (button) { case Ok: startRename(); break; case Cancel: if (!optionsBox->isEnabled()) { paused=true; if (MessageBox::No==MessageBox::questionYesNo(this, i18n("Abort renaming of files?"), i18n("Abort"), GuiItem(i18n("Abort")), StdGuiItem::cancel())) { paused=false; QTimer::singleShot(0, this, SLOT(renameFile())); return; } } finish(false); // Need to call this - if not, when dialog is closed by window X control, it is not deleted!!!! Dialog::slotButtonClicked(button); break; default: break; } }
GuiItem stop() { return GuiItem(i18n("&Stop"), "process-stop"); }
GuiItem back(bool useRtl) { return GuiItem(i18n("&Previous"), useRtl && QApplication::isRightToLeft() ? "go-next" : "go-previous"); }
GuiItem cancel() { return GuiItem(i18n("&Cancel"), "dialog-cancel"); }
GuiItem cont() { return GuiItem(i18n("&Continue"), "arrow-right"); }
GuiItem cont() { return GuiItem(QObject::tr("&Continue"), FontAwesome::arrowright); }
GuiItem ok() { return GuiItem(i18n("&OK"), "dialog-ok"); }
GuiItem forward(bool useRtl) { return GuiItem(QObject::tr("&Next"), useRtl && QApplication::isRightToLeft() ? FontAwesome::chevronleft : FontAwesome::chevronright); }
GuiItem back(bool useRtl) { return GuiItem(QObject::tr("&Previous"), useRtl && QApplication::isRightToLeft() ? FontAwesome::chevronright : FontAwesome::chevronleft); }
GuiItem remove() { return GuiItem(QObject::tr("&Remove"), FontAwesome::remove); }
GuiItem overwrite() { return GuiItem(i18n("&Overwrite")); }
GuiItem yes() { return GuiItem(i18n("&Yes"), "dialog-ok"); }
GuiItem reset() { return GuiItem(i18n("&Reset"), "edit-undo"); }
GuiItem no() { return GuiItem(i18n("&No"), "process-stop"); }
GuiItem del() { return GuiItem(i18n("&Delete"), "edit-delete"); }
GuiItem discard() { return GuiItem(i18n("&Discard"), "edit-clear"); }
GuiItem remove() { return GuiItem(i18n("&Remove"), "list-remove"); }
GuiItem save() { return GuiItem(i18n("&Save"), "document-save"); }
GuiItem forward(bool useRtl) { return GuiItem(i18n("&Next"), useRtl && QApplication::isRightToLeft() ? "go-previous" : "go-next"); }
GuiItem reset() { return GuiItem(QObject::tr("&Reset"), FontAwesome::undo); }
RgDialog::RgDialog(QWidget *parent) : SongDialog(parent, "RgDialog", QSize(800, 400)) , state(State_Idle) , totalToScan(0) , tagReader(0) , autoScanTags(false) { iCount++; setButtons(User1|Ok|Cancel); setCaption(i18n("ReplayGain")); setAttribute(Qt::WA_DeleteOnClose); QWidget *mainWidget = new QWidget(this); QBoxLayout *layout=new QBoxLayout(QBoxLayout::TopToBottom, mainWidget); combo = new QComboBox(this); view = new QTreeWidget(this); statusLabel = new QLabel(this); statusLabel->setVisible(false); progress = new QProgressBar(this); progress->setVisible(false); combo->addItem(i18n("Show All Tracks"), true); combo->addItem(i18n("Show Untagged Tracks"), false); view->setRootIsDecorated(false); view->setAllColumnsShowFocus(true); view->setItemDelegate(new BasicItemDelegate(view)); view->setAlternatingRowColors(false); view->setContextMenuPolicy(Qt::ActionsContextMenu); view->setSelectionMode(QAbstractItemView::ExtendedSelection); removeAct=new Action(i18n("Remove From List"), view); removeAct->setEnabled(false); view->addAction(removeAct); QTreeWidgetItem *hdr = view->headerItem(); hdr->setText(COL_ARTIST, i18n("Artist")); hdr->setText(COL_ALBUM, i18n("Album")); hdr->setText(COL_TITLE, i18n("Title")); hdr->setText(COL_ALBUMGAIN, i18n("Album Gain")); hdr->setText(COL_TRACKGAIN, i18n("Track Gain")); hdr->setText(COL_ALBUMPEAK, i18n("Album Peak")); hdr->setText(COL_TRACKPEAK, i18n("Track Peak")); QHeaderView *hv=view->header(); setResizeMode(hv, COL_ARTIST, QHeaderView::ResizeToContents); setResizeMode(hv, COL_ALBUM, QHeaderView::ResizeToContents); setResizeMode(hv, COL_TITLE, QHeaderView::Stretch); setResizeMode(hv, COL_ALBUMGAIN, QHeaderView::Fixed); setResizeMode(hv, COL_TRACKGAIN, QHeaderView::Fixed); setResizeMode(hv, COL_ALBUMPEAK, QHeaderView::Fixed); setResizeMode(hv, COL_TRACKPEAK, QHeaderView::Fixed); hv->setStretchLastSection(false); layout->setMargin(0); layout->addWidget(combo); layout->addWidget(view); layout->addWidget(statusLabel); layout->addWidget(progress); setMainWidget(mainWidget); setButtonGuiItem(Ok, StdGuiItem::save()); setButtonGuiItem(Cancel, StdGuiItem::close()); setButtonGuiItem(User1, GuiItem(i18n("Scan"), "edit-find")); enableButton(Ok, false); enableButton(User1, false); qRegisterMetaType<Tags::ReplayGain>("Tags::ReplayGain"); connect(combo, SIGNAL(currentIndexChanged(int)), SLOT(toggleDisplay())); connect(view, SIGNAL(itemSelectionChanged()), SLOT(controlRemoveAct())); connect(removeAct, SIGNAL(triggered()), SLOT(removeItems())); italic=font(); italic.setItalic(true); JobController::self()->setMaxActive(1); }
GuiItem close() { return GuiItem(i18n("&Close"), "window-close"); }
GuiItem apply() { return GuiItem(i18n("&Apply"), "dialog-ok-apply"); }
GuiItem del() { return GuiItem(QObject::tr("&Delete"), FontAwesome::trash, true); }