Skip to content

Commit 59fa29a

Browse files
committed
Merge #442: Introduce the Desktop Wallet Activity Page
28ede4b qml: Introduce the Desktop Wallet Activity Page (johnny9) Pull request description: This commit introduces the basic Activity Page and Activity details Page. The pages are backed by activitylistmodel which queries the wallet interface and converts the WalletTx objects into Transaction objects in the list that returns the properties for each send/receive to one of our wallet's addresses. ![Screenshot from 2025-03-10 11-27-20](https://github.com/user-attachments/assets/d2021b25-612d-464a-a49d-cce317a4a28b) ![Screenshot from 2025-03-10 11-27-29](https://github.com/user-attachments/assets/ca6f2533-67f2-45f0-81ca-b45152e56a80) ACKs for top commit: hebasto: ACK 28ede4b, I have skimmed through the code and it looks OK. Tree-SHA512: febbf0d38b26932d34d69490d6db117eb6e25e55cc412138c7f0d38476325a03fd734fe1f2abc99d8312fc476315c50d7cc623349b8ec95a54dd2a5e1d7ec7a3
2 parents 8a1526f + 28ede4b commit 59fa29a

23 files changed

+1061
-12
lines changed

src/Makefile.qt.include

+14-1
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,19 @@ QT_FORMS_UI = \
3737
QT_MOC_CPP = \
3838
qml/components/moc_blockclockdial.cpp \
3939
qml/controls/moc_linegraph.cpp \
40+
qml/models/moc_activitylistmodel.cpp \
4041
qml/models/moc_chainmodel.cpp \
4142
qml/models/moc_networktraffictower.cpp \
4243
qml/models/moc_nodemodel.cpp \
4344
qml/models/moc_options_model.cpp \
4445
qml/models/moc_peerdetailsmodel.cpp \
4546
qml/models/moc_peerlistsortproxy.cpp \
47+
qml/models/moc_transaction.cpp \
4648
qml/models/moc_walletlistmodel.cpp \
4749
qml/models/moc_walletqmlmodel.cpp \
4850
qml/moc_appmode.cpp \
4951
qml/moc_bitcoinamount.cpp \
52+
qml/moc_clipboard.cpp \
5053
qml/moc_walletqmlcontroller.cpp \
5154
qt/moc_addressbookpage.cpp \
5255
qt/moc_addresstablemodel.cpp \
@@ -121,15 +124,18 @@ QT_QRC_LOCALE = qt/bitcoin_locale.qrc
121124
BITCOIN_QT_H = \
122125
qml/components/blockclockdial.h \
123126
qml/controls/linegraph.h \
127+
qml/models/activitylistmodel.h \
124128
qml/models/chainmodel.h \
125129
qml/models/networktraffictower.h \
126130
qml/models/nodemodel.h \
127131
qml/models/options_model.h \
128132
qml/models/peerdetailsmodel.h \
129133
qml/models/peerlistsortproxy.h \
134+
qml/models/transaction.h \
130135
qml/models/walletlistmodel.h \
131136
qml/models/walletqmlmodel.h \
132137
qml/appmode.h \
138+
qml/clipboard.h \
133139
qml/bitcoin.h \
134140
qml/bitcoinamount.h \
135141
qml/guiconstants.h \
@@ -315,12 +321,14 @@ BITCOIN_QML_BASE_CPP = \
315321
qml/bitcoinamount.cpp \
316322
qml/components/blockclockdial.cpp \
317323
qml/controls/linegraph.cpp \
324+
qml/models/activitylistmodel.cpp \
318325
qml/models/chainmodel.cpp \
319326
qml/models/networktraffictower.cpp \
320327
qml/models/nodemodel.cpp \
321328
qml/models/options_model.cpp \
322329
qml/models/peerdetailsmodel.cpp \
323330
qml/models/peerlistsortproxy.cpp \
331+
qml/models/transaction.cpp \
324332
qml/models/walletlistmodel.cpp \
325333
qml/models/walletqmlmodel.cpp \
326334
qml/imageprovider.cpp \
@@ -344,6 +352,7 @@ QML_RES_ICONS = \
344352
qml/res/icons/caret-right.png \
345353
qml/res/icons/check.png \
346354
qml/res/icons/copy.png \
355+
qml/res/icons/coinbase.png \
347356
qml/res/icons/cross.png \
348357
qml/res/icons/error.png \
349358
qml/res/icons/export.png \
@@ -361,6 +370,8 @@ QML_RES_ICONS = \
361370
qml/res/icons/singlesig-wallet.png \
362371
qml/res/icons/storage-dark.png \
363372
qml/res/icons/storage-light.png \
373+
qml/res/icons/triangle-up.png \
374+
qml/res/icons/triangle-down.png \
364375
qml/res/icons/tooltip-arrow-dark.png \
365376
qml/res/icons/tooltip-arrow-light.png \
366377
qml/res/icons/wallet.png \
@@ -402,13 +413,13 @@ QML_RES_QML = \
402413
qml/controls/KeyValueRow.qml \
403414
qml/controls/LabeledTextInput.qml \
404415
qml/controls/NavButton.qml \
405-
qml/controls/PageIndicator.qml \
406416
qml/controls/NavigationBar.qml \
407417
qml/controls/NavigationBar2.qml \
408418
qml/controls/NavigationTab.qml \
409419
qml/controls/OptionButton.qml \
410420
qml/controls/OptionSwitch.qml \
411421
qml/controls/OutlineButton.qml \
422+
qml/controls/PageIndicator.qml \
412423
qml/controls/PageStack.qml \
413424
qml/controls/ProgressIndicator.qml \
414425
qml/controls/qmldir \
@@ -441,6 +452,8 @@ QML_RES_QML = \
441452
qml/pages/settings/SettingsProxy.qml \
442453
qml/pages/settings/SettingsStorage.qml \
443454
qml/pages/settings/SettingsTheme.qml \
455+
qml/pages/wallet/Activity.qml \
456+
qml/pages/wallet/ActivityDetails.qml \
444457
qml/pages/wallet/CreateBackup.qml \
445458
qml/pages/wallet/CreateConfirm.qml \
446459
qml/pages/wallet/CreateIntro.qml \

