Skip to content

Commit d56a8f8

Browse files
committed
[Trivial] Styling: spaces and brackets
1 parent 5a600ba commit d56a8f8

File tree

5 files changed

+118
-78
lines changed

5 files changed

+118
-78
lines changed

src/qt/pivx/masternodeswidget.cpp

Lines changed: 55 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,16 @@ class MNHolder : public FurListRow<QWidget*>
3737
public:
3838
MNHolder();
3939

40-
explicit MNHolder(bool _isLightTheme) : FurListRow(), isLightTheme(_isLightTheme){}
40+
explicit MNHolder(bool _isLightTheme) : FurListRow(), isLightTheme(_isLightTheme) {}
4141

42-
MNRow* createHolder(int pos) override{
43-
if(!cachedRow) cachedRow = new MNRow();
42+
MNRow* createHolder(int pos) override
43+
{
44+
if (!cachedRow) cachedRow = new MNRow();
4445
return cachedRow;
4546
}
4647

47-
void init(QWidget* holder,const QModelIndex &index, bool isHovered, bool isSelected) const override{
48+
void init(QWidget* holder,const QModelIndex &index, bool isHovered, bool isSelected) const override
49+
{
4850
MNRow* row = static_cast<MNRow*>(holder);
4951
QString label = index.data(Qt::DisplayRole).toString();
5052
QString address = index.sibling(index.row(), MNModel::ADDRESS).data(Qt::DisplayRole).toString();
@@ -53,7 +55,8 @@ class MNHolder : public FurListRow<QWidget*>
5355
row->updateView("Address: " + address, label, status, wasCollateralAccepted);
5456
}
5557

56-
QColor rectColor(bool isHovered, bool isSelected) override{
58+
QColor rectColor(bool isHovered, bool isSelected) override
59+
{
5760
return getRowColor(isLightTheme, isHovered, isSelected);
5861
}
5962

@@ -133,41 +136,46 @@ MasterNodesWidget::MasterNodesWidget(PIVXGUI *parent) :
133136
connect(ui->btnAboutController, &OptionButton::clicked, [this](){window->openFAQ(10);});
134137
}
135138

136-
void MasterNodesWidget::showEvent(QShowEvent *event){
139+
void MasterNodesWidget::showEvent(QShowEvent *event)
140+
{
137141
if (mnModel) mnModel->updateMNList();
138-
if(!timer) {
142+
if (!timer) {
139143
timer = new QTimer(this);
140144
connect(timer, &QTimer::timeout, [this]() {mnModel->updateMNList();});
141145
}
142146
timer->start(30000);
143147
}
144148

145-
void MasterNodesWidget::hideEvent(QHideEvent *event){
146-
if(timer) timer->stop();
149+
void MasterNodesWidget::hideEvent(QHideEvent *event)
150+
{
151+
if (timer) timer->stop();
147152
}
148153

149-
void MasterNodesWidget::loadWalletModel(){
150-
if(walletModel) {
154+
void MasterNodesWidget::loadWalletModel()
155+
{
156+
if (walletModel) {
151157
ui->listMn->setModel(mnModel);
152158
ui->listMn->setModelColumn(AddressTableModel::Label);
153159
updateListState();
154160
}
155161
}
156162

157-
void MasterNodesWidget::updateListState() {
163+
void MasterNodesWidget::updateListState()
164+
{
158165
bool show = mnModel->rowCount() > 0;
159166
ui->listMn->setVisible(show);
160167
ui->emptyContainer->setVisible(!show);
161168
ui->pushButtonStartAll->setVisible(show);
162169
}
163170

164-
void MasterNodesWidget::onMNClicked(const QModelIndex &index){
171+
void MasterNodesWidget::onMNClicked(const QModelIndex &index)
172+
{
165173
ui->listMn->setCurrentIndex(index);
166174
QRect rect = ui->listMn->visualRect(index);
167175
QPoint pos = rect.topRight();
168176
pos.setX(pos.x() - (DECORATION_SIZE * 2));
169177
pos.setY(pos.y() + (DECORATION_SIZE * 1.5));
170-
if(!this->menu){
178+
if (!this->menu) {
171179
this->menu = new TooltipMenu(window, this);
172180
this->menu->setEditBtnText(tr("Start"));
173181
this->menu->setDeleteBtnText(tr("Delete"));
@@ -190,14 +198,16 @@ void MasterNodesWidget::onMNClicked(const QModelIndex &index){
190198
ui->listMn->setFocus();
191199
}
192200

193-
bool MasterNodesWidget::checkMNsNetwork() {
201+
bool MasterNodesWidget::checkMNsNetwork()
202+
{
194203
bool isTierTwoSync = mnModel->isMNsNetworkSynced();
195204
if (!isTierTwoSync) inform(tr("Please wait until the node is fully synced"));
196205
return isTierTwoSync;
197206
}
198207

199-
void MasterNodesWidget::onEditMNClicked(){
200-
if(walletModel) {
208+
void MasterNodesWidget::onEditMNClicked()
209+
{
210+
if (walletModel) {
201211
if (!checkMNsNetwork()) return;
202212
if (index.sibling(index.row(), MNModel::WAS_COLLATERAL_ACCEPTED).data(Qt::DisplayRole).toBool()) {
203213
// Start MN
@@ -212,7 +222,8 @@ void MasterNodesWidget::onEditMNClicked(){
212222
}
213223
}
214224

215-
void MasterNodesWidget::startAlias(QString strAlias) {
225+
void MasterNodesWidget::startAlias(QString strAlias)
226+
{
216227
QString strStatusHtml;
217228
strStatusHtml += "Alias: " + strAlias + " ";
218229

@@ -227,12 +238,14 @@ void MasterNodesWidget::startAlias(QString strAlias) {
227238
updateModelAndInform(strStatusHtml);
228239
}
229240

230-
void MasterNodesWidget::updateModelAndInform(QString informText) {
241+
void MasterNodesWidget::updateModelAndInform(QString informText)
242+
{
231243
mnModel->updateMNList();
232244
inform(informText);
233245
}
234246

235-
bool MasterNodesWidget::startMN(CMasternodeConfig::CMasternodeEntry mne, std::string& strError) {
247+
bool MasterNodesWidget::startMN(CMasternodeConfig::CMasternodeEntry mne, std::string& strError)
248+
{
236249
CMasternodeBroadcast mnb;
237250
if (!CMasternodeBroadcast::Create(mne.getIp(), mne.getPrivKey(), mne.getTxHash(), mne.getOutputIndex(), strError, mnb))
238251
return false;
@@ -242,7 +255,8 @@ bool MasterNodesWidget::startMN(CMasternodeConfig::CMasternodeEntry mne, std::st
242255
return true;
243256
}
244257

245-
void MasterNodesWidget::onStartAllClicked(int type) {
258+
void MasterNodesWidget::onStartAllClicked(int type)
259+
{
246260
if (!verifyWalletUnlocked()) return;
247261
if (!checkMNsNetwork()) return;
248262
if (isLoading) {
@@ -256,7 +270,8 @@ void MasterNodesWidget::onStartAllClicked(int type) {
256270
}
257271
}
258272

259-
bool MasterNodesWidget::startAll(QString& failText, bool onlyMissing) {
273+
bool MasterNodesWidget::startAll(QString& failText, bool onlyMissing)
274+
{
260275
int amountOfMnFailed = 0;
261276
int amountOfMnStarted = 0;
262277
for (CMasternodeConfig::CMasternodeEntry mne : masternodeConfig.getEntries()) {
@@ -282,7 +297,8 @@ bool MasterNodesWidget::startAll(QString& failText, bool onlyMissing) {
282297
return true;
283298
}
284299

285-
void MasterNodesWidget::run(int type) {
300+
void MasterNodesWidget::run(int type)
301+
{
286302
bool isStartMissing = type == REQUEST_START_MISSING;
287303
if (type == REQUEST_START_ALL || isStartMissing) {
288304
QString failText;
@@ -294,15 +310,17 @@ void MasterNodesWidget::run(int type) {
294310
isLoading = false;
295311
}
296312

297-
void MasterNodesWidget::onError(QString error, int type) {
313+
void MasterNodesWidget::onError(QString error, int type)
314+
{
298315
if (type == REQUEST_START_ALL) {
299316
QMetaObject::invokeMethod(this, "inform", Qt::QueuedConnection,
300317
Q_ARG(QString, "Error starting all Masternodes"));
301318
}
302319
}
303320

304-
void MasterNodesWidget::onInfoMNClicked() {
305-
if(!verifyWalletUnlocked()) return;
321+
void MasterNodesWidget::onInfoMNClicked()
322+
{
323+
if (!verifyWalletUnlocked()) return;
306324
showHideOp(true);
307325
MnInfoDialog* dialog = new MnInfoDialog(window);
308326
QString label = index.data(Qt::DisplayRole).toString();
@@ -314,7 +332,7 @@ void MasterNodesWidget::onInfoMNClicked() {
314332
dialog->setData(pubKey, label, address, txId, outIndex, status);
315333
dialog->adjustSize();
316334
showDialog(dialog, 3, 17);
317-
if (dialog->exportMN){
335+
if (dialog->exportMN) {
318336
if (ask(tr("Remote Masternode Data"),
319337
tr("You are just about to export the required data to run a Masternode\non a remote server to your clipboard.\n\n\n"
320338
"You will only have to paste the data in the pivx.conf file\nof your remote server and start it, "
@@ -333,7 +351,8 @@ void MasterNodesWidget::onInfoMNClicked() {
333351
dialog->deleteLater();
334352
}
335353

336-
void MasterNodesWidget::onDeleteMNClicked(){
354+
void MasterNodesWidget::onDeleteMNClicked()
355+
{
337356
QString qAliasString = index.data(Qt::DisplayRole).toString();
338357
std::string aliasToRemove = qAliasString.toStdString();
339358

@@ -342,7 +361,7 @@ void MasterNodesWidget::onDeleteMNClicked(){
342361

343362
std::string strConfFile = "masternode.conf";
344363
std::string strDataDir = GetDataDir().string();
345-
if (strConfFile != boost::filesystem::basename(strConfFile) + boost::filesystem::extension(strConfFile)){
364+
if (strConfFile != boost::filesystem::basename(strConfFile) + boost::filesystem::extension(strConfFile)) {
346365
throw std::runtime_error(strprintf(_("masternode.conf %s resides outside data directory %s"), strConfFile, strDataDir));
347366
}
348367

@@ -425,15 +444,16 @@ void MasterNodesWidget::onDeleteMNClicked(){
425444
}
426445
}
427446

428-
void MasterNodesWidget::onCreateMNClicked(){
429-
if(verifyWalletUnlocked()) {
430-
if(walletModel->getBalance() <= (COIN * 10000)){
447+
void MasterNodesWidget::onCreateMNClicked()
448+
{
449+
if (verifyWalletUnlocked()) {
450+
if (walletModel->getBalance() <= (COIN * 10000)) {
431451
inform(tr("Not enough balance to create a masternode, 10,000 PIV required."));
432452
return;
433453
}
434454
showHideOp(true);
435455
MasterNodeWizardDialog *dialog = new MasterNodeWizardDialog(walletModel, window);
436-
if(openDialogWithOpaqueBackgroundY(dialog, window, 5, 7)) {
456+
if (openDialogWithOpaqueBackgroundY(dialog, window, 5, 7)) {
437457
if (dialog->isOk) {
438458
// Update list
439459
mnModel->addMn(dialog->mnEntry);
@@ -448,7 +468,8 @@ void MasterNodesWidget::onCreateMNClicked(){
448468
}
449469
}
450470

451-
void MasterNodesWidget::changeTheme(bool isLightTheme, QString& theme){
471+
void MasterNodesWidget::changeTheme(bool isLightTheme, QString& theme)
472+
{
452473
static_cast<MNHolder*>(this->delegate->getRowFactory())->isLightTheme = isLightTheme;
453474
}
454475

src/qt/pivx/masternodewizarddialog.cpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <QFile>
1313
#include <QIntValidator>
1414
#include <QHostAddress>
15-
#include <QRegExpValidator>
1615

1716
MasterNodeWizardDialog::MasterNodeWizardDialog(WalletModel *model, QWidget *parent) :
1817
QDialog(parent),
@@ -64,7 +63,7 @@ MasterNodeWizardDialog::MasterNodeWizardDialog(WalletModel *model, QWidget *pare
6463
initCssEditLine(ui->lineEditPort);
6564
ui->stackedWidget->setCurrentIndex(pos);
6665
ui->lineEditPort->setValidator(new QIntValidator(0, 9999999, ui->lineEditPort));
67-
if(walletModel->isTestNetwork()){
66+
if (walletModel->isTestNetwork()) {
6867
ui->lineEditPort->setEnabled(false);
6968
ui->lineEditPort->setText("51474");
7069
} else {
@@ -96,8 +95,9 @@ void MasterNodeWizardDialog::showEvent(QShowEvent *event)
9695
if (ui->btnNext) ui->btnNext->setFocus();
9796
}
9897

99-
void MasterNodeWizardDialog::onNextClicked(){
100-
switch(pos){
98+
void MasterNodeWizardDialog::onNextClicked()
99+
{
100+
switch(pos) {
101101
case 0:{
102102
ui->stackedWidget->setCurrentIndex(1);
103103
ui->pushName4->setChecked(false);
@@ -145,7 +145,8 @@ void MasterNodeWizardDialog::onNextClicked(){
145145
pos++;
146146
}
147147

148-
bool MasterNodeWizardDialog::createMN(){
148+
bool MasterNodeWizardDialog::createMN()
149+
{
149150
if (walletModel) {
150151
/**
151152
*
@@ -178,7 +179,7 @@ bool MasterNodeWizardDialog::createMN(){
178179
}
179180
// TODO: Validate IP address..
180181
int portInt = portStr.toInt();
181-
if (portInt <= 0 && portInt > 999999){
182+
if (portInt <= 0 && portInt > 999999) {
182183
returnStr = tr("Invalid port number");
183184
return false;
184185
}
@@ -238,7 +239,7 @@ bool MasterNodeWizardDialog::createMN(){
238239
// now change the conf
239240
std::string strConfFile = "masternode.conf";
240241
std::string strDataDir = GetDataDir().string();
241-
if (strConfFile != boost::filesystem::basename(strConfFile) + boost::filesystem::extension(strConfFile)){
242+
if (strConfFile != boost::filesystem::basename(strConfFile) + boost::filesystem::extension(strConfFile)) {
242243
throw std::runtime_error(strprintf(_("masternode.conf %s resides outside data directory %s"), strConfFile, strDataDir));
243244
}
244245

@@ -291,9 +292,9 @@ bool MasterNodeWizardDialog::createMN(){
291292
CWalletTx* walletTx = currentTransaction.getTransaction();
292293
std::string txID = walletTx->GetHash().GetHex();
293294
int indexOut = -1;
294-
for (int i=0; i < (int)walletTx->vout.size(); i++){
295+
for (int i=0; i < (int)walletTx->vout.size(); i++) {
295296
CTxOut& out = walletTx->vout[i];
296-
if (out.nValue == 10000 * COIN){
297+
if (out.nValue == 10000 * COIN) {
297298
indexOut = i;
298299
}
299300
}
@@ -342,10 +343,11 @@ bool MasterNodeWizardDialog::createMN(){
342343
return false;
343344
}
344345

345-
void MasterNodeWizardDialog::onBackClicked(){
346+
void MasterNodeWizardDialog::onBackClicked()
347+
{
346348
if (pos == 0) return;
347349
pos--;
348-
switch(pos){
350+
switch(pos) {
349351
case 0:{
350352
ui->stackedWidget->setCurrentIndex(0);
351353
ui->btnNext->setFocus();
@@ -373,7 +375,8 @@ void MasterNodeWizardDialog::onBackClicked(){
373375
}
374376
}
375377

376-
void MasterNodeWizardDialog::inform(QString text){
378+
void MasterNodeWizardDialog::inform(QString text)
379+
{
377380
if (!snackBar)
378381
snackBar = new SnackBar(nullptr, this);
379382
snackBar->setText(text);
@@ -382,7 +385,8 @@ void MasterNodeWizardDialog::inform(QString text){
382385
}
383386

384387
QSize BUTTON_SIZE = QSize(22, 22);
385-
void MasterNodeWizardDialog::initBtn(std::initializer_list<QPushButton*> args){
388+
void MasterNodeWizardDialog::initBtn(std::initializer_list<QPushButton*> args)
389+
{
386390
for (QPushButton* btn : args) {
387391
btn->setMinimumSize(BUTTON_SIZE);
388392
btn->setMaximumSize(BUTTON_SIZE);
@@ -393,7 +397,8 @@ void MasterNodeWizardDialog::initBtn(std::initializer_list<QPushButton*> args){
393397
}
394398
}
395399

396-
MasterNodeWizardDialog::~MasterNodeWizardDialog(){
397-
if(snackBar) delete snackBar;
400+
MasterNodeWizardDialog::~MasterNodeWizardDialog()
401+
{
402+
if (snackBar) delete snackBar;
398403
delete ui;
399404
}

0 commit comments

Comments
 (0)