X-Git-Url: https://git.sur5r.net/?p=minitube;a=blobdiff_plain;f=src%2Fmainwindow.h;h=e377a2fe3fd5bd8bec8af55161382a42c8a5bd77;hp=eb1058f4874a7828603b5a928e8a6c67b2e407b4;hb=533489a63a9716c645a11a99ca446978b20eedd0;hpb=994e6e5e95196b0e36c680b1fd496f12d71739c9 diff --git a/src/mainwindow.h b/src/mainwindow.h index eb1058f..e377a2f 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -21,10 +21,7 @@ $END_LICENSE */ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include -#if QT_VERSION >= 0x050000 #include -#endif #ifdef APP_PHONON #include #include @@ -35,11 +32,13 @@ $END_LICENSE */ class HomeView; class MediaView; class DownloadView; + class SearchLineEdit; class UpdateChecker; class SearchParams; class VideoSource; class Suggestion; +class ToolbarMenu; class MainWindow : public QMainWindow { @@ -57,21 +56,34 @@ public: Phonon::AudioOutput* getAudioOutput() { return audioOutput; } Phonon::VolumeSlider *getVolumeSlider() { return volumeSlider; } #endif - QLabel *getCurrentTimeLabel() { return currentTime; } + QLabel *getCurrentTimeLabel() { return currentTimeLabel; } void readSettings(); void writeSettings(); static void printHelp(); + QStackedWidget *getViews() { return views; } MediaView* getMediaView() { return mediaView; } - QToolButton* getRegionButton() { return regionButton; } + HomeView* getHomeView() { return homeView; } QAction* getRegionAction() { return regionAction; } SearchLineEdit *getToolbarSearch() { return toolbarSearch; } + QAction *getAction(const char *name); + void addNamedAction(const QByteArray &name, QAction *action); + + QMenu *getMenu(const char *name); + void showActionInStatusBar(QAction*, bool show); void setStatusBarVisibility(bool show); void adjustStatusBarVisibility(); + void hideToolbar(); + void showToolbar(); + +#ifdef APP_ACTIVATION + void showActivationView(); +#endif + public slots: - void showHome(bool transition = true); + void showHome(); void showMedia(SearchParams *params); void showMedia(VideoSource *videoSource); void showRegionsView(); @@ -80,19 +92,18 @@ public slots: void quit(); void suggestionAccepted(Suggestion *suggestion); void search(const QString &query); + bool canGoBack() { return history.size() > 1; } void goBack(); void showMessage(const QString &message); -#ifdef APP_ACTIVATION - void showActivationView(bool transition = true); - void showActivationDialog(); - void buy(); - void hideBuyAction(); -#endif + void hideMessage(); bool isReallyFullScreen(); - bool isCompact() { return m_compact; } + bool isCompact() { return compactModeActive; } + void missingKeyWarning(); + void visitSite(); signals: void currentTimeChanged(const QString &s); + void viewChanged(); protected: void changeEvent(QEvent *e); @@ -103,16 +114,17 @@ protected: void dropEvent(QDropEvent *e); void resizeEvent(QResizeEvent *e); void moveEvent(QMoveEvent *e); + void leaveEvent(QEvent *e); + void enterEvent(QEvent *e); private slots: void lazyInit(); void checkForUpdate(); void gotNewVersion(const QString &version); - void visitSite(); void donate(); void reportIssue(); void about(); - void fullscreen(); + void toggleFullscreen(); void updateUIForFullscreen(); void compactView(bool enable); void stop(); @@ -126,28 +138,23 @@ private slots: void toggleDefinitionMode(); void clearRecentKeywords(); - // volume shortcuts void volumeUp(); void volumeDown(); void volumeMute(); - void volumeChanged(qreal newVolume); void volumeMutedChanged(bool muted); - // fullscreen toolbar - void showFullscreenToolbar(bool show); - void showFullscreenPlaylist(bool show); - - void setManualPlay(bool enabled); void updateDownloadMessage(const QString &); void downloadsFinished(); void toggleDownloads(bool show); + void setManualPlay(bool enabled); void floatOnTop(bool, bool showAction = true); - void adjustWindowSizeChanged(bool enabled); - void showStopAfterThisInStatusBar(bool show); + void hideFullscreenUI(); - void hideMouse(); + void toggleMenuVisibility(); + void toggleMenuVisibilityWithMessage(); + void toggleToolbarMenu(); #ifdef APP_MAC_STORE void rateOnAppStore(); @@ -170,10 +177,13 @@ private: UpdateChecker *updateChecker; + QHash actionMap; + QHash menuMap; + // view mechanism QStackedWidget *views; QStack history; - QList viewActions; + // QVector viewActions; // view widgets HomeView *homeView; @@ -222,7 +232,6 @@ private: QToolBar *mainToolBar; SearchLineEdit *toolbarSearch; QToolBar *statusToolBar; - QToolButton *regionButton; QAction *regionAction; // phonon @@ -236,18 +245,21 @@ private: Phonon::MediaObject *mediaObject; Phonon::AudioOutput *audioOutput; #endif - QLabel *currentTime; - // QLabel *totalTime; - - bool fullscreenFlag; - bool m_maximized; - QTimer *mouseTimer; - bool m_compact; + QLabel *currentTimeLabel; + + bool fullScreenActive; + bool maximizedBeforeFullScreen; + bool menuVisibleBeforeFullScreen; + QTimer *fullscreenTimer; + bool compactModeActive; + bool menuVisibleBeforeCompactMode; bool initialized; QLabel *messageLabel; QTimer *messageTimer; + ToolbarMenu *toolbarMenu; + QToolButton *toolbarMenuButton; }; #endif