From: Jean-Baptiste Kempf Date: Mon, 9 Apr 2007 22:57:52 +0000 (+0000) Subject: Qt4 - Preferences - Size/Layout/Margin and stuff related. This is not yet optimal... X-Git-Tag: 0.9.0-test0~7773 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=4e7e655aa94944ed4f1797d9dbb7114010c2c2a1;p=vlc Qt4 - Preferences - Size/Layout/Margin and stuff related. This is not yet optimal, but is much better than it was, I think. Some work has yet to be done on Complete Preferences to make it nicer. --- diff --git a/modules/gui/qt4/components/complete_preferences.cpp b/modules/gui/qt4/components/complete_preferences.cpp index 8bbc1162b4..a7217f2ec4 100644 --- a/modules/gui/qt4/components/complete_preferences.cpp +++ b/modules/gui/qt4/components/complete_preferences.cpp @@ -65,6 +65,8 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : setAlternatingRowColors( true ); header()->hide(); setIconSize( QSize( ITEM_HEIGHT,ITEM_HEIGHT ) ); + setTextElideMode( Qt::ElideNone ); + setHorizontalScrollBarPolicy ( Qt::ScrollBarAlwaysOn ); #define BI( a,b) QIcon a##_icon = QIcon( QPixmap( b##_xpm )) BI( audio, audio ); @@ -372,6 +374,7 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, } global_layout = new QVBoxLayout(); + global_layout->setMargin( 2 ); QString head; if( data->i_type == TYPE_SUBCATEGORY || data->i_type == TYPE_CATSUBCAT ) { diff --git a/modules/gui/qt4/components/simple_preferences.cpp b/modules/gui/qt4/components/simple_preferences.cpp index 5e7944846a..eef694ad8b 100644 --- a/modules/gui/qt4/components/simple_preferences.cpp +++ b/modules/gui/qt4/components/simple_preferences.cpp @@ -82,9 +82,12 @@ SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) : ADD_CATEGORY( SPrefsHotkeys, qtr("Hotkeys"), spref_cone_Hotkeys_64.png, 5 ); SPrefsInterface->setChecked( true ); + layout->setMargin( 0 ); + layout->setSpacing( 1 ); this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); setLayout( layout ); + } void SPrefsCatList::switchPanel( int i ) @@ -142,6 +145,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, QVBoxLayout *panel_layout = new QVBoxLayout(); QWidget *panel = new QWidget(); + panel_layout->setMargin( 3 ); // Title Label QLabel *panel_label = new QLabel; diff --git a/modules/gui/qt4/dialogs/preferences.cpp b/modules/gui/qt4/dialogs/preferences.cpp index 8346a4df90..72773e93fe 100644 --- a/modules/gui/qt4/dialogs/preferences.cpp +++ b/modules/gui/qt4/dialogs/preferences.cpp @@ -44,68 +44,71 @@ PrefsDialog *PrefsDialog::instance = NULL; PrefsDialog::PrefsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) { - QGridLayout *main_layout = new QGridLayout( this ); - setWindowTitle( qtr( "Preferences" ) ); - resize( 700, 650 ); - setMaximumHeight( 650 ); - setMaximumWidth( 700 ); + QGridLayout *main_layout = new QGridLayout( this ); + setWindowTitle( qtr( "Preferences" ) ); + resize( 700, 650 ); - /* Create Panels */ - tree_panel = new QWidget( 0 ); - tree_panel_l = new QHBoxLayout; - tree_panel->setLayout( tree_panel_l ); - main_panel = new QWidget( 0 ); - main_panel_l = new QHBoxLayout; - main_panel->setLayout( main_panel_l ); + /* Create Panels */ + tree_panel = new QWidget( 0 ); + tree_panel_l = new QHBoxLayout; + tree_panel->setLayout( tree_panel_l ); + main_panel = new QWidget( 0 ); + main_panel_l = new QHBoxLayout; + main_panel->setLayout( main_panel_l ); - /* Choice for types */ - types = new QGroupBox( "Show settings" ); - types->setAlignment( Qt::AlignHCenter ); - QHBoxLayout *types_l = new QHBoxLayout(0); - types_l->setSpacing( 3 ); types_l->setMargin( 3 ); - small = new QRadioButton( "Basic", types ); types_l->addWidget( small ); - all = new QRadioButton( "All", types ); types_l->addWidget( all ); - types->setLayout( types_l ); - small->setChecked( true ); + /* Choice for types */ + types = new QGroupBox( "Show settings" ); + types->setAlignment( Qt::AlignHCenter ); + QHBoxLayout *types_l = new QHBoxLayout(0); + types_l->setSpacing( 3 ); types_l->setMargin( 3 ); + small = new QRadioButton( "Basic", types ); types_l->addWidget( small ); + all = new QRadioButton( "All", types ); types_l->addWidget( all ); + types->setLayout( types_l ); + small->setChecked( true ); - /* Tree and panel initialisations */ - advanced_tree = NULL; - simple_tree = NULL; - simple_panel = NULL; - advanced_panel = NULL; + /* Tree and panel initialisations */ + advanced_tree = NULL; + simple_tree = NULL; + simple_panel = NULL; + advanced_panel = NULL; - main_layout->addWidget( tree_panel, 0, 0, 3, 1 ); - main_layout->addWidget( types, 3, 0, 2, 1 ); + /* Buttons */ + QDialogButtonBox *buttonsBox = new QDialogButtonBox(); + QPushButton *save = new QPushButton( qtr( "&Save" ) ); + QPushButton *cancel = new QPushButton( qtr( "&Cancel" ) ); + QPushButton *reset = new QPushButton( qtr( "&Reset Preferences" ) ); - main_layout->addWidget( main_panel, 0, 1, 4, 1 ); + buttonsBox->addButton( save, QDialogButtonBox::AcceptRole ); + buttonsBox->addButton( cancel, QDialogButtonBox::RejectRole ); + buttonsBox->addButton( reset, QDialogButtonBox::ActionRole ); - main_layout->setColumnMinimumWidth( 0, 150 ); - main_layout->setColumnStretch( 0, 1 ); - main_layout->setColumnStretch( 1, 3 ); + /* Layout */ + main_layout->addWidget( tree_panel, 0, 0, 3, 1 ); + main_layout->addWidget( types, 3, 0, 2, 1 ); + main_layout->addWidget( main_panel, 0, 1, 4, 1 ); + main_layout->addWidget( buttonsBox, 4, 1, 1 ,2 ); - main_layout->setRowStretch( 2, 4); + main_layout->setColumnMinimumWidth( 0, 150 ); + main_layout->setColumnStretch( 0, 1 ); + main_layout->setColumnStretch( 1, 3 ); - setSmall(); + main_layout->setRowStretch( 2, 4); - QDialogButtonBox *buttonsBox = new QDialogButtonBox(); - QPushButton *save = new QPushButton( qtr( "&Save" ) ); - QPushButton *cancel = new QPushButton( qtr( "&Cancel" ) ); - QPushButton *reset = new QPushButton( qtr( "&Reset Preferences" ) ); + setLayout( main_layout ); - buttonsBox->addButton( save, QDialogButtonBox::AcceptRole ); - buttonsBox->addButton( cancel, QDialogButtonBox::RejectRole ); - buttonsBox->addButton( reset, QDialogButtonBox::ActionRole ); + /* Margins */ + tree_panel_l->setMargin( 1 ); + main_panel_l->setMargin( 3 ); - main_layout->addWidget( buttonsBox, 4, 1, 1 ,2 ); - setLayout( main_layout ); + setSmall(); - BUTTONACT( save, save() ); - BUTTONACT( cancel, cancel() ); - BUTTONACT( reset, reset() ); - BUTTONACT( small, setSmall() ); - BUTTONACT( all, setAll() ); + BUTTONACT( save, save() ); + BUTTONACT( cancel, cancel() ); + BUTTONACT( reset, reset() ); + BUTTONACT( small, setSmall() ); + BUTTONACT( all, setAll() ); - for( int i = 0; i < SPrefsMax ; i++ ) simple_panels[i] = NULL; + for( int i = 0; i < SPrefsMax ; i++ ) simple_panels[i] = NULL; } void PrefsDialog::setAll() @@ -268,7 +271,6 @@ void PrefsDialog::reset() if ( ret == QMessageBox::Ok ) { config_ResetAll( p_intf ); - // TODO reset changes ? config_SaveConfigFile( p_intf, NULL ); } }