Commit 64e68cb4 authored by Clément Stenac's avatar Clément Stenac

A bunch of various fixes (encoding, refcount, layout)

parent 77b8c78a
......@@ -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 \
......
/*****************************************************************************
* 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()
{
}
......@@ -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;
......
......@@ -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()
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -24,15 +24,26 @@
#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()
......
......@@ -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:
};
......
......@@ -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;
......
......@@ -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,
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment