Commit 4b5e7346 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Allow to select the style of Qt in Simple preferences.

parent 93f25799
......@@ -40,6 +40,8 @@
#include <QVBoxLayout>
#include <QScrollArea>
#include <QStyleFactory>
#include <QSettings>
#include <QtAlgorithms>
#include <string>
......@@ -482,7 +484,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
* Interface Panel *
*******************/
START_SPREFS_CAT( Interface, qtr("Interface Settings") );
ui.defaultLabel->setFont( italicFont );
// ui.defaultLabel->setFont( italicFont );
ui.skinsLabel->setText(
qtr( "This is VLC's skinnable interface. You can download other skins at" )
+ QString( " <a href=\"http://www.videolan.org/vlc/skins.php\">VLC skins website</a>." ) );
......@@ -495,6 +497,13 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
ui.languageBox->hide();
ui.assoBox->hide();
#endif
ui.stylesCombo->addItems( QStyleFactory::keys() );
ui.stylesCombo->setCurrentIndex( ui.stylesCombo->findText(
getSettings()->value( "MainWindow/QtStyle", "" ).toString() ) );
ui.stylesCombo->insertSeparator( 1 );
CONNECT( ui.stylesCombo, currentIndexChanged( QString ), this, changeStyle( QString ) );
/* interface */
char *psz_intf = config_GetPsz( p_intf, "intf" );
......@@ -510,6 +519,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
optionWidgets.append( ui.skins );
optionWidgets.append( ui.qt4 );
optionWidgets.append( ui.stylesCombo );
ui.skins_zone->setEnabled( ui.skins->isChecked() );
CONNECT( ui.skins, toggled( bool ), ui.skins_zone, setEnabled( bool ) );
......@@ -750,6 +760,9 @@ void SPrefsPanel::apply()
config_PutPsz( p_intf, "intf", "skins2" );
if( qobject_cast<QRadioButton *>(optionWidgets[qtRB])->isChecked() )
config_PutPsz( p_intf, "intf", "qt" );
getSettings()->setValue( "MainWindow/QtStyle",
qobject_cast<QComboBox *>(optionWidgets[styleCB])->currentText() );
break;
}
......@@ -787,6 +800,19 @@ void SPrefsPanel::lastfm_Changed( int i_state )
config_RemoveIntf( VLC_OBJECT( p_intf ), "audioscrobbler" );
}
void SPrefsPanel::changeStyle( QString s_style )
{
QApplication::setStyle( s_style );
/* force refresh on all widgets */
QWidgetList widgets = QApplication::allWidgets();
QWidgetList::iterator it = widgets.begin();
while( it != widgets.end() ) {
(*it)->update();
it++;
};
}
#ifdef WIN32
#include <QDialogButtonBox>
#include <QHeaderView>
......
......@@ -78,7 +78,7 @@ enum {
spdifChB,
};
enum { inputLE, cachingCoB };
enum { skinRB, qtRB };
enum { skinRB, qtRB, styleCB };
class ConfigControl;
class QComboBox;
......@@ -136,6 +136,7 @@ private slots:
void assoDialog();
void saveAsso();
#endif
void changeStyle( QString );
};
#endif
......@@ -451,6 +451,12 @@ static void *Thread( void *obj )
p_intf->p_sys->filepath =
getSettings()->value( "filedialog-path", config_GetHomeDir() ).toString();
/* Loads and tries to apply the preferred QStyle */
QString s_style = getSettings()->value( "MainWindow/QtStyle", "" ).toString();
if( s_style.compare("") != 0 )
QApplication::setStyle( s_style );
/* Launch */
app.exec();
......
This diff is collapsed.
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