Browse Source

- Usability improvement in torrent properties

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
a7da280f57
  1. 12
      src/GUI.cpp
  2. 4
      src/GUI.h
  3. 43
      src/propertiesWidget.ui
  4. 39
      src/propertieswidget.cpp
  5. 6
      src/propertieswidget.h

12
src/GUI.cpp

@ -31,6 +31,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QTimer> #include <QTimer>
#include <QVBoxLayout>
#include <QDesktopServices> #include <QDesktopServices>
#include <QStatusBar> #include <QStatusBar>
#include <QFrame> #include <QFrame>
@ -138,16 +139,18 @@ 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);
hSplitter = new QSplitter(Qt::Vertical, vSplitter); rightPanel = new QWidget(vSplitter);
hSplitter = new QVBoxLayout(vSplitter);
rightPanel->setLayout(hSplitter);
// Transfer List tab // Transfer List tab
transferList = new TransferListWidget(hSplitter, BTSession); transferList = new TransferListWidget(rightPanel, BTSession);
properties = new PropertiesWidget(hSplitter, transferList, BTSession); properties = new PropertiesWidget(rightPanel, 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(hSplitter); vSplitter->addWidget(rightPanel);
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);
@ -280,6 +283,7 @@ GUI::~GUI() {
delete transferList; delete transferList;
delete properties; delete properties;
delete hSplitter; delete hSplitter;
delete rightPanel;
delete vSplitter; delete vSplitter;
delete checkConnect; delete checkConnect;
qDebug("1"); qDebug("1");

4
src/GUI.h

@ -59,6 +59,7 @@ 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
@ -78,8 +79,9 @@ class GUI : public QMainWindow, private Ui::MainWindow{
TransferListWidget *transferList; TransferListWidget *transferList;
TransferListFiltersWidget *transferListFilters; TransferListFiltersWidget *transferListFilters;
PropertiesWidget *properties; PropertiesWidget *properties;
QVBoxLayout *hSplitter;
QWidget *rightPanel;
QSplitter *vSplitter; QSplitter *vSplitter;
QSplitter *hSplitter;
QLabel *connecStatusLblIcon; QLabel *connecStatusLblIcon;
bool systrayIntegration; bool systrayIntegration;
bool displaySpeedInTitle; bool displaySpeedInTitle;

43
src/propertiesWidget.ui

@ -7,9 +7,21 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>756</width> <width>756</width>
<height>300</height> <height>291</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>333</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
@ -27,6 +39,7 @@
<widget class="QGroupBox" name="groupTorrentInfos"> <widget class="QGroupBox" name="groupTorrentInfos">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
@ -49,6 +62,7 @@
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
@ -62,6 +76,7 @@
<widget class="QLabel" name="creator_lbl"> <widget class="QLabel" name="creator_lbl">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
@ -75,6 +90,7 @@
<widget class="QLabel" name="hash_lbl2"> <widget class="QLabel" name="hash_lbl2">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
@ -88,6 +104,7 @@
<widget class="QLabel" name="comment_lbl2"> <widget class="QLabel" name="comment_lbl2">
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize>
<weight>50</weight> <weight>50</weight>
<bold>false</bold> <bold>false</bold>
</font> </font>
@ -221,8 +238,7 @@
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<family>Sans Serif</family> <pointsize>8</pointsize>
<pointsize>9</pointsize>
<weight>75</weight> <weight>75</weight>
<italic>false</italic> <italic>false</italic>
<bold>true</bold> <bold>true</bold>
@ -260,8 +276,6 @@
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="font"> <property name="font">
<font> <font>
<family>Sans Serif</family>
<pointsize>9</pointsize>
<weight>50</weight> <weight>50</weight>
<italic>false</italic> <italic>false</italic>
<bold>false</bold> <bold>false</bold>
@ -278,8 +292,6 @@
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="font"> <property name="font">
<font> <font>
<family>Sans Serif</family>
<pointsize>9</pointsize>
<weight>50</weight> <weight>50</weight>
<italic>false</italic> <italic>false</italic>
<bold>false</bold> <bold>false</bold>
@ -296,13 +308,8 @@
<widget class="QLabel" name="lbl_ratio"> <widget class="QLabel" name="lbl_ratio">
<property name="font"> <property name="font">
<font> <font>
<family>Sans Serif</family>
<pointsize>9</pointsize>
<weight>50</weight> <weight>50</weight>
<italic>false</italic>
<bold>false</bold> <bold>false</bold>
<underline>false</underline>
<strikeout>false</strikeout>
</font> </font>
</property> </property>
<property name="text"> <property name="text">
@ -314,8 +321,6 @@
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="font"> <property name="font">
<font> <font>
<family>Sans Serif</family>
<pointsize>9</pointsize>
<weight>50</weight> <weight>50</weight>
<italic>false</italic> <italic>false</italic>
<bold>false</bold> <bold>false</bold>
@ -422,6 +427,7 @@
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>8</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
@ -435,8 +441,7 @@
<widget class="QCheckBox" name="incrementalDownload"> <widget class="QCheckBox" name="incrementalDownload">
<property name="font"> <property name="font">
<font> <font>
<family>Sans Serif</family> <pointsize>8</pointsize>
<pointsize>9</pointsize>
<weight>50</weight> <weight>50</weight>
<italic>false</italic> <italic>false</italic>
<bold>false</bold> <bold>false</bold>
@ -465,8 +470,7 @@
<widget class="QLabel" name="label_12"> <widget class="QLabel" name="label_12">
<property name="font"> <property name="font">
<font> <font>
<family>Sans Serif</family> <pointsize>8</pointsize>
<pointsize>9</pointsize>
<weight>50</weight> <weight>50</weight>
<italic>false</italic> <italic>false</italic>
<bold>false</bold> <bold>false</bold>
@ -686,8 +690,7 @@
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<family>Sans Serif</family> <pointsize>8</pointsize>
<pointsize>9</pointsize>
<weight>50</weight> <weight>50</weight>
<italic>false</italic> <italic>false</italic>
<bold>false</bold> <bold>false</bold>

39
src/propertieswidget.cpp

@ -32,6 +32,7 @@
#include <QListWidgetItem> #include <QListWidgetItem>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QStackedWidget> #include <QStackedWidget>
#include <QSplitter>
#include "propertieswidget.h" #include "propertieswidget.h"
#include "TransferListWidget.h" #include "TransferListWidget.h"
#include "torrentPersistentData.h" #include "torrentPersistentData.h"
@ -44,8 +45,12 @@
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;
reduce();
connect(transferList, SIGNAL(currentTorrentChanged(QTorrentHandle&)), this, SLOT(loadTorrentInfos(QTorrentHandle &))); connect(transferList, SIGNAL(currentTorrentChanged(QTorrentHandle&)), this, SLOT(loadTorrentInfos(QTorrentHandle &)));
connect(incrementalDownload, SIGNAL(stateChanged(int)), this, SLOT(setIncrementalDownload(int))); connect(incrementalDownload, SIGNAL(stateChanged(int)), this, SLOT(setIncrementalDownload(int)));
// Downloaded pieces progress bar // Downloaded pieces progress bar
progressBar = new RealProgressBar(this); progressBar = new RealProgressBar(this);
progressBar->setForegroundColor(Qt::blue); progressBar->setForegroundColor(Qt::blue);
@ -66,6 +71,20 @@ PropertiesWidget::~PropertiesWidget() {
delete progressBarVbox; delete progressBarVbox;
} }
void PropertiesWidget::reduce() {
if(state == VISIBLE) {
stackedProperties->setFixedHeight(0);
state = REDUCED;
}
}
void PropertiesWidget::slide() {
if(state == REDUCED) {
stackedProperties->setFixedHeight(232);
state = VISIBLE;
}
}
void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) { void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) {
h = _h; h = _h;
if(!h.is_valid()) return; if(!h.is_valid()) return;
@ -181,25 +200,45 @@ QPushButton* PropertiesWidget::getButtonFromIndex(int index) {
} }
void PropertiesWidget::on_main_infos_button_clicked() { void PropertiesWidget::on_main_infos_button_clicked() {
if(state == VISIBLE && stackedProperties->currentIndex() == MAIN_TAB) {
reduce();
} else {
slide();
getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS); getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS);
stackedProperties->setCurrentIndex(MAIN_TAB); stackedProperties->setCurrentIndex(MAIN_TAB);
main_infos_button->setStyleSheet(SELECTED_BUTTON_CSS); main_infos_button->setStyleSheet(SELECTED_BUTTON_CSS);
}
} }
void PropertiesWidget::on_trackers_button_clicked() { void PropertiesWidget::on_trackers_button_clicked() {
if(state == VISIBLE && stackedProperties->currentIndex() == TRACKERS_TAB) {
reduce();
} else {
slide();
getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS); getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS);
stackedProperties->setCurrentIndex(TRACKERS_TAB); stackedProperties->setCurrentIndex(TRACKERS_TAB);
trackers_button->setStyleSheet(SELECTED_BUTTON_CSS); trackers_button->setStyleSheet(SELECTED_BUTTON_CSS);
}
} }
void PropertiesWidget::on_url_seeds_button_clicked() { void PropertiesWidget::on_url_seeds_button_clicked() {
if(state == VISIBLE && stackedProperties->currentIndex() == URLSEEDS_TAB) {
reduce();
} else {
slide();
getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS); getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS);
stackedProperties->setCurrentIndex(URLSEEDS_TAB); stackedProperties->setCurrentIndex(URLSEEDS_TAB);
url_seeds_button->setStyleSheet(SELECTED_BUTTON_CSS); url_seeds_button->setStyleSheet(SELECTED_BUTTON_CSS);
}
} }
void PropertiesWidget::on_files_button_clicked() { void PropertiesWidget::on_files_button_clicked() {
if(state == VISIBLE && stackedProperties->currentIndex() == FILES_TAB) {
reduce();
} else {
slide();
getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS); getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS);
stackedProperties->setCurrentIndex(FILES_TAB); stackedProperties->setCurrentIndex(FILES_TAB);
files_button->setStyleSheet(SELECTED_BUTTON_CSS); files_button->setStyleSheet(SELECTED_BUTTON_CSS);
}
} }

