mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-07 16:12:30 -06:00
[TorrentCreator] Show number of pieces. Closes #6774.
This commit is contained in:
@@ -70,6 +70,7 @@ TorrentCreatorDlg::TorrentCreatorDlg(QWidget *parent, const QString &defaultPath
|
||||
connect(m_ui->addFileButton, SIGNAL(clicked(bool)), SLOT(onAddFileButtonClicked()));
|
||||
connect(m_ui->addFolderButton, SIGNAL(clicked(bool)), SLOT(onAddFolderButtonClicked()));
|
||||
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(onCreateButtonClicked()));
|
||||
connect(m_ui->buttonCalcTotalPieces, &QAbstractButton::clicked, this, &TorrentCreatorDlg::updatePiecesCount);
|
||||
|
||||
connect(m_creatorThread, SIGNAL(creationSuccess(QString, QString)), this, SLOT(handleCreationSuccess(QString, QString)));
|
||||
connect(m_creatorThread, SIGNAL(creationFailure(QString)), this, SLOT(handleCreationFailure(QString)));
|
||||
@@ -207,6 +208,14 @@ void TorrentCreatorDlg::updateProgressBar(int progress)
|
||||
m_ui->progressBar->setValue(progress);
|
||||
}
|
||||
|
||||
void TorrentCreatorDlg::updatePiecesCount()
|
||||
{
|
||||
const QString path = m_ui->textInputPath->text().trimmed();
|
||||
|
||||
const int count = BitTorrent::TorrentCreatorThread::calculateTotalPieces(path, getPieceSize());
|
||||
m_ui->labelTotalPieces->setText(QString::number(count));
|
||||
}
|
||||
|
||||
void TorrentCreatorDlg::setInteractionEnabled(bool enabled)
|
||||
{
|
||||
m_ui->textInputPath->setEnabled(enabled);
|
||||
|
||||
Reference in New Issue
Block a user