Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/decenomy/DSW into tKYAN-…
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
pedro-at-decenomy committed Nov 4, 2024
2 parents f152668 + 9469fba commit a337751
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 3 deletions.
25 changes: 25 additions & 0 deletions src/masternodeconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,28 @@ bool CMasternodeConfig::CMasternodeEntry::castOutputIndex(int &n) const

return true;
}

bool CMasternodeConfig::exportActiveMasternodes(std::string filename)
{
try {
std::ofstream file(filename);

if (!file.is_open()) {
return false;
}

// Iterate through entries and write to the file
for (const auto& mne : entries) {
std::string line = mne.getAlias() + " " + mne.getPrivKey() + "\n";
file << line;

if (file.fail()) {
return false;
}
}
} catch (const std::exception& e) {
return false;
}

return true;
}
2 changes: 2 additions & 0 deletions src/masternodeconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ class CMasternodeConfig
return false;
}

bool exportActiveMasternodes(std::string filename);

private:
std::vector<CMasternodeEntry> entries;
};
Expand Down
20 changes: 20 additions & 0 deletions src/qt/pivx/forms/masternodeswidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,26 @@ and vote on the treasury system receiving a periodic reward.</string>
</property>
</widget>
</item>
<item>
<widget class="OptionButton" name="btnMasternodeConf" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="OptionButton" name="btnExportActivemasternodeConf" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
Expand Down
16 changes: 16 additions & 0 deletions src/qt/pivx/forms/topbar.ui
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,22 @@
</property>
</widget>
</item>
<item>
<widget class="ExpandableButton" name="pushButtonFAQ" native="true">
<property name="minimumSize">
<size>
<width>36</width>
<height>36</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>36</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="ExpandableButton" name="pushButtonPrivacy" native="true">
<property name="minimumSize">
Expand Down
27 changes: 27 additions & 0 deletions src/qt/pivx/masternodeswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ MasterNodesWidget::MasterNodesWidget(PIVXGUI *parent) :
ui->btnAbout->setSubTitleClassAndText("text-subtitle", tr("FAQ explaining what Masternodes are"));
ui->btnAboutController->setTitleClassAndText("btn-title-grey", tr("What is a Controller?"));
ui->btnAboutController->setSubTitleClassAndText("text-subtitle", tr("FAQ explaining what is a Masternode Controller"));
ui->btnMasternodeConf->setTitleClassAndText("btn-title-grey", tr("masternode.conf"));
ui->btnMasternodeConf->setSubTitleClassAndText("text-subtitle", tr("Opens the masternode configuration file for editing"));
ui->btnExportActivemasternodeConf->setTitleClassAndText("btn-title-grey", tr("Export activemasternode.conf"));
ui->btnExportActivemasternodeConf->setSubTitleClassAndText("text-subtitle", tr("Exports the masternode list as a activemasternode.conf file"));

setCssProperty(ui->listMn, "container");
ui->listMn->setItemDelegate(delegate);
Expand All @@ -131,6 +135,29 @@ MasterNodesWidget::MasterNodesWidget(PIVXGUI *parent) :
connect(ui->listMn, &QListView::clicked, this, &MasterNodesWidget::onMNClicked);
connect(ui->btnAbout, &OptionButton::clicked, [this](){window->openFAQ(5);});
connect(ui->btnAboutController, &OptionButton::clicked, [this](){window->openFAQ(6);});
connect(ui->btnMasternodeConf, &OptionButton::clicked, [this](){
if(!GUIUtil::openMNConfigfile()) {
inform(tr("Unable to open masternode.conf with default application"));
}
});
connect(ui->btnExportActivemasternodeConf, &OptionButton::clicked, [this](){
QString filename =
GUIUtil::getSaveFileName(
this,
tr("Export activemasternode.conf"),
tr("activemasternode.conf"),
tr("activemasternode.conf (*.conf)"),
NULL
);

if (!filename.isEmpty()) {
if(masternodeConfig.exportActiveMasternodes(filename.toStdString())) {
inform(tr("activemasternode.conf file exported to file: ") + filename);
} else {
inform(tr("Error exporting activemasternode.conf file"));
}
}
});
}

void MasterNodesWidget::showEvent(QShowEvent *event)
Expand Down
9 changes: 6 additions & 3 deletions src/qt/pivx/topbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ TopBar::TopBar(PIVXGUI* _mainWindow, QWidget* parent) : PWidget(_mainWindow, par
progressBar->raise();
progressBar->move(0, 34);

// ui->pushButtonFAQ->setButtonClassStyle("cssClass", "btn-check-faq");
// ui->pushButtonFAQ->setButtonText(tr("FAQ"));
ui->pushButtonFAQ->setButtonClassStyle("cssClass", "btn-check-faq");
ui->pushButtonFAQ->setButtonText(tr("FAQ"));
ui->pushButtonFAQ->setVisible(false);

ui->pushButtonHDUpgrade->setButtonClassStyle("cssClass", "btn-check-hd-upgrade");
ui->pushButtonHDUpgrade->setButtonText(tr("Upgrade to HD Wallet"));
Expand All @@ -99,10 +100,12 @@ TopBar::TopBar(PIVXGUI* _mainWindow, QWidget* parent) : PWidget(_mainWindow, par
ui->pushButtonConf->setButtonClassStyle("cssClass", "btn-check-conf");
ui->pushButtonConf->setButtonText("kyanite.conf");
ui->pushButtonConf->setChecked(false);
ui->pushButtonConf->setVisible(false);

ui->pushButtonMasternodes->setButtonClassStyle("cssClass", "btn-check-masternodes");
ui->pushButtonMasternodes->setButtonText("masternode.conf");
ui->pushButtonMasternodes->setChecked(false);
ui->pushButtonMasternodes->setVisible(false);

ui->pushButtonConsole->setButtonClassStyle("cssClass", "btn-check-console");
ui->pushButtonConsole->setButtonText("Debug Console");
Expand Down Expand Up @@ -140,7 +143,7 @@ TopBar::TopBar(PIVXGUI* _mainWindow, QWidget* parent) : PWidget(_mainWindow, par
connect(ui->btnQr, &QPushButton::clicked, this, &TopBar::onBtnReceiveClicked);
connect(ui->pushButtonLock, &ExpandableButton::Mouse_Pressed, this, &TopBar::onBtnLockClicked);
connect(ui->pushButtonTheme, &ExpandableButton::Mouse_Pressed, this, &TopBar::onThemeClicked);
// connect(ui->pushButtonFAQ, &ExpandableButton::Mouse_Pressed, [this]() { window->openFAQ(); });
connect(ui->pushButtonFAQ, &ExpandableButton::Mouse_Pressed, [this]() { window->openFAQ(); });
connect(ui->pushButtonConf, &ExpandableButton::Mouse_Pressed, this, &TopBar::onBtnConfClicked);
connect(ui->pushButtonMasternodes, &ExpandableButton::Mouse_Pressed, this, &TopBar::onBtnMasternodesClicked);
connect(ui->pushButtonSync, &ExpandableButton::Mouse_HoverLeave, this, &TopBar::refreshProgressBarSize);
Expand Down

0 comments on commit a337751

Please sign in to comment.