Skip to content

Commit 4c6562e

Browse files
hebastojarolrod
authored andcommitted
qml, build: Add OptionsQmlModel class with basic implementation
1 parent 464c726 commit 4c6562e

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

src/Makefile.qt.include

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ QT_FORMS_UI = \
3737
QT_MOC_CPP = \
3838
qml/moc_appmode.cpp \
3939
qml/moc_nodemodel.cpp \
40+
qml/moc_options_model.cpp \
4041
qt/moc_addressbookpage.cpp \
4142
qt/moc_addresstablemodel.cpp \
4243
qt/moc_askpassphrasedialog.cpp \
@@ -112,6 +113,7 @@ BITCOIN_QT_H = \
112113
qml/bitcoin.h \
113114
qml/imageprovider.h \
114115
qml/nodemodel.h \
116+
qml/options_model.h \
115117
qml/util.h \
116118
qt/addressbookpage.h \
117119
qt/addresstablemodel.h \
@@ -291,6 +293,7 @@ BITCOIN_QML_BASE_CPP = \
291293
qml/bitcoin.cpp \
292294
qml/imageprovider.cpp \
293295
qml/nodemodel.cpp \
296+
qml/options_model.cpp \
294297
qml/util.cpp
295298

296299
QML_RES_FONTS = \

src/qml/bitcoin.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <qml/appmode.h>
1515
#include <qml/imageprovider.h>
1616
#include <qml/nodemodel.h>
17+
#include <qml/options_model.h>
1718
#include <qml/util.h>
1819
#include <qt/guiconstants.h>
1920
#include <qt/guiutil.h>
@@ -185,6 +186,9 @@ int QmlGuiMain(int argc, char* argv[])
185186

186187
engine.rootContext()->setContextProperty("nodeModel", &node_model);
187188

189+
OptionsQmlModel options_model{*node};
190+
engine.rootContext()->setContextProperty("optionsModel", &options_model);
191+
188192
#ifdef __ANDROID__
189193
AppMode app_mode(AppMode::MOBILE);
190194
#else

src/qml/options_model.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright (c) 2022 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#include <qml/options_model.h>
6+
7+
#include <interfaces/node.h>
8+
9+
OptionsQmlModel::OptionsQmlModel(interfaces::Node& node)
10+
: m_node{node}
11+
{
12+
}

src/qml/options_model.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) 2022 The Bitcoin Core developers
2+
// Distributed under the MIT software license, see the accompanying
3+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
5+
#ifndef BITCOIN_QML_OPTIONS_MODEL_H
6+
#define BITCOIN_QML_OPTIONS_MODEL_H
7+
8+
#include <QObject>
9+
10+
namespace interfaces {
11+
class Node;
12+
}
13+
14+
/** Model for Bitcoin client options. */
15+
class OptionsQmlModel : public QObject
16+
{
17+
Q_OBJECT
18+
19+
public:
20+
explicit OptionsQmlModel(interfaces::Node& node);
21+
22+
private:
23+
interfaces::Node& m_node;
24+
};
25+
26+
#endif // BITCOIN_QML_OPTIONS_MODEL_H

0 commit comments

Comments
 (0)