Implement class for handling filesystem paths

PR #15915.
This commit is contained in:
Vladimir Golovnev
2022-02-08 06:03:48 +03:00
committed by GitHub
parent facfa26eed
commit dd1bd8ad10
131 changed files with 2252 additions and 1868 deletions

View File

@@ -138,13 +138,13 @@ void WatchedFolderOptionsDialog::onCategoryChanged(const int index)
const auto *btSession = BitTorrent::Session::instance();
const QString categoryName = m_ui->categoryComboBox->currentText();
const QString savePath = btSession->categorySavePath(categoryName);
m_ui->savePath->setSelectedPath(Utils::Fs::toNativePath(savePath));
const Path savePath = btSession->categorySavePath(categoryName);
m_ui->savePath->setSelectedPath(savePath);
const QString finishedSavePath = btSession->categoryDownloadPath(categoryName);
m_ui->downloadPath->setSelectedPath(Utils::Fs::toNativePath(finishedSavePath));
const Path downloadPath = btSession->categoryDownloadPath(categoryName);
m_ui->downloadPath->setSelectedPath(downloadPath);
m_ui->groupBoxDownloadPath->setChecked(!finishedSavePath.isEmpty());
m_ui->groupBoxDownloadPath->setChecked(!downloadPath.isEmpty());
}
}
@@ -152,11 +152,11 @@ void WatchedFolderOptionsDialog::populateSavePaths()
{
const auto *btSession = BitTorrent::Session::instance();
const QString defaultSavePath {btSession->savePath()};
const Path defaultSavePath {btSession->savePath()};
m_ui->savePath->setSelectedPath(!m_savePath.isEmpty() ? m_savePath : defaultSavePath);
const QString defaultFinishedSavePath {btSession->downloadPath()};
m_ui->downloadPath->setSelectedPath(!m_downloadPath.isEmpty() ? m_downloadPath : defaultFinishedSavePath);
const Path defaultDownloadPath {btSession->downloadPath()};
m_ui->downloadPath->setSelectedPath(!m_downloadPath.isEmpty() ? m_downloadPath : defaultDownloadPath);
m_ui->groupBoxDownloadPath->setChecked(m_useDownloadPath);
}
@@ -178,15 +178,15 @@ void WatchedFolderOptionsDialog::onTMMChanged(const int index)
m_ui->savePath->blockSignals(true);
m_savePath = m_ui->savePath->selectedPath();
const QString savePath = btSession->categorySavePath(m_ui->categoryComboBox->currentText());
const Path savePath = btSession->categorySavePath(m_ui->categoryComboBox->currentText());
m_ui->savePath->setSelectedPath(savePath);
m_ui->downloadPath->blockSignals(true);
m_downloadPath = m_ui->downloadPath->selectedPath();
const QString finishedSavePath = btSession->categoryDownloadPath(m_ui->categoryComboBox->currentText());
m_ui->downloadPath->setSelectedPath(finishedSavePath);
const Path downloadPath = btSession->categoryDownloadPath(m_ui->categoryComboBox->currentText());
m_ui->downloadPath->setSelectedPath(downloadPath);
m_useDownloadPath = m_ui->groupBoxDownloadPath->isChecked();
m_ui->groupBoxDownloadPath->setChecked(!finishedSavePath.isEmpty());
m_ui->groupBoxDownloadPath->setChecked(!downloadPath.isEmpty());
}
}