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();
......
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Jean-Baptiste Kempf</author>
<class>SPrefsInterface</class>
<widget class="QWidget" name="SPrefsInterface" >
<property name="geometry" >
<widget class="QWidget" name="SPrefsInterface">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
......@@ -10,32 +11,32 @@
<height>657</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_3" >
<item row="2" column="0" colspan="2" >
<widget class="QGroupBox" name="OneInterfaceBox" >
<property name="title" >
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="OneInterfaceBox">
<property name="title">
<string>Instances</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="0" >
<widget class="QCheckBox" name="OneInterfaceMode" >
<property name="text" >
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QCheckBox" name="OneInterfaceMode">
<property name="text">
<string>Allow only one instance</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QCheckBox" name="EnqueueOneInterfaceMode" >
<property name="text" >
<item row="0" column="1" colspan="2">
<widget class="QCheckBox" name="EnqueueOneInterfaceMode">
<property name="text">
<string>Enqueue files when in one instance mode</string>
</property>
</widget>
......@@ -43,63 +44,63 @@
</layout>
</widget>
</item>
<item row="4" column="0" colspan="2" >
<widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Privacy / Network Interaction</string>
</property>
<layout class="QGridLayout" name="gridLayout_5" >
<item row="0" column="0" >
<widget class="QLabel" name="artFetchLabel" >
<property name="minimumSize" >
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="artFetchLabel">
<property name="minimumSize">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="text" >
<property name="text">
<string>Album art download policy:</string>
</property>
</widget>
</item>
<item row="0" column="2" colspan="2" >
<widget class="QComboBox" name="artFetcher" />
<item row="0" column="2" colspan="2">
<widget class="QComboBox" name="artFetcher"/>
</item>
<item row="1" column="0" >
<widget class="QCheckBox" name="updatesBox" >
<property name="text" >
<item row="1" column="0">
<widget class="QCheckBox" name="updatesBox">
<property name="text">
<string>Activate update notifier</string>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QSpinBox" name="updatesDays" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<item row="1" column="2">
<widget class="QSpinBox" name="updatesDays">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix" >
<property name="suffix">
<string> days</string>
</property>
<property name="prefix" >
<property name="prefix">
<string>Every </string>
</property>
</widget>
</item>
<item row="1" column="3" >
<spacer name="horizontalSpacer_2" >
<property name="orientation" >
<item row="1" column="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0" >
<property name="sizeHint" stdset="0">
<size>
<width>200</width>
<height>27</height>
......@@ -107,35 +108,35 @@
</property>
</spacer>
</item>
<item row="2" column="0" >
<widget class="QCheckBox" name="saveRecentlyPlayed" >
<property name="text" >
<item row="2" column="0">
<widget class="QCheckBox" name="saveRecentlyPlayed">
<property name="text">
<string>Save recently played items</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLabel" name="filterLabel" >
<property name="text" >
<item row="2" column="1">
<widget class="QLabel" name="filterLabel">
<property name="text">
<string>Filter:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="margin" >
<property name="margin">
<number>5</number>
</property>
</widget>
</item>
<item row="2" column="2" colspan="2" >
<widget class="QLineEdit" name="recentlyPlayedFilters" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<item row="2" column="2" colspan="2">
<widget class="QLineEdit" name="recentlyPlayedFilters">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip" >
<property name="toolTip">
<string>Separate words by | (without space)</string>
</property>
</widget>
......@@ -143,117 +144,161 @@
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QGroupBox" name="LooknfeelBox" >
<property name="title" >
<string>Look and feel</string>
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="languageBox">
<property name="title">
<string>Language</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="languageLabel">
<property name="maximumSize">
<size>
<width>220</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Menus language:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="2" colspan="4" >
<widget class="QLabel" name="defaultLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
</widget>
</item>
<item>
<widget class="QComboBox" name="language"/>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="assoBox">
<property name="title">
<string>File associations</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QPushButton" name="assoButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="text" >
<string>This is VLC's default interface, with a native look and feel.</string>
<property name="minimumSize">
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="textFormat" >
<enum>Qt::RichText</enum>
<property name="text">
<string>Set up associations...</string>
</property>
<property name="wordWrap" >
<bool>true</bool>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="margin" >
<number>10</number>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="6" column="0" colspan="2" >
<widget class="QRadioButton" name="skins" >
<property name="text" >
<item row="1" column="0" colspan="2">
<widget class="QGroupBox" name="LooknfeelBox">
<property name="title">
<string>Look and feel</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="0" colspan="2">
<widget class="QRadioButton" name="skins">
<property name="text">
<string>Use custom skin</string>
</property>
</widget>
</item>
<item row="6" column="2" colspan="4" >
<widget class="QLabel" name="skinsLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<item row="6" column="2" colspan="2">
<widget class="QLabel" name="skinsLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text" >
<property name="text">
<string/>
</property>
<property name="textFormat" >
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="scaledContents" >
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin" >
<property name="margin">
<number>5</number>
</property>
<property name="openExternalLinks" >
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0" colspan="6" >
<widget class="Line" name="line" >
<property name="orientation" >
<item row="5" column="0" colspan="4">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="7" column="2" colspan="4" >
<widget class="QWidget" native="1" name="skins_zone" >
<property name="enabled" >
<item row="7" column="2" colspan="2">
<widget class="QWidget" name="skins_zone" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<property name="margin" >
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="skinFileLabel" >
<property name="text" >
<widget class="QLabel" name="skinFileLabel">
<property name="text">
<string>Skin resource file:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>fileSkin</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="fileSkin" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<widget class="QLineEdit" name="fileSkin">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -261,14 +306,14 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="skinBrowse" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<widget class="QPushButton" name="skinBrowse">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Choose...</string>
</property>
</widget>
......@@ -276,175 +321,118 @@
</layout>
</widget>
</item>
<item row="0" column="0" colspan="2" >
<widget class="QRadioButton" name="qt4" >
<property name="text" >
<string>Use native style</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2" colspan="4" >
<widget class="QWidget" native="1" name="native_zone" >
<layout class="QGridLayout" name="gridLayout_4" >
<property name="margin" >
<item row="0" column="2" rowspan="2" colspan="2">
<widget class="QWidget" name="native_zone" native="true">
<layout class="QGridLayout" name="gridLayout_4">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="1" >
<widget class="QComboBox" name="displayModeBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="MinimumExpanding" >
<item row="0" column="1">
<widget class="QComboBox" name="displayModeBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="7" column="1" >
<widget class="QCheckBox" name="fsController" >
<property name="text" >
<item row="7" column="1">
<widget class="QCheckBox" name="fsController">
<property name="text">
<string>Show controls in full screen mode</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="displayLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<item row="0" column="0">
<widget class="QLabel" name="displayLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection" >
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text" >
<property name="text">
<string>Display mode:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="QCheckBox" name="systrayBox" >
<property name="text" >
<item row="4" column="1">
<widget class="QCheckBox" name="systrayBox">
<property name="text">
<string>Show systray icon</string>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QCheckBox" name="resizingBox" >
<property name="text" >
<item row="4" column="0">
<widget class="QCheckBox" name="resizingBox">
<property name="text">
<string>Resize interface to video size</string>
</property>
</widget>
</item>
<item row="7" column="0" >
<widget class="QCheckBox" name="embedVideo" >
<property name="text" >
<item row="7" column="0">
<widget class="QCheckBox" name="embedVideo">
<property name="text">
<string>Embed video in interface</string>
</property>
</widget>
</item>
</layout>
</widget>
<item row="8" column="1">
<widget class="QComboBox" name="stylesCombo"/>
</item>
<item row="7" column="0" >
<widget class="QLabel" name="previewSkins" >
<property name="text" >
<string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;img src=":/prefsmenu/sample_skins" />&lt;/p>&lt;/body>&lt;/html></string>
<item row="8" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Force window style:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" colspan="2" >
<widget class="QGroupBox" name="languageBox" >
<property name="title" >
<string>Language</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3" >
<item>
<widget class="QLabel" name="languageLabel" >
<property name="maximumSize" >
<size>
<width>220</width>
<height>16777215</height>
</size>
</property>
<property name="text" >
<string>Menus language:</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
<item row="7" column="0">
<widget class="QLabel" name="previewSkins">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;img src=&quot;:/prefsmenu/sample_skins&quot; /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="language" />
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QGroupBox" name="assoBox" >
<property name="title" >
<string>File associations</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4" >
<item>
<widget class="QPushButton" name="assoButton" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Maximum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="qt4">
<property name="toolTip">
<string>This is VLC's default interface, with a native look and feel.</string>
</property>
<property name="minimumSize" >
<size>
<width>220</width>
<height>0</height>
</size>
<property name="text">
<string>Use native style</string>
</property>
<property name="text" >
<string>Set up associations...</string>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>qt4</tabstop>
<tabstop>OneInterfaceMode</tabstop>
<tabstop>artFetcher</tabstop>
<tabstop>updatesBox</tabstop>
</tabstops>
<resources>
<include location="../vlc.qrc" />
<include location="../vlc.qrc"/>
</resources>
<connections/>
</ui>
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