qt: Avoid header circular dependency

This commit is contained in:
Anthony Towns
2025-07-29 09:12:46 +01:00
committed by Hennadii Stepanov
parent 25884bd896
commit 3a03f07560
4 changed files with 12 additions and 15 deletions

View File

@@ -5,7 +5,6 @@
#include <qt/freespacechecker.h>
#include <qt/guiutil.h>
#include <qt/intro.h>
#include <util/fs.h>
#include <QDir>
@@ -13,11 +12,6 @@
#include <cstdint>
FreespaceChecker::FreespaceChecker(Intro *_intro)
{
this->intro = _intro;
}
void FreespaceChecker::check()
{
QString dataDirStr = intro->getPathToCheck();

View File

@@ -9,8 +9,6 @@
#include <QString>
#include <QtGlobal>
class Intro;
/* Check free space asynchronously to prevent hanging the UI thread.
Up to one request to check a path is in flight to this thread; when the check()
@@ -26,7 +24,13 @@ class FreespaceChecker : public QObject
Q_OBJECT
public:
explicit FreespaceChecker(Intro *intro);
class PathQuery
{
public:
virtual QString getPathToCheck() = 0;
};
explicit FreespaceChecker(PathQuery* intro) : intro{intro} {}
enum Status {
ST_OK,
@@ -40,7 +44,7 @@ Q_SIGNALS:
void reply(int status, const QString &message, quint64 available);
private:
Intro *intro;
PathQuery* intro;
};
#endif // BITCOIN_QT_FREESPACECHECKER_H

View File

@@ -5,14 +5,14 @@
#ifndef BITCOIN_QT_INTRO_H
#define BITCOIN_QT_INTRO_H
#include <qt/freespacechecker.h>
#include <QDialog>
#include <QMutex>
#include <QThread>
static const bool DEFAULT_CHOOSE_DATADIR = false;
class FreespaceChecker;
namespace interfaces {
class Node;
}
@@ -25,7 +25,7 @@ namespace Ui {
Allows the user to choose a data directory,
in which the wallet and block chain will be stored.
*/
class Intro : public QDialog
class Intro : public QDialog, public FreespaceChecker::PathQuery
{
Q_OBJECT
@@ -78,7 +78,7 @@ private:
void startThread();
void checkPath(const QString &dataDir);
QString getPathToCheck();
QString getPathToCheck() override;
void UpdatePruneLabels(bool prune_checked);
void UpdateFreeSpaceLabel();

View File

@@ -16,7 +16,6 @@ EXPECTED_CIRCULAR_DEPENDENCIES = (
"node/blockstorage -> validation -> node/blockstorage",
"node/utxo_snapshot -> validation -> node/utxo_snapshot",
"qt/addresstablemodel -> qt/walletmodel -> qt/addresstablemodel",
"qt/freespacechecker -> qt/intro -> qt/freespacechecker",
"qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel",
"qt/sendcoinsdialog -> qt/walletmodel -> qt/sendcoinsdialog",
"qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel",