diff --git a/src/GUI.cpp b/src/GUI.cpp
index 4ce60dc65..063f7bb7f 100644
--- a/src/GUI.cpp
+++ b/src/GUI.cpp
@@ -139,20 +139,17 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
qDebug("create tabWidget");
tabs = new QTabWidget();
vSplitter = new QSplitter(Qt::Horizontal);
- rightPanel = new QWidget(vSplitter);
- hSplitter = new QVBoxLayout(vSplitter);
- rightPanel->setLayout(hSplitter);
+ hSplitter = new QSplitter(Qt::Vertical);
// Transfer List tab
- transferList = new TransferListWidget(rightPanel, BTSession);
- properties = new PropertiesWidget(rightPanel, transferList, BTSession);
+ transferList = new TransferListWidget(hSplitter, BTSession);
+ properties = new PropertiesWidget(hSplitter, transferList, BTSession);
transferListFilters = new TransferListFiltersWidget(vSplitter, transferList);
hSplitter->addWidget(transferList);
hSplitter->addWidget(properties);
vSplitter->addWidget(transferListFilters);
- vSplitter->addWidget(rightPanel);
+ vSplitter->addWidget(hSplitter);
tabs->addTab(vSplitter, QIcon(QString::fromUtf8(":/Icons/oxygen/folder-remote.png")), tr("Transfers"));
-
vboxLayout->addWidget(tabs);
// Transfer list slots
@@ -281,10 +278,9 @@ GUI::~GUI() {
delete rssWidget;
delete searchEngine;
delete transferListFilters;
- delete transferList;
delete properties;
+ delete transferList;
delete hSplitter;
- delete rightPanel;
delete vSplitter;
delete checkConnect;
qDebug("1");
diff --git a/src/GUI.h b/src/GUI.h
index 6785fbf04..75222973f 100644
--- a/src/GUI.h
+++ b/src/GUI.h
@@ -59,7 +59,6 @@ class TransferListWidget;
class TransferListFiltersWidget;
class QSplitter;
class PropertiesWidget;
-class QVBoxLayout;
class GUI : public QMainWindow, private Ui::MainWindow{
Q_OBJECT
@@ -79,8 +78,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
TransferListWidget *transferList;
TransferListFiltersWidget *transferListFilters;
PropertiesWidget *properties;
- QVBoxLayout *hSplitter;
- QWidget *rightPanel;
+ QSplitter *hSplitter;
QSplitter *vSplitter;
QLabel *connecStatusLblIcon;
bool systrayIntegration;
diff --git a/src/propertiesWidget.ui b/src/propertiesWidget.ui
index f5897252a..16ff9b8d8 100644
--- a/src/propertiesWidget.ui
+++ b/src/propertiesWidget.ui
@@ -7,11 +7,11 @@
0
0
758
- 292
+ 235
-
+
0
0
@@ -38,7 +38,7 @@
-
-
+
0
0
diff --git a/src/propertieswidget.cpp b/src/propertieswidget.cpp
index ab1a06e57..19ac5a0f4 100644
--- a/src/propertieswidget.cpp
+++ b/src/propertieswidget.cpp
@@ -54,13 +54,6 @@
PropertiesWidget::PropertiesWidget(QWidget *parent, TransferListWidget *transferList, bittorrent* BTSession): QWidget(parent), transferList(transferList), BTSession(BTSession) {
setupUi(this);
state = VISIBLE;
- QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
- if(!settings.value("TorrentProperties/Visible", false).toBool()) {
- reduce();
- } else {
- main_infos_button->setStyleSheet(SELECTED_BUTTON_CSS);
- setEnabled(false);
- }
// Set Properties list model
PropListModel = new TorrentFilesModel();
@@ -122,14 +115,25 @@ PropertiesWidget::~PropertiesWidget() {
void PropertiesWidget::reduce() {
if(state == VISIBLE) {
- stackedProperties->setFixedHeight(0);
+ QSplitter *hSplitter = static_cast(parentWidget());
+ slideSizes = hSplitter->sizes();
+ stackedProperties->setVisible(false);
+ QList sizes;
+ sizes << hSplitter->geometry().height()-30 << 30;
+ hSplitter->setSizes(sizes);
+ hSplitter->handle(1)->setVisible(false);
+ hSplitter->handle(1)->setDisabled(true);
state = REDUCED;
}
}
void PropertiesWidget::slide() {
if(state == REDUCED) {
- stackedProperties->setFixedHeight(260);
+ stackedProperties->setVisible(true);
+ QSplitter *hSplitter = static_cast(parentWidget());
+ hSplitter->handle(1)->setDisabled(false);
+ hSplitter->handle(1)->setVisible(true);
+ hSplitter->setSizes(slideSizes);
state = VISIBLE;
}
}
@@ -209,6 +213,20 @@ void PropertiesWidget::readSettings() {
filesList->setColumnWidth(i, contentColsWidths.at(i).toInt());
}
}
+ // Restore splitter sizes
+ QStringList sizes_str = settings.value(QString::fromUtf8("TorrentProperties/SplitterSizes"), QString()).toString().split(",");
+ if(sizes_str.size() == 2) {
+ slideSizes << sizes_str.first().toInt();
+ slideSizes << sizes_str.last().toInt();
+ QSplitter *hSplitter = static_cast(parentWidget());
+ hSplitter->setSizes(slideSizes);
+ }
+ if(!settings.value("TorrentProperties/Visible", false).toBool()) {
+ reduce();
+ } else {
+ main_infos_button->setStyleSheet(SELECTED_BUTTON_CSS);
+ setEnabled(false);
+ }
}
void PropertiesWidget::saveSettings() {
@@ -218,6 +236,18 @@ void PropertiesWidget::saveSettings() {
for(int i=0; icolumnCount(); ++i) {
contentColsWidths.append(filesList->columnWidth(i));
}
+ QSplitter *hSplitter = static_cast(parentWidget());
+ QList sizes;
+ if(state == VISIBLE)
+ sizes = hSplitter->sizes();
+ else
+ sizes = slideSizes;
+ if(state == VISIBLE)
+ qDebug("Visible");
+ qDebug("Sizes: %d", sizes.size());
+ if(sizes.size() == 2) {
+ settings.setValue(QString::fromUtf8("TorrentProperties/SplitterSizes"), QString::number(sizes.first())+','+QString::number(sizes.last()));
+ }
settings.setValue(QString::fromUtf8("TorrentProperties/filesColsWidth"), contentColsWidths);
}
diff --git a/src/propertieswidget.h b/src/propertieswidget.h
index c9efd25db..a299f034d 100644
--- a/src/propertieswidget.h
+++ b/src/propertieswidget.h
@@ -66,6 +66,7 @@ private:
QAction *actionNormal;
QAction *actionMaximum;
QAction *actionHigh;
+ QList slideSizes;
protected:
QPushButton* getButtonFromIndex(int index);