mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-06 05:01:25 -07:00
Explicitly reject opened Add torrent dialogs when exiting app
PR #22535. Closes #19933. Supercedes #22533.
This commit is contained in:
parent
3d73026ff2
commit
110e6d32b4
4 changed files with 24 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt and libtorrent.
|
* Bittorrent Client using Qt and libtorrent.
|
||||||
* Copyright (C) 2022-2024 Vladimir Golovnev <glassez@yandex.ru>
|
* Copyright (C) 2022-2025 Vladimir Golovnev <glassez@yandex.ru>
|
||||||
* Copyright (C) 2012 Christophe Dumez <chris@qbittorrent.org>
|
* Copyright (C) 2012 Christophe Dumez <chris@qbittorrent.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -386,7 +386,6 @@ AddNewTorrentDialog::AddNewTorrentDialog(const BitTorrent::TorrentDescriptor &to
|
||||||
|
|
||||||
AddNewTorrentDialog::~AddNewTorrentDialog()
|
AddNewTorrentDialog::~AddNewTorrentDialog()
|
||||||
{
|
{
|
||||||
saveState();
|
|
||||||
delete m_ui;
|
delete m_ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +399,7 @@ void AddNewTorrentDialog::loadState()
|
||||||
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
if (const QSize dialogSize = m_storeDialogSize; dialogSize.isValid())
|
||||||
resize(dialogSize);
|
resize(dialogSize);
|
||||||
|
|
||||||
m_ui->splitter->restoreState(m_storeSplitterState);;
|
m_ui->splitter->restoreState(m_storeSplitterState);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddNewTorrentDialog::saveState()
|
void AddNewTorrentDialog::saveState()
|
||||||
|
@ -836,6 +835,12 @@ void AddNewTorrentDialog::reject()
|
||||||
QDialog::reject();
|
QDialog::reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddNewTorrentDialog::done(const int result)
|
||||||
|
{
|
||||||
|
saveState();
|
||||||
|
QDialog::done(result);
|
||||||
|
}
|
||||||
|
|
||||||
void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &metadata)
|
void AddNewTorrentDialog::updateMetadata(const BitTorrent::TorrentInfo &metadata)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_currentContext);
|
Q_ASSERT(m_currentContext);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Bittorrent Client using Qt and libtorrent.
|
* Bittorrent Client using Qt and libtorrent.
|
||||||
* Copyright (C) 2022-2024 Vladimir Golovnev <glassez@yandex.ru>
|
* Copyright (C) 2022-2025 Vladimir Golovnev <glassez@yandex.ru>
|
||||||
* Copyright (C) 2012 Christophe Dumez <chris@qbittorrent.org>
|
* Copyright (C) 2012 Christophe Dumez <chris@qbittorrent.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -68,6 +68,11 @@ signals:
|
||||||
void torrentAccepted(const BitTorrent::TorrentDescriptor &torrentDescriptor, const BitTorrent::AddTorrentParams &addTorrentParams);
|
void torrentAccepted(const BitTorrent::TorrentDescriptor &torrentDescriptor, const BitTorrent::AddTorrentParams &addTorrentParams);
|
||||||
void torrentRejected(const BitTorrent::TorrentDescriptor &torrentDescriptor);
|
void torrentRejected(const BitTorrent::TorrentDescriptor &torrentDescriptor);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void accept() override;
|
||||||
|
void reject() override;
|
||||||
|
void done(int result) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateDiskSpaceLabel();
|
void updateDiskSpaceLabel();
|
||||||
void onSavePathChanged(const Path &newPath);
|
void onSavePathChanged(const Path &newPath);
|
||||||
|
@ -77,9 +82,6 @@ private slots:
|
||||||
void categoryChanged(int index);
|
void categoryChanged(int index);
|
||||||
void contentLayoutChanged();
|
void contentLayoutChanged();
|
||||||
|
|
||||||
void accept() override;
|
|
||||||
void reject() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class TorrentContentAdaptor;
|
class TorrentContentAdaptor;
|
||||||
struct Context;
|
struct Context;
|
||||||
|
|
|
@ -81,6 +81,15 @@ GUIAddTorrentManager::GUIAddTorrentManager(IGUIApplication *app, BitTorrent::Ses
|
||||||
connect(btSession(), &BitTorrent::Session::metadataDownloaded, this, &GUIAddTorrentManager::onMetadataDownloaded);
|
connect(btSession(), &BitTorrent::Session::metadataDownloaded, this, &GUIAddTorrentManager::onMetadataDownloaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GUIAddTorrentManager::~GUIAddTorrentManager()
|
||||||
|
{
|
||||||
|
for (AddNewTorrentDialog *dialog : asConst(m_dialogs))
|
||||||
|
{
|
||||||
|
dialog->disconnect(this);
|
||||||
|
dialog->reject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool GUIAddTorrentManager::addTorrent(const QString &source, const BitTorrent::AddTorrentParams ¶ms, const AddTorrentOption option)
|
bool GUIAddTorrentManager::addTorrent(const QString &source, const BitTorrent::AddTorrentParams ¶ms, const AddTorrentOption option)
|
||||||
{
|
{
|
||||||
// `source`: .torrent file path, magnet URI or URL
|
// `source`: .torrent file path, magnet URI or URL
|
||||||
|
|
|
@ -61,6 +61,7 @@ class GUIAddTorrentManager : public GUIApplicationComponent<AddTorrentManager>
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GUIAddTorrentManager(IGUIApplication *app, BitTorrent::Session *session, QObject *parent = nullptr);
|
GUIAddTorrentManager(IGUIApplication *app, BitTorrent::Session *session, QObject *parent = nullptr);
|
||||||
|
~GUIAddTorrentManager() override;
|
||||||
|
|
||||||
bool addTorrent(const QString &source, const BitTorrent::AddTorrentParams ¶ms = {}, AddTorrentOption option = AddTorrentOption::Default);
|
bool addTorrent(const QString &source, const BitTorrent::AddTorrentParams ¶ms = {}, AddTorrentOption option = AddTorrentOption::Default);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue