Skip to content

Commit

Permalink
Add GUI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Liquid369 committed Mar 10, 2023
1 parent cb07e1d commit 2ffaaaf
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/qt/pivx/qtutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const QString ZAPTXES2("-zapwallettxes=2");
const QString UPGRADEWALLET("-upgradewallet");
const QString REINDEX("-reindex");
const QString RESYNC("-resync");
const QString REWIND("-rewindblockindex");

extern Qt::Modifier SHORT_KEY;

Expand Down
83 changes: 80 additions & 3 deletions src/qt/pivx/settings/forms/settingswalletrepairwidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>398</width>
<height>620</height>
<y>-57</y>
<width>383</width>
<height>677</height>
</rect>
</property>
<property name="autoFillBackground">
Expand Down Expand Up @@ -584,11 +584,88 @@
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_8">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalRewind" stretch="1,1">
<property name="spacing">
<number>20</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalRewind" stretch="0">
<property name="spacing">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="pushButtonRewind">
<property name="minimumSize">
<size>
<width>0</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Rewind blockchain</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="labelMessageRewind">
<property name="text">
<string>Rewind blockchain to last checkpoint</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
Expand Down
24 changes: 22 additions & 2 deletions src/qt/pivx/settings/settingswalletrepairwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ SettingsWalletRepairWidget::SettingsWalletRepairWidget(PIVXGUI* _window, QWidget
// Labels
setCssProperty({ui->labelMessageSalvage, ui->labelMessageRescan, ui->labelMessageRecover1,
ui->labelMessageRecover2, ui->labelMessageUpgrade, ui->labelMessageRebuild,
ui->labelMessageDelete}, "text-main-settings");
ui->labelMessageDelete, ui->labelMessageRewind}, "text-main-settings");

// Buttons
setCssProperty({ui->pushButtonSalvage, ui->pushButtonRescan, ui->pushButtonRecover1,
ui->pushButtonRecover2, ui->pushButtonUpgrade, ui->pushButtonRebuild,
ui->pushButtonDelete}, "btn-primary");
ui->pushButtonDelete, ui->pushButtonRewind}, "btn-primary");

// Wallet Repair Buttons
connect(ui->pushButtonSalvage, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletSalvage);
Expand All @@ -41,6 +41,7 @@ SettingsWalletRepairWidget::SettingsWalletRepairWidget(PIVXGUI* _window, QWidget
connect(ui->pushButtonUpgrade, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletUpgrade);
connect(ui->pushButtonRebuild, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletReindex);
connect(ui->pushButtonDelete, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletResync);
connect(ui->pushButtonRewind, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletRewind);
}

/** Restart wallet with "-salvagewallet" */
Expand Down Expand Up @@ -100,6 +101,25 @@ void SettingsWalletRepairWidget::walletResync()
buildParameterlist(RESYNC);
}

/** Restart wallet with "-rewindblockindex" */
void SettingsWalletRepairWidget::walletRewind()
{
QString rewindWarning = tr("This will rewind your blocks to the most recent checkpoint.<br /><br />");
rewindWarning += tr("Do you want to continue?.<br />");
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm resync Blockchain"),
rewindWarning,
QMessageBox::Yes | QMessageBox::Cancel,
QMessageBox::Cancel);

if (retval != QMessageBox::Yes) {
// Rewind canceled
return;
}

// Restart and rewind
buildParameterlist(REWIND);
}

/** Build command-line parameter list for restart */
void SettingsWalletRepairWidget::buildParameterlist(QString arg)
{
Expand Down
1 change: 1 addition & 0 deletions src/qt/pivx/settings/settingswalletrepairwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public Q_SLOTS:
void walletUpgrade();
void walletReindex();
void walletResync();
void walletRewind();

private:
Ui::SettingsWalletRepairWidget *ui;
Expand Down

0 comments on commit 2ffaaaf

Please sign in to comment.