#include <QToolButton>
#include <QButtonGroup>
#include <QVBoxLayout>
+#include <QScrollArea>
#include <QtAlgorithms>
#include <string>
#define ICON_HEIGHT 64
-#define BUTTON_HEIGHT 74
/*********************************************************************
* The List of categories
*********************************************************************/
-SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) :
+SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent, bool small ) :
QWidget( _parent ), p_intf( _p_intf )
{
QVBoxLayout *layout = new QVBoxLayout();
CONNECT( buttonGroup, buttonClicked ( int ),
this, switchPanel( int ) );
+ short icon_height = small ? ICON_HEIGHT /2 : ICON_HEIGHT;
+
#define ADD_CATEGORY( button, label, icon, numb ) \
QToolButton * button = new QToolButton( this ); \
button->setIcon( QIcon( ":/pixmaps/prefs/" #icon ) ); \
- button->setIconSize( QSize( ICON_HEIGHT , ICON_HEIGHT ) ); \
button->setText( label ); \
button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); \
- button->resize( BUTTON_HEIGHT , BUTTON_HEIGHT); \
+ button->setIconSize( QSize( icon_height, icon_height ) ); \
+ button->resize( icon_height + 6 , icon_height + 6 ); \
button->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding) ; \
button->setAutoRaise( true ); \
button->setCheckable( true ); \
* The Panels
*********************************************************************/
SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
- int _number ) : QWidget( _parent ), p_intf( _p_intf )
+ int _number, bool small ) : QWidget( _parent ), p_intf( _p_intf )
{
module_config_t *p_config;
ConfigControl *control;
panel_layout->addWidget( panel_label );
panel_layout->addWidget( title_line );
- panel_layout->addWidget( panel );
- if( number != SPrefsHotkeys ) panel_layout->addStretch( 2 );
+
+ if( small )
+ {
+ QScrollArea *scroller= new QScrollArea;
+ scroller->setWidget( panel );
+ scroller->setWidgetResizable( true );
+ scroller->setFrameStyle( QFrame::NoFrame );
+ panel_layout->addWidget( scroller );
+ }
+ else
+ {
+ panel_layout->addWidget( panel );
+ if( number != SPrefsHotkeys ) panel_layout->addStretch( 2 );
+ }
setLayout( panel_layout );
}
{
Q_OBJECT;
public:
- SPrefsCatList( intf_thread_t *, QWidget *);
+ SPrefsCatList( intf_thread_t *, QWidget *, bool );
virtual ~SPrefsCatList() {};
private:
intf_thread_t *p_intf;
{
Q_OBJECT
public:
- SPrefsPanel( intf_thread_t *, QWidget *, int );
+ SPrefsPanel( intf_thread_t *, QWidget *, int, bool );
virtual ~SPrefsPanel();
void apply();
void clean();
main_layout->setColumnMinimumWidth( 1, 10 );
main_layout->setColumnStretch( 0, 1 );
main_layout->setColumnStretch( 1, 0 );
- main_layout->setColumnStretch( 2, 3 );
+ main_layout->setColumnStretch( 2, 10 );
main_layout->setRowStretch( 2, 4 );
tree_panel_l->setMargin( 1 );
main_panel_l->setLayoutMargins( 6, 0, 0, 3, 3 );
+ b_small = (p_intf->p_sys->i_screenHeight < 750);
+ if( b_small ) msg_Dbg( p_intf, "Small");
+ setMaximumHeight( p_intf->p_sys->i_screenHeight );
for( int i = 0; i < SPrefsMax ; i++ ) simple_panels[i] = NULL;
if( config_GetInt( p_intf, "qt-advanced-pref" ) == 1 )
BUTTONACT( small, setSmall() );
BUTTONACT( all, setAdvanced() );
- resize( 750, sizeHint().height() );
+ resize( 780, sizeHint().height() );
}
void PrefsDialog::setAdvanced()
/* If no simple_tree, create one, connect it */
if( !simple_tree )
{
- simple_tree = new SPrefsCatList( p_intf, tree_panel );
+ simple_tree = new SPrefsCatList( p_intf, tree_panel, b_small );
CONNECT( simple_tree,
currentItemChanged( int ),
this, changeSimplePanel( int ) );
if( !current_simple_panel )
{
current_simple_panel =
- new SPrefsPanel( p_intf, main_panel, SPrefsDefaultCat );
+ new SPrefsPanel( p_intf, main_panel, SPrefsDefaultCat, b_small );
simple_panels[SPrefsDefaultCat] = current_simple_panel;
main_panel_l->addWidget( current_simple_panel );
}
current_simple_panel = simple_panels[number];
if( !current_simple_panel )
{
- current_simple_panel = new SPrefsPanel( p_intf, main_panel, number );
+ current_simple_panel = new SPrefsPanel( p_intf, main_panel, number, b_small );
simple_panels[number] = current_simple_panel;
main_panel_l->addWidget( current_simple_panel );
}
static PrefsDialog *instance;
+ bool b_small;
+
private slots:
void setAdvanced();
void setSmall();