source: trunk/qt/options.h @ 14349

Last change on this file since 14349 was 14349, checked in by mikedld, 8 years ago

#5077: Remove torrent file from watch directory even if "show options dialog" is not set (patch from rb07 + some improvements)

Refactor Session::addTorrent (add new method) to eliminate duplicate
code in options.cc and ensure that FileAdded? object is being created
on torrent addition even with non-interactive workflow.
Move FileAdded? class from options.{h,cc} to session.{h,cc}.

  • Property svn:keywords set to Date Rev Author Id
File size: 2.5 KB
Line 
1/*
2 * This file Copyright (C) 2009-2014 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: options.h 14349 2014-12-01 19:24:07Z mikedld $
8 */
9
10#ifndef OPTIONS_DIALOG_H
11#define OPTIONS_DIALOG_H
12
13#include <QDialog>
14#include <QEvent>
15#include <QString>
16#include <QDir>
17#include <QVector>
18#include <QMap>
19#include <QString>
20#include <QStringList>
21#include <QCryptographicHash>
22#include <QFile>
23#include <QTimer>
24#include <QLineEdit>
25
26#include "add-data.h" // AddData
27#include "file-tree.h" // FileList
28
29class QCheckBox;
30class QComboBox;
31class QPushButton;
32
33class FileTreeView;
34class FreespaceLabel;
35class Prefs;
36class Session;
37
38extern "C"
39{
40  struct tr_variant;
41}
42
43class Options: public QDialog
44{
45    Q_OBJECT
46
47  public:
48    Options (Session& session, const Prefs& prefs, const AddData& addme, QWidget * parent = 0);
49    ~Options ();
50
51  private:
52    void reload ();
53    void clearInfo ();
54    void refreshSource (int width=-1);
55    void refreshDestinationButton (int width=-1);
56    void refreshButton (QPushButton *, const QString&, int width=-1);
57    bool eventFilter (QObject *, QEvent *);
58
59  private slots:
60    void onAccepted ();
61    void onPriorityChanged (const QSet<int>& fileIndices, int);
62    void onWantedChanged (const QSet<int>& fileIndices, bool);
63    void onVerify ();
64    void onTimeout ();
65    void onFilenameClicked ();
66    void onDestinationClicked ();
67    void onFilesSelected (const QStringList&);
68    void onSourceEditingFinished ();
69    void onDestinationsSelected (const QStringList&);
70    void onDestinationEdited (const QString&);
71    void onDestinationEditedIdle ();
72
73  private:
74    Session& mySession;
75    AddData myAdd;
76    QDir myLocalDestination;
77    bool myHaveInfo;
78    tr_info myInfo;
79    FileTreeView * myTree;
80    FreespaceLabel * myFreespaceLabel;
81    QCheckBox * myStartCheck;
82    QCheckBox * myTrashCheck;
83    QComboBox * myPriorityCombo;
84    QPushButton * mySourceButton;
85    QLineEdit * mySourceEdit;
86    QPushButton * myDestinationButton;
87    QLineEdit * myDestinationEdit;
88    QPushButton * myVerifyButton;
89    QVector<int> myPriorities;
90    QVector<bool> myWanted;
91    FileList myFiles;
92
93  private:
94    QTimer myVerifyTimer;
95    char myVerifyBuf[2048*4];
96    QFile myVerifyFile;
97    uint64_t myVerifyFilePos;
98    int myVerifyFileIndex;
99    uint32_t myVerifyPieceIndex;
100    uint32_t myVerifyPiecePos;
101    void clearVerify ();
102    QVector<bool> myVerifyFlags;
103    QCryptographicHash myVerifyHash;
104    typedef QMap<uint32_t,int32_t> mybins_t;
105    mybins_t myVerifyBins;
106    QTimer myEditTimer;
107};
108
109#endif
Note: See TracBrowser for help on using the repository browser.