mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 13:04:23 +00:00
Make alignment optimization optional
Disabling alignment optimization allows preserving file order in torrent files and closes #5652
This commit is contained in:
parent
1055cc0f45
commit
e538eae726
@ -92,7 +92,8 @@ void TorrentCreatorThread::run()
|
||||
|
||||
if (isInterruptionRequested()) return;
|
||||
|
||||
libt::create_torrent newTorrent(fs, m_params.pieceSize);
|
||||
libt::create_torrent newTorrent(fs, m_params.pieceSize, -1
|
||||
, (m_params.isAlignmentOptimized ? libt::create_torrent::optimize_alignment : 0));
|
||||
|
||||
// Add url seeds
|
||||
foreach (QString seed, m_params.urlSeeds) {
|
||||
|
@ -39,6 +39,7 @@ namespace BitTorrent
|
||||
struct TorrentCreatorParams
|
||||
{
|
||||
bool isPrivate;
|
||||
bool isAlignmentOptimized;
|
||||
int pieceSize;
|
||||
QString inputPath;
|
||||
QString savePath;
|
||||
|
@ -55,6 +55,7 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath
|
||||
, m_storePrivateTorrent(SETTINGS_KEY("PrivateTorrent"))
|
||||
, m_storeStartSeeding(SETTINGS_KEY("StartSeeding"))
|
||||
, m_storeIgnoreRatio(SETTINGS_KEY("IgnoreRatio"))
|
||||
, m_storeOptimizeAlignment(SETTINGS_KEY("OptimizeAlignment"), true)
|
||||
, m_storeLastAddPath(SETTINGS_KEY("LastAddPath"), QDir::homePath())
|
||||
, m_storeTrackerList(SETTINGS_KEY("TrackerList"))
|
||||
, m_storeWebSeedList(SETTINGS_KEY("WebSeedList"))
|
||||
@ -169,7 +170,8 @@ void TorrentCreatorDlg::onCreateButtonClicked()
|
||||
const QString source = m_ui->lineEditSource->text();
|
||||
|
||||
// run the creator thread
|
||||
m_creatorThread->create({ m_ui->checkPrivate->isChecked(), getPieceSize()
|
||||
m_creatorThread->create({ m_ui->checkPrivate->isChecked()
|
||||
, m_ui->checkOptimizeAlignment->isChecked(), getPieceSize()
|
||||
, input, destination, comment, source, trackers, urlSeeds });
|
||||
}
|
||||
|
||||
@ -241,6 +243,7 @@ void TorrentCreatorDlg::saveSettings()
|
||||
m_storePrivateTorrent = m_ui->checkPrivate->isChecked();
|
||||
m_storeStartSeeding = m_ui->checkStartSeeding->isChecked();
|
||||
m_storeIgnoreRatio = m_ui->checkIgnoreShareLimits->isChecked();
|
||||
m_storeOptimizeAlignment = m_ui->checkOptimizeAlignment->isChecked();
|
||||
|
||||
m_storeTrackerList = m_ui->trackersList->toPlainText();
|
||||
m_storeWebSeedList = m_ui->URLSeedsList->toPlainText();
|
||||
@ -258,6 +261,7 @@ void TorrentCreatorDlg::loadSettings()
|
||||
m_ui->checkPrivate->setChecked(m_storePrivateTorrent);
|
||||
m_ui->checkStartSeeding->setChecked(m_storeStartSeeding);
|
||||
m_ui->checkIgnoreShareLimits->setChecked(m_storeIgnoreRatio);
|
||||
m_ui->checkOptimizeAlignment->setChecked(m_storeOptimizeAlignment);
|
||||
m_ui->checkIgnoreShareLimits->setEnabled(m_ui->checkStartSeeding->isChecked());
|
||||
|
||||
m_ui->trackersList->setPlainText(m_storeTrackerList);
|
||||
|
@ -80,6 +80,7 @@ private:
|
||||
CachedSettingValue<bool> m_storePrivateTorrent;
|
||||
CachedSettingValue<bool> m_storeStartSeeding;
|
||||
CachedSettingValue<bool> m_storeIgnoreRatio;
|
||||
CachedSettingValue<bool> m_storeOptimizeAlignment;
|
||||
CachedSettingValue<QString> m_storeLastAddPath;
|
||||
CachedSettingValue<QString> m_storeTrackerList;
|
||||
CachedSettingValue<QString> m_storeWebSeedList;
|
||||
|
@ -224,6 +224,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkOptimizeAlignment">
|
||||
<property name="text">
|
||||
<string>Optimize alignment</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -329,6 +339,7 @@
|
||||
<tabstop>checkPrivate</tabstop>
|
||||
<tabstop>checkStartSeeding</tabstop>
|
||||
<tabstop>checkIgnoreShareLimits</tabstop>
|
||||
<tabstop>checkOptimizeAlignment</tabstop>
|
||||
<tabstop>trackersList</tabstop>
|
||||
<tabstop>URLSeedsList</tabstop>
|
||||
<tabstop>txtComment</tabstop>
|
||||
|
Loading…
x
Reference in New Issue
Block a user