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; }
62 static void printHelp();
63 MediaView* getMediaView() { return mediaView; }
64 QToolButton* getRegionButton() { return regionButton; }
65 QAction* getRegionAction() { return regionAction; }
66 void showActionInStatusBar(QAction*, bool show);
69 void showHome(bool transition = true);
70 void showMedia(SearchParams *params);
71 void showMedia(VideoSource *videoSource);
72 void showRegionsView();
74 void messageReceived(const QString &message);
76 void suggestionAccepted(Suggestion *suggestion);
77 void search(const QString &query);
79 void showMessage(QString message);
81 void showActivationView(bool transition = true);
82 void showActivationDialog();
86 bool isReallyFullScreen();
87 bool isCompact() { return m_compact; }
90 void changeEvent(QEvent *);
91 void closeEvent(QCloseEvent *);
92 bool eventFilter(QObject *obj, QEvent *event);
93 void dragEnterEvent(QDragEnterEvent *event);
94 void dropEvent(QDropEvent *event);
95 void resizeEvent(QResizeEvent *);
99 void checkForUpdate();
100 void gotNewVersion(QString version);
106 void updateUIForFullscreen();
107 void compactView(bool enable);
110 void stateChanged(Phonon::State newState, Phonon::State oldState);
113 void tick(qint64 time);
114 void totalTimeChanged(qint64 time);
115 void setDefinitionMode(QString definitionName);
116 void toggleDefinitionMode();
117 void clearRecentKeywords();
123 void volumeChanged(qreal newVolume);
124 void volumeMutedChanged(bool muted);
126 // fullscreen toolbar
127 void showFullscreenToolbar(bool show);
128 void showFullscreenPlaylist(bool show);
130 void setManualPlay(bool enabled);
131 void updateDownloadMessage(QString);
132 void downloadsFinished();
133 void toggleDownloads(bool show);
135 void floatOnTop(bool);
136 void showStopAfterThisInStatusBar(bool show);
141 void rateOnAppStore();
148 void createActions();
150 void createToolBars();
151 void createStatusBar();
152 void showWidget(QWidget*, bool transition = true);
153 static QString formatTime(qint64 time);
155 void simpleUpdateDialog(QString version);
157 UpdateChecker *updateChecker;
160 QStackedWidget *views;
161 QStack<QWidget*> *history;
162 QList<QAction*> viewActions;
166 MediaView *mediaView;
168 QWidget *downloadView;
169 QWidget *regionsView;
177 QAction *searchFocusAct;
180 QAction *skipBackwardAct;
184 QAction *fullscreenAct;
185 QAction *compactViewAct;
187 QAction *copyPageAct;
188 QAction *copyLinkAct;
189 QAction *volumeUpAct;
190 QAction *volumeDownAct;
191 QAction *volumeMuteAct;
192 QAction *findVideoPartsAct;
196 QAction *moveDownAct;
198 QAction *fetchMoreAct;
207 // toolbar & statusbar
208 QToolBar *mainToolBar;
209 SearchLineEdit *toolbarSearch;
210 QToolBar *statusToolBar;
211 QToolButton *regionButton;
212 QAction *regionAction;
216 #ifdef APP_PHONON_SEEK
217 Phonon::SeekSlider *seekSlider;
221 Phonon::VolumeSlider *volumeSlider;
222 Phonon::MediaObject *mediaObject;
223 Phonon::AudioOutput *audioOutput;
226 // QLabel *totalTime;