src/qml/bitcoin.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616
#include <noui.h>
1717
#include <qml/appmode.h>
1818
#include <qml/bitcoinamount.h>
19+
#include <qml/clipboard.h>
1920
#ifdef __ANDROID__
2021
#include <qml/androidnotifier.h>
2122
#endif
2223
#include <qml/components/blockclockdial.h>
2324
#include <qml/controls/linegraph.h>
2425
#include <qml/guiconstants.h>
26+
#include <qml/models/activitylistmodel.h>
2527
#include <qml/models/chainmodel.h>
2628
#include <qml/models/networktraffictower.h>
2729
#include <qml/models/nodemodel.h>
@@ -326,12 +328,15 @@ int QmlGuiMain(int argc, char* argv[])
326328
engine.rootContext()->setContextProperty("needOnboarding", need_onboarding);
327329

328330
AppMode app_mode = SetupAppMode();
331+
Clipboard clipboard;
329332

330333
qmlRegisterSingletonInstance<AppMode>("org.bitcoincore.qt", 1, 0, "AppMode", &app_mode);
334+
qmlRegisterSingletonInstance<Clipboard>("org.bitcoincore.qt", 1, 0, "Clipboard", &clipboard);
331335
qmlRegisterType<BlockClockDial>("org.bitcoincore.qt", 1, 0, "BlockClockDial");
332336
qmlRegisterType<LineGraph>("org.bitcoincore.qt", 1, 0, "LineGraph");
333337
qmlRegisterUncreatableType<PeerDetailsModel>("org.bitcoincore.qt", 1, 0, "PeerDetailsModel", "");
334338
qmlRegisterType<BitcoinAmount>("org.bitcoincore.qt", 1, 0, "BitcoinAmount");
339+
qmlRegisterUncreatableType<Transaction>("org.bitcoincore.qt", 1, 0, "Transaction", "");
335340

336341
#ifdef ENABLE_WALLET
337342
qmlRegisterUncreatableType<WalletQmlModel>("org.bitcoincore.qt", 1, 0, "WalletQmlModel",

src/qml/bitcoin_qml.qrc

+7-1
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@
3232
<file>controls/InformationPage.qml</file>
3333
<file>controls/IPAddressValueInput.qml</file>
3434
<file>controls/KeyValueRow.qml</file>
35+
<file>controls/LabeledTextInput.qml</file>
3536
<file>controls/NavButton.qml</file>
36-
<file>controls/PageIndicator.qml</file>
3737
<file>controls/NavigationBar.qml</file>
3838
<file>controls/NavigationBar2.qml</file>
3939
<file>controls/NavigationTab.qml</file>
4040
<file>controls/OptionButton.qml</file>
4141
<file>controls/OptionSwitch.qml</file>
4242
<file>controls/OutlineButton.qml</file>
43+
<file>controls/PageIndicator.qml</file>
4344
<file>controls/PageStack.qml</file>
4445
<file>controls/ProgressIndicator.qml</file>
4546
<file>controls/qmldir</file>
@@ -72,6 +73,8 @@
7273
<file>pages/settings/SettingsProxy.qml</file>
7374
<file>pages/settings/SettingsStorage.qml</file>
7475
<file>pages/settings/SettingsTheme.qml</file>
76+
<file>pages/wallet/Activity.qml</file>
77+
<file>pages/wallet/ActivityDetails.qml</file>
7578
<file>pages/wallet/CreateBackup.qml</file>
7679
<file>pages/wallet/CreateConfirm.qml</file>
7780
<file>pages/wallet/CreateIntro.qml</file>
@@ -97,6 +100,7 @@
97100
<file alias="caret-right">res/icons/caret-right.png</file>
98101
<file alias="check">res/icons/check.png</file>
99102
<file alias="copy">res/icons/copy.png</file>
103+
<file alias="coinbase">res/icons/coinbase.png</file>
100104
<file alias="cross">res/icons/cross.png</file>
101105
<file alias="error">res/icons/error.png</file>
102106
<file alias="export">res/icons/export.png</file>
@@ -116,6 +120,8 @@
116120
<file alias="storage-light">res/icons/storage-light.png</file>
117121
<file alias="tooltip-arrow-dark">res/icons/tooltip-arrow-dark.png</file>
118122
<file alias="tooltip-arrow-light">res/icons/tooltip-arrow-light.png</file>
123+
<file alias="triangle-down">res/icons/triangle-down.png</file>
124+
<file alias="triangle-up">res/icons/triangle-up.png</file>
119125
<file alias="wallet">res/icons/wallet.png</file>
120126
<file alias="visible">res/icons/visible.png</file>
121127
</qresource>

src/qml/clipboard.h

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (c) 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_CLIPBOARD_H
6+
#define BITCOIN_QML_CLIPBOARD_H
7+
8+
#include <QObject>
9+
#include <QClipboard>
10+
#include <QGuiApplication>
11+
12+
class Clipboard : public QObject
13+
{
14+
Q_OBJECT
15+
public:
16+
explicit Clipboard(QObject *parent = nullptr) : QObject(parent) {}
17+
18+
Q_INVOKABLE void setText(const QString &text) {
19+
QGuiApplication::clipboard()->setText(text);
20+
}
21+
22+
Q_INVOKABLE QString text() const {
23+
return QGuiApplication::clipboard()->text();
24+
}
25+
};
26+
27+
#endif // BITCOIN_QML_CLIPBOARD_H

src/qml/controls/LabeledTextInput.qml

+8-6
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,23 @@ Item {
1818
signal textEdited
1919

2020
id: root
21-
implicitHeight: label.height + input.height
21+
implicitHeight: input.height
2222

2323
CoreText {
2424
id: label
2525
anchors.left: parent.left
26-
anchors.top: parent.top
27-
color: Theme.color.neutral7
28-
font.pixelSize: 15
26+
anchors.verticalCenter: parent.verticalCenter
27+
horizontalAlignment: Text.AlignLeft
28+
width: 110
29+
color: Theme.color.neutral9
30+
font.pixelSize: 18
2931
}
3032

3133
TextField {
3234
id: input
33-
anchors.left: parent.left
35+
anchors.left: label.right
3436
anchors.right: iconContainer.left
35-
anchors.bottom: parent.bottom
37+
anchors.verticalCenter: parent.verticalCenter
3638
leftPadding: 0
3739
font.family: "Inter"
3840
font.styleName: "Regular"

src/qml/imageprovider.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ QPixmap ImageProvider::requestPixmap(const QString& id, QSize* size, const QSize
7272
return QIcon(":/icons/caret-right").pixmap(requested_size);
7373
}
7474

75+
if (id == "coinbase") {
76+
*size = requested_size;
77+
return QIcon(":/icons/coinbase").pixmap(requested_size);
78+
}
79+
7580
if (id == "check") {
7681
*size = requested_size;
7782
return QIcon(":/icons/check").pixmap(requested_size);
@@ -167,6 +172,16 @@ QPixmap ImageProvider::requestPixmap(const QString& id, QSize* size, const QSize
167172
return QIcon(":/icons/tooltip-arrow-light").pixmap(requested_size);
168173
}
169174

175+
if (id == "triangle-up") {
176+
*size = requested_size;
177+
return QIcon(":/icons/triangle-up").pixmap(requested_size);
178+
}
179+
180+
if (id == "triangle-down") {
181+
*size = requested_size;
182+
return QIcon(":/icons/triangle-down").pixmap(requested_size);
183+
}
184+
170185
if (id == "add-wallet-dark") {
171186
*size = requested_size;
172187
return QIcon(":/icons/add-wallet-dark").pixmap(requested_size);

0 commit comments

Comments
 (0)