Skip to content

Commit 1865548

Browse files
qml, refactoring: Separate guiconstants from QT
Separating guiconstants.h file from QT, copying it from src/qt to src/qml and updating QAPP_APP_NAME_* constants values so both QT and QML gui apps don't clash with each other trying to persist same or different settings (e.g. configuration file for QT on signet will be still named as Bitcoin-Qt-signet.conf, as of today, while QML will start using a separate file named Bitcoin-Qml-signet.conf). This could be a temporary fix so instances from both QT and QML gui apps don't interfere between them during QML development. This change will be transparent for both QT app and users.
1 parent b6bf91f commit 1865548

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed

src/Makefile.qt.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ BITCOIN_QT_H = \
123123
qml/models/peerlistsortproxy.h \
124124
qml/appmode.h \
125125
qml/bitcoin.h \
126+
qml/guiconstants.h \
126127
qml/imageprovider.h \
127128
qml/util.h \
128129
qt/addressbookpage.h \
@@ -140,7 +141,6 @@ BITCOIN_QT_H = \
140141
qt/createwalletdialog.h \
141142
qt/csvmodelwriter.h \
142143
qt/editaddressdialog.h \
143-
qt/guiconstants.h \
144144
qt/guiutil.h \
145145
qt/initexecutor.h \
146146
qt/intro.h \

src/qml/bitcoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <qml/models/peerlistsortproxy.h>
2828
#include <qml/imageprovider.h>
2929
#include <qml/util.h>
30-
#include <qt/guiconstants.h>
30+
#include <qml/guiconstants.h>
3131
#include <qt/guiutil.h>
3232
#include <qt/initexecutor.h>
3333
#include <qt/networkstyle.h>

src/qml/guiconstants.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright (c) 2011-2024 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_GUICONSTANTS_H
6+
#define BITCOIN_QML_GUICONSTANTS_H
7+
8+
#include <chrono>
9+
#include <cstdint>
10+
11+
using namespace std::chrono_literals;
12+
13+
/* A delay between model updates */
14+
static constexpr auto MODEL_UPDATE_DELAY{250ms};
15+
16+
/* A delay between shutdown pollings */
17+
static constexpr auto SHUTDOWN_POLLING_DELAY{200ms};
18+
19+
/* AskPassphraseDialog -- Maximum passphrase length */
20+
static const int MAX_PASSPHRASE_SIZE = 1024;
21+
22+
/* BitcoinGUI -- Size of icons in status bar */
23+
static const int STATUSBAR_ICONSIZE = 16;
24+
25+
static const bool DEFAULT_SPLASHSCREEN = true;
26+
27+
/* Invalid field background style */
28+
#define STYLE_INVALID "background:#FF8080"
29+
30+
/* Transaction list -- unconfirmed transaction */
31+
#define COLOR_UNCONFIRMED QColor(128, 128, 128)
32+
/* Transaction list -- negative amount */
33+
#define COLOR_NEGATIVE QColor(255, 0, 0)
34+
/* Transaction list -- bare address (without label) */
35+
#define COLOR_BAREADDRESS QColor(140, 140, 140)
36+
/* Transaction list -- TX status decoration - danger, tx needs attention */
37+
#define COLOR_TX_STATUS_DANGER QColor(200, 100, 100)
38+
/* Transaction list -- TX status decoration - default color */
39+
#define COLOR_BLACK QColor(0, 0, 0)
40+
41+
/* Tooltips longer than this (in characters) are converted into rich text,
42+
so that they can be word-wrapped.
43+
*/
44+
static const int TOOLTIP_WRAP_THRESHOLD = 80;
45+
46+
/* Number of frames in spinner animation */
47+
#define SPINNER_FRAMES 36
48+
49+
#define QAPP_ORG_NAME "Bitcoin"
50+
#define QAPP_ORG_DOMAIN "bitcoin.org"
51+
#define QAPP_APP_NAME_DEFAULT "Bitcoin-Qml"
52+
#define QAPP_APP_NAME_TESTNET "Bitcoin-Qml-testnet"
53+
#define QAPP_APP_NAME_SIGNET "Bitcoin-Qml-signet"
54+
#define QAPP_APP_NAME_REGTEST "Bitcoin-Qml-regtest"
55+
56+
/* One gigabyte (GB) in bytes */
57+
static constexpr uint64_t GB_BYTES{1000000000};
58+
59+
// Default prune target displayed in GUI.
60+
static constexpr int DEFAULT_PRUNE_TARGET_GB{2};
61+
62+
#endif // BITCOIN_QML_GUICONSTANTS_H

0 commit comments

Comments
 (0)