]> git.sesse.net Git - vlc/commitdiff
Some progress
authorClément Stenac <zorglub@videolan.org>
Mon, 29 May 2006 17:28:15 +0000 (17:28 +0000)
committerClément Stenac <zorglub@videolan.org>
Mon, 29 May 2006 17:28:15 +0000 (17:28 +0000)
modules/gui/qt4/Modules.am
modules/gui/qt4/dialogs/streaminfo.cpp
modules/gui/qt4/dialogs/streaminfo.hpp
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.hpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp
modules/gui/qt4/util/input_slider.cpp [new file with mode: 0644]
modules/gui/qt4/util/input_slider.hpp [new file with mode: 0644]

index 84bcd124b0c890db05c9be92693bdd0b1bc17782..ed292f2748974a209e9fd40c6a9e014820ba9ffe 100644 (file)
@@ -16,7 +16,8 @@ TOMOC = main_interface \
        input_manager \
        dialogs/playlist \
        dialogs/streaminfo \
-       components/infopanels
+       components/infopanels \
+       util/input_slider
 MOCCPP := $(TOMOC:%=%.moc.cpp)
 
 if ENABLE_QT4
@@ -28,7 +29,8 @@ BUILT_SOURCES +=  \
                input_manager.moc.cpp \
                dialogs/playlist.moc.cpp \
                dialogs/streaminfo.moc.cpp \
-               components/infopanels.moc.cpp
+               components/infopanels.moc.cpp \
+               util/input_slider.moc.cpp
 
 $(MOCCPP): %.moc.cpp: %.hpp
        @echo "MOC $< -> $@"
@@ -46,7 +48,8 @@ nodist_SOURCES_qt4 = \
                input_manager.moc.cpp \
                dialogs/playlist.moc.cpp \
                dialogs/streaminfo.moc.cpp \
-               components/infopanels.moc.cpp
+               components/infopanels.moc.cpp \
+               util/input_slider.moc.cpp
 
 endif
 
@@ -56,7 +59,8 @@ SOURCES_qt4 =         qt4.cpp \
                input_manager.cpp \
                dialogs/playlist.cpp \
                dialogs/streaminfo.cpp \
-               components/infopanels.cpp
+               components/infopanels.cpp \
+               util/input_slider.cpp
                $(NULL)
 
 EXTRA_DIST += \
@@ -67,4 +71,5 @@ EXTRA_DIST += \
        dialogs/playlist.hpp \
        dialogs/streaminfo.hpp \
        components/infopanels.hpp \
+       util/input_slider.hpp \
        ui/input_stats.ui
index b27b0cd8d327588f1ba099454fd0759ff19ec2e0..8543d12ba68afabfde284cb0deab55e9e48df9b8 100644 (file)
@@ -36,13 +36,16 @@ StreamInfoDialog::StreamInfoDialog( intf_thread_t *_p_intf ) : QVLCFrame( p_intf
 
      fprintf( stderr, "CONNECTING\n");
 
-    QObject::connect( DialogsProvider::getInstance(NULL)->fixed_timer, SIGNAL( timeout() ), DialogsProvider::getInstance(NULL), SLOT( messagesDialog() )) ;
-
-    QObject::connect( DialogsProvider::getInstance(NULL)->fixed_timer, SIGNAL( timeout() ), this, SLOT(update() ) );
 
      fprintf( stderr, "Done\n");
 }
 
+void StreamInfoDialog::init()
+{
+    QObject::connect( DialogsProvider::getInstance(NULL)->fixed_timer,
+                     SIGNAL( timeout() ), this, SLOT(update() ) );
+}
+
 void StreamInfoDialog::update()
 {
     fprintf( stderr, "timer\n");
index 061bba1f5932b13b9ec8a1a0eb16d50d2786c428..6c1c72a49b73e0861864cd640c0e46db52ed3768 100644 (file)
@@ -31,16 +31,22 @@ class StreamInfoDialog : public QVLCFrame
 public:
     static StreamInfoDialog * getInstance( intf_thread_t *p_intf )
     {
-        if( !instance) instance = new StreamInfoDialog( p_intf );
+        if( !instance)
+       {
+           instance = new StreamInfoDialog( p_intf );
+           instance->init();
+       }
         return instance;
     }
     virtual ~StreamInfoDialog();
 private:
     StreamInfoDialog( intf_thread_t * );
+    void init();
+
     intf_thread_t *p_intf;
     static StreamInfoDialog *instance;
 public slots:
-        void update();
+    void update();
 };
 
 
