2011-01-10 23:26:13 +01:00
|
|
|
/* This file is part of Clementine.
|
2014-11-02 19:36:21 +01:00
|
|
|
Copyright 2011, Paweł Bara <keirangtp@gmail.com>
|
|
|
|
Copyright 2011, David Sansome <me@davidsansome.com>
|
|
|
|
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
|
|
|
|
Copyright 2014, John Maguire <john.maguire@gmail.com>
|
2011-01-10 23:26:13 +01:00
|
|
|
|
|
|
|
Clementine 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.
|
|
|
|
|
|
|
|
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2014-11-01 19:26:05 +01:00
|
|
|
#ifndef CORE_MIMEDATA_H_
|
|
|
|
#define CORE_MIMEDATA_H_
|
2011-01-10 23:26:13 +01:00
|
|
|
|
|
|
|
#include <QMimeData>
|
|
|
|
|
|
|
|
class MimeData : public QMimeData {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
|
|
|
MimeData(bool clear = false, bool play_now = false, bool enqueue = false,
|
|
|
|
bool open_in_new_playlist = false)
|
|
|
|
: override_user_settings_(false),
|
|
|
|
clear_first_(clear),
|
|
|
|
play_now_(play_now),
|
|
|
|
enqueue_now_(enqueue),
|
|
|
|
open_in_new_playlist_(open_in_new_playlist),
|
|
|
|
name_for_new_playlist_(QString()),
|
|
|
|
from_doubleclick_(false) {}
|
2011-01-10 23:26:13 +01:00
|
|
|
|
2011-09-19 00:26:21 +02:00
|
|
|
// If this is set then MainWindow will not touch any of the other flags.
|
|
|
|
bool override_user_settings_;
|
|
|
|
|
2011-01-10 23:26:13 +01:00
|
|
|
// If this is set then the playlist will be cleared before these songs
|
|
|
|
// are inserted.
|
|
|
|
bool clear_first_;
|
|
|
|
|
|
|
|
// If this is set then the first item that is inserted will start playing
|
2011-01-24 22:16:26 +01:00
|
|
|
// immediately. Note: this is always overridden with the user's preference
|
2014-02-07 16:34:20 +01:00
|
|
|
// if the MimeData goes via MainWindow, unless you set
|
|
|
|
// override_user_settings_.
|
2011-01-10 23:26:13 +01:00
|
|
|
bool play_now_;
|
|
|
|
|
|
|
|
// If this is set then the items are added to the queue after being inserted.
|
|
|
|
bool enqueue_now_;
|
|
|
|
|
2011-02-16 19:29:35 +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.
|
2011-02-14 18:00:13 +01:00
|
|
|
QString name_for_new_playlist_;
|
2011-02-09 18:51:59 +01:00
|
|
|
|
2011-01-10 23:26:13 +01:00
|
|
|
// This can be set if this MimeData goes via MainWindow (ie. it is created
|
2011-02-16 19:29:35 +01:00
|
|
|
// manually in a double-click). The MainWindow will set the above flags to
|
|
|
|
// the defaults set by the user.
|
2011-01-24 22:16:26 +01:00
|
|
|
bool from_doubleclick_;
|
2011-02-16 19:29:35 +01:00
|
|
|
|
2014-02-07 16:34:20 +01: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
|
2011-02-16 19:29:35 +01:00
|
|
|
// "Playlist" string if the 'name_for_new_playlist_' attribute is empty.
|
|
|
|
QString get_name_for_new_playlist() {
|
2014-02-07 16:34:20 +01:00
|
|
|
return name_for_new_playlist_.isEmpty() ? tr("Playlist")
|
|
|
|
: name_for_new_playlist_;
|
2011-02-16 19:29:35 +01:00
|
|
|
}
|
2011-01-10 23:26:13 +01:00
|
|
|
};
|
|
|
|
|
2014-11-01 19:26:05 +01:00
|
|
|
#endif // CORE_MIMEDATA_H_
|