Clementine-audio-player-Mac.../src/ui/mainwindow.h

253 lines
7.0 KiB
C
Raw Normal View History

/* 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
#include <boost/scoped_ptr.hpp>
2009-12-24 20:16:07 +01:00
#include <QMainWindow>
#include <QSettings>
2009-12-24 20:16:07 +01:00
#include <QSystemTrayIcon>
#include "config.h"
2010-06-14 15:27:45 +02:00
#include "core/mac_startup.h"
#include "engines/engine_fwd.h"
#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;
class AddStreamDialog;
class AlbumCoverManager;
class CommandlineOptions;
class Database;
class DeviceManager;
class EditTagDialog;
class Equalizer;
class ErrorDialog;
class GlobalShortcuts;
class GroupByDialog;
class Library;
class MultiLoadingIndicator;
class NetworkAccessManager;
class OrganiseDialog;
class OSD;
class Player;
class PlaylistBackend;
class PlaylistManager;
class PlaylistParser;
2010-07-11 17:37:40 +02:00
class QueueManager;
class RadioItem;
class RadioModel;
class Song;
class SystemTrayIcon;
class TaskManager;
class TranscodeDialog;
class VisualisationContainer;
2010-08-25 15:51:30 +02:00
class WiimotedevShortcuts;
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:
MainWindow(NetworkAccessManager* network, Engine::Type engine, QWidget *parent = 0);
2009-12-24 20:16:07 +01:00
~MainWindow();
static const char* kSettingsGroup;
static const char* kMusicFilterSpec;
static const char* kAllFilesFilterSpec;
// 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);
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);
2009-12-24 20:16:07 +01:00
private slots:
void FilePathChanged(const QString& path);
2009-12-24 20:16:07 +01:00
void MediaStopped();
void MediaPaused();
void MediaPlaying();
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();
void PlaylistRemoveCurrent();
void PlaylistEditFinished(const QModelIndex& index);
2010-01-16 17:12:47 +01:00
void EditTracks();
void RenumberTracks();
void SelectionSetValue();
void EditValue();
void PlaylistUndoRedoChanged(QAction* undo, QAction* redo);
2010-01-15 17:22:19 +01:00
void PlaylistCopyToLibrary();
void PlaylistMoveToLibrary();
void PlaylistCopyToDevice();
void PlaylistOrganiseSelected(bool copy);
void PlaylistDelete();
2009-12-24 20:16:07 +01:00
void PlayIndex(const QModelIndex& index);
void StopAfterCurrent();
void LoadLibraryItemToPlaylist(const QModelIndexList& indexes);
void AddLibraryItemToPlaylist(const QModelIndexList& indexes);
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
void CopyFilesToLibrary(const QList<QUrl>& urls);
void MoveFilesToLibrary(const QList<QUrl>& urls);
void LoadLibrarySongsToPlaylist(const SongList& songs);
void AddLibrarySongsToPlaylist(const SongList& songs);
void LibrarySongsDoubleClicked(const SongList& songs);
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);
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*);
void InsertRadioItems(const PlaylistItemList& items);
2009-12-29 21:48:50 +01:00
void ScrobblingEnabledChanged(bool value);
void LastFMButtonVisibilityChanged(bool value);
2009-12-29 21:48:50 +01:00
void Love();
void TaskCountChanged(int count);
void ShowLibraryConfig();
void ReloadSettings();
void SetHiddenInTray() { SetHiddenInTray(true); }
void AddFile();
void AddFolder();
void AddStream();
void AddStreamAccepted();
void CommandlineOptionsReceived(const QByteArray& serialized_options);
void CheckForUpdates();
void NowPlayingWidgetPositionChanged(bool above_status_bar);
void SongSaveComplete();
2010-08-27 17:42:58 +02:00
void ShowCoverManager();
void ShowAboutDialog();
void ShowTranscodeDialog();
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();
void AddFilesToPlaylist(bool clear_first, const QList<QUrl>& urls);
void AddLibraryItemToPlaylist(bool clear_first, const QModelIndexList& indexes);
void AddLibrarySongsToPlaylist(bool clear_first, const SongList& songs);
void AddDeviceSongsToPlaylist(bool clear_first, const SongList& songs);
void AddUrls(bool play_now, const QList<QUrl>& urls);
2009-12-24 20:16:07 +01:00
private:
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_;
boost::scoped_ptr<EditTagDialog> edit_tag_dialog_;
TaskManager* task_manager_;
boost::scoped_ptr<About> about_dialog_;
2009-12-24 20:16:07 +01:00
BackgroundThread<Database>* database_;
2009-12-26 22:35:45 +01:00
RadioModel* radio_model_;
PlaylistBackend* playlist_backend_;
PlaylistManager* playlists_;
PlaylistParser* playlist_parser_;
2009-12-24 20:16:07 +01:00
Player* player_;
Library* library_;
GlobalShortcuts* global_shortcuts_;
2009-12-24 20:16:07 +01:00
DeviceManager* devices_;
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_;
boost::scoped_ptr<TranscodeDialog> transcode_dialog_;
boost::scoped_ptr<ErrorDialog> error_dialog_;
boost::scoped_ptr<OrganiseDialog> organise_dialog_;
2010-07-11 17:37:40 +02:00
boost::scoped_ptr<QueueManager> queue_manager_;
#ifdef ENABLE_VISUALISATIONS
boost::scoped_ptr<VisualisationContainer> visualisation_;
#endif
2010-02-03 19:32:48 +01:00
#ifdef ENABLE_WIIMOTEDEV
boost::scoped_ptr<WiimotedevShortcuts> wiimotedev_shortcuts_;
#endif
2010-01-15 17:22:19 +01:00
QMenu* playlist_menu_;
QAction* playlist_play_pause_;
QAction* playlist_stop_after_;
QAction* playlist_undoredo_;
QAction* playlist_organise_;
QAction* playlist_copy_to_library_;
QAction* playlist_move_to_library_;
QAction* playlist_copy_to_device_;
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_;
QSettings settings_;
bool was_maximized_;
bool autoclear_playlist_;
2009-12-24 20:16:07 +01:00
};
#endif // MAINWINDOW_H