- Added Peers tab (not functional yet)

This commit is contained in:
Christophe Dumez 2009-11-12 19:44:47 +00:00
parent bc2a4b622b
commit d8c6e2bcc6
3 changed files with 119 additions and 6 deletions

View file

@ -2,6 +2,14 @@
<ui version="4.0">
<class>PropertiesWidget</class>
<widget class="QWidget" name="PropertiesWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>540</width>
<height>305</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
@ -42,9 +50,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-39</y>
<width>714</width>
<height>285</height>
<y>0</y>
<width>536</width>
<height>268</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
@ -278,7 +286,7 @@
<item>
<widget class="QLabel" name="label_10">
<property name="text">
<string notr="true"> </string>
<string notr="true"/>
</property>
</widget>
</item>
@ -303,7 +311,7 @@
<item>
<widget class="QLabel" name="label_11">
<property name="text">
<string notr="true"> </string>
<string notr="true"/>
</property>
</widget>
</item>
@ -721,6 +729,61 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="page_5">
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<widget class="QTreeWidget" name="peersList">
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<column>
<property name="text">
<string>IP</string>
</property>
</column>
<column>
<property name="text">
<string>Client</string>
</property>
</column>
<column>
<property name="text">
<string>Progress</string>
</property>
</column>
<column>
<property name="text">
<string>Down speed</string>
</property>
</column>
<column>
<property name="text">
<string>Up speed</string>
</property>
</column>
<column>
<property name="text">
<string>Downloaded</string>
</property>
</column>
<column>
<property name="text">
<string>Uploaded</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_3">
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
@ -935,6 +998,37 @@ margin-left: 3px; margin-right: 3px;
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="peers_button">
<property name="minimumSize">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
<property name="styleSheet">
<string>QPushButton {
border: 1px solid rgb(85, 81, 91);
border-radius: 3px;
padding: 2px;
margin-left: 3px; margin-right: 3px;
}</string>
</property>
<property name="text">
<string>Peers</string>
</property>
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/Icons/oxygen/peer.png</normaloff>:/Icons/oxygen/peer.png</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="url_seeds_button">
<property name="styleSheet">

View file

@ -252,6 +252,10 @@ void PropertiesWidget::saveSettings() {
settings.setValue(QString::fromUtf8("TorrentProperties/filesColsWidth"), contentColsWidths);
}
void PropertiesWidget::loadPeers() {
// TODO
}
void PropertiesWidget::loadDynamicData() {
if(!h.is_valid()) return;
try {
@ -360,6 +364,8 @@ QPushButton* PropertiesWidget::getButtonFromIndex(int index) {
switch(index) {
case TRACKERS_TAB:
return trackers_button;
case PEERS_TAB:
return peers_button;
case URLSEEDS_TAB:
return url_seeds_button;
case FILES_TAB:
@ -391,6 +397,17 @@ void PropertiesWidget::on_trackers_button_clicked() {
}
}
void PropertiesWidget::on_peers_button_clicked() {
if(state == VISIBLE && stackedProperties->currentIndex() == PEERS_TAB) {
reduce();
} else {
slide();
getButtonFromIndex(stackedProperties->currentIndex())->setStyleSheet(DEFAULT_BUTTON_CSS);
stackedProperties->setCurrentIndex(PEERS_TAB);
peers_button->setStyleSheet(SELECTED_BUTTON_CSS);
}
}
void PropertiesWidget::on_url_seeds_button_clicked() {
if(state == VISIBLE && stackedProperties->currentIndex() == URLSEEDS_TAB) {
reduce();

View file

@ -46,7 +46,7 @@ class PropListDelegate;
class QAction;
class torrent_file;
enum Tab {MAIN_TAB, TRACKERS_TAB, URLSEEDS_TAB, FILES_TAB};
enum Tab {MAIN_TAB, TRACKERS_TAB, PEERS_TAB, URLSEEDS_TAB, FILES_TAB};
enum SlideState {REDUCED, VISIBLE};
class PropertiesWidget : public QWidget, private Ui::PropertiesWidget {
@ -79,8 +79,10 @@ protected slots:
void setIncrementalDownload(int checkboxState);
void loadTrackers();
void loadUrlSeeds();
void loadPeers();
void on_main_infos_button_clicked();
void on_trackers_button_clicked();
void on_peers_button_clicked();
void on_url_seeds_button_clicked();
void on_files_button_clicked();
void ignoreSelection();