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/>.
39 class MainWindow : public QMainWindow {
43 static MainWindow *instance();
46 QSlider *getSeekSlider() { return seekSlider; }
47 QSlider *getVolumeSlider() { return volumeSlider; }
49 QLabel *getCurrentTimeLabel() { return currentTimeLabel; }
52 static void printHelp();
53 QStackedWidget *getViews() { return views; }
54 MediaView *getMediaView() { return mediaView; }
55 HomeView *getHomeView() { return homeView; }
56 QAction *getRegionAction() { return regionAction; }
57 SearchLineEdit *getToolbarSearch() { return toolbarSearch; }
59 void setupAction(QAction *action);
60 QAction *getAction(const char *name);
61 void addNamedAction(const QByteArray &name, QAction *action);
63 QMenu *getMenu(const char *name);
65 void showActionsInStatusBar(const QVector<QAction *> &actions, bool show);
66 void setStatusBarVisibility(bool show);
67 void adjustStatusBarVisibility();
73 void showActivationView();
78 void showMedia(SearchParams *params);
79 void showMedia(VideoSource *videoSource);
80 void showRegionsView();
82 void messageReceived(const QString &message);
84 void suggestionAccepted(Suggestion *suggestion);
85 void search(const QString &query);
86 bool canGoBack() { return history.size() > 1; }
88 void showMessage(const QString &message);
90 void handleError(const QString &message);
91 bool isReallyFullScreen();
92 bool isCompact() { return compactModeActive; }
93 void missingKeyWarning();
95 void setDefinitionMode(const QString &definitionName);
98 void currentTimeChanged(const QString &s);
102 void changeEvent(QEvent *e);
103 void closeEvent(QCloseEvent *e);
104 void showEvent(QShowEvent *e);
105 bool eventFilter(QObject *obj, QEvent *e);
106 void dragEnterEvent(QDragEnterEvent *e);
107 void dropEvent(QDropEvent *e);
108 void resizeEvent(QResizeEvent *e);
109 void leaveEvent(QEvent *e);
110 void enterEvent(QEvent *e);
114 void checkForUpdate();
118 void toggleFullscreen();
119 void updateUIForFullscreen();
120 void compactView(bool enable);
123 void toggleDefinitionMode();
124 void clearRecentKeywords();
127 void stateChanged(Media::State state);
128 void tick(qint64 time);
132 void toggleVolumeMute();
133 void volumeChanged(qreal newVolume);
134 void volumeMutedChanged(bool muted);
136 void updateDownloadMessage(const QString &);
137 void downloadsFinished();
138 void toggleDownloads(bool show);
140 void setManualPlay(bool enabled);
141 void floatOnTop(bool, bool showAction = true);
142 void showStopAfterThisInStatusBar(bool show);
143 void hideFullscreenUI();
145 void toggleMenuVisibility();
146 void toggleMenuVisibilityWithMessage();
147 void toggleToolbarMenu();
150 void rateOnAppStore();
155 void createActions();
157 void createToolBar();
158 void createStatusBar();
159 void showView(View *view, bool transition = false);
160 static QString formatTime(qint64 duration);
162 void simpleUpdateDialog(const QString &version);
163 bool needStatusBar();
164 void adjustMessageLabelPosition();
166 QHash<QByteArray, QAction *> actionMap;
167 QHash<QByteArray, QMenu *> menuMap;
170 QStackedWidget *views;
171 QStack<View *> history;
175 MediaView *mediaView;
186 QAction *searchFocusAct;
189 QAction *skipBackwardAct;
193 QAction *fullscreenAct;
194 QAction *compactViewAct;
196 QAction *copyPageAct;
197 QAction *copyLinkAct;
198 QAction *volumeUpAct;
199 QAction *volumeDownAct;
200 QAction *volumeMuteAct;
201 QAction *findVideoPartsAct;
205 QAction *moveDownAct;
207 QAction *fetchMoreAct;
216 // toolbar & statusbar
217 QToolBar *mainToolBar;
218 SearchLineEdit *toolbarSearch;
219 QToolBar *statusToolBar;
220 QAction *regionAction;
222 QSlider *volumeSlider;
223 QLabel *currentTimeLabel;
225 bool fullScreenActive;
226 bool maximizedBeforeFullScreen;
227 bool menuVisibleBeforeFullScreen;
228 QTimer *fullscreenTimer;
229 bool compactModeActive;
230 bool menuVisibleBeforeCompactMode;
233 QLabel *messageLabel;
234 QTimer *messageTimer;
236 ToolbarMenu *toolbarMenu;
237 QToolButton *toolbarMenuButton;