Browse Source

Made preferences columns resizable

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
6431343ad7
  1. 21
      src/options_imp.cpp
  2. 63
      src/ui/options.ui

21
src/options_imp.cpp

@ -56,6 +56,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -56,6 +56,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
QString savePath;
setupUi(this);
hsplitter->setCollapsible(0, false);
hsplitter->setCollapsible(1, false);
// Get apply button in button box
QList<QAbstractButton *> buttons = buttonBox->buttons();
foreach(QAbstractButton *button, buttons){
@ -284,8 +286,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -284,8 +286,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
scrollArea_advanced->setLayout(adv_layout);
connect(advancedSettings, SIGNAL(settingsChanged()), this, SLOT(enableApplyButton()));
// Adapt size
loadWindowState();
show();
loadWindowState();
}
// Main destructor
@ -313,12 +315,29 @@ void options_imp::loadWindowState() { @@ -313,12 +315,29 @@ void options_imp::loadWindowState() {
QPoint p = settings.value(QString::fromUtf8("Preferences/State/pos"), QPoint()).toPoint();
if(!p.isNull())
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 {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
settings.setValue(QString::fromUtf8("Preferences/State/size"), size());
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() {

63
src/ui/options.ui

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

Loading…
Cancel
Save