2006-09-30 20:02:39 +04:00
|
|
|
/*
|
2017-05-17 16:14:46 +03:00
|
|
|
* Bittorrent Client using Qt and libtorrent.
|
|
|
|
* Copyright (C) 2017 Mike Tzou (Chocobo1)
|
|
|
|
* Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org>
|
2006-09-30 20:02:39 +04:00
|
|
|
*
|
2007-07-14 18:31:59 +04:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2006-09-30 20:02:39 +04:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2007-07-14 18:31:59 +04:00
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
2009-04-05 21:00:55 +04:00
|
|
|
* In addition, as a special exception, the copyright holders give permission to
|
|
|
|
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
|
|
|
* modified versions of it that use the same license as the "OpenSSL" library),
|
|
|
|
* and distribute the linked executables. You must obey the GNU General Public
|
|
|
|
* License in all respects for all of the code used other than "OpenSSL". If you
|
|
|
|
* modify file(s), you may extend this exception to your version of the file(s),
|
|
|
|
* but you are not obligated to do so. If you do not wish to do so, delete this
|
|
|
|
* exception statement from your version.
|
2006-09-30 20:02:39 +04:00
|
|
|
*/
|
|
|
|
|
2020-12-10 20:56:37 +03:00
|
|
|
#pragma once
|
2006-09-30 20:02:39 +04:00
|
|
|
|
2016-04-28 14:02:05 +03:00
|
|
|
#include <QDialog>
|
|
|
|
|
2020-09-09 10:08:14 +03:00
|
|
|
#include "base/bittorrent/torrentcreatorthread.h"
|
2022-02-08 06:03:48 +03:00
|
|
|
#include "base/path.h"
|
2016-05-04 12:56:51 +03:00
|
|
|
#include "base/settingvalue.h"
|
|
|
|
|
2019-07-13 08:03:46 +03:00
|
|
|
namespace Ui
|
2015-04-19 18:17:47 +03:00
|
|
|
{
|
2019-07-13 08:03:46 +03:00
|
|
|
class TorrentCreatorDialog;
|
2015-04-19 18:17:47 +03:00
|
|
|
}
|
2007-12-31 19:57:35 +03:00
|
|
|
|
2020-04-19 05:42:11 +03:00
|
|
|
class TorrentCreatorDialog final : public QDialog
|
2015-06-24 13:19:42 +03:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2022-02-08 06:03:48 +03:00
|
|
|
Q_DISABLE_COPY_MOVE(TorrentCreatorDialog)
|
2007-09-04 08:18:51 +04:00
|
|
|
|
2010-12-04 13:31:14 +03:00
|
|
|
public:
|
2022-02-08 06:03:48 +03:00
|
|
|
TorrentCreatorDialog(QWidget *parent = nullptr, const Path &defaultPath = {});
|
2018-09-07 14:12:38 +03:00
|
|
|
~TorrentCreatorDialog() override;
|
2022-02-08 06:03:48 +03:00
|
|
|
void updateInputPath(const Path &path);
|
2006-09-30 20:02:39 +04:00
|
|
|
|
2016-04-28 14:02:05 +03:00
|
|
|
private slots:
|
2015-06-24 13:19:42 +03:00
|
|
|
void updateProgressBar(int progress);
|
2017-05-25 17:48:10 +03:00
|
|
|
void updatePiecesCount();
|
2016-04-28 14:02:05 +03:00
|
|
|
void onCreateButtonClicked();
|
|
|
|
void onAddFileButtonClicked();
|
|
|
|
void onAddFolderButtonClicked();
|
|
|
|
void handleCreationFailure(const QString &msg);
|
2022-02-08 06:03:48 +03:00
|
|
|
void handleCreationSuccess(const Path &path, const Path &branchPath);
|
2010-12-04 13:31:14 +03:00
|
|
|
|
|
|
|
private:
|
2016-04-28 14:02:05 +03:00
|
|
|
void dropEvent(QDropEvent *event) override;
|
|
|
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
|
|
|
|
2015-06-24 13:19:42 +03:00
|
|
|
void saveSettings();
|
|
|
|
void loadSettings();
|
2019-09-09 19:59:43 +03:00
|
|
|
void setInteractionEnabled(bool enabled) const;
|
|
|
|
|
2016-04-28 14:02:05 +03:00
|
|
|
int getPieceSize() const;
|
2021-08-08 08:27:22 +03:00
|
|
|
#ifdef QBT_USES_LIBTORRENT2
|
2020-09-09 10:08:14 +03:00
|
|
|
BitTorrent::TorrentFormat getTorrentFormat() const;
|
|
|
|
#else
|
2019-09-09 19:59:43 +03:00
|
|
|
int getPaddedFileSizeLimit() const;
|
2020-09-09 10:08:14 +03:00
|
|
|
#endif
|
2010-10-25 23:34:42 +04:00
|
|
|
|
2018-06-14 12:54:23 +03:00
|
|
|
Ui::TorrentCreatorDialog *m_ui;
|
2015-06-24 13:19:42 +03:00
|
|
|
BitTorrent::TorrentCreatorThread *m_creatorThread;
|
2016-05-04 12:56:51 +03:00
|
|
|
|
|
|
|
// settings
|
2020-12-28 18:32:59 +03:00
|
|
|
SettingValue<QSize> m_storeDialogSize;
|
|
|
|
SettingValue<int> m_storePieceSize;
|
|
|
|
SettingValue<bool> m_storePrivateTorrent;
|
|
|
|
SettingValue<bool> m_storeStartSeeding;
|
|
|
|
SettingValue<bool> m_storeIgnoreRatio;
|
2021-08-08 08:27:22 +03:00
|
|
|
#ifdef QBT_USES_LIBTORRENT2
|
2020-12-28 18:32:59 +03:00
|
|
|
SettingValue<int> m_storeTorrentFormat;
|
2020-09-09 10:08:14 +03:00
|
|
|
#else
|
2020-12-28 18:32:59 +03:00
|
|
|
SettingValue<bool> m_storeOptimizeAlignment;
|
|
|
|
SettingValue<int> m_paddedFileSizeLimit;
|
2020-09-09 10:08:14 +03:00
|
|
|
#endif
|
2022-02-08 06:03:48 +03:00
|
|
|
SettingValue<Path> m_storeLastAddPath;
|
2020-12-28 18:32:59 +03:00
|
|
|
SettingValue<QString> m_storeTrackerList;
|
|
|
|
SettingValue<QString> m_storeWebSeedList;
|
|
|
|
SettingValue<QString> m_storeComments;
|
2022-02-08 06:03:48 +03:00
|
|
|
SettingValue<Path> m_storeLastSavePath;
|
2020-12-28 18:32:59 +03:00
|
|
|
SettingValue<QString> m_storeSource;
|
2006-09-30 20:02:39 +04:00
|
|
|
};
|