Revert "transmission: update from 2.13 to 2.22"
[tomato.git] / release / src / router / transmission / qt / options.h
blob1d202886f729bae15b768879ae6f07dfb38fec71
1 /*
2 * This file Copyright (C) Mnemosyne LLC
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.
8 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
10 * $Id: options.h 11092 2010-08-01 20:36:13Z charles $
13 #ifndef OPTIONS_DIALOG_H
14 #define OPTIONS_DIALOG_H
16 #include <iostream>
18 #include <QDialog>
19 #include <QEvent>
20 #include <QString>
21 #include <QDir>
22 #include <QVector>
23 #include <QMap>
24 #include <QPushButton>
25 #include <QString>
26 #include <QStringList>
27 #include <QCryptographicHash>
28 #include <QFile>
29 #include <QTimer>
31 #include "add-data.h" // AddData
32 #include "file-tree.h" // FileList
34 class FileTreeView;
35 class Prefs;
36 class QCheckBox;
37 class QComboBox;
38 class Session;
40 extern "C" { struct tr_benc; };
42 class FileAdded: public QObject
44 Q_OBJECT
45 const int64_t myTag;
46 QString myName;
47 QString myDelFile;
49 public:
50 FileAdded( int tag, const QString& name ): myTag(tag), myName(name) { }
51 ~FileAdded( ) { }
52 void setFileToDelete( const QString& file ) { myDelFile = file; }
54 public slots:
55 void executed( int64_t tag, const QString& result, struct tr_benc * arguments );
58 class Options: public QDialog
60 Q_OBJECT
62 public:
63 Options( Session& session, const Prefs& prefs, const AddData& addme, QWidget * parent = 0 );
64 ~Options( );
66 private:
67 void reload( );
68 void clearInfo( );
69 void refreshFileButton( int width=-1 );
70 void refreshDestinationButton( int width=-1 );
71 void refreshButton( QPushButton *, const QString&, int width=-1 );
73 private:
74 Session& mySession;
75 AddData myAdd;
76 QDir myDestination;
77 bool myHaveInfo;
78 tr_info myInfo;
79 FileTreeView * myTree;
80 QCheckBox * myStartCheck;
81 QCheckBox * myTrashCheck;
82 QComboBox * myPriorityCombo;
83 QPushButton * myFileButton;
84 QPushButton * myDestinationButton;
85 QPushButton * myVerifyButton;
86 QVector<int> myPriorities;
87 QVector<bool> myWanted;
88 FileList myFiles;
90 private slots:
91 void onAccepted( );
92 void onPriorityChanged( const QSet<int>& fileIndices, int );
93 void onWantedChanged( const QSet<int>& fileIndices, bool );
94 void onVerify( );
95 void onTimeout( );
96 void onFilenameClicked( );
97 void onDestinationClicked( );
98 void onFilesSelected( const QStringList& );
99 void onDestinationsSelected( const QStringList& );
101 private:
102 bool eventFilter( QObject *, QEvent * );
104 private:
105 QTimer myVerifyTimer;
106 char myVerifyBuf[2048*4];
107 QFile myVerifyFile;
108 uint64_t myVerifyFilePos;
109 int myVerifyFileIndex;
110 uint32_t myVerifyPieceIndex;
111 uint32_t myVerifyPiecePos;
112 void clearVerify( );
113 QVector<bool> myVerifyFlags;
114 QCryptographicHash myVerifyHash;
115 typedef QMap<uint32_t,int32_t> mybins_t;
116 mybins_t myVerifyBins;
120 #endif