]> git.sesse.net Git - vlc/commitdiff
A bunch of various fixes (encoding, refcount, layout)
authorClément Stenac <zorglub@videolan.org>
Tue, 18 Jul 2006 23:20:06 +0000 (23:20 +0000)
committerClément Stenac <zorglub@videolan.org>
Tue, 18 Jul 2006 23:20:06 +0000 (23:20 +0000)
modules/gui/qt4/Modules.am
modules/gui/qt4/components/playlist/selector.cpp [new file with mode: 0644]
modules/gui/qt4/components/playlist/selector.hpp
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/components/preferences.cpp
modules/gui/qt4/components/preferences_widgets.cpp
modules/gui/qt4/dialogs/playlist.cpp
modules/gui/qt4/dialogs/playlist.hpp
modules/gui/qt4/dialogs/prefs_dialog.cpp
modules/gui/qt4/menus.cpp
modules/gui/qt4/qt4.hpp

index 125c765bc45df26064598e873f0a7a2755cf5b34..753195d7973ad664a51ff28c5f8c3790e9a192d7 100644 (file)
@@ -30,6 +30,7 @@ TOMOC = main_interface \
        components/open \
        components/video_widget \
        components/playlist/panels \
+       components/playlist/selector \
        util/input_slider
 MOCCPP = $(TOMOC:%=%.moc.cpp)
 
@@ -49,6 +50,7 @@ nodist_SOURCES_qt4 = \
                components/open.moc.cpp \
                components/video_widget.moc.cpp \
                components/playlist/panels.moc.cpp \
+               components/playlist/selector.moc.cpp \
                util/input_slider.moc.cpp \
                resources.cpp
 
@@ -87,6 +89,7 @@ SOURCES_qt4 =         qt4.cpp \
                components/open.cpp \
                components/video_widget.cpp \
                components/playlist/standardpanel.cpp \
+               components/playlist/selector.cpp \
                util/input_slider.cpp \
                $(NULL)
 
@@ -108,7 +111,7 @@ EXTRA_DIST += \
        components/open.hpp \
        components/video_widget.hpp \
        components/playlist/panels.hpp \
-        components/playlist/selector.hpp \
+    components/playlist/selector.hpp \
        util/input_slider.hpp \
        util/directslider.hpp \
        util/qvlcframe.hpp \
diff --git a/modules/gui/qt4/components/playlist/selector.cpp b/modules/gui/qt4/components/playlist/selector.cpp
new file mode 100644 (file)
index 0000000..3e6eee2
--- /dev/null
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * selector.cpp : Playlist source selector
+ ****************************************************************************
+ * Copyright (C) 2000-2005 the VideoLAN team
+ * $Id: standardpanel.cpp 16024 2006-07-13 13:51:05Z xtophe $
+ *
+ * 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 "components/playlist/selector.hpp"
+
+PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
+{
+    p_intf = _p_intf;
+}
+
+PLSelector::~PLSelector()
+{
+}
+                                        
index 0e4e41de369d41096447aa31b4c66a60b0fbf766..7a5931b4c5cd67ebe4de229b8251899d12486efe 100644 (file)
@@ -32,10 +32,7 @@ class PLSelector: public QWidget
 {
     Q_OBJECT;
 public:
-    PLSelector( QWidget *p, intf_thread_t *_p_intf ) : QWidget( p )
-    {
-        p_intf = _p_intf;
-    }
+    PLSelector( QWidget *p, intf_thread_t *_p_intf );
     virtual ~PLSelector();
 private:
     intf_thread_t *p_intf;
index 5a8457b7f3618562bf12dfe4770d4822d79d74c5..671f8bb99c493bb20ca65ebfffa0fd3ce5c1597d 100644 (file)
@@ -30,12 +30,10 @@ StandardPLPanel::StandardPLPanel( QWidget *_parent, intf_thread_t *_p_intf,
                                   playlist_item_t *p_root ):
                                   PLPanel( _parent, _p_intf )
 {
-   
     PLModel *model = new PLModel( p_playlist, p_root, -1, this );
-    QTreeView *view = new QTreeView( 0 );
+    QTreeView *view = new QTreeView( this );
     view->setModel(model);
     model->Rebuild();
-    view->show();
 }
 
 StandardPLPanel::~StandardPLPanel()
index fc5c765e2f6d723f62c7973641f071bfedce399f..e7de207241f3d70937349b297564cd82624ecdb0 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "components/preferences.hpp"
 #include "components/preferences_widgets.hpp"
+#include "qt4.hpp"
 #include <vlc_config_cat.h>
 #include <assert.h>
 
@@ -351,6 +352,7 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             msg_Warn( p_intf, "unable to create preferences (main not found)");
             return;
         }
+        if( p_module ) vlc_object_yield( p_module );
         vlc_list_release( p_list );
     }
 
@@ -398,6 +400,7 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
     QVBoxLayout *boxlayout = NULL;
 
     QScrollArea *scroller= new QScrollArea;
+    scroller->setFrameStyle( QFrame::NoFrame );
     QWidget *scrolled_area = new QWidget;
 
     QVBoxLayout *layout = new QVBoxLayout();
@@ -420,7 +423,7 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
                 box->setLayout( boxlayout );
                 layout->addWidget( box, 1 );
             }
-            box = new QGroupBox( p_item->psz_text );
+            box = new QGroupBox( qfu(p_item->psz_text) );
             boxlayout = new QVBoxLayout();
         }
 
@@ -450,6 +453,8 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
         layout->addWidget( box, 1 );
     }
 
+    vlc_object_release( p_module );
+
     scrolled_area->setSizePolicy( QSizePolicy::Preferred,QSizePolicy::Fixed );
     scrolled_area->setLayout( layout );
     scroller->setWidget( scrolled_area );
index 7818f0f18da84f912167c1a87596acd65ff98ede..dc2960e6984b5b16c34cd73ce871fb012be52a22 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 #include "components/preferences_widgets.hpp"
-
+#include "qt4.hpp"
 #include <QLineEdit>
 #include <QString>
 #include <QSpinBox>
@@ -82,10 +82,10 @@ StringConfigControl::StringConfigControl( vlc_object_t *_p_this,
                      module_config_t *p_item, QWidget *_parent, bool pwd )
                            : VStringConfigControl( _p_this, p_item, _parent )
 {
-    QLabel *label = new QLabel( p_item->psz_text );
-    text = new QLineEdit( p_item->psz_value );
-    text->setToolTip( p_item->psz_longtext );
-    label->setToolTip( p_item->psz_longtext );
+    QLabel *label = new QLabel( qfu(p_item->psz_text) );
+    text = new QLineEdit( qfu(p_item->psz_value) );
+    text->setToolTip( qfu(p_item->psz_longtext) );
+    label->setToolTip( qfu(p_item->psz_longtext) );
 
     QHBoxLayout *layout = new QHBoxLayout();
     layout->addWidget( label, 0 ); layout->addWidget( text, 1 );
@@ -105,13 +105,13 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
     vlc_list_t *p_list;
     module_t *p_parser;
 
-    QLabel *label = new QLabel( p_item->psz_text );
+    QLabel *label = new QLabel( qfu(p_item->psz_text) );
     combo = new QComboBox();
     combo->setEditable( false );
 
     /* build a list of available modules */
     p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
-    combo->addItem( "Default" );
+    combo->addItem( qtr("Default") );
     for( int i_index = 0; i_index < p_list->i_count; i_index++ )
     {
         p_parser = (module_t *)p_list->p_values[i_index].p_object ;
@@ -126,7 +126,7 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
                 /* Hack: required subcategory is stored in i_min */
                 if( p_config->i_type == CONFIG_SUBCATEGORY &&
                     p_config->i_value == p_item->i_min )
-                    combo->addItem( p_parser->psz_longname,
+                    combo->addItem( qfu(p_parser->psz_longname),
                                     QVariant( p_parser->psz_object_name ) );
                 if( p_item->psz_value && !strcmp( p_item->psz_value,
                                                   p_parser->psz_object_name) )
@@ -135,7 +135,7 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
         }
         else if( !strcmp( p_parser->psz_capability, p_item->psz_type ) )
         {
-            combo->addItem( p_parser->psz_longname,
+            combo->addItem( qfu(p_parser->psz_longname),
                             QVariant( p_parser->psz_object_name ) );
             if( p_item->psz_value && !strcmp( p_item->psz_value,
                                               p_parser->psz_object_name) )
@@ -143,8 +143,8 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
         }
     }
     vlc_list_release( p_list );
-    combo->setToolTip( p_item->psz_longtext );
-    label->setToolTip( p_item->psz_longtext );
+    combo->setToolTip( qfu(p_item->psz_longtext) );
+    label->setToolTip( qfu(p_item->psz_longtext) );
 
     QHBoxLayout *layout = new QHBoxLayout();
     layout->addWidget( label ); layout->addWidget( combo );
index f66ad2bff0f892586ca9548106ff3ae7c4e6d98a..400d5e0d5c66db08d28c930a5f24b6838cb6a1b3 100644 (file)
 #include "util/qvlcframe.hpp"
 #include "qt4.hpp"
 #include "components/playlist/panels.hpp"
+#include "components/playlist/selector.hpp"
+#include <QHBoxLayout>
 
 PlaylistDialog *PlaylistDialog::instance = NULL;
 
 PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
 {
+    setWindowTitle( qtr( "Playlist" ) );
     playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf,
                                      VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
-    new StandardPLPanel( this, p_intf, p_playlist, p_playlist->p_root_category );
+
+    QHBoxLayout *layout = new QHBoxLayout();
+    selector = new PLSelector( this, p_intf );
+    layout->addWidget( selector, 1 );
+    
+    rightPanel = qobject_cast<PLPanel *>(new StandardPLPanel( this, p_intf,
+                                   p_playlist, p_playlist->p_root_category ) );
+    layout->addWidget( rightPanel, 3 );
     readSettings( "playlist", QSize( 500,500 ) );
+    setLayout( layout );
 }
 
 PlaylistDialog::~PlaylistDialog()
index 6c501f096c7e1f7ba05d6ebb178bbaff2b0eba94..db5c8f25d94e4b9eecb36a03c980af54bb63a03f 100644 (file)
@@ -25,6 +25,9 @@
 
 #include "util/qvlcframe.hpp"
 
+class PLSelector;
+class PLPanel;
+
 class PlaylistDialog : public QVLCFrame
 {
     Q_OBJECT;
@@ -38,6 +41,9 @@ public:
 private:
     PlaylistDialog( intf_thread_t * );
     static PlaylistDialog *instance;
+
+    PLSelector *selector;
+    PLPanel *rightPanel;
 public slots:
 };
 
index b91d0971a9abeca8f809a064f0cea3bdb11124a7..27b208eeb369ed41db7a19264e9141610b91b5c1 100644 (file)
@@ -39,10 +39,10 @@ PrefsDialog::PrefsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
 {
      layout = new QHBoxLayout();
      QVBoxLayout * main_layout = new QVBoxLayout();
-     setWindowTitle( _("Preferences" ) );
+     setWindowTitle( qtr("Preferences" ) );
      resize( 800, 450 );
 
-          advanced_tree = NULL;
+     advanced_tree = NULL;
      simple_tree = NULL;
      simple_panel = NULL;
      advanced_panel = NULL;
index 3cf4f599a1c12a14eecdc8e4e51f4a7ebfc78185..1c4520a42645c0c8a891450ba4806682194195d0 100644 (file)
@@ -541,7 +541,7 @@ void QVLCMenu::CreateItem( QMenu *menu, const char *psz_var,
         if( b_submenu )
         {
             QMenu *submenu = new QMenu();
-            submenu->setTitle( QString::fromUtf8( text.psz_string ? 
+            submenu->setTitle( qfu( text.psz_string ? 
                                     text.psz_string : psz_var ) );
             if( CreateChoicesMenu( submenu, psz_var, p_object, true ) == 0)
                 menu->addMenu( submenu );
@@ -552,8 +552,7 @@ void QVLCMenu::CreateItem( QMenu *menu, const char *psz_var,
         return;
     }
 
-#define TEXT_OR_VAR QString::fromUtf8 ( text.psz_string ? text.psz_string : \
-                                         psz_var )
+#define TEXT_OR_VAR qfu ( text.psz_string ? text.psz_string : psz_var )
 
     switch( i_type & VLC_VAR_TYPE )
     {
@@ -620,8 +619,7 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
         {
         case VLC_VAR_VARIABLE:
             CreateChoicesMenu( subsubmenu, CURVAL.psz_string, p_object, false );
-            subsubmenu->setTitle( QString::fromUtf8( CURTEXT ? CURTEXT :
-                                     CURVAL.psz_string ) );
+            subsubmenu->setTitle( qfu( CURTEXT ? CURTEXT :CURVAL.psz_string ) );
             submenu->addMenu( subsubmenu );
             break;
 
@@ -629,7 +627,7 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
           var_Get( p_object, psz_var, &val );
           another_val.psz_string = strdup( CURVAL.psz_string );
 
-          menutext = CURTEXT ? CURTEXT : another_val.psz_string;
+          menutext = qfu( CURTEXT ? CURTEXT : another_val.psz_string );
           CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
                             p_object->i_object_id, another_val, i_type, 
                             NOTCOMMAND && val.psz_string &&
@@ -640,7 +638,7 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
 
         case VLC_VAR_INTEGER:
           var_Get( p_object, psz_var, &val );
-          if( CURTEXT ) menutext = CURTEXT; 
+          if( CURTEXT ) menutext = qfu( CURTEXT );
           else menutext.sprintf( "%d", CURVAL.i_int);
           CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
                             p_object->i_object_id, CURVAL, i_type,
@@ -649,7 +647,7 @@ int QVLCMenu::CreateChoicesMenu( QMenu *submenu, const char *psz_var,
 
         case VLC_VAR_FLOAT:
           var_Get( p_object, psz_var, &val );
-          if( CURTEXT ) menutext = CURTEXT ;
+          if( CURTEXT ) menutext = qfu( CURTEXT );
           else menutext.sprintf( "%.2f", CURVAL.f_float );
           CreateAndConnect( submenu, psz_var, menutext, "", NORMAL_OR_RADIO,
                             p_object->i_object_id, CURVAL, i_type,
index cb62bc989472547799abe1e4a9a7cada1a371317..85d50c5206eec236ef8d7db07d46ae89708e717f 100644 (file)
@@ -50,6 +50,7 @@ struct intf_sys_t
 #define THEDP DialogsProvider::getInstance()
 #define THEMIM MainInputManager::getInstance( NULL )
 
+#define qfu( i ) QString::fromUtf8( i )
 #define qtr( i ) QString::fromUtf8( _(i) )
 
 static int DialogEvent_Type = QEvent::User + 1;