qt: Avoid header circular dependency

This commit is contained in:
Anthony Towns authored and Hennadii Stepanov committed 2025-07-30 12:56:41 +01:00
1 parent 25884bd896
commit 3a03f07560
4 files changed
+12 -15

No files matched your search

-6
View File
@@ -5,7 +5,6 @@
#include <qt/freespacechecker.h> #include <qt/freespacechecker.h>
#include <qt/guiutil.h> #include <qt/guiutil.h>
#include <qt/intro.h>
#include <util/fs.h> #include <util/fs.h>
#include <QDir> #include <QDir>
@@ -13,11 +12,6 @@
#include <cstdint> #include <cstdint>
FreespaceChecker::FreespaceChecker(Intro *_intro)
{
this->intro = _intro;
}
void FreespaceChecker::check() void FreespaceChecker::check()
{ {
QString dataDirStr = intro->getPathToCheck(); QString dataDirStr = intro->getPathToCheck();
+8 -4
View File
@@ -9,8 +9,6 @@
#include <QString> #include <QString>
#include <QtGlobal> #include <QtGlobal>
class Intro;
/* Check free space asynchronously to prevent hanging the UI thread. /* 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() 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 Q_OBJECT
public: public:
explicit FreespaceChecker(Intro *intro); class PathQuery
{
public:
virtual QString getPathToCheck() = 0;
};
explicit FreespaceChecker(PathQuery* intro) : intro{intro} {}
enum Status { enum Status {
ST_OK, ST_OK,
@@ -40,7 +44,7 @@ Q_SIGNALS:
void reply(int status, const QString &message, quint64 available); void reply(int status, const QString &message, quint64 available);
private: private:
Intro *intro; PathQuery* intro;
}; };
#endif // BITCOIN_QT_FREESPACECHECKER_H #endif // BITCOIN_QT_FREESPACECHECKER_H
+4 -4
View File
@@ -5,14 +5,14 @@
#ifndef BITCOIN_QT_INTRO_H #ifndef BITCOIN_QT_INTRO_H
#define BITCOIN_QT_INTRO_H #define BITCOIN_QT_INTRO_H
#include <qt/freespacechecker.h>
#include <QDialog> #include <QDialog>
#include <QMutex> #include <QMutex>
#include <QThread> #include <QThread>
static const bool DEFAULT_CHOOSE_DATADIR = false; static const bool DEFAULT_CHOOSE_DATADIR = false;
class FreespaceChecker;
namespace interfaces { namespace interfaces {
class Node; class Node;
} }
@@ -25,7 +25,7 @@ namespace Ui {
Allows the user to choose a data directory, Allows the user to choose a data directory,
in which the wallet and block chain will be stored. in which the wallet and block chain will be stored.
*/ */
class Intro : public QDialog class Intro : public QDialog, public FreespaceChecker::PathQuery
{ {
Q_OBJECT Q_OBJECT
@@ -78,7 +78,7 @@ private:
void startThread(); void startThread();
void checkPath(const QString &dataDir); void checkPath(const QString &dataDir);
QString getPathToCheck(); QString getPathToCheck() override;
void UpdatePruneLabels(bool prune_checked); void UpdatePruneLabels(bool prune_checked);
void UpdateFreeSpaceLabel(); void UpdateFreeSpaceLabel();
-1
View File
@@ -16,7 +16,6 @@ EXPECTED_CIRCULAR_DEPENDENCIES = (
"node/blockstorage -> validation -> node/blockstorage", "node/blockstorage -> validation -> node/blockstorage",
"node/utxo_snapshot -> validation -> node/utxo_snapshot", "node/utxo_snapshot -> validation -> node/utxo_snapshot",
"qt/addresstablemodel -> qt/walletmodel -> qt/addresstablemodel", "qt/addresstablemodel -> qt/walletmodel -> qt/addresstablemodel",
"qt/freespacechecker -> qt/intro -> qt/freespacechecker",
"qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel", "qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel",
"qt/sendcoinsdialog -> qt/walletmodel -> qt/sendcoinsdialog", "qt/sendcoinsdialog -> qt/walletmodel -> qt/sendcoinsdialog",
"qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel", "qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel",