]> git.sur5r.net Git - minitube/blob - src/mainwindow.h
Imported Upstream version 2.0
[minitube] / src / mainwindow.h
1 #ifndef MAINWINDOW_H
2 #define MAINWINDOW_H
3
4 #include <QtGui>
5 #include <phonon/audiooutput.h>
6 #include <phonon/volumeslider.h>
7 #include <phonon/mediaobject.h>
8 #include <phonon/seekslider.h>
9 #include "view.h"
10
11 class HomeView;
12 class MediaView;
13 class DownloadView;
14 class SearchLineEdit;
15 class UpdateChecker;
16 class SearchParams;
17 class VideoSource;
18
19 class MainWindow : public QMainWindow {
20
21     Q_OBJECT
22
23 public:
24     static MainWindow* instance();
25     MainWindow();
26     ~MainWindow();
27     Phonon::SeekSlider* getSeekSlider() { return seekSlider; }
28     void readSettings();
29     void writeSettings();
30     static void printHelp();
31     MediaView* getMediaView() { return mediaView; }
32     QToolButton* getRegionButton() { return regionButton; }
33     QAction* getRegionAction() { return regionAction; }
34
35 public slots:
36     void showHome(bool transition = true);
37     void showMedia(SearchParams *params);
38     void showMedia(VideoSource *videoSource);
39     void showRegionsView();
40     void restore();
41     void messageReceived(const QString &message);
42     void quit();
43     void startToolbarSearch(QString query);
44     void goBack();
45     void showMessage(QString message);
46 #ifdef APP_ACTIVATION
47     void showActivationView(bool transition = true);
48     void showActivationDialog();
49     void buy();
50     void hideBuyAction();
51 #endif
52
53 protected:
54     void changeEvent(QEvent *);
55     void closeEvent(QCloseEvent *);
56     bool eventFilter(QObject *obj, QEvent *event);
57     void dragEnterEvent(QDragEnterEvent *event);
58     void dropEvent(QDropEvent *event);
59     void resizeEvent(QResizeEvent *);
60
61 private slots:
62     void checkForUpdate();
63     void gotNewVersion(QString version);
64     void visitSite();
65     void donate();
66     void reportIssue();
67     void about();
68     void fullscreen();
69     void updateUIForFullscreen();
70     void compactView(bool enable);
71     void stop();
72     void stateChanged(Phonon::State newState, Phonon::State oldState);
73     void searchFocus();
74     void tick(qint64 time);
75     void totalTimeChanged(qint64 time);
76     void setDefinitionMode(QString definitionName);
77     void toggleDefinitionMode();
78     void clearRecentKeywords();
79
80     // volume shortcuts
81     void volumeUp();
82     void volumeDown();
83     void volumeMute();
84     void volumeChanged(qreal newVolume);
85     void volumeMutedChanged(bool muted);
86
87     // fullscreen toolbar
88     void showFullscreenToolbar(bool show);
89     void showFullscreenPlaylist(bool show);
90
91     void setManualPlay(bool enabled);
92     void updateDownloadMessage(QString);
93     void downloadsFinished();
94     void toggleDownloads(bool show);
95
96     void floatOnTop(bool);
97     void showActionInStatusBar(QAction*, bool show);
98     void showStopAfterThisInStatusBar(bool show);
99
100     void hideMouse();
101
102 private:
103     void initPhonon();
104     void createActions();
105     void createMenus();
106     void createToolBars();
107     void createStatusBar();
108     void showWidget(QWidget*, bool transition = true);
109     static QString formatTime(qint64 time);
110     bool confirmQuit();
111     void simpleUpdateDialog(QString version);
112
113     UpdateChecker *updateChecker;
114
115     // view mechanism
116     QStackedWidget *views;
117     QStack<QWidget*> *history;
118
119     // view widgets
120     HomeView *homeView;
121     MediaView *mediaView;
122     QWidget *aboutView;
123     QWidget *downloadView;
124     QWidget *regionsView;
125
126     // actions
127     QAction *addGadgetAct;
128     QAction *backAct;
129     QAction *quitAct;
130     QAction *siteAct;
131     QAction *donateAct;
132     QAction *aboutAct;
133     QAction *searchFocusAct;
134
135     // media actions
136     QAction *skipBackwardAct;
137     QAction *skipAct;
138     QAction *pauseAct;
139     QAction *stopAct;
140     QAction *fullscreenAct;
141     QAction *compactViewAct;
142     QAction *webPageAct;
143     QAction *copyPageAct;
144     QAction *copyLinkAct;
145     QAction *volumeUpAct;
146     QAction *volumeDownAct;
147     QAction *volumeMuteAct;
148     QAction *findVideoPartsAct;
149
150     // playlist actions
151     QAction *removeAct;
152     QAction *moveDownAct;
153     QAction *moveUpAct;
154     QAction *fetchMoreAct;
155     QAction *clearAct;
156
157     // menus
158     QMenu *fileMenu;
159     QMenu *viewMenu;
160     QMenu *playlistMenu;
161     QMenu *helpMenu;
162
163     // toolbar & statusbar
164     QToolBar *mainToolBar;
165     SearchLineEdit *toolbarSearch;
166     QToolBar *statusToolBar;
167     QToolButton *regionButton;
168     QAction *regionAction;
169
170     // phonon
171     Phonon::SeekSlider *seekSlider;
172     Phonon::VolumeSlider *volumeSlider;
173     Phonon::MediaObject *mediaObject;
174     Phonon::AudioOutput *audioOutput;
175     QLabel *currentTime;
176     QLabel *totalTime;
177
178     // fullscreen
179     bool m_fullscreen;
180     bool m_maximized;
181     QTimer *mouseTimer;
182 };
183
184 #endif