Skip to content

Commit 3a03f07

Browse files
ajtownshebasto
authored andcommitted
qt: Avoid header circular dependency
1 parent 25884bd commit 3a03f07

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

src/qt/freespacechecker.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,13 @@
55
#include <qt/freespacechecker.h>
66

77
#include <qt/guiutil.h>
8-
#include <qt/intro.h>
98
#include <util/fs.h>
109

1110
#include <QDir>
1211
#include <QString>
1312

1413
#include <cstdint>
1514

16-
FreespaceChecker::FreespaceChecker(Intro *_intro)
17-
{
18-
this->intro = _intro;
19-
}
20-
2115
void FreespaceChecker::check()
2216
{
2317
QString dataDirStr = intro->getPathToCheck();

src/qt/freespacechecker.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#include <QString>
1010
#include <QtGlobal>
1111

12-
class Intro;
13-
1412
/* Check free space asynchronously to prevent hanging the UI thread.
1513
1614
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
2624
Q_OBJECT
2725

2826
public:
29-
explicit FreespaceChecker(Intro *intro);
27+
class PathQuery
28+
{
29+
public:
30+
virtual QString getPathToCheck() = 0;
31+
};
32+
33+
explicit FreespaceChecker(PathQuery* intro) : intro{intro} {}
3034

3135
enum Status {
3236
ST_OK,
@@ -40,7 +44,7 @@ public Q_SLOTS:
4044
void reply(int status, const QString &message, quint64 available);
4145

4246
private:
43-
Intro *intro;
47+
PathQuery* intro;
4448
};
4549

4650
#endif // BITCOIN_QT_FREESPACECHECKER_H

src/qt/intro.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
#ifndef BITCOIN_QT_INTRO_H
66
#define BITCOIN_QT_INTRO_H
77

8+
#include <qt/freespacechecker.h>
9+
810
#include <QDialog>
911
#include <QMutex>
1012
#include <QThread>
1113

1214
static const bool DEFAULT_CHOOSE_DATADIR = false;
1315

14-
class FreespaceChecker;
15-
1616
namespace interfaces {
1717
class Node;
1818
}
@@ -25,7 +25,7 @@ namespace Ui {
2525
Allows the user to choose a data directory,
2626
in which the wallet and block chain will be stored.
2727
*/
28-
class Intro : public QDialog
28+
class Intro : public QDialog, public FreespaceChecker::PathQuery
2929
{
3030
Q_OBJECT
3131

@@ -78,7 +78,7 @@ private Q_SLOTS:
7878

7979
void startThread();
8080
void checkPath(const QString &dataDir);
81-
QString getPathToCheck();
81+
QString getPathToCheck() override;
8282
void UpdatePruneLabels(bool prune_checked);
8383
void UpdateFreeSpaceLabel();
8484

test/lint/lint-circular-dependencies.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"node/blockstorage -> validation -> node/blockstorage",
1717
"node/utxo_snapshot -> validation -> node/utxo_snapshot",
1818
"qt/addresstablemodel -> qt/walletmodel -> qt/addresstablemodel",
19-
"qt/freespacechecker -> qt/intro -> qt/freespacechecker",
2019
"qt/recentrequeststablemodel -> qt/walletmodel -> qt/recentrequeststablemodel",
2120
"qt/sendcoinsdialog -> qt/walletmodel -> qt/sendcoinsdialog",
2221
"qt/transactiontablemodel -> qt/walletmodel -> qt/transactiontablemodel",

0 commit comments

Comments
 (0)