]> git.sur5r.net Git - minitube/blob - src/mainwindow.h
Better compact mode
[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     bool isReallyFullScreen();
53     bool isCompact() { return m_compact; }
54
55 protected:
56     void changeEvent(QEvent *);
57     void closeEvent(QCloseEvent *);
58     bool eventFilter(QObject *obj, QEvent *event);
59     void dragEnterEvent(QDragEnterEvent *event);
60     void dropEvent(QDropEvent *event);
61     void resizeEvent(QResizeEvent *);
62
63 private slots:
64     void checkForUpdate();
65     void gotNewVersion(QString version);
66     void visitSite();
67     void donate();
68     void reportIssue();
69     void about();
70     void fullscreen();
71     void updateUIForFullscreen();
72     void compactView(bool enable);
73     void stop();
74     void stateChanged(Phonon::State newState, Phonon::State oldState);
75     void searchFocus();
76     void tick(qint64 time);
77     void totalTimeChanged(qint64 time);
78     void setDefinitionMode(QString definitionName);
79     void toggleDefinitionMode();
80     void clearRecentKeywords();
81
82     // volume shortcuts
83     void volumeUp();
84     void volumeDown();
85     void volumeMute();
86     void volumeChanged(qreal newVolume);
87     void volumeMutedChanged(bool muted);
88
89     // fullscreen toolbar
90     void showFullscreenToolbar(bool show);
91     void showFullscreenPlaylist(bool show);
92
93     void setManualPlay(bool enabled);
94     void updateDownloadMessage(QString);
95     void downloadsFinished();
96     void toggleDownloads(bool show);
97
98     void floatOnTop(bool);
99     void showActionInStatusBar(QAction*, bool show);
100     void showStopAfterThisInStatusBar(bool show);
101
102     void hideMouse();
103
104 private:
105     void initPhonon();
106     void createActions();
107     void createMenus();
108     void createToolBars();
109     void createStatusBar();
110     void showWidget(QWidget*, bool transition = true);
111     static QString formatTime(qint64 time);
112     bool confirmQuit();
113     void simpleUpdateDialog(QString version);
114
115     UpdateChecker *updateChecker;
116
117     // view mechanism
118     QStackedWidget *views;
119     QStack<QWidget*> *history;
120
121     // view widgets
122     HomeView *homeView;
123     MediaView *mediaView;
124     QWidget *aboutView;
125     QWidget *downloadView;
126     QWidget *regionsView;
127
128     // actions
129     QAction *addGadgetAct;
130     QAction *backAct;
131     QAction *quitAct;
132     QAction *siteAct;
133     QAction *donateAct;
134     QAction *aboutAct;
135     QAction *searchFocusAct;
136
137     // media actions
138     QAction *skipBackwardAct;
139     QAction *skipAct;
140     QAction *pauseAct;
141     QAction *stopAct;
142     QAction *fullscreenAct;
143     QAction *compactViewAct;
144     QAction *webPageAct;
145     QAction *copyPageAct;
146     QAction *copyLinkAct;
147     QAction *volumeUpAct;
148     QAction *volumeDownAct;
149     QAction *volumeMuteAct;
150     QAction *findVideoPartsAct;
151
152     // playlist actions
153     QAction *removeAct;
154     QAction *moveDownAct;
155     QAction *moveUpAct;
156     QAction *fetchMoreAct;
157     QAction *clearAct;
158
159     // menus
160     QMenu *fileMenu;
161     QMenu *viewMenu;
162     QMenu *playlistMenu;
163     QMenu *helpMenu;
164
165     // toolbar & statusbar
166     QToolBar *mainToolBar;
167     SearchLineEdit *toolbarSearch;
168     QToolBar *statusToolBar;
169     QToolButton *regionButton;
170     QAction *regionAction;
171
172     // phonon
173     Phonon::SeekSlider *seekSlider;
174     Phonon::VolumeSlider *volumeSlider;
175     Phonon::MediaObject *mediaObject;
176     Phonon::AudioOutput *audioOutput;
177     QLabel *currentTime;
178     QLabel *totalTime;
179
180     // fullscreen
181     bool m_fullscreen;
182     bool m_maximized;
183     QTimer *mouseTimer;
184     bool m_compact;
185
186 };
187
188 #endif