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 13810 2013-01-20 01:31:58Z 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 onTorrentFileListRebuilt( ); |
---|
53 | void onTimer( ); |
---|
54 | |
---|
55 | public: |
---|
56 | Details( Session&, Prefs&, TorrentModel&, QWidget * parent = 0 ); |
---|
57 | ~Details( ); |
---|
58 | void setIds( const QSet<int>& ids ); |
---|
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 | bool myFilesDirty; |
---|
140 | |
---|
141 | private slots: |
---|
142 | void refreshPref( int key ); |
---|
143 | void onBandwidthPriorityChanged( int ); |
---|
144 | void onFilePriorityChanged( const QSet<int>& fileIndices, int ); |
---|
145 | void onFileWantedChanged( const QSet<int>& fileIndices, bool ); |
---|
146 | void onPathEdited (const QString& oldpath, const QString& newname); |
---|
147 | void onHonorsSessionLimitsToggled( bool ); |
---|
148 | void onDownloadLimitedToggled( bool ); |
---|
149 | void onSpinBoxEditingFinished( ); |
---|
150 | void onUploadLimitedToggled( bool ); |
---|
151 | void onRatioModeChanged( int ); |
---|
152 | void onIdleModeChanged( int ); |
---|
153 | void onShowTrackerScrapesToggled( bool ); |
---|
154 | void onShowBackupTrackersToggled( bool ); |
---|
155 | void onTrackerSelectionChanged( ); |
---|
156 | void onAddTrackerClicked( ); |
---|
157 | void onEditTrackerClicked( ); |
---|
158 | void onRemoveTrackerClicked( ); |
---|
159 | void refresh( ); |
---|
160 | }; |
---|
161 | |
---|
162 | #endif |
---|