From 6c3b691ae9071fe50a2568ab23e1838b785568ab Mon Sep 17 00:00:00 2001 From: tobtoht Date: Sun, 27 Jun 2021 17:00:09 +0200 Subject: [PATCH] Widgets: cleanup --- src/mainwindow.h | 7 +++--- src/sendwidget.h | 3 ++- src/settings.h | 4 +-- src/settings.ui | 2 +- ...ssdelegate.cpp => CCSProgressDelegate.cpp} | 6 ++--- ...ogressdelegate.h => CCSProgressDelegate.h} | 1 + src/widgets/{ccswidget.cpp => CCSWidget.cpp} | 19 +++++++------- src/widgets/{ccswidget.h => CCSWidget.h} | 8 +++--- src/widgets/{ccswidget.ui => CCSWidget.ui} | 0 src/widgets/LocalMoneroWidget.cpp | 17 +++++++------ src/widgets/LocalMoneroWidget.h | 2 +- .../{nodewidget.cpp => NodeWidget.cpp} | 14 ++++++----- src/widgets/{nodewidget.h => NodeWidget.h} | 15 +++++------ src/widgets/{nodewidget.ui => NodeWidget.ui} | 0 src/widgets/PayToEdit.cpp | 4 +-- .../{redditwidget.cpp => RedditWidget.cpp} | 17 +++++++------ .../{redditwidget.h => RedditWidget.h} | 2 +- .../{redditwidget.ui => RedditWidget.ui} | 0 src/widgets/RestoreHeightWidget.cpp | 4 +-- src/widgets/TickerWidget.cpp | 14 +++++------ .../{xmrigwidget.cpp => XMRigWidget.cpp} | 25 ++++++++++--------- src/widgets/{xmrigwidget.h => XMRigWidget.h} | 2 +- .../{xmrigwidget.ui => XMRigWidget.ui} | 0 23 files changed, 86 insertions(+), 80 deletions(-) rename src/widgets/{ccsprogressdelegate.cpp => CCSProgressDelegate.cpp} (93%) rename src/widgets/{ccsprogressdelegate.h => CCSProgressDelegate.h} (99%) rename src/widgets/{ccswidget.cpp => CCSWidget.cpp} (87%) rename src/widgets/{ccswidget.h => CCSWidget.h} (100%) rename src/widgets/{ccswidget.ui => CCSWidget.ui} (100%) rename src/widgets/{nodewidget.cpp => NodeWidget.cpp} (98%) rename src/widgets/{nodewidget.h => NodeWidget.h} (96%) rename src/widgets/{nodewidget.ui => NodeWidget.ui} (100%) rename src/widgets/{redditwidget.cpp => RedditWidget.cpp} (90%) rename src/widgets/{redditwidget.h => RedditWidget.h} (100%) rename src/widgets/{redditwidget.ui => RedditWidget.ui} (100%) rename src/widgets/{xmrigwidget.cpp => XMRigWidget.cpp} (97%) rename src/widgets/{xmrigwidget.h => XMRigWidget.h} (100%) rename src/widgets/{xmrigwidget.ui => XMRigWidget.ui} (100%) diff --git a/src/mainwindow.h b/src/mainwindow.h index f7a441f..efbf13a 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -7,7 +7,6 @@ #include #include #include -#include #include "appcontext.h" #include "components.h" @@ -31,8 +30,8 @@ #include "model/CoinsProxyModel.h" #include "utils/networking.h" #include "utils/config.h" -#include "widgets/ccswidget.h" -#include "widgets/redditwidget.h" +#include "widgets/CCSWidget.h" +#include "widgets/RedditWidget.h" #include "widgets/TickerWidget.h" #include "wizard/WalletWizard.h" @@ -49,7 +48,7 @@ #endif #ifdef HAS_XMRIG -#include "widgets/xmrigwidget.h" +#include "widgets/XMRigWidget.h" #endif namespace Ui { diff --git a/src/sendwidget.h b/src/sendwidget.h index 2b2f0b8..3f340fc 100644 --- a/src/sendwidget.h +++ b/src/sendwidget.h @@ -5,8 +5,9 @@ #define FEATHER_SENDWIDGET_H #include + #include "appcontext.h" -#include "widgets/ccswidget.h" +#include "widgets/CCSWidget.h" namespace Ui { class SendWidget; diff --git a/src/settings.h b/src/settings.h index 8c9c48c..4cbf18c 100644 --- a/src/settings.h +++ b/src/settings.h @@ -4,12 +4,12 @@ #ifndef FEATHER_SETTINGS_H #define FEATHER_SETTINGS_H +#include #include #include -#include #include "appcontext.h" -#include "widgets/nodewidget.h" +#include "widgets/NodeWidget.h" namespace Ui { class Settings; diff --git a/src/settings.ui b/src/settings.ui index 533afdf..554d5e3 100644 --- a/src/settings.ui +++ b/src/settings.ui @@ -670,7 +670,7 @@ NodeWidget QWidget -
widgets/nodewidget.h
+
widgets/NodeWidget.h
1
diff --git a/src/widgets/ccsprogressdelegate.cpp b/src/widgets/CCSProgressDelegate.cpp similarity index 93% rename from src/widgets/ccsprogressdelegate.cpp rename to src/widgets/CCSProgressDelegate.cpp index 18c39b3..dfed0ca 100644 --- a/src/widgets/ccsprogressdelegate.cpp +++ b/src/widgets/CCSProgressDelegate.cpp @@ -1,13 +1,13 @@ // SPDX-License-Identifier: BSD-3-Clause // Copyright (c) 2020-2021, The Monero Project. -#include "ccsprogressdelegate.h" +#include "CCSProgressDelegate.h" #include CCSProgressDelegate::CCSProgressDelegate(CCSModel *model, QWidget *parent) - : QStyledItemDelegate(parent) - , m_model(model) + : QStyledItemDelegate(parent) + , m_model(model) { } diff --git a/src/widgets/ccsprogressdelegate.h b/src/widgets/CCSProgressDelegate.h similarity index 99% rename from src/widgets/ccsprogressdelegate.h rename to src/widgets/CCSProgressDelegate.h index c2fd13e..1ad23b1 100644 --- a/src/widgets/ccsprogressdelegate.h +++ b/src/widgets/CCSProgressDelegate.h @@ -5,6 +5,7 @@ #define FEATHER_CSSPROGRESSDELEGATE_H #include + #include "model/CCSModel.h" class CCSProgressDelegate : public QStyledItemDelegate diff --git a/src/widgets/ccswidget.cpp b/src/widgets/CCSWidget.cpp similarity index 87% rename from src/widgets/ccswidget.cpp rename to src/widgets/CCSWidget.cpp index 443c37d..a80571a 100644 --- a/src/widgets/ccswidget.cpp +++ b/src/widgets/CCSWidget.cpp @@ -1,19 +1,20 @@ // SPDX-License-Identifier: BSD-3-Clause // Copyright (c) 2020-2021, The Monero Project. +#include "CCSWidget.h" +#include "ui_CCSWidget.h" + +#include #include #include -#include -#include "ccswidget.h" -#include "ui_ccswidget.h" -#include "ccsprogressdelegate.h" +#include "CCSProgressDelegate.h" -CCSWidget::CCSWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::CSSWidget), - m_model(new CCSModel(this)), - m_contextMenu(new QMenu(this)) +CCSWidget::CCSWidget(QWidget *parent) + : QWidget(parent) + , ui(new Ui::CSSWidget) + , m_model(new CCSModel(this)) + , m_contextMenu(new QMenu(this)) { ui->setupUi(this); auto progressDelegate = new CCSProgressDelegate(m_model, this); diff --git a/src/widgets/ccswidget.h b/src/widgets/CCSWidget.h similarity index 100% rename from src/widgets/ccswidget.h rename to src/widgets/CCSWidget.h index 5b77d8d..21332e8 100644 --- a/src/widgets/ccswidget.h +++ b/src/widgets/CCSWidget.h @@ -4,15 +4,15 @@ #ifndef FEATHER_CSSWIDGET_H #define FEATHER_CSSWIDGET_H +#include #include #include -#include #include -#include +#include -#include "widgets/CCSEntry.h" -#include "model/CCSModel.h" #include "appcontext.h" +#include "model/CCSModel.h" +#include "widgets/CCSEntry.h" namespace Ui { class CSSWidget; diff --git a/src/widgets/ccswidget.ui b/src/widgets/CCSWidget.ui similarity index 100% rename from src/widgets/ccswidget.ui rename to src/widgets/CCSWidget.ui diff --git a/src/widgets/LocalMoneroWidget.cpp b/src/widgets/LocalMoneroWidget.cpp index ffbb615..5fb70f3 100644 --- a/src/widgets/LocalMoneroWidget.cpp +++ b/src/widgets/LocalMoneroWidget.cpp @@ -3,19 +3,20 @@ #include "LocalMoneroWidget.h" #include "ui_LocalMoneroWidget.h" -#include "utils/ColorScheme.h" -#include "utils/Icons.h" -#include "utils/NetworkManager.h" -#include "utils/WebsocketNotifier.h" -#include "dialog/LocalMoneroInfoDialog.h" #include #include +#include "dialog/LocalMoneroInfoDialog.h" +#include "utils/ColorScheme.h" +#include "utils/Icons.h" +#include "utils/NetworkManager.h" +#include "utils/WebsocketNotifier.h" + LocalMoneroWidget::LocalMoneroWidget(QWidget *parent, QSharedPointer ctx) - : QWidget(parent) - , ui(new Ui::LocalMoneroWidget) - , m_ctx(std::move(ctx)) + : QWidget(parent) + , ui(new Ui::LocalMoneroWidget) + , m_ctx(std::move(ctx)) { ui->setupUi(this); diff --git a/src/widgets/LocalMoneroWidget.h b/src/widgets/LocalMoneroWidget.h index baa0d7a..d5d6acc 100644 --- a/src/widgets/LocalMoneroWidget.h +++ b/src/widgets/LocalMoneroWidget.h @@ -6,8 +6,8 @@ #include -#include "appcontext.h" #include "api/LocalMoneroApi.h" +#include "appcontext.h" #include "model/LocalMoneroModel.h" namespace Ui { diff --git a/src/widgets/nodewidget.cpp b/src/widgets/NodeWidget.cpp similarity index 98% rename from src/widgets/nodewidget.cpp rename to src/widgets/NodeWidget.cpp index af63095..23d6afa 100644 --- a/src/widgets/nodewidget.cpp +++ b/src/widgets/NodeWidget.cpp @@ -1,15 +1,17 @@ // SPDX-License-Identifier: BSD-3-Clause // Copyright (c) 2020-2021, The Monero Project. -#include -#include -#include +#include "NodeWidget.h" +#include "ui_NodeWidget.h" + +#include #include +#include +#include +#include +#include #include "model/NodeModel.h" -#include "nodewidget.h" -#include "ui_nodewidget.h" -#include "mainwindow.h" #include "utils/Icons.h" NodeWidget::NodeWidget(QWidget *parent) diff --git a/src/widgets/nodewidget.h b/src/widgets/NodeWidget.h similarity index 96% rename from src/widgets/nodewidget.h rename to src/widgets/NodeWidget.h index 348bac4..0d3a781 100644 --- a/src/widgets/nodewidget.h +++ b/src/widgets/NodeWidget.h @@ -4,9 +4,10 @@ #ifndef FEATHER_NODEWIDGET_H #define FEATHER_NODEWIDGET_H -#include -#include #include +#include +#include + #include "appcontext.h" #include "model/NodeModel.h" #include "utils/nodes.h" @@ -44,10 +45,13 @@ signals: void nodeSourceChanged(NodeSource nodeSource); private: + void showContextMenu(const QPoint &pos, const FeatherNode &node); + FeatherNode selectedNode(); + QScopedPointer ui; QSharedPointer m_ctx; - NodeModel* m_customModel; - NodeModel* m_wsModel; + NodeModel *m_customModel; + NodeModel *m_wsModel; QTreeView *m_activeView; @@ -55,9 +59,6 @@ private: QAction *m_contextActionRemove; QAction *m_contextActionOpenStatusURL; QAction *m_contextActionCopy; - - void showContextMenu(const QPoint &pos, const FeatherNode &node); - FeatherNode selectedNode(); }; #endif // FEATHER_NODEWIDGET_H diff --git a/src/widgets/nodewidget.ui b/src/widgets/NodeWidget.ui similarity index 100% rename from src/widgets/nodewidget.ui rename to src/widgets/NodeWidget.ui diff --git a/src/widgets/PayToEdit.cpp b/src/widgets/PayToEdit.cpp index f19a6e3..a63f41d 100644 --- a/src/widgets/PayToEdit.cpp +++ b/src/widgets/PayToEdit.cpp @@ -7,10 +7,8 @@ #include #include -#include "utils/utils.h" -#include "model/ModelUtils.h" - #include "libwalletqt/WalletManager.h" +#include "model/ModelUtils.h" PayToEdit::PayToEdit(QWidget *parent) : QPlainTextEdit(parent) { diff --git a/src/widgets/redditwidget.cpp b/src/widgets/RedditWidget.cpp similarity index 90% rename from src/widgets/redditwidget.cpp rename to src/widgets/RedditWidget.cpp index c0e1411..cbdcc3d 100644 --- a/src/widgets/redditwidget.cpp +++ b/src/widgets/RedditWidget.cpp @@ -1,21 +1,22 @@ // SPDX-License-Identifier: BSD-3-Clause // Copyright (c) 2020-2021, The Monero Project. +#include "RedditWidget.h" +#include "ui_RedditWidget.h" + +#include #include #include -#include #include "model/RedditModel.h" -#include "redditwidget.h" -#include "ui_redditwidget.h" #include "utils/utils.h" #include "utils/config.h" -RedditWidget::RedditWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::RedditWidget), - m_model(new RedditModel(this)), - m_contextMenu(new QMenu(this)) +RedditWidget::RedditWidget(QWidget *parent) + : QWidget(parent) + , ui(new Ui::RedditWidget) + , m_model(new RedditModel(this)) + , m_contextMenu(new QMenu(this)) { ui->setupUi(this); ui->tableView->setModel(m_model); diff --git a/src/widgets/redditwidget.h b/src/widgets/RedditWidget.h similarity index 100% rename from src/widgets/redditwidget.h rename to src/widgets/RedditWidget.h index 3860355..0fdfdf9 100644 --- a/src/widgets/redditwidget.h +++ b/src/widgets/RedditWidget.h @@ -4,9 +4,9 @@ #ifndef FEATHER_REDDITWIDGET_H #define FEATHER_REDDITWIDGET_H +#include #include #include -#include #include "model/RedditModel.h" diff --git a/src/widgets/redditwidget.ui b/src/widgets/RedditWidget.ui similarity index 100% rename from src/widgets/redditwidget.ui rename to src/widgets/RedditWidget.ui diff --git a/src/widgets/RestoreHeightWidget.cpp b/src/widgets/RestoreHeightWidget.cpp index eb70052..0edb09e 100644 --- a/src/widgets/RestoreHeightWidget.cpp +++ b/src/widgets/RestoreHeightWidget.cpp @@ -10,8 +10,8 @@ #include "constants.h" RestoreHeightWidget::RestoreHeightWidget(QWidget *parent) - : QWidget(parent) - , ui(new Ui::RestoreHeightWidget) + : QWidget(parent) + , ui(new Ui::RestoreHeightWidget) { ui->setupUi(this); diff --git a/src/widgets/TickerWidget.cpp b/src/widgets/TickerWidget.cpp index a8f656c..ec99840 100644 --- a/src/widgets/TickerWidget.cpp +++ b/src/widgets/TickerWidget.cpp @@ -8,9 +8,9 @@ #include "utils/AppData.h" TickerWidgetBase::TickerWidgetBase(QWidget *parent, QSharedPointer ctx) - : QWidget(parent) - , ui(new Ui::TickerWidget) - , m_ctx(std::move(ctx)) + : QWidget(parent) + , ui(new Ui::TickerWidget) + , m_ctx(std::move(ctx)) { ui->setupUi(this); @@ -50,8 +50,8 @@ void TickerWidgetBase::setFiatText(double amount, const QString &fiatCurrency) { // BalanceTickerWidget BalanceTickerWidget::BalanceTickerWidget(QWidget *parent, QSharedPointer ctx, bool totalBalance) - : TickerWidgetBase(parent, std::move(ctx)) - , m_totalBalance(totalBalance) + : TickerWidgetBase(parent, std::move(ctx)) + , m_totalBalance(totalBalance) { if (totalBalance) this->setTitle("Total balance"); @@ -76,8 +76,8 @@ void BalanceTickerWidget::updateDisplay() { // PriceTickerWidget PriceTickerWidget::PriceTickerWidget(QWidget *parent, QSharedPointer ctx, QString symbol) - : TickerWidgetBase(parent, std::move(ctx)) - , m_symbol(std::move(symbol)) + : TickerWidgetBase(parent, std::move(ctx)) + , m_symbol(std::move(symbol)) { this->setTitle(m_symbol); diff --git a/src/widgets/xmrigwidget.cpp b/src/widgets/XMRigWidget.cpp similarity index 97% rename from src/widgets/xmrigwidget.cpp rename to src/widgets/XMRigWidget.cpp index c67556d..87be728 100644 --- a/src/widgets/xmrigwidget.cpp +++ b/src/widgets/XMRigWidget.cpp @@ -1,24 +1,25 @@ // SPDX-License-Identifier: BSD-3-Clause // Copyright (c) 2020-2021, The Monero Project. +#include "XMRigWidget.h" +#include "ui_XMRigWidget.h" + +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include "xmrigwidget.h" -#include "ui_xmrigwidget.h" #include "utils/Icons.h" XMRigWidget::XMRigWidget(QSharedPointer ctx, QWidget *parent) - : QWidget(parent) - , ui(new Ui::XMRigWidget) - , m_ctx(std::move(ctx)) - , m_XMRig(new XmRig(Config::defaultConfigDir().path())) - , m_model(new QStandardItemModel(this)) - , m_contextMenu(new QMenu(this)) + : QWidget(parent) + , ui(new Ui::XMRigWidget) + , m_ctx(std::move(ctx)) + , m_XMRig(new XmRig(Config::defaultConfigDir().path())) + , m_model(new QStandardItemModel(this)) + , m_contextMenu(new QMenu(this)) { ui->setupUi(this); diff --git a/src/widgets/xmrigwidget.h b/src/widgets/XMRigWidget.h similarity index 100% rename from src/widgets/xmrigwidget.h rename to src/widgets/XMRigWidget.h index 7cb3519..e91e50a 100644 --- a/src/widgets/xmrigwidget.h +++ b/src/widgets/XMRigWidget.h @@ -8,9 +8,9 @@ #include #include +#include "appcontext.h" #include "utils/xmrig.h" #include "utils/config.h" -#include "appcontext.h" namespace Ui { class XMRigWidget; diff --git a/src/widgets/xmrigwidget.ui b/src/widgets/XMRigWidget.ui similarity index 100% rename from src/widgets/xmrigwidget.ui rename to src/widgets/XMRigWidget.ui