Browse Source

- Displaying more infos about the torrent in its properties (hash, creator, comment)

- Preparing GUI to allow trackers list edition (Unfinished)
adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
a346d49b60
  1. 718
      src/properties.ui
  2. 8
      src/properties_imp.cpp

718
src/properties.ui

@ -70,64 +70,209 @@ @@ -70,64 +70,209 @@
</widget>
</item>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
<widget class="QGroupBox" name="groupTorrentInfos" >
<property name="title" >
<string>Torrent infos</string>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="savePath_lbl" >
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Save path:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="save_path" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="savePath_lbl" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>29</height>
</size>
</property>
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Save path:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="creator_lbl" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>28</height>
</size>
</property>
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Creator:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="hash_lbl2" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>29</height>
</size>
</property>
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Torrent hash:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="comment_lbl" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>128</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>120</height>
</size>
</property>
<property name="font" >
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text" >
<string>Comment:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="save_path" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>29</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="creator" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>28</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="hash_lbl" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>29</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="comment_txt" >
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>120</height>
</size>
</property>
<property name="undoRedoEnabled" >
<bool>false</bool>
</property>
<property name="readOnly" >
<bool>true</bool>
</property>
<property name="acceptRichText" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2" >
<widget class="QGroupBox" name="groupBox" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -135,7 +280,7 @@ @@ -135,7 +280,7 @@
<property name="minimumSize" >
<size>
<width>0</width>
<height>170</height>
<height>115</height>
</size>
</property>
<property name="font" >
@ -150,7 +295,7 @@ @@ -150,7 +295,7 @@
</font>
</property>
<property name="title" >
<string>Tracker</string>
<string>Current session</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
@ -176,7 +321,7 @@ @@ -176,7 +321,7 @@
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_9" >
<widget class="QLabel" name="label_5" >
<property name="font" >
<font>
<family>Sans Serif</family>
@ -189,12 +334,12 @@ @@ -189,12 +334,12 @@
</font>
</property>
<property name="text" >
<string>Trackers:</string>
<string>Total uploaded:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_10" >
<widget class="QLabel" name="label_6" >
<property name="font" >
<font>
<family>Sans Serif</family>
@ -207,18 +352,30 @@ @@ -207,18 +352,30 @@
</font>
</property>
<property name="text" >
<string>Errors:</string>
<string>Total downloaded:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2" >
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>16</height>
</size>
<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" >
<string>Share ratio:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_8" >
<property name="font" >
<font>
<family>Sans Serif</family>
@ -231,7 +388,7 @@ @@ -231,7 +388,7 @@
</font>
</property>
<property name="text" >
<string>Current tracker:</string>
<string>Total failed:</string>
</property>
</widget>
</item>
@ -246,32 +403,28 @@ @@ -246,32 +403,28 @@
<number>6</number>
</property>
<item>
<widget class="QListWidget" name="trackersURLS" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<widget class="QLabel" name="upTotal" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="trackerErrors" >
<property name="lineWrapMode" >
<enum>QTextEdit::NoWrap</enum>
<widget class="QLabel" name="dlTotal" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="trackerURL" >
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>16</height>
</size>
<widget class="QLabel" name="shareRatio" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="failed" >
<property name="text" >
<string/>
</property>
@ -279,17 +432,61 @@ @@ -279,17 +432,61 @@
</item>
</layout>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>181</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox" >
<widget class="QCheckBox" name="incrementalDownload" >
<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" >
<string>Download in correct order (slower but good for previewing)</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3" >
<attribute name="title" >
<string>Trackers</string>
</attribute>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox_2" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>5</vsizetype>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -297,7 +494,7 @@ @@ -297,7 +494,7 @@
<property name="minimumSize" >
<size>
<width>0</width>
<height>115</height>
<height>170</height>
</size>
</property>
<property name="font" >
@ -312,7 +509,7 @@ @@ -312,7 +509,7 @@
</font>
</property>
<property name="title" >
<string>Current Session</string>
<string>Tracker</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
@ -329,6 +526,24 @@ @@ -329,6 +526,24 @@
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_9" >
<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" >
<string>Trackers:</string>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
@ -337,6 +552,18 @@ @@ -337,6 +552,18 @@
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QListWidget" name="trackersURLS" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
@ -346,175 +573,234 @@ @@ -346,175 +573,234 @@
<number>6</number>
</property>
<item>
<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>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="text" >
<string>Total uploaded:</string>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item>
<widget class="QLabel" name="upTotal" >
<widget class="QPushButton" name="removeTracker_button" >
<property name="minimumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<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>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
<widget class="QPushButton" name="addTracker_button" >
<property name="minimumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text" >
<string>Total downloaded:</string>
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dlTotal" >
<property name="text" >
<string/>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</widget>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="spacing" >
<number>6</number>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
<item>
<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" >
<string>Share Ratio:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="shareRatio" >
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
<widget class="QPushButton" name="riseTracker_button" >
<property name="minimumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="spacing" >
<number>6</number>
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<item>
<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>
<underline>false</underline>
<strikeout>false</strikeout>
</font>
</property>
<property name="text" >
<string>Total failed:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="failed" >
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="lowerTracker_button" >
<property name="minimumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_10" >
<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" >
<string>Errors:</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
<widget class="QTextBrowser" name="trackerErrors" >
<property name="lineWrapMode" >
<enum>QTextEdit::NoWrap</enum>
</property>
<property name="sizeHint" >
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QLabel" name="label_2" >
<property name="maximumSize" >
<size>
<width>181</width>
<height>20</height>
<width>16777215</width>
<height>16</height>
</size>
</property>
</spacer>
<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" >
<string>Current tracker:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="trackerURL" >
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>16</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="incrementalDownload" >
<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" >
<string>Download in correct order (slower but good for previewing)</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2" >

8
src/properties_imp.cpp

@ -42,11 +42,16 @@ properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErr @@ -42,11 +42,16 @@ properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErr
filesList->setItemDelegate(PropDelegate);
connect(filesList, SIGNAL(doubleClicked(const QModelIndex&)), this, SLOT(toggleSelectedState(const QModelIndex&)));
// get Infos from torrent handle
save_path->setText(QString(h.save_path().string().c_str()));
fileHash = QString(misc::toString(h.info_hash()).c_str());
torrent_status torrentStatus = h.status();
torrent_info torrentInfo = h.get_torrent_info();
fileName->setText(torrentInfo.name().c_str());
// Torrent Infos
save_path->setText(QString(h.save_path().string().c_str()));
creator->setText(QString(torrentInfo.creator().c_str()));
hash_lbl->setText(fileHash);
comment_txt->setText(QString(torrentInfo.comment().c_str()));
//Trackers
QString tracker = QString(torrentStatus.current_tracker.c_str()).trimmed();
if(!tracker.isEmpty()){
trackerURL->setText(tracker);
@ -57,6 +62,7 @@ properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErr @@ -57,6 +62,7 @@ properties::properties(QWidget *parent, torrent_handle h, QStringList trackerErr
for(unsigned int i=0; i<trackers.size(); ++i){
trackersURLS->addItem(QString(trackers[i].url.c_str()));
}
// Session infos
char tmp[MAX_CHAR_TMP];
failed->setText(misc::friendlyUnit(torrentStatus.total_failed_bytes));
upTotal->setText(misc::friendlyUnit(torrentStatus.total_payload_upload));

Loading…
Cancel
Save