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();
51 #ifdef APP_PHONON_SEEK
52 Phonon::SeekSlider* getSeekSlider() { return seekSlider; }
54 QSlider* getSlider() { return slider; }
57 Phonon::AudioOutput* getAudioOutput() { return audioOutput; }
58 Phonon::VolumeSlider *getVolumeSlider() { return volumeSlider; }
60 QLabel *getCurrentTimeLabel() { return currentTime; }
63 static void printHelp();
64 MediaView* getMediaView() { return mediaView; }
65 QToolButton* getRegionButton() { return regionButton; }
66 QAction* getRegionAction() { return regionAction; }
67 SearchLineEdit *getToolbarSearch() { return toolbarSearch; }
69 void showActionInStatusBar(QAction*, bool show);
70 void setStatusBarVisibility(bool show);
71 void adjustStatusBarVisibility();
74 void showHome(bool transition = true);
75 void showMedia(SearchParams *params);
76 void showMedia(VideoSource *videoSource);
77 void showRegionsView();
79 void messageReceived(const QString &message);
81 void suggestionAccepted(Suggestion *suggestion);
82 void search(const QString &query);
84 void showMessage(const QString &message);
86 void showActivationView(bool transition = true);
87 void showActivationDialog();
91 bool isReallyFullScreen();
92 bool isCompact() { return m_compact; }
95 void currentTimeChanged(const QString &s);
98 void changeEvent(QEvent *e);
99 void closeEvent(QCloseEvent *e);
100 void showEvent(QShowEvent *e);
101 bool eventFilter(QObject *obj, QEvent *e);
102 void dragEnterEvent(QDragEnterEvent *e);
103 void dropEvent(QDropEvent *e);
104 void resizeEvent(QResizeEvent *e);
105 void moveEvent(QMoveEvent *e);
109 void checkForUpdate();
110 void gotNewVersion(const QString &version);
116 void updateUIForFullscreen();
117 void compactView(bool enable);
120 void stateChanged(Phonon::State newState, Phonon::State oldState);
123 void tick(qint64 time);
124 void totalTimeChanged(qint64 time);
125 void setDefinitionMode(const QString &definitionName);
126 void toggleDefinitionMode();
127 void clearRecentKeywords();
133 void volumeChanged(qreal newVolume);
134 void volumeMutedChanged(bool muted);
136 // fullscreen toolbar
137 void showFullscreenToolbar(bool show);
138 void showFullscreenPlaylist(bool show);
140 void setManualPlay(bool enabled);
141 void updateDownloadMessage(const QString &);
142 void downloadsFinished();
143 void toggleDownloads(bool show);
145 void floatOnTop(bool, bool showAction = true);
146 void adjustWindowSizeChanged(bool enabled);
148 void showStopAfterThisInStatusBar(bool show);
153 void rateOnAppStore();
160 void createActions();
162 void createToolBars();
163 void createStatusBar();
164 void showWidget(QWidget*, bool transition = true);
165 static QString formatTime(qint64 duration);
167 void simpleUpdateDialog(const QString &version);
168 bool needStatusBar();
169 void adjustMessageLabelPosition();
171 UpdateChecker *updateChecker;
174 QStackedWidget *views;
175 QStack<QWidget*> history;
176 QList<QAction*> viewActions;
180 MediaView *mediaView;
182 QWidget *downloadView;
183 QWidget *regionsView;
191 QAction *searchFocusAct;
194 QAction *skipBackwardAct;
198 QAction *fullscreenAct;
199 QAction *compactViewAct;
201 QAction *copyPageAct;
202 QAction *copyLinkAct;
203 QAction *volumeUpAct;
204 QAction *volumeDownAct;
205 QAction *volumeMuteAct;
206 QAction *findVideoPartsAct;
210 QAction *moveDownAct;
212 QAction *fetchMoreAct;
221 // toolbar & statusbar
222 QToolBar *mainToolBar;
223 SearchLineEdit *toolbarSearch;
224 QToolBar *statusToolBar;
225 QToolButton *regionButton;
226 QAction *regionAction;
230 #ifdef APP_PHONON_SEEK
231 Phonon::SeekSlider *seekSlider;
235 Phonon::VolumeSlider *volumeSlider;
236 Phonon::MediaObject *mediaObject;
237 Phonon::AudioOutput *audioOutput;
240 // QLabel *totalTime;
247 QLabel *messageLabel;
248 QTimer *messageTimer;