2018-02-27 18:06:05 +01:00
|
|
|
/*
|
|
|
|
* Strawberry Music Player
|
|
|
|
* This file was part of Clementine.
|
|
|
|
* Copyright 2010, David Sansome <me@davidsansome.com>
|
|
|
|
*
|
|
|
|
* Strawberry is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Strawberry is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
2018-08-09 18:10:03 +02:00
|
|
|
*
|
2018-02-27 18:06:05 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MIMEDATA_H
|
|
|
|
#define MIMEDATA_H
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2018-05-01 00:41:33 +02:00
|
|
|
#include <QObject>
|
2018-02-27 18:06:05 +01:00
|
|
|
#include <QMimeData>
|
2018-05-01 00:41:33 +02:00
|
|
|
#include <QString>
|
2018-02-27 18:06:05 +01:00
|
|
|
|
|
|
|
class MimeData : public QMimeData {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2021-06-20 19:04:08 +02:00
|
|
|
explicit MimeData(const bool clear = false, const bool play_now = false, const bool enqueue = false, const bool enqueue_next_now = false, const bool open_in_new_playlist = false, QObject* = nullptr)
|
2018-02-27 18:06:05 +01:00
|
|
|
: override_user_settings_(false),
|
|
|
|
clear_first_(clear),
|
|
|
|
play_now_(play_now),
|
|
|
|
enqueue_now_(enqueue),
|
2018-11-18 23:21:12 +01:00
|
|
|
enqueue_next_now_(enqueue_next_now),
|
2018-02-27 18:06:05 +01:00
|
|
|
open_in_new_playlist_(open_in_new_playlist),
|
|
|
|
name_for_new_playlist_(QString()),
|
|
|
|
from_doubleclick_(false) {}
|
|
|
|
|
|
|
|
// If this is set then MainWindow will not touch any of the other flags.
|
|
|
|
bool override_user_settings_;
|
|
|
|
|
2018-05-01 00:41:33 +02:00
|
|
|
// If this is set then the playlist will be cleared before these songs are inserted.
|
2018-02-27 18:06:05 +01:00
|
|
|
bool clear_first_;
|
|
|
|
|
2018-05-01 00:41:33 +02:00
|
|
|
// If this is set then the first item that is inserted will start playing immediately.
|
|
|
|
// Note: this is always overridden with the user's preference if the MimeData goes via MainWindow, unless you set override_user_settings_.
|
2018-02-27 18:06:05 +01:00
|
|
|
bool play_now_;
|
|
|
|
|
|
|
|
// If this is set then the items are added to the queue after being inserted.
|
|
|
|
bool enqueue_now_;
|
2018-10-02 00:38:52 +02:00
|
|
|
|
2018-08-09 18:10:03 +02:00
|
|
|
// If this is set then the items are added to the beginning of the queue after being inserted.
|
|
|
|
bool enqueue_next_now_;
|
2018-02-27 18:06:05 +01:00
|
|
|
|
|
|
|
// If this is set then the items are inserted into a newly created playlist.
|
|
|
|
bool open_in_new_playlist_;
|
|
|
|
|
|
|
|
// This serves as a name for the new playlist in 'open_in_new_playlist_' mode.
|
|
|
|
QString name_for_new_playlist_;
|
|
|
|
|
2018-05-01 00:41:33 +02:00
|
|
|
// This can be set if this MimeData goes via MainWindow (ie. it is created manually in a double-click).
|
|
|
|
// The MainWindow will set the above flags to the defaults set by the user.
|
2018-02-27 18:06:05 +01:00
|
|
|
bool from_doubleclick_;
|
|
|
|
|
2018-05-01 00:41:33 +02:00
|
|
|
// Returns a pretty name for a playlist containing songs described by this MimeData object.
|
|
|
|
// By pretty name we mean the value of 'name_for_new_playlist_' or generic "Playlist" string if the 'name_for_new_playlist_' attribute is empty.
|
2018-02-27 18:06:05 +01:00
|
|
|
QString get_name_for_new_playlist() {
|
|
|
|
return name_for_new_playlist_.isEmpty() ? tr("Playlist") : name_for_new_playlist_;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MIMEDATA_H
|