2010-03-24 00:11:46 +01:00
|
|
|
/* This file is part of Clementine.
|
|
|
|
|
|
|
|
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/>.
|
|
|
|
*/
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
2010-04-14 23:27:27 +02:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
#include <QMainWindow>
|
2010-02-27 09:57:43 +01:00
|
|
|
#include <QSettings>
|
2009-12-24 20:16:07 +01:00
|
|
|
#include <QSystemTrayIcon>
|
|
|
|
|
2010-06-11 00:48:23 +02:00
|
|
|
#include "config.h"
|
2010-06-14 15:27:45 +02:00
|
|
|
#include "core/mac_startup.h"
|
2010-04-15 14:39:34 +02:00
|
|
|
#include "engines/engine_fwd.h"
|
2010-05-10 23:50:31 +02:00
|
|
|
#include "library/librarymodel.h"
|
|
|
|
#include "playlist/playlistitem.h"
|
2010-08-27 17:42:58 +02:00
|
|
|
#include "ui/settingsdialog.h"
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2010-02-03 21:45:32 +01:00
|
|
|
class About;
|
2010-02-24 23:26:01 +01:00
|
|
|
class AddStreamDialog;
|
2010-02-28 19:04:50 +01:00
|
|
|
class AlbumCoverManager;
|
2010-04-13 00:44:29 +02:00
|
|
|
class CommandlineOptions;
|
2010-05-09 02:10:26 +02:00
|
|
|
class Database;
|
2010-06-26 14:41:18 +02:00
|
|
|
class DeviceManager;
|
2010-05-22 22:06:19 +02:00
|
|
|
class EditTagDialog;
|
|
|
|
class Equalizer;
|
2010-05-31 22:49:44 +02:00
|
|
|
class ErrorDialog;
|
2010-05-22 22:06:19 +02:00
|
|
|
class GlobalShortcuts;
|
|
|
|
class GroupByDialog;
|
|
|
|
class Library;
|
|
|
|
class MultiLoadingIndicator;
|
2010-05-10 15:15:52 +02:00
|
|
|
class NetworkAccessManager;
|
2010-06-24 18:26:49 +02:00
|
|
|
class OrganiseDialog;
|
2010-05-22 22:06:19 +02:00
|
|
|
class OSD;
|
|
|
|
class Player;
|
|
|
|
class PlaylistBackend;
|
|
|
|
class PlaylistManager;
|
|
|
|
class PlaylistParser;
|
2010-07-11 17:37:40 +02:00
|
|
|
class QueueManager;
|
2010-05-22 22:06:19 +02:00
|
|
|
class RadioItem;
|
|
|
|
class RadioModel;
|
|
|
|
class Song;
|
|
|
|
class SystemTrayIcon;
|
2010-06-23 15:21:30 +02:00
|
|
|
class TaskManager;
|
2010-05-22 22:06:19 +02:00
|
|
|
class TranscodeDialog;
|
2010-06-06 16:06:23 +02:00
|
|
|
class VisualisationContainer;
|
2010-08-25 15:51:30 +02:00
|
|
|
class WiimotedevShortcuts;
|
2010-05-10 23:50:31 +02:00
|
|
|
class Ui_MainWindow;
|
2009-12-24 20:16:07 +01:00
|
|
|
|
|
|
|
class QSortFilterProxyModel;
|
|
|
|
|
2010-06-14 15:27:45 +02:00
|
|
|
class MainWindow : public QMainWindow, public PlatformInterface {
|
2009-12-24 20:16:07 +01:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2010-05-10 15:15:52 +02:00
|
|
|
MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidget *parent = 0);
|
2009-12-24 20:16:07 +01:00
|
|
|
~MainWindow();
|
|
|
|
|
2010-04-07 01:46:34 +02:00
|
|
|
static const char* kSettingsGroup;
|
2010-05-03 20:52:35 +02:00
|
|
|
static const char* kMusicFilterSpec;
|
|
|
|
static const char* kAllFilesFilterSpec;
|
2010-04-07 01:46:34 +02:00
|
|
|
|
|
|
|
// Don't change the values
|
|
|
|
enum StartupBehaviour {
|
|
|
|
Startup_Remember = 1,
|
|
|
|
Startup_AlwaysShow = 2,
|
|
|
|
Startup_AlwaysHide = 3,
|
|
|
|
};
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
void SetHiddenInTray(bool hidden);
|
2010-04-13 00:44:29 +02:00
|
|
|
void CommandlineOptionsReceived(const CommandlineOptions& options);
|
2009-12-24 20:16:07 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent* event);
|
|
|
|
void closeEvent(QCloseEvent* event);
|
|
|
|
|
2010-06-15 23:56:33 +02:00
|
|
|
// PlatformInterface
|
2010-06-14 15:27:45 +02:00
|
|
|
void Activate();
|
2010-06-15 23:56:33 +02:00
|
|
|
bool LoadUrl(const QString& url);
|
2010-04-14 23:27:27 +02:00
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
private slots:
|
2009-12-24 21:27:32 +01:00
|
|
|
void FilePathChanged(const QString& path);
|
2009-12-24 20:16:07 +01:00
|
|
|
|
|
|
|
void MediaStopped();
|
|
|
|
void MediaPaused();
|
|
|
|
void MediaPlaying();
|
2010-04-13 22:45:40 +02:00
|
|
|
void ForceShowOSD(const Song& song);
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2010-01-15 17:22:19 +01:00
|
|
|
void PlaylistRightClick(const QPoint& global_pos, const QModelIndex& index);
|
|
|
|
void PlaylistPlay();
|
|
|
|
void PlaylistStopAfter();
|
2010-07-11 17:37:40 +02:00
|
|
|
void PlaylistQueue();
|
2010-03-24 17:36:44 +01:00
|
|
|
void PlaylistRemoveCurrent();
|
2010-04-11 19:58:58 +02:00
|
|
|
void PlaylistEditFinished(const QModelIndex& index);
|
2010-01-16 17:12:47 +01:00
|
|
|
void EditTracks();
|
2010-03-22 23:46:53 +01:00
|
|
|
void RenumberTracks();
|
2010-03-24 01:12:52 +01:00
|
|
|
void SelectionSetValue();
|
2010-03-26 00:48:58 +01:00
|
|
|
void EditValue();
|
2010-05-20 23:21:55 +02:00
|
|
|
void PlaylistUndoRedoChanged(QAction* undo, QAction* redo);
|
2010-01-15 17:22:19 +01:00
|
|
|
|
2010-06-25 01:36:39 +02:00
|
|
|
void PlaylistCopyToLibrary();
|
|
|
|
void PlaylistMoveToLibrary();
|
2010-08-08 15:06:52 +02:00
|
|
|
void PlaylistCopyToDevice();
|
2010-06-25 01:36:39 +02:00
|
|
|
void PlaylistOrganiseSelected(bool copy);
|
|
|
|
void PlaylistDelete();
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
void PlayIndex(const QModelIndex& index);
|
|
|
|
void StopAfterCurrent();
|
|
|
|
|
2010-06-09 17:49:05 +02:00
|
|
|
void LoadLibraryItemToPlaylist(const QModelIndexList& indexes);
|
|
|
|
void AddLibraryItemToPlaylist(const QModelIndexList& indexes);
|
2010-05-15 19:45:04 +02:00
|
|
|
void LibraryItemDoubleClicked(const QModelIndex& index);
|
|
|
|
|
|
|
|
void LoadFilesToPlaylist(const QList<QUrl>& urls);
|
|
|
|
void AddFilesToPlaylist(const QList<QUrl>& urls);
|
|
|
|
void FilesDoubleClicked(const QList<QUrl>& urls);
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2010-06-24 18:26:49 +02:00
|
|
|
void CopyFilesToLibrary(const QList<QUrl>& urls);
|
|
|
|
void MoveFilesToLibrary(const QList<QUrl>& urls);
|
|
|
|
|
2010-06-12 17:18:16 +02:00
|
|
|
void LoadLibrarySongsToPlaylist(const SongList& songs);
|
|
|
|
void AddLibrarySongsToPlaylist(const SongList& songs);
|
|
|
|
void LibrarySongsDoubleClicked(const SongList& songs);
|
|
|
|
|
2010-07-18 00:53:27 +02:00
|
|
|
void LoadDeviceSongsToPlaylist(const SongList& songs);
|
|
|
|
void AddDeviceSongsToPlaylist(const SongList& songs);
|
|
|
|
void DeviceSongsDoubleClicked(const SongList& songs);
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
void VolumeWheelEvent(int delta);
|
2010-06-22 13:52:55 +02:00
|
|
|
void ToggleShowHide();
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2009-12-29 20:57:33 +01:00
|
|
|
void UpdateTrackPosition();
|
|
|
|
|
2009-12-30 00:17:54 +01:00
|
|
|
void RadioDoubleClick(const QModelIndex& index);
|
2009-12-30 02:41:37 +01:00
|
|
|
void InsertRadioItem(RadioItem*);
|
2010-05-10 16:19:43 +02:00
|
|
|
void InsertRadioItems(const PlaylistItemList& items);
|
2009-12-29 21:48:50 +01:00
|
|
|
void ScrobblingEnabledChanged(bool value);
|
2010-04-07 21:26:49 +02:00
|
|
|
void LastFMButtonVisibilityChanged(bool value);
|
2009-12-29 21:48:50 +01:00
|
|
|
void Love();
|
|
|
|
|
2010-06-16 21:21:15 +02:00
|
|
|
void TaskCountChanged(int count);
|
2010-06-15 20:24:08 +02:00
|
|
|
|
2010-06-09 17:38:00 +02:00
|
|
|
void ShowLibraryConfig();
|
2010-04-07 01:46:34 +02:00
|
|
|
void ReloadSettings();
|
2010-06-17 19:08:56 +02:00
|
|
|
void SetHiddenInTray() { SetHiddenInTray(true); }
|
2010-02-26 19:22:44 +01:00
|
|
|
|
2010-05-11 22:02:19 +02:00
|
|
|
void AddFile();
|
|
|
|
void AddFolder();
|
2010-02-24 23:26:01 +01:00
|
|
|
void AddStream();
|
|
|
|
void AddStreamAccepted();
|
|
|
|
|
2010-04-13 00:44:29 +02:00
|
|
|
void CommandlineOptionsReceived(const QByteArray& serialized_options);
|
|
|
|
|
2010-04-15 17:23:12 +02:00
|
|
|
void CheckForUpdates();
|
|
|
|
|
2010-06-18 02:06:59 +02:00
|
|
|
void NowPlayingWidgetPositionChanged(bool above_status_bar);
|
|
|
|
|
2010-08-02 16:22:05 +02:00
|
|
|
void SongSaveComplete();
|
|
|
|
|
2010-08-27 17:42:58 +02:00
|
|
|
void ShowCoverManager();
|
|
|
|
void ShowAboutDialog();
|
|
|
|
void ShowTranscodeDialog();
|
2010-08-27 21:09:03 +02:00
|
|
|
void ShowErrorDialog(const QString& message);
|
|
|
|
void ShowQueueManager();
|
|
|
|
void ShowVisualisations();
|
2010-08-27 17:42:58 +02:00
|
|
|
void EnsureSettingsDialogCreated();
|
|
|
|
void EnsureEditTagDialogCreated();
|
|
|
|
void OpenSettingsDialog();
|
|
|
|
void OpenSettingsDialogAtPage(SettingsDialog::Page page);
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
private:
|
|
|
|
void SaveGeometry();
|
2010-05-15 19:45:04 +02:00
|
|
|
void AddFilesToPlaylist(bool clear_first, const QList<QUrl>& urls);
|
2010-06-09 17:49:05 +02:00
|
|
|
void AddLibraryItemToPlaylist(bool clear_first, const QModelIndexList& indexes);
|
2010-06-12 17:18:16 +02:00
|
|
|
void AddLibrarySongsToPlaylist(bool clear_first, const SongList& songs);
|
2010-07-18 00:53:27 +02:00
|
|
|
void AddDeviceSongsToPlaylist(bool clear_first, const SongList& songs);
|
2010-06-15 20:24:08 +02:00
|
|
|
void AddUrls(bool play_now, const QList<QUrl>& urls);
|
2010-03-06 16:33:57 +01:00
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
private:
|
2010-05-10 23:50:31 +02:00
|
|
|
Ui_MainWindow* ui_;
|
2010-08-27 17:42:58 +02:00
|
|
|
NetworkAccessManager* network_;
|
|
|
|
|
2009-12-29 20:57:33 +01:00
|
|
|
SystemTrayIcon* tray_icon_;
|
2010-01-08 15:52:05 +01:00
|
|
|
OSD* osd_;
|
2010-04-14 23:27:27 +02:00
|
|
|
boost::scoped_ptr<EditTagDialog> edit_tag_dialog_;
|
2010-06-23 15:21:30 +02:00
|
|
|
TaskManager* task_manager_;
|
2010-04-14 23:27:27 +02:00
|
|
|
boost::scoped_ptr<About> about_dialog_;
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2010-06-02 17:58:07 +02:00
|
|
|
BackgroundThread<Database>* database_;
|
2009-12-26 22:35:45 +01:00
|
|
|
RadioModel* radio_model_;
|
2010-05-09 02:10:26 +02:00
|
|
|
PlaylistBackend* playlist_backend_;
|
2010-05-20 23:21:55 +02:00
|
|
|
PlaylistManager* playlists_;
|
2010-05-22 22:06:19 +02:00
|
|
|
PlaylistParser* playlist_parser_;
|
2009-12-24 20:16:07 +01:00
|
|
|
Player* player_;
|
|
|
|
Library* library_;
|
2010-03-21 20:02:56 +01:00
|
|
|
GlobalShortcuts* global_shortcuts_;
|
2009-12-24 20:16:07 +01:00
|
|
|
|
2010-06-26 14:41:18 +02:00
|
|
|
DeviceManager* devices_;
|
|
|
|
|
2010-04-14 23:27:27 +02:00
|
|
|
boost::scoped_ptr<SettingsDialog> settings_dialog_;
|
|
|
|
boost::scoped_ptr<AddStreamDialog> add_stream_dialog_;
|
2010-04-14 23:58:51 +02:00
|
|
|
boost::scoped_ptr<AlbumCoverManager> cover_manager_;
|
|
|
|
boost::scoped_ptr<Equalizer> equalizer_;
|
2010-05-03 20:52:35 +02:00
|
|
|
boost::scoped_ptr<TranscodeDialog> transcode_dialog_;
|
2010-05-31 22:49:44 +02:00
|
|
|
boost::scoped_ptr<ErrorDialog> error_dialog_;
|
2010-06-24 18:26:49 +02:00
|
|
|
boost::scoped_ptr<OrganiseDialog> organise_dialog_;
|
2010-07-11 17:37:40 +02:00
|
|
|
boost::scoped_ptr<QueueManager> queue_manager_;
|
2010-06-11 00:48:23 +02:00
|
|
|
|
|
|
|
#ifdef ENABLE_VISUALISATIONS
|
2010-06-06 16:06:23 +02:00
|
|
|
boost::scoped_ptr<VisualisationContainer> visualisation_;
|
2010-06-11 00:48:23 +02:00
|
|
|
#endif
|
2010-02-03 19:32:48 +01:00
|
|
|
|
2010-08-23 19:42:51 +02:00
|
|
|
#ifdef ENABLE_WIIMOTEDEV
|
2010-08-30 19:31:42 +02:00
|
|
|
boost::scoped_ptr<WiimotedevShortcuts> wiimotedev_shortcuts_;
|
2010-08-23 19:42:51 +02:00
|
|
|
#endif
|
|
|
|
|
2010-01-15 17:22:19 +01:00
|
|
|
QMenu* playlist_menu_;
|
|
|
|
QAction* playlist_play_pause_;
|
|
|
|
QAction* playlist_stop_after_;
|
2010-05-20 23:21:55 +02:00
|
|
|
QAction* playlist_undoredo_;
|
2010-06-25 01:36:39 +02:00
|
|
|
QAction* playlist_organise_;
|
|
|
|
QAction* playlist_copy_to_library_;
|
|
|
|
QAction* playlist_move_to_library_;
|
2010-08-08 15:06:52 +02:00
|
|
|
QAction* playlist_copy_to_device_;
|
2010-06-25 01:36:39 +02:00
|
|
|
QAction* playlist_delete_;
|
2010-07-11 17:37:40 +02:00
|
|
|
QAction* playlist_queue_;
|
2010-01-15 17:22:19 +01:00
|
|
|
QModelIndex playlist_menu_index_;
|
|
|
|
|
2009-12-24 20:16:07 +01:00
|
|
|
QSortFilterProxyModel* library_sort_model_;
|
|
|
|
|
2009-12-29 20:57:33 +01:00
|
|
|
QTimer* track_position_timer_;
|
2010-02-27 17:52:18 +01:00
|
|
|
QSettings settings_;
|
2010-04-19 16:10:31 +02:00
|
|
|
|
|
|
|
bool was_maximized_;
|
2010-05-15 19:45:04 +02:00
|
|
|
bool autoclear_playlist_;
|
2009-12-24 20:16:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|