Repository navigation
Expand file tree
/
Copy pathdigidollaroverviewwidget.h
More file actions
153 lines (131 loc) · 4.73 KB
/
Copy pathdigidollaroverviewwidget.h
File metadata and controls
153 lines (131 loc) · 4.73 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
// 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.
#ifndef DIGIBYTE_QT_DIGIDOLLAROVERVIEWWIDGET_H
#define DIGIBYTE_QT_DIGIDOLLAROVERVIEWWIDGET_H
#include <QWidget>
class WalletModel;
class ClientModel;
QT_BEGIN_NAMESPACE
class QLabel;
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QFrame;
class QProgressBar;
class QListWidget;
class QListWidgetItem;
class QSpacerItem;
QT_END_NAMESPACE
/**
* DigiDollar overview widget showing balances, oracle price, and system health.
* This widget provides a summary view of the user's DigiDollar holdings and
* system status information.
*/
class DigiDollarOverviewWidget : public QWidget
{
Q_OBJECT
public:
explicit DigiDollarOverviewWidget(QWidget *parent = nullptr);
~DigiDollarOverviewWidget();
void setWalletModel(WalletModel* model);
void setClientModel(ClientModel* model);
void updateView();
/** Show incoming DigiDollar transaction notification */
void incomingDDTransaction(const QString& date, const QString& amount,
const QString& type, const QString& address);
Q_SIGNALS:
/** Fired when a message should be reported to the user */
void message(const QString &title, const QString &message, unsigned int style);
/** Fired when a recent transaction row should open in the DD Transactions tab. */
void recentTransactionActivated(const QString& txid);
public Q_SLOTS:
/** Update balance displays */
void updateBalance();
/** Update oracle price display */
void updateOraclePrice();
/** Update system health status */
void updateSystemHealth();
/** Set monospaced font for balance labels */
void setMonospacedFont(bool use_embedded_font);
/** Set privacy mode — masks all values and hides transaction list */
void setPrivacy(bool privacy);
// REMOVED: updateTheme() and applyTheme() - CSS handles all theming now
private Q_SLOTS:
/** Refresh immediately after wallet DigiDollar state changes. */
void refreshDigiDollarState();
/** Update recent transactions display */
void updateRecentTransactions();
/** Activate a recent transaction row. */
void activateRecentTransaction(QListWidgetItem* item);
private:
void setupUI();
void setupBalanceSection();
void setupSystemHealthSection();
void setupRecentTransactionsSection();
void connectSignals();
void addDemoTransactions(); // For demo purposes only
void updateSystemHealthIfDue(bool force);
QString formatDDAmount(double amount) const;
QString formatDGBAmount(double amount) const;
QString formatUSDAmount(double amount) const;
/** Mask a formatted string by replacing digits with '#' */
QString maskValue(const QString& value) const;
/** Keep blockchain total labels wide enough for launch-scale values. */
void updateBlockchainTotalsMinimumWidth();
// UI components
QVBoxLayout* m_mainLayout;
// Balance section
QFrame* m_balanceFrame;
QGridLayout* m_balanceLayout;
QLabel* m_ddBalanceLabel;
QLabel* m_ddBalanceValue;
QLabel* m_ddPendingLabel;
QLabel* m_ddPendingValue;
QLabel* m_dgbCollateralLabel;
QLabel* m_dgbCollateralValue;
QLabel* m_usdValueLabel;
QLabel* m_usdValueValue;
// System health section
QFrame* m_systemHealthFrame;
QGridLayout* m_systemHealthLayout;
QLabel* m_oraclePriceLabel;
QLabel* m_oraclePriceValue;
QLabel* m_networkTotalDDLabel;
QLabel* m_networkTotalDDValue;
QLabel* m_networkTotalCollateralLabel;
QLabel* m_networkTotalCollateralValue;
QLabel* m_systemHealthLabel;
QLabel* m_systemHealthValue;
QLabel* m_dcaLevelLabel;
QLabel* m_dcaLevelValue;
QLabel* m_errLevelLabel;
QLabel* m_errLevelValue;
QProgressBar* m_systemHealthBar;
QLabel* m_mintStatusLabel;
// Recent transactions section
QFrame* m_transactionsFrame;
QVBoxLayout* m_transactionsLayout;
QLabel* m_transactionsTitle;
QListWidget* m_transactionsList;
QLabel* m_recentTransactionsInfo;
// Models
WalletModel* m_walletModel;
ClientModel* m_clientModel;
// Data
double m_ddBalance;
double m_dgbCollateral;
double m_oraclePrice;
QString m_systemHealthStatus;
int m_dcaLevel;
int m_errLevel;
// Privacy
bool m_privacy{false};
// Throttling - minimum 5 seconds between updates during sync
qint64 m_lastBalanceUpdateTime{0};
qint64 m_lastTxUpdateTime{0};
qint64 m_lastSystemHealthUpdateTime{0};
static constexpr int UPDATE_THROTTLE_MS = 5000;
static constexpr int SYSTEM_HEALTH_UPDATE_INTERVAL_MS = 30000;
};
#endif // DIGIBYTE_QT_DIGIDOLLAROVERVIEWWIDGET_H