mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-18 20:34:39 +01:00
Save playlist' id instead of tab's id in favorite widget, so we don't have to update it when tab are moved
This commit is contained in:
parent
e9f14d9f8a
commit
94a70d61b9
@ -78,7 +78,6 @@ PlaylistBackend::PlaylistList PlaylistBackend::GetPlaylists(GetPlaylistsFlags fl
|
||||
condition = " WHERE " + condition_list.join(" OR ");
|
||||
}
|
||||
|
||||
|
||||
QSqlQuery q("SELECT ROWID, name, last_played, dynamic_playlist_type,"
|
||||
" dynamic_playlist_data, dynamic_playlist_backend,"
|
||||
" special_type, ui_path, is_favorite"
|
||||
|
@ -194,6 +194,8 @@ void PlaylistManager::Rename(int id, const QString& new_name) {
|
||||
}
|
||||
|
||||
void PlaylistManager::Favorite(int id, bool favorite) {
|
||||
Q_ASSERT(playlists_.contains(id));
|
||||
|
||||
playlist_backend_->FavoritePlaylist(id, favorite);
|
||||
playlists_[id].p->set_favorite(favorite);
|
||||
emit PlaylistFavorited(id, favorite);
|
||||
|
@ -232,8 +232,9 @@ void PlaylistTabBar::InsertTab(int id, int index, const QString& text, bool favo
|
||||
insertTab(index, text);
|
||||
setTabData(index, id);
|
||||
setTabToolTip(index, text);
|
||||
FavoriteWidget* widget = new FavoriteWidget(index, favorite);
|
||||
connect(widget, SIGNAL(FavoriteStateChanged(int, bool)), SLOT(TabFavorited(int, bool)));
|
||||
FavoriteWidget* widget = new FavoriteWidget(id, favorite);
|
||||
connect(widget, SIGNAL(FavoriteStateChanged(int, bool)),
|
||||
SIGNAL(PlaylistFavorited(int, bool)));
|
||||
setTabButton(index, QTabBar::LeftSide, widget);
|
||||
suppress_current_changed_ = false;
|
||||
|
||||
@ -252,10 +253,6 @@ void PlaylistTabBar::TabMoved() {
|
||||
emit PlaylistOrderChanged(ids);
|
||||
}
|
||||
|
||||
void PlaylistTabBar::TabFavorited(int index, bool favorite) {
|
||||
emit PlaylistFavorited(tabData(index).toInt(), favorite);
|
||||
}
|
||||
|
||||
void PlaylistTabBar::dragEnterEvent(QDragEnterEvent* e) {
|
||||
if (e->mimeData()->hasUrls() ||
|
||||
e->mimeData()->hasFormat(Playlist::kRowsMimetype) ||
|
||||
|
@ -42,7 +42,7 @@ class FavoriteWidget : public QWidget {
|
||||
private:
|
||||
static const int kStarSize;
|
||||
|
||||
// The tab's id this widget belongs to
|
||||
// The playlist's id this widget belongs to
|
||||
int tab_index_;
|
||||
bool favorite_;
|
||||
QPixmap on_;
|
||||
|
Loading…
Reference in New Issue
Block a user