Skip to content

Commit e0fc9d8

Browse files
committed
qml: Add stub window
1 parent 58fee8d commit e0fc9d8

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

src/Makefile.qt.include

+12-1
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,10 @@ BITCOIN_QT_WALLET_CPP = \
280280
BITCOIN_QML_BASE_CPP = \
281281
qml/bitcoin.cpp
282282

283+
QML_QRC_CPP = qml/qrc_bitcoin.cpp
284+
QML_QRC = qml/bitcoin_qml.qrc
285+
RES_QML = $(wildcard $(srcdir)/qml/pages/*.qml)
286+
283287
BITCOIN_QT_CPP = $(BITCOIN_QT_BASE_CPP)
284288
if TARGET_WINDOWS
285289
BITCOIN_QT_CPP += $(BITCOIN_QT_WINDOWS_CPP)
@@ -308,7 +312,8 @@ endif
308312
nodist_qt_libbitcoinqt_a_SOURCES = $(QT_MOC_CPP) $(QT_MOC) $(QT_QRC_CPP) $(QT_QRC_LOCALE_CPP)
309313

310314
if BUILD_WITH_QML
311-
qt_libbitcoinqt_a_SOURCES += $(BITCOIN_QML_BASE_CPP)
315+
qt_libbitcoinqt_a_SOURCES += $(BITCOIN_QML_BASE_CPP) $(QML_QRC) $(RES_QML)
316+
nodist_qt_libbitcoinqt_a_SOURCES += $(QML_QRC_CPP)
312317
endif # BUILD_WITH_QML
313318

314319
# forms/foo.h -> forms/ui_foo.h
@@ -380,6 +385,12 @@ $(QT_QRC_CPP): $(QT_QRC) $(QT_FORMS_H) $(RES_FONTS) $(RES_ICONS) $(RES_ANIMATION
380385
@test -f $(RCC)
381386
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin --format-version 1 $< > $@
382387

388+
if BUILD_WITH_QML
389+
$(QML_QRC_CPP): $(QML_QRC) $(RES_QML)
390+
@test -f $(RCC)
391+
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) --name bitcoin_qml --format-version 1 $< > $@
392+
endif # BUILD_WITH_QML
393+
383394
CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno qt/temp_bitcoin_locale.qrc
384395

385396
CLEANFILES += $(CLEAN_QT)

src/qml/bitcoin.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
#include <QGuiApplication>
2020
#include <QQmlApplicationEngine>
21+
#include <QStringLiteral>
22+
#include <QUrl>
2123

2224
namespace {
2325
void SetupUIArgs(ArgsManager& argsman)
@@ -40,9 +42,15 @@ int QmlGuiMain(int argc, char* argv[])
4042
boost::signals2::scoped_connection handler_question = ::uiInterface.ThreadSafeQuestion_connect(noui_ThreadSafeQuestion);
4143
boost::signals2::scoped_connection handler_init_message = ::uiInterface.InitMessage_connect(noui_InitMessage);
4244

45+
Q_INIT_RESOURCE(bitcoin_qml);
46+
4347
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
4448
QGuiApplication app(argc, argv);
4549
QQmlApplicationEngine engine;
50+
engine.load(QUrl(QStringLiteral("qrc:///qml/pages/stub.qml")));
51+
if (engine.rootObjects().isEmpty()) {
52+
return EXIT_FAILURE;
53+
}
4654

4755
// Parse command-line options. We do this after qt in order to show an error if there are problems parsing these.
4856
SetupServerArgs(gArgs);

src/qml/bitcoin_qml.qrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!DOCTYPE RCC><RCC version="1.0">
2+
<qresource prefix="/qml">
3+
<file>pages/stub.qml</file>
4+
</qresource>
5+
</RCC>

src/qml/pages/stub.qml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import QtQuick.Controls 2.12
2+
3+
ApplicationWindow {
4+
id: appWindow
5+
title: "Bitcoin Core TnG"
6+
minimumWidth: 750
7+
minimumHeight: 450
8+
visible: true
9+
}

0 commit comments

Comments
 (0)