1 | /* |
---|
2 | * This file Copyright (C) 2009-2014 Mnemosyne LLC |
---|
3 | * |
---|
4 | * It may be used under the GNU GPL versions 2 or 3 |
---|
5 | * or any future license endorsed by Mnemosyne LLC. |
---|
6 | * |
---|
7 | * $Id: details.h 14241 2014-01-21 03:10:30Z jordan $ |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef DETAILS_DIALOG_H |
---|
11 | #define DETAILS_DIALOG_H |
---|
12 | |
---|
13 | #include <QDialog> |
---|
14 | #include <QString> |
---|
15 | #include <QMap> |
---|
16 | #include <QSet> |
---|
17 | #include <QTimer> |
---|
18 | #include <QWidgetList> |
---|
19 | |
---|
20 | #include "prefs.h" |
---|
21 | |
---|
22 | class FileTreeView; |
---|
23 | class QTreeView; |
---|
24 | class QComboBox; |
---|
25 | class QCheckBox; |
---|
26 | class QDoubleSpinBox; |
---|
27 | class QLabel; |
---|
28 | class QRadioButton; |
---|
29 | class QSpinBox; |
---|
30 | class QTextBrowser; |
---|
31 | class QTreeWidget; |
---|
32 | class QTreeWidgetItem; |
---|
33 | class Session; |
---|
34 | class Torrent; |
---|
35 | class TorrentModel; |
---|
36 | class TrackerDelegate; |
---|
37 | class TrackerModel; |
---|
38 | class TrackerModelFilter; |
---|
39 | |
---|
40 | class Details: public QDialog |
---|
41 | { |
---|
42 | Q_OBJECT |
---|
43 | |
---|
44 | private: |
---|
45 | void getNewData (); |
---|
46 | |
---|
47 | private slots: |
---|
48 | void onTorrentChanged (); |
---|
49 | void onTimer (); |
---|
50 | |
---|
51 | public: |
---|
52 | Details (Session&, Prefs&, TorrentModel&, QWidget * parent = 0); |
---|
53 | ~Details (); |
---|
54 | void setIds (const QSet<int>& ids); |
---|
55 | virtual QSize sizeHint () const { return QSize (440, 460); } |
---|
56 | |
---|
57 | private: |
---|
58 | QWidget * createPeersTab (); |
---|
59 | QWidget * createTrackerTab (); |
---|
60 | QWidget * createInfoTab (); |
---|
61 | QWidget * createFilesTab (); |
---|
62 | QWidget * createOptionsTab (); |
---|
63 | |
---|
64 | private: |
---|
65 | QIcon getStockIcon (const QString& freedesktop_name, int fallback); |
---|
66 | QString timeToStringRounded (int seconds); |
---|
67 | QString trimToDesiredWidth (const QString& str); |
---|
68 | void enableWhenChecked (QCheckBox *, QWidget *); |
---|
69 | |
---|
70 | private: |
---|
71 | Session& mySession; |
---|
72 | Prefs& myPrefs; |
---|
73 | TorrentModel& myModel; |
---|
74 | QSet<int> myIds; |
---|
75 | QTimer myTimer; |
---|
76 | bool myChangedTorrents; |
---|
77 | bool myHavePendingRefresh; |
---|
78 | |
---|
79 | QLabel * myStateLabel; |
---|
80 | QLabel * myHaveLabel; |
---|
81 | QLabel * myAvailabilityLabel; |
---|
82 | QLabel * myDownloadedLabel; |
---|
83 | QLabel * myUploadedLabel; |
---|
84 | QLabel * myErrorLabel; |
---|
85 | QLabel * myRunTimeLabel; |
---|
86 | QLabel * myETALabel; |
---|
87 | QLabel * myLastActivityLabel; |
---|
88 | |
---|
89 | QCheckBox * mySessionLimitCheck; |
---|
90 | QCheckBox * mySingleDownCheck; |
---|
91 | QCheckBox * mySingleUpCheck; |
---|
92 | QCheckBox * myShowTrackerScrapesCheck; |
---|
93 | QCheckBox * myShowBackupTrackersCheck; |
---|
94 | QPushButton * myAddTrackerButton; |
---|
95 | QPushButton * myEditTrackerButton; |
---|
96 | QPushButton * myRemoveTrackerButton; |
---|
97 | QSpinBox * mySingleDownSpin; |
---|
98 | QSpinBox * mySingleUpSpin; |
---|
99 | QComboBox * myRatioCombo; |
---|
100 | QDoubleSpinBox * myRatioSpin; |
---|
101 | QComboBox * myIdleCombo; |
---|
102 | QSpinBox * myIdleSpin; |
---|
103 | QSpinBox * myPeerLimitSpin; |
---|
104 | QComboBox * myBandwidthPriorityCombo; |
---|
105 | |
---|
106 | QLabel * mySizeLabel; |
---|
107 | QLabel * myHashLabel; |
---|
108 | QLabel * myPrivacyLabel; |
---|
109 | QLabel * myOriginLabel; |
---|
110 | QLabel * myLocationLabel; |
---|
111 | QTextBrowser * myCommentBrowser; |
---|
112 | |
---|
113 | QLabel * myTrackerLabel; |
---|
114 | QLabel * myScrapeTimePrevLabel; |
---|
115 | QLabel * myScrapeTimeNextLabel; |
---|
116 | QLabel * myScrapeResponseLabel; |
---|
117 | QLabel * myAnnounceTimePrevLabel; |
---|
118 | QLabel * myAnnounceTimeNextLabel; |
---|
119 | QLabel * myAnnounceResponseLabel; |
---|
120 | QLabel * myAnnounceManualLabel; |
---|
121 | |
---|
122 | TrackerModel * myTrackerModel; |
---|
123 | TrackerModelFilter * myTrackerFilter; |
---|
124 | TrackerDelegate * myTrackerDelegate; |
---|
125 | QTreeView * myTrackerView; |
---|
126 | //QMap<QString,QTreeWidgetItem*> myTrackerTiers; |
---|
127 | //QMap<QString,QTreeWidgetItem*> myTrackerItems; |
---|
128 | |
---|
129 | QTreeWidget * myPeerTree; |
---|
130 | QMap<QString,QTreeWidgetItem*> myPeers; |
---|
131 | |
---|
132 | QWidgetList myWidgets; |
---|
133 | |
---|
134 | FileTreeView * myFileTreeView; |
---|
135 | |
---|
136 | private slots: |
---|
137 | void refreshPref (int key); |
---|
138 | void onBandwidthPriorityChanged (int); |
---|
139 | void onFilePriorityChanged (const QSet<int>& fileIndices, int); |
---|
140 | void onFileWantedChanged (const QSet<int>& fileIndices, bool); |
---|
141 | void onPathEdited (const QString& oldpath, const QString& newname); |
---|
142 | void onOpenRequested (const QString& path); |
---|
143 | void onHonorsSessionLimitsToggled (bool); |
---|
144 | void onDownloadLimitedToggled (bool); |
---|
145 | void onSpinBoxEditingFinished (); |
---|
146 | void onUploadLimitedToggled (bool); |
---|
147 | void onRatioModeChanged (int); |
---|
148 | void onIdleModeChanged (int); |
---|
149 | void onShowTrackerScrapesToggled (bool); |
---|
150 | void onShowBackupTrackersToggled (bool); |
---|
151 | void onTrackerSelectionChanged (); |
---|
152 | void onAddTrackerClicked (); |
---|
153 | void onEditTrackerClicked (); |
---|
154 | void onRemoveTrackerClicked (); |
---|
155 | void refresh (); |
---|
156 | }; |
---|
157 | |
---|
158 | #endif |
---|