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