mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-19 12:59:56 -07:00
Use QString literals
The plan is to define `QT_NO_CAST_FROM_ASCII` eventually. PR #16561.
This commit is contained in:
parent
2c8447853b
commit
ab64ee872b
23 changed files with 104 additions and 108 deletions
|
@ -567,23 +567,21 @@ void AddNewTorrentDialog::saveTorrentFile()
|
|||
{
|
||||
Q_ASSERT(hasMetadata());
|
||||
|
||||
const QString torrentFileExtension {C_TORRENT_FILE_EXTENSION};
|
||||
const QString filter {tr("Torrent file (*%1)").arg(torrentFileExtension)};
|
||||
const QString filter {tr("Torrent file (*%1)").arg(TORRENT_FILE_EXTENSION)};
|
||||
|
||||
QString path = QFileDialog::getSaveFileName(
|
||||
this, tr("Save as torrent file")
|
||||
, QDir::home().absoluteFilePath(m_torrentInfo.name() + torrentFileExtension)
|
||||
, filter);
|
||||
Path path {QFileDialog::getSaveFileName(this, tr("Save as torrent file")
|
||||
, QDir::home().absoluteFilePath(m_torrentInfo.name() + TORRENT_FILE_EXTENSION)
|
||||
, filter)};
|
||||
if (path.isEmpty()) return;
|
||||
|
||||
if (!path.endsWith(torrentFileExtension, Qt::CaseInsensitive))
|
||||
path += torrentFileExtension;
|
||||
if (!path.hasExtension(TORRENT_FILE_EXTENSION))
|
||||
path += TORRENT_FILE_EXTENSION;
|
||||
|
||||
const nonstd::expected<void, QString> result = m_torrentInfo.saveToFile(Path(path));
|
||||
const nonstd::expected<void, QString> result = m_torrentInfo.saveToFile(path);
|
||||
if (!result)
|
||||
{
|
||||
QMessageBox::critical(this, tr("I/O Error")
|
||||
, tr("Couldn't export torrent metadata file '%1'. Reason: %2.").arg(path, result.error()));
|
||||
, tr("Couldn't export torrent metadata file '%1'. Reason: %2.").arg(path.toString(), result.error()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue