5 #ifndef PIVX_QT_DASHBOARDWIDGET_H
6 #define PIVX_QT_DASHBOARDWIDGET_H
21 #if defined(HAVE_CONFIG_H)
27 #include <QtCharts/QChartView>
28 #include <QtCharts/QBarSeries>
29 #include <QtCharts/QBarCategoryAxis>
30 #include <QtCharts/QBarSet>
31 #include <QtCharts/QChart>
32 #include <QtCharts/QValueAxis>
34 QT_CHARTS_USE_NAMESPACE
36 using namespace QtCharts;
50 explicit SortEdit(QWidget* parent =
nullptr) : QLineEdit(parent){}
53 Q_EMIT Mouse_Pressed();
102 void loadWalletModel()
override;
105 void run(
int type)
override;
106 void onError(QString
error,
int type)
override;
109 void walletSynced(
bool isSync);
114 void processNewTransaction(
const QModelIndex& parent,
int start,
int );
119 void handleTransactionClicked(
const QModelIndex &index);
120 void changeTheme(
bool isLightTheme, QString &theme)
override;
121 void onSortChanged(
const QString&);
122 void onSortTypeChanged(
const QString& value);
123 void updateDisplayUnit();
125 void onTxArrived(
const QString& hash,
const bool isCoinStake,
const bool isMNReward,
const bool isCSAnyType);
128 void windowResizeEvent(QResizeEvent* event);
129 void changeChartColors();
130 void onChartYearChanged(
const QString&);
131 void onChartMonthChanged(
const QString&);
132 void onChartArrowClicked(
bool goLeft);
136 Ui::DashboardWidget *ui{
nullptr};
141 int nDisplayUnit{-1};
144 void changeSort(
int nSortIndex);
148 int64_t lastRefreshTime{0};
149 std::atomic<bool> isLoading;
153 bool isChartInitialized{
false};
154 QChartView *chartView{
nullptr};
155 QBarSeries *series{
nullptr};
156 QBarSet *set0{
nullptr};
157 QBarSet *set1{
nullptr};
159 QBarCategoryAxis *axisX{
nullptr};
160 QValueAxis *axisY{
nullptr};
162 QChart *chart{
nullptr};
163 bool isChartMin{
false};
168 bool hasMNRewards{
false};
171 bool hasStakes{
false};
172 bool fShowCharts{
true};
173 std::atomic<bool> filterUpdateNeeded{
false};
176 void showHideEmptyChart(
bool show,
bool loading,
bool forceView =
false);
178 void tryChartRefresh();
179 void updateStakeFilter();
180 QMap<int, std::pair<qint64, qint64>> getAmountBy();
181 bool loadChartData(
bool withMonthNames);
182 void updateAxisX(
const QStringList *arg =
nullptr);
184 std::pair<int, int> getChartRange(
const QMap<
int, std::pair<qint64, qint64>>& amountsBy);
187 void onChartRefreshed();
188 void onHideChartsChanged(
bool fHide);
int64_t CAmount
Amount in PIV (Can be negative)
QMap< int, std::pair< qint64, qint64 > > amountsByCache
void mousePressEvent(QMouseEvent *) override
SortEdit(QWidget *parent=nullptr)
Filter the transaction list according to pre-specified rules.
UI model for the transaction table of a wallet.
Interface to PIVX wallet from Qt view code.
bool error(const char *fmt, const Args &... args)