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 @@ @@ -31,6 +31,7 @@
#include <QMessageBox>
#include <QDesktopWidget>
#include <QTimer>
#include <QVBoxLayout>
#include <QDesktopServices>
#include <QStatusBar>
#include <QFrame>
@ -138,16 +139,18 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis @@ -138,16 +139,18 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
qDebug("create tabWidget");
tabs = new QTabWidget();
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
transferList = new TransferListWidget(hSplitter, BTSession);
properties = new PropertiesWidget(hSplitter, transferList, BTSession);
transferList = new TransferListWidget(rightPanel, BTSession);
properties = new PropertiesWidget(rightPanel, transferList, BTSession);
transferListFilters = new TransferListFiltersWidget(vSplitter, transferList);
hSplitter->addWidget(transferList);
hSplitter->addWidget(properties);
vSplitter->addWidget(transferListFilters);
vSplitter->addWidget(hSplitter);
vSplitter->addWidget(rightPanel);
tabs->addTab(vSplitter, QIcon(QString::fromUtf8(":/Icons/oxygen/folder-remote.png")), tr("Transfers"));
vboxLayout->addWidget(tabs);
@ -280,6 +283,7 @@ GUI::~GUI() { @@ -280,6 +283,7 @@ GUI::~GUI() {
delete transferList;
delete properties;
delete hSplitter;
delete rightPanel;
delete vSplitter;
delete checkConnect;
qDebug("1");

4
src/GUI.h

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

43
src/propertiesWidget.ui

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

39
src/propertieswidget.cpp

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

6
src/propertieswidget.h

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

Loading…
Cancel
Save