Skip to content

Commit

Permalink
Addressed coderabbitai comments on 'My Own Spats GUI' changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gevorgvoskanyan committed Dec 10, 2024
1 parent ca2610c commit 8a4795f
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ 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 \
Expand Down
33 changes: 23 additions & 10 deletions src/qt/myownspats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,39 @@

MyOwnSpats::MyOwnSpats(const PlatformStyle* platformStyle, QWidget* parent) :
QWidget(parent),
ui(std::make_unique<Ui::MyOwnSpats>())
ui_(std::make_unique<Ui::MyOwnSpats>())
{
ui->setupUi(this);
ui_->setupUi(this);
}

MyOwnSpats::~MyOwnSpats() {}

void MyOwnSpats::setClientModel(ClientModel* model)
{
this->clientModel = model;
if (client_model_) {
// Disconnect signals from old model, if any
}
client_model_ = model;
if (model) {
// Connect necessary signals for UI updates, if any
}
}

void MyOwnSpats::setWalletModel(WalletModel* model)
{
this->walletModel = model;
if (wallet_model_) {
// Disconnect signals from old model, if any
}
wallet_model_ = model;
if (model) {
// Connect necessary signals for UI updates, if any
}
}

void MyOwnSpats::resizeEvent(QResizeEvent* event)
{
QWidget::resizeEvent(event);
adjustTextSize(width(), height());
}

void MyOwnSpats::adjustTextSize(int width,int height){
Expand All @@ -34,10 +47,10 @@ void MyOwnSpats::adjustTextSize(int width,int height){
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);
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);
}
17 changes: 11 additions & 6 deletions src/qt/myownspats.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,23 @@ class MyOwnSpats : public QWidget

public:
explicit MyOwnSpats(const PlatformStyle* platformStyle, QWidget* parent = 0);
~MyOwnSpats();
~MyOwnSpats() override;

// Set the client model for this page
void setClientModel(ClientModel* clientModel);

// Set the wallet model for this page
void setWalletModel(WalletModel* walletModel);
void resizeEvent(QResizeEvent*) override;
void adjustTextSize(int width, int height);

protected:
void resizeEvent(QResizeEvent*) override;

private:
QTimer* timer;
const std::unique_ptr< Ui::MyOwnSpats > ui;
ClientModel* clientModel;
WalletModel* walletModel;
QTimer* timer_;
const std::unique_ptr< Ui::MyOwnSpats > ui_;
ClientModel* client_model_{};
WalletModel* wallet_model_{};
};

#endif // MYOWNSPATS_H_INCLUDED

0 comments on commit 8a4795f

Please sign in to comment.