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);
117 void toggleFullscreen();
118 void updateUIForFullscreen();
119 void compactView(bool enable);
122 void toggleDefinitionMode();
123 void clearRecentKeywords();
126 void stateChanged(Media::State state);
127 void tick(qint64 time);
131 void toggleVolumeMute();
132 void volumeChanged(qreal newVolume);
133 void volumeMutedChanged(bool muted);
135 void updateDownloadMessage(const QString &);
136 void downloadsFinished();
137 void toggleDownloads(bool show);
139 void setManualPlay(bool enabled);
140 void floatOnTop(bool, bool showAction = true);
141 void showStopAfterThisInStatusBar(bool show);
142 void hideFullscreenUI();
144 void toggleMenuVisibility();
145 void toggleMenuVisibilityWithMessage();
146 void toggleToolbarMenu();
149 void rateOnAppStore();
154 void createActions();
156 void createToolBar();
157 void createStatusBar();
158 void showView(View *view, bool transition = false);
159 static QString formatTime(qint64 duration);
161 bool needStatusBar();
162 void adjustMessageLabelPosition();
164 QHash<QByteArray, QAction *> actionMap;
165 QHash<QByteArray, QMenu *> menuMap;
168 QStackedWidget *views;
169 QStack<View *> history;
173 MediaView *mediaView;
184 QAction *searchFocusAct;
187 QAction *skipBackwardAct;
191 QAction *fullscreenAct;
192 QAction *compactViewAct;
194 QAction *copyPageAct;
195 QAction *copyLinkAct;
196 QAction *volumeUpAct;
197 QAction *volumeDownAct;
198 QAction *volumeMuteAct;
199 QAction *findVideoPartsAct;
203 QAction *moveDownAct;
205 QAction *fetchMoreAct;
214 // toolbar & statusbar
215 QToolBar *mainToolBar;
216 SearchLineEdit *toolbarSearch;
217 QToolBar *statusToolBar;
218 QAction *regionAction;
220 QSlider *volumeSlider;
221 QLabel *currentTimeLabel;
223 bool fullScreenActive;
224 bool maximizedBeforeFullScreen;
225 bool menuVisibleBeforeFullScreen;
226 QTimer *fullscreenTimer;
227 bool compactModeActive;
228 bool menuVisibleBeforeCompactMode;
231 QLabel *messageLabel;
232 QTimer *messageTimer;
234 ToolbarMenu *toolbarMenu;
235 QToolButton *toolbarMenuButton;