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