From 12a94c7fae29e2b55bd3cb17636c838624f70743 Mon Sep 17 00:00:00 2001 From: Gevorg Voskanyan Date: Wed, 13 Nov 2024 17:40:16 +0400 Subject: [PATCH 1/4] Initial mock-up of the 'My Own Spats' page on the GUI --- src/qt/bitcoingui.cpp | 27 +++++- src/qt/bitcoingui.h | 3 + src/qt/forms/myownspats.ui | 177 +++++++++++++++++++++++++++++++++++++ src/qt/myownspats.cpp | 43 +++++++++ src/qt/myownspats.h | 38 ++++++++ src/qt/walletframe.cpp | 7 ++ src/qt/walletframe.h | 2 + src/qt/walletview.cpp | 9 ++ src/qt/walletview.h | 4 + 9 files changed, 307 insertions(+), 3 deletions(-) create mode 100644 src/qt/forms/myownspats.ui create mode 100644 src/qt/myownspats.cpp create mode 100644 src/qt/myownspats.h diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 6e14a99593..2f33d04d6d 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -40,6 +40,7 @@ #include "evo/deterministicmns.h" #include "masternode-sync.h" #include "masternodelist.h" +#include "myownspats.h" #include #include @@ -122,6 +123,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle * showHelpMessageAction(0), lelantusAction(0), masternodeAction(0), + myownspatsAction(nullptr), logoAction(0), trayIcon(0), trayIconMenu(0), @@ -365,9 +367,19 @@ void BitcoinGUI::createActions() tabGroup->addAction(masternodeAction); #endif + myownspatsAction = new QAction(tr("M&y Own Spats"), this); + myownspatsAction->setStatusTip(tr("Browse My Own Spats")); + myownspatsAction->setToolTip(myownspatsAction->statusTip()); + myownspatsAction->setCheckable(true); + myownspatsAction->setShortcut(QKeySequence(Qt::ALT + key++)); + tabGroup->addAction(myownspatsAction); +#endif + #ifdef ENABLE_WALLET connect(masternodeAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); connect(masternodeAction, &QAction::triggered, this, &BitcoinGUI::gotoMasternodePage); + connect(myownspatsAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); + connect(myownspatsAction, &QAction::triggered, this, &BitcoinGUI::gotoMyOwnSpatsPage); connect(overviewAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); connect(overviewAction, &QAction::triggered, this, &BitcoinGUI::gotoOverviewPage); connect(sendCoinsAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); @@ -522,6 +534,7 @@ void BitcoinGUI::createToolBars() toolbar->addAction(historyAction); toolbar->addAction(lelantusAction); toolbar->addAction(masternodeAction); + toolbar->addAction(myownspatsAction); logoLabel = new QLabel(); logoLabel->setObjectName("lblToolbarLogo"); @@ -647,7 +660,7 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled) receiveCoinsMenuAction->setEnabled(enabled); historyAction->setEnabled(enabled); lelantusAction->setEnabled(enabled); - masternodeAction->setEnabled(enabled); + myownspatsAction->setEnabled(enabled); encryptWalletAction->setEnabled(enabled); backupWalletAction->setEnabled(enabled); changePassphraseAction->setEnabled(enabled); @@ -790,6 +803,13 @@ void BitcoinGUI::gotoMasternodePage() if (walletFrame) walletFrame->gotoMasternodePage(); } +void BitcoinGUI::gotoMyOwnSpatsPage() +{ + QSettings settings; + myownspatsAction->setChecked(true); + if (walletFrame) walletFrame->gotoMyOwnSpatsPage(); +} + void BitcoinGUI::gotoReceiveCoinsPage() { receiveCoinsAction->setChecked(true); @@ -1490,10 +1510,11 @@ void BitcoinGUI::resizeEvent(QResizeEvent* event) { QWidget* historyWidget = toolbar->widgetForAction(historyAction); QWidget* sendCoinsWidget = toolbar->widgetForAction(sendCoinsAction); QWidget* masternodeWidget = toolbar->widgetForAction(masternodeAction); + QWidget* myownspatsWidget = toolbar->widgetForAction(myownspatsAction); overviewWidget->setMinimumWidth(actionWidth); receiveWidget->setMinimumWidth(actionWidth); historyWidget->setMinimumWidth(actionWidth); sendCoinsWidget->setMinimumWidth(actionWidth); - masternodeWidget->setMinimumWidth(actionWidth); -} \ No newline at end of file + myownspatsWidget->setMinimumWidth(actionWidth); +} diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index bb2db20668..f6f6a79ef7 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -122,6 +122,7 @@ class BitcoinGUI : public QMainWindow QAction *showHelpMessageAction; QAction *lelantusAction; QAction *masternodeAction; + QAction *myownspatsAction; QAction *logoAction; QToolBar *toolbar; QLabel *logoLabel; @@ -219,6 +220,8 @@ public Q_SLOTS: void gotoBitcoinHistoryTab(); /** Switch to masternode page */ void gotoMasternodePage(); + /** Switch to myownspats page */ + void gotoMyOwnSpatsPage(); /** Switch to receive coins page */ void gotoReceiveCoinsPage(); /** Switch to send coins page */ diff --git a/src/qt/forms/myownspats.ui b/src/qt/forms/myownspats.ui new file mode 100644 index 0000000000..c776f19fae --- /dev/null +++ b/src/qt/forms/myownspats.ui @@ -0,0 +1,177 @@ + + + MyOwnSpats + + + + 0 + 0 + 762 + 457 + + + + Form + + + + 20 + + + 0 + + + 20 + + + 0 + + + + + 0 + + + + + Qt::Orientation::Horizontal + + + + 40 + 20 + + + + + + + + + + 0 + + + + + Filter List: + + + + + + + Filter assets list + + + + + + + Qt::Orientation::Horizontal + + + + 10 + 20 + + + + + + + + Asset Count: + + + + + + + 0 + + + + + + + + + QAbstractItemView::EditTrigger::NoEditTriggers + + + true + + + QAbstractItemView::SelectionMode::SingleSelection + + + QAbstractItemView::SelectionBehavior::SelectRows + + + true + + + true + + + + Asset Type + + + + + Identifier + + + + + Symbol + + + + + Name + + + + + Description + + + + + Total Supply + + + + + Fungible + + + + + Resuppliable + + + + + Precision + + + + + Metadata + + + + + + + + + + + + + diff --git a/src/qt/myownspats.cpp b/src/qt/myownspats.cpp new file mode 100644 index 0000000000..6d464e1c79 --- /dev/null +++ b/src/qt/myownspats.cpp @@ -0,0 +1,43 @@ +#include "myownspats.h" +#include "ui_masternodelist.h" + +MyOwnSpats::MyOwnSpats(const PlatformStyle* platformStyle, QWidget* parent) : + QWidget(parent), + ui(std::make_unique()), +{ + ui->setupUi(this); +} + +MyOwnSpats::~MyOwnSpats() {} + +void MyOwnSpats::setClientModel(ClientModel* model) +{ + this->clientModel = model; +} + +void MyOwnSpats::setWalletModel(WalletModel* model) +{ + this->walletModel = model; +} + +void MyOwnSpats::resizeEvent(QResizeEvent* event) +{ + QWidget::resizeEvent(event); +} + +void MyOwnSpats::adjustTextSize(int width,int height){ + + const double fontSizeScalingFactor = 70.0; + int baseFontSize = std::min(width, height) / fontSizeScalingFactor; + int fontSize = std::min(15, std::max(12, baseFontSize)); + QFont font = this->font(); + font.setPointSize(fontSize); + + // Set font size for all labels + ui->label_filter_2->setFont(font); + ui->label_count_2->setFont(font); + ui->countLabel->setFont(font); + ui->tableWidgetMyOwnSpats->setFont(font); + ui->tableWidgetMyOwnSpats->horizontalHeader()->setFont(font); + ui->tableWidgetMyOwnSpats->verticalHeader()->setFont(font); +} diff --git a/src/qt/myownspats.h b/src/qt/myownspats.h new file mode 100644 index 0000000000..c178275269 --- /dev/null +++ b/src/qt/myownspats.h @@ -0,0 +1,38 @@ +#ifndef MYOWNSPATS_H_INCLUDED +#define MYOWNSPATS_H_INCLUDED + +#include +#include + +#include "platformstyle.h" + +namespace Ui +{ +class MyOwnSpats; +} + +class ClientModel; +class WalletModel; + +/** "My Own Spats" Manager page widget */ +class MyOwnSpats : public QWidget +{ + Q_OBJECT + +public: + explicit MyOwnSpats(const PlatformStyle* platformStyle, QWidget* parent = 0); + ~MyOwnSpats(); + + void setClientModel(ClientModel* clientModel); + void setWalletModel(WalletModel* walletModel); + void resizeEvent(QResizeEvent*) override; + void adjustTextSize(int width, int height); + +private: + QTimer* timer; + const std::unique_ptr< Ui::MyOwnSpats > ui; + ClientModel* clientModel; + WalletModel* walletModel; +}; + +#endif // MYOWNSPATS_H_INCLUDED diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index 06ca9a2868..fe0338cbc1 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -139,6 +139,13 @@ void WalletFrame::gotoMasternodePage() i.value()->gotoMasternodePage(); } +void WalletFrame::gotoMyOwnSpatsPage() +{ + QMap::const_iterator i; + for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) + i.value()->gotoMyOwnSpatsPage(); +} + void WalletFrame::gotoReceiveCoinsPage() { QMap::const_iterator i; diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h index 2c99bd74bd..45bcf0b44b 100644 --- a/src/qt/walletframe.h +++ b/src/qt/walletframe.h @@ -74,6 +74,8 @@ public Q_SLOTS: void gotoBitcoinHistoryTab(); /** Switch to masternode page */ void gotoMasternodePage(); + /** Switch to myownspats page */ + void gotoMyOwnSpatsPage(); /** Switch to receive coins page */ void gotoReceiveCoinsPage(); /** Switch to send coins page */ diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index eb65f9fa6b..6bfab5b247 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -57,6 +57,7 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): sendCoinsPage = new QWidget(this); masternodeListPage = new MasternodeList(platformStyle); + myOwnSpatsPage = new MyOwnSpats(platformStyle); automintNotification = new AutomintNotification(this); automintNotification->setWindowModality(Qt::NonModal); @@ -74,6 +75,7 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): addWidget(sendCoinsPage); addWidget(lelantusPage); addWidget(masternodeListPage); + addWidget(myOwnSpatsPage); // Clicking on a transaction on the overview pre-selects the transaction on the transaction history page connect(overviewPage, &OverviewPage::transactionClicked, this, &WalletView::focusBitcoinHistoryTab); @@ -183,6 +185,7 @@ void WalletView::setClientModel(ClientModel *_clientModel) overviewPage->setClientModel(clientModel); sendFiroView->setClientModel(clientModel); masternodeListPage->setClientModel(clientModel); + myOwnSpatsPage->setClientModel(clientModel); if (pwalletMain->IsHDSeedAvailable()) { lelantusView->setClientModel(clientModel); @@ -205,6 +208,7 @@ void WalletView::setWalletModel(WalletModel *_walletModel) usedReceivingAddressesPage->setModel(_walletModel->getAddressTableModel()); usedSendingAddressesPage->setModel(_walletModel->getAddressTableModel()); masternodeListPage->setWalletModel(_walletModel); + myOwnSpatsPage->setWalletModel(_walletModel); sendFiroView->setModel(_walletModel); automintNotification->setModel(_walletModel); automintSparkNotification->setModel(_walletModel); @@ -299,6 +303,11 @@ void WalletView::gotoMasternodePage() setCurrentWidget(masternodeListPage); } +void WalletView::gotoMyOwnSpatsPage() +{ + setCurrentWidget(myOwnSpatsPage); +} + void WalletView::gotoReceiveCoinsPage() { setCurrentWidget(receiveCoinsPage); diff --git a/src/qt/walletview.h b/src/qt/walletview.h index b0203dd00c..15bb5d7922 100644 --- a/src/qt/walletview.h +++ b/src/qt/walletview.h @@ -13,6 +13,7 @@ #include "automintnotification.h" #include "amount.h" #include "masternodelist.h" +#include "myownspats.h" #include "lelantusdialog.h" #include @@ -87,6 +88,7 @@ class WalletView : public QStackedWidget TransactionView *firoTransactionList; QWidget *firoTransactionsView; MasternodeList *masternodeListPage; + MyOwnSpats *myOwnSpatsPage; QProgressDialog *progressDialog; const PlatformStyle *platformStyle; @@ -105,6 +107,8 @@ public Q_SLOTS: void focusBitcoinHistoryTab(const QModelIndex &idx); /** Switch to masternode page */ void gotoMasternodePage(); + /** Switch to myownspats page */ + void gotoMyOwnSpatsPage(); /** Switch to receive coins page */ void gotoReceiveCoinsPage(); /** Switch to send coins page */ From 0e27e9d1d24648f831c4d88b565e2fd3a6cf3332 Mon Sep 17 00:00:00 2001 From: Gevorg Voskanyan Date: Sat, 16 Nov 2024 12:54:44 +0400 Subject: [PATCH 2/4] fixed qt/myownspats build errors --- src/Makefile.qt.include | 5 +++++ src/qt/bitcoingui.cpp | 1 - src/qt/myownspats.cpp | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 613cc3178e..38fd58d6ef 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -104,6 +104,7 @@ QT_FORMS_UI = \ qt/forms/editaddressdialog.ui \ qt/forms/helpmessagedialog.ui \ qt/forms/masternodelist.ui \ + qt/forms/myownspats.ui \ qt/forms/intro.ui \ qt/forms/modaloverlay.ui \ qt/forms/recover.ui \ @@ -146,6 +147,7 @@ QT_MOC_CPP = \ qt/moc_macdockiconhandler.cpp \ qt/moc_macnotificationhandler.cpp \ qt/moc_masternodelist.cpp \ + qt/moc_myownspats.cpp \ qt/moc_modaloverlay.cpp \ qt/moc_notificator.cpp \ qt/moc_openuridialog.cpp \ @@ -225,6 +227,7 @@ BITCOIN_QT_H = \ qt/macdockiconhandler.h \ qt/macnotificationhandler.h \ qt/masternodelist.h \ + qt/myownspats.h \ qt/modaloverlay.h \ qt/networkstyle.h \ qt/notificator.h \ @@ -403,6 +406,7 @@ BITCOIN_QT_BASE_CPP = \ qt/recover.cpp \ qt/notifymnemonic.cpp \ qt/masternodelist.cpp \ + qt/myownspats.cpp \ qt/networkstyle.cpp \ qt/notificator.cpp \ qt/optionsdialog.cpp \ @@ -449,6 +453,7 @@ BITCOIN_QT_WALLET_CPP = \ qt/walletmodel.cpp \ qt/walletmodeltransaction.cpp \ qt/masternodelist.cpp \ + qt/myownspats.cpp \ qt/walletview.cpp \ qt/lelantusmodel.cpp \ qt/lelantusdialog.cpp \ diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 2f33d04d6d..89c398db0e 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -373,7 +373,6 @@ void BitcoinGUI::createActions() myownspatsAction->setCheckable(true); myownspatsAction->setShortcut(QKeySequence(Qt::ALT + key++)); tabGroup->addAction(myownspatsAction); -#endif #ifdef ENABLE_WALLET connect(masternodeAction, &QAction::triggered, [this]{ showNormalIfMinimized(); }); diff --git a/src/qt/myownspats.cpp b/src/qt/myownspats.cpp index 6d464e1c79..71b2080c28 100644 --- a/src/qt/myownspats.cpp +++ b/src/qt/myownspats.cpp @@ -1,9 +1,9 @@ #include "myownspats.h" -#include "ui_masternodelist.h" +#include "ui_myownspats.h" MyOwnSpats::MyOwnSpats(const PlatformStyle* platformStyle, QWidget* parent) : QWidget(parent), - ui(std::make_unique()), + ui(std::make_unique()) { ui->setupUi(this); } From bc06c8a6d34ecca6ba8b270238d037e34d525cc4 Mon Sep 17 00:00:00 2001 From: Gevorg Voskanyan Date: Sat, 16 Nov 2024 13:06:07 +0400 Subject: [PATCH 3/4] restored accidentally removed code --- src/qt/bitcoingui.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 89c398db0e..1bcac6153f 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -659,6 +659,7 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled) receiveCoinsMenuAction->setEnabled(enabled); historyAction->setEnabled(enabled); lelantusAction->setEnabled(enabled); + masternodeAction->setEnabled(enabled); myownspatsAction->setEnabled(enabled); encryptWalletAction->setEnabled(enabled); backupWalletAction->setEnabled(enabled); @@ -1515,5 +1516,6 @@ void BitcoinGUI::resizeEvent(QResizeEvent* event) { receiveWidget->setMinimumWidth(actionWidth); historyWidget->setMinimumWidth(actionWidth); sendCoinsWidget->setMinimumWidth(actionWidth); + masternodeWidget->setMinimumWidth(actionWidth); myownspatsWidget->setMinimumWidth(actionWidth); } From ca2610cd902d38f78cf1b5a5f25f4187dbc83788 Mon Sep 17 00:00:00 2001 From: Gevorg Voskanyan Date: Thu, 21 Nov 2024 15:48:07 +0400 Subject: [PATCH 4/4] My Own Spats GUI appearance fixes + added buttons --- src/qt/bitcoingui.cpp | 2 +- src/qt/forms/myownspats.ui | 184 ++++++++++++++++++++++++++----------- 2 files changed, 130 insertions(+), 56 deletions(-) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 1bcac6153f..36e4fe3068 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1502,7 +1502,7 @@ void BitcoinGUI::resizeEvent(QResizeEvent* event) { // Retrieve new dimensions from the resize event int newWidth = event->size().width(); int newHeight = event->size().height(); - int actionWidth = newWidth / 6; + int actionWidth = newWidth / 7; // Set widths for each action dynamically QWidget* overviewWidget = toolbar->widgetForAction(overviewAction); diff --git a/src/qt/forms/myownspats.ui b/src/qt/forms/myownspats.ui index c776f19fae..69cca5dd96 100644 --- a/src/qt/forms/myownspats.ui +++ b/src/qt/forms/myownspats.ui @@ -7,9 +7,15 @@ 0 0 762 - 457 + 535 + + + 190 + 65 + + Form @@ -33,9 +39,6 @@ - - Qt::Orientation::Horizontal - 40 @@ -46,67 +49,19 @@ - - - - 0 - - - - - Filter List: - - - - - - - Filter assets list - - - - - - - Qt::Orientation::Horizontal - - - - 10 - 20 - - - - - - - - Asset Count: - - - - - - - 0 - - - - - - QAbstractItemView::EditTrigger::NoEditTriggers + QAbstractItemView::NoEditTriggers true - QAbstractItemView::SelectionMode::SingleSelection + QAbstractItemView::NoSelection - QAbstractItemView::SelectionBehavior::SelectRows + QAbstractItemView::SelectItems true @@ -166,6 +121,125 @@ + + + + 0 + + + + + Filter List: + + + + + + + Filter assets list + + + + + + + + 10 + 20 + + + + + + + + Asset Count: + + + + + + + 0 + + + + + + + + + 20 + + + + + Create + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Mint + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Modify + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Unregister + + + + +