source: trunk/qt/options.h @ 8188

Last change on this file since 8188 was 8188, checked in by charles, 13 years ago

(trunk) add the Qt beta into svn

File size: 2.5 KB
Line 
1/*
2 * This file Copyright (C) 2009 Charles Kerr <charles@transmissionbt.com>
3 *
4 * This file is licensed by the GPL version 2.  Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
9 *
10 * $Id:$
11 */
12
13#ifndef OPTIONS_DIALOG_H
14#define OPTIONS_DIALOG_H
15
16#include <QDialog>
17#include <QEvent>
18#include <QString>
19#include <QDir>
20#include <QVector>
21#include <QMap>
22#include <QPushButton>
23#include <QStringList>
24#include <QCryptographicHash>
25#include <QFile>
26#include <QTimer>
27
28#include <libtransmission/transmission.h>
29
30#include "file-tree.h"
31
32class FileTreeView;
33class Prefs;
34class QCheckBox;
35class Session;
36
37class Options: public QDialog
38{
39        Q_OBJECT
40
41    public:
42        Options( Session& session, const Prefs& prefs, const QString& filename, QWidget * parent = 0 );
43        ~Options( );
44
45    private:
46        void reload( );
47        void clearInfo( );
48        void refreshFileButton( int width=-1 );
49        void refreshDestinationButton( int width=-1 );
50        void refreshButton( QPushButton *, const QString&, int width=-1 );
51
52    private:
53        Session& mySession;
54        QString myFile;
55        QDir myDestination;
56        bool myHaveInfo;
57        tr_info myInfo;
58        FileTreeView * myTree;
59        QCheckBox * myStartCheck;
60        QCheckBox * myTrashCheck;
61        QPushButton * myFileButton;
62        QPushButton * myDestinationButton;
63        QPushButton * myVerifyButton;
64        QVector<int> myPriorities;
65        QVector<bool> myWanted;
66        FileList myFiles;
67
68    private slots:
69        void onAccepted( );
70        void onPriorityChanged( const QSet<int>& fileIndices, int );
71        void onWantedChanged( const QSet<int>& fileIndices, bool );
72        void onVerify( );
73        void onTimeout( );
74        void onFilenameClicked( );
75        void onDestinationClicked( );
76        void onFilesSelected( const QStringList& );
77        void onDestinationsSelected( const QStringList& );
78
79    private:
80        bool eventFilter( QObject *, QEvent * );
81
82    private:
83        QTimer myVerifyTimer;
84        char myVerifyBuf[2048*4];
85        QFile myVerifyFile;
86        uint64_t myVerifyFilePos;
87        int myVerifyFileIndex;
88        uint32_t myVerifyPieceIndex;
89        uint32_t myVerifyPiecePos;
90        void clearVerify( );
91        QVector<bool> myVerifyFlags;
92        QCryptographicHash myVerifyHash;
93        typedef QMap<uint32_t,int32_t> mybins_t;
94        mybins_t myVerifyBins;
95
96};
97
98#endif
Note: See TracBrowser for help on using the repository browser.