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