PIVX Core  5.6.99
P2P Digital Currency
walletrepairwidget.cpp
Go to the documentation of this file.
1 // Copyright (c) 2019-2020 The PIVX Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
6 #include "qt/settings/forms/ui_walletrepairwidget.h"
7 
8 #include "qtutils.h"
9 
11  PWidget(_window, parent),
13 {
14  ui->setupUi(this);
15  this->setStyleSheet(parent->styleSheet());
16 
17  // Containers
18  ui->left->setProperty("cssClass", "container");
19  ui->left->setContentsMargins(10,10,10,10);
20  ui->scrollStack->setProperty("cssClass", "container");
21 
22  // Title
23  ui->labelTitle->setText(tr("Wallet Repair"));
24  ui->labelTitle->setProperty("cssClass", "text-title-screen");
25  ui->labelSubtitle1->setProperty("cssClass", "text-subtitle");
26 
27  // Labels
28  setCssProperty({ui->labelMessageSalvage, ui->labelMessageRescan, ui->labelMessageRecover1,
29  ui->labelMessageRecover2, ui->labelMessageUpgrade, ui->labelMessageRebuild,
30  ui->labelMessageDelete}, "text-main-settings");
31 
32  // Buttons
33  setCssProperty({ui->pushButtonSalvage, ui->pushButtonRescan, ui->pushButtonRecover1,
34  ui->pushButtonRecover2, ui->pushButtonUpgrade, ui->pushButtonRebuild,
35  ui->pushButtonDelete}, "btn-primary");
36 
37  // Wallet Repair Buttons
38  connect(ui->pushButtonSalvage, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletSalvage);
39  connect(ui->pushButtonRescan, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletRescan);
40  connect(ui->pushButtonRecover1, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletZaptxes1);
41  connect(ui->pushButtonRecover2, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletZaptxes2);
42  connect(ui->pushButtonUpgrade, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletUpgrade);
43  connect(ui->pushButtonRebuild, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletReindex);
44  connect(ui->pushButtonDelete, &QPushButton::clicked, this, &SettingsWalletRepairWidget::walletResync);
45 }
46 
49 {
51 }
52 
55 {
57 }
58 
61 {
63 }
64 
67 {
69 }
70 
73 {
75 }
76 
79 {
81 }
82 
85 {
86  QString resyncWarning = tr("This will delete your local blockchain folders and the wallet will synchronize the complete Blockchain from scratch.<br /><br />");
87  resyncWarning += tr("This needs quite some time and downloads a lot of data.<br /><br />");
88  resyncWarning += tr("Your transactions and funds will be visible again after the download has completed.<br /><br />");
89  resyncWarning += tr("Do you want to continue?.<br />");
90  QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm resync Blockchain"),
91  resyncWarning,
92  QMessageBox::Yes | QMessageBox::Cancel,
93  QMessageBox::Cancel);
94 
95  if (retval != QMessageBox::Yes) {
96  // Resync canceled
97  return;
98  }
99 
100  // Restart and resync
102 }
103 
106 {
107  // Get command-line arguments and remove the application name
108  QStringList args = QApplication::arguments();
109  args.removeFirst();
110 
111  // Remove existing repair-options
112  args.removeAll(SALVAGEWALLET);
113  args.removeAll(RESCAN);
114  args.removeAll(ZAPTXES1);
115  args.removeAll(ZAPTXES2);
116  args.removeAll(UPGRADEWALLET);
117  args.removeAll(REINDEX);
118 
119  // Append repair parameter to command line.
120  args.append(arg);
121 
122  // Send command-line arguments to PIVXGUI::handleRestart()
123  Q_EMIT handleRestart(args);
124 }
125 
127 {
128  delete ui;
129 }
PIVX GUI main class.
Definition: pivxgui.h:46
void walletResync()
Restart wallet with "-resync".
void walletRescan()
Restart wallet with "-rescan".
void buildParameterlist(QString arg)
Build parameter list for restart.
void walletZaptxes2()
Restart wallet with "-zapwallettxes=2".
void handleRestart(QStringList args)
Get restart command-line parameters and handle restart.
void walletReindex()
Restart wallet with "-reindex".
void walletSalvage()
Restart wallet with "-salvagewallet".
Ui::SettingsWalletRepairWidget * ui
void walletZaptxes1()
Restart wallet with "-zapwallettxes=1".
void walletUpgrade()
Restart wallet with "-upgradewallet".
SettingsWalletRepairWidget(PIVXGUI *_window, QWidget *parent=nullptr)
@ REINDEX
Definition: logging.h:51
void setCssProperty(std::initializer_list< QWidget * > args, const QString &value)
Definition: qtutils.cpp:334
const QString ZAPTXES1("-zapwallettxes=1")
const QString ZAPTXES2("-zapwallettxes=2")
const QString UPGRADEWALLET("-upgradewallet")
const QString SALVAGEWALLET("-salvagewallet")
const QString RESYNC("-resync")
const QString RESCAN("-rescan")