mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 16:23:07 -07:00
Use std::optional<bool> instead of custom TriStateBool
This commit is contained in:
parent
d0cac421bb
commit
531ae501ad
17 changed files with 75 additions and 235 deletions
|
@ -505,7 +505,7 @@ void Application::processParams(const QStringList ¶ms)
|
|||
}
|
||||
#endif
|
||||
BitTorrent::AddTorrentParams torrentParams;
|
||||
TriStateBool skipTorrentDialog;
|
||||
std::optional<bool> skipTorrentDialog;
|
||||
|
||||
for (QString param : params)
|
||||
{
|
||||
|
@ -521,7 +521,7 @@ void Application::processParams(const QStringList ¶ms)
|
|||
|
||||
if (param.startsWith(QLatin1String("@addPaused=")))
|
||||
{
|
||||
torrentParams.addPaused = param.midRef(11).toInt() ? TriStateBool::True : TriStateBool::False;
|
||||
torrentParams.addPaused = (param.midRef(11).toInt() != 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -551,7 +551,7 @@ void Application::processParams(const QStringList ¶ms)
|
|||
|
||||
if (param.startsWith(QLatin1String("@skipDialog=")))
|
||||
{
|
||||
skipTorrentDialog = param.midRef(12).toInt() ? TriStateBool::True : TriStateBool::False;
|
||||
skipTorrentDialog = (param.midRef(12).toInt() != 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -561,9 +561,7 @@ void Application::processParams(const QStringList ¶ms)
|
|||
// be shown and skipTorrentDialog is undefined. The other is when
|
||||
// skipTorrentDialog is false, meaning that the application setting
|
||||
// should be overridden.
|
||||
const bool showDialogForThisTorrent =
|
||||
((AddNewTorrentDialog::isEnabled() && skipTorrentDialog == TriStateBool::Undefined)
|
||||
|| skipTorrentDialog == TriStateBool::False);
|
||||
const bool showDialogForThisTorrent = !skipTorrentDialog.value_or(!AddNewTorrentDialog::isEnabled());
|
||||
if (showDialogForThisTorrent)
|
||||
AddNewTorrentDialog::show(param, torrentParams, m_window);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue