3 This file is part of Minitube.
4 Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
6 Minitube is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Minitube is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Minitube. If not, see <http://www.gnu.org/licenses/>.
25 #if QT_VERSION >= 0x050000
29 #include <phonon/audiooutput.h>
30 #include <phonon/volumeslider.h>
31 #include <phonon/mediaobject.h>
32 #include <phonon/seekslider.h>
44 class MainWindow : public QMainWindow {
49 static MainWindow* instance();
52 #ifdef APP_PHONON_SEEK
53 Phonon::SeekSlider* getSeekSlider() { return seekSlider; }
55 QSlider* getSlider() { return slider; }
58 Phonon::AudioOutput* getAudioOutput() { return audioOutput; }
59 Phonon::VolumeSlider *getVolumeSlider() { return volumeSlider; }
61 QLabel *getCurrentTimeLabel() { return currentTime; }
64 static void printHelp();
65 MediaView* getMediaView() { return mediaView; }
66 QToolButton* getRegionButton() { return regionButton; }
67 QAction* getRegionAction() { return regionAction; }
68 SearchLineEdit *getToolbarSearch() { return toolbarSearch; }
70 void showActionInStatusBar(QAction*, bool show);
71 void setStatusBarVisibility(bool show);
72 void adjustStatusBarVisibility();
75 void showHome(bool transition = true);
76 void showMedia(SearchParams *params);
77 void showMedia(VideoSource *videoSource);
78 void showRegionsView();
80 void messageReceived(const QString &message);
82 void suggestionAccepted(Suggestion *suggestion);
83 void search(const QString &query);
85 void showMessage(const QString &message);
87 void showActivationView(bool transition = true);
88 void showActivationDialog();
92 bool isReallyFullScreen();
93 bool isCompact() { return m_compact; }
96 void currentTimeChanged(const QString &s);
99 void changeEvent(QEvent *e);
100 void closeEvent(QCloseEvent *e);
101 void showEvent(QShowEvent *e);
102 bool eventFilter(QObject *obj, QEvent *e);
103 void dragEnterEvent(QDragEnterEvent *e);
104 void dropEvent(QDropEvent *e);
105 void resizeEvent(QResizeEvent *e);
106 void moveEvent(QMoveEvent *e);
110 void checkForUpdate();
111 void gotNewVersion(const QString &version);
117 void updateUIForFullscreen();
118 void compactView(bool enable);
121 void stateChanged(Phonon::State newState, Phonon::State oldState);
124 void tick(qint64 time);
125 void totalTimeChanged(qint64 time);
126 void setDefinitionMode(const QString &definitionName);
127 void toggleDefinitionMode();
128 void clearRecentKeywords();
134 void volumeChanged(qreal newVolume);
135 void volumeMutedChanged(bool muted);
137 // fullscreen toolbar
138 void showFullscreenToolbar(bool show);
139 void showFullscreenPlaylist(bool show);
141 void setManualPlay(bool enabled);
142 void updateDownloadMessage(const QString &);
143 void downloadsFinished();
144 void toggleDownloads(bool show);
146 void floatOnTop(bool, bool showAction = true);
147 void adjustWindowSizeChanged(bool enabled);
149 void showStopAfterThisInStatusBar(bool show);
154 void rateOnAppStore();
161 void createActions();
163 void createToolBars();
164 void createStatusBar();
165 void showWidget(QWidget*, bool transition = true);
166 static QString formatTime(qint64 duration);
168 void simpleUpdateDialog(const QString &version);
169 bool needStatusBar();
170 void adjustMessageLabelPosition();
172 UpdateChecker *updateChecker;
175 QStackedWidget *views;
176 QStack<QWidget*> *history;
177 QList<QAction*> viewActions;
181 MediaView *mediaView;
183 QWidget *downloadView;
184 QWidget *regionsView;
192 QAction *searchFocusAct;
195 QAction *skipBackwardAct;
199 QAction *fullscreenAct;
200 QAction *compactViewAct;
202 QAction *copyPageAct;
203 QAction *copyLinkAct;
204 QAction *volumeUpAct;
205 QAction *volumeDownAct;
206 QAction *volumeMuteAct;
207 QAction *findVideoPartsAct;
211 QAction *moveDownAct;
213 QAction *fetchMoreAct;
222 // toolbar & statusbar
223 QToolBar *mainToolBar;
224 SearchLineEdit *toolbarSearch;
225 QToolBar *statusToolBar;
226 QToolButton *regionButton;
227 QAction *regionAction;
231 #ifdef APP_PHONON_SEEK
232 Phonon::SeekSlider *seekSlider;
236 Phonon::VolumeSlider *volumeSlider;
237 Phonon::MediaObject *mediaObject;
238 Phonon::AudioOutput *audioOutput;
241 // QLabel *totalTime;
249 QLabel *messageLabel;
250 QTimer *messageTimer;