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: OptionsDialog.h 14561 2015-09-01 20:19:26Z mikedld $ |
---|
8 | */ |
---|
9 | |
---|
10 | #ifndef QTR_OPTIONS_DIALOG_H |
---|
11 | #define QTR_OPTIONS_DIALOG_H |
---|
12 | |
---|
13 | #include <QCryptographicHash> |
---|
14 | #include <QDir> |
---|
15 | #include <QFile> |
---|
16 | #include <QMap> |
---|
17 | #include <QString> |
---|
18 | #include <QTimer> |
---|
19 | #include <QVector> |
---|
20 | |
---|
21 | #include "AddData.h" // AddData |
---|
22 | #include "BaseDialog.h" |
---|
23 | #include "Torrent.h" // FileList |
---|
24 | |
---|
25 | #include "ui_OptionsDialog.h" |
---|
26 | |
---|
27 | class Prefs; |
---|
28 | class Session; |
---|
29 | |
---|
30 | extern "C" |
---|
31 | { |
---|
32 | struct tr_variant; |
---|
33 | } |
---|
34 | |
---|
35 | class OptionsDialog: public BaseDialog |
---|
36 | { |
---|
37 | Q_OBJECT |
---|
38 | |
---|
39 | public: |
---|
40 | OptionsDialog (Session& session, const Prefs& prefs, const AddData& addme, QWidget * parent = nullptr); |
---|
41 | virtual ~OptionsDialog (); |
---|
42 | |
---|
43 | private: |
---|
44 | typedef QMap<uint32_t, int32_t> mybins_t; |
---|
45 | |
---|
46 | private: |
---|
47 | void reload (); |
---|
48 | void clearInfo (); |
---|
49 | void clearVerify (); |
---|
50 | |
---|
51 | private slots: |
---|
52 | void onAccepted (); |
---|
53 | void onPriorityChanged (const QSet<int>& fileIndices, int); |
---|
54 | void onWantedChanged (const QSet<int>& fileIndices, bool); |
---|
55 | void onVerify (); |
---|
56 | void onTimeout (); |
---|
57 | |
---|
58 | void onSourceChanged (); |
---|
59 | void onDestinationChanged (); |
---|
60 | |
---|
61 | private: |
---|
62 | Session& mySession; |
---|
63 | AddData myAdd; |
---|
64 | |
---|
65 | Ui::OptionsDialog ui; |
---|
66 | |
---|
67 | QDir myLocalDestination; |
---|
68 | bool myHaveInfo; |
---|
69 | tr_info myInfo; |
---|
70 | QPushButton * myVerifyButton; |
---|
71 | QVector<int> myPriorities; |
---|
72 | QVector<bool> myWanted; |
---|
73 | FileList myFiles; |
---|
74 | |
---|
75 | QTimer myVerifyTimer; |
---|
76 | char myVerifyBuf[2048 * 4]; |
---|
77 | QFile myVerifyFile; |
---|
78 | uint64_t myVerifyFilePos; |
---|
79 | int myVerifyFileIndex; |
---|
80 | uint32_t myVerifyPieceIndex; |
---|
81 | uint32_t myVerifyPiecePos; |
---|
82 | QVector<bool> myVerifyFlags; |
---|
83 | QCryptographicHash myVerifyHash; |
---|
84 | mybins_t myVerifyBins; |
---|
85 | QTimer myEditTimer; |
---|
86 | }; |
---|
87 | |
---|
88 | #endif // QTR_OPTIONS_DIALOG_H |
---|