Commit 3a7f6136 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - New Simple Preferences look'n feel. Should work without too many...

Qt4 - New Simple Preferences look'n feel. Should work without too many segfaults... Got rid of the QListWidget thing.
Some look has still to be done, especially for size/margin/padding.
I don't know yet if the look of the button will be like that ( flat, rounded onMouseOver, darked onCliked)

parent 1580eede
...@@ -51,7 +51,7 @@ protected: ...@@ -51,7 +51,7 @@ protected:
public slots: public slots:
virtual void updateMRL() = 0; virtual void updateMRL() = 0;
signals: signals:
void mrlUpdated(QString); void mrlUpdated( QString );
void methodChanged( QString method ); void methodChanged( QString method );
}; };
......
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#include <QListWidget>
#include <QListWidgetItem>
#include <QString> #include <QString>
#include <QFont> #include <QFont>
#include <QToolButton>
#include <QButtonGroup>
#include "components/simple_preferences.hpp" #include "components/simple_preferences.hpp"
#include "components/preferences_widgets.hpp" #include "components/preferences_widgets.hpp"
...@@ -34,13 +34,6 @@ ...@@ -34,13 +34,6 @@
#include <vlc_config_cat.h> #include <vlc_config_cat.h>
#include "pixmaps/hotkeys_50x50.xpm"
#include "pixmaps/audio_50x50.xpm"
#include "pixmaps/input_and_codecs_50x50.xpm"
#include "pixmaps/interface_50x50.xpm"
#include "pixmaps/subtitles_50x50.xpm"
#include "pixmaps/video_50x50.xpm"
#include "ui/sprefs_audio.h" #include "ui/sprefs_audio.h"
#include "ui/sprefs_input.h" #include "ui/sprefs_input.h"
#include "ui/sprefs_video.h" #include "ui/sprefs_video.h"
...@@ -48,42 +41,52 @@ ...@@ -48,42 +41,52 @@
#include "ui/sprefs_hotkeys.h" #include "ui/sprefs_hotkeys.h"
#include "ui/sprefs_interface.h" #include "ui/sprefs_interface.h"
#define ITEM_HEIGHT 64 #define ICON_HEIGHT 64
#define BUTTON_HEIGHT 76
/********************************************************************* /*********************************************************************
* The List of categories * The List of categories
*********************************************************************/ *********************************************************************/
SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) : SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) :
QListWidget( _parent ), p_intf( _p_intf ) QWidget( _parent ), p_intf( _p_intf )
{ {
setIconSize( QSize( ITEM_HEIGHT, ITEM_HEIGHT ) ); QVBoxLayout *layout = new QVBoxLayout();
setViewMode(QListView::ListMode);
setMovement(QListView::Static); QButtonGroup *buttonGroup = new QButtonGroup( this );
setMaximumWidth(200); buttonGroup->setExclusive ( true );
setSpacing(0); CONNECT( buttonGroup, buttonClicked ( int ),
// setWordWrap(true); this, switchPanel( int ) );
setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); #define ADD_CATEGORY( button, label, icon, numb ) \
setAlternatingRowColors( true ); QToolButton * button = new QToolButton( this ); \
button->setIcon( QIcon( ":/pixmaps/" #icon ) ); \
#define ADD_CATEGORY( id, label, icon ) \ button->setIconSize( QSize( ICON_HEIGHT , ICON_HEIGHT ) ); \
addItem( label ); \ button->setText( label ); \
item( id )->setIcon( QIcon( ":/pixmaps/" #icon ) ) ; \ button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); \
item( id )->setTextAlignment( Qt::AlignLeft | Qt::AlignVCenter ); \ button->resize( BUTTON_HEIGHT , BUTTON_HEIGHT); \
item( id )->setData( Qt::UserRole, qVariantFromValue( (int)id ) ); \ button->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding) ; \
item( id )->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); button->setAutoRaise( true ); \
button->setCheckable( true ); \
buttonGroup->addButton( button, numb ); \
layout->addWidget( button );
ADD_CATEGORY( SPrefsInterface, qtr("Interface"), ADD_CATEGORY( SPrefsInterface, qtr("Interface"),
spref_cone_Interface_64.png ); spref_cone_Interface_64.png, 0 );
ADD_CATEGORY( SPrefsAudio, qtr("Audio"), spref_cone_Audio_64.png ); ADD_CATEGORY( SPrefsAudio, qtr("Audio"), spref_cone_Audio_64.png, 1 );
ADD_CATEGORY( SPrefsVideo, qtr("Video"), spref_cone_Video_64.png ); ADD_CATEGORY( SPrefsVideo, qtr("Video"), spref_cone_Video_64.png, 2 );
ADD_CATEGORY( SPrefsSubtitles, qtr("Subtitles"), ADD_CATEGORY( SPrefsSubtitles, qtr("Subtitles"),
spref_cone_Subtitles_64.png ); spref_cone_Subtitles_64.png, 3 );
ADD_CATEGORY( SPrefsInputAndCodecs, qtr("Input and Codecs"), ADD_CATEGORY( SPrefsInputAndCodecs, qtr("Input and Codecs"),
spref_cone_Input_64.png ); spref_cone_Input_64.png, 4 );
ADD_CATEGORY( SPrefsHotkeys, qtr("Hotkeys"), spref_cone_Hotkeys_64.png ); ADD_CATEGORY( SPrefsHotkeys, qtr("Hotkeys"), spref_cone_Hotkeys_64.png, 5 );
setCurrentRow( SPrefsInterface ); this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
setLayout( layout );
}
void SPrefsCatList::switchPanel( int i )
{
emit currentItemChanged( i );
} }
/********************************************************************* /*********************************************************************
...@@ -304,3 +307,4 @@ void SPrefsPanel::apply() ...@@ -304,3 +307,4 @@ void SPrefsPanel::apply()
void SPrefsPanel::clean() void SPrefsPanel::clean()
{} {}
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#define _SIMPLEPREFS_H_ #define _SIMPLEPREFS_H_
#include <QListWidget> #include <QListWidget>
#include <QVBoxLayout>
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc_interface.h> #include <vlc_interface.h>
...@@ -41,7 +42,7 @@ enum { ...@@ -41,7 +42,7 @@ enum {
class ConfigControl; class ConfigControl;
class SPrefsCatList : public QListWidget class SPrefsCatList : public QWidget
{ {
Q_OBJECT; Q_OBJECT;
public: public:
...@@ -49,6 +50,10 @@ public: ...@@ -49,6 +50,10 @@ public:
virtual ~SPrefsCatList() {}; virtual ~SPrefsCatList() {};
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
signals:
void currentItemChanged( int );
public slots:
void switchPanel( int );
}; };
class SPrefsPanel : public QWidget class SPrefsPanel : public QWidget
......
...@@ -143,8 +143,8 @@ void PrefsDialog::setSmall() ...@@ -143,8 +143,8 @@ void PrefsDialog::setSmall()
{ {
simple_tree = new SPrefsCatList( p_intf, tree_panel ); simple_tree = new SPrefsCatList( p_intf, tree_panel );
CONNECT( simple_tree, CONNECT( simple_tree,
currentItemChanged( QListWidgetItem *, QListWidgetItem *), currentItemChanged( int ),
this, changeSimplePanel( QListWidgetItem * ) ); this, changeSimplePanel( int ) );
} }
tree_panel_l->addWidget( simple_tree ); tree_panel_l->addWidget( simple_tree );
simple_tree->show(); simple_tree->show();
...@@ -160,9 +160,8 @@ void PrefsDialog::setSmall() ...@@ -160,9 +160,8 @@ void PrefsDialog::setSmall()
simple_panel->show(); simple_panel->show();
} }
void PrefsDialog::changeSimplePanel( QListWidgetItem *item ) void PrefsDialog::changeSimplePanel( int number )
{ {
int number = item->data( Qt::UserRole ).toInt();
if( simple_panel ) if( simple_panel )
{ {
main_panel_l->removeWidget( simple_panel ); main_panel_l->removeWidget( simple_panel );
...@@ -176,7 +175,6 @@ void PrefsDialog::changeSimplePanel( QListWidgetItem *item ) ...@@ -176,7 +175,6 @@ void PrefsDialog::changeSimplePanel( QListWidgetItem *item )
} }
main_panel_l->addWidget( simple_panel ); main_panel_l->addWidget( simple_panel );
simple_panel->show(); simple_panel->show();
// panel_label->setText(qtr("Test")); //FIXME
} }
void PrefsDialog::changePanel( QTreeWidgetItem *item ) void PrefsDialog::changePanel( QTreeWidgetItem *item )
......
...@@ -80,7 +80,7 @@ private: ...@@ -80,7 +80,7 @@ private:
static PrefsDialog *instance; static PrefsDialog *instance;
private slots: private slots:
void changePanel( QTreeWidgetItem * ); void changePanel( QTreeWidgetItem * );
void changeSimplePanel( QListWidgetItem * ); void changeSimplePanel( int );
void setAll(); void setAll();
void setSmall(); void setSmall();
void save(); void save();
......
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