|
|
@ -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); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|