mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-23 17:56:50 +03:00
- Improved properties pannel by using a Splitter to allow the user to set the height of the pannel
This commit is contained in:
parent
6199d6d543
commit
4493752d2f
5 changed files with 49 additions and 24 deletions
14
src/GUI.cpp
14
src/GUI.cpp
|
@ -139,20 +139,17 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
||||||
qDebug("create tabWidget");
|
qDebug("create tabWidget");
|
||||||
tabs = new QTabWidget();
|
tabs = new QTabWidget();
|
||||||
vSplitter = new QSplitter(Qt::Horizontal);
|
vSplitter = new QSplitter(Qt::Horizontal);
|
||||||
rightPanel = new QWidget(vSplitter);
|
hSplitter = new QSplitter(Qt::Vertical);
|
||||||
hSplitter = new QVBoxLayout(vSplitter);
|
|
||||||
rightPanel->setLayout(hSplitter);
|
|
||||||
|
|
||||||
// Transfer List tab
|
// Transfer List tab
|
||||||
transferList = new TransferListWidget(rightPanel, BTSession);
|
transferList = new TransferListWidget(hSplitter, BTSession);
|
||||||
properties = new PropertiesWidget(rightPanel, transferList, BTSession);
|
properties = new PropertiesWidget(hSplitter, transferList, BTSession);
|
||||||
transferListFilters = new TransferListFiltersWidget(vSplitter, transferList);
|
transferListFilters = new TransferListFiltersWidget(vSplitter, transferList);
|
||||||
hSplitter->addWidget(transferList);
|
hSplitter->addWidget(transferList);
|
||||||
hSplitter->addWidget(properties);
|
hSplitter->addWidget(properties);
|
||||||
vSplitter->addWidget(transferListFilters);
|
vSplitter->addWidget(transferListFilters);
|
||||||
vSplitter->addWidget(rightPanel);
|
vSplitter->addWidget(hSplitter);
|
||||||
tabs->addTab(vSplitter, QIcon(QString::fromUtf8(":/Icons/oxygen/folder-remote.png")), tr("Transfers"));
|
tabs->addTab(vSplitter, QIcon(QString::fromUtf8(":/Icons/oxygen/folder-remote.png")), tr("Transfers"));
|
||||||
|
|
||||||
vboxLayout->addWidget(tabs);
|
vboxLayout->addWidget(tabs);
|
||||||
|
|
||||||
// Transfer list slots
|
// Transfer list slots
|
||||||
|
@ -281,10 +278,9 @@ GUI::~GUI() {
|
||||||
delete rssWidget;
|
delete rssWidget;
|
||||||
delete searchEngine;
|
delete searchEngine;
|
||||||
delete transferListFilters;
|
delete transferListFilters;
|
||||||
delete transferList;
|
|
||||||
delete properties;
|
delete properties;
|
||||||
|
delete transferList;
|
||||||
delete hSplitter;
|
delete hSplitter;
|
||||||
delete rightPanel;
|
|
||||||
delete vSplitter;
|
delete vSplitter;
|
||||||
delete checkConnect;
|
delete checkConnect;
|
||||||
qDebug("1");
|
qDebug("1");
|
||||||
|
|
|
@ -59,7 +59,6 @@ class TransferListWidget;
|
||||||
class TransferListFiltersWidget;
|
class TransferListFiltersWidget;
|
||||||
class QSplitter;
|
class QSplitter;
|
||||||
class PropertiesWidget;
|
class PropertiesWidget;
|
||||||
class QVBoxLayout;
|
|
||||||
|
|
||||||
class GUI : public QMainWindow, private Ui::MainWindow{
|
class GUI : public QMainWindow, private Ui::MainWindow{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -79,8 +78,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||||
TransferListWidget *transferList;
|
TransferListWidget *transferList;
|
||||||
TransferListFiltersWidget *transferListFilters;
|
TransferListFiltersWidget *transferListFilters;
|
||||||
PropertiesWidget *properties;
|
PropertiesWidget *properties;
|
||||||
QVBoxLayout *hSplitter;
|
QSplitter *hSplitter;
|
||||||
QWidget *rightPanel;
|
|
||||||
QSplitter *vSplitter;
|
QSplitter *vSplitter;
|
||||||
QLabel *connecStatusLblIcon;
|
QLabel *connecStatusLblIcon;
|
||||||
bool systrayIntegration;
|
bool systrayIntegration;
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>758</width>
|
<width>758</width>
|
||||||
<height>292</height>
|
<height>235</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QStackedWidget" name="stackedProperties">
|
<widget class="QStackedWidget" name="stackedProperties">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
|
|
@ -54,13 +54,6 @@
|
||||||
PropertiesWidget::PropertiesWidget(QWidget *parent, TransferListWidget *transferList, bittorrent* BTSession): QWidget(parent), transferList(transferList), BTSession(BTSession) {
|
PropertiesWidget::PropertiesWidget(QWidget *parent, TransferListWidget *transferList, bittorrent* BTSession): QWidget(parent), transferList(transferList), BTSession(BTSession) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
state = VISIBLE;
|
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
|
// Set Properties list model
|
||||||
PropListModel = new TorrentFilesModel();
|
PropListModel = new TorrentFilesModel();
|
||||||
|
@ -122,14 +115,25 @@ PropertiesWidget::~PropertiesWidget() {
|
||||||
|
|
||||||
void PropertiesWidget::reduce() {
|
void PropertiesWidget::reduce() {
|
||||||
if(state == VISIBLE) {
|
if(state == VISIBLE) {
|
||||||
stackedProperties->setFixedHeight(0);
|
QSplitter *hSplitter = static_cast<QSplitter*>(parentWidget());
|
||||||
|
slideSizes = hSplitter->sizes();
|
||||||
|
stackedProperties->setVisible(false);
|
||||||
|
QList<int> sizes;
|
||||||
|
sizes << hSplitter->geometry().height()-30 << 30;
|
||||||
|
hSplitter->setSizes(sizes);
|
||||||
|
hSplitter->handle(1)->setVisible(false);
|
||||||
|
hSplitter->handle(1)->setDisabled(true);
|
||||||
state = REDUCED;
|
state = REDUCED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PropertiesWidget::slide() {
|
void PropertiesWidget::slide() {
|
||||||
if(state == REDUCED) {
|
if(state == REDUCED) {
|
||||||
stackedProperties->setFixedHeight(260);
|
stackedProperties->setVisible(true);
|
||||||
|
QSplitter *hSplitter = static_cast<QSplitter*>(parentWidget());
|
||||||
|
hSplitter->handle(1)->setDisabled(false);
|
||||||
|
hSplitter->handle(1)->setVisible(true);
|
||||||
|
hSplitter->setSizes(slideSizes);
|
||||||
state = VISIBLE;
|
state = VISIBLE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,6 +213,20 @@ void PropertiesWidget::readSettings() {
|
||||||
filesList->setColumnWidth(i, contentColsWidths.at(i).toInt());
|
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<QSplitter*>(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() {
|
void PropertiesWidget::saveSettings() {
|
||||||
|
@ -218,6 +236,18 @@ void PropertiesWidget::saveSettings() {
|
||||||
for(int i=0; i<PropListModel->columnCount(); ++i) {
|
for(int i=0; i<PropListModel->columnCount(); ++i) {
|
||||||
contentColsWidths.append(filesList->columnWidth(i));
|
contentColsWidths.append(filesList->columnWidth(i));
|
||||||
}
|
}
|
||||||
|
QSplitter *hSplitter = static_cast<QSplitter*>(parentWidget());
|
||||||
|
QList<int> 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);
|
settings.setValue(QString::fromUtf8("TorrentProperties/filesColsWidth"), contentColsWidths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ private:
|
||||||
QAction *actionNormal;
|
QAction *actionNormal;
|
||||||
QAction *actionMaximum;
|
QAction *actionMaximum;
|
||||||
QAction *actionHigh;
|
QAction *actionHigh;
|
||||||
|
QList<int> slideSizes;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QPushButton* getButtonFromIndex(int index);
|
QPushButton* getButtonFromIndex(int index);
|
||||||
|
|
Loading…
Reference in a new issue