Skip to content

Commit

Permalink
Merge #1424: [GUI] One-click export to file
Browse files Browse the repository at this point in the history
2df5e68 [GUI] One-click export accounting (random-zebra)
a3edc53 [GUI] One-click wallet file backup (random-zebra)

Pull request description:

  Export to file directly, after selecting the destination and clicking "Save", without requiring additional button presses.
  Interested flows:
  - backup wallet
  - export txes to csv
  - export addresses to csv

  Closes #1417

ACKs for top commit:
  furszy:
    ACK 2df5e68

Tree-SHA512: 96da02d48d65f5a16dc0649f9560a59cdf8e4b5f4bd2a98e8380bbdd5db24b35a8f0ed990315d1338ea85f39bcdae18c0ab8a4539a08e362b4b347783c5984a9
  • Loading branch information
random-zebra committed Mar 28, 2020
2 parents 110aa9c + 2df5e68 commit 592aa52
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 246 deletions.
71 changes: 0 additions & 71 deletions src/qt/pivx/settings/forms/settingsbackupwallet.ui
Expand Up @@ -117,64 +117,6 @@
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_4">
<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="horizontalLayout_7">
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButtonSave">
<property name="minimumSize">
<size>
<width>200</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>50</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
Expand Down Expand Up @@ -207,19 +149,6 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayoutTitle_2">
<property name="spacing">
Expand Down
138 changes: 3 additions & 135 deletions src/qt/pivx/settings/forms/settingsexportcsv.ui
Expand Up @@ -174,64 +174,6 @@
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButtonSave">
<property name="minimumSize">
<size>
<width>220</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>220</width>
<height>50</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Export Transactions</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<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>5</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelDivider">
<property name="minimumSize">
Expand All @@ -251,30 +193,14 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayoutAddressesExport">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QWidget" name="filtersContainer" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<widget class="QWidget" name="filtersContainer1" native="true">
<layout class="QHBoxLayout" name="horizontalLayout1">
<property name="spacing">
<number>0</number>
</property>
Expand All @@ -298,7 +224,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<spacer name="horizontalSpacer1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
Expand Down Expand Up @@ -347,64 +273,6 @@
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_6">
<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="horizontalLayout_7">
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButtonExportAddress">
<property name="minimumSize">
<size>
<width>220</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>220</width>
<height>50</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Export Address Book</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
Expand Down
18 changes: 3 additions & 15 deletions src/qt/pivx/settings/settingsbackupwallet.cpp
Expand Up @@ -46,36 +46,24 @@ SettingsBackupWallet::SettingsBackupWallet(PIVXGUI* _window, QWidget *parent) :
setShadow(ui->pushButtonDocuments);

// Buttons
ui->pushButtonSave->setText(tr("Backup"));
setCssBtnPrimary(ui->pushButtonSave);

ui->pushButtonSave_2->setText(tr("Change Passphrase"));
setCssBtnPrimary(ui->pushButtonSave_2);

connect(ui->pushButtonSave, &QPushButton::clicked, this, &SettingsBackupWallet::backupWallet);
connect(ui->pushButtonDocuments, &QPushButton::clicked, this, &SettingsBackupWallet::selectFileOutput);
connect(ui->pushButtonSave_2, &QPushButton::clicked, this, &SettingsBackupWallet::changePassphrase);
}

void SettingsBackupWallet::selectFileOutput()
{
QString filenameRet = GUIUtil::getSaveFileName(this,
QString filename = GUIUtil::getSaveFileName(this,
tr("Backup Wallet"), QString(),
tr("Wallet Data (*.dat)"), NULL);

if (!filenameRet.isEmpty()) {
filename = filenameRet;
if (!filename.isEmpty() && walletModel) {
ui->pushButtonDocuments->setText(filename);
}
}

void SettingsBackupWallet::backupWallet()
{
if(walletModel && !filename.isEmpty()) {
inform(walletModel->backupWallet(filename) ? tr("Backup created") : tr("Backup creation failed"));
filename = QString();
ui->pushButtonDocuments->setText(tr("Select folder..."));
} else {
ui->pushButtonDocuments->setText(tr("Select folder..."));
inform(tr("Please select a folder to export the backup first."));
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/qt/pivx/settings/settingsbackupwallet.h
Expand Up @@ -21,13 +21,11 @@ class SettingsBackupWallet : public PWidget
~SettingsBackupWallet();

private Q_SLOTS:
void backupWallet();
void selectFileOutput();
void changePassphrase();

private:
Ui::SettingsBackupWallet *ui;
QString filename;
};

#endif // SETTINGSBACKUPWALLET_H

0 comments on commit 592aa52

Please sign in to comment.