index 531a7c0ddefc68f3a565b23f83da99ebe207b54d..26f6ea3ef7b10b73f1150a5a99d5ef3d09e65216 100644 (file)
@@ -59,5 +59,4 @@ void InputManager::update()
     f_pos = var_GetFloat( p_input, "position" );
 
     emit positionUpdated( f_pos, i_time, i_length );
-
 }
index 79efe6cebab2c5cd0ba5d8b6fd80d142c02c2c56..8c86878efc8c188d14022bb8f790173382d5c2bf 100644 (file)
@@ -33,7 +33,6 @@ class InputManager : public QObject
 public:
     InputManager( QObject *, intf_thread_t *);
     virtual ~InputManager();
-    void setInput( input_thread_t * );
 
 private:
     intf_thread_t *p_intf;
@@ -41,6 +40,7 @@ private:
 
 public slots:
     void update(); ///< Periodic updates
+    void setInput( input_thread_t * ); ///< Our controlled input changed
     void sliderUpdate( float ); ///< User dragged the slider. We get new pos
 signals:
     /// Send new position, new time and new length
index 4f7fc3d4c6cb2d0a27eae57813c23abeafa65b26..ae40ad36b2d7b156e6cd080c934e06b424b99de4 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
 
 #include "main_interface.hpp"
+#include "input_manager.hpp"
+#include "dialogs_provider.hpp"
 
 MainInterface::MainInterface( intf_thread_t *p_intf ) : QWidget( NULL )
 {
-    fprintf( stderr, "QT Main interface" );
+    fprintf( stderr, "QT Main interface\n" );
+
+    /* Init UI */
+
+    /* Init input manager */
+}
+
+void MainInterface::init()
+{
+    /* Get timer updates */
+    QObject::connect( DialogsProvider::getInstance(NULL)->fixed_timer,
+                     SIGNAL( timeout() ), this, SLOT(updateOnTimer() ) );
+    /* Tell input manager about the input changes */
+    QObject::connect( this, SIGNAL( inputChanged( input_thread_t * ) ),
+                  main_input_manager, SLOT( setInput( input_thread_t * ) ) );
 }
 
 MainInterface::~MainInterface()
 {
 }
+
+void MainInterface::updateOnTimer()
+{
+
+}
index 4c7bf2d588522cdf70f475059d87b699771124b8..3e5886c51ded87640121658a8d081c4f9604b220 100644 (file)
 #include <vlc/intf.h>
 #include <QWidget>
 
+class InputManager;
+
 class MainInterface : public QWidget
 {
     Q_OBJECT;
 public:
     MainInterface( intf_thread_t *);
     virtual ~MainInterface();
+    void init();
+private:
+    InputManager *main_input_manager;
+private slots:
+    void updateOnTimer();
 };
 
 #endif
diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
new file mode 100644 (file)
index 0000000..a153acc
--- /dev/null
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * input_manager.cpp : Manage an input and interact with its GUI elements
+ ****************************************************************************
+ * Copyright (C) 2000-2005 the VideoLAN team
+ * $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
+ *
+ * Authors: Clément Stenac <zorglub@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include "util/input_slider.hpp"
+
+void InputSlider::init()
+{
+    setMinimum( 0 );
+    setMaximum( 1000 );
+    setSingleStep( 2 );
+    setPageStep( 100 );
+    setTracking( true );
+    QObject::connect( this, SIGNAL( valueChanged(int) ), this,
+                     SLOT( userDrag( int ) ) );
+}
+
+void InputSlider::setPosition( float pos, int a, int b )
+{
+    setValue( (int)(pos * 1000.0 ) );
+}
+
+void InputSlider::userDrag( int new_value )
+{
+    float f_pos = (float)(new_value)/1000.0;
+    emit positionUpdated( f_pos );
+}
diff --git a/modules/gui/qt4/util/input_slider.hpp b/modules/gui/qt4/util/input_slider.hpp
new file mode 100644 (file)
index 0000000..b4618e6
--- /dev/null
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * input_slider.hpp : A slider that controls an input
+ ****************************************************************************
+ * Copyright (C) 2000-2005 the VideoLAN team
+ * $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
+ *
+ * Authors: Clément Stenac <zorglub@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
+
+#ifndef _INPUTSLIDER_H_
+#define _INPUTSLIDER_H_
+
+#include "util/directslider.hpp"
+
+class InputSlider : public DirectSlider
+{
+    Q_OBJECT
+public:
+    InputSlider( QWidget *_parent ) : DirectSlider( _parent ) {};
+    InputSlider( Qt::Orientation q,QWidget *_parent ) : DirectSlider( q,_parent )
+    {};
+    virtual ~InputSlider()   {};
+    void init();
+public slots:
+    void setPosition( float, int, int );
+private slots:
+    void userDrag( int );
+signals:
+    void positionUpdated( float );
+};
+#endif