1 | /* |
---|
2 | * This file Copyright (C) 2009-2015 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: DetailsDialog.h 14539 2015-06-12 22:12:12Z mikedld $ |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef QTR_DETAILS_DIALOG_H |
---|
11 | #define QTR_DETAILS_DIALOG_H |
---|
12 | |
---|
13 | #include <QDialog> |
---|
14 | #include <QString> |
---|
15 | #include <QMap> |
---|
16 | #include <QSet> |
---|
17 | #include <QTimer> |
---|
18 | |
---|
19 | #include "ui_DetailsDialog.h" |
---|
20 | |
---|
21 | class QTreeWidgetItem; |
---|
22 | |
---|
23 | class Prefs; |
---|
24 | class Session; |
---|
25 | class Torrent; |
---|
26 | class TorrentModel; |
---|
27 | class TrackerDelegate; |
---|
28 | class TrackerModel; |
---|
29 | class TrackerModelFilter; |
---|
30 | |
---|
31 | class DetailsDialog: public QDialog |
---|
32 | { |
---|
33 | Q_OBJECT |
---|
34 | |
---|
35 | public: |
---|
36 | DetailsDialog (Session&, Prefs&, const TorrentModel&, QWidget * parent = nullptr); |
---|
37 | virtual ~DetailsDialog (); |
---|
38 | |
---|
39 | void setIds (const QSet<int>& ids); |
---|
40 | |
---|
41 | // QWidget |
---|
42 | virtual QSize sizeHint () const { return QSize (440, 460); } |
---|
43 | |
---|
44 | private: |
---|
45 | void initPeersTab (); |
---|
46 | void initTrackerTab (); |
---|
47 | void initInfoTab (); |
---|
48 | void initFilesTab (); |
---|
49 | void initOptionsTab (); |
---|
50 | |
---|
51 | void getNewData (); |
---|
52 | |
---|
53 | QIcon getStockIcon (const QString& freedesktop_name, int fallback); |
---|
54 | |
---|
55 | private slots: |
---|
56 | void refresh (); |
---|
57 | void refreshPref (int key); |
---|
58 | |
---|
59 | void onTorrentChanged (); |
---|
60 | void onTimer (); |
---|
61 | |
---|
62 | // Tracker tab |
---|
63 | void onTrackerSelectionChanged (); |
---|
64 | void onAddTrackerClicked (); |
---|
65 | void onEditTrackerClicked (); |
---|
66 | void onRemoveTrackerClicked (); |
---|
67 | void onShowTrackerScrapesToggled (bool); |
---|
68 | void onShowBackupTrackersToggled (bool); |
---|
69 | |
---|
70 | // Files tab |
---|
71 | void onFilePriorityChanged (const QSet<int>& fileIndices, int); |
---|
72 | void onFileWantedChanged (const QSet<int>& fileIndices, bool); |
---|
73 | void onPathEdited (const QString& oldpath, const QString& newname); |
---|
74 | void onOpenRequested (const QString& path); |
---|
75 | |
---|
76 | // Options tab |
---|
77 | void onBandwidthPriorityChanged (int); |
---|
78 | void onHonorsSessionLimitsToggled (bool); |
---|
79 | void onDownloadLimitedToggled (bool); |
---|
80 | void onSpinBoxEditingFinished (); |
---|
81 | void onUploadLimitedToggled (bool); |
---|
82 | void onRatioModeChanged (int); |
---|
83 | void onIdleModeChanged (int); |
---|
84 | void onIdleLimitChanged (); |
---|
85 | |
---|
86 | private: |
---|
87 | Session& mySession; |
---|
88 | Prefs& myPrefs; |
---|
89 | const TorrentModel& myModel; |
---|
90 | |
---|
91 | Ui::DetailsDialog ui; |
---|
92 | |
---|
93 | QSet<int> myIds; |
---|
94 | QTimer myTimer; |
---|
95 | bool myChangedTorrents; |
---|
96 | bool myHavePendingRefresh; |
---|
97 | |
---|
98 | TrackerModel * myTrackerModel; |
---|
99 | TrackerModelFilter * myTrackerFilter; |
---|
100 | TrackerDelegate * myTrackerDelegate; |
---|
101 | |
---|
102 | QMap<QString, QTreeWidgetItem*> myPeers; |
---|
103 | }; |
---|
104 | |
---|
105 | #endif // QTR_DETAILS_DIALOG_H |
---|