Browse Source

- A little eye candy

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
8686ef0892
  1. 35
      src/propertiesWidget.ui
  2. 22
      src/propertieswidget.cpp
  3. 3
      src/propertieswidget.h

35
src/propertiesWidget.ui

@ -732,10 +732,24 @@
</widget> </widget>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QPushButton" name="main_infos_button"> <widget class="QPushButton" name="main_infos_button">
<property name="styleSheet">
<string>QPushButton {
border: 1px solid rgb(85, 81, 91);
border-radius: 3px;
padding: 2px;
}</string>
</property>
<property name="text"> <property name="text">
<string>General</string> <string>General</string>
</property> </property>
@ -753,6 +767,13 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="trackers_button"> <widget class="QPushButton" name="trackers_button">
<property name="styleSheet">
<string>QPushButton {
border: 1px solid rgb(85, 81, 91);
border-radius: 3px;
padding: 2px;
}</string>
</property>
<property name="text"> <property name="text">
<string>Trackers</string> <string>Trackers</string>
</property> </property>
@ -770,6 +791,13 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="url_seeds_button"> <widget class="QPushButton" name="url_seeds_button">
<property name="styleSheet">
<string>QPushButton {
border: 1px solid rgb(85, 81, 91);
border-radius: 3px;
padding: 2px;
}</string>
</property>
<property name="text"> <property name="text">
<string>URL seeds</string> <string>URL seeds</string>
</property> </property>
@ -787,6 +815,13 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="files_button"> <widget class="QPushButton" name="files_button">
<property name="styleSheet">
<string>QPushButton {
border: 1px solid rgb(85, 81, 91);
border-radius: 3px;
padding: 2px;
}</string>
</property>
<property name="text"> <property name="text">
<string>Files</string> <string>Files</string>
</property> </property>

22
src/propertieswidget.cpp

@ -39,6 +39,9 @@
#include "realprogressbarthread.h" #include "realprogressbarthread.h"
#include "bittorrent.h" #include "bittorrent.h"
#define DEFAULT_BUTTON_CSS "QPushButton {border: 1px solid rgb(85, 81, 91);border-radius: 3px;padding: 2px;}"
#define SELECTED_BUTTON_CSS "QPushButton {border: 1px solid rgb(85, 81, 91);border-radius: 3px;padding: 2px;background-color: rgb(255, 208, 105);}"
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);
connect(transferList, SIGNAL(currentTorrentChanged(QTorrentHandle&)), this, SLOT(loadTorrentInfos(QTorrentHandle &))); connect(transferList, SIGNAL(currentTorrentChanged(QTorrentHandle&)), this, SLOT(loadTorrentInfos(QTorrentHandle &)));
@ -68,7 +71,7 @@ void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) {
if(!h.is_valid()) return; if(!h.is_valid()) return;
if(progressBarUpdater) if(progressBarUpdater)
delete progressBarUpdater; delete progressBarUpdater;
progressBarUpdater = 0; progressBarUpdater = 0;
try { try {
// Save path // Save path
save_path->setText(TorrentPersistentData::getSavePath(h.hash())); save_path->setText(TorrentPersistentData::getSavePath(h.hash()));
@ -124,8 +127,8 @@ void PropertiesWidget::loadDynamicData() {
void PropertiesWidget::setIncrementalDownload(int checkboxState) { void PropertiesWidget::setIncrementalDownload(int checkboxState) {
if(!h.is_valid()) return; if(!h.is_valid()) return;
h.set_sequential_download(checkboxState == Qt::Checked); h.set_sequential_download(checkboxState == Qt::Checked);
TorrentPersistentData::saveSequentialStatus(h); TorrentPersistentData::saveSequentialStatus(h);
} }
void PropertiesWidget::loadTrackers() { void PropertiesWidget::loadTrackers() {
@ -164,10 +167,23 @@ void PropertiesWidget::loadTrackers() {
} }
/* Tab buttons */ /* Tab buttons */
QPushButton* PropertiesWidget::getButtonFromIndex(int index) {
switch(index) {
case TRACKERS_TAB:
return trackers_button;
default:
return main_infos_button;
}
}
void PropertiesWidget::on_main_infos_button_clicked() { void PropertiesWidget::on_main_infos_button_clicked() {
getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS);
stackedProperties->setCurrentIndex(MAIN_TAB); stackedProperties->setCurrentIndex(MAIN_TAB);
main_infos_button->setStyleSheet(SELECTED_BUTTON_CSS);
} }
void PropertiesWidget::on_trackers_button_clicked() { void PropertiesWidget::on_trackers_button_clicked() {
getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS);
stackedProperties->setCurrentIndex(TRACKERS_TAB); stackedProperties->setCurrentIndex(TRACKERS_TAB);
trackers_button->setStyleSheet(SELECTED_BUTTON_CSS);
} }

3
src/propertieswidget.h

@ -56,6 +56,9 @@ private:
QVBoxLayout *progressBarVbox; QVBoxLayout *progressBarVbox;
bittorrent* BTSession; bittorrent* BTSession;
protected:
QPushButton* getButtonFromIndex(int index);
protected slots: protected slots:
void loadTorrentInfos(QTorrentHandle &h); void loadTorrentInfos(QTorrentHandle &h);
void loadDynamicData(); void loadDynamicData();

Loading…
Cancel
Save