2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2024 Radu Carpa <radu.carpa@cern.ch>
4 * Copyright (C) 2017 Mike Tzou (Chocobo1)
5 * Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * In addition, as a special exception, the copyright holders give permission to
22 * link this program with the OpenSSL project's "OpenSSL" library (or with
23 * modified versions of it that use the same license as the "OpenSSL" library),
24 * and distribute the linked executables. You must obey the GNU General Public
25 * License in all respects for all of the code used other than "OpenSSL". If you
26 * modify file(s), you may extend this exception to your version of the file(s),
27 * but you are not obligated to do so. If you do not wish to do so, delete this
28 * exception statement from your version.
34 #include <QThreadPool>
36 #include "base/bittorrent/torrentcreator.h"
37 #include "base/path.h"
38 #include "base/settingvalue.h"
42 class TorrentCreatorDialog
;
45 class TorrentCreatorDialog final
: public QDialog
48 Q_DISABLE_COPY_MOVE(TorrentCreatorDialog
)
51 TorrentCreatorDialog(QWidget
*parent
= nullptr, const Path
&defaultPath
= {});
52 ~TorrentCreatorDialog() override
;
53 void updateInputPath(const Path
&path
);
56 void updateProgressBar(int progress
);
57 void updatePiecesCount();
58 void onCreateButtonClicked();
59 void onAddFileButtonClicked();
60 void onAddFolderButtonClicked();
61 void handleCreationFailure(const QString
&msg
);
62 void handleCreationSuccess(const BitTorrent::TorrentCreatorResult
&result
);
65 void dropEvent(QDropEvent
*event
) override
;
66 void dragEnterEvent(QDragEnterEvent
*event
) override
;
70 void setInteractionEnabled(bool enabled
) const;
72 int getPieceSize() const;
73 #ifdef QBT_USES_LIBTORRENT2
74 BitTorrent::TorrentFormat
getTorrentFormat() const;
76 int getPaddedFileSizeLimit() const;
79 Ui::TorrentCreatorDialog
*m_ui
= nullptr;
80 QThreadPool m_threadPool
;
83 SettingValue
<QSize
> m_storeDialogSize
;
84 SettingValue
<int> m_storePieceSize
;
85 SettingValue
<bool> m_storePrivateTorrent
;
86 SettingValue
<bool> m_storeStartSeeding
;
87 SettingValue
<bool> m_storeIgnoreRatio
;
88 #ifdef QBT_USES_LIBTORRENT2
89 SettingValue
<int> m_storeTorrentFormat
;
91 SettingValue
<bool> m_storeOptimizeAlignment
;
92 SettingValue
<int> m_paddedFileSizeLimit
;
94 SettingValue
<Path
> m_storeLastAddPath
;
95 SettingValue
<QString
> m_storeTrackerList
;
96 SettingValue
<QString
> m_storeWebSeedList
;
97 SettingValue
<QString
> m_storeComments
;
98 SettingValue
<Path
> m_storeLastSavePath
;
99 SettingValue
<QString
> m_storeSource
;