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 void showActionInStatusBar(QAction*, bool show);
69 void setStatusBarVisibility(bool show);
70 void adjustStatusBarVisibility();
73 void showHome(bool transition = true);
74 void showMedia(SearchParams *params);
75 void showMedia(VideoSource *videoSource);
76 void showRegionsView();
78 void messageReceived(const QString &message);
80 void suggestionAccepted(Suggestion *suggestion);
81 void search(const QString &query);
83 void showMessage(const QString &message);
85 void showActivationView(bool transition = true);
86 void showActivationDialog();
90 bool isReallyFullScreen();
91 bool isCompact() { return m_compact; }
94 void currentTimeChanged(const QString &s);
97 void changeEvent(QEvent *e);
98 void closeEvent(QCloseEvent *e);
99 void showEvent(QShowEvent *e);
100 bool eventFilter(QObject *obj, QEvent *e);
101 void dragEnterEvent(QDragEnterEvent *e);
102 void dropEvent(QDropEvent *e);
103 void resizeEvent(QResizeEvent *e);
104 void moveEvent(QMoveEvent *e);
108 void checkForUpdate();
109 void gotNewVersion(const QString &version);
115 void updateUIForFullscreen();
116 void compactView(bool enable);
119 void stateChanged(Phonon::State newState, Phonon::State oldState);
122 void tick(qint64 time);
123 void totalTimeChanged(qint64 time);
124 void setDefinitionMode(const QString &definitionName);
125 void toggleDefinitionMode();
126 void clearRecentKeywords();
132 void volumeChanged(qreal newVolume);
133 void volumeMutedChanged(bool muted);
135 // fullscreen toolbar
136 void showFullscreenToolbar(bool show);
137 void showFullscreenPlaylist(bool show);
139 void setManualPlay(bool enabled);
140 void updateDownloadMessage(const QString &);
141 void downloadsFinished();
142 void toggleDownloads(bool show);
144 void floatOnTop(bool, bool showAction = true);
145 void adjustWindowSizeChanged(bool enabled);
147 void showStopAfterThisInStatusBar(bool show);
152 void rateOnAppStore();
159 void createActions();
161 void createToolBars();
162 void createStatusBar();
163 void showWidget(QWidget*, bool transition = true);
164 static QString formatTime(qint64 duration);
166 void simpleUpdateDialog(const QString &version);
167 bool needStatusBar();
168 void adjustMessageLabelPosition();
170 UpdateChecker *updateChecker;
173 QStackedWidget *views;
174 QStack<QWidget*> *history;
175 QList<QAction*> viewActions;
179 MediaView *mediaView;
181 QWidget *downloadView;
182 QWidget *regionsView;
190 QAction *searchFocusAct;
193 QAction *skipBackwardAct;
197 QAction *fullscreenAct;
198 QAction *compactViewAct;
200 QAction *copyPageAct;
201 QAction *copyLinkAct;
202 QAction *volumeUpAct;
203 QAction *volumeDownAct;
204 QAction *volumeMuteAct;
205 QAction *findVideoPartsAct;
209 QAction *moveDownAct;
211 QAction *fetchMoreAct;
220 // toolbar & statusbar
221 QToolBar *mainToolBar;
222 SearchLineEdit *toolbarSearch;
223 QToolBar *statusToolBar;
224 QToolButton *regionButton;
225 QAction *regionAction;
229 #ifdef APP_PHONON_SEEK
230 Phonon::SeekSlider *seekSlider;
234 Phonon::VolumeSlider *volumeSlider;
235 Phonon::MediaObject *mediaObject;
236 Phonon::AudioOutput *audioOutput;
239 // QLabel *totalTime;
247 QLabel *messageLabel;
248 QTimer *messageTimer;