More code fixes to mainwindow
This commit is contained in:
@@ -1129,7 +1129,7 @@ void MainWindow::MediaPlaying() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::VolumeChanged(int volume) {
|
void MainWindow::VolumeChanged(const int volume) {
|
||||||
ui_->action_mute->setChecked(!volume);
|
ui_->action_mute->setChecked(!volume);
|
||||||
if (tray_icon_) tray_icon_->MuteButtonStateChanged(!volume);
|
if (tray_icon_) tray_icon_->MuteButtonStateChanged(!volume);
|
||||||
}
|
}
|
||||||
@@ -1298,7 +1298,7 @@ void MainWindow::PlaylistDoubleClick(const QModelIndex &index) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::VolumeWheelEvent(int delta) {
|
void MainWindow::VolumeWheelEvent(const int delta) {
|
||||||
ui_->volume->setValue(ui_->volume->value() + delta / 30);
|
ui_->volume->setValue(ui_->volume->value() + delta / 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1352,7 +1352,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::SetHiddenInTray(bool hidden) {
|
void MainWindow::SetHiddenInTray(const bool hidden) {
|
||||||
|
|
||||||
settings_.setValue("hidden", hidden);
|
settings_.setValue("hidden", hidden);
|
||||||
|
|
||||||
@@ -1488,26 +1488,26 @@ void MainWindow::AddToPlaylist(QMimeData *data) {
|
|||||||
|
|
||||||
void MainWindow::AddToPlaylist(QAction *action) {
|
void MainWindow::AddToPlaylist(QAction *action) {
|
||||||
|
|
||||||
int destination = action->data().toInt();
|
const int destination = action->data().toInt();
|
||||||
PlaylistItemList items;
|
PlaylistItemList items;
|
||||||
|
SongList songs;
|
||||||
|
|
||||||
// Get the selected playlist items
|
// Get the selected playlist items
|
||||||
for (const QModelIndex &index : ui_->playlist->view()->selectionModel()->selection().indexes()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selection().indexes()) {
|
||||||
if (index.column() != 0) continue;
|
if (proxy_index.column() != 0) continue;
|
||||||
int row = app_->playlist_manager()->current()->proxy()->mapToSource(index).row();
|
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
||||||
items << app_->playlist_manager()->current()->item_at(row);
|
if (!source_index.isValid()) continue;
|
||||||
}
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
|
if (!item) continue;
|
||||||
SongList songs;
|
items << item;
|
||||||
for (const PlaylistItemPtr item : items) {
|
|
||||||
songs << item->Metadata();
|
songs << item->Metadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're creating a new playlist
|
// We're creating a new playlist
|
||||||
if (destination == -1) {
|
if (destination == -1) {
|
||||||
// Save the current playlist to reactivate it
|
// Save the current playlist to reactivate it
|
||||||
int current_id = app_->playlist_manager()->current_id();
|
const int current_id = app_->playlist_manager()->current_id();
|
||||||
// get the name from selection
|
// Get the name from selection
|
||||||
app_->playlist_manager()->New(app_->playlist_manager()->GetNameForNewPlaylist(songs));
|
app_->playlist_manager()->New(app_->playlist_manager()->GetNameForNewPlaylist(songs));
|
||||||
if (app_->playlist_manager()->current()->id() != current_id) {
|
if (app_->playlist_manager()->current()->id() != current_id) {
|
||||||
// I'm sure the new playlist was created and is selected, so I can just insert items
|
// I'm sure the new playlist was created and is selected, so I can just insert items
|
||||||
@@ -1738,6 +1738,7 @@ void MainWindow::PlaylistRightClick(const QPoint &global_pos, const QModelIndex
|
|||||||
connect(add_to_another_menu, SIGNAL(triggered(QAction*)), SLOT(AddToPlaylist(QAction*)));
|
connect(add_to_another_menu, SIGNAL(triggered(QAction*)), SLOT(AddToPlaylist(QAction*)));
|
||||||
|
|
||||||
playlist_menu_->popup(global_pos);
|
playlist_menu_->popup(global_pos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::PlaylistPlay() {
|
void MainWindow::PlaylistPlay() {
|
||||||
@@ -1759,14 +1760,13 @@ void MainWindow::RescanSongs() {
|
|||||||
|
|
||||||
SongList songs;
|
SongList songs;
|
||||||
|
|
||||||
for (const QModelIndex& index : ui_->playlist->view()->selectionModel()->selection().indexes()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selection().indexes()) {
|
||||||
if (index.column() != 0) continue;
|
if (proxy_index.column() != 0) continue;
|
||||||
const int row = app_->playlist_manager()->current()->proxy()->mapToSource(index).row();
|
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
||||||
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(row));
|
if (!source_index.isValid()) continue;
|
||||||
if (!item) continue;
|
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(source_index.row()));
|
||||||
Song song = item->Metadata();
|
if (!item || !item->IsLocalCollectionItem()) continue;
|
||||||
if (!song.is_valid() || song.source() != Song::Source_Collection) continue;
|
songs << item->Metadata();
|
||||||
songs << song;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (songs.isEmpty()) return;
|
if (songs.isEmpty()) return;
|
||||||
@@ -1780,12 +1780,11 @@ void MainWindow::EditTracks() {
|
|||||||
SongList songs;
|
SongList songs;
|
||||||
PlaylistItemList items;
|
PlaylistItemList items;
|
||||||
|
|
||||||
for (const QModelIndex &idx : ui_->playlist->view()->selectionModel()->selection().indexes()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selection().indexes()) {
|
||||||
if (idx.column() != 0) continue;
|
if (proxy_index.column() != 0) continue;
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(idx);
|
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
||||||
if (!source_index.isValid()) continue;
|
if (!source_index.isValid()) continue;
|
||||||
const int row = source_index.row();
|
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(source_index.row()));
|
||||||
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(row));
|
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
Song song = item->Metadata();
|
Song song = item->Metadata();
|
||||||
if (song.IsEditable()) {
|
if (song.IsEditable()) {
|
||||||
@@ -1807,7 +1806,7 @@ void MainWindow::EditTagDialogAccepted() {
|
|||||||
item->Reload();
|
item->Reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is really lame but we don't know what rows have changed
|
// FIXME: This is really lame but we don't know what rows have changed.
|
||||||
ui_->playlist->view()->update();
|
ui_->playlist->view()->update();
|
||||||
|
|
||||||
app_->playlist_manager()->current()->Save();
|
app_->playlist_manager()->current()->Save();
|
||||||
@@ -1825,25 +1824,22 @@ void MainWindow::RenumberTracks() {
|
|||||||
// if first selected song has a track number set, start from that offset
|
// if first selected song has a track number set, start from that offset
|
||||||
if (!indexes.isEmpty()) {
|
if (!indexes.isEmpty()) {
|
||||||
const Song first_song = app_->playlist_manager()->current()->item_at(indexes[0].row())->Metadata();
|
const Song first_song = app_->playlist_manager()->current()->item_at(indexes[0].row())->Metadata();
|
||||||
|
|
||||||
if (first_song.track() > 0) track = first_song.track();
|
if (first_song.track() > 0) track = first_song.track();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const QModelIndex &index : indexes) {
|
for (const QModelIndex &proxy_index : indexes) {
|
||||||
if (index.column() != 0) continue;
|
if (proxy_index.column() != 0) continue;
|
||||||
|
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(index);
|
if (!source_index.isValid()) continue;
|
||||||
const int row = source_index.row();
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
Song song = app_->playlist_manager()->current()->item_at(row)->Metadata();
|
if (!item) continue;
|
||||||
|
Song song = item->Metadata();
|
||||||
if (song.IsEditable()) {
|
if (song.IsEditable()) {
|
||||||
song.set_track(track);
|
song.set_track(track);
|
||||||
|
|
||||||
TagReaderReply *reply = TagReaderClient::Instance()->SaveFile(song.url().toLocalFile(), song);
|
TagReaderReply *reply = TagReaderClient::Instance()->SaveFile(song.url().toLocalFile(), song);
|
||||||
|
|
||||||
NewClosure(reply, SIGNAL(Finished(bool)), this, SLOT(SongSaveComplete(TagReaderReply*, QPersistentModelIndex)),reply, QPersistentModelIndex(source_index));
|
NewClosure(reply, SIGNAL(Finished(bool)), this, SLOT(SongSaveComplete(TagReaderReply*, QPersistentModelIndex)),reply, QPersistentModelIndex(source_index));
|
||||||
}
|
}
|
||||||
track++;
|
++track;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1862,18 +1858,16 @@ void MainWindow::SelectionSetValue() {
|
|||||||
Playlist::Column column = (Playlist::Column)playlist_menu_index_.column();
|
Playlist::Column column = (Playlist::Column)playlist_menu_index_.column();
|
||||||
QVariant column_value = app_->playlist_manager()->current()->data(playlist_menu_index_);
|
QVariant column_value = app_->playlist_manager()->current()->data(playlist_menu_index_);
|
||||||
|
|
||||||
QModelIndexList indexes = ui_->playlist->view()->selectionModel()->selection().indexes();
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selection().indexes()) {
|
||||||
|
if (proxy_index.column() != 0) continue;
|
||||||
for (const QModelIndex &index : indexes) {
|
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
||||||
if (index.column() != 0) continue;
|
if (!source_index.isValid()) continue;
|
||||||
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(index);
|
if (!item) continue;
|
||||||
const int row = source_index.row();
|
Song song = item->Metadata();
|
||||||
Song song = app_->playlist_manager()->current()->item_at(row)->Metadata();
|
if (!song.is_valid() || !song.url().isLocalFile()) continue;
|
||||||
|
|
||||||
if (Playlist::set_column_value(song, column, column_value)) {
|
if (Playlist::set_column_value(song, column, column_value)) {
|
||||||
TagReaderReply *reply = TagReaderClient::Instance()->SaveFile(song.url().toLocalFile(), song);
|
TagReaderReply *reply = TagReaderClient::Instance()->SaveFile(song.url().toLocalFile(), song);
|
||||||
|
|
||||||
NewClosure(reply, SIGNAL(Finished(bool)), this, SLOT(SongSaveComplete(TagReaderReply*, QPersistentModelIndex)), reply, QPersistentModelIndex(source_index));
|
NewClosure(reply, SIGNAL(Finished(bool)), this, SLOT(SongSaveComplete(TagReaderReply*, QPersistentModelIndex)), reply, QPersistentModelIndex(source_index));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1883,7 +1877,6 @@ void MainWindow::SelectionSetValue() {
|
|||||||
void MainWindow::EditValue() {
|
void MainWindow::EditValue() {
|
||||||
|
|
||||||
QModelIndex current = ui_->playlist->view()->currentIndex();
|
QModelIndex current = ui_->playlist->view()->currentIndex();
|
||||||
|
|
||||||
if (!current.isValid()) return;
|
if (!current.isValid()) return;
|
||||||
|
|
||||||
// Edit the last column that was right-clicked on. If nothing's ever been right clicked then look for the first editable column.
|
// Edit the last column that was right-clicked on. If nothing's ever been right clicked then look for the first editable column.
|
||||||
@@ -1934,7 +1927,7 @@ void MainWindow::AddFolder() {
|
|||||||
QString directory =settings_.value("add_folder_path", QDir::currentPath()).toString();
|
QString directory =settings_.value("add_folder_path", QDir::currentPath()).toString();
|
||||||
|
|
||||||
// Show dialog
|
// Show dialog
|
||||||
directory =QFileDialog::getExistingDirectory(this, tr("Add folder"), directory);
|
directory = QFileDialog::getExistingDirectory(this, tr("Add folder"), directory);
|
||||||
if (directory.isEmpty()) return;
|
if (directory.isEmpty()) return;
|
||||||
|
|
||||||
// Save last used directory
|
// Save last used directory
|
||||||
@@ -1960,13 +1953,14 @@ void MainWindow::AddCDTracks() {
|
|||||||
void MainWindow::ShowInCollection() {
|
void MainWindow::ShowInCollection() {
|
||||||
|
|
||||||
// Show the first valid selected track artist/album in CollectionView
|
// Show the first valid selected track artist/album in CollectionView
|
||||||
QModelIndexList proxy_indexes =ui_->playlist->view()->selectionModel()->selectedRows();
|
|
||||||
SongList songs;
|
|
||||||
|
|
||||||
for (const QModelIndex &proxy_index : proxy_indexes) {
|
SongList songs;
|
||||||
QModelIndex index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
if (app_->playlist_manager()->current()->item_at(index.row())->IsLocalCollectionItem()) {
|
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
||||||
songs << app_->playlist_manager()->current()->item_at(index.row())->Metadata();
|
if (!source_index.isValid()) continue;
|
||||||
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
|
if (item && item->IsLocalCollectionItem()) {
|
||||||
|
songs << item->Metadata();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2102,7 +2096,7 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions &options) {
|
|||||||
app_->player()->SeekTo(options.seek_to());
|
app_->player()->SeekTo(options.seek_to());
|
||||||
}
|
}
|
||||||
else if (options.seek_by() != 0) {
|
else if (options.seek_by() != 0) {
|
||||||
app_->player()->SeekTo(app_->player()->engine()->position_nanosec() /kNsecPerSec +options.seek_by());
|
app_->player()->SeekTo(app_->player()->engine()->position_nanosec() / kNsecPerSec + options.seek_by());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.play_track_at() != -1) app_->player()->PlayAt(options.play_track_at(), Engine::Manual, true);
|
if (options.play_track_at() != -1) app_->player()->PlayAt(options.play_track_at(), Engine::Manual, true);
|
||||||
@@ -2158,13 +2152,14 @@ void MainWindow::AddFilesToTranscoder() {
|
|||||||
|
|
||||||
QStringList filenames;
|
QStringList filenames;
|
||||||
|
|
||||||
for (const QModelIndex &index : ui_->playlist->view()->selectionModel()->selection().indexes()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selection().indexes()) {
|
||||||
if (index.column() != 0) continue;
|
if (proxy_index.column() != 0) continue;
|
||||||
const int row = app_->playlist_manager()->current()->proxy()->mapToSource(index).row();
|
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
||||||
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(row));
|
if (!source_index.isValid()) continue;
|
||||||
|
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(source_index.row()));
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
Song song = item->Metadata();
|
Song song = item->Metadata();
|
||||||
if (!song.is_valid()) continue;
|
if (!song.is_valid() || !song.url().isLocalFile()) continue;
|
||||||
filenames << song.url().toLocalFile();
|
filenames << song.url().toLocalFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2182,7 +2177,7 @@ void MainWindow::ShowCollectionConfig() {
|
|||||||
settings_dialog_->OpenAtPage(SettingsDialog::Page_Collection);
|
settings_dialog_->OpenAtPage(SettingsDialog::Page_Collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::TaskCountChanged(int count) {
|
void MainWindow::TaskCountChanged(const int count) {
|
||||||
|
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
ui_->status_bar_stack->setCurrentWidget(ui_->playlist_summary_page);
|
ui_->status_bar_stack->setCurrentWidget(ui_->playlist_summary_page);
|
||||||
@@ -2193,7 +2188,7 @@ void MainWindow::TaskCountChanged(int count) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::PlayingWidgetPositionChanged(bool above_status_bar) {
|
void MainWindow::PlayingWidgetPositionChanged(const bool above_status_bar) {
|
||||||
|
|
||||||
if (above_status_bar) ui_->status_bar->setParent(ui_->centralWidget);
|
if (above_status_bar) ui_->status_bar->setParent(ui_->centralWidget);
|
||||||
else ui_->status_bar->setParent(ui_->player_controls_container);
|
else ui_->status_bar->setParent(ui_->player_controls_container);
|
||||||
@@ -2263,14 +2258,15 @@ void MainWindow::PlaylistMoveToCollection() {
|
|||||||
|
|
||||||
void MainWindow::PlaylistOrganiseSelected(const bool copy) {
|
void MainWindow::PlaylistOrganiseSelected(const bool copy) {
|
||||||
|
|
||||||
QModelIndexList proxy_indexes = ui_->playlist->view()->selectionModel()->selectedRows();
|
|
||||||
SongList songs;
|
SongList songs;
|
||||||
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
for (const QModelIndex &proxy_index : proxy_indexes) {
|
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
||||||
QModelIndex index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
if (!source_index.isValid()) continue;
|
||||||
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(index.row());
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
songs << item->Metadata();
|
Song song = item->Metadata();
|
||||||
|
if (!song.is_valid() || !song.url().isLocalFile()) continue;
|
||||||
|
songs << song;
|
||||||
}
|
}
|
||||||
if (songs.isEmpty()) return;
|
if (songs.isEmpty()) return;
|
||||||
|
|
||||||
@@ -2284,11 +2280,10 @@ void MainWindow::PlaylistOrganiseSelected(const bool copy) {
|
|||||||
void MainWindow::PlaylistOpenInBrowser() {
|
void MainWindow::PlaylistOpenInBrowser() {
|
||||||
|
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
QModelIndexList proxy_indexes = ui_->playlist->view()->selectionModel()->selectedRows();
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
|
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
||||||
for (const QModelIndex &proxy_index : proxy_indexes) {
|
if (!source_index.isValid()) continue;
|
||||||
const QModelIndex index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
urls << QUrl(source_index.sibling(source_index.row(), Playlist::Column_Filename).data().toString());
|
||||||
urls << QUrl(index.sibling(index.row(), Playlist::Column_Filename).data().toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Utilities::OpenInFileBrowser(urls);
|
Utilities::OpenInFileBrowser(urls);
|
||||||
@@ -2332,15 +2327,16 @@ void MainWindow::PlaylistSkip() {
|
|||||||
void MainWindow::PlaylistCopyToDevice() {
|
void MainWindow::PlaylistCopyToDevice() {
|
||||||
|
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
QModelIndexList proxy_indexes = ui_->playlist->view()->selectionModel()->selectedRows();
|
|
||||||
SongList songs;
|
SongList songs;
|
||||||
|
|
||||||
for (const QModelIndex &proxy_index : proxy_indexes) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
||||||
|
if (!source_index.isValid()) continue;
|
||||||
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
Song song = item->Metadata();
|
Song song = item->Metadata();
|
||||||
if (!song.is_valid()) continue;
|
if (!song.is_valid() || !song.url().isLocalFile()) continue;
|
||||||
songs << song;
|
songs << song;
|
||||||
}
|
}
|
||||||
if (songs.isEmpty()) return;
|
if (songs.isEmpty()) return;
|
||||||
@@ -2352,6 +2348,7 @@ void MainWindow::PlaylistCopyToDevice() {
|
|||||||
else {
|
else {
|
||||||
QMessageBox::warning(this, tr("Error"), tr("None of the selected songs were suitable for copying to a device"));
|
QMessageBox::warning(this, tr("Error"), tr("None of the selected songs were suitable for copying to a device"));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2441,9 +2438,8 @@ void MainWindow::CheckFullRescanRevisions() {
|
|||||||
|
|
||||||
// Collect all reasons
|
// Collect all reasons
|
||||||
QSet<QString> reasons;
|
QSet<QString> reasons;
|
||||||
for (int i = from; i <= to; i++) {
|
for (int i = from ; i <= to ; ++i) {
|
||||||
QString reason = app_->collection()->full_rescan_reason(i);
|
QString reason = app_->collection()->full_rescan_reason(i);
|
||||||
|
|
||||||
if (!reason.isEmpty()) {
|
if (!reason.isEmpty()) {
|
||||||
reasons.insert(reason);
|
reasons.insert(reason);
|
||||||
}
|
}
|
||||||
@@ -2456,7 +2452,6 @@ void MainWindow::CheckFullRescanRevisions() {
|
|||||||
message += ("<li>" + reason + "</li>");
|
message += ("<li>" + reason + "</li>");
|
||||||
}
|
}
|
||||||
message += "</ul>" + tr("Would you like to run a full rescan right now?");
|
message += "</ul>" + tr("Would you like to run a full rescan right now?");
|
||||||
|
|
||||||
if (QMessageBox::question(this, tr("Collection rescan notice"), message, QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
|
if (QMessageBox::question(this, tr("Collection rescan notice"), message, QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) {
|
||||||
app_->collection()->FullScan();
|
app_->collection()->FullScan();
|
||||||
}
|
}
|
||||||
@@ -2504,6 +2499,8 @@ void MainWindow::AutoCompleteTags() {
|
|||||||
|
|
||||||
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
|
#if defined(HAVE_GSTREAMER) && defined(HAVE_CHROMAPRINT)
|
||||||
|
|
||||||
|
autocomplete_tag_items_.clear();
|
||||||
|
|
||||||
// Create the tag fetching stuff if it hasn't been already
|
// Create the tag fetching stuff if it hasn't been already
|
||||||
if (!tag_fetcher_) {
|
if (!tag_fetcher_) {
|
||||||
tag_fetcher_.reset(new TagFetcher);
|
tag_fetcher_.reset(new TagFetcher);
|
||||||
@@ -2519,12 +2516,11 @@ void MainWindow::AutoCompleteTags() {
|
|||||||
|
|
||||||
// Get the selected songs and start fetching tags for them
|
// Get the selected songs and start fetching tags for them
|
||||||
SongList songs;
|
SongList songs;
|
||||||
autocomplete_tag_items_.clear();
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selection().indexes()) {
|
||||||
for (const QModelIndex &index : ui_->playlist->view()->selectionModel()->selection().indexes()) {
|
if (proxy_index.column() != 0) continue;
|
||||||
if (index.column() != 0) continue;
|
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
||||||
const QModelIndex &source_index = app_->playlist_manager()->current()->proxy()->mapToSource(index);
|
if (!source_index.isValid()) continue;
|
||||||
const int row = source_index.row();
|
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(source_index.row()));
|
||||||
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(row));
|
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
Song song = item->Metadata();
|
Song song = item->Metadata();
|
||||||
if (song.IsEditable()) {
|
if (song.IsEditable()) {
|
||||||
@@ -2537,7 +2533,6 @@ void MainWindow::AutoCompleteTags() {
|
|||||||
|
|
||||||
track_selection_dialog_->Init(songs);
|
track_selection_dialog_->Init(songs);
|
||||||
tag_fetcher_->StartFetch(songs);
|
tag_fetcher_->StartFetch(songs);
|
||||||
|
|
||||||
track_selection_dialog_->show();
|
track_selection_dialog_->show();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -2666,11 +2661,11 @@ void MainWindow::GetCoverAutomatically() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ScrobblingEnabledChanged(bool value) {
|
void MainWindow::ScrobblingEnabledChanged(const bool value) {
|
||||||
if (app_->scrobbler()->ScrobbleButton()) SetToggleScrobblingIcon(value);
|
if (app_->scrobbler()->ScrobbleButton()) SetToggleScrobblingIcon(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ScrobbleButtonVisibilityChanged(bool value) {
|
void MainWindow::ScrobbleButtonVisibilityChanged(const bool value) {
|
||||||
|
|
||||||
ui_->button_scrobble->setVisible(value);
|
ui_->button_scrobble->setVisible(value);
|
||||||
ui_->action_toggle_scrobbling->setVisible(value);
|
ui_->action_toggle_scrobbling->setVisible(value);
|
||||||
@@ -2678,7 +2673,7 @@ void MainWindow::ScrobbleButtonVisibilityChanged(bool value) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::LoveButtonVisibilityChanged(bool value) {
|
void MainWindow::LoveButtonVisibilityChanged(const bool value) {
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
ui_->widget_love->show();
|
ui_->widget_love->show();
|
||||||
@@ -2689,7 +2684,7 @@ void MainWindow::LoveButtonVisibilityChanged(bool value) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::SetToggleScrobblingIcon(bool value) {
|
void MainWindow::SetToggleScrobblingIcon(const bool value) {
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (app_->playlist_manager()->active()->scrobbled())
|
if (app_->playlist_manager()->active()->scrobbled())
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
Startup_AlwaysHide = 3,
|
Startup_AlwaysHide = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetHiddenInTray(bool hidden);
|
void SetHiddenInTray(const bool hidden);
|
||||||
void CommandlineOptionsReceived(const CommandlineOptions& options);
|
void CommandlineOptionsReceived(const CommandlineOptions& options);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -182,7 +182,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
void StopAfterCurrent();
|
void StopAfterCurrent();
|
||||||
|
|
||||||
void SongChanged(const Song& song);
|
void SongChanged(const Song& song);
|
||||||
void VolumeChanged(int volume);
|
void VolumeChanged(const int volume);
|
||||||
|
|
||||||
void CopyFilesToCollection(const QList<QUrl>& urls);
|
void CopyFilesToCollection(const QList<QUrl>& urls);
|
||||||
void MoveFilesToCollection(const QList<QUrl>& urls);
|
void MoveFilesToCollection(const QList<QUrl>& urls);
|
||||||
@@ -192,14 +192,14 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
void AddToPlaylist(QMimeData *data);
|
void AddToPlaylist(QMimeData *data);
|
||||||
void AddToPlaylist(QAction *action);
|
void AddToPlaylist(QAction *action);
|
||||||
|
|
||||||
void VolumeWheelEvent(int delta);
|
void VolumeWheelEvent(const int delta);
|
||||||
void ToggleShowHide();
|
void ToggleShowHide();
|
||||||
|
|
||||||
void Seeked(qlonglong microseconds);
|
void Seeked(const qlonglong microseconds);
|
||||||
void UpdateTrackPosition();
|
void UpdateTrackPosition();
|
||||||
void UpdateTrackSliderPosition();
|
void UpdateTrackSliderPosition();
|
||||||
|
|
||||||
void TaskCountChanged(int count);
|
void TaskCountChanged(const int count);
|
||||||
|
|
||||||
void ShowCollectionConfig();
|
void ShowCollectionConfig();
|
||||||
void ReloadSettings();
|
void ReloadSettings();
|
||||||
@@ -215,7 +215,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
|
|
||||||
void CheckForUpdates();
|
void CheckForUpdates();
|
||||||
|
|
||||||
void PlayingWidgetPositionChanged(bool above_status_bar);
|
void PlayingWidgetPositionChanged(const bool above_status_bar);
|
||||||
|
|
||||||
void SongSaveComplete(TagReaderReply *reply, const QPersistentModelIndex& index);
|
void SongSaveComplete(TagReaderReply *reply, const QPersistentModelIndex& index);
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
void Exit();
|
void Exit();
|
||||||
void DoExit();
|
void DoExit();
|
||||||
|
|
||||||
void HandleNotificationPreview(OSD::Behaviour type, QString line1, QString line2);
|
void HandleNotificationPreview(const OSD::Behaviour type, QString line1, QString line2);
|
||||||
|
|
||||||
void ShowConsole();
|
void ShowConsole();
|
||||||
|
|
||||||
@@ -253,9 +253,9 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
void SearchCoverAutomatically();
|
void SearchCoverAutomatically();
|
||||||
void AlbumCoverLoaded(const Song &song, const QUrl &cover_url, const QImage &image);
|
void AlbumCoverLoaded(const Song &song, const QUrl &cover_url, const QImage &image);
|
||||||
|
|
||||||
void ScrobblingEnabledChanged(bool value);
|
void ScrobblingEnabledChanged(const bool value);
|
||||||
void ScrobbleButtonVisibilityChanged(bool value);
|
void ScrobbleButtonVisibilityChanged(const bool value);
|
||||||
void LoveButtonVisibilityChanged(bool value);
|
void LoveButtonVisibilityChanged(const bool value);
|
||||||
void Love();
|
void Love();
|
||||||
|
|
||||||
void ExitFinished();
|
void ExitFinished();
|
||||||
@@ -270,11 +270,11 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
void CheckFullRescanRevisions();
|
void CheckFullRescanRevisions();
|
||||||
|
|
||||||
// creates the icon by painting the full one depending on the current position
|
// creates the icon by painting the full one depending on the current position
|
||||||
QPixmap CreateOverlayedIcon(int position, int scrobble_point);
|
QPixmap CreateOverlayedIcon(const int position, const int scrobble_point);
|
||||||
|
|
||||||
void GetCoverAutomatically();
|
void GetCoverAutomatically();
|
||||||
|
|
||||||
void SetToggleScrobblingIcon(bool value);
|
void SetToggleScrobblingIcon(const bool value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_MainWindow *ui_;
|
Ui_MainWindow *ui_;
|
||||||
|
|||||||
Reference in New Issue
Block a user