2010-05-20 16:12:15 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-05-20 16:12:15 +02: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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLAYLISTCONTAINER_H
|
|
|
|
#define PLAYLISTCONTAINER_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
2010-05-21 01:18:55 +02:00
|
|
|
#include <QSettings>
|
2010-05-20 16:12:15 +02:00
|
|
|
|
|
|
|
class Ui_PlaylistContainer;
|
|
|
|
|
2011-04-28 22:48:53 +02:00
|
|
|
class DidYouMean;
|
2010-08-25 22:59:08 +02:00
|
|
|
class LineEditInterface;
|
2010-05-20 23:21:55 +02:00
|
|
|
class Playlist;
|
|
|
|
class PlaylistManager;
|
2010-05-20 16:12:15 +02:00
|
|
|
class PlaylistView;
|
|
|
|
|
2010-05-21 12:57:40 +02:00
|
|
|
class QTimeLine;
|
2012-09-09 00:35:50 +02:00
|
|
|
class QTimer;
|
2010-05-22 19:03:18 +02:00
|
|
|
class QLabel;
|
2010-05-21 12:57:40 +02:00
|
|
|
|
2010-05-20 16:12:15 +02:00
|
|
|
class PlaylistContainer : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
PlaylistContainer(QWidget *parent = 0);
|
|
|
|
~PlaylistContainer();
|
|
|
|
|
2010-05-21 01:18:55 +02:00
|
|
|
static const char* kSettingsGroup;
|
|
|
|
|
2010-05-20 16:12:15 +02:00
|
|
|
void SetActions(QAction* new_playlist, QAction* save_playlist,
|
2011-04-19 22:11:24 +02:00
|
|
|
QAction* load_playlist, QAction* next_playlist, QAction*
|
|
|
|
previous_playlist);
|
2010-05-20 23:21:55 +02:00
|
|
|
void SetManager(PlaylistManager* manager);
|
2010-05-20 16:12:15 +02:00
|
|
|
|
2011-04-28 22:48:53 +02:00
|
|
|
DidYouMean* did_you_mean() const { return did_you_mean_; }
|
2010-05-20 16:12:15 +02:00
|
|
|
PlaylistView* view() const;
|
|
|
|
|
2011-02-23 23:21:17 +01:00
|
|
|
bool eventFilter(QObject *objectWatched, QEvent *event);
|
|
|
|
|
2010-05-20 16:12:15 +02:00
|
|
|
signals:
|
2010-05-23 00:20:00 +02:00
|
|
|
void TabChanged(int id);
|
|
|
|
void Rename(int id, const QString& new_name);
|
|
|
|
void Remove(int id);
|
2010-05-20 16:12:15 +02:00
|
|
|
|
2010-05-20 23:21:55 +02:00
|
|
|
void UndoRedoActionsChanged(QAction* undo, QAction* redo);
|
2010-11-28 16:14:48 +01:00
|
|
|
void ViewSelectionModelChanged();
|
2010-05-20 23:21:55 +02:00
|
|
|
|
2010-05-22 19:03:18 +02:00
|
|
|
protected:
|
|
|
|
// QWidget
|
|
|
|
void resizeEvent(QResizeEvent *);
|
|
|
|
|
2010-05-20 16:12:15 +02:00
|
|
|
private slots:
|
2010-05-21 01:18:55 +02:00
|
|
|
void NewPlaylist();
|
|
|
|
void LoadPlaylist();
|
2010-05-23 00:20:00 +02:00
|
|
|
void SavePlaylist() { SavePlaylist(-1); }
|
|
|
|
void SavePlaylist(int id);
|
2011-04-19 22:11:24 +02:00
|
|
|
void GoToNextPlaylistTab();
|
|
|
|
void GoToPreviousPlaylistTab();
|
2010-05-20 23:21:55 +02:00
|
|
|
|
|
|
|
void SetViewModel(Playlist* playlist);
|
2010-05-23 00:20:00 +02:00
|
|
|
void PlaylistAdded(int id, const QString& name);
|
|
|
|
void PlaylistRemoved(int id);
|
|
|
|
void PlaylistRenamed(int id, const QString& new_name);
|
2010-05-20 16:12:15 +02:00
|
|
|
|
2010-05-21 00:48:11 +02:00
|
|
|
void ActivePlaying();
|
|
|
|
void ActivePaused();
|
|
|
|
void ActiveStopped();
|
|
|
|
|
2010-05-21 01:18:55 +02:00
|
|
|
void Save();
|
|
|
|
|
2010-05-21 12:57:40 +02:00
|
|
|
void SetTabBarVisible(bool visible);
|
|
|
|
void SetTabBarHeight(int height);
|
|
|
|
|
2010-06-13 14:45:05 +02:00
|
|
|
void SelectionChanged();
|
2012-09-09 00:35:50 +02:00
|
|
|
void MaybeUpdateFilter();
|
2010-05-22 18:36:13 +02:00
|
|
|
void UpdateFilter();
|
2011-02-23 23:21:17 +01:00
|
|
|
void FocusOnFilter(QKeyEvent *event);
|
2010-05-22 18:36:13 +02:00
|
|
|
|
2011-04-28 22:48:53 +02:00
|
|
|
void DidYouMeanAccepted(const QString& text);
|
2011-04-29 13:24:58 +02:00
|
|
|
void UpdateNoMatchesLabel();
|
2011-04-28 22:48:53 +02:00
|
|
|
|
2010-05-21 00:48:11 +02:00
|
|
|
private:
|
|
|
|
void UpdateActiveIcon(const QIcon& icon);
|
2010-05-22 19:03:18 +02:00
|
|
|
void RepositionNoMatchesLabel(bool force = false);
|
2010-05-21 00:48:11 +02:00
|
|
|
|
2010-05-20 16:12:15 +02:00
|
|
|
private:
|
2012-09-09 00:35:50 +02:00
|
|
|
static const int kFilterDelayMs;
|
|
|
|
static const int kFilterDelayPlaylistSizeThreshold;
|
|
|
|
|
2010-05-20 16:12:15 +02:00
|
|
|
Ui_PlaylistContainer* ui_;
|
2010-05-20 23:21:55 +02:00
|
|
|
|
|
|
|
PlaylistManager* manager_;
|
|
|
|
QAction* undo_;
|
|
|
|
QAction* redo_;
|
2011-04-29 13:24:58 +02:00
|
|
|
Playlist* playlist_;
|
2010-05-21 01:18:55 +02:00
|
|
|
|
|
|
|
QSettings settings_;
|
|
|
|
bool starting_up_;
|
2010-05-21 12:57:40 +02:00
|
|
|
|
|
|
|
bool tab_bar_visible_;
|
|
|
|
QTimeLine* tab_bar_animation_;
|
2010-05-22 19:03:18 +02:00
|
|
|
|
|
|
|
QLabel* no_matches_label_;
|
2011-04-28 22:48:53 +02:00
|
|
|
|
|
|
|
DidYouMean* did_you_mean_;
|
2012-09-09 00:35:50 +02:00
|
|
|
|
|
|
|
QTimer* filter_timer_;
|
2010-05-20 16:12:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PLAYLISTCONTAINER_H
|