2009-04-09 18:55:47 +00:00
|
|
|
/*
|
2014-01-19 01:09:44 +00:00
|
|
|
* This file Copyright (C) 2009-2014 Mnemosyne LLC
|
2009-04-09 18:55:47 +00:00
|
|
|
*
|
2014-01-21 03:10:30 +00:00
|
|
|
* It may be used under the GNU GPL versions 2 or 3
|
2014-01-19 01:09:44 +00:00
|
|
|
* or any future license endorsed by Mnemosyne LLC.
|
2009-04-09 18:55:47 +00:00
|
|
|
*
|
2009-05-31 19:33:48 +00:00
|
|
|
* $Id$
|
2009-04-09 18:55:47 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OPTIONS_DIALOG_H
|
|
|
|
#define OPTIONS_DIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QEvent>
|
|
|
|
#include <QString>
|
|
|
|
#include <QDir>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QMap>
|
2010-08-01 18:55:04 +00:00
|
|
|
#include <QString>
|
2009-04-09 18:55:47 +00:00
|
|
|
#include <QStringList>
|
|
|
|
#include <QCryptographicHash>
|
|
|
|
#include <QFile>
|
|
|
|
#include <QTimer>
|
2012-07-09 23:18:40 +00:00
|
|
|
#include <QLineEdit>
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2010-08-01 18:55:04 +00:00
|
|
|
#include "add-data.h" // AddData
|
|
|
|
#include "file-tree.h" // FileList
|
2009-04-09 18:55:47 +00:00
|
|
|
|
|
|
|
class QCheckBox;
|
2010-02-02 07:52:57 +00:00
|
|
|
class QComboBox;
|
2013-02-09 04:05:03 +00:00
|
|
|
class QPushButton;
|
|
|
|
|
|
|
|
class FileTreeView;
|
|
|
|
class FreespaceLabel;
|
|
|
|
class Prefs;
|
2009-04-09 18:55:47 +00:00
|
|
|
class Session;
|
|
|
|
|
2013-08-24 19:26:21 +00:00
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
struct tr_variant;
|
|
|
|
}
|
2009-05-15 02:05:07 +00:00
|
|
|
|
2009-04-09 18:55:47 +00:00
|
|
|
class Options: public QDialog
|
|
|
|
{
|
2013-02-09 21:47:42 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Options (Session& session, const Prefs& prefs, const AddData& addme, QWidget * parent = 0);
|
|
|
|
~Options ();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void reload ();
|
|
|
|
void clearInfo ();
|
2013-02-09 23:11:17 +00:00
|
|
|
void refreshSource (int width=-1);
|
2013-02-09 21:47:42 +00:00
|
|
|
void refreshDestinationButton (int width=-1);
|
|
|
|
void refreshButton (QPushButton *, const QString&, int width=-1);
|
|
|
|
bool eventFilter (QObject *, QEvent *);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onAccepted ();
|
|
|
|
void onPriorityChanged (const QSet<int>& fileIndices, int);
|
|
|
|
void onWantedChanged (const QSet<int>& fileIndices, bool);
|
|
|
|
void onVerify ();
|
|
|
|
void onTimeout ();
|
|
|
|
void onFilenameClicked ();
|
|
|
|
void onDestinationClicked ();
|
|
|
|
void onFilesSelected (const QStringList&);
|
2013-02-09 23:11:17 +00:00
|
|
|
void onSourceEditingFinished ();
|
2013-02-09 21:47:42 +00:00
|
|
|
void onDestinationsSelected (const QStringList&);
|
|
|
|
void onDestinationEdited (const QString&);
|
|
|
|
void onDestinationEditedIdle ();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Session& mySession;
|
|
|
|
AddData myAdd;
|
2013-02-09 23:11:17 +00:00
|
|
|
QDir myLocalDestination;
|
2013-02-09 21:47:42 +00:00
|
|
|
bool myHaveInfo;
|
|
|
|
tr_info myInfo;
|
|
|
|
FileTreeView * myTree;
|
|
|
|
FreespaceLabel * myFreespaceLabel;
|
|
|
|
QCheckBox * myStartCheck;
|
|
|
|
QCheckBox * myTrashCheck;
|
|
|
|
QComboBox * myPriorityCombo;
|
2013-02-09 23:11:17 +00:00
|
|
|
QPushButton * mySourceButton;
|
|
|
|
QLineEdit * mySourceEdit;
|
2013-02-09 21:47:42 +00:00
|
|
|
QPushButton * myDestinationButton;
|
|
|
|
QLineEdit * myDestinationEdit;
|
|
|
|
QPushButton * myVerifyButton;
|
|
|
|
QVector<int> myPriorities;
|
|
|
|
QVector<bool> myWanted;
|
|
|
|
FileList myFiles;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QTimer myVerifyTimer;
|
|
|
|
char myVerifyBuf[2048*4];
|
|
|
|
QFile myVerifyFile;
|
2013-08-29 00:37:37 +00:00
|
|
|
uint64_t myVerifyFilePos;
|
2013-02-09 21:47:42 +00:00
|
|
|
int myVerifyFileIndex;
|
2013-08-29 00:37:37 +00:00
|
|
|
uint32_t myVerifyPieceIndex;
|
|
|
|
uint32_t myVerifyPiecePos;
|
2013-02-09 21:47:42 +00:00
|
|
|
void clearVerify ();
|
|
|
|
QVector<bool> myVerifyFlags;
|
|
|
|
QCryptographicHash myVerifyHash;
|
2013-08-29 00:37:37 +00:00
|
|
|
typedef QMap<uint32_t,int32_t> mybins_t;
|
2013-02-09 21:47:42 +00:00
|
|
|
mybins_t myVerifyBins;
|
|
|
|
QTimer myEditTimer;
|
2009-04-09 18:55:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|