|
|
|
@ -154,7 +154,7 @@ void AddNewTorrentDialog::showAdvancedSettings(bool show)
@@ -154,7 +154,7 @@ void AddNewTorrentDialog::showAdvancedSettings(bool show)
|
|
|
|
|
if (show) { |
|
|
|
|
ui->adv_button->setText(QString::fromUtf8("▲")); |
|
|
|
|
ui->settings_group->setVisible(true); |
|
|
|
|
ui->info_group->setVisible(m_hasMetadata); |
|
|
|
|
ui->info_group->setVisible(true); |
|
|
|
|
if (m_hasMetadata && (m_torrentInfo->num_files() > 1)) { |
|
|
|
|
ui->content_tree->setVisible(true); |
|
|
|
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); |
|
|
|
@ -230,7 +230,7 @@ bool AddNewTorrentDialog::loadMagnet(const QString &magnet_uri)
@@ -230,7 +230,7 @@ bool AddNewTorrentDialog::loadMagnet(const QString &magnet_uri)
|
|
|
|
|
QString torrent_name = misc::magnetUriToName(m_url); |
|
|
|
|
setWindowTitle(torrent_name.isEmpty() ? tr("Magnet link") : torrent_name); |
|
|
|
|
|
|
|
|
|
showAdvancedSettings(Preferences::instance()->getAddNewTorrentDialogExpanded()); |
|
|
|
|
setupTreeview(); |
|
|
|
|
// Set dialog position
|
|
|
|
|
setdialogPosition(); |
|
|
|
|
|
|
|
|
@ -282,11 +282,11 @@ void AddNewTorrentDialog::updateFileNameInSavePaths(const QString &new_filename)
@@ -282,11 +282,11 @@ void AddNewTorrentDialog::updateFileNameInSavePaths(const QString &new_filename)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AddNewTorrentDialog::updateDiskSpaceLabel() |
|
|
|
|
{ |
|
|
|
|
Q_ASSERT(m_hasMetadata); |
|
|
|
|
void AddNewTorrentDialog::updateDiskSpaceLabel() { |
|
|
|
|
// Determine torrent size
|
|
|
|
|
qulonglong torrent_size = 0; |
|
|
|
|
|
|
|
|
|
if (m_hasMetadata) { |
|
|
|
|
if (m_contentModel) { |
|
|
|
|
const std::vector<int> priorities = m_contentModel->model()->getFilesPriorities(); |
|
|
|
|
Q_ASSERT(priorities.size() == (uint) m_torrentInfo->num_files()); |
|
|
|
@ -297,7 +297,9 @@ void AddNewTorrentDialog::updateDiskSpaceLabel()
@@ -297,7 +297,9 @@ void AddNewTorrentDialog::updateDiskSpaceLabel()
|
|
|
|
|
} else { |
|
|
|
|
torrent_size = m_torrentInfo->total_size(); |
|
|
|
|
} |
|
|
|
|
QString size_string = misc::friendlyUnit(torrent_size); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QString size_string = torrent_size ? misc::friendlyUnit(torrent_size) : QString(tr("Not Available", "This size is unavailable.")); |
|
|
|
|
size_string += " ("; |
|
|
|
|
size_string += tr("Disk space: %1").arg(misc::friendlyUnit(fsutils::freeDiskSpaceOnPath(ui->save_path_combo->currentText()))); |
|
|
|
|
size_string += ")"; |
|
|
|
@ -358,7 +360,6 @@ void AddNewTorrentDialog::onSavePathChanged(int index)
@@ -358,7 +360,6 @@ void AddNewTorrentDialog::onSavePathChanged(int index)
|
|
|
|
|
relayout(); |
|
|
|
|
// Remember index
|
|
|
|
|
old_index = ui->save_path_combo->currentIndex(); |
|
|
|
|
if (m_hasMetadata) |
|
|
|
|
updateDiskSpaceLabel(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -627,6 +628,11 @@ void AddNewTorrentDialog::setMetadataProgressIndicator(bool visibleIndicator, co
@@ -627,6 +628,11 @@ void AddNewTorrentDialog::setMetadataProgressIndicator(bool visibleIndicator, co
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void AddNewTorrentDialog::setupTreeview() { |
|
|
|
|
if (!m_hasMetadata) { |
|
|
|
|
ui->comment_lbl->setText(tr("Not Available", "This comment is unavailable")); |
|
|
|
|
ui->date_lbl->setText(tr("Not Available", "This date is unavailable")); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
// Set dialog title
|
|
|
|
|
setWindowTitle(misc::toQStringU(m_torrentInfo->name())); |
|
|
|
|
|
|
|
|
@ -634,7 +640,6 @@ void AddNewTorrentDialog::setupTreeview() {
@@ -634,7 +640,6 @@ void AddNewTorrentDialog::setupTreeview() {
|
|
|
|
|
QString comment = misc::toQString(m_torrentInfo->comment()); |
|
|
|
|
ui->comment_lbl->setText(comment.replace('\n', ' ')); |
|
|
|
|
ui->date_lbl->setText(m_torrentInfo->creation_date() ? misc::toQString(*m_torrentInfo->creation_date()) : tr("Not available")); |
|
|
|
|
updateDiskSpaceLabel(); |
|
|
|
|
|
|
|
|
|
file_storage const& fs = m_torrentInfo->files(); |
|
|
|
|
|
|
|
|
@ -668,7 +673,9 @@ void AddNewTorrentDialog::setupTreeview() {
@@ -668,7 +673,9 @@ void AddNewTorrentDialog::setupTreeview() {
|
|
|
|
|
ui->save_path_combo->setItemText(i, fsutils::toNativePath(QDir(ui->save_path_combo->itemText(i)).absoluteFilePath(single_file_relpath))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
updateDiskSpaceLabel(); |
|
|
|
|
showAdvancedSettings(Preferences::instance()->getAddNewTorrentDialogExpanded()); |
|
|
|
|
// Set dialog position
|
|
|
|
|
setdialogPosition(); |
|
|
|
|