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/>.
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "playlist.h"
|
|
||||||
#include "playlistbackend.h"
|
#include "playlistbackend.h"
|
||||||
#include "playlistcontainer.h"
|
#include "playlistcontainer.h"
|
||||||
#include "playlistmanager.h"
|
#include "playlistmanager.h"
|
||||||
@ -34,6 +33,7 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
|
#include <QMessageBox>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
using smart_playlists::GeneratorPtr;
|
using smart_playlists::GeneratorPtr;
|
||||||
@ -293,7 +293,6 @@ bool PlaylistManager::Close(int id) {
|
|||||||
emit PlaylistClosed(id);
|
emit PlaylistClosed(id);
|
||||||
|
|
||||||
if (!data.p->is_favorite()) {
|
if (!data.p->is_favorite()) {
|
||||||
// TODO: should we warn the user this action cannot be undone?
|
|
||||||
playlist_backend_->RemovePlaylist(id);
|
playlist_backend_->RemovePlaylist(id);
|
||||||
emit PlaylistDeleted(id);
|
emit PlaylistDeleted(id);
|
||||||
}
|
}
|
||||||
|
@ -25,11 +25,11 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
|
#include "playlist.h"
|
||||||
#include "smartplaylists/generator_fwd.h"
|
#include "smartplaylists/generator_fwd.h"
|
||||||
|
|
||||||
class Application;
|
class Application;
|
||||||
class LibraryBackend;
|
class LibraryBackend;
|
||||||
class Playlist;
|
|
||||||
class PlaylistBackend;
|
class PlaylistBackend;
|
||||||
class PlaylistContainer;
|
class PlaylistContainer;
|
||||||
class PlaylistParser;
|
class PlaylistParser;
|
||||||
@ -162,6 +162,7 @@ public:
|
|||||||
QItemSelection active_selection() const { return selection(active_id()); }
|
QItemSelection active_selection() const { return selection(active_id()); }
|
||||||
|
|
||||||
QString GetPlaylistName(int index) const { return playlists_[index].name; }
|
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,
|
void Init(LibraryBackend* library_backend, PlaylistBackend* playlist_backend,
|
||||||
PlaylistSequence* sequence, PlaylistContainer* playlist_container);
|
PlaylistSequence* sequence, PlaylistContainer* playlist_container);
|
||||||
|
@ -94,7 +94,7 @@ void PlaylistTabBar::mouseReleaseEvent(QMouseEvent* e) {
|
|||||||
if (e->button() == Qt::MidButton) {
|
if (e->button() == Qt::MidButton) {
|
||||||
// Update menu index
|
// Update menu index
|
||||||
menu_index_ = tabAt(e->pos());
|
menu_index_ = tabAt(e->pos());
|
||||||
Close();
|
Close(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTabBar::mouseReleaseEvent(e);
|
QTabBar::mouseReleaseEvent(e);
|
||||||
@ -151,13 +151,26 @@ void PlaylistTabBar::HideEditor() {
|
|||||||
manager_->SetCurrentPlaylist(manager_->current()->id());
|
manager_->SetCurrentPlaylist(manager_->current()->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlaylistTabBar::Close() {
|
void PlaylistTabBar::Close(bool ask_for_delete) {
|
||||||
if (menu_index_ == -1)
|
if (menu_index_ == -1)
|
||||||
return;
|
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
|
// Just hide the tab from the UI - don't delete it completely (it can still
|
||||||
// be resurrected from the Playlists tab).
|
// be resurrected from the Playlists tab).
|
||||||
emit Close(tabData(menu_index_).toInt());
|
emit Close(playlist_id);
|
||||||
|
|
||||||
// Select the nearest tab.
|
// Select the nearest tab.
|
||||||
if (menu_index_ > 1) {
|
if (menu_index_ > 1) {
|
||||||
|
@ -76,7 +76,7 @@ private slots:
|
|||||||
void Rename();
|
void Rename();
|
||||||
void RenameInline();
|
void RenameInline();
|
||||||
void HideEditor();
|
void HideEditor();
|
||||||
void Close();
|
void Close(bool ask_for_delete = true);
|
||||||
void CloseFromTabIndex(int index);
|
void CloseFromTabIndex(int index);
|
||||||
// Used when playlist's favorite flag isn't changed from the favorite widget
|
// Used when playlist's favorite flag isn't changed from the favorite widget
|
||||||
// (e.g. from the playlistlistcontainer): will update the favorite widget
|
// (e.g. from the playlistlistcontainer): will update the favorite widget
|
||||||
|
Loading…
x
Reference in New Issue
Block a user