mirror of
				https://git.wownero.com/wowlet/wowlet.git
				synced 2024-08-15 01:03:14 +00:00 
			
		
		
		
	Merge pull request 'Export/Import KeyImages/Outputs' (#66) from tobtoht/feather:keyimages into master
Reviewed-on: https://git.wownero.com/feather/feather/pulls/66
This commit is contained in:
		
						commit
						1febbc869f
					
				
					 8 changed files with 138 additions and 6 deletions
				
			
		| 
						 | 
					@ -28,7 +28,7 @@ if(DEBUG)
 | 
				
			||||||
    set(CMAKE_VERBOSE_MAKEFILE ON)
 | 
					    set(CMAKE_VERBOSE_MAKEFILE ON)
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
set(MONERO_HEAD "fe3c05952281773684e20a964110a9aeb7a4fc74")
 | 
					set(MONERO_HEAD "f6587d7943a19c55a5b78af1a89b22c130513b73")
 | 
				
			||||||
set(BUILD_GUI_DEPS ON)
 | 
					set(BUILD_GUI_DEPS ON)
 | 
				
			||||||
set(ARCH "x86-64")
 | 
					set(ARCH "x86-64")
 | 
				
			||||||
set(BUILD_64 ON)
 | 
					set(BUILD_64 ON)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								monero
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								monero
									
										
									
									
									
								
							| 
						 | 
					@ -1 +1 @@
 | 
				
			||||||
Subproject commit fe3c05952281773684e20a964110a9aeb7a4fc74
 | 
					Subproject commit f6587d7943a19c55a5b78af1a89b22c130513b73
 | 
				
			||||||
| 
						 | 
					@ -457,9 +457,9 @@ quint64 Wallet::daemonBlockChainTargetHeight() const
 | 
				
			||||||
    return m_daemonBlockChainTargetHeight;
 | 
					    return m_daemonBlockChainTargetHeight;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Wallet::exportKeyImages(const QString& path)
 | 
					bool Wallet::exportKeyImages(const QString& path, bool all)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return m_walletImpl->exportKeyImages(path.toStdString());
 | 
					    return m_walletImpl->exportKeyImages(path.toStdString(), all);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Wallet::importKeyImages(const QString& path)
 | 
					bool Wallet::importKeyImages(const QString& path)
 | 
				
			||||||
| 
						 | 
					@ -467,6 +467,14 @@ bool Wallet::importKeyImages(const QString& path)
 | 
				
			||||||
    return m_walletImpl->importKeyImages(path.toStdString());
 | 
					    return m_walletImpl->importKeyImages(path.toStdString());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool Wallet::exportOutputs(const QString& path, bool all) {
 | 
				
			||||||
 | 
					    return m_walletImpl->exportOutputs(path.toStdString(), all);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool Wallet::importOutputs(const QString& path) {
 | 
				
			||||||
 | 
					    return m_walletImpl->importOutputs(path.toStdString());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Wallet::refresh(bool historyAndSubaddresses /* = true */)
 | 
					bool Wallet::refresh(bool historyAndSubaddresses /* = true */)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    refreshingSet(true);
 | 
					    refreshingSet(true);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -192,9 +192,13 @@ public:
 | 
				
			||||||
    Q_INVOKABLE void refreshHeightAsync();
 | 
					    Q_INVOKABLE void refreshHeightAsync();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //! export/import key images
 | 
					    //! export/import key images
 | 
				
			||||||
    Q_INVOKABLE bool exportKeyImages(const QString& path);
 | 
					    Q_INVOKABLE bool exportKeyImages(const QString& path, bool all = false);
 | 
				
			||||||
    Q_INVOKABLE bool importKeyImages(const QString& path);
 | 
					    Q_INVOKABLE bool importKeyImages(const QString& path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //! export/import outputs
 | 
				
			||||||
 | 
					    Q_INVOKABLE bool exportOutputs(const QString& path, bool all = false);
 | 
				
			||||||
 | 
					    Q_INVOKABLE bool importOutputs(const QString& path);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    //! refreshes the wallet
 | 
					    //! refreshes the wallet
 | 
				
			||||||
    Q_INVOKABLE bool refresh(bool historyAndSubaddresses = true);
 | 
					    Q_INVOKABLE bool refresh(bool historyAndSubaddresses = true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -404,6 +404,10 @@ void MainWindow::initMenu() {
 | 
				
			||||||
    connect(ui->actionUpdate_balance, &QAction::triggered, [&]{
 | 
					    connect(ui->actionUpdate_balance, &QAction::triggered, [&]{
 | 
				
			||||||
        m_ctx->updateBalance();
 | 
					        m_ctx->updateBalance();
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					    connect(ui->actionExportKeyImages, &QAction::triggered, this, &MainWindow::exportKeyImages);
 | 
				
			||||||
 | 
					    connect(ui->actionImportKeyImages, &QAction::triggered, this, &MainWindow::importKeyImages);
 | 
				
			||||||
 | 
					    connect(ui->actionExportOutputs, &QAction::triggered, this, &MainWindow::exportOutputs);
 | 
				
			||||||
 | 
					    connect(ui->actionImportOutputs, &QAction::triggered, this, &MainWindow::importOutputs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // set restore height
 | 
					    // set restore height
 | 
				
			||||||
    connect(ui->actionChange_restore_height, &QAction::triggered, this, &MainWindow::showRestoreHeightDialog);
 | 
					    connect(ui->actionChange_restore_height, &QAction::triggered, this, &MainWindow::showRestoreHeightDialog);
 | 
				
			||||||
| 
						 | 
					@ -1068,6 +1072,58 @@ void MainWindow::showWSNodeExhaustedMessage() {
 | 
				
			||||||
    QMessageBox::warning(this, "Could not connect to a node", msg);
 | 
					    QMessageBox::warning(this, "Could not connect to a node", msg);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void MainWindow::exportKeyImages() {
 | 
				
			||||||
 | 
					    QString fn = QFileDialog::getSaveFileName(this, "Save key images to file", QDir::homePath(), "Key Images (*_keyImages)");
 | 
				
			||||||
 | 
					    if (fn.isEmpty()) return;
 | 
				
			||||||
 | 
					    if (!fn.endsWith("_keyImages")) fn += "_keyImages";
 | 
				
			||||||
 | 
					    m_ctx->currentWallet->exportKeyImages(fn, true);
 | 
				
			||||||
 | 
					    auto err = m_ctx->currentWallet->errorString();
 | 
				
			||||||
 | 
					    if (!err.isEmpty()) {
 | 
				
			||||||
 | 
					        QMessageBox::warning(this, "Key image export", QString("Failed to export key images.\nReason: %1").arg(err));
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        QMessageBox::information(this, "Key image export", "Successfully exported key images.");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void MainWindow::importKeyImages() {
 | 
				
			||||||
 | 
					    QString fn = QFileDialog::getOpenFileName(this, "Import key image file", QDir::homePath(), "Key Images (*_keyImages)");
 | 
				
			||||||
 | 
					    if (fn.isEmpty()) return;
 | 
				
			||||||
 | 
					    m_ctx->currentWallet->importKeyImages(fn);
 | 
				
			||||||
 | 
					    auto err = m_ctx->currentWallet->errorString();
 | 
				
			||||||
 | 
					    if (!err.isEmpty()) {
 | 
				
			||||||
 | 
					        QMessageBox::warning(this, "Key image import", QString("Failed to import key images.\n\n%1").arg(err));
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        QMessageBox::information(this, "Key image import", "Successfully imported key images");
 | 
				
			||||||
 | 
					        m_ctx->refreshModels();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void MainWindow::exportOutputs() {
 | 
				
			||||||
 | 
					    QString fn = QFileDialog::getSaveFileName(this, "Save outputs to file", QDir::homePath(), "Outputs (*_outputs)");
 | 
				
			||||||
 | 
					    if (fn.isEmpty()) return;
 | 
				
			||||||
 | 
					    if (!fn.endsWith("_outputs")) fn += "_outputs";
 | 
				
			||||||
 | 
					    m_ctx->currentWallet->exportOutputs(fn, true);
 | 
				
			||||||
 | 
					    auto err = m_ctx->currentWallet->errorString();
 | 
				
			||||||
 | 
					    if (!err.isEmpty()) {
 | 
				
			||||||
 | 
					        QMessageBox::warning(this, "Outputs export", QString("Failed to export outputs.\nReason: %1").arg(err));
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        QMessageBox::information(this, "Outputs export", "Successfully exported outputs.");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void MainWindow::importOutputs() {
 | 
				
			||||||
 | 
					    QString fn = QFileDialog::getOpenFileName(this, "Import outputs file", QDir::homePath(), "Outputs (*_outputs)");
 | 
				
			||||||
 | 
					    if (fn.isEmpty()) return;
 | 
				
			||||||
 | 
					    m_ctx->currentWallet->importOutputs(fn);
 | 
				
			||||||
 | 
					    auto err = m_ctx->currentWallet->errorString();
 | 
				
			||||||
 | 
					    if (!err.isEmpty()) {
 | 
				
			||||||
 | 
					        QMessageBox::warning(this, "Outputs import", QString("Failed to import outputs.\n\n%1").arg(err));
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					        QMessageBox::information(this, "Outputs import", "Successfully imported outputs");
 | 
				
			||||||
 | 
					        m_ctx->refreshModels();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MainWindow::~MainWindow() {
 | 
					MainWindow::~MainWindow() {
 | 
				
			||||||
    delete ui;
 | 
					    delete ui;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -100,6 +100,11 @@ public slots:
 | 
				
			||||||
    void onAddContact(const QString &address, const QString &name);
 | 
					    void onAddContact(const QString &address, const QString &name);
 | 
				
			||||||
    void showRestoreHeightDialog();
 | 
					    void showRestoreHeightDialog();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void exportKeyImages();
 | 
				
			||||||
 | 
					    void importKeyImages();
 | 
				
			||||||
 | 
					    void exportOutputs();
 | 
				
			||||||
 | 
					    void importOutputs();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // libwalletqt
 | 
					    // libwalletqt
 | 
				
			||||||
    void onBalanceUpdated(double balance, double unlocked, const QString &balance_str, const QString &unlocked_str);
 | 
					    void onBalanceUpdated(double balance, double unlocked, const QString &balance_str, const QString &unlocked_str);
 | 
				
			||||||
    void onSynchronized();
 | 
					    void onSynchronized();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -291,7 +291,7 @@
 | 
				
			||||||
     <x>0</x>
 | 
					     <x>0</x>
 | 
				
			||||||
     <y>0</y>
 | 
					     <y>0</y>
 | 
				
			||||||
     <width>894</width>
 | 
					     <width>894</width>
 | 
				
			||||||
     <height>22</height>
 | 
					     <height>30</height>
 | 
				
			||||||
    </rect>
 | 
					    </rect>
 | 
				
			||||||
   </property>
 | 
					   </property>
 | 
				
			||||||
   <widget class="QMenu" name="menuFile">
 | 
					   <widget class="QMenu" name="menuFile">
 | 
				
			||||||
| 
						 | 
					@ -324,10 +324,27 @@
 | 
				
			||||||
     <property name="title">
 | 
					     <property name="title">
 | 
				
			||||||
      <string>Advanced</string>
 | 
					      <string>Advanced</string>
 | 
				
			||||||
     </property>
 | 
					     </property>
 | 
				
			||||||
 | 
					     <widget class="QMenu" name="menuExport">
 | 
				
			||||||
 | 
					      <property name="title">
 | 
				
			||||||
 | 
					       <string>Export</string>
 | 
				
			||||||
 | 
					      </property>
 | 
				
			||||||
 | 
					      <addaction name="actionExportOutputs"/>
 | 
				
			||||||
 | 
					      <addaction name="actionExportKeyImages"/>
 | 
				
			||||||
 | 
					     </widget>
 | 
				
			||||||
 | 
					     <widget class="QMenu" name="menuImport">
 | 
				
			||||||
 | 
					      <property name="title">
 | 
				
			||||||
 | 
					       <string>Import</string>
 | 
				
			||||||
 | 
					      </property>
 | 
				
			||||||
 | 
					      <addaction name="actionImportOutputs"/>
 | 
				
			||||||
 | 
					      <addaction name="actionImportKeyImages"/>
 | 
				
			||||||
 | 
					     </widget>
 | 
				
			||||||
     <addaction name="actionStore_wallet"/>
 | 
					     <addaction name="actionStore_wallet"/>
 | 
				
			||||||
     <addaction name="actionUpdate_balance"/>
 | 
					     <addaction name="actionUpdate_balance"/>
 | 
				
			||||||
     <addaction name="actionRefresh_tabs"/>
 | 
					     <addaction name="actionRefresh_tabs"/>
 | 
				
			||||||
 | 
					     <addaction name="separator"/>
 | 
				
			||||||
     <addaction name="actionChange_restore_height"/>
 | 
					     <addaction name="actionChange_restore_height"/>
 | 
				
			||||||
 | 
					     <addaction name="menuExport"/>
 | 
				
			||||||
 | 
					     <addaction name="menuImport"/>
 | 
				
			||||||
    </widget>
 | 
					    </widget>
 | 
				
			||||||
    <addaction name="actionInformation"/>
 | 
					    <addaction name="actionInformation"/>
 | 
				
			||||||
    <addaction name="menuAdvanced"/>
 | 
					    <addaction name="menuAdvanced"/>
 | 
				
			||||||
| 
						 | 
					@ -534,6 +551,46 @@
 | 
				
			||||||
    <string>View-Only</string>
 | 
					    <string>View-Only</string>
 | 
				
			||||||
   </property>
 | 
					   </property>
 | 
				
			||||||
  </action>
 | 
					  </action>
 | 
				
			||||||
 | 
					  <action name="actionExport_key_images">
 | 
				
			||||||
 | 
					   <property name="text">
 | 
				
			||||||
 | 
					    <string>Export key images</string>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					  </action>
 | 
				
			||||||
 | 
					  <action name="actionImport_key_images">
 | 
				
			||||||
 | 
					   <property name="text">
 | 
				
			||||||
 | 
					    <string>Import key images</string>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					  </action>
 | 
				
			||||||
 | 
					  <action name="actionExport_outputs">
 | 
				
			||||||
 | 
					   <property name="text">
 | 
				
			||||||
 | 
					    <string>Export outputs</string>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					  </action>
 | 
				
			||||||
 | 
					  <action name="actionImport_outputs">
 | 
				
			||||||
 | 
					   <property name="text">
 | 
				
			||||||
 | 
					    <string>Import outputs</string>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					  </action>
 | 
				
			||||||
 | 
					  <action name="actionExportKeyImages">
 | 
				
			||||||
 | 
					   <property name="text">
 | 
				
			||||||
 | 
					    <string>Key Images</string>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					  </action>
 | 
				
			||||||
 | 
					  <action name="actionExportOutputs">
 | 
				
			||||||
 | 
					   <property name="text">
 | 
				
			||||||
 | 
					    <string>Outputs</string>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					  </action>
 | 
				
			||||||
 | 
					  <action name="actionImportKeyImages">
 | 
				
			||||||
 | 
					   <property name="text">
 | 
				
			||||||
 | 
					    <string>Key images</string>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					  </action>
 | 
				
			||||||
 | 
					  <action name="actionImportOutputs">
 | 
				
			||||||
 | 
					   <property name="text">
 | 
				
			||||||
 | 
					    <string>Outputs</string>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					  </action>
 | 
				
			||||||
 </widget>
 | 
					 </widget>
 | 
				
			||||||
 <layoutdefault spacing="6" margin="11"/>
 | 
					 <layoutdefault spacing="6" margin="11"/>
 | 
				
			||||||
 <customwidgets>
 | 
					 <customwidgets>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -168,6 +168,8 @@ QVariant CoinsModel::parseTransactionInfo(const CoinsInfo &cInfo, int column, in
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    switch (column)
 | 
					    switch (column)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        case KeyImageKnown:
 | 
				
			||||||
 | 
					            return "";
 | 
				
			||||||
        case PubKey:
 | 
					        case PubKey:
 | 
				
			||||||
            return cInfo.pubKey().mid(0,8);
 | 
					            return cInfo.pubKey().mid(0,8);
 | 
				
			||||||
        case OutputPoint:
 | 
					        case OutputPoint:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue