]> git.sur5r.net Git - minitube/blobdiff - src/mainwindow.h
SearchLineEdit refactoring
[minitube] / src / mainwindow.h
index e20bae0187e8c32afe3f3b45329d1ca633d58e53..6cccabdb343f2401797d54ab4a93175d40e40bb0 100644 (file)
@@ -25,11 +25,12 @@ $END_LICENSE */
 #if QT_VERSION >= 0x050000
 #include <QtWidgets>
 #endif
+#ifdef APP_PHONON
 #include <phonon/audiooutput.h>
 #include <phonon/volumeslider.h>
 #include <phonon/mediaobject.h>
 #include <phonon/seekslider.h>
-#include "view.h"
+#endif
 
 class HomeView;
 class MediaView;
@@ -38,6 +39,7 @@ class SearchLineEdit;
 class UpdateChecker;
 class SearchParams;
 class VideoSource;
+class Suggestion;
 
 class MainWindow : public QMainWindow {
 
@@ -49,15 +51,25 @@ public:
     ~MainWindow();
 #ifdef APP_PHONON_SEEK
     Phonon::SeekSlider* getSeekSlider() { return seekSlider; }
-#endif
+#else
     QSlider* getSlider() { return slider; }
+#endif
+#ifdef APP_PHONON
+    Phonon::AudioOutput* getAudioOutput() { return audioOutput; }
+    Phonon::VolumeSlider *getVolumeSlider() { return volumeSlider; }
+#endif
+    QLabel *getCurrentTimeLabel() { return currentTime; }
     void readSettings();
     void writeSettings();
     static void printHelp();
     MediaView* getMediaView() { return mediaView; }
     QToolButton* getRegionButton() { return regionButton; }
     QAction* getRegionAction() { return regionAction; }
+    SearchLineEdit *getToolbarSearch() { return toolbarSearch; }
+
     void showActionInStatusBar(QAction*, bool show);
+    void setStatusBarVisibility(bool show);
+    void adjustStatusBarVisibility();
 
 public slots:
     void showHome(bool transition = true);
@@ -67,9 +79,10 @@ public slots:
     void restore();
     void messageReceived(const QString &message);
     void quit();
-    void startToolbarSearch(QString query);
+    void suggestionAccepted(Suggestion *suggestion);
+    void search(const QString &query);
     void goBack();
-    void showMessage(QString message);
+    void showMessage(const QString &message);
 #ifdef APP_ACTIVATION
     void showActivationView(bool transition = true);
     void showActivationDialog();
@@ -79,18 +92,23 @@ public slots:
     bool isReallyFullScreen();
     bool isCompact() { return m_compact; }
 
+signals:
+    void currentTimeChanged(const QString &s);
+
 protected:
-    void changeEvent(QEvent *);
-    void closeEvent(QCloseEvent *);
-    bool eventFilter(QObject *obj, QEvent *event);
-    void dragEnterEvent(QDragEnterEvent *event);
-    void dropEvent(QDropEvent *event);
-    void resizeEvent(QResizeEvent *);
+    void changeEvent(QEvent *e);
+    void closeEvent(QCloseEvent *e);
+    void showEvent(QShowEvent *e);
+    bool eventFilter(QObject *obj, QEvent *e);
+    void dragEnterEvent(QDragEnterEvent *e);
+    void dropEvent(QDropEvent *e);
+    void resizeEvent(QResizeEvent *e);
+    void moveEvent(QMoveEvent *e);
 
 private slots:
     void lazyInit();
     void checkForUpdate();
-    void gotNewVersion(QString version);
+    void gotNewVersion(const QString &version);
     void visitSite();
     void donate();
     void reportIssue();
@@ -99,11 +117,13 @@ private slots:
     void updateUIForFullscreen();
     void compactView(bool enable);
     void stop();
+#ifdef APP_PHONON
     void stateChanged(Phonon::State newState, Phonon::State oldState);
+#endif
     void searchFocus();
     void tick(qint64 time);
     void totalTimeChanged(qint64 time);
-    void setDefinitionMode(QString definitionName);
+    void setDefinitionMode(const QString &definitionName);
     void toggleDefinitionMode();
     void clearRecentKeywords();
 
@@ -119,25 +139,35 @@ private slots:
     void showFullscreenPlaylist(bool show);
 
     void setManualPlay(bool enabled);
-    void updateDownloadMessage(QString);
+    void updateDownloadMessage(const QString &);
     void downloadsFinished();
     void toggleDownloads(bool show);
 
-    void floatOnTop(bool);
+    void floatOnTop(bool, bool showAction = true);
+    void adjustWindowSizeChanged(bool enabled);
+
     void showStopAfterThisInStatusBar(bool show);
 
     void hideMouse();
 
+#ifdef APP_MAC_STORE
+    void rateOnAppStore();
+#endif
+
 private:
+#ifdef APP_PHONON
     void initPhonon();
+#endif
     void createActions();
     void createMenus();
     void createToolBars();
     void createStatusBar();
     void showWidget(QWidget*, bool transition = true);
-    static QString formatTime(qint64 time);
+    static QString formatTime(qint64 duration);
     bool confirmQuit();
-    void simpleUpdateDialog(QString version);
+    void simpleUpdateDialog(const QString &version);
+    bool needStatusBar();
+    void adjustMessageLabelPosition();
 
     UpdateChecker *updateChecker;
 
@@ -197,15 +227,18 @@ private:
     QAction *regionAction;
 
     // phonon
-    QSlider *slider;
+#ifdef APP_PHONON
 #ifdef APP_PHONON_SEEK
     Phonon::SeekSlider *seekSlider;
+#else
+    QSlider *slider;
 #endif
     Phonon::VolumeSlider *volumeSlider;
     Phonon::MediaObject *mediaObject;
     Phonon::AudioOutput *audioOutput;
+#endif
     QLabel *currentTime;
-    QLabel *totalTime;
+    // QLabel *totalTime;
 
     // fullscreen
     bool m_fullscreen;
@@ -213,6 +246,9 @@ private:
     QTimer *mouseTimer;
     bool m_compact;
 
+    QLabel *messageLabel;
+    QTimer *messageTimer;
+
 };
 
 #endif