From 15d6bcba0e107c937624125d3f825345fcbdb03b Mon Sep 17 00:00:00 2001 From: Mika Lindqvist Date: Fri, 27 Jan 2023 15:25:49 +0200 Subject: [PATCH] Update to latest daemon sources * (MacOS) Replace mentions of "CryptoNote" with "Talleo" in bundle properties * (Windows) Silence Winsock related warnings and add manifest to disable compatibility mode * (Windows) Automatically update copyright years in resource file * Add "Repair wallet" to "File" menu * Only try to send optimization transactions if there is something to optimize, create them until no more optimizable outputs or node rejects due to exceeding limit * Show path of currently opened wallet file in window title * Use proper directory separators depending on operating system on "Recent wallets" menu and window title --- CMakeLists.txt | 9 +++-- CryptoNoteWallet.cmake | 3 +- cryptonote | 2 +- include/IWalletAdapter.h | 3 ++ src/Application/AddressBookManager.cpp | 5 +++ src/Application/AddressBookManager.h | 2 + src/Application/OptimizationManager.cpp | 13 +++++- src/Application/OptimizationManager.h | 2 + src/CryptoNoteWalletVersion.h.in | 2 +- src/CryptoNoteWrapper/WalletGreenAdapter.cpp | 14 +++++++ src/CryptoNoteWrapper/WalletGreenAdapter.h | 4 ++ src/CryptoNoteWrapper/WalletGreenWorker.cpp | 11 ++++- src/CryptoNoteWrapper/WalletGreenWorker.h | 3 ++ src/Gui/MainWindow/MainWindow.cpp | 29 ++++++++++++-- src/Gui/MainWindow/MainWindow.h | 4 +- src/Gui/MainWindow/MainWindow.ui | 25 +++++++++++- src/Gui/MainWindow/WalletStatusBar.cpp | 6 ++- src/Gui/MainWindow/WalletStatusBar.h | 2 + src/Gui/NoWallet/NoWalletFrame.cpp | 5 +++ src/Gui/NoWallet/NoWalletFrame.h | 2 + src/Gui/Send/SendFrame.cpp | 6 ++- src/Gui/Send/SendFrame.h | 2 + src/Gui/Transactions/TransactionsDelegate.cpp | 5 +++ src/Gui/Transactions/TransactionsDelegate.h | 2 + src/Models/TransactionsModel.cpp | 7 ++++ src/Models/TransactionsModel.h | 2 + src/Models/WalletStateModel.cpp | 6 ++- src/Models/WalletStateModel.h | 3 +- src/TalleoWallet.manifest.in | 40 +++++++++++++++++++ 29 files changed, 199 insertions(+), 20 deletions(-) create mode 100644 src/TalleoWallet.manifest.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 912c7f9..5e29e54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,7 +192,8 @@ file(GLOB_RECURSE FORMS src/Gui/*/*.ui) if(MSVC) include_directories(Platform/Windows) - set(SOURCES ${SOURCES} ${CMAKE_SOURCE_DIR}/Platform/Windows/ApplicationEventHandler.cpp) + configure_file(${CMAKE_SOURCE_DIR}/src/TalleoWallet.manifest.in ${CMAKE_BINARY_DIR}/TalleoWallet.manifest @ONLY) + set(SOURCES ${SOURCES} ${CMAKE_SOURCE_DIR}/Platform/Windows/ApplicationEventHandler.cpp ${CMAKE_BINARY_DIR}/TalleoWallet.manifest) elseif(APPLE) include_directories(Platform/OSX) include_directories(Platform/Posix) @@ -216,7 +217,7 @@ if (WIN32) message(FATAL_ERROR "Only MSVC is supported on this platform") endif () - add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0600 /DSTATICLIB) + add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_WINSOCK_DEPRECATED_NO_WARNINGS /D_WIN32_WINNT=0x0600 /DSTATICLIB) include_directories(cryptonote/src/Platform/msc) set(PLATFORM_DIR Windows) @@ -231,9 +232,9 @@ elseif (UNIX) file(GLOB_RECURSE OBJC_SOURCES src/*.mm) set(SOURCES ${SOURCES} ${OBJC_SOURCES}) set(PLATFORM_DIR OSX) - set(MACOSX_BUNDLE_INFO_STRING "Cryptonote GUI wallet") + set(MACOSX_BUNDLE_INFO_STRING "Talleo GUI wallet") set(MACOSX_BUNDLE_LONG_VERSION_STRING "${VERSION_VERSION}.${VERSION_MINOR}.${VERSION_PATCH}") - set(MACOSX_BUNDLE_BUNDLE_NAME CryptonoteWallet) + set(MACOSX_BUNDLE_BUNDLE_NAME TalleoWallet) set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${VERSION_VERSION}.${VERSION_MINOR}.${VERSION_PATCH}") set(MACOSX_BUNDLE_BUNDLE_VERSION "$${VERSION_VERSION}.${VERSION_MINOR}.${VERSION_PATCH}") diff --git a/CryptoNoteWallet.cmake b/CryptoNoteWallet.cmake index 22a2e1a..53f96d8 100644 --- a/CryptoNoteWallet.cmake +++ b/CryptoNoteWallet.cmake @@ -5,5 +5,6 @@ set(CN_URI_SCHEME_NAME "talleo") set(CN_VERSION_MAJOR "2") set(CN_VERSION_MINOR "0") set(CN_VERSION_REVISION "10") -set(CN_VERSION_BUILD "2") +set(CN_VERSION_BUILD "3") set(CN_VERSION "${CN_VERSION_MAJOR}.${CN_VERSION_MINOR}.${CN_VERSION_REVISION}") +string(TIMESTAMP CN_BUILD_YEAR "%Y") diff --git a/cryptonote b/cryptonote index 50d187d..14b8548 160000 --- a/cryptonote +++ b/cryptonote @@ -1 +1 @@ -Subproject commit 50d187d523bd3ea814f581f87683c3b494f0e643 +Subproject commit 14b85486bc60786f69a8b8b17d7d30353300f224 diff --git a/include/IWalletAdapter.h b/include/IWalletAdapter.h index 7d6caed..2e8ea83 100644 --- a/include/IWalletAdapter.h +++ b/include/IWalletAdapter.h @@ -1,4 +1,5 @@ // Copyright (c) 2015-2017, The Bytecoin developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -46,6 +47,7 @@ class IWalletAdapterObserver { virtual ~IWalletAdapterObserver() {} virtual void walletOpened() = 0; virtual void walletOpenError(int _initStatus) = 0; + virtual void walletRepairStarted() = 0; virtual void walletClosed() = 0; virtual void passwordChanged() = 0; virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) = 0; @@ -82,6 +84,7 @@ class IWalletAdapter { virtual WalletSaveStatus save(CryptoNote::WalletSaveLevel _saveLevel, bool _saveUserData) = 0; virtual WalletSaveStatus exportWallet(const QString& _path, bool _encrypt, CryptoNote::WalletSaveLevel _saveLevel, bool _saveUserData) = 0; virtual PasswordStatus changePassword(const QString& _oldPassword, const QString& _newPassword) = 0; + virtual void repair() = 0; virtual void close() = 0; virtual bool isOpen() const = 0; diff --git a/src/Application/AddressBookManager.cpp b/src/Application/AddressBookManager.cpp index 25e25fa..98fea56 100644 --- a/src/Application/AddressBookManager.cpp +++ b/src/Application/AddressBookManager.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -394,6 +395,10 @@ void AddressBookManager::walletOpenError(int _initStatus) { // Do nothing } +void AddressBookManager::walletRepairStarted() { + // Do nothing +} + void AddressBookManager::walletClosed() { m_addressIndexes.clear(); m_labelIndexes.clear(); diff --git a/src/Application/AddressBookManager.h b/src/Application/AddressBookManager.h index 0c9a15a..dcb3b0a 100644 --- a/src/Application/AddressBookManager.h +++ b/src/Application/AddressBookManager.h @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -71,6 +72,7 @@ class AddressBookManager : public QObject, public IAddressBookManager, public ID // IWalletAdapterObserver Q_SLOT virtual void walletOpened() override; Q_SLOT virtual void walletOpenError(int _initStatus) override; + Q_SLOT virtual void walletRepairStarted() override; Q_SLOT virtual void walletClosed() override; Q_SLOT virtual void passwordChanged() override; Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override; diff --git a/src/Application/OptimizationManager.cpp b/src/Application/OptimizationManager.cpp index 13f2e81..d3fd5e6 100644 --- a/src/Application/OptimizationManager.cpp +++ b/src/Application/OptimizationManager.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -17,6 +18,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with Bytecoin. If not, see . +#include #include #include @@ -130,6 +132,10 @@ void OptimizationManager::walletOpenError(int _initStatus) { // Do nothing } +void OptimizationManager::walletRepairStarted() { + // Do nothing +} + void OptimizationManager::walletClosed() { if (m_checkTimerId != -1) { killTimer(m_checkTimerId); @@ -223,8 +229,11 @@ void OptimizationManager::optimize() { return; } - walletAdapter->createFusionTransaction(Settings::instance().getOptimizationThreshold(), - Settings::instance().getOptimizationMixin(), walletAdapter->getAddress(0)); + quint64 threshold = Settings::instance().getOptimizationThreshold(); + while ((walletAdapter->getOutputsToOptimizeCount(threshold) > 0) && + walletAdapter->createFusionTransaction(threshold, Settings::instance().getOptimizationMixin(), walletAdapter->getAddress(0))) { + qApp->processEvents(); + } } void OptimizationManager::ensureStarted() { diff --git a/src/Application/OptimizationManager.h b/src/Application/OptimizationManager.h index 735ebb3..2343cfc 100644 --- a/src/Application/OptimizationManager.h +++ b/src/Application/OptimizationManager.h @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -61,6 +62,7 @@ class OptimizationManager : public QObject, public IOptimizationManager, public // IWalletAdapterObserver Q_SLOT virtual void walletOpened() override; Q_SLOT virtual void walletOpenError(int _initStatus) override; + Q_SLOT virtual void walletRepairStarted() override; Q_SLOT virtual void walletClosed() override; Q_SLOT virtual void passwordChanged() override; Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override; diff --git a/src/CryptoNoteWalletVersion.h.in b/src/CryptoNoteWalletVersion.h.in index 4be7790..7b75eb9 100644 --- a/src/CryptoNoteWalletVersion.h.in +++ b/src/CryptoNoteWalletVersion.h.in @@ -4,7 +4,7 @@ #define PROJECT_NAME "@CN_CURRENCY_DISPLAY_NAME@ Wallet" #define PROJECT_COMPANY "Talleo Project" #define PROJECT_SITE "https://talleo.org/" -#define PROJECT_COPYRIGHT "Copyright 2019-2020, The Talleo Developers" +#define PROJECT_COPYRIGHT "Copyright 2019-@CN_BUILD_YEAR@, The Talleo Developers" #define APP_VER_MAJOR @CN_VERSION_MAJOR@ #define APP_VER_MINOR @CN_VERSION_MINOR@ #define APP_VER_REV @CN_VERSION_REVISION@ diff --git a/src/CryptoNoteWrapper/WalletGreenAdapter.cpp b/src/CryptoNoteWrapper/WalletGreenAdapter.cpp index 16d2012..465438c 100644 --- a/src/CryptoNoteWrapper/WalletGreenAdapter.cpp +++ b/src/CryptoNoteWrapper/WalletGreenAdapter.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -89,6 +90,13 @@ IWalletAdapter::PasswordStatus WalletGreenAdapter::changePassword(const QString& return m_worker->changePassword(_oldPassword, _newPassword); } + +void WalletGreenAdapter::repair() { + Q_ASSERT(m_worker != nullptr); + Q_EMIT walletRepairStarted(); + m_worker->repair(); +} + void WalletGreenAdapter::close() { m_worker->removeObserver(this); deleteWorker(); @@ -193,6 +201,7 @@ void WalletGreenAdapter::addObserver(IWalletAdapterObserver* _observer) { QObject* observerObject = dynamic_cast(_observer); connect(this, SIGNAL(walletOpenedSignal()), observerObject, SLOT(walletOpened())); connect(this, SIGNAL(walletOpenErrorSignal(int)), observerObject, SLOT(walletOpenError(int))); + connect(this, SIGNAL(walletRepairStartedSignal()), observerObject, SLOT(walletRepairStarted())); connect(this, SIGNAL(walletClosedSignal()), observerObject, SLOT(walletClosed())); connect(this, SIGNAL(passwordChangedSignal()), observerObject, SLOT(passwordChanged())); connect(this, SIGNAL(synchronizationProgressUpdatedSignal(quint32, quint32)), observerObject, @@ -209,6 +218,7 @@ void WalletGreenAdapter::removeObserver(IWalletAdapterObserver* _observer) { QObject* observerObject = dynamic_cast(_observer); disconnect(this, SIGNAL(walletOpenedSignal()), observerObject, SLOT(walletOpened())); disconnect(this, SIGNAL(walletOpenErrorSignal(int)), observerObject, SLOT(walletOpenError(int))); + disconnect(this, SIGNAL(walletRepairStartedSignal()), observerObject, SLOT(walletRepairStarted())); disconnect(this, SIGNAL(walletClosedSignal()), observerObject, SLOT(walletClosed())); disconnect(this, SIGNAL(passwordChangedSignal()), observerObject, SLOT(passwordChanged())); disconnect(this, SIGNAL(synchronizationProgressUpdatedSignal(quint32, quint32)), observerObject, @@ -229,6 +239,10 @@ void WalletGreenAdapter::walletOpenError(int _initStatus) { Q_EMIT walletOpenErrorSignal(_initStatus); } +void WalletGreenAdapter::walletRepairStarted() { + Q_EMIT walletRepairStartedSignal(); +} + void WalletGreenAdapter::walletClosed() { Q_EMIT walletClosedSignal(); } diff --git a/src/CryptoNoteWrapper/WalletGreenAdapter.h b/src/CryptoNoteWrapper/WalletGreenAdapter.h index 014a3e4..4e4a387 100644 --- a/src/CryptoNoteWrapper/WalletGreenAdapter.h +++ b/src/CryptoNoteWrapper/WalletGreenAdapter.h @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -48,6 +49,7 @@ class WalletGreenAdapter : public QObject, public IWalletAdapter, public IWallet virtual WalletSaveStatus save(CryptoNote::WalletSaveLevel _saveLevel, bool _saveUserData) override; virtual WalletSaveStatus exportWallet(const QString& _path, bool _encrypt, CryptoNote::WalletSaveLevel _saveLevel, bool _saveUserData) override; virtual PasswordStatus changePassword(const QString& _oldPassword, const QString& _newPassword) override; + virtual void repair() override; virtual void close() override; virtual bool isOpen() const override; @@ -77,6 +79,7 @@ class WalletGreenAdapter : public QObject, public IWalletAdapter, public IWallet // IWalletAdapterObserver Q_SLOT virtual void walletOpened() override; Q_SLOT virtual void walletOpenError(int _initStatus) override; + Q_SLOT virtual void walletRepairStarted() override; Q_SLOT virtual void walletClosed() override; Q_SLOT virtual void passwordChanged() override; Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override; @@ -99,6 +102,7 @@ class WalletGreenAdapter : public QObject, public IWalletAdapter, public IWallet Q_SIGNALS: void walletOpenedSignal(); void walletOpenErrorSignal(int _initStatus); + void walletRepairStartedSignal(); void walletClosedSignal(); void passwordChangedSignal(); void synchronizationProgressUpdatedSignal(quint32 _current, quint32 _total); diff --git a/src/CryptoNoteWrapper/WalletGreenWorker.cpp b/src/CryptoNoteWrapper/WalletGreenWorker.cpp index 8d3e276..3258bcc 100644 --- a/src/CryptoNoteWrapper/WalletGreenWorker.cpp +++ b/src/CryptoNoteWrapper/WalletGreenWorker.cpp @@ -1,7 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers -// Copyright (c) 2021, The Talleo developers +// Copyright (c) 2021-2023, The Talleo developers // // This file is part of Bytecoin. // @@ -379,6 +379,14 @@ IWalletAdapter::PasswordStatus WalletGreenWorker::changePassword(const QString& return getPasswordStatus(errorCode); } +void WalletGreenWorker::repair() { + Q_ASSERT(!m_wallet.isNull()); + SemaphoreLocker locker(m_walletSemaphore); + Q_EMIT walletRepairStartedSignal(); + m_wallet->repair(); + WalletLogger::info(tr("[Wallet] Wallet repair finished")); +} + void WalletGreenWorker::close() { Q_ASSERT(!m_wallet.isNull()); SemaphoreLocker locker(m_walletSemaphore); @@ -703,6 +711,7 @@ void WalletGreenWorker::addObserver(IWalletAdapterObserver* _observer) { QObject* observerObject = dynamic_cast(_observer); m_observerConnections[_observer] << connect(this, SIGNAL(walletOpenedSignal()), observerObject, SLOT(walletOpened()), Qt::QueuedConnection); m_observerConnections[_observer] << connect(this, SIGNAL(walletOpenErrorSignal(int)), observerObject, SLOT(walletOpenError(int)), Qt::QueuedConnection); + m_observerConnections[_observer] << connect(this, SIGNAL(walletRepairStartedSignal()), observerObject, SLOT(walletRepairStarted()), Qt::QueuedConnection); m_observerConnections[_observer] << connect(this, SIGNAL(walletClosedSignal()), observerObject, SLOT(walletClosed()), Qt::QueuedConnection); m_observerConnections[_observer] << connect(this, SIGNAL(passwordChangedSignal()), observerObject, SLOT(passwordChanged()), Qt::QueuedConnection); m_observerConnections[_observer] << connect(this, SIGNAL(synchronizationProgressUpdatedSignal(quint32, quint32)), observerObject, diff --git a/src/CryptoNoteWrapper/WalletGreenWorker.h b/src/CryptoNoteWrapper/WalletGreenWorker.h index 44b7e05..a9b5ed5 100644 --- a/src/CryptoNoteWrapper/WalletGreenWorker.h +++ b/src/CryptoNoteWrapper/WalletGreenWorker.h @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -60,6 +61,7 @@ class WalletGreenWorker : public QObject, public IWalletAdapter { virtual WalletSaveStatus save(CryptoNote::WalletSaveLevel _saveLevel, bool _saveUserData) override; virtual WalletSaveStatus exportWallet(const QString& _path, bool _encrypt, CryptoNote::WalletSaveLevel _saveLevel, bool _saveUserData) override; virtual PasswordStatus changePassword(const QString& _oldPassword, const QString& _newPassword) override; + virtual void repair() override; virtual void close() override; virtual bool isOpen() const override; @@ -113,6 +115,7 @@ class WalletGreenWorker : public QObject, public IWalletAdapter { Q_SIGNALS: void walletOpenedSignal(); void walletOpenErrorSignal(int _initStatus); + void walletRepairStartedSignal(); void walletClosedSignal(); void passwordChangedSignal(); void synchronizationProgressUpdatedSignal(quint32 _current, quint32 _total); diff --git a/src/Gui/MainWindow/MainWindow.cpp b/src/Gui/MainWindow/MainWindow.cpp index 10ea567..e2153d6 100644 --- a/src/Gui/MainWindow/MainWindow.cpp +++ b/src/Gui/MainWindow/MainWindow.cpp @@ -1,7 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers -// Copyright (c) 2019-2020, The Talleo developers +// Copyright (c) 2019-2023, The Talleo developers // // This file is part of Bytecoin. // @@ -253,6 +253,10 @@ void MainWindow::walletOpenError(int _initStatus) { } } +void MainWindow::walletRepairStarted() { + // Do nothing +} + void MainWindow::walletClosed() { setClosedState(); } @@ -364,6 +368,7 @@ void MainWindow::closeEvent(QCloseEvent* _event) { } void MainWindow::setOpenedState() { + setWindowTitle(tr("Talleo Wallet %1 - %2").arg(Settings::instance().getVersion()).arg(QDir::toNativeSeparators(Settings::instance().getWalletFile()))); QList toolButtons = m_ui->m_toolButtonGroup->buttons(); for (const auto& button : toolButtons) { @@ -374,6 +379,7 @@ void MainWindow::setOpenedState() { IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); m_ui->m_backupWalletAction->setEnabled(true); m_ui->m_resetAction->setEnabled(true); + m_ui->m_repairAction->setEnabled(true); m_ui->m_exportTrackingKeyAction->setEnabled(true); m_ui->m_encryptWalletAction->setEnabled(!walletAdapter->isEncrypted()); m_ui->m_changePasswordAction->setEnabled(walletAdapter->isEncrypted()); @@ -386,6 +392,8 @@ void MainWindow::setOpenedState() { } void MainWindow::setClosedState() { + setWindowTitle(tr("Talleo Wallet %1").arg(Settings::instance().getVersion())); + QList toolButtons = m_ui->m_toolButtonGroup->buttons(); for (const auto& button : toolButtons) { button->setChecked(false); @@ -394,6 +402,7 @@ void MainWindow::setClosedState() { m_ui->m_backupWalletAction->setEnabled(false); m_ui->m_resetAction->setEnabled(false); + m_ui->m_repairAction->setEnabled(false); m_ui->m_exportTrackingKeyAction->setEnabled(false); m_ui->m_encryptWalletAction->setEnabled(false); m_ui->m_changePasswordAction->setEnabled(false); @@ -462,7 +471,7 @@ void MainWindow::updateRecentWalletActions() { QStringList recentWallets = Settings::instance().getRecentWalletList(); int recentWalletCount = qMin(recentWallets.size(), MAX_RECENT_WALLET_COUNT); for (int i = 0; i < recentWalletCount; ++i) { - m_recentWalletsActionList[i]->setText(recentWallets[i]); + m_recentWalletsActionList[i]->setText(QDir::toNativeSeparators(recentWallets[i])); m_recentWalletsActionList[i]->setData(recentWallets[i]); m_recentWalletsActionList[i]->setVisible(true); } @@ -634,6 +643,18 @@ void MainWindow::saveWalletKeys() { } } +void MainWindow::repairWallet() { + qApp->processEvents(); // Make sure GUI redraws once before repair starts + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + Q_ASSERT(walletAdapter->isOpen()); + walletAdapter->repair(); + walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); + walletAdapter->removeObserver(this); + walletAdapter->close(); + walletAdapter->addObserver(this); + m_ui->m_noWalletFrame->openWallet(Settings::instance().getWalletFile(), QString()); +} + void MainWindow::resetWallet() { QuestionDialog dlg(tr("Reset wallet?"), tr("Reset wallet to re-synchronise its transactions and balance based\n" "on the blockchain data. This operation can take some time.\n" @@ -645,8 +666,8 @@ void MainWindow::resetWallet() { IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); Q_ASSERT(walletAdapter->isOpen()); QString fileName = Settings::instance().getWalletFile(); - QDateTime currenctDateTime = QDateTime::currentDateTime(); - fileName.append(QString(".%1.backup").arg(currenctDateTime.toString("yyyyMMddHHMMss"))); + QDateTime _currentDateTime = QDateTime::currentDateTime(); + fileName.append(QString(".%1.backup").arg(_currentDateTime.toString("yyyyMMddHHMMss"))); walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_KEYS_ONLY, true); walletAdapter->removeObserver(this); diff --git a/src/Gui/MainWindow/MainWindow.h b/src/Gui/MainWindow/MainWindow.h index 2f70e44..e270f90 100644 --- a/src/Gui/MainWindow/MainWindow.h +++ b/src/Gui/MainWindow/MainWindow.h @@ -1,7 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers -// Copyright (c) 2020, The Talleo developers +// Copyright (c) 2020-2023, The Talleo developers // // This file is part of Bytecoin. // @@ -62,6 +62,7 @@ class MainWindow : public QMainWindow, public IWalletAdapterObserver, public IAp // IWalletAdapterObserver Q_SLOT virtual void walletOpened() override; Q_SLOT virtual void walletOpenError(int _initStatus) override; + Q_SLOT virtual void walletRepairStarted() override; Q_SLOT virtual void walletClosed() override; Q_SLOT virtual void passwordChanged() override; Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override; @@ -124,6 +125,7 @@ class MainWindow : public QMainWindow, public IWalletAdapterObserver, public IAp Q_SLOT void openWallet(); Q_SLOT void backupWallet(); Q_SLOT void saveWalletKeys(); + Q_SLOT void repairWallet(); Q_SLOT void resetWallet(); Q_SLOT void encryptWallet(); Q_SLOT void exportKey(); diff --git a/src/Gui/MainWindow/MainWindow.ui b/src/Gui/MainWindow/MainWindow.ui index 65c97ae..26aabe9 100644 --- a/src/Gui/MainWindow/MainWindow.ui +++ b/src/Gui/MainWindow/MainWindow.ui @@ -844,7 +844,7 @@ 0 0 1273 - 18 + 22 @@ -873,6 +873,7 @@ + @@ -1068,6 +1069,11 @@ Report an issue + + + Repair wallet + + Reset wallet @@ -1586,6 +1592,22 @@ + + m_repairAction + triggered() + MainWindow + repairWallet() + + + -1 + -1 + + + 629 + 404 + + + m_resetAction triggered() @@ -1669,6 +1691,7 @@ importSeed() communityForumTriggered() reportIssueTriggered() + repairWallet() resetWallet() saveWalletKeys() exportKey() diff --git a/src/Gui/MainWindow/WalletStatusBar.cpp b/src/Gui/MainWindow/WalletStatusBar.cpp index d61a206..30d7a74 100644 --- a/src/Gui/MainWindow/WalletStatusBar.cpp +++ b/src/Gui/MainWindow/WalletStatusBar.cpp @@ -1,7 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers -// Copyright (c) 2020, The Talleo developers +// Copyright (c) 2020-2023, The Talleo developers // // This file is part of Bytecoin. // @@ -163,6 +163,10 @@ void WalletStatusBar::walletOpenError(int _initStatus) { m_walletIsSynchronized = false; } +void WalletStatusBar::walletRepairStarted() { + showMessage(tr("Repairing wallet...")); +} + void WalletStatusBar::walletClosed() { if (m_checkSyncStateTimerId != -1) { killTimer(m_checkSyncStateTimerId); diff --git a/src/Gui/MainWindow/WalletStatusBar.h b/src/Gui/MainWindow/WalletStatusBar.h index 93c1cec..ed7172a 100644 --- a/src/Gui/MainWindow/WalletStatusBar.h +++ b/src/Gui/MainWindow/WalletStatusBar.h @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -47,6 +48,7 @@ class WalletStatusBar : public QStatusBar, public IWalletUiItem, public IWalletA // IWalletAdapterObserver Q_SLOT virtual void walletOpened() override; Q_SLOT virtual void walletOpenError(int _initStatus) override; + Q_SLOT virtual void walletRepairStarted() override; Q_SLOT virtual void walletClosed() override; Q_SLOT virtual void passwordChanged() override; Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override; diff --git a/src/Gui/NoWallet/NoWalletFrame.cpp b/src/Gui/NoWallet/NoWalletFrame.cpp index 3c27824..e46aa45 100644 --- a/src/Gui/NoWallet/NoWalletFrame.cpp +++ b/src/Gui/NoWallet/NoWalletFrame.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018-2019, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -96,6 +97,10 @@ void NoWalletFrame::walletOpenError(int _initStatus) { m_ui->m_passwordEdit->setFocus(); } +void NoWalletFrame::walletRepairStarted() { + // Do nothing +} + void NoWalletFrame::walletClosed() { setEnabled(true); m_ui->m_passwordEdit->setFocus(); diff --git a/src/Gui/NoWallet/NoWalletFrame.h b/src/Gui/NoWallet/NoWalletFrame.h index da99de8..0d48da3 100644 --- a/src/Gui/NoWallet/NoWalletFrame.h +++ b/src/Gui/NoWallet/NoWalletFrame.h @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -48,6 +49,7 @@ class NoWalletFrame : public QFrame, public IWalletUiItem, public IWalletAdapter // IWalletAdapterObserver Q_SLOT virtual void walletOpened() override; Q_SLOT virtual void walletOpenError(int _initStatus) override; + Q_SLOT virtual void walletRepairStarted() override; Q_SLOT virtual void walletClosed() override; Q_SLOT virtual void passwordChanged() override; Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override; diff --git a/src/Gui/Send/SendFrame.cpp b/src/Gui/Send/SendFrame.cpp index d7be7a8..8e9203b 100644 --- a/src/Gui/Send/SendFrame.cpp +++ b/src/Gui/Send/SendFrame.cpp @@ -1,7 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018-2019, The Bittorium developers -// Copyright (c) 2020, The Talleo developers +// Copyright (c) 2020-2023, The Talleo developers // // This file is part of Bytecoin. // @@ -197,6 +197,10 @@ void SendFrame::walletOpenError(int _initStatus) { // Do nothing } +void SendFrame::walletRepairStarted() { + // Do nothing +} + void SendFrame::walletClosed() { clearAll(); } diff --git a/src/Gui/Send/SendFrame.h b/src/Gui/Send/SendFrame.h index 03f6320..ace906c 100644 --- a/src/Gui/Send/SendFrame.h +++ b/src/Gui/Send/SendFrame.h @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -61,6 +62,7 @@ class SendFrame : public QFrame, public IWalletUiItem, public IWalletAdapterObse // IWalletAdapterObserver Q_SLOT virtual void walletOpened() override; Q_SLOT virtual void walletOpenError(int _initStatus) override; + Q_SLOT virtual void walletRepairStarted() override; Q_SLOT virtual void walletClosed() override; Q_SLOT virtual void passwordChanged() override; Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override; diff --git a/src/Gui/Transactions/TransactionsDelegate.cpp b/src/Gui/Transactions/TransactionsDelegate.cpp index c02a7b2..21504a6 100644 --- a/src/Gui/Transactions/TransactionsDelegate.cpp +++ b/src/Gui/Transactions/TransactionsDelegate.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -115,6 +116,10 @@ void TransactionsDelegate::walletOpenError(int _initStatus) { // Do nothing } +void TransactionsDelegate::walletRepairStarted() { + // Do nothing +} + void TransactionsDelegate::walletClosed() { // Do nothing } diff --git a/src/Gui/Transactions/TransactionsDelegate.h b/src/Gui/Transactions/TransactionsDelegate.h index c66d1c2..75eb190 100644 --- a/src/Gui/Transactions/TransactionsDelegate.h +++ b/src/Gui/Transactions/TransactionsDelegate.h @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -44,6 +45,7 @@ class TransactionsDelegate : public QStyledItemDelegate, public IWalletAdapterOb // IWalletAdapterObserver Q_SLOT virtual void walletOpened() override; Q_SLOT virtual void walletOpenError(int _initStatus) override; + Q_SLOT virtual void walletRepairStarted() override; Q_SLOT virtual void walletClosed() override; Q_SLOT virtual void passwordChanged() override; Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override; diff --git a/src/Models/TransactionsModel.cpp b/src/Models/TransactionsModel.cpp index beeaab7..a3e6ae8 100644 --- a/src/Models/TransactionsModel.cpp +++ b/src/Models/TransactionsModel.cpp @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -230,6 +231,10 @@ void TransactionsModel::walletOpenError(int _initStatus) { // Do nothing } +void TransactionsModel::walletRepairStarted() { + // Do nothing +} + void TransactionsModel::walletClosed() { ensureSyncTimerStopped(); beginResetModel(); @@ -374,6 +379,8 @@ QVariant TransactionsModel::getDisplayRoleData(const QModelIndex &_index) const return tr("Failed"); } else if (transactionState == CryptoNote::WalletTransactionState::CANCELLED) { return tr("Cancelled"); + } else if (transactionState == CryptoNote::WalletTransactionState::DELETED) { + return tr("Deleted"); } quint32 transactionConfirmationCount = _index.data(ROLE_NUMBER_OF_CONFIRMATIONS).value(); diff --git a/src/Models/TransactionsModel.h b/src/Models/TransactionsModel.h index 8c41791..fdadd2f 100644 --- a/src/Models/TransactionsModel.h +++ b/src/Models/TransactionsModel.h @@ -1,6 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers +// Copyright (c) 2023, The Talleo developers // // This file is part of Bytecoin. // @@ -70,6 +71,7 @@ class TransactionsModel : public QAbstractItemModel, public IWalletAdapterObserv // IWalletAdapterObserver Q_SLOT virtual void walletOpened() override; Q_SLOT virtual void walletOpenError(int _initStatus) override; + Q_SLOT virtual void walletRepairStarted() override; Q_SLOT virtual void walletClosed() override; Q_SLOT virtual void passwordChanged() override; Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override; diff --git a/src/Models/WalletStateModel.cpp b/src/Models/WalletStateModel.cpp index d635efb..167a3a3 100644 --- a/src/Models/WalletStateModel.cpp +++ b/src/Models/WalletStateModel.cpp @@ -1,7 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers -// Copyright (c) 2020, The Talleo developers +// Copyright (c) 2020-2023, The Talleo developers // // This file is part of Bytecoin. // @@ -133,6 +133,10 @@ void WalletStateModel::walletOpenError(int _initStatus) { // Do nothing } +void WalletStateModel::walletRepairStarted() { + // Do nothing +} + void WalletStateModel::walletClosed() { m_isOpen = false; m_isEncrypted = false; diff --git a/src/Models/WalletStateModel.h b/src/Models/WalletStateModel.h index ac3c837..851b96e 100644 --- a/src/Models/WalletStateModel.h +++ b/src/Models/WalletStateModel.h @@ -1,7 +1,7 @@ // Copyright (c) 2015-2018, The Bytecoin developers // Copyright (c) 2018, The PinkstarcoinV2 developers // Copyright (c) 2018, The Bittorium developers -// Copyright (c) 2020, The Talleo developers +// Copyright (c) 2020-2023, The Talleo developers // // This file is part of Bytecoin. // @@ -58,6 +58,7 @@ class WalletStateModel : public QAbstractItemModel, public IWalletAdapterObserve // IWalletAdapterObserver Q_SLOT virtual void walletOpened() override; Q_SLOT virtual void walletOpenError(int _initStatus) override; + Q_SLOT virtual void walletRepairStarted() override; Q_SLOT virtual void walletClosed() override; Q_SLOT virtual void passwordChanged() override; Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override; diff --git a/src/TalleoWallet.manifest.in b/src/TalleoWallet.manifest.in new file mode 100644 index 0000000..d972764 --- /dev/null +++ b/src/TalleoWallet.manifest.in @@ -0,0 +1,40 @@ + + + + + Talleo GUI Wallet + + + + + + + + + + + + + + + + + + + + + + +