Browse Source

- Save files list column width

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
998b161696
  1. 1
      src/GUI.cpp
  2. 28
      src/propertiesWidget.ui
  3. 25
      src/propertieswidget.cpp
  4. 2
      src/propertieswidget.h

1
src/GUI.cpp

@ -247,6 +247,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis @@ -247,6 +247,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
// Load Window state and sizes
readSettings();
properties->readSettings();
if(settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), false).toBool()) {
this->setWindowState(Qt::WindowMinimized);

28
src/propertiesWidget.ui

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>756</width>
<height>333</height>
<height>303</height>
</rect>
</property>
<property name="sizePolicy">
@ -19,13 +19,22 @@ @@ -19,13 +19,22 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>333</height>
<height>303</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QStackedWidget" name="stackedProperties">
<property name="currentIndex">
@ -821,12 +830,6 @@ @@ -821,12 +830,6 @@
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
</widget>
</item>
<item>
@ -886,6 +889,15 @@ @@ -886,6 +889,15 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<item>
<widget class="QPushButton" name="main_infos_button">
<property name="styleSheet">

25
src/propertieswidget.cpp

@ -116,8 +116,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, TransferListWidget *transfer @@ -116,8 +116,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, TransferListWidget *transfer
}
PropertiesWidget::~PropertiesWidget() {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
settings.setValue("TorrentProperties/Visible", state==VISIBLE);
saveSettings();
delete refreshTimer;
if(progressBarUpdater)
delete progressBarUpdater;
@ -218,6 +217,28 @@ void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) { @@ -218,6 +217,28 @@ void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) {
loadDynamicData();
}
void PropertiesWidget::readSettings() {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QVariantList contentColsWidths = settings.value(QString::fromUtf8("TorrentProperties/filesColsWidth"), QVariantList()).toList();
if(contentColsWidths.empty()) {
filesList->header()->resizeSection(0, filesList->width()/2.);
} else {
for(int i=0; i<contentColsWidths.size(); ++i) {
filesList->setColumnWidth(i, contentColsWidths.at(i).toInt());
}
}
}
void PropertiesWidget::saveSettings() {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
settings.setValue("TorrentProperties/Visible", state==VISIBLE);
QVariantList contentColsWidths;
for(int i=0; i<PropListModel->columnCount()-1; ++i) {
contentColsWidths.append(filesList->columnWidth(i));
}
settings.setValue(QString::fromUtf8("TorrentProperties/filesColsWidth"), contentColsWidths);
}
void PropertiesWidget::loadDynamicData() {
if(!h.is_valid()) return;
try {

2
src/propertieswidget.h

@ -112,6 +112,8 @@ public slots: @@ -112,6 +112,8 @@ public slots:
void reduce();
void slide();
void clear();
void readSettings();
void saveSettings();
public:
PropertiesWidget(QWidget *parent, TransferListWidget *transferList, bittorrent* BTSession);

Loading…
Cancel
Save