Made preferences columns resizable

This commit is contained in:
Christophe Dumez 2010-03-13 14:10:26 +00:00
parent bd292076e3
commit 6431343ad7
2 changed files with 2961 additions and 2967 deletions

View file

@ -56,6 +56,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
QString savePath; QString savePath;
setupUi(this); setupUi(this);
hsplitter->setCollapsible(0, false);
hsplitter->setCollapsible(1, false);
// Get apply button in button box // Get apply button in button box
QList<QAbstractButton *> buttons = buttonBox->buttons(); QList<QAbstractButton *> buttons = buttonBox->buttons();
foreach(QAbstractButton *button, buttons){ foreach(QAbstractButton *button, buttons){
@ -284,8 +286,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
scrollArea_advanced->setLayout(adv_layout); scrollArea_advanced->setLayout(adv_layout);
connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton())); connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton()));
// Adapt size // Adapt size
loadWindowState();
show(); show();
loadWindowState();
} }
// Main destructor // Main destructor
@ -313,12 +315,29 @@ void options_imp::loadWindowState() {
QPoint p = settings.value(QString::fromUtf8("Preferences/State/pos"), QPoint()).toPoint(); QPoint p = settings.value(QString::fromUtf8("Preferences/State/pos"), QPoint()).toPoint();
if(!p.isNull()) if(!p.isNull())
move(p); move(p);
// Load slider size
const QStringList &sizes_str = settings.value("Preferences/State/hSplitterSizes", QStringList()).toStringList();
// Splitter size
QList<int> sizes;
if(sizes_str.size() == 2) {
sizes << sizes_str.first().toInt();
sizes << sizes_str.last().toInt();
} else {
sizes << 130;
sizes << hsplitter->width()-130;
}
hsplitter->setSizes(sizes);
} }
void options_imp::saveWindowState() const { void options_imp::saveWindowState() const {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
settings.setValue(QString::fromUtf8("Preferences/State/size"), size()); settings.setValue(QString::fromUtf8("Preferences/State/size"), size());
settings.setValue(QString::fromUtf8("Preferences/State/pos"), pos()); settings.setValue(QString::fromUtf8("Preferences/State/pos"), pos());
// Splitter size
QStringList sizes_str;
sizes_str << QString::number(hsplitter->sizes().first());
sizes_str << QString::number(hsplitter->sizes().last());
settings.setValue(QString::fromUtf8("Preferences/State/hSplitterSizes"), sizes_str);
} }
QSize options_imp::sizeFittingScreen() { QSize options_imp::sizeFittingScreen() {

View file

@ -21,27 +21,17 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <widget class="QSplitter" name="hsplitter">
<item> <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<widget class="QListWidget" name="tabSelection"> <widget class="QListWidget" name="tabSelection">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>121</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>121</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
@ -229,8 +219,6 @@
</property> </property>
</item> </item>
</widget> </widget>
</item>
<item>
<widget class="QStackedWidget" name="tabOption"> <widget class="QStackedWidget" name="tabOption">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
@ -253,8 +241,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>602</width> <width>513</width>
<height>555</height> <height>565</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="verticalLayout_9">
@ -565,10 +553,10 @@ QGroupBox {
<widget class="QWidget" name="scrollAreaWidgetContents_2"> <widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>-30</x> <x>0</x>
<y>0</y> <y>0</y>
<width>632</width> <width>631</width>
<height>684</height> <height>694</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_17"> <layout class="QVBoxLayout" name="verticalLayout_17">
@ -741,18 +729,6 @@ QGroupBox {
<attribute name="verticalHeaderVisible"> <attribute name="verticalHeaderVisible">
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>80</number>
</attribute>
</widget> </widget>
</item> </item>
<item> <item>
@ -1124,7 +1100,7 @@ QGroupBox {
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>447</width> <width>447</width>
<height>288</height> <height>294</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_28"> <layout class="QVBoxLayout" name="verticalLayout_28">
@ -1369,7 +1345,7 @@ QGroupBox {
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>364</width> <width>364</width>
<height>332</height> <height>333</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_33"> <layout class="QVBoxLayout" name="verticalLayout_33">
@ -1774,7 +1750,7 @@ QGroupBox {
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>459</width> <width>459</width>
<height>415</height> <height>422</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_20"> <layout class="QVBoxLayout" name="verticalLayout_20">
@ -2190,8 +2166,8 @@ QGroupBox {
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>475</width> <width>426</width>
<height>312</height> <height>308</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_16"> <layout class="QVBoxLayout" name="verticalLayout_16">
@ -2625,7 +2601,7 @@ QGroupBox {
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>287</width> <width>287</width>
<height>124</height> <height>123</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_21"> <layout class="QVBoxLayout" name="verticalLayout_21">
@ -2722,7 +2698,7 @@ QGroupBox {
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>213</width> <width>213</width>
<height>221</height> <height>220</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_23"> <layout class="QVBoxLayout" name="verticalLayout_23">
@ -2889,7 +2865,7 @@ QGroupBox {
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>445</width> <width>445</width>
<height>192</height> <height>195</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_24"> <layout class="QVBoxLayout" name="verticalLayout_24">
@ -3074,8 +3050,7 @@ QGroupBox {
</layout> </layout>
</widget> </widget>
</widget> </widget>
</item> </widget>
</layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">