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