Skip to content

Commit

Permalink
Merge #344: Setup AppMode within InitErrorMessage
Browse files Browse the repository at this point in the history
8eac738 qml: setup AppMode in initerrormessage (jarolrod)

Pull request description:

  If you run the GUI with an invalid parameter, the `initerrormessage` window should appear. But, #289 introduced a dependency on `AppMode` being available into the `OutlineButton` which the `initerrormessage` window uses. So, the following appears on master and the `initerrormessage` window does not appear:

  ```
  $ ./src/qt/bitcoin-qt -signsadfsad
  Error: Cannot parse command line arguments: Invalid parameter -signsadfsad

  QQmlApplicationEngine failed to load component
  qrc:/qml/pages/initerrormessage.qml:32:9: Type OutlineButton unavailable
  qrc:/qml/controls/OutlineButton.qml:7:1: module "org.bitcoincore.qt" is not installed
  ```

  This encapsulates the setting of AppMode into a function, and runs in within the `InitErrorMessageBox` function:

  <img width="612" alt="Screen Shot 2023-06-03 at 12 52 55 AM" src="https://github.com/bitcoin-core/gui-qml/assets/23396902/aa46d32f-855e-46b2-b219-d77319f6d492">

  [![Windows](https://img.shields.io/badge/OS-Windows-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/win64/unsecure_win_gui.zip?branch=pull/344)
  [![Intel macOS](https://img.shields.io/badge/OS-Intel%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos/unsecure_mac_gui.zip?branch=pull/344)
  [![Apple Silicon macOS](https://img.shields.io/badge/OS-Apple%20Silicon%20macOS-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/macos_arm64/unsecure_mac_arm64_gui.zip?branch=pull/344)
  [![ARM64 Android](https://img.shields.io/badge/OS-Android-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android/unsecure_android_apk.zip?branch=pull/344)
  [![ARM32 Android](https://img.shields.io/badge/OS-Android%2032bit-green)](https://api.cirrus-ci.com/v1/artifact/github/bitcoin-core/gui-qml/android32/unsecure_android_32bit_apk.zip?branch=pull/344)

ACKs for top commit:
  johnny9:
    ACK 8eac738

Tree-SHA512: 24c31154ab4f7efd6b718f799bd4aafc79d56cdc4aad82a66db2d0618eaf24730c905dc8c958b44b9f90b7e9bbbccb30a717dfd7e70e2170820fa4478fac8487
  • Loading branch information
hebasto committed Jun 4, 2023
2 parents 23a1ab4 + 8eac738 commit 7b88d03
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/qml/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ bool InitErrorMessageBox(
[[maybe_unused]] unsigned int style)
{
QQmlApplicationEngine engine;
#ifdef __ANDROID__
AppMode app_mode(AppMode::MOBILE);
#else
AppMode app_mode(AppMode::DESKTOP);
#endif // __ANDROID__

qmlRegisterSingletonInstance<AppMode>("org.bitcoincore.qt", 1, 0, "AppMode", &app_mode);
engine.rootContext()->setContextProperty("message", QString::fromStdString(message.translated));
engine.load(QUrl(QStringLiteral("qrc:///qml/pages/initerrormessage.qml")));
if (engine.rootObjects().isEmpty()) {
Expand Down

0 comments on commit 7b88d03

Please sign in to comment.