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 #include <phonon/audiooutput.h>
26 #include <phonon/volumeslider.h>
27 #include <phonon/mediaobject.h>
28 #include <phonon/seekslider.h>
39 class MainWindow : public QMainWindow {
44 static MainWindow* instance();
47 Phonon::SeekSlider* getSeekSlider() { return seekSlider; }
50 static void printHelp();
51 MediaView* getMediaView() { return mediaView; }
52 QToolButton* getRegionButton() { return regionButton; }
53 QAction* getRegionAction() { return regionAction; }
54 void showActionInStatusBar(QAction*, bool show);
57 void showHome(bool transition = true);
58 void showMedia(SearchParams *params);
59 void showMedia(VideoSource *videoSource);
60 void showRegionsView();
62 void messageReceived(const QString &message);
64 void startToolbarSearch(QString query);
66 void showMessage(QString message);
68 void showActivationView(bool transition = true);
69 void showActivationDialog();
73 bool isReallyFullScreen();
74 bool isCompact() { return m_compact; }
77 void changeEvent(QEvent *);
78 void closeEvent(QCloseEvent *);
79 bool eventFilter(QObject *obj, QEvent *event);
80 void dragEnterEvent(QDragEnterEvent *event);
81 void dropEvent(QDropEvent *event);
82 void resizeEvent(QResizeEvent *);
86 void checkForUpdate();
87 void gotNewVersion(QString version);
93 void updateUIForFullscreen();
94 void compactView(bool enable);
96 void stateChanged(Phonon::State newState, Phonon::State oldState);
98 void tick(qint64 time);
99 void totalTimeChanged(qint64 time);
100 void setDefinitionMode(QString definitionName);
101 void toggleDefinitionMode();
102 void clearRecentKeywords();
108 void volumeChanged(qreal newVolume);
109 void volumeMutedChanged(bool muted);
111 // fullscreen toolbar
112 void showFullscreenToolbar(bool show);
113 void showFullscreenPlaylist(bool show);
115 void setManualPlay(bool enabled);
116 void updateDownloadMessage(QString);
117 void downloadsFinished();
118 void toggleDownloads(bool show);
120 void floatOnTop(bool);
121 void showStopAfterThisInStatusBar(bool show);
127 void createActions();
129 void createToolBars();
130 void createStatusBar();
131 void showWidget(QWidget*, bool transition = true);
132 static QString formatTime(qint64 time);
134 void simpleUpdateDialog(QString version);
136 UpdateChecker *updateChecker;
139 QStackedWidget *views;
140 QStack<QWidget*> *history;
141 QList<QAction*> viewActions;
145 MediaView *mediaView;
147 QWidget *downloadView;
148 QWidget *regionsView;
151 QAction *addGadgetAct;
157 QAction *searchFocusAct;
160 QAction *skipBackwardAct;
164 QAction *fullscreenAct;
165 QAction *compactViewAct;
167 QAction *copyPageAct;
168 QAction *copyLinkAct;
169 QAction *volumeUpAct;
170 QAction *volumeDownAct;
171 QAction *volumeMuteAct;
172 QAction *findVideoPartsAct;
176 QAction *moveDownAct;
178 QAction *fetchMoreAct;
187 // toolbar & statusbar
188 QToolBar *mainToolBar;
189 SearchLineEdit *toolbarSearch;
190 QToolBar *statusToolBar;
191 QToolButton *regionButton;
192 QAction *regionAction;
195 Phonon::SeekSlider *seekSlider;
196 Phonon::VolumeSlider *volumeSlider;
197 Phonon::MediaObject *mediaObject;
198 Phonon::AudioOutput *audioOutput;