6
src/propertieswidget.h

@ -43,6 +43,7 @@ class RealProgressBarThread;
class bittorrent; class bittorrent;
enum Tab {MAIN_TAB, TRACKERS_TAB, URLSEEDS_TAB, FILES_TAB}; enum Tab {MAIN_TAB, TRACKERS_TAB, URLSEEDS_TAB, FILES_TAB};
enum SlideState {REDUCED, VISIBLE};
class PropertiesWidget : public QWidget, private Ui::PropertiesWidget { class PropertiesWidget : public QWidget, private Ui::PropertiesWidget {
Q_OBJECT Q_OBJECT
@ -55,6 +56,7 @@ private:
RealProgressBarThread *progressBarUpdater; RealProgressBarThread *progressBarUpdater;
QVBoxLayout *progressBarVbox; QVBoxLayout *progressBarVbox;
bittorrent* BTSession; bittorrent* BTSession;
SlideState state;
protected: protected:
QPushButton* getButtonFromIndex(int index); QPushButton* getButtonFromIndex(int index);
@ -69,6 +71,10 @@ protected slots:
void on_url_seeds_button_clicked(); void on_url_seeds_button_clicked();
void on_files_button_clicked(); void on_files_button_clicked();
public slots:
void reduce();
void slide();
public: public:
PropertiesWidget(QWidget *parent, TransferListWidget *transferList, bittorrent* BTSession); PropertiesWidget(QWidget *parent, TransferListWidget *transferList, bittorrent* BTSession);
~PropertiesWidget(); ~PropertiesWidget();

Loading…
Cancel
Save