forked from digibyte/digibyte
-
Notifications
You must be signed in to change notification settings - Fork 95
Expand file tree
/
Copy pathdigidollaroverviewwidget.cpp
More file actions
1129 lines (965 loc) · 46.8 KB
/
Copy pathdigidollaroverviewwidget.cpp
File metadata and controls
1129 lines (965 loc) · 46.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2025 The DigiByte Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <qt/digidollaroverviewwidget.h>
#include <qt/walletmodel.h>
#include <qt/clientmodel.h>
#include <qt/guiutil.h>
#include <qt/digibyteunits.h>
#include <qt/optionsmodel.h>
#include <qt/platformstyle.h>
#include <oracle/mock_oracle.h>
#include <consensus/dca.h>
#include <digidollar/health.h>
#include <chainparams.h>
#include <wallet/digidollarwallet.h>
#include <uint256.h>
#include <interfaces/wallet.h>
#include <interfaces/node.h>
#include <univalue.h>
#include <rpc/util.h>
#include <algorithm>
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QGridLayout>
#include <QFrame>
#include <QProgressBar>
#include <QFont>
#include <QTimer>
#include <QDateTime>
#include <QSpacerItem>
#include <QListWidget>
#include <QListWidgetItem>
#include <QCursor>
#include <QBrush>
#include <QColor>
#include <QAbstractScrollArea>
#include <QAbstractItemView>
#include <QApplication>
#include <QPalette>
#include <QLocale>
#include <QStatusTipEvent>
#include <QFontMetrics>
namespace {
static const QString MAX_EXPECTED_BLOCKCHAIN_DD_SUPPLY = QStringLiteral("11,000,000,000.00 $DD");
static const QString MAX_EXPECTED_BLOCKCHAIN_DGB_LOCKED = QStringLiteral("21,000,000,000.00 DGB");
static constexpr int TOTALS_VALUE_HORIZONTAL_PADDING = 36;
static constexpr int TOTALS_FRAME_HORIZONTAL_PADDING = 72;
static constexpr int RECENT_TX_AMOUNT_COLUMN_MIN_WIDTH = 128;
static constexpr int RECENT_TX_COLUMN_SPACING = 16;
enum RecentTransactionRole {
RecentTxIdRole = Qt::UserRole + 1,
RecentTypeRole,
RecentAmountRole,
RecentDateRole,
RecentConfirmationsRole,
RecentNoteRole,
};
} // namespace
DigiDollarOverviewWidget::DigiDollarOverviewWidget(QWidget *parent) :
QWidget(parent),
m_mainLayout(nullptr),
m_balanceFrame(nullptr),
m_balanceLayout(nullptr),
m_ddBalanceLabel(nullptr),
m_ddBalanceValue(nullptr),
m_ddPendingLabel(nullptr),
m_ddPendingValue(nullptr),
m_dgbCollateralLabel(nullptr),
m_dgbCollateralValue(nullptr),
m_usdValueLabel(nullptr),
m_usdValueValue(nullptr),
m_systemHealthFrame(nullptr),
m_systemHealthLayout(nullptr),
m_oraclePriceLabel(nullptr),
m_oraclePriceValue(nullptr),
m_networkTotalDDLabel(nullptr),
m_networkTotalDDValue(nullptr),
m_networkTotalCollateralLabel(nullptr),
m_networkTotalCollateralValue(nullptr),
m_systemHealthLabel(nullptr),
m_systemHealthValue(nullptr),
m_dcaLevelLabel(nullptr),
m_dcaLevelValue(nullptr),
m_errLevelLabel(nullptr),
m_errLevelValue(nullptr),
m_systemHealthBar(nullptr),
m_transactionsFrame(nullptr),
m_transactionsLayout(nullptr),
m_transactionsTitle(nullptr),
m_transactionsList(nullptr),
m_recentTransactionsInfo(nullptr),
m_walletModel(nullptr),
m_clientModel(nullptr),
m_ddBalance(0.0),
m_dgbCollateral(0.0),
m_oraclePrice(0.0),
m_systemHealthStatus("Loading..."),
m_dcaLevel(0),
m_errLevel(0)
{
setupUI();
connectSignals();
// REMOVED: applyTheme() - Let CSS handle all theming
// Add some demo transactions for display purposes
addDemoTransactions();
}
DigiDollarOverviewWidget::~DigiDollarOverviewWidget()
{
// Qt will handle cleanup of child widgets
}
void DigiDollarOverviewWidget::setupUI()
{
// Create main layout - reduced spacing for compact UI
m_mainLayout = new QVBoxLayout(this);
m_mainLayout->setSpacing(6);
m_mainLayout->setContentsMargins(8, 8, 8, 8);
// Create horizontal layout for balance and system health side-by-side
QHBoxLayout* topLayout = new QHBoxLayout();
topLayout->setSpacing(10);
// Setup sections
setupBalanceSection();
setupSystemHealthSection();
// Add balance and system health frames to horizontal layout
// Both frames stretch to fill the same height for symmetry
topLayout->addWidget(m_balanceFrame, 1);
topLayout->addWidget(m_systemHealthFrame, 1);
// Add the horizontal layout to main layout
m_mainLayout->addLayout(topLayout);
// Add transactions section below
setupRecentTransactionsSection();
setLayout(m_mainLayout);
}
void DigiDollarOverviewWidget::setupBalanceSection()
{
// Create balance frame with styling matching main wallet
m_balanceFrame = new QFrame(this);
m_balanceFrame->setFrameShape(QFrame::StyledPanel);
m_balanceFrame->setFrameShadow(QFrame::Raised);
m_balanceFrame->setObjectName("balanceFrame");
m_balanceFrame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QVBoxLayout* frameVLayout = new QVBoxLayout(m_balanceFrame);
frameVLayout->setObjectName("frameVLayout");
// Add top stretch to center content vertically
frameVLayout->addStretch(1);
// Title with status indicator layout (similar to main wallet)
QHBoxLayout* titleLayout = new QHBoxLayout();
titleLayout->setObjectName("titleLayout");
QLabel* balanceTitle = new QLabel(tr("DigiDollar Balances"), this);
QFont titleFont = balanceTitle->font();
titleFont.setBold(true);
titleFont.setWeight(75); // Match main wallet weight
balanceTitle->setFont(titleFont);
titleLayout->addWidget(balanceTitle);
// Add spacer to push content left (matching main wallet layout)
QSpacerItem* titleSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
titleLayout->addItem(titleSpacer);
frameVLayout->addLayout(titleLayout);
// Grid layout for balance items - reduced spacing for compact UI
m_balanceLayout = new QGridLayout();
m_balanceLayout->setSpacing(6);
m_balanceLayout->setObjectName("balanceGridLayout");
// DD Balance (Available / Confirmed)
m_ddBalanceLabel = new QLabel(tr("Available"), this);
m_ddBalanceLabel->setObjectName("ddBalanceLabel");
m_ddBalanceValue = new QLabel("0.00 $DD", this);
m_ddBalanceValue->setObjectName("ddBalanceValue");
m_ddBalanceValue->setCursor(QCursor(Qt::IBeamCursor));
m_ddBalanceValue->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
m_ddBalanceValue->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
m_ddBalanceValue->setToolTip(tr("Your confirmed, spendable DigiDollar balance"));
m_balanceLayout->addWidget(m_ddBalanceLabel, 1, 0);
m_balanceLayout->addWidget(m_ddBalanceValue, 1, 1);
// DD Pending (Unconfirmed)
m_ddPendingLabel = new QLabel(tr("Pending"), this);
m_ddPendingLabel->setObjectName("ddPendingLabel");
m_ddPendingValue = new QLabel("0.00 $DD", this);
m_ddPendingValue->setObjectName("ddPendingValue");
m_ddPendingValue->setCursor(QCursor(Qt::IBeamCursor));
m_ddPendingValue->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
m_ddPendingValue->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
m_ddPendingValue->setToolTip(tr("DigiDollar balance from unconfirmed transactions (awaiting block confirmation)"));
m_balanceLayout->addWidget(m_ddPendingLabel, 2, 0);
m_balanceLayout->addWidget(m_ddPendingValue, 2, 1);
// DGB Collateral (Locked)
m_dgbCollateralLabel = new QLabel(tr("Locked Collateral"), this);
m_dgbCollateralLabel->setObjectName("dgbCollateralLabel");
m_dgbCollateralValue = new QLabel("0.00000000 DGB", this);
m_dgbCollateralValue->setObjectName("dgbCollateralValue");
m_dgbCollateralValue->setCursor(QCursor(Qt::IBeamCursor));
m_dgbCollateralValue->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
m_dgbCollateralValue->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
m_dgbCollateralValue->setToolTip(tr("Your DGB locked as collateral for DigiDollars in your wallet"));
m_balanceLayout->addWidget(m_dgbCollateralLabel, 3, 0);
m_balanceLayout->addWidget(m_dgbCollateralValue, 3, 1);
// Add separator line
QFrame* line = new QFrame(m_balanceFrame);
line->setObjectName("line");
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
m_balanceLayout->addWidget(line, 4, 0, 1, 2);
// USD Value (Total — confirmed only)
m_usdValueLabel = new QLabel(tr("Total $USD:"), this);
m_usdValueLabel->setObjectName("usdValueLabel");
m_usdValueValue = new QLabel(formatUSDAmount(0), this);
m_usdValueValue->setObjectName("usdValueValue");
m_usdValueValue->setCursor(QCursor(Qt::IBeamCursor));
m_usdValueValue->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
m_usdValueValue->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
m_usdValueValue->setToolTip(tr("Your confirmed DigiDollar value in USD (excludes pending)"));
m_balanceLayout->addWidget(m_usdValueLabel, 5, 0);
m_balanceLayout->addWidget(m_usdValueValue, 5, 1);
// Add horizontal spacer
QSpacerItem* horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
m_balanceLayout->addItem(horizontalSpacer, 3, 2, 1, 1);
frameVLayout->addLayout(m_balanceLayout);
// Add bottom stretch to center content vertically
frameVLayout->addStretch(1);
// REMOVED: m_mainLayout->addWidget(m_balanceFrame);
// Frame is now added to horizontal layout in setupUI()
}
void DigiDollarOverviewWidget::setupSystemHealthSection()
{
// Create system health frame with styling matching main wallet
m_systemHealthFrame = new QFrame(this);
m_systemHealthFrame->setFrameShape(QFrame::StyledPanel);
m_systemHealthFrame->setFrameShadow(QFrame::Raised);
m_systemHealthFrame->setObjectName("systemHealthFrame");
m_systemHealthFrame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QVBoxLayout* frameVLayout = new QVBoxLayout(m_systemHealthFrame);
frameVLayout->setObjectName("healthFrameVLayout");
// Title with status indicator layout
QHBoxLayout* titleLayout = new QHBoxLayout();
titleLayout->setObjectName("healthTitleLayout");
QLabel* healthTitle = new QLabel(tr("Blockchain DigiDollar Status"), this);
healthTitle->setObjectName("healthTitle");
QFont titleFont = healthTitle->font();
titleFont.setBold(true);
titleFont.setWeight(75); // Match main wallet weight
healthTitle->setFont(titleFont);
titleLayout->addWidget(healthTitle);
// Add spacer to push content left
QSpacerItem* titleSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
titleLayout->addItem(titleSpacer);
frameVLayout->addLayout(titleLayout);
// ========================================
// Split layout: Left stats | Right totals
// ========================================
QHBoxLayout* contentLayout = new QHBoxLayout();
contentLayout->setSpacing(10);
contentLayout->setObjectName("healthContentLayout");
// --- LEFT SIDE: Other stats (DGB/USD, System Health, DCA, ERR) ---
QFrame* leftStatsFrame = new QFrame(this);
leftStatsFrame->setObjectName("leftStatsFrame");
leftStatsFrame->setFrameShape(QFrame::NoFrame);
leftStatsFrame->setMinimumWidth(170);
m_systemHealthLayout = new QGridLayout(leftStatsFrame);
m_systemHealthLayout->setSpacing(8);
m_systemHealthLayout->setContentsMargins(0, 0, 0, 0);
m_systemHealthLayout->setObjectName("healthGridLayout");
// Oracle Price
m_oraclePriceLabel = new QLabel(tr("DGB/$USD Price:"), this);
m_oraclePriceLabel->setObjectName("oraclePriceLabel");
m_oraclePriceValue = new QLabel("Loading...", this);
m_oraclePriceValue->setObjectName("oraclePriceValue");
m_oraclePriceValue->setCursor(QCursor(Qt::IBeamCursor));
m_oraclePriceValue->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
m_oraclePriceValue->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
m_oraclePriceValue->setToolTip(tr("Current DigiByte to USD exchange rate from oracle"));
m_systemHealthLayout->addWidget(m_oraclePriceLabel, 0, 0);
m_systemHealthLayout->addWidget(m_oraclePriceValue, 0, 1);
// System Health Status
m_systemHealthLabel = new QLabel(tr("System Health:"), this);
m_systemHealthLabel->setObjectName("systemHealthLabel");
m_systemHealthValue = new QLabel("Loading...", this);
m_systemHealthValue->setObjectName("systemHealthValue");
m_systemHealthValue->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
m_systemHealthValue->setToolTip(tr("Overall DigiDollar blockchain health status"));
m_systemHealthLayout->addWidget(m_systemHealthLabel, 1, 0);
m_systemHealthLayout->addWidget(m_systemHealthValue, 1, 1);
// DCA Level
m_dcaLevelLabel = new QLabel(tr("DCA Level:"), this);
m_dcaLevelLabel->setObjectName("dcaLevelLabel");
m_dcaLevelValue = new QLabel("0", this);
m_dcaLevelValue->setObjectName("dcaLevelValue");
m_dcaLevelValue->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
m_dcaLevelValue->setToolTip(tr("Current Dynamic Collateral Adjustment intervention level"));
m_systemHealthLayout->addWidget(m_dcaLevelLabel, 2, 0);
m_systemHealthLayout->addWidget(m_dcaLevelValue, 2, 1);
// ERR Level
m_errLevelLabel = new QLabel(tr("ERR Level:"), this);
m_errLevelLabel->setObjectName("errLevelLabel");
m_errLevelValue = new QLabel("0", this);
m_errLevelValue->setObjectName("errLevelValue");
m_errLevelValue->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
m_errLevelValue->setToolTip(tr("Current Emergency Redemption Ratio level"));
m_systemHealthLayout->addWidget(m_errLevelLabel, 3, 0);
m_systemHealthLayout->addWidget(m_errLevelValue, 3, 1);
// --- RIGHT SIDE: Prominent Blockchain Totals (DD Supply + Collateral) ---
QFrame* rightTotalsFrame = new QFrame(this);
rightTotalsFrame->setObjectName("networkTotalsFrame");
rightTotalsFrame->setFrameShape(QFrame::StyledPanel);
rightTotalsFrame->setFrameShadow(QFrame::Raised);
rightTotalsFrame->setMinimumWidth(300);
QVBoxLayout* totalsLayout = new QVBoxLayout(rightTotalsFrame);
totalsLayout->setSpacing(12);
totalsLayout->setContentsMargins(15, 15, 15, 15);
// Blockchain Total DD Supply (prominent)
m_networkTotalDDLabel = new QLabel(tr("Blockchain $DD Supply"), this);
m_networkTotalDDLabel->setObjectName("networkTotalDDLabel");
m_networkTotalDDLabel->setAlignment(Qt::AlignCenter);
m_networkTotalDDLabel->setWordWrap(false);
totalsLayout->addWidget(m_networkTotalDDLabel);
m_networkTotalDDValue = new QLabel("Loading...", this);
m_networkTotalDDValue->setObjectName("networkTotalDDValue");
m_networkTotalDDValue->setCursor(QCursor(Qt::IBeamCursor));
m_networkTotalDDValue->setAlignment(Qt::AlignCenter);
m_networkTotalDDValue->setWordWrap(false);
m_networkTotalDDValue->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
m_networkTotalDDValue->setToolTip(tr("Total DigiDollar supply recorded on the blockchain"));
totalsLayout->addWidget(m_networkTotalDDValue);
// Separator between totals
QFrame* separator = new QFrame(this);
separator->setObjectName("totalsSeparator");
separator->setFrameShape(QFrame::HLine);
separator->setFrameShadow(QFrame::Sunken);
totalsLayout->addWidget(separator);
// Blockchain Total Collateral (prominent)
m_networkTotalCollateralLabel = new QLabel(tr("Blockchain DGB Locked"), this);
m_networkTotalCollateralLabel->setObjectName("networkTotalCollateralLabel");
m_networkTotalCollateralLabel->setAlignment(Qt::AlignCenter);
m_networkTotalCollateralLabel->setWordWrap(false);
totalsLayout->addWidget(m_networkTotalCollateralLabel);
m_networkTotalCollateralValue = new QLabel("Loading...", this);
m_networkTotalCollateralValue->setObjectName("networkTotalCollateralValue");
m_networkTotalCollateralValue->setCursor(QCursor(Qt::IBeamCursor));
m_networkTotalCollateralValue->setAlignment(Qt::AlignCenter);
m_networkTotalCollateralValue->setWordWrap(false);
m_networkTotalCollateralValue->setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);
m_networkTotalCollateralValue->setToolTip(tr("Total DGB locked as collateral on the blockchain"));
totalsLayout->addWidget(m_networkTotalCollateralValue);
updateBlockchainTotalsMinimumWidth();
// Add left and right to horizontal content layout
contentLayout->addWidget(leftStatsFrame, 2);
contentLayout->addWidget(rightTotalsFrame, 3);
frameVLayout->addLayout(contentLayout);
// System Health Progress Bar at bottom - spans full width
m_systemHealthBar = new QProgressBar(this);
m_systemHealthBar->setObjectName("systemHealthBar");
m_systemHealthBar->setRange(0, 100);
m_systemHealthBar->setValue(0);
m_systemHealthBar->setTextVisible(true);
m_systemHealthBar->setFormat("0% Collateralization");
m_systemHealthBar->setMinimumHeight(20);
m_systemHealthBar->setToolTip(tr("Visual indicator of overall blockchain health"));
frameVLayout->addWidget(m_systemHealthBar);
// REMOVED: m_mainLayout->addWidget(m_systemHealthFrame);
// Frame is now added to horizontal layout in setupUI()
}
void DigiDollarOverviewWidget::setupRecentTransactionsSection()
{
// Create recent transactions frame with styling matching main wallet
m_transactionsFrame = new QFrame(this);
m_transactionsFrame->setFrameShape(QFrame::StyledPanel);
m_transactionsFrame->setFrameShadow(QFrame::Raised);
m_transactionsFrame->setObjectName("transactionsFrame");
QVBoxLayout* frameVLayout = new QVBoxLayout(m_transactionsFrame);
frameVLayout->setObjectName("transactionsFrameVLayout");
// Title with status indicator layout
QHBoxLayout* titleLayout = new QHBoxLayout();
titleLayout->setObjectName("transactionsTitleLayout");
m_transactionsTitle = new QLabel(tr("20 Most Recent DigiDollar Transactions"), this);
QFont titleFont = m_transactionsTitle->font();
titleFont.setBold(true);
titleFont.setWeight(75); // Match main wallet weight
m_transactionsTitle->setFont(titleFont);
titleLayout->addWidget(m_transactionsTitle);
// Add spacer to push content left
QSpacerItem* titleSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
titleLayout->addItem(titleSpacer);
frameVLayout->addLayout(titleLayout);
// Create list widget for transactions (similar to main wallet)
m_transactionsList = new QListWidget(this);
m_transactionsList->setObjectName("transactionsList");
m_transactionsList->setFrameShape(QFrame::NoFrame);
m_transactionsList->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
m_transactionsList->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_transactionsList->setSelectionMode(QAbstractItemView::SingleSelection);
m_transactionsList->setUniformItemSizes(true);
// No minimum height - allow to shrink with window
m_transactionsList->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
connect(m_transactionsList, &QListWidget::itemDoubleClicked,
this, &DigiDollarOverviewWidget::activateRecentTransaction);
connect(m_transactionsList, &QListWidget::itemActivated,
this, &DigiDollarOverviewWidget::activateRecentTransaction);
// Info label for when no transactions exist
m_recentTransactionsInfo = new QLabel(tr("No recent DigiDollar transactions"), this);
m_recentTransactionsInfo->setObjectName("recentTransactionsInfo");
// Theme styling will be applied in applyTheme()
m_recentTransactionsInfo->setAlignment(Qt::AlignCenter);
m_recentTransactionsInfo->setVisible(true);
frameVLayout->addWidget(m_transactionsList);
frameVLayout->addWidget(m_recentTransactionsInfo);
// Set transactions frame to expand vertically
m_transactionsFrame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
// Add transactions frame with stretch factor to fill remaining space
m_mainLayout->addWidget(m_transactionsFrame, 1); // stretch factor 1 = expand to fill
}
void DigiDollarOverviewWidget::connectSignals()
{
// Connect update timer (every 5 seconds for better sync across wallets)
QTimer* updateTimer = new QTimer(this);
connect(updateTimer, &QTimer::timeout, this, &DigiDollarOverviewWidget::updateView);
updateTimer->start(5000); // 5 seconds - faster updates for network sync
// Note: Additional wallet and client model signals will be connected
// in setWalletModel() and setClientModel() once models are available
}
void DigiDollarOverviewWidget::setWalletModel(WalletModel* model)
{
m_walletModel = model;
if (m_walletModel) {
// Connect wallet model signals for automatic updates
connect(m_walletModel, &WalletModel::balanceChanged,
this, &DigiDollarOverviewWidget::updateBalance);
// Update transaction history when balance changes (indicates new transaction)
connect(m_walletModel, &WalletModel::balanceChanged,
this, &DigiDollarOverviewWidget::updateRecentTransactions);
connect(m_walletModel, &WalletModel::digiDollarChanged,
this, &DigiDollarOverviewWidget::refreshDigiDollarState);
// Initial updates
updateBalance();
updateRecentTransactions();
// Connect to options model for font updates
if (m_walletModel->getOptionsModel()) {
connect(m_walletModel->getOptionsModel(), &OptionsModel::useEmbeddedMonospacedFontChanged,
this, &DigiDollarOverviewWidget::setMonospacedFont);
setMonospacedFont(m_walletModel->getOptionsModel()->getUseEmbeddedMonospacedFont());
// REMOVED: applyTheme() - Let CSS handle all theming
}
}
}
void DigiDollarOverviewWidget::setClientModel(ClientModel* model)
{
m_clientModel = model;
if (m_clientModel) {
// NOTE: We do NOT connect to numBlocksChanged for DD updates!
// DD updates should only happen when balance changes (like DGB).
// Oracle price and system health are updated via the 30-second timer in updateView().
// This prevents constant updates during block sync.
// Initial updates
updateOraclePrice();
updateSystemHealthIfDue(/*force=*/true);
// Connect to options model for font updates
if (m_clientModel->getOptionsModel()) {
connect(m_clientModel->getOptionsModel(), &OptionsModel::useEmbeddedMonospacedFontChanged,
this, &DigiDollarOverviewWidget::setMonospacedFont);
setMonospacedFont(m_clientModel->getOptionsModel()->getUseEmbeddedMonospacedFont());
// REMOVED: applyTheme() - Let CSS handle all theming
}
}
}
void DigiDollarOverviewWidget::updateView()
{
// Don't poll RPCs if widget is hidden (DD not yet active)
if (!isVisible()) return;
updateBalance();
updateOraclePrice();
updateSystemHealthIfDue(/*force=*/false);
updateRecentTransactions();
}
void DigiDollarOverviewWidget::updateSystemHealthIfDue(bool force)
{
const qint64 now = QDateTime::currentMSecsSinceEpoch();
if (!force && m_lastSystemHealthUpdateTime > 0 &&
now - m_lastSystemHealthUpdateTime < SYSTEM_HEALTH_UPDATE_INTERVAL_MS) {
return;
}
m_lastSystemHealthUpdateTime = now;
updateSystemHealth();
}
void DigiDollarOverviewWidget::incomingDDTransaction(const QString& date, const QString& amount,
const QString& type, const QString& address)
{
// Add transaction to list widget
QListWidgetItem* item = new QListWidgetItem(m_transactionsList);
QString transactionText = QString("%1 %2 $DD - %3")
.arg(type)
.arg(amount)
.arg(date);
item->setText(transactionText);
item->setToolTip(QString("Address: %1").arg(address));
// Color code transaction types with theme support
QPalette palette = QApplication::palette();
int lightness = palette.color(QPalette::WindowText).lightness();
bool isDarkTheme = lightness > 127;
if (type.contains("Received") || type.contains("Minted")) {
QString successColor = isDarkTheme ? "#4caf50" : "#28a745";
item->setForeground(QBrush(QColor(successColor)));
} else if (type.contains("Sent") || type.contains("Redeemed")) {
QString errorColor = isDarkTheme ? "#f44336" : "#dc3545";
item->setForeground(QBrush(QColor(errorColor)));
}
// Insert at top (most recent first)
m_transactionsList->insertItem(0, item);
// Limit to 5 most recent transactions
while (m_transactionsList->count() > 5) {
delete m_transactionsList->takeItem(m_transactionsList->count() - 1);
}
// Hide the "no transactions" label and show the list
m_recentTransactionsInfo->setVisible(false);
m_transactionsList->setVisible(true);
// Update balance after a short delay to allow for processing
QTimer::singleShot(1000, this, &DigiDollarOverviewWidget::updateBalance);
}
void DigiDollarOverviewWidget::updateBalance()
{
// Skip updates during Initial Block Download - balance only matters when synced
if (m_clientModel && m_clientModel->node().isInitialBlockDownload()) {
return;
}
// Throttle updates - skip if less than 5 seconds since last update
// This prevents UI freeze when balance changes flood in after IBD ends
qint64 now = QDateTime::currentMSecsSinceEpoch();
if (now - m_lastBalanceUpdateTime < UPDATE_THROTTLE_MS) {
return; // Skip this update, too soon
}
m_lastBalanceUpdateTime = now;
// Get actual DigiDollar balance from wallet
double ddPending = 0.0;
if (m_walletModel) {
// Get DD confirmed balance from wallet (in cents)
CAmount balanceCents = m_walletModel->getDigiDollarBalance();
m_ddBalance = balanceCents / 100.0; // Convert cents to DD
// Get DD pending balance from wallet (in cents)
CAmount pendingCents = m_walletModel->getPendingDigiDollarBalance();
ddPending = pendingCents / 100.0; // Convert cents to DD
// Get locked collateral from wallet positions (in satoshis)
CAmount collateralSats = m_walletModel->getLockedCollateral();
m_dgbCollateral = collateralSats / 100000000.0; // Convert satoshis to DGB
} else {
// No wallet connected
m_ddBalance = 0.0;
m_dgbCollateral = 0.0;
}
// Update display — Available (confirmed only)
if (m_privacy) {
m_ddBalanceValue->setText(maskValue(formatDDAmount(0)));
m_ddPendingValue->setText(maskValue(formatDDAmount(0)));
m_ddPendingLabel->setVisible(false);
m_ddPendingValue->setVisible(false);
m_dgbCollateralValue->setText(maskValue(formatDGBAmount(0)));
m_usdValueValue->setText(maskValue(formatUSDAmount(0)));
} else {
m_ddBalanceValue->setText(formatDDAmount(m_ddBalance));
// Pending (unconfirmed but trusted) — hide row when zero for clean UI
m_ddPendingValue->setText(formatDDAmount(ddPending));
bool hasPending = (ddPending > 0.0);
m_ddPendingLabel->setVisible(hasPending);
m_ddPendingValue->setVisible(hasPending);
m_dgbCollateralValue->setText(formatDGBAmount(m_dgbCollateral));
// Calculate USD value from CONFIRMED balance only (DD pegged to $1)
double usdValue = m_ddBalance * 1.0;
m_usdValueValue->setText(formatUSDAmount(usdValue));
}
}
void DigiDollarOverviewWidget::refreshDigiDollarState()
{
m_lastBalanceUpdateTime = 0;
m_lastTxUpdateTime = 0;
updateBalance();
updateRecentTransactions();
}
void DigiDollarOverviewWidget::updateOraclePrice()
{
// Skip updates during Initial Block Download - oracle price only matters when synced
if (m_clientModel && m_clientModel->node().isInitialBlockDownload()) {
return;
}
// Get price from MockOracleManager if in RegTest, otherwise use real oracle via RPC
if (Params().GetChainType() == ChainType::REGTEST && MockOracleManager::GetInstance().IsEnabled()) {
// Get regtest mock oracle price in micro-USD.
// 1,000,000 micro-USD = $1.00
CAmount priceMicroUsd = MockOracleManager::GetInstance().GetCurrentPrice();
// Convert micro-USD to dollars
m_oraclePrice = priceMicroUsd / 1000000.0;
} else if (m_clientModel) {
// Get actual oracle price from RPC
try {
UniValue params(UniValue::VARR);
UniValue result = m_clientModel->node().executeRpc("getoracleprice", params, "");
// Price is returned in micro-USD (1,000,000 = $1.00)
int64_t priceMicroUsd = result.find_value("price_micro_usd").getInt<int64_t>();
m_oraclePrice = priceMicroUsd / 1000000.0; // Convert micro-USD to dollars
} catch (const UniValue& e) {
LogPrintf("DigiDollar: updateOraclePrice RPC error - %s\n", e.write());
m_oraclePrice = 0.0;
} catch (const std::exception& e) {
LogPrintf("DigiDollar: updateOraclePrice error - %s\n", e.what());
m_oraclePrice = 0.0;
} catch (...) {
LogPrintf("DigiDollar: updateOraclePrice unknown error\n");
m_oraclePrice = 0.0;
}
} else {
m_oraclePrice = 0.0; // No client model available
}
if (m_oraclePrice > 0) {
m_oraclePriceValue->setText(QString("%1 $USD").arg(QString::number(m_oraclePrice, 'f', 6)));
} else {
m_oraclePriceValue->setText(tr("Oracle unavailable"));
}
}
void DigiDollarOverviewWidget::updateSystemHealth()
{
// Skip updates during Initial Block Download - system health only matters when synced
if (m_clientModel && m_clientModel->node().isInitialBlockDownload()) {
return;
}
// BLOCKCHAIN-WIDE TRACKING: Call RPC to get blockchain-wide system health
// This ensures Bob and Alice both see identical stats across the chain.
if (!m_clientModel) {
m_systemHealthValue->setText("No Connection");
m_networkTotalDDValue->setText("N/A");
m_networkTotalCollateralValue->setText("N/A");
m_dcaLevelValue->setText("N/A");
m_errLevelValue->setText("N/A");
m_systemHealthBar->setValue(0);
return;
}
try {
// Execute RPC call to get blockchain-wide system health
UniValue params(UniValue::VARR); // No parameters needed
UniValue result = m_clientModel->node().executeRpc("getdigidollarstats", params, "");
// Extract values from RPC result
int healthPercentage = result.find_value("health_percentage").getInt<int>();
std::string healthStatus = result.find_value("health_status").get_str();
CAmount totalCollateralSats = AmountFromValue(result.find_value("total_collateral_dgb"));
CAmount totalDDCents = result.find_value("total_dd_supply").getInt<int64_t>();
bool isEmergency = result.find_value("is_emergency").get_bool();
const UniValue& oracleAvailableValue = result.find_value("oracle_available");
const bool oracleAvailable = oracleAvailableValue.isNull() ? true : oracleAvailableValue.get_bool();
// Get DCA tier info
const UniValue& dcaTier = result.find_value("dca_tier");
double dcaMultiplier = dcaTier.find_value("multiplier").get_real();
// Get ERR tier info
const UniValue& errTier = result.find_value("err_tier");
double errRatio = errTier.find_value("ratio").get_real();
double errBurnMultiplier = errTier.find_value("burn_multiplier").get_real();
// Update blockchain-wide stats
double totalDD = totalDDCents / 100.0; // Convert cents to DD
double totalCollateralDGB = totalCollateralSats / 100000000.0; // Convert satoshis to DGB
// Format with commas for readability
QLocale locale(QLocale::English);
QString ddFormatted = locale.toString(totalDD, 'f', 2);
QString dgbFormatted = locale.toString(totalCollateralDGB, 'f', 2);
// Use rich text for colored formatting: green numbers and white $DD label
m_networkTotalDDValue->setTextFormat(Qt::RichText);
m_networkTotalDDValue->setText(QString("<span style='color: #00FF88; font-weight: bold;'>%1</span><span style='color: white;'> $DD</span>").arg(ddFormatted));
m_networkTotalCollateralValue->setTextFormat(Qt::RichText);
m_networkTotalCollateralValue->setText(QString("<span style='color: #00FF88; font-weight: bold;'>%1</span><span style='color: white;'> DGB</span>").arg(dgbFormatted));
if (!oracleAvailable) {
m_systemHealthValue->setText(tr("Oracle Unavailable"));
m_dcaLevelValue->setText(tr("Paused"));
m_errLevelValue->setText(tr("Not Evaluated"));
m_systemHealthBar->setValue(0);
m_systemHealthBar->setFormat(tr("Oracle price unavailable"));
return;
}
// Update system health display
// RPC returns health_percentage as actual percentage (e.g., 151 = 151%)
double healthPercent = static_cast<double>(healthPercentage);
m_systemHealthValue->setText(QString("%1% Collateralized").arg(healthPercentage));
// Update DCA and ERR levels
m_dcaLevelValue->setText(QString("%1x").arg(QString::number(dcaMultiplier, 'f', 1)));
// Show ERR as percentage ratio and burn multiplier
// Normal: "100% (1.0x)" | Emergency: "80% (1.25x burn)"
if (isEmergency) {
int errPercent = static_cast<int>(errRatio * 100);
m_errLevelValue->setText(QString("%1% (%2x burn)")
.arg(errPercent)
.arg(QString::number(errBurnMultiplier, 'f', 2)));
} else {
m_errLevelValue->setText("100% (Normal)");
}
// Update progress bar (scale 0-500% to 0-100%)
int barValue = std::min(100, static_cast<int>((healthPercent * 100) / 500));
m_systemHealthBar->setValue(barValue);
m_systemHealthBar->setFormat(QString("%1% Collateralization").arg(QString::number(healthPercent, 'f', 1)));
} catch (const UniValue& e) {
LogPrintf("DigiDollar: updateSystemHealth RPC error - %s\n", e.write());
m_systemHealthValue->setText("Loading...");
m_networkTotalDDValue->setText("Loading...");
m_networkTotalCollateralValue->setText("Loading...");
m_dcaLevelValue->setText("Loading...");
m_errLevelValue->setText("Loading...");
m_systemHealthBar->setValue(0);
} catch (const std::exception& e) {
m_systemHealthValue->setText("Error");
m_networkTotalDDValue->setText("Error");
m_networkTotalCollateralValue->setText("Error");
m_dcaLevelValue->setText("Unknown");
m_errLevelValue->setText("Unknown");
m_systemHealthBar->setValue(0);
LogPrintf("DigiDollar: updateSystemHealth RPC error - %s\n", e.what());
}
}
void DigiDollarOverviewWidget::updateRecentTransactions()
{
if (!m_walletModel) {
return;
}
// Skip updates during Initial Block Download - DD data only matters when synced
if (m_clientModel && m_clientModel->node().isInitialBlockDownload()) {
return;
}
// Throttle updates - skip if less than 5 seconds since last update
qint64 now = QDateTime::currentMSecsSinceEpoch();
if (now - m_lastTxUpdateTime < UPDATE_THROTTLE_MS) {
return; // Skip this update, too soon
}
m_lastTxUpdateTime = now;
// Get recent transactions from DigiDollarWallet
DigiDollarWallet* ddWallet = m_walletModel->wallet().getDigiDollarWallet();
if (!ddWallet) {
return;
}
// Get transaction history (confirmations are calculated on-demand inside this call)
std::vector<DDTransaction> transactions = ddWallet->GetDDTransactionHistory();
// Sort transactions by timestamp descending (newest first)
std::sort(transactions.begin(), transactions.end(),
[](const DDTransaction& a, const DDTransaction& b) {
return a.timestamp > b.timestamp;
});
// NOTE: Removed expensive per-transaction getWalletTxDetails loop
// Confirmations are now calculated on-demand in GetDDTransactionHistory()
auto formatRecentAmount = [](const DDTransaction& tx) {
const CAmount absAmount = tx.amount < 0 ? -tx.amount : tx.amount;
const bool is_outflow = (tx.category == "send" || tx.category == "redeem") || tx.amount < 0;
const bool is_inflow = (tx.category == "receive" || tx.category == "mint") || tx.amount > 0;
const QString amountPrefix = absAmount == 0 ? "" : (is_outflow ? "-" : (is_inflow ? "+" : ""));
QString amount = QString("%1 $DD").arg(static_cast<double>(absAmount) / 100.0, 0, 'f', 2);
amount.prepend(amountPrefix);
return amount;
};
QFont monospaceFont = GUIUtil::fixedPitchFont();
QFontMetrics amountMetrics(monospaceFont);
int amountColumnWidth = RECENT_TX_AMOUNT_COLUMN_MIN_WIDTH;
int measuredCount = 0;
for (const auto& tx : transactions) {
if (measuredCount >= 20) break;
++measuredCount;
amountColumnWidth = std::max(amountColumnWidth,
amountMetrics.horizontalAdvance(formatRecentAmount(tx)) + 12);
}
// Clear existing items
m_transactionsList->clear();
// Show recent transactions (first 20 - already sorted newest first)
int count = 0;
for (const auto& tx : transactions) {
if (count >= 20) break;
++count;
// Create transaction item widget
QWidget* itemWidget = new QWidget();
QHBoxLayout* layout = new QHBoxLayout(itemWidget);
layout->setContentsMargins(10, 5, 10, 5);
layout->setSpacing(RECENT_TX_COLUMN_SPACING);
// Transaction type icon and category with lock period for mints
QString icon;
QString categoryText;
QString lockPeriodStr;
// Format lock period based on tier (0-9, matches consensus/digidollar.h)
switch (tx.lock_tier) {
case 0: lockPeriodStr = tr("1-hr"); break;
case 1: lockPeriodStr = tr("30-day"); break;
case 2: lockPeriodStr = tr("3-mo"); break;
case 3: lockPeriodStr = tr("6-mo"); break;
case 4: lockPeriodStr = tr("1-yr"); break;
case 5: lockPeriodStr = tr("2-yr"); break;
case 6: lockPeriodStr = tr("3-yr"); break;
case 7: lockPeriodStr = tr("5-yr"); break;
case 8: lockPeriodStr = tr("7-yr"); break;
case 9: lockPeriodStr = tr("10-yr"); break;
default: lockPeriodStr = ""; break;
}
if (tx.category == "mint") {
icon = "🏦";
categoryText = lockPeriodStr.isEmpty() ? tr("Mint") : tr("Mint %1").arg(lockPeriodStr);
} else if (tx.category == "redeem") {
icon = "💰";
categoryText = lockPeriodStr.isEmpty() ? tr("Redeem") : tr("Redeem %1").arg(lockPeriodStr);
} else if (tx.category == "redeem_change") {
icon = "💰";
categoryText = tr("Redemption Change");
} else if (tx.category == "send") {
icon = "📤";
categoryText = tr("Send");
} else if (tx.category == "receive") {
icon = "📥";
categoryText = tr("Receive");
} else {
icon = "💵";
categoryText = QString::fromStdString(tx.category);
}
QLabel* iconLabel = new QLabel(icon);
iconLabel->setObjectName("recentTxIconLabel");
iconLabel->setFixedWidth(30);
iconLabel->setAlignment(Qt::AlignCenter);
layout->addWidget(iconLabel);
QLabel* categoryLabel = new QLabel(categoryText);
categoryLabel->setObjectName("recentTxCategoryLabel");
categoryLabel->setFixedWidth(130); // Wide enough for "Redeem 180-day"
layout->addWidget(categoryLabel);
// Amount — DDTransaction stores unsigned magnitudes, so derive sign from
// category (send/redeem are outflows, receive/mint are inflows). This
// matches listdigidollartxs RPC behaviour and the row colour logic below.
QLabel* amountLabel = new QLabel(formatRecentAmount(tx));
amountLabel->setObjectName("recentTxAmountLabel");
amountLabel->setFont(monospaceFont);
amountLabel->setFixedWidth(amountColumnWidth);
amountLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
amountLabel->setAlignment(Qt::AlignRight);
if (tx.amount < 0 || tx.category == "send" || tx.category == "redeem") {
amountLabel->setStyleSheet("color: #ff4646;");
} else if (tx.amount > 0 || tx.category == "receive" || tx.category == "mint") {
amountLabel->setStyleSheet("color: #64ff64;");
}
layout->addWidget(amountLabel);
// Confirmations - also check for abandoned status
QString confirmText;
if (tx.abandoned) {
confirmText = tr("Abandoned");
} else if (tx.confirmations < 0) {
confirmText = tr("Conflicted");
} else if (tx.confirmations == 0) {
confirmText = tx.is_local ? tr("Local") : tr("Pending");
} else if (tx.confirmations < 6) {
confirmText = QString("%1 conf").arg(tx.confirmations);
} else {
confirmText = tr("Confirmed");
}
QLabel* confirmLabel = new QLabel(confirmText);
confirmLabel->setObjectName("recentTxStatusLabel");
if (tx.is_local) {
confirmLabel->setToolTip(tr("Created locally but not currently in mempool. It may need rebroadcast or may have been rejected."));
}
confirmLabel->setFixedWidth(100);
layout->addWidget(confirmLabel);
// Date/time
QDateTime dateTime = QDateTime::fromSecsSinceEpoch(tx.timestamp);
QLabel* dateLabel = new QLabel(dateTime.toString("MMM dd, yyyy"));
dateLabel->setObjectName("recentTxDateLabel");
dateLabel->setAlignment(Qt::AlignRight);
layout->addWidget(dateLabel);
layout->addStretch();
// Add to list
QListWidgetItem* item = new QListWidgetItem(m_transactionsList);