2009-04-09 18:55:47 +00:00
|
|
|
/*
|
2015-06-10 21:27:11 +00:00
|
|
|
* This file Copyright (C) 2009-2015 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
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-03-29 16:37:21 +00:00
|
|
|
#pragma once
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2014-12-29 04:03:56 +00:00
|
|
|
#include <QCryptographicHash>
|
2009-04-09 18:55:47 +00:00
|
|
|
#include <QDir>
|
2014-12-29 04:03:56 +00:00
|
|
|
#include <QFile>
|
2009-04-09 18:55:47 +00:00
|
|
|
#include <QMap>
|
2010-08-01 18:55:04 +00:00
|
|
|
#include <QString>
|
2009-04-09 18:55:47 +00:00
|
|
|
#include <QTimer>
|
2014-12-29 04:03:56 +00:00
|
|
|
#include <QVector>
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2015-06-10 21:27:11 +00:00
|
|
|
#include "AddData.h" // AddData
|
2015-09-01 20:19:26 +00:00
|
|
|
#include "BaseDialog.h"
|
2015-06-10 21:27:11 +00:00
|
|
|
#include "Torrent.h" // FileList
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2015-06-10 21:27:11 +00:00
|
|
|
#include "ui_OptionsDialog.h"
|
2013-02-09 04:05:03 +00:00
|
|
|
|
|
|
|
class Prefs;
|
2009-04-09 18:55:47 +00:00
|
|
|
class Session;
|
|
|
|
|
2013-08-24 19:26:21 +00:00
|
|
|
extern "C"
|
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
struct tr_variant;
|
2013-08-24 19:26:21 +00:00
|
|
|
}
|
2009-05-15 02:05:07 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
class OptionsDialog : public BaseDialog
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2013-02-09 21:47:42 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
public:
|
2017-04-20 16:02:19 +00:00
|
|
|
OptionsDialog(Session& session, Prefs const& prefs, AddData const& addme, QWidget* parent = nullptr);
|
2017-04-19 12:04:45 +00:00
|
|
|
virtual ~OptionsDialog();
|
2015-06-12 22:12:12 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
private:
|
2015-06-12 22:12:12 +00:00
|
|
|
typedef QMap<uint32_t, int32_t> mybins_t;
|
2013-02-09 21:47:42 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
private:
|
|
|
|
void reload();
|
|
|
|
void updateWidgetsLocality();
|
|
|
|
void clearInfo();
|
|
|
|
void clearVerify();
|
2013-02-09 21:47:42 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
private slots:
|
|
|
|
void onAccepted();
|
2017-04-20 16:02:19 +00:00
|
|
|
void onPriorityChanged(QSet<int> const& fileIndices, int);
|
|
|
|
void onWantedChanged(QSet<int> const& fileIndices, bool);
|
2017-04-19 12:04:45 +00:00
|
|
|
void onVerify();
|
|
|
|
void onTimeout();
|
2014-12-29 04:03:56 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void onSourceChanged();
|
|
|
|
void onDestinationChanged();
|
2013-02-09 21:47:42 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
void onSessionUpdated();
|
2016-10-03 18:26:28 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
private:
|
2013-02-09 21:47:42 +00:00
|
|
|
Session& mySession;
|
|
|
|
AddData myAdd;
|
2015-06-12 22:12:12 +00:00
|
|
|
|
|
|
|
Ui::OptionsDialog ui;
|
|
|
|
|
2016-10-03 18:26:28 +00:00
|
|
|
bool myIsLocal;
|
2013-02-09 23:11:17 +00:00
|
|
|
QDir myLocalDestination;
|
2013-02-09 21:47:42 +00:00
|
|
|
bool myHaveInfo;
|
|
|
|
tr_info myInfo;
|
2017-04-19 12:04:45 +00:00
|
|
|
QPushButton* myVerifyButton;
|
2013-02-09 21:47:42 +00:00
|
|
|
QVector<int> myPriorities;
|
|
|
|
QVector<bool> myWanted;
|
|
|
|
FileList myFiles;
|
|
|
|
|
|
|
|
QTimer myVerifyTimer;
|
2014-12-29 04:03:56 +00:00
|
|
|
char myVerifyBuf[2048 * 4];
|
2013-02-09 21:47:42 +00:00
|
|
|
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
|
|
|
QVector<bool> myVerifyFlags;
|
|
|
|
QCryptographicHash myVerifyHash;
|
|
|
|
mybins_t myVerifyBins;
|
|
|
|
QTimer myEditTimer;
|
2009-04-09 18:55:47 +00:00
|
|
|
};
|