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
24 #include <QPushButton>
26 #include <QStringList>
27 #include <QCryptographicHash>
31 #include "add-data.h" // AddData
32 #include "file-tree.h" // FileList
40 extern "C" { struct tr_benc
; };
42 class FileAdded
: public QObject
50 FileAdded( int tag
, const QString
& name
): myTag(tag
), myName(name
) { }
52 void setFileToDelete( const QString
& file
) { myDelFile
= file
; }
55 void executed( int64_t tag
, const QString
& result
, struct tr_benc
* arguments
);
58 class Options
: public QDialog
63 Options( Session
& session
, const Prefs
& prefs
, const AddData
& addme
, QWidget
* parent
= 0 );
69 void refreshFileButton( int width
=-1 );
70 void refreshDestinationButton( int width
=-1 );
71 void refreshButton( QPushButton
*, const QString
&, int width
=-1 );
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
;
92 void onPriorityChanged( const QSet
<int>& fileIndices
, int );
93 void onWantedChanged( const QSet
<int>& fileIndices
, bool );
96 void onFilenameClicked( );
97 void onDestinationClicked( );
98 void onFilesSelected( const QStringList
& );
99 void onDestinationsSelected( const QStringList
& );
102 bool eventFilter( QObject
*, QEvent
* );
105 QTimer myVerifyTimer
;
106 char myVerifyBuf
[2048*4];
108 uint64_t myVerifyFilePos
;
109 int myVerifyFileIndex
;
110 uint32_t myVerifyPieceIndex
;
111 uint32_t myVerifyPiecePos
;
113 QVector
<bool> myVerifyFlags
;
114 QCryptographicHash myVerifyHash
;
115 typedef QMap
<uint32_t,int32_t> mybins_t
;
116 mybins_t myVerifyBins
;