mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-31 19:45:31 +01:00
Merge branch 'master' of https://code.google.com/p/clementine-player
This commit is contained in:
commit
3dff73965e
@ -15,7 +15,6 @@
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "playlist.h"
|
||||
#include "playlistbackend.h"
|
||||
#include "playlistcontainer.h"
|
||||
#include "playlistmanager.h"
|
||||
@ -34,6 +33,7 @@
|
||||
#include <QFileInfo>
|
||||
#include <QFuture>
|
||||
#include <QFutureWatcher>
|
||||
#include <QMessageBox>
|
||||
#include <QtDebug>
|
||||
|
||||
using smart_playlists::GeneratorPtr;
|
||||
@ -293,7 +293,6 @@ bool PlaylistManager::Close(int id) {
|
||||
emit PlaylistClosed(id);
|
||||
|
||||
if (!data.p->is_favorite()) {
|
||||
// TODO: should we warn the user this action cannot be undone?
|
||||
playlist_backend_->RemovePlaylist(id);
|
||||
emit PlaylistDeleted(id);
|
||||
}
|
||||
|
@ -25,11 +25,11 @@
|
||||
#include <QSettings>
|
||||
|
||||
#include "core/song.h"
|
||||
#include "playlist.h"
|
||||
#include "smartplaylists/generator_fwd.h"
|
||||
|
||||
class Application;
|
||||
class LibraryBackend;
|
||||
class Playlist;
|
||||
class PlaylistBackend;
|
||||
class PlaylistContainer;
|
||||
class PlaylistParser;
|
||||
@ -162,6 +162,7 @@ public:
|
||||
QItemSelection active_selection() const { return selection(active_id()); }
|
||||
|
||||
QString GetPlaylistName(int index) const { return playlists_[index].name; }
|
||||
bool IsPlaylistFavorite(int index) const { return playlists_[index].p->is_favorite(); }
|
||||
|
||||
void Init(LibraryBackend* library_backend, PlaylistBackend* playlist_backend,
|
||||
PlaylistSequence* sequence, PlaylistContainer* playlist_container);
|
||||
|
@ -94,7 +94,7 @@ void PlaylistTabBar::mouseReleaseEvent(QMouseEvent* e) {
|
||||
if (e->button() == Qt::MidButton) {
|
||||
// Update menu index
|
||||
menu_index_ = tabAt(e->pos());
|
||||
Close();
|
||||
Close(false);
|
||||
}
|
||||
|
||||
QTabBar::mouseReleaseEvent(e);
|
||||
@ -151,13 +151,26 @@ void PlaylistTabBar::HideEditor() {
|
||||
manager_->SetCurrentPlaylist(manager_->current()->id());
|
||||
}
|
||||
|
||||
void PlaylistTabBar::Close() {
|
||||
void PlaylistTabBar::Close(bool ask_for_delete) {
|
||||
if (menu_index_ == -1)
|
||||
return;
|
||||
|
||||
const int playlist_id = tabData(menu_index_).toInt();
|
||||
|
||||
if (ask_for_delete && !manager_->IsPlaylistFavorite(playlist_id)) {
|
||||
if (QMessageBox::question(this,
|
||||
tr("Remove playlist"),
|
||||
tr("You are about to remove a playlist which is not part of your favorite playlists: "
|
||||
"the playlist will be deleted (this action cannot be undone). \n"
|
||||
"Are you sure you want to continue?"),
|
||||
QMessageBox::Yes, QMessageBox::Cancel) != QMessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Just hide the tab from the UI - don't delete it completely (it can still
|
||||
// be resurrected from the Playlists tab).
|
||||
emit Close(tabData(menu_index_).toInt());
|
||||
emit Close(playlist_id);
|
||||
|
||||
// Select the nearest tab.
|
||||
if (menu_index_ > 1) {
|
||||
|
@ -76,7 +76,7 @@ private slots:
|
||||
void Rename();
|
||||
void RenameInline();
|
||||
void HideEditor();
|
||||
void Close();
|
||||
void Close(bool ask_for_delete = true);
|
||||
void CloseFromTabIndex(int index);
|
||||
// Used when playlist's favorite flag isn't changed from the favorite widget
|
||||
// (e.g. from the playlistlistcontainer): will update the favorite widget
|
||||
|
Loading…
x
Reference in New Issue
Block a user