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

178 lines
4.5 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 "ui_mainwindow.h"
#include "engines/engine_fwd.h"
#include "librarymodel.h"
2009-12-24 20:16:07 +01:00
class Playlist;
class Player;
class Library;
class PlaylistBackend;
class RadioModel;
2009-12-29 21:48:50 +01:00
class Song;
2009-12-30 02:41:37 +01:00
class RadioItem;
2010-01-08 15:52:05 +01:00
class OSD;
2010-01-15 18:12:47 +01:00
class TrackSlider;
2010-01-16 17:12:47 +01:00
class EditTagDialog;
2010-01-16 18:52:51 +01:00
class MultiLoadingIndicator;
2010-02-03 17:17:04 +01:00
class SettingsDialog;
2010-02-03 21:45:32 +01:00
class About;
class AddStreamDialog;
class AlbumCoverManager;
class PlaylistSequence;
class GlobalShortcuts;
class GroupByDialog;
class Equalizer;
class CommandlineOptions;
class TranscodeDialog;
class Database;
class NetworkAccessManager;
2009-12-24 20:16:07 +01:00
class QSortFilterProxyModel;
class SystemTrayIcon;
class MainWindow : public QMainWindow {
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* kPlaylistFilterSpec;
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);
bool event(QEvent* event);
2009-12-24 20:16:07 +01:00
private slots:
2009-12-24 23:26:58 +01:00
void QueueFiles(const QList<QUrl>& urls);
void FilePathChanged(const QString& path);
2009-12-24 20:16:07 +01:00
void ReportError(const QString& message);
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();
void PlaylistRemoveCurrent();
void PlaylistEditFinished(const QModelIndex& index);
2010-01-16 17:12:47 +01:00
void EditTracks();
void RenumberTracks();
void SelectionSetValue();
void EditValue();
2010-01-15 17:22:19 +01:00
2009-12-24 20:16:07 +01:00
void PlayIndex(const QModelIndex& index);
void StopAfterCurrent();
void AddLibraryItemToPlaylist(const QModelIndex& index);
2009-12-24 20:16:07 +01:00
void VolumeWheelEvent(int delta);
void TrayClicked(QSystemTrayIcon::ActivationReason reason);
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();
2010-01-16 18:52:51 +01:00
void LibraryScanStarted();
void LibraryScanFinished();
void ReloadSettings();
void AddMedia();
void AddStream();
void AddStreamAccepted();
void CommandlineOptionsReceived(const QByteArray& serialized_options);
void CheckForUpdates();
2009-12-24 20:16:07 +01:00
private:
void SaveGeometry();
2009-12-24 20:16:07 +01:00
private:
static const int kStateVersion;
Ui::MainWindow ui_;
2009-12-29 20:57:33 +01:00
SystemTrayIcon* tray_icon_;
2010-01-08 15:52:05 +01:00
OSD* osd_;
2010-01-15 18:12:47 +01:00
TrackSlider* track_slider_;
PlaylistSequence* playlist_sequence_;
boost::scoped_ptr<EditTagDialog> edit_tag_dialog_;
2010-01-16 18:52:51 +01:00
MultiLoadingIndicator* multi_loading_indicator_;
boost::scoped_ptr<About> about_dialog_;
2009-12-24 20:16:07 +01:00
Database* database_;
2009-12-26 22:35:45 +01:00
RadioModel* radio_model_;
PlaylistBackend* playlist_backend_;
Playlist* playlist_;
2009-12-24 20:16:07 +01:00
Player* player_;
Library* library_;
GlobalShortcuts* global_shortcuts_;
2009-12-24 20:16:07 +01: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_;
boost::scoped_ptr<TranscodeDialog> transcode_dialog_;
2010-02-03 19:32:48 +01:00
2010-01-15 17:22:19 +01:00
QMenu* playlist_menu_;
QAction* playlist_play_pause_;
QAction* playlist_stop_after_;
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_;
2009-12-24 20:16:07 +01:00
};
#endif // MAINWINDOW_H