Correctly adjust "Add New torrent" dialog position in all the cases

PR #20457.
Closes #20449.
This commit is contained in:
Vladimir Golovnev 2024-02-26 15:44:44 +03:00 committed by GitHub
parent cfa7a6db46
commit 361741d677
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 6 deletions

View file

@ -551,7 +551,10 @@ void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorre
// Qt::Window is required to avoid showing only two dialog on top (see #12852). // Qt::Window is required to avoid showing only two dialog on top (see #12852).
// Also improves the general convenience of adding multiple torrents. // Also improves the general convenience of adding multiple torrents.
if (!attached) if (!attached)
{
dlg->setWindowFlags(Qt::Window); dlg->setWindowFlags(Qt::Window);
adjustDialogGeometry(dlg, parent);
}
dlg->setAttribute(Qt::WA_DeleteOnClose); dlg->setAttribute(Qt::WA_DeleteOnClose);
if (Net::DownloadManager::hasSupportedScheme(source)) if (Net::DownloadManager::hasSupportedScheme(source))
@ -570,15 +573,10 @@ void AddNewTorrentDialog::show(const QString &source, const BitTorrent::AddTorre
: dlg->loadTorrentFile(source); : dlg->loadTorrentFile(source);
if (isLoaded) if (isLoaded)
{
adjustDialogGeometry(dlg, parent);
dlg->QDialog::show(); dlg->QDialog::show();
}
else else
{
delete dlg; delete dlg;
} }
}
void AddNewTorrentDialog::show(const QString &source, QWidget *parent) void AddNewTorrentDialog::show(const QString &source, QWidget *parent)
{ {

View file

@ -292,7 +292,7 @@ void SearchJobWidget::addTorrentToSession(const QString &source, const AddTorren
if (source.isEmpty()) return; if (source.isEmpty()) return;
if ((option == AddTorrentOption::ShowDialog) || ((option == AddTorrentOption::Default) && AddNewTorrentDialog::isEnabled())) if ((option == AddTorrentOption::ShowDialog) || ((option == AddTorrentOption::Default) && AddNewTorrentDialog::isEnabled()))
AddNewTorrentDialog::show(source, this); AddNewTorrentDialog::show(source, window());
else else
BitTorrent::Session::instance()->addTorrent(source); BitTorrent::Session::instance()->addTorrent(source);
} }