From e252b816e272d7992490efc6b57d787bfe59fc1b Mon Sep 17 00:00:00 2001 From: valiant1x Date: Fri, 26 Jan 2018 01:42:13 -0500 Subject: [PATCH] add 'Export secret keys' menu option for XMR rebase wallet imports --- cryptonote | 2 +- src/Gui/Common/KeyDialog.cpp | 365 ++++--- src/Gui/Common/KeyDialog.h | 107 +- src/Gui/MainWindow/MainWindow.cpp | 1639 ++++++++++++++-------------- src/Gui/MainWindow/MainWindow.h | 289 ++--- src/Gui/MainWindow/ui_MainWindow.h | 1405 ++++++++++++------------ 6 files changed, 1930 insertions(+), 1877 deletions(-) diff --git a/cryptonote b/cryptonote index ace3cd800..726637cdc 160000 --- a/cryptonote +++ b/cryptonote @@ -1 +1 @@ -Subproject commit ace3cd80097beb96f81f2f74bf66e7376b2442aa +Subproject commit 726637cdc747ac73ca7a41195847f8718a6f96b4 diff --git a/src/Gui/Common/KeyDialog.cpp b/src/Gui/Common/KeyDialog.cpp index 0a071e0c7..2d02bc190 100644 --- a/src/Gui/Common/KeyDialog.cpp +++ b/src/Gui/Common/KeyDialog.cpp @@ -1,172 +1,193 @@ -// Copyright (c) 2015-2017, The Bytecoin developers -// -// This file is part of Bytecoin. -// -// Intensecoin is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Intensecoin is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Intensecoin. If not, see . - -#include -#include - -#include "KeyDialog.h" -#include "IWalletAdapter.h" -#include "Settings/Settings.h" -#include "Style/Style.h" -#include "ui_KeyDialog.h" - -namespace WalletGui { - -namespace { - -const char KEY_DIALOG_STYLE_SHEET_TEMPLATE[] = - "* {" - "font-family: %fontFamily%;" - "}" - - "WalletGui--KeyDialog #m_keyEdit {" - "font-size: %fontSizeNormal%;" - "border-radius: 2px;" - "border: 1px solid %borderColorDark%;" - "}"; - -bool isTrackingKeys(const QByteArray& _array) { - if (_array.size() < sizeof(AccountKeys)) { - return false; - } - - AccountKeys accountKeys; - QDataStream trackingKeysDataStream(_array); - trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.spendKeys.publicKey), sizeof(Crypto::PublicKey)); - trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.viewKeys.publicKey), sizeof(Crypto::PublicKey)); - trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.spendKeys.secretKey), sizeof(Crypto::SecretKey)); - trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.viewKeys.secretKey), sizeof(Crypto::SecretKey)); - return (std::memcmp(&accountKeys.spendKeys.secretKey, &CryptoNote::NULL_SECRET_KEY, sizeof(Crypto::SecretKey)) == 0); -} - -} - -KeyDialog::KeyDialog(const QByteArray& _key, bool _isTracking, QWidget *_parent) - : QDialog(_parent, static_cast(Qt::WindowCloseButtonHint)) - , m_ui(new Ui::KeyDialog) - , m_isTracking(_isTracking) - , m_isExport(true) - , m_key(_key) { - m_ui->setupUi(this); - setWindowTitle(m_isTracking ? tr("Export tracking key") : tr("Export key")); - m_ui->m_fileButton->setText(tr("Save to file")); - m_ui->m_okButton->setText(tr("Close")); - m_ui->m_keyEdit->setReadOnly(true); - m_ui->m_keyEdit->setPlainText(m_key.toHex().toUpper()); - if (m_isTracking) { - m_ui->m_descriptionLabel->setText(tr("Tracking key allows other people to see all incoming transactions of this wallet.\n" - "It doesn't allow spending your funds.")); - } - - m_ui->m_cancelButton->hide(); - setFixedHeight(195); - setStyleSheet(Settings::instance().getCurrentStyle().makeStyleSheet(KEY_DIALOG_STYLE_SHEET_TEMPLATE)); -} - -KeyDialog::KeyDialog(QWidget* _parent) - : QDialog(_parent, static_cast(Qt::WindowCloseButtonHint)) - , m_ui(new Ui::KeyDialog) - , m_isTracking(false) - , m_isExport(false) { - m_ui->setupUi(this); - setWindowTitle(m_isTracking ? tr("Import tracking key") : tr("Import key")); - m_ui->m_fileButton->setText(tr("Load from file")); - if (m_isTracking) { - m_ui->m_descriptionLabel->setText(tr("Import a tracking key of a wallet to see all its incoming transactions.\n" - "It doesn't allow spending funds.")); - } - - setFixedHeight(195); -} - -KeyDialog::~KeyDialog() { -} - -QByteArray KeyDialog::getKey() const { - return QByteArray::fromHex(m_ui->m_keyEdit->toPlainText().toLatin1()); -} - -void KeyDialog::saveKey() { - QString filePath = QFileDialog::getSaveFileName(this, m_isTracking ? tr("Save tracking key to...") : tr("Save key to..."), -#ifdef Q_OS_WIN - QApplication::applicationDirPath(), -#else - QDir::homePath(), -#endif - m_isTracking ? tr("Tracking key (*.trackingkey)") : tr("Wallet key (*.walletkey)")); - if (filePath.isEmpty()) { - return; - } - - if (m_isTracking && !filePath.endsWith(".trackingkey")) { - filePath.append(".trackingkey"); - } else if (!m_isTracking && !filePath.endsWith(".walletkey")) { - filePath.append(".walletkey"); - } - - QFile keyFile(filePath); - if (!keyFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - return; - } - - keyFile.write(m_key); - keyFile.close(); -} - -void KeyDialog::loadKey() { - QString filePath = QFileDialog::getOpenFileName(this, m_isTracking ? tr("Load tracking key from...") : tr("Load key from..."), -#ifdef Q_OS_WIN - QApplication::applicationDirPath(), -#else - QDir::homePath(), -#endif - m_isTracking ? tr("Tracking key (*.trackingkey)") : tr("Wallet key (*.walletkey)")); - if (filePath.isEmpty()) { - return; - } - - QFile keyFile(filePath); - if (!keyFile.open(QIODevice::ReadOnly)) { - return; - } - - m_key = keyFile.readAll(); - keyFile.close(); - m_ui->m_keyEdit->setPlainText(m_key.toHex().toUpper()); -} - -void KeyDialog::fileClicked() { - if (m_isExport) { - saveKey(); - accept(); - } else { - loadKey(); - } -} - -void KeyDialog::keyChanged() { - m_isTracking = isTrackingKeys(getKey()); - setWindowTitle(m_isTracking ? tr("Import tracking key") : tr("Import key")); - if (m_isTracking) { - m_ui->m_descriptionLabel->setText(tr("Import a tracking key of a wallet to see all its incoming transactions.\n" - "It doesn't allow spending funds.")); - } else { - m_ui->m_descriptionLabel->clear(); - } -} - -} +// Copyright (c) 2015-2017, The Bytecoin developers +// +// This file is part of Bytecoin. +// +// Intensecoin is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Intensecoin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Intensecoin. If not, see . + +#include +#include + +#include "KeyDialog.h" +#include "IWalletAdapter.h" +#include "Settings/Settings.h" +#include "Style/Style.h" +#include "ui_KeyDialog.h" + +namespace WalletGui { + +namespace { + +const char KEY_DIALOG_STYLE_SHEET_TEMPLATE[] = + "* {" + "font-family: %fontFamily%;" + "}" + + "WalletGui--KeyDialog #m_keyEdit {" + "font-size: %fontSizeNormal%;" + "border-radius: 2px;" + "border: 1px solid %borderColorDark%;" + "}"; + +bool isTrackingKeys(const QByteArray& _array) { + if (_array.size() < sizeof(AccountKeys)) { + return false; + } + + AccountKeys accountKeys; + QDataStream trackingKeysDataStream(_array); + trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.spendKeys.publicKey), sizeof(Crypto::PublicKey)); + trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.viewKeys.publicKey), sizeof(Crypto::PublicKey)); + trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.spendKeys.secretKey), sizeof(Crypto::SecretKey)); + trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.viewKeys.secretKey), sizeof(Crypto::SecretKey)); + return (std::memcmp(&accountKeys.spendKeys.secretKey, &CryptoNote::NULL_SECRET_KEY, sizeof(Crypto::SecretKey)) == 0); +} + +} + +KeyDialog::KeyDialog(const QByteArray& _key, bool _isTracking, QWidget *_parent) + : QDialog(_parent, static_cast(Qt::WindowCloseButtonHint)) + , m_ui(new Ui::KeyDialog) + , m_isTracking(_isTracking) + , m_isExport(true) + , m_key(_key) { + m_ui->setupUi(this); + m_ui->m_fileButton->setText(tr("Save to file")); + m_ui->m_okButton->setText(tr("Close")); + m_ui->m_keyEdit->setReadOnly(true); + m_ui->m_keyEdit->setPlainText(m_key.toHex().toUpper()); + if (m_isTracking) { + m_ui->m_descriptionLabel->setText(tr("Tracking key allows other people to see all incoming transactions of this wallet.\n" + "It doesn't allow spending your funds.")); + } + + m_ui->m_cancelButton->hide(); + setFixedHeight(195); + setStyleSheet(Settings::instance().getCurrentStyle().makeStyleSheet(KEY_DIALOG_STYLE_SHEET_TEMPLATE)); + setWindowTitle(m_isTracking ? tr("Export tracking key") : tr("Export key")); +} + +KeyDialog::KeyDialog(const QByteArray& _key, bool _isTracking, bool _isPrivateKeyExport, QWidget *_parent) + : QDialog(_parent, static_cast(Qt::WindowCloseButtonHint)) + , m_ui(new Ui::KeyDialog) + , m_isTracking(_isTracking) + , m_isExport(true) + , m_key(_key) { + m_ui->setupUi(this); + m_ui->m_fileButton->setText(tr("Save to file")); + m_ui->m_okButton->setText(tr("Close")); + m_ui->m_keyEdit->setReadOnly(true); + m_ui->m_keyEdit->setPlainText("Secret spend key:\n" + m_key.toHex().toUpper().mid(0,64) + "\n\nSecret view key:\n" + m_key.toHex().toUpper().mid(64)); + if (_isPrivateKeyExport) { + m_ui->m_descriptionLabel->setText(tr("These keys allow restoration of your wallet in new wallet software version 1.4.2 and above.")); + } + + m_ui->m_cancelButton->hide(); + setFixedHeight(195); + setStyleSheet(Settings::instance().getCurrentStyle().makeStyleSheet(KEY_DIALOG_STYLE_SHEET_TEMPLATE)); + setWindowTitle(tr("Export secret keys")); +} + +KeyDialog::KeyDialog(QWidget* _parent) + : QDialog(_parent, static_cast(Qt::WindowCloseButtonHint)) + , m_ui(new Ui::KeyDialog) + , m_isTracking(false) + , m_isExport(false) { + m_ui->setupUi(this); + setWindowTitle(m_isTracking ? tr("Import tracking key") : tr("Import key")); + m_ui->m_fileButton->setText(tr("Load from file")); + if (m_isTracking) { + m_ui->m_descriptionLabel->setText(tr("Import a tracking key of a wallet to see all its incoming transactions.\n" + "It doesn't allow spending funds.")); + } + + setFixedHeight(195); +} + +KeyDialog::~KeyDialog() { +} + +QByteArray KeyDialog::getKey() const { + return QByteArray::fromHex(m_ui->m_keyEdit->toPlainText().toLatin1()); +} + +void KeyDialog::saveKey() { + QString filePath = QFileDialog::getSaveFileName(this, m_isTracking ? tr("Save tracking key to...") : tr("Save key to..."), +#ifdef Q_OS_WIN + QApplication::applicationDirPath(), +#else + QDir::homePath(), +#endif + m_isTracking ? tr("Tracking key (*.trackingkey)") : tr("Wallet key (*.walletkey)")); + if (filePath.isEmpty()) { + return; + } + + if (m_isTracking && !filePath.endsWith(".trackingkey")) { + filePath.append(".trackingkey"); + } else if (!m_isTracking && !filePath.endsWith(".walletkey")) { + filePath.append(".walletkey"); + } + + QFile keyFile(filePath); + if (!keyFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) { + return; + } + + keyFile.write(m_key); + keyFile.close(); +} + +void KeyDialog::loadKey() { + QString filePath = QFileDialog::getOpenFileName(this, m_isTracking ? tr("Load tracking key from...") : tr("Load key from..."), +#ifdef Q_OS_WIN + QApplication::applicationDirPath(), +#else + QDir::homePath(), +#endif + m_isTracking ? tr("Tracking key (*.trackingkey)") : tr("Wallet key (*.walletkey)")); + if (filePath.isEmpty()) { + return; + } + + QFile keyFile(filePath); + if (!keyFile.open(QIODevice::ReadOnly)) { + return; + } + + m_key = keyFile.readAll(); + keyFile.close(); + m_ui->m_keyEdit->setPlainText(m_key.toHex().toUpper()); +} + +void KeyDialog::fileClicked() { + if (m_isExport) { + saveKey(); + accept(); + } else { + loadKey(); + } +} + +void KeyDialog::keyChanged() { + m_isTracking = isTrackingKeys(getKey()); + setWindowTitle(m_isTracking ? tr("Import tracking key") : tr("Import key")); + if (m_isTracking) { + m_ui->m_descriptionLabel->setText(tr("Import a tracking key of a wallet to see all its incoming transactions.\n" + "It doesn't allow spending funds.")); + } else { + m_ui->m_descriptionLabel->clear(); + } +} + +} diff --git a/src/Gui/Common/KeyDialog.h b/src/Gui/Common/KeyDialog.h index 550968605..c558b9c48 100644 --- a/src/Gui/Common/KeyDialog.h +++ b/src/Gui/Common/KeyDialog.h @@ -1,53 +1,54 @@ -// Copyright (c) 2015-2017, The Bytecoin developers -// -// This file is part of Bytecoin. -// -// Intensecoin is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Intensecoin is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Intensecoin. If not, see . - -#pragma once - -#include - -namespace Ui { - class KeyDialog; -} - -namespace WalletGui { - -class KeyDialog - : public QDialog { - Q_OBJECT - Q_DISABLE_COPY(KeyDialog) - -public: - KeyDialog(const QByteArray& _key, bool _isTracking, QWidget *_parent); - KeyDialog(QWidget *_parent); - ~KeyDialog(); - - QByteArray getKey() const; - -private: - QScopedPointer m_ui; - bool m_isTracking; - bool m_isExport; - QByteArray m_key; - - void saveKey(); - void loadKey(); - - Q_SLOT void fileClicked(); - Q_SLOT void keyChanged(); -}; - -} +// Copyright (c) 2015-2017, The Bytecoin developers +// +// This file is part of Bytecoin. +// +// Intensecoin is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Intensecoin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Intensecoin. If not, see . + +#pragma once + +#include + +namespace Ui { + class KeyDialog; +} + +namespace WalletGui { + +class KeyDialog + : public QDialog { + Q_OBJECT + Q_DISABLE_COPY(KeyDialog) + +public: + KeyDialog(const QByteArray& _key, bool _isTracking, QWidget *_parent); + KeyDialog(const QByteArray& _key, bool _isTracking, bool _isPrivateKeyExport, QWidget *_parent); + KeyDialog(QWidget *_parent); + ~KeyDialog(); + + QByteArray getKey() const; + +private: + QScopedPointer m_ui; + bool m_isTracking; + bool m_isExport; + QByteArray m_key; + + void saveKey(); + void loadKey(); + + Q_SLOT void fileClicked(); + Q_SLOT void keyChanged(); +}; + +} diff --git a/src/Gui/MainWindow/MainWindow.cpp b/src/Gui/MainWindow/MainWindow.cpp index 818fe39ee..f0537402e 100644 --- a/src/Gui/MainWindow/MainWindow.cpp +++ b/src/Gui/MainWindow/MainWindow.cpp @@ -1,808 +1,831 @@ -// Copyright (c) 2015-2017, The Bytecoin developers -// -// This file is part of Bytecoin. -// -// Intensecoin is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Intensecoin is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Intensecoin. If not, see . - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "MainWindow.h" -#include "Settings/Settings.h" -#include "WalletLogger/WalletLogger.h" -#include "Gui/Common/AboutDialog.h" -#include "Gui/Common/ChangePasswordDialog.h" -#include "Gui/Common/NewPasswordDialog.h" -#include "Gui/Common/KeyDialog.h" -#include "Gui/Common/QuestionDialog.h" -#include "ICryptoNoteAdapter.h" -#include "INodeAdapter.h" -#include "Models/AddressBookModel.h" -#include "Models/BlockchainModel.h" -#include "Models/FusionTransactionsFilterModel.h" -#include "Models/MinerModel.h" -#include "Models/NodeStateModel.h" -#include "Models/SortedAddressBookModel.h" -#include "Models/SortedTransactionsModel.h" -#include "Models/TransactionsModel.h" -#include "Models/TransactionPoolModel.h" -#include "Models/WalletStateModel.h" -#include "Gui/Options/OptionsDialog.h" -#include "Style/Style.h" - -#include "ui_MainWindow.h" - -namespace WalletGui { - -namespace { - -const int MAX_RECENT_WALLET_COUNT = 10; -const char COMMUNITY_FORUM_URL[] = "https://intense-coin.herokuapp.com"; -const char REPORT_ISSUE_URL[] = "https://intensecoin.com/#contact"; - -const char DONATION_URL_DONATION_TAG[] = "donation"; -const char DONATION_URL_LABEL_TAG[] = "label"; - -QByteArray convertAccountKeysToByteArray(const AccountKeys& _accountKeys) { - QByteArray spendPublicKey(reinterpret_cast(&_accountKeys.spendKeys.publicKey), sizeof(Crypto::PublicKey)); - QByteArray viewPublicKey(reinterpret_cast(&_accountKeys.viewKeys.publicKey), sizeof(Crypto::PublicKey)); - QByteArray spendPrivateKey(reinterpret_cast(&_accountKeys.spendKeys.secretKey), sizeof(Crypto::SecretKey)); - QByteArray viewPrivateKey(reinterpret_cast(&_accountKeys.viewKeys.secretKey), sizeof(Crypto::SecretKey)); - QByteArray trackingKeys; - trackingKeys.append(spendPublicKey).append(viewPublicKey).append(spendPrivateKey).append(viewPrivateKey); - return trackingKeys; -} - -AccountKeys convertByteArrayToAccountKeys(const QByteArray& _array) { - AccountKeys accountKeys; - QDataStream trackingKeysDataStream(_array); - trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.spendKeys.publicKey), sizeof(Crypto::PublicKey)); - trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.viewKeys.publicKey), sizeof(Crypto::PublicKey)); - trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.spendKeys.secretKey), sizeof(Crypto::SecretKey)); - trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.viewKeys.secretKey), sizeof(Crypto::SecretKey)); - return accountKeys; -} - -bool isDonationUrl(const QUrl& _url) { - QUrlQuery urlQuery(_url); - if(!urlQuery.hasQueryItem(DONATION_URL_DONATION_TAG)) { - return false; - } - - return (urlQuery.queryItemValue(DONATION_URL_DONATION_TAG).compare("true", Qt::CaseInsensitive) == 0); -} - -} - -MainWindow::MainWindow(ICryptoNoteAdapter* _cryptoNoteAdapter, IAddressBookManager* _addressBookManager, - IDonationManager* _donationManager, IOptimizationManager* _optimizationManager, IMiningManager* _miningManager, - IApplicationEventHandler* _applicationEventHandler, INewsReader* _blogReader, const QString& _styleSheetTemplate, QWidget* _parent) : - QMainWindow(_parent), m_ui(new Ui::MainWindow), m_cryptoNoteAdapter(_cryptoNoteAdapter), - m_addressBookManager(_addressBookManager), m_donationManager(_donationManager), - m_optimizationManager(_optimizationManager), m_miningManager(_miningManager), m_applicationEventHandler(_applicationEventHandler), - m_blogReader(_blogReader), m_blockChainModel(nullptr), m_transactionPoolModel(nullptr), m_recentWalletsMenu(new QMenu(this)), - m_addRecipientAction(new QAction(this)), m_styleSheetTemplate(_styleSheetTemplate), m_walletStateMapper(new QDataWidgetMapper(this)), - m_syncMovie(new QMovie(Settings::instance().getCurrentStyle().getWalletSyncGifFile(), QByteArray(), this)) { - m_ui->setupUi(this); - setWindowTitle(tr("Intensecoin Wallet %1").arg(Settings::instance().getVersion())); - m_addRecipientAction->setObjectName("m_addRecipientAction"); - m_cryptoNoteAdapter->addObserver(this); - m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter()->addObserver(this); - m_applicationEventHandler->addObserver(this); - addActions(QList() << m_ui->m_createWalletAction << m_ui->m_openWalletAction); - - m_nodeStateModel = new NodeStateModel(m_cryptoNoteAdapter, this); - m_walletStateModel = new WalletStateModel(m_cryptoNoteAdapter, this); - m_transactionsModel = new TransactionsModel(m_cryptoNoteAdapter, m_optimizationManager, m_nodeStateModel, this); - m_sortedTranactionsModel = new SortedTransactionsModel(m_transactionsModel, this); - m_fusionTranactionsFilterModel = new FusionTransactionsFilterModel(m_sortedTranactionsModel, m_optimizationManager, this); - m_addressBookModel = new AddressBookModel(m_addressBookManager, this); - m_sortedAddressBookModel = new SortedAddressBookModel(m_addressBookModel, this); - m_blockChainModel = new BlockchainModel(m_cryptoNoteAdapter, m_nodeStateModel, this); - m_transactionPoolModel = new TransactionPoolModel(m_cryptoNoteAdapter, this); - m_minerModel = new MinerModel(m_miningManager, this); - - QList uiItems; - uiItems << m_ui->m_noWalletFrame << m_ui->m_overviewFrame << m_ui->m_sendFrame << m_ui->m_transactionsFrame << - m_ui->m_blockExplorerFrame << m_ui->m_addressBookFrame << m_ui->m_miningFrame << m_ui->statusBar; - for (auto& uiItem : uiItems) { - uiItem->setCryptoNoteAdapter(m_cryptoNoteAdapter); - uiItem->setAddressBookManager(m_addressBookManager); - uiItem->setDonationManager(m_donationManager); - uiItem->setMiningManager(m_miningManager); - uiItem->setApplicationEventHandler(m_applicationEventHandler); - uiItem->setBlogReader(m_blogReader); - uiItem->setMainWindow(this); - uiItem->setNodeStateModel(m_nodeStateModel); - uiItem->setWalletStateModel(m_walletStateModel); - uiItem->setTransactionsModel(m_transactionsModel); - uiItem->setSortedTransactionsModel(m_fusionTranactionsFilterModel); - uiItem->setAddressBookModel(m_addressBookModel); - uiItem->setSortedAddressBookModel(m_sortedAddressBookModel); - uiItem->setBlockChainModel(m_blockChainModel); - uiItem->setTransactionPoolModel(m_transactionPoolModel); - uiItem->setMinerModel(m_minerModel); - } - - if (!Settings::instance().isSystemTrayAvailable() && QSystemTrayIcon::isSystemTrayAvailable()) { - m_ui->m_minimizeToTrayAction->deleteLater(); - m_ui->m_closeToTrayAction->deleteLater(); - } else { - m_ui->m_minimizeToTrayAction->setChecked(Settings::instance().isMinimizeToTrayEnabled()); - m_ui->m_closeToTrayAction->setChecked(Settings::instance().isCloseToTrayEnabled()); - } - - createRecentWalletMenu(); - m_ui->m_addressLabel->installEventFilter(this); - m_ui->m_balanceLabel->installEventFilter(this); - m_walletStateMapper->setModel(m_walletStateModel); - m_walletStateMapper->addMapping(m_ui->m_balanceFrame, WalletStateModel::COLUMN_IS_OPEN, "visible"); - m_walletStateMapper->addMapping(m_ui->m_walletFrame, WalletStateModel::COLUMN_IS_OPEN, "visible"); - m_walletStateMapper->addMapping(m_ui->m_noWalletLabel, WalletStateModel::COLUMN_IS_CLOSED, "visible"); - m_walletStateMapper->addMapping(m_ui->m_notEncryptedFrame, WalletStateModel::COLUMN_IS_NOT_ENCRYPTED, "visible"); - m_walletStateMapper->addMapping(m_ui->m_addressLabel, WalletStateModel::COLUMN_ADDRESS, "text"); - m_walletStateMapper->addMapping(m_ui->m_balanceLabel, WalletStateModel::COLUMN_TOTAL_BALANCE, "text"); - m_walletStateMapper->setCurrentIndex(0); - - setClosedState(); - if (QFile::exists(Settings::instance().getWalletFile())) { - m_ui->m_noWalletFrame->openWallet(Settings::instance().getWalletFile(), QString()); - } else { - m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter()->create(Settings::instance().getWalletFile(), ""); - } - - m_ui->m_balanceIconLabel->setPixmap(Settings::instance().getCurrentStyle().getBalanceIcon()); - m_ui->m_logoLabel->setPixmap(Settings::instance().getCurrentStyle().getLogoPixmap()); - QActionGroup* themeActionGroup = new QActionGroup(this); - quintptr styleCount = Settings::instance().getStyleCount(); - for (quintptr i = 0; i < styleCount; ++i) { - const Style& style = Settings::instance().getStyle(i); - QAction* styleAction = m_ui->menuThemes->addAction(style.getStyleName()); - styleAction->setData(style.getStyleId()); - styleAction->setCheckable(true); - if (style.getStyleId() == Settings::instance().getCurrentTheme()) { - styleAction->setChecked(true); - } - - themeActionGroup->addAction(styleAction); - connect(styleAction, &QAction::triggered, this, &MainWindow::themeChanged); - } - - connect(m_walletStateModel, &QAbstractItemModel::dataChanged, this, &MainWindow::walletStateModelDataChanged); - connect(m_addRecipientAction, &QAction::triggered, this, &MainWindow::addRecipientTriggered); - connect(m_ui->m_exitAction, &QAction::triggered, qApp, &QApplication::quit); - connect(qApp, &QGuiApplication::commitDataRequest, this, &MainWindow::commitData); -} - -MainWindow::~MainWindow() { -} - -bool MainWindow::eventFilter(QObject* _object, QEvent* _event) { - if (_object == m_ui->m_addressLabel && _event->type() == QEvent::MouseButtonRelease) { - copyAddress(); - } else if (_object == m_ui->m_balanceLabel && _event->type() == QEvent::MouseButtonRelease) { - copyBalance(); - } - - return false; -} - -void MainWindow::walletOpened() { - IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); - setOpenedState(); - QStringList recentWalletList = Settings::instance().getRecentWalletList(); - recentWalletList.removeAll(Settings::instance().getWalletFile()); - recentWalletList.prepend(Settings::instance().getWalletFile()); - while (recentWalletList.size() > MAX_RECENT_WALLET_COUNT) { - recentWalletList.removeLast(); - } - - Settings::instance().setRecentWalletList(recentWalletList); - updateRecentWalletActions(); - if (walletAdapter->isTrackingWallet()) { - m_ui->m_sendButton->setEnabled(false); - m_ui->m_addressBookButton->setEnabled(false); - } - - QUrl url = m_applicationEventHandler->getLastReceivedUrl(); - if (url.isValid()) { - urlReceived(url); - } -} - -void MainWindow::walletOpenError(int _initStatus) { - if (_initStatus != IWalletAdapter::INIT_SUCCESS) { - setClosedState(); - } -} - -void MainWindow::walletClosed() { - setClosedState(); -} - -void MainWindow::passwordChanged() { - IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); - if (walletAdapter->isEncrypted()) { - m_ui->m_notEncryptedFrame->hide(); - } - - m_ui->m_changePasswordAction->setEnabled(walletAdapter->isEncrypted()); - m_ui->m_encryptWalletAction->setEnabled(!walletAdapter->isEncrypted()); - walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); -} - -void MainWindow::synchronizationProgressUpdated(quint32 _current, quint32 _total) { - if (_total < _current) { - return; - } - - if (m_ui->m_removePendingTxAction->isEnabled()) - m_ui->m_removePendingTxAction->setEnabled(false); - - qreal value = static_cast(_current) / _total; - m_ui->m_syncProgress->setValue(value * m_ui->m_syncProgress->maximum()); -} - -void MainWindow::synchronizationCompleted() { - m_ui->m_syncProgress->setValue(m_ui->m_syncProgress->maximum()); - m_ui->m_removePendingTxAction->setEnabled(true); -} - -void MainWindow::balanceUpdated(quint64 _actualBalance, quint64 _pendingBalance) { - // Do nothing -} - -void MainWindow::externalTransactionCreated(quintptr _transactionId, const FullTransactionInfo& _transaction) { - // Do nothing -} - -void MainWindow::transactionUpdated(quintptr _transactionId, const FullTransactionInfo& _transaction) { - // Do nothing -} - -void MainWindow::urlReceived(const QUrl& _url) { - IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); - if (!walletAdapter->isOpen()) { - return; - } - - showNormal(); - activateWindow(); - raise(); - if (isDonationUrl(_url)) { - QUrlQuery urlQuery(_url); - QString address = _url.path(); - QString label = urlQuery.queryItemValue(DONATION_URL_LABEL_TAG); - m_addressBookManager->addAddress(label, address, true); - - OptionsDialog dlg(m_cryptoNoteAdapter, m_donationManager, m_optimizationManager, m_addressBookModel, this); - dlg.setDonationAddress(label, address); - dlg.exec(); - } else if (_url.isValid()) { - m_ui->m_sendButton->click(); - } -} - -void MainWindow::screenLocked() { - // Do nothing -} - -void MainWindow::screenUnlocked() { - // Do nothing -} - -void MainWindow::cryptoNoteAdapterInitCompleted(int _status) { - setEnabled(true); - if (_status == 0) { - m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter()->addObserver(this); - if (QFile::exists(Settings::instance().getWalletFile())) { - m_ui->m_noWalletFrame->openWallet(Settings::instance().getWalletFile(), QString()); - } - } -} - -void MainWindow::cryptoNoteAdapterDeinitCompleted() { - -} - -void MainWindow::changeEvent(QEvent* _event) { - QMainWindow::changeEvent(_event); - switch (_event->type()) { - case QEvent::WindowStateChange: - if(isMinimized() && Settings::instance().isMinimizeToTrayEnabled()) { - hide(); - } - - break; - default: - break; - } - - QMainWindow::changeEvent(_event); -} - -void MainWindow::closeEvent(QCloseEvent* _event) { -#ifndef Q_OS_MAC - if (!Settings::instance().isCloseToTrayEnabled()) { - m_ui->m_exitAction->trigger(); - } -#endif - QMainWindow::closeEvent(_event); -} - -void MainWindow::setOpenedState() { - - QList toolButtons = m_ui->m_toolButtonGroup->buttons(); - for (const auto& button : toolButtons) { - button->setChecked(false); - button->setEnabled(true); - } - - IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); - m_ui->m_backupWalletAction->setEnabled(true); - m_ui->m_resetAction->setEnabled(true); - m_ui->m_exportTrackingKeyAction->setEnabled(true); - m_ui->m_encryptWalletAction->setEnabled(!walletAdapter->isEncrypted()); - m_ui->m_changePasswordAction->setEnabled(walletAdapter->isEncrypted()); - - m_ui->m_noWalletFrame->hide(); - m_ui->m_overviewFrame->show(); - - m_ui->m_overviewButton->setChecked(true); - m_ui->m_blockExplorerButton->setEnabled(m_cryptoNoteAdapter->getNodeAdapter()->getBlockChainExplorerAdapter() != nullptr); -} - -void MainWindow::setClosedState() { - QList toolButtons = m_ui->m_toolButtonGroup->buttons(); - for (const auto& button : toolButtons) { - button->setChecked(false); - button->setEnabled(false); - } - - m_ui->m_backupWalletAction->setEnabled(false); - m_ui->m_resetAction->setEnabled(false); - m_ui->m_exportTrackingKeyAction->setEnabled(false); - m_ui->m_encryptWalletAction->setEnabled(false); - m_ui->m_changePasswordAction->setEnabled(false); - m_ui->m_removePendingTxAction->setEnabled(false); - - m_ui->m_overviewFrame->hide(); - m_ui->m_sendFrame->hide(); - m_ui->m_transactionsFrame->hide(); - m_ui->m_addressBookFrame->hide(); - m_ui->m_blockExplorerFrame->hide(); - m_ui->m_miningFrame->hide(); - m_ui->m_noWalletFrame->show(); - m_ui->m_syncProgress->setValue(0); -} - -void MainWindow::addRecipientTriggered() { - m_ui->m_sendFrame->addRecipient(m_addRecipientAction->data().toString()); - m_ui->m_sendButton->click(); -} - -void MainWindow::commitData(QSessionManager& _manager) { - WalletLogger::debug(tr("[Main window] Commit data request")); - if (m_cryptoNoteAdapter->getNodeAdapter() != nullptr) { - IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); - if (walletAdapter->isOpen()) { - walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); - } - } -} - -void MainWindow::walletStateModelDataChanged(const QModelIndex& _topLeft, const QModelIndex& _bottomRight, const QVector& _roles) { - if (_topLeft.column() == WalletStateModel::COLUMN_ABOUT_TO_BE_SYNCHRONIZED) { - bool walletAboutToBeSynchronized = _topLeft.data().toBool(); - if (!walletAboutToBeSynchronized) { - m_walletStateMapper->removeMapping(m_ui->m_balanceLabel); - m_ui->m_balanceLabel->setMovie(m_syncMovie); - m_syncMovie->start(); - m_ui->m_balanceLabel->setCursor(Qt::ArrowCursor); - m_ui->m_balanceLabel->removeEventFilter(this); - m_ui->m_balanceLabel->setToolTip(QString()); - } else { - m_syncMovie->stop(); - m_ui->m_balanceLabel->setMovie(nullptr); - m_walletStateMapper->addMapping(m_ui->m_balanceLabel, WalletStateModel::COLUMN_TOTAL_BALANCE, "text"); - m_walletStateMapper->revert(); - m_ui->m_balanceLabel->setCursor(Qt::PointingHandCursor); - m_ui->m_balanceLabel->installEventFilter(this); - m_ui->m_balanceLabel->setToolTip(tr("Click to copy")); - } - } -} - -void MainWindow::createRecentWalletMenu() { - m_ui->m_recentWalletsAction->setMenu(m_recentWalletsMenu); - for (quint32 i = 0; i < MAX_RECENT_WALLET_COUNT; ++i) { - QAction* action = new QAction(this); - action->setVisible(false); - m_recentWalletsActionList.append(action); - m_recentWalletsMenu->addAction(action); - connect(action, &QAction::triggered, this, &MainWindow::openRecentWallet); - } - - updateRecentWalletActions(); -} - -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]->setData(recentWallets[i]); - m_recentWalletsActionList[i]->setVisible(true); - } - - for (int i = recentWalletCount; i < MAX_RECENT_WALLET_COUNT; ++i) { - m_recentWalletsActionList[i]->setVisible(false); - } -} - -void MainWindow::openRecentWallet() { - QAction* action = qobject_cast(sender()); - if (action == nullptr) { - return; - } - - QString filePath = action->data().toString(); - if (!filePath.isEmpty()) { - IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); - if (walletAdapter->isOpen()) { - walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); - walletAdapter->removeObserver(this); - walletAdapter->close(); - walletAdapter->addObserver(this); - } - - m_ui->m_noWalletFrame->openWallet(filePath, QString()); - } -} - -void MainWindow::themeChanged() { - QAction* styleAction = qobject_cast(sender()); - Settings::instance().setCurrentTheme(styleAction->data().toString()); - qApp->setStyleSheet(Settings::instance().getCurrentStyle().makeStyleSheet(m_styleSheetTemplate)); - m_ui->m_balanceIconLabel->setPixmap(Settings::instance().getCurrentStyle().getBalanceIcon()); - m_ui->m_logoLabel->setPixmap(Settings::instance().getCurrentStyle().getLogoPixmap()); - m_syncMovie->stop(); - m_syncMovie->setFileName(Settings::instance().getCurrentStyle().getWalletSyncGifFile()); - m_syncMovie->start(); - QList uiItems; - uiItems << m_ui->m_noWalletFrame << m_ui->m_overviewFrame << m_ui->m_sendFrame << m_ui->m_transactionsFrame << - m_ui->m_blockExplorerFrame << m_ui->m_addressBookFrame << m_ui->m_miningFrame << m_ui->statusBar; - for (auto& uiItem : uiItems) { - uiItem->updateStyle(); - } -} - -void MainWindow::createWallet() { - QString filePath = QFileDialog::getSaveFileName(this, tr("New wallet file"), -#ifdef Q_OS_WIN - QApplication::applicationDirPath(), -#else - QDir::homePath(), -#endif - tr("Wallets (*.wallet)") - ); - - if (!filePath.isEmpty() && !filePath.endsWith(".wallet")) { - filePath.append(".wallet"); - } - - if (QFile::exists(filePath)) { - QMessageBox::warning(this, tr("Warning"), - tr("Can't overwrite existing %1 because it may lead to loss of private keys").arg(QFileInfo(filePath).fileName())); - return; - } - - IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); - if (!filePath.isEmpty()) { - if (walletAdapter->isOpen()) { - walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); - walletAdapter->removeObserver(this); - walletAdapter->close(); - walletAdapter->addObserver(this); - } - - QString oldWalletFile = Settings::instance().getWalletFile(); - Settings::instance().setWalletFile(filePath); - if (walletAdapter->create(filePath, "") == IWalletAdapter::INIT_SUCCESS) { - walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); - } else { - Settings::instance().setWalletFile(oldWalletFile); - } - } -} - -void MainWindow::openWallet() { - QString filePath = QFileDialog::getOpenFileName(this, tr("Open .wallet/.keys file"), -#ifdef Q_OS_WIN - QApplication::applicationDirPath(), -#else - QDir::homePath(), -#endif - tr("Wallet (*.wallet *.keys)")); - - QString walletFilePath = filePath; - if (!filePath.isEmpty()) { - if (filePath.endsWith(".keys")) { - walletFilePath.replace(filePath.lastIndexOf(".keys"), 5, ".wallet"); - if (QFile::exists(walletFilePath)) { - QMessageBox::warning(this, tr("Warning"), - tr("Can't overwrite existing %1 because it may lead to loss of private keys").arg(QFileInfo(walletFilePath).fileName())); - return; - } - } else { - filePath.clear(); - } - } else { - return; - } - - IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); - if (walletAdapter->isOpen()) { - walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); - walletAdapter->removeObserver(this); - walletAdapter->close(); - walletAdapter->addObserver(this); - } - - m_ui->m_noWalletFrame->openWallet(walletFilePath, filePath); -} - -void MainWindow::backupWallet() { - QString filePath = QFileDialog::getSaveFileName(this, tr("Backup wallet to..."), -#ifdef Q_OS_WIN - QApplication::applicationDirPath(), -#else - QDir::homePath(), -#endif - tr("Wallets (*.wallet)") - ); - if (!filePath.isEmpty() && !filePath.endsWith(".wallet")) { - filePath.append(".wallet"); - } - - if (QFile::exists(filePath)) { - QMessageBox::warning(this, tr("Warning"), - tr("Can't overwrite existing %1 because it may lead to loss of private keys").arg(QFileInfo(filePath).fileName())); - return; - } - - if (!filePath.isEmpty()) { - IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); - walletAdapter->exportWallet(filePath, true, CryptoNote::WalletSaveLevel::SAVE_KEYS_AND_TRANSACTIONS, false); - } -} - -void MainWindow::saveWalletKeys() { - QString filePath = QFileDialog::getSaveFileName(this, tr("Save keys to..."), -#ifdef Q_OS_WIN - QApplication::applicationDirPath(), -#else - QDir::homePath(), -#endif - tr("Wallet (*.wallet)") - ); - if (!filePath.isEmpty() && !filePath.endsWith(".wallet")) { - filePath.append(".wallet"); - } - - if (QFile::exists(filePath)) { - QMessageBox::warning(this, tr("Warning"), - tr("Can't overwrite existing %1 because it may lead to loss of private keys").arg(QFileInfo(filePath).fileName())); - return; - } - - if (!filePath.isEmpty()) { - IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); - walletAdapter->exportWallet(filePath, false, CryptoNote::WalletSaveLevel::SAVE_KEYS_ONLY, false); - } -} - -void MainWindow::resetWallet() { - QuestionDialog dlg(tr("Reset wallet?"), tr("Reset wallet to resynchronize its transactions and balance based\n" - "on the blockchain data. This operation can take some time.\n" - "Are you sure you would like to reset this wallet?"), this); - if (dlg.exec() != QDialog::Accepted) { - return; - } - - 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"))); - - walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_KEYS_ONLY, true); - walletAdapter->removeObserver(this); - walletAdapter->close(); - walletAdapter->addObserver(this); - m_ui->m_noWalletFrame->openWallet(Settings::instance().getWalletFile(), QString()); -} - -void MainWindow::removePendingTx() { - IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); - if (walletAdapter->resetPendingTransactions()) - QMessageBox::information(this, "Transactions reset", "Transactions reset successfully.", QMessageBox::Ok); - else - QMessageBox::warning(this, "Transaction reset failed", "Failed to reset transactions. Check debug log.", QMessageBox::Ok); -} - -void MainWindow::encryptWallet() { - IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); - if (walletAdapter->isEncrypted()) { - IWalletAdapter::PasswordStatus status = IWalletAdapter::PASSWORD_SUCCESS; - do { - ChangePasswordDialog dlg(status == IWalletAdapter::PASSWORD_ERROR, this); - if (dlg.exec() == QDialog::Rejected) { - return; - } - - QString oldPassword = dlg.getOldPassword(); - QString newPassword = dlg.getNewPassword(); - status = walletAdapter->changePassword(oldPassword, newPassword); - } while (status != IWalletAdapter::PASSWORD_SUCCESS); - } else { - NewPasswordDialog dlg(this); - if (dlg.exec() == QDialog::Accepted) { - QString password = dlg.getPassword(); - if (password.isEmpty()) { - return; - } - - walletAdapter->changePassword("", password); - } - } -} - -void MainWindow::exportKey() { - AccountKeys accountKeys = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter()->getAccountKeys(0); - QByteArray keys = convertAccountKeysToByteArray(accountKeys); - KeyDialog dlg(keys, false, this); - dlg.exec(); -} - -void MainWindow::exportTrackingKey() { - AccountKeys accountKeys = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter()->getAccountKeys(0); - std::memset(&accountKeys.spendKeys.secretKey, 0, sizeof(Crypto::SecretKey)); - QByteArray trackingKeys = convertAccountKeysToByteArray(accountKeys); - KeyDialog dlg(trackingKeys, true, this); - dlg.exec(); -} - -void MainWindow::importKey() { - KeyDialog dlg(this); - if (dlg.exec() == QDialog::Accepted) { - QByteArray key = dlg.getKey(); - if (key.size() != sizeof(CryptoNote::AccountKeys)) { - QMessageBox::warning(this, tr("Warning"), tr("Incorrect tracking key size")); - return; - } - - QString filePath = QFileDialog::getSaveFileName(this, tr("Save tracking wallet to..."), -#ifdef Q_OS_WIN - QApplication::applicationDirPath(), -#else - QDir::homePath(), -#endif - tr("Wallets (*.wallet)")); - if (filePath.isEmpty()) { - return; - } - - if (!filePath.endsWith(".wallet")) { - filePath.append(".wallet"); - } - - if (QFile::exists(filePath)) { - QMessageBox::warning(this, tr("Warning"), - tr("Can't overwrite existing %1 because it may lead to loss of private keys").arg(QFileInfo(filePath).fileName())); - return; - } - - IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); - if (walletAdapter->isOpen()) { - walletAdapter->removeObserver(this); - walletAdapter->close(); - walletAdapter->addObserver(this); - } - - AccountKeys accountKeys = convertByteArrayToAccountKeys(key); - QString oldWalletFile = Settings::instance().getWalletFile(); - Settings::instance().setWalletFile(filePath); - if (walletAdapter->createWithKeys(filePath, accountKeys) == IWalletAdapter::INIT_SUCCESS) { - walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); - } else { - Settings::instance().setWalletFile(oldWalletFile); - } - } -} - -void MainWindow::aboutQt() { - QMessageBox::aboutQt(this); -} - -void MainWindow::about() { - AboutDialog dlg(this); - dlg.exec(); -} - -void MainWindow::copyAddress() { - QApplication::clipboard()->setText(m_walletStateModel->index(0, WalletStateModel::COLUMN_ADDRESS).data().toString()); - m_ui->m_copyAddressLabel->start(); -} - -void MainWindow::copyBalance() { - QString balanceString = m_walletStateModel->index(0, WalletStateModel::COLUMN_TOTAL_BALANCE).data().toString(); - balanceString.remove(','); - QApplication::clipboard()->setText(balanceString); - m_ui->m_balanceCopyLabel->start(); -} - -void MainWindow::setStartOnLoginEnabled(bool _enable) { - Settings::instance().setStartOnLoginEnabled(_enable); - m_ui->m_autostartAction->setChecked(Settings::instance().isStartOnLoginEnabled()); -} - -void MainWindow::setMinimizeToTrayEnabled(bool _enable) { - Settings::instance().setMinimizeToTrayEnabled(_enable); -} - -void MainWindow::setCloseToTrayEnabled(bool _enable) { - Settings::instance().setCloseToTrayEnabled(_enable); -} - -void MainWindow::showPreferences() { - OptionsDialog dlg(m_cryptoNoteAdapter, m_donationManager, m_optimizationManager, m_addressBookModel, this); - ConnectionMethod currentConnectionMethod = Settings::instance().getConnectionMethod(); - quint16 currentLocalRpcPort = Settings::instance().getLocalRpcPort(); - QUrl currentRemoteRpcUrl = Settings::instance().getRemoteRpcUrl(); - if (dlg.exec() == QDialog::Accepted) { - ConnectionMethod newConnectionMethod = Settings::instance().getConnectionMethod(); - quint16 newLocalRpcPort = Settings::instance().getLocalRpcPort(); - QUrl newRemoteRpcUrl = Settings::instance().getRemoteRpcUrl(); - - if(newConnectionMethod != currentConnectionMethod || - (newConnectionMethod == ConnectionMethod::LOCAL && newLocalRpcPort != currentLocalRpcPort) || - (newConnectionMethod == ConnectionMethod::REMOTE && newRemoteRpcUrl != currentRemoteRpcUrl)) { - setEnabled(false); - Q_EMIT reinitCryptoNoteAdapterSignal(); - } - } -} - -void MainWindow::communityForumTriggered() { - QDesktopServices::openUrl(QUrl::fromUserInput(COMMUNITY_FORUM_URL)); -} - -void MainWindow::reportIssueTriggered() { - QDesktopServices::openUrl(QUrl::fromUserInput(REPORT_ISSUE_URL)); -} - -} +// Copyright (c) 2015-2017, The Bytecoin developers +// +// This file is part of Bytecoin. +// +// Intensecoin is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Intensecoin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Intensecoin. If not, see . + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "MainWindow.h" +#include "Settings/Settings.h" +#include "WalletLogger/WalletLogger.h" +#include "Gui/Common/AboutDialog.h" +#include "Gui/Common/ChangePasswordDialog.h" +#include "Gui/Common/NewPasswordDialog.h" +#include "Gui/Common/KeyDialog.h" +#include "Gui/Common/QuestionDialog.h" +#include "ICryptoNoteAdapter.h" +#include "INodeAdapter.h" +#include "Models/AddressBookModel.h" +#include "Models/BlockchainModel.h" +#include "Models/FusionTransactionsFilterModel.h" +#include "Models/MinerModel.h" +#include "Models/NodeStateModel.h" +#include "Models/SortedAddressBookModel.h" +#include "Models/SortedTransactionsModel.h" +#include "Models/TransactionsModel.h" +#include "Models/TransactionPoolModel.h" +#include "Models/WalletStateModel.h" +#include "Gui/Options/OptionsDialog.h" +#include "Style/Style.h" + +#include "ui_MainWindow.h" + +namespace WalletGui { + +namespace { + +const int MAX_RECENT_WALLET_COUNT = 10; +const char COMMUNITY_FORUM_URL[] = "https://intense-coin.herokuapp.com"; +const char REPORT_ISSUE_URL[] = "https://intensecoin.com/#contact"; + +const char DONATION_URL_DONATION_TAG[] = "donation"; +const char DONATION_URL_LABEL_TAG[] = "label"; + +QByteArray convertAccountKeysToByteArray(const AccountKeys& _accountKeys) { + QByteArray spendPublicKey(reinterpret_cast(&_accountKeys.spendKeys.publicKey), sizeof(Crypto::PublicKey)); + QByteArray viewPublicKey(reinterpret_cast(&_accountKeys.viewKeys.publicKey), sizeof(Crypto::PublicKey)); + QByteArray spendPrivateKey(reinterpret_cast(&_accountKeys.spendKeys.secretKey), sizeof(Crypto::SecretKey)); + QByteArray viewPrivateKey(reinterpret_cast(&_accountKeys.viewKeys.secretKey), sizeof(Crypto::SecretKey)); + QByteArray trackingKeys; + trackingKeys.append(spendPublicKey).append(viewPublicKey).append(spendPrivateKey).append(viewPrivateKey); + return trackingKeys; +} + +QByteArray convertAccountPrivateKeysToByteArray(const AccountKeys& _accountKeys) { + QByteArray spendPrivateKey(reinterpret_cast(&_accountKeys.spendKeys.secretKey), sizeof(Crypto::SecretKey)); + QByteArray viewPrivateKey(reinterpret_cast(&_accountKeys.viewKeys.secretKey), sizeof(Crypto::SecretKey)); + QByteArray trackingKeys; + trackingKeys.append(spendPrivateKey).append(viewPrivateKey); + return trackingKeys; +} + +AccountKeys convertByteArrayToAccountKeys(const QByteArray& _array) { + AccountKeys accountKeys; + QDataStream trackingKeysDataStream(_array); + trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.spendKeys.publicKey), sizeof(Crypto::PublicKey)); + trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.viewKeys.publicKey), sizeof(Crypto::PublicKey)); + trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.spendKeys.secretKey), sizeof(Crypto::SecretKey)); + trackingKeysDataStream.readRawData(reinterpret_cast(&accountKeys.viewKeys.secretKey), sizeof(Crypto::SecretKey)); + return accountKeys; +} + +bool isDonationUrl(const QUrl& _url) { + QUrlQuery urlQuery(_url); + if(!urlQuery.hasQueryItem(DONATION_URL_DONATION_TAG)) { + return false; + } + + return (urlQuery.queryItemValue(DONATION_URL_DONATION_TAG).compare("true", Qt::CaseInsensitive) == 0); +} + +} + +MainWindow::MainWindow(ICryptoNoteAdapter* _cryptoNoteAdapter, IAddressBookManager* _addressBookManager, + IDonationManager* _donationManager, IOptimizationManager* _optimizationManager, IMiningManager* _miningManager, + IApplicationEventHandler* _applicationEventHandler, INewsReader* _blogReader, const QString& _styleSheetTemplate, QWidget* _parent) : + QMainWindow(_parent), m_ui(new Ui::MainWindow), m_cryptoNoteAdapter(_cryptoNoteAdapter), + m_addressBookManager(_addressBookManager), m_donationManager(_donationManager), + m_optimizationManager(_optimizationManager), m_miningManager(_miningManager), m_applicationEventHandler(_applicationEventHandler), + m_blogReader(_blogReader), m_blockChainModel(nullptr), m_transactionPoolModel(nullptr), m_recentWalletsMenu(new QMenu(this)), + m_addRecipientAction(new QAction(this)), m_styleSheetTemplate(_styleSheetTemplate), m_walletStateMapper(new QDataWidgetMapper(this)), + m_syncMovie(new QMovie(Settings::instance().getCurrentStyle().getWalletSyncGifFile(), QByteArray(), this)) { + m_ui->setupUi(this); + setWindowTitle(tr("Intensecoin Wallet %1").arg(Settings::instance().getVersion())); + m_addRecipientAction->setObjectName("m_addRecipientAction"); + m_cryptoNoteAdapter->addObserver(this); + m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter()->addObserver(this); + m_applicationEventHandler->addObserver(this); + addActions(QList() << m_ui->m_createWalletAction << m_ui->m_openWalletAction); + + m_nodeStateModel = new NodeStateModel(m_cryptoNoteAdapter, this); + m_walletStateModel = new WalletStateModel(m_cryptoNoteAdapter, this); + m_transactionsModel = new TransactionsModel(m_cryptoNoteAdapter, m_optimizationManager, m_nodeStateModel, this); + m_sortedTranactionsModel = new SortedTransactionsModel(m_transactionsModel, this); + m_fusionTranactionsFilterModel = new FusionTransactionsFilterModel(m_sortedTranactionsModel, m_optimizationManager, this); + m_addressBookModel = new AddressBookModel(m_addressBookManager, this); + m_sortedAddressBookModel = new SortedAddressBookModel(m_addressBookModel, this); + m_blockChainModel = new BlockchainModel(m_cryptoNoteAdapter, m_nodeStateModel, this); + m_transactionPoolModel = new TransactionPoolModel(m_cryptoNoteAdapter, this); + m_minerModel = new MinerModel(m_miningManager, this); + + QList uiItems; + uiItems << m_ui->m_noWalletFrame << m_ui->m_overviewFrame << m_ui->m_sendFrame << m_ui->m_transactionsFrame << + m_ui->m_blockExplorerFrame << m_ui->m_addressBookFrame << m_ui->m_miningFrame << m_ui->statusBar; + for (auto& uiItem : uiItems) { + uiItem->setCryptoNoteAdapter(m_cryptoNoteAdapter); + uiItem->setAddressBookManager(m_addressBookManager); + uiItem->setDonationManager(m_donationManager); + uiItem->setMiningManager(m_miningManager); + uiItem->setApplicationEventHandler(m_applicationEventHandler); + uiItem->setBlogReader(m_blogReader); + uiItem->setMainWindow(this); + uiItem->setNodeStateModel(m_nodeStateModel); + uiItem->setWalletStateModel(m_walletStateModel); + uiItem->setTransactionsModel(m_transactionsModel); + uiItem->setSortedTransactionsModel(m_fusionTranactionsFilterModel); + uiItem->setAddressBookModel(m_addressBookModel); + uiItem->setSortedAddressBookModel(m_sortedAddressBookModel); + uiItem->setBlockChainModel(m_blockChainModel); + uiItem->setTransactionPoolModel(m_transactionPoolModel); + uiItem->setMinerModel(m_minerModel); + } + + if (!Settings::instance().isSystemTrayAvailable() && QSystemTrayIcon::isSystemTrayAvailable()) { + m_ui->m_minimizeToTrayAction->deleteLater(); + m_ui->m_closeToTrayAction->deleteLater(); + } else { + m_ui->m_minimizeToTrayAction->setChecked(Settings::instance().isMinimizeToTrayEnabled()); + m_ui->m_closeToTrayAction->setChecked(Settings::instance().isCloseToTrayEnabled()); + } + + createRecentWalletMenu(); + m_ui->m_addressLabel->installEventFilter(this); + m_ui->m_balanceLabel->installEventFilter(this); + m_walletStateMapper->setModel(m_walletStateModel); + m_walletStateMapper->addMapping(m_ui->m_balanceFrame, WalletStateModel::COLUMN_IS_OPEN, "visible"); + m_walletStateMapper->addMapping(m_ui->m_walletFrame, WalletStateModel::COLUMN_IS_OPEN, "visible"); + m_walletStateMapper->addMapping(m_ui->m_noWalletLabel, WalletStateModel::COLUMN_IS_CLOSED, "visible"); + m_walletStateMapper->addMapping(m_ui->m_notEncryptedFrame, WalletStateModel::COLUMN_IS_NOT_ENCRYPTED, "visible"); + m_walletStateMapper->addMapping(m_ui->m_addressLabel, WalletStateModel::COLUMN_ADDRESS, "text"); + m_walletStateMapper->addMapping(m_ui->m_balanceLabel, WalletStateModel::COLUMN_TOTAL_BALANCE, "text"); + m_walletStateMapper->setCurrentIndex(0); + + setClosedState(); + if (QFile::exists(Settings::instance().getWalletFile())) { + m_ui->m_noWalletFrame->openWallet(Settings::instance().getWalletFile(), QString()); + } else { + m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter()->create(Settings::instance().getWalletFile(), ""); + } + + m_ui->m_balanceIconLabel->setPixmap(Settings::instance().getCurrentStyle().getBalanceIcon()); + m_ui->m_logoLabel->setPixmap(Settings::instance().getCurrentStyle().getLogoPixmap()); + QActionGroup* themeActionGroup = new QActionGroup(this); + quintptr styleCount = Settings::instance().getStyleCount(); + for (quintptr i = 0; i < styleCount; ++i) { + const Style& style = Settings::instance().getStyle(i); + QAction* styleAction = m_ui->menuThemes->addAction(style.getStyleName()); + styleAction->setData(style.getStyleId()); + styleAction->setCheckable(true); + if (style.getStyleId() == Settings::instance().getCurrentTheme()) { + styleAction->setChecked(true); + } + + themeActionGroup->addAction(styleAction); + connect(styleAction, &QAction::triggered, this, &MainWindow::themeChanged); + } + + connect(m_walletStateModel, &QAbstractItemModel::dataChanged, this, &MainWindow::walletStateModelDataChanged); + connect(m_addRecipientAction, &QAction::triggered, this, &MainWindow::addRecipientTriggered); + connect(m_ui->m_exitAction, &QAction::triggered, qApp, &QApplication::quit); + connect(qApp, &QGuiApplication::commitDataRequest, this, &MainWindow::commitData); +} + +MainWindow::~MainWindow() { +} + +bool MainWindow::eventFilter(QObject* _object, QEvent* _event) { + if (_object == m_ui->m_addressLabel && _event->type() == QEvent::MouseButtonRelease) { + copyAddress(); + } else if (_object == m_ui->m_balanceLabel && _event->type() == QEvent::MouseButtonRelease) { + copyBalance(); + } + + return false; +} + +void MainWindow::walletOpened() { + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + setOpenedState(); + QStringList recentWalletList = Settings::instance().getRecentWalletList(); + recentWalletList.removeAll(Settings::instance().getWalletFile()); + recentWalletList.prepend(Settings::instance().getWalletFile()); + while (recentWalletList.size() > MAX_RECENT_WALLET_COUNT) { + recentWalletList.removeLast(); + } + + Settings::instance().setRecentWalletList(recentWalletList); + updateRecentWalletActions(); + if (walletAdapter->isTrackingWallet()) { + m_ui->m_sendButton->setEnabled(false); + m_ui->m_addressBookButton->setEnabled(false); + } + + QUrl url = m_applicationEventHandler->getLastReceivedUrl(); + if (url.isValid()) { + urlReceived(url); + } +} + +void MainWindow::walletOpenError(int _initStatus) { + if (_initStatus != IWalletAdapter::INIT_SUCCESS) { + setClosedState(); + } +} + +void MainWindow::walletClosed() { + setClosedState(); +} + +void MainWindow::passwordChanged() { + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + if (walletAdapter->isEncrypted()) { + m_ui->m_notEncryptedFrame->hide(); + } + + m_ui->m_changePasswordAction->setEnabled(walletAdapter->isEncrypted()); + m_ui->m_encryptWalletAction->setEnabled(!walletAdapter->isEncrypted()); + walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); +} + +void MainWindow::synchronizationProgressUpdated(quint32 _current, quint32 _total) { + if (_total < _current) { + return; + } + + if (m_ui->m_removePendingTxAction->isEnabled()) + m_ui->m_removePendingTxAction->setEnabled(false); + + qreal value = static_cast(_current) / _total; + m_ui->m_syncProgress->setValue(value * m_ui->m_syncProgress->maximum()); +} + +void MainWindow::synchronizationCompleted() { + m_ui->m_syncProgress->setValue(m_ui->m_syncProgress->maximum()); + m_ui->m_removePendingTxAction->setEnabled(true); +} + +void MainWindow::balanceUpdated(quint64 _actualBalance, quint64 _pendingBalance) { + // Do nothing +} + +void MainWindow::externalTransactionCreated(quintptr _transactionId, const FullTransactionInfo& _transaction) { + // Do nothing +} + +void MainWindow::transactionUpdated(quintptr _transactionId, const FullTransactionInfo& _transaction) { + // Do nothing +} + +void MainWindow::urlReceived(const QUrl& _url) { + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + if (!walletAdapter->isOpen()) { + return; + } + + showNormal(); + activateWindow(); + raise(); + if (isDonationUrl(_url)) { + QUrlQuery urlQuery(_url); + QString address = _url.path(); + QString label = urlQuery.queryItemValue(DONATION_URL_LABEL_TAG); + m_addressBookManager->addAddress(label, address, true); + + OptionsDialog dlg(m_cryptoNoteAdapter, m_donationManager, m_optimizationManager, m_addressBookModel, this); + dlg.setDonationAddress(label, address); + dlg.exec(); + } else if (_url.isValid()) { + m_ui->m_sendButton->click(); + } +} + +void MainWindow::screenLocked() { + // Do nothing +} + +void MainWindow::screenUnlocked() { + // Do nothing +} + +void MainWindow::cryptoNoteAdapterInitCompleted(int _status) { + setEnabled(true); + if (_status == 0) { + m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter()->addObserver(this); + if (QFile::exists(Settings::instance().getWalletFile())) { + m_ui->m_noWalletFrame->openWallet(Settings::instance().getWalletFile(), QString()); + } + } +} + +void MainWindow::cryptoNoteAdapterDeinitCompleted() { + +} + +void MainWindow::changeEvent(QEvent* _event) { + QMainWindow::changeEvent(_event); + switch (_event->type()) { + case QEvent::WindowStateChange: + if(isMinimized() && Settings::instance().isMinimizeToTrayEnabled()) { + hide(); + } + + break; + default: + break; + } + + QMainWindow::changeEvent(_event); +} + +void MainWindow::closeEvent(QCloseEvent* _event) { +#ifndef Q_OS_MAC + if (!Settings::instance().isCloseToTrayEnabled()) { + m_ui->m_exitAction->trigger(); + } +#endif + QMainWindow::closeEvent(_event); +} + +void MainWindow::setOpenedState() { + + QList toolButtons = m_ui->m_toolButtonGroup->buttons(); + for (const auto& button : toolButtons) { + button->setChecked(false); + button->setEnabled(true); + } + + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + m_ui->m_backupWalletAction->setEnabled(true); + m_ui->m_resetAction->setEnabled(true); + m_ui->m_exportTrackingKeyAction->setEnabled(true); + m_ui->m_encryptWalletAction->setEnabled(!walletAdapter->isEncrypted()); + m_ui->m_changePasswordAction->setEnabled(walletAdapter->isEncrypted()); + + m_ui->m_noWalletFrame->hide(); + m_ui->m_overviewFrame->show(); + + m_ui->m_overviewButton->setChecked(true); + m_ui->m_blockExplorerButton->setEnabled(m_cryptoNoteAdapter->getNodeAdapter()->getBlockChainExplorerAdapter() != nullptr); +} + +void MainWindow::setClosedState() { + QList toolButtons = m_ui->m_toolButtonGroup->buttons(); + for (const auto& button : toolButtons) { + button->setChecked(false); + button->setEnabled(false); + } + + m_ui->m_backupWalletAction->setEnabled(false); + m_ui->m_resetAction->setEnabled(false); + m_ui->m_exportTrackingKeyAction->setEnabled(false); + m_ui->m_encryptWalletAction->setEnabled(false); + m_ui->m_changePasswordAction->setEnabled(false); + m_ui->m_removePendingTxAction->setEnabled(false); + + m_ui->m_overviewFrame->hide(); + m_ui->m_sendFrame->hide(); + m_ui->m_transactionsFrame->hide(); + m_ui->m_addressBookFrame->hide(); + m_ui->m_blockExplorerFrame->hide(); + m_ui->m_miningFrame->hide(); + m_ui->m_noWalletFrame->show(); + m_ui->m_syncProgress->setValue(0); +} + +void MainWindow::addRecipientTriggered() { + m_ui->m_sendFrame->addRecipient(m_addRecipientAction->data().toString()); + m_ui->m_sendButton->click(); +} + +void MainWindow::commitData(QSessionManager& _manager) { + WalletLogger::debug(tr("[Main window] Commit data request")); + if (m_cryptoNoteAdapter->getNodeAdapter() != nullptr) { + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + if (walletAdapter->isOpen()) { + walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); + } + } +} + +void MainWindow::walletStateModelDataChanged(const QModelIndex& _topLeft, const QModelIndex& _bottomRight, const QVector& _roles) { + if (_topLeft.column() == WalletStateModel::COLUMN_ABOUT_TO_BE_SYNCHRONIZED) { + bool walletAboutToBeSynchronized = _topLeft.data().toBool(); + if (!walletAboutToBeSynchronized) { + m_walletStateMapper->removeMapping(m_ui->m_balanceLabel); + m_ui->m_balanceLabel->setMovie(m_syncMovie); + m_syncMovie->start(); + m_ui->m_balanceLabel->setCursor(Qt::ArrowCursor); + m_ui->m_balanceLabel->removeEventFilter(this); + m_ui->m_balanceLabel->setToolTip(QString()); + } else { + m_syncMovie->stop(); + m_ui->m_balanceLabel->setMovie(nullptr); + m_walletStateMapper->addMapping(m_ui->m_balanceLabel, WalletStateModel::COLUMN_TOTAL_BALANCE, "text"); + m_walletStateMapper->revert(); + m_ui->m_balanceLabel->setCursor(Qt::PointingHandCursor); + m_ui->m_balanceLabel->installEventFilter(this); + m_ui->m_balanceLabel->setToolTip(tr("Click to copy")); + } + } +} + +void MainWindow::createRecentWalletMenu() { + m_ui->m_recentWalletsAction->setMenu(m_recentWalletsMenu); + for (quint32 i = 0; i < MAX_RECENT_WALLET_COUNT; ++i) { + QAction* action = new QAction(this); + action->setVisible(false); + m_recentWalletsActionList.append(action); + m_recentWalletsMenu->addAction(action); + connect(action, &QAction::triggered, this, &MainWindow::openRecentWallet); + } + + updateRecentWalletActions(); +} + +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]->setData(recentWallets[i]); + m_recentWalletsActionList[i]->setVisible(true); + } + + for (int i = recentWalletCount; i < MAX_RECENT_WALLET_COUNT; ++i) { + m_recentWalletsActionList[i]->setVisible(false); + } +} + +void MainWindow::openRecentWallet() { + QAction* action = qobject_cast(sender()); + if (action == nullptr) { + return; + } + + QString filePath = action->data().toString(); + if (!filePath.isEmpty()) { + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + if (walletAdapter->isOpen()) { + walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); + walletAdapter->removeObserver(this); + walletAdapter->close(); + walletAdapter->addObserver(this); + } + + m_ui->m_noWalletFrame->openWallet(filePath, QString()); + } +} + +void MainWindow::themeChanged() { + QAction* styleAction = qobject_cast(sender()); + Settings::instance().setCurrentTheme(styleAction->data().toString()); + qApp->setStyleSheet(Settings::instance().getCurrentStyle().makeStyleSheet(m_styleSheetTemplate)); + m_ui->m_balanceIconLabel->setPixmap(Settings::instance().getCurrentStyle().getBalanceIcon()); + m_ui->m_logoLabel->setPixmap(Settings::instance().getCurrentStyle().getLogoPixmap()); + m_syncMovie->stop(); + m_syncMovie->setFileName(Settings::instance().getCurrentStyle().getWalletSyncGifFile()); + m_syncMovie->start(); + QList uiItems; + uiItems << m_ui->m_noWalletFrame << m_ui->m_overviewFrame << m_ui->m_sendFrame << m_ui->m_transactionsFrame << + m_ui->m_blockExplorerFrame << m_ui->m_addressBookFrame << m_ui->m_miningFrame << m_ui->statusBar; + for (auto& uiItem : uiItems) { + uiItem->updateStyle(); + } +} + +void MainWindow::createWallet() { + QString filePath = QFileDialog::getSaveFileName(this, tr("New wallet file"), +#ifdef Q_OS_WIN + QApplication::applicationDirPath(), +#else + QDir::homePath(), +#endif + tr("Wallets (*.wallet)") + ); + + if (!filePath.isEmpty() && !filePath.endsWith(".wallet")) { + filePath.append(".wallet"); + } + + if (QFile::exists(filePath)) { + QMessageBox::warning(this, tr("Warning"), + tr("Can't overwrite existing %1 because it may lead to loss of private keys").arg(QFileInfo(filePath).fileName())); + return; + } + + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + if (!filePath.isEmpty()) { + if (walletAdapter->isOpen()) { + walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); + walletAdapter->removeObserver(this); + walletAdapter->close(); + walletAdapter->addObserver(this); + } + + QString oldWalletFile = Settings::instance().getWalletFile(); + Settings::instance().setWalletFile(filePath); + if (walletAdapter->create(filePath, "") == IWalletAdapter::INIT_SUCCESS) { + walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); + } else { + Settings::instance().setWalletFile(oldWalletFile); + } + } +} + +void MainWindow::openWallet() { + QString filePath = QFileDialog::getOpenFileName(this, tr("Open .wallet/.keys file"), +#ifdef Q_OS_WIN + QApplication::applicationDirPath(), +#else + QDir::homePath(), +#endif + tr("Wallet (*.wallet *.keys)")); + + QString walletFilePath = filePath; + if (!filePath.isEmpty()) { + if (filePath.endsWith(".keys")) { + walletFilePath.replace(filePath.lastIndexOf(".keys"), 5, ".wallet"); + if (QFile::exists(walletFilePath)) { + QMessageBox::warning(this, tr("Warning"), + tr("Can't overwrite existing %1 because it may lead to loss of private keys").arg(QFileInfo(walletFilePath).fileName())); + return; + } + } else { + filePath.clear(); + } + } else { + return; + } + + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + if (walletAdapter->isOpen()) { + walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); + walletAdapter->removeObserver(this); + walletAdapter->close(); + walletAdapter->addObserver(this); + } + + m_ui->m_noWalletFrame->openWallet(walletFilePath, filePath); +} + +void MainWindow::backupWallet() { + QString filePath = QFileDialog::getSaveFileName(this, tr("Backup wallet to..."), +#ifdef Q_OS_WIN + QApplication::applicationDirPath(), +#else + QDir::homePath(), +#endif + tr("Wallets (*.wallet)") + ); + if (!filePath.isEmpty() && !filePath.endsWith(".wallet")) { + filePath.append(".wallet"); + } + + if (QFile::exists(filePath)) { + QMessageBox::warning(this, tr("Warning"), + tr("Can't overwrite existing %1 because it may lead to loss of private keys").arg(QFileInfo(filePath).fileName())); + return; + } + + if (!filePath.isEmpty()) { + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + walletAdapter->exportWallet(filePath, true, CryptoNote::WalletSaveLevel::SAVE_KEYS_AND_TRANSACTIONS, false); + } +} + +void MainWindow::saveWalletKeys() { + QString filePath = QFileDialog::getSaveFileName(this, tr("Save keys to..."), +#ifdef Q_OS_WIN + QApplication::applicationDirPath(), +#else + QDir::homePath(), +#endif + tr("Wallet (*.wallet)") + ); + if (!filePath.isEmpty() && !filePath.endsWith(".wallet")) { + filePath.append(".wallet"); + } + + if (QFile::exists(filePath)) { + QMessageBox::warning(this, tr("Warning"), + tr("Can't overwrite existing %1 because it may lead to loss of private keys").arg(QFileInfo(filePath).fileName())); + return; + } + + if (!filePath.isEmpty()) { + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + walletAdapter->exportWallet(filePath, false, CryptoNote::WalletSaveLevel::SAVE_KEYS_ONLY, false); + } +} + +void MainWindow::resetWallet() { + QuestionDialog dlg(tr("Reset wallet?"), tr("Reset wallet to resynchronize its transactions and balance based\n" + "on the blockchain data. This operation can take some time.\n" + "Are you sure you would like to reset this wallet?"), this); + if (dlg.exec() != QDialog::Accepted) { + return; + } + + 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"))); + + walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_KEYS_ONLY, true); + walletAdapter->removeObserver(this); + walletAdapter->close(); + walletAdapter->addObserver(this); + m_ui->m_noWalletFrame->openWallet(Settings::instance().getWalletFile(), QString()); +} + +void MainWindow::removePendingTx() { + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + if (walletAdapter->resetPendingTransactions()) + QMessageBox::information(this, "Transactions reset", "Transactions reset successfully.", QMessageBox::Ok); + else + QMessageBox::warning(this, "Transaction reset failed", "Failed to reset transactions. Check debug log.", QMessageBox::Ok); +} + +void MainWindow::encryptWallet() { + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + if (walletAdapter->isEncrypted()) { + IWalletAdapter::PasswordStatus status = IWalletAdapter::PASSWORD_SUCCESS; + do { + ChangePasswordDialog dlg(status == IWalletAdapter::PASSWORD_ERROR, this); + if (dlg.exec() == QDialog::Rejected) { + return; + } + + QString oldPassword = dlg.getOldPassword(); + QString newPassword = dlg.getNewPassword(); + status = walletAdapter->changePassword(oldPassword, newPassword); + } while (status != IWalletAdapter::PASSWORD_SUCCESS); + } else { + NewPasswordDialog dlg(this); + if (dlg.exec() == QDialog::Accepted) { + QString password = dlg.getPassword(); + if (password.isEmpty()) { + return; + } + + walletAdapter->changePassword("", password); + } + } +} + +void MainWindow::exportKey() { + if (m_cryptoNoteAdapter->getNodeAdapter() == nullptr || + m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter() == nullptr || + !m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter()->isOpen()) + return; + AccountKeys accountKeys = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter()->getAccountKeys(0); + QByteArray keys = convertAccountKeysToByteArray(accountKeys); + KeyDialog dlg(keys, false, this); + dlg.exec(); +} + +void MainWindow::exportPrivateKeys() { + if (m_cryptoNoteAdapter->getNodeAdapter() == nullptr || + m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter() == nullptr || + !m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter()->isOpen()) + return; + AccountKeys accountKeys = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter()->getAccountKeys(0); + QByteArray keys = convertAccountPrivateKeysToByteArray(accountKeys); + KeyDialog dlg(keys, false, true, this); + dlg.exec(); +} + +void MainWindow::exportTrackingKey() { + AccountKeys accountKeys = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter()->getAccountKeys(0); + std::memset(&accountKeys.spendKeys.secretKey, 0, sizeof(Crypto::SecretKey)); + QByteArray trackingKeys = convertAccountKeysToByteArray(accountKeys); + KeyDialog dlg(trackingKeys, true, this); + dlg.exec(); +} + +void MainWindow::importKey() { + KeyDialog dlg(this); + if (dlg.exec() == QDialog::Accepted) { + QByteArray key = dlg.getKey(); + if (key.size() != sizeof(CryptoNote::AccountKeys)) { + QMessageBox::warning(this, tr("Warning"), tr("Incorrect tracking key size")); + return; + } + + QString filePath = QFileDialog::getSaveFileName(this, tr("Save tracking wallet to..."), +#ifdef Q_OS_WIN + QApplication::applicationDirPath(), +#else + QDir::homePath(), +#endif + tr("Wallets (*.wallet)")); + if (filePath.isEmpty()) { + return; + } + + if (!filePath.endsWith(".wallet")) { + filePath.append(".wallet"); + } + + if (QFile::exists(filePath)) { + QMessageBox::warning(this, tr("Warning"), + tr("Can't overwrite existing %1 because it may lead to loss of private keys").arg(QFileInfo(filePath).fileName())); + return; + } + + IWalletAdapter* walletAdapter = m_cryptoNoteAdapter->getNodeAdapter()->getWalletAdapter(); + if (walletAdapter->isOpen()) { + walletAdapter->removeObserver(this); + walletAdapter->close(); + walletAdapter->addObserver(this); + } + + AccountKeys accountKeys = convertByteArrayToAccountKeys(key); + QString oldWalletFile = Settings::instance().getWalletFile(); + Settings::instance().setWalletFile(filePath); + if (walletAdapter->createWithKeys(filePath, accountKeys) == IWalletAdapter::INIT_SUCCESS) { + walletAdapter->save(CryptoNote::WalletSaveLevel::SAVE_ALL, true); + } else { + Settings::instance().setWalletFile(oldWalletFile); + } + } +} + +void MainWindow::aboutQt() { + QMessageBox::aboutQt(this); +} + +void MainWindow::about() { + AboutDialog dlg(this); + dlg.exec(); +} + +void MainWindow::copyAddress() { + QApplication::clipboard()->setText(m_walletStateModel->index(0, WalletStateModel::COLUMN_ADDRESS).data().toString()); + m_ui->m_copyAddressLabel->start(); +} + +void MainWindow::copyBalance() { + QString balanceString = m_walletStateModel->index(0, WalletStateModel::COLUMN_TOTAL_BALANCE).data().toString(); + balanceString.remove(','); + QApplication::clipboard()->setText(balanceString); + m_ui->m_balanceCopyLabel->start(); +} + +void MainWindow::setStartOnLoginEnabled(bool _enable) { + Settings::instance().setStartOnLoginEnabled(_enable); + m_ui->m_autostartAction->setChecked(Settings::instance().isStartOnLoginEnabled()); +} + +void MainWindow::setMinimizeToTrayEnabled(bool _enable) { + Settings::instance().setMinimizeToTrayEnabled(_enable); +} + +void MainWindow::setCloseToTrayEnabled(bool _enable) { + Settings::instance().setCloseToTrayEnabled(_enable); +} + +void MainWindow::showPreferences() { + OptionsDialog dlg(m_cryptoNoteAdapter, m_donationManager, m_optimizationManager, m_addressBookModel, this); + ConnectionMethod currentConnectionMethod = Settings::instance().getConnectionMethod(); + quint16 currentLocalRpcPort = Settings::instance().getLocalRpcPort(); + QUrl currentRemoteRpcUrl = Settings::instance().getRemoteRpcUrl(); + if (dlg.exec() == QDialog::Accepted) { + ConnectionMethod newConnectionMethod = Settings::instance().getConnectionMethod(); + quint16 newLocalRpcPort = Settings::instance().getLocalRpcPort(); + QUrl newRemoteRpcUrl = Settings::instance().getRemoteRpcUrl(); + + if(newConnectionMethod != currentConnectionMethod || + (newConnectionMethod == ConnectionMethod::LOCAL && newLocalRpcPort != currentLocalRpcPort) || + (newConnectionMethod == ConnectionMethod::REMOTE && newRemoteRpcUrl != currentRemoteRpcUrl)) { + setEnabled(false); + Q_EMIT reinitCryptoNoteAdapterSignal(); + } + } +} + +void MainWindow::communityForumTriggered() { + QDesktopServices::openUrl(QUrl::fromUserInput(COMMUNITY_FORUM_URL)); +} + +void MainWindow::reportIssueTriggered() { + QDesktopServices::openUrl(QUrl::fromUserInput(REPORT_ISSUE_URL)); +} + +} diff --git a/src/Gui/MainWindow/MainWindow.h b/src/Gui/MainWindow/MainWindow.h index 662b46fbe..f880b07a8 100644 --- a/src/Gui/MainWindow/MainWindow.h +++ b/src/Gui/MainWindow/MainWindow.h @@ -1,144 +1,145 @@ -// Copyright (c) 2015-2017, The Bytecoin developers -// -// This file is part of Bytecoin. -// -// Intensecoin is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Intensecoin is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with Intensecoin. If not, see . - -#pragma once - -#include - -#include "IApplicationEventHandler.h" -#include "ICryptoNoteAdapter.h" -#include "IWalletAdapter.h" - -class QActionGroup; -class QDataWidgetMapper; -class QSplashScreen; -class QAbstractButton; -class QAbstractItemModel; -class QSessionManager; - -namespace Ui { - class MainWindow; -} - -namespace WalletGui { - -class IAddressBookManager; -class IDonationManager; -class IOptimizationManager; -class IMiningManager; -class INewsReader; - -class MainWindow : public QMainWindow, public IWalletAdapterObserver, public IApplicationEventHandlerObserver, - public ICryptoNoteAdapterObserver { - Q_OBJECT - Q_DISABLE_COPY(MainWindow) - -public: - MainWindow(ICryptoNoteAdapter* _cryptoNoteAdapter, IAddressBookManager* _addressBookManager, - IDonationManager* _donationManager, IOptimizationManager* _optimizationManager, IMiningManager* _miningManager, - IApplicationEventHandler* _applicationEventHandler, INewsReader* _blogReader, - const QString& _styleSheetTemplate, QWidget* _parent); - virtual ~MainWindow(); - - bool eventFilter(QObject* _object, QEvent* _event) override; - - // IWalletAdapterObserver - Q_SLOT virtual void walletOpened() override; - Q_SLOT virtual void walletOpenError(int _initStatus) override; - Q_SLOT virtual void walletClosed() override; - Q_SLOT virtual void passwordChanged() override; - Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override; - Q_SLOT virtual void synchronizationCompleted() override; - Q_SLOT virtual void balanceUpdated(quint64 _actualBalance, quint64 _pendingBalance) override; - Q_SLOT virtual void externalTransactionCreated(quintptr _transactionId, const FullTransactionInfo& _transaction) override; - Q_SLOT virtual void transactionUpdated(quintptr _transactionId, const FullTransactionInfo& _transaction) override; - - // IApplicationEventHandlerObserver - Q_SLOT virtual void urlReceived(const QUrl& _url) override; - Q_SLOT virtual void screenLocked() override; - Q_SLOT virtual void screenUnlocked() override; - - // ICryptoNoteAdapterObserver - Q_SLOT virtual void cryptoNoteAdapterInitCompleted(int _status) override; - Q_SLOT virtual void cryptoNoteAdapterDeinitCompleted() override; - -protected: - void changeEvent(QEvent* _event) override; - void closeEvent(QCloseEvent* _event) override; - -private: - QScopedPointer m_ui; - ICryptoNoteAdapter* m_cryptoNoteAdapter; - IAddressBookManager* m_addressBookManager; - IDonationManager* m_donationManager; - IOptimizationManager* m_optimizationManager; - IMiningManager* m_miningManager; - IApplicationEventHandler* m_applicationEventHandler; - INewsReader* m_blogReader; - QAbstractItemModel* m_nodeStateModel; - QAbstractItemModel* m_walletStateModel; - QAbstractItemModel* m_transactionsModel; - QAbstractItemModel* m_sortedTranactionsModel; - QAbstractItemModel* m_fusionTranactionsFilterModel; - QAbstractItemModel* m_addressBookModel; - QAbstractItemModel* m_sortedAddressBookModel; - QAbstractItemModel* m_blockChainModel; - QAbstractItemModel* m_transactionPoolModel; - QAbstractItemModel* m_minerModel; - QMenu* m_recentWalletsMenu; - QList m_recentWalletsActionList; - QAction* m_addRecipientAction; - QString m_styleSheetTemplate; - QDataWidgetMapper* m_walletStateMapper; - QMovie* m_syncMovie; - - void createRecentWalletMenu(); - void updateRecentWalletActions(); - void openRecentWallet(); - void themeChanged(); - void setOpenedState(); - void setClosedState(); - void addRecipientTriggered(); - void commitData(QSessionManager& _manager); - void walletStateModelDataChanged(const QModelIndex& _topLeft, const QModelIndex& _bottomRight, const QVector& _roles); - - Q_SLOT void createWallet(); - Q_SLOT void openWallet(); - Q_SLOT void backupWallet(); - Q_SLOT void saveWalletKeys(); - Q_SLOT void resetWallet(); - Q_SLOT void encryptWallet(); - Q_SLOT void removePendingTx(); - Q_SLOT void exportKey(); - Q_SLOT void exportTrackingKey(); - Q_SLOT void importKey(); - Q_SLOT void aboutQt(); - Q_SLOT void about(); - Q_SLOT void copyAddress(); - Q_SLOT void copyBalance(); - Q_SLOT void setStartOnLoginEnabled(bool _enable); - Q_SLOT void setMinimizeToTrayEnabled(bool _enable); - Q_SLOT void setCloseToTrayEnabled(bool _enable); - Q_SLOT void showPreferences(); - Q_SLOT void communityForumTriggered(); - Q_SLOT void reportIssueTriggered(); - -Q_SIGNALS: - void reinitCryptoNoteAdapterSignal(); -}; - -} +// Copyright (c) 2015-2017, The Bytecoin developers +// +// This file is part of Bytecoin. +// +// Intensecoin is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Intensecoin is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with Intensecoin. If not, see . + +#pragma once + +#include + +#include "IApplicationEventHandler.h" +#include "ICryptoNoteAdapter.h" +#include "IWalletAdapter.h" + +class QActionGroup; +class QDataWidgetMapper; +class QSplashScreen; +class QAbstractButton; +class QAbstractItemModel; +class QSessionManager; + +namespace Ui { + class MainWindow; +} + +namespace WalletGui { + +class IAddressBookManager; +class IDonationManager; +class IOptimizationManager; +class IMiningManager; +class INewsReader; + +class MainWindow : public QMainWindow, public IWalletAdapterObserver, public IApplicationEventHandlerObserver, + public ICryptoNoteAdapterObserver { + Q_OBJECT + Q_DISABLE_COPY(MainWindow) + +public: + MainWindow(ICryptoNoteAdapter* _cryptoNoteAdapter, IAddressBookManager* _addressBookManager, + IDonationManager* _donationManager, IOptimizationManager* _optimizationManager, IMiningManager* _miningManager, + IApplicationEventHandler* _applicationEventHandler, INewsReader* _blogReader, + const QString& _styleSheetTemplate, QWidget* _parent); + virtual ~MainWindow(); + + bool eventFilter(QObject* _object, QEvent* _event) override; + + // IWalletAdapterObserver + Q_SLOT virtual void walletOpened() override; + Q_SLOT virtual void walletOpenError(int _initStatus) override; + Q_SLOT virtual void walletClosed() override; + Q_SLOT virtual void passwordChanged() override; + Q_SLOT virtual void synchronizationProgressUpdated(quint32 _current, quint32 _total) override; + Q_SLOT virtual void synchronizationCompleted() override; + Q_SLOT virtual void balanceUpdated(quint64 _actualBalance, quint64 _pendingBalance) override; + Q_SLOT virtual void externalTransactionCreated(quintptr _transactionId, const FullTransactionInfo& _transaction) override; + Q_SLOT virtual void transactionUpdated(quintptr _transactionId, const FullTransactionInfo& _transaction) override; + + // IApplicationEventHandlerObserver + Q_SLOT virtual void urlReceived(const QUrl& _url) override; + Q_SLOT virtual void screenLocked() override; + Q_SLOT virtual void screenUnlocked() override; + + // ICryptoNoteAdapterObserver + Q_SLOT virtual void cryptoNoteAdapterInitCompleted(int _status) override; + Q_SLOT virtual void cryptoNoteAdapterDeinitCompleted() override; + +protected: + void changeEvent(QEvent* _event) override; + void closeEvent(QCloseEvent* _event) override; + +private: + QScopedPointer m_ui; + ICryptoNoteAdapter* m_cryptoNoteAdapter; + IAddressBookManager* m_addressBookManager; + IDonationManager* m_donationManager; + IOptimizationManager* m_optimizationManager; + IMiningManager* m_miningManager; + IApplicationEventHandler* m_applicationEventHandler; + INewsReader* m_blogReader; + QAbstractItemModel* m_nodeStateModel; + QAbstractItemModel* m_walletStateModel; + QAbstractItemModel* m_transactionsModel; + QAbstractItemModel* m_sortedTranactionsModel; + QAbstractItemModel* m_fusionTranactionsFilterModel; + QAbstractItemModel* m_addressBookModel; + QAbstractItemModel* m_sortedAddressBookModel; + QAbstractItemModel* m_blockChainModel; + QAbstractItemModel* m_transactionPoolModel; + QAbstractItemModel* m_minerModel; + QMenu* m_recentWalletsMenu; + QList m_recentWalletsActionList; + QAction* m_addRecipientAction; + QString m_styleSheetTemplate; + QDataWidgetMapper* m_walletStateMapper; + QMovie* m_syncMovie; + + void createRecentWalletMenu(); + void updateRecentWalletActions(); + void openRecentWallet(); + void themeChanged(); + void setOpenedState(); + void setClosedState(); + void addRecipientTriggered(); + void commitData(QSessionManager& _manager); + void walletStateModelDataChanged(const QModelIndex& _topLeft, const QModelIndex& _bottomRight, const QVector& _roles); + + Q_SLOT void createWallet(); + Q_SLOT void openWallet(); + Q_SLOT void backupWallet(); + Q_SLOT void saveWalletKeys(); + Q_SLOT void resetWallet(); + Q_SLOT void encryptWallet(); + Q_SLOT void removePendingTx(); + Q_SLOT void exportKey(); + Q_SLOT void exportPrivateKeys(); + Q_SLOT void exportTrackingKey(); + Q_SLOT void importKey(); + Q_SLOT void aboutQt(); + Q_SLOT void about(); + Q_SLOT void copyAddress(); + Q_SLOT void copyBalance(); + Q_SLOT void setStartOnLoginEnabled(bool _enable); + Q_SLOT void setMinimizeToTrayEnabled(bool _enable); + Q_SLOT void setCloseToTrayEnabled(bool _enable); + Q_SLOT void showPreferences(); + Q_SLOT void communityForumTriggered(); + Q_SLOT void reportIssueTriggered(); + +Q_SIGNALS: + void reinitCryptoNoteAdapterSignal(); +}; + +} diff --git a/src/Gui/MainWindow/ui_MainWindow.h b/src/Gui/MainWindow/ui_MainWindow.h index 31a63e7c6..5a38bb2ee 100644 --- a/src/Gui/MainWindow/ui_MainWindow.h +++ b/src/Gui/MainWindow/ui_MainWindow.h @@ -1,699 +1,706 @@ -/******************************************************************************** -** Form generated from reading UI file 'MainWindow.ui' -** -** Created by: Qt User Interface Compiler version 5.8.0 -** -** WARNING! All changes made in this file will be lost when recompiling UI file! -********************************************************************************/ - -#ifndef UI_MAINWINDOW_H -#define UI_MAINWINDOW_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "Gui/AddressBook/AddressBookFrame.h" -#include "Gui/BlockchainExplorer/BlockExplorerFrame.h" -#include "Gui/Common/CopyMagicLabel.h" -#include "Gui/Common/WalletLinkLikeButton.h" -#include "Gui/Common/WalletTextLabel.h" -#include "Gui/MainWindow/WalletStatusBar.h" -#include "Gui/Mining/MiningFrame.h" -#include "Gui/NoWallet/NoWalletFrame.h" -#include "Gui/Overview/OverviewFrame.h" -#include "Gui/Send/SendFrame.h" -#include "Gui/Transactions/TransactionsFrame.h" - -QT_BEGIN_NAMESPACE - -class Ui_MainWindow -{ -public: - QAction *m_exitAction; - QAction *m_createWalletAction; - QAction *m_openWalletAction; - QAction *m_encryptWalletAction; - QAction *m_changePasswordAction; - QAction *m_aboutIntensecoinAction; - QAction *m_aboutQtAction; - QAction *m_backupWalletAction; - QAction *m_autostartAction; - QAction *m_minimizeToTrayAction; - QAction *m_closeToTrayAction; - QAction *m_preferencesAction; - QAction *m_recentWalletsAction; - QAction *m_exportTrackingKeyAction; - QAction *m_importKeyAction; - QAction *m_communityForumAction; - QAction *m_reportIssueAction; - QAction *m_resetAction; - QAction *m_saveKeysAction; - QAction *m_exportKeyAction; - QAction *m_removePendingTxAction; - QWidget *centralwidget; - QVBoxLayout *verticalLayout_2; - QFrame *m_headerFrame; - QHBoxLayout *horizontalLayout_3; - QSpacerItem *horizontalSpacer_2; - QLabel *m_logoLabel; - QSpacerItem *horizontalSpacer_5; - WalletGui::WalletSmallGrayTextLabel *m_noWalletLabel; - QFrame *m_walletFrame; - QVBoxLayout *verticalLayout_3; - QSpacerItem *verticalSpacer_3; - WalletGui::WalletSmallGrayTextLabel *m_walletLabel; - QLabel *m_addressLabel; - QHBoxLayout *horizontalLayout_2; - QFrame *m_notEncryptedFrame; - QHBoxLayout *horizontalLayout_4; - QLabel *m_notEncryptedIconLabel; - QSpacerItem *horizontalSpacer_11; - WalletGui::WalletTinyGrayTextLabel *m_notEncryptedTextLabel; - QSpacerItem *horizontalSpacer_9; - WalletGui::WalletTinyLinkLikeButton *m_encryptButton; - QSpacerItem *horizontalSpacer_10; - WalletGui::WalletTinyLinkLikeButton *m_copyAddressButton; - QSpacerItem *horizontalSpacer_7; - WalletGui::CopyMagicLabel *m_copyAddressLabel; - QSpacerItem *horizontalSpacer; - QSpacerItem *verticalSpacer_2; - QSpacerItem *horizontalSpacer_3; - QSpacerItem *horizontalSpacer_8; - QFrame *m_balanceFrame; - QGridLayout *gridLayout; - QVBoxLayout *verticalLayout_4; - QLabel *m_balanceTextLabel; - QLabel *m_balanceLabel; - WalletGui::CopyMagicLabel *m_balanceCopyLabel; - QSpacerItem *horizontalSpacer_6; - QSpacerItem *verticalSpacer_5; - QLabel *m_balanceIconLabel; - QHBoxLayout *horizontalLayout; - QFrame *m_toolFrame; - QVBoxLayout *verticalLayout; - QPushButton *m_overviewButton; - QPushButton *m_sendButton; - QPushButton *m_transactionsButton; - QPushButton *m_blockExplorerButton; - QPushButton *m_addressBookButton; - QPushButton *m_miningButton; - QSpacerItem *verticalSpacer; - WalletGui::OverviewFrame *m_overviewFrame; - WalletGui::SendFrame *m_sendFrame; - WalletGui::TransactionsFrame *m_transactionsFrame; - WalletGui::AddressBookFrame *m_addressBookFrame; - WalletGui::NoWalletFrame *m_noWalletFrame; - WalletGui::BlockExplorerFrame *m_blockExplorerFrame; - WalletGui::MiningFrame *m_miningFrame; - QProgressBar *m_syncProgress; - QMenuBar *menubar; - QMenu *menuFile; - QMenu *menuSettings; - QMenu *menuThemes; - QMenu *menuHelp; - WalletGui::WalletStatusBar *statusBar; - QButtonGroup *m_toolButtonGroup; - - void setupUi(QMainWindow *MainWindow) - { - if (MainWindow->objectName().isEmpty()) - MainWindow->setObjectName(QStringLiteral("MainWindow")); - MainWindow->resize(1273, 824); - QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - sizePolicy.setHorizontalStretch(0); - sizePolicy.setVerticalStretch(0); - sizePolicy.setHeightForWidth(MainWindow->sizePolicy().hasHeightForWidth()); - MainWindow->setSizePolicy(sizePolicy); - MainWindow->setMinimumSize(QSize(1260, 600)); - MainWindow->setMaximumSize(QSize(16777215, 16777215)); - QIcon icon; - icon.addFile(QStringLiteral(":/images/intensecoin"), QSize(), QIcon::Normal, QIcon::Off); - MainWindow->setWindowIcon(icon); - m_exitAction = new QAction(MainWindow); - m_exitAction->setObjectName(QStringLiteral("m_exitAction")); - m_exitAction->setCheckable(false); - m_exitAction->setEnabled(true); - m_createWalletAction = new QAction(MainWindow); - m_createWalletAction->setObjectName(QStringLiteral("m_createWalletAction")); - m_createWalletAction->setEnabled(true); - m_openWalletAction = new QAction(MainWindow); - m_openWalletAction->setObjectName(QStringLiteral("m_openWalletAction")); - m_openWalletAction->setEnabled(true); - m_encryptWalletAction = new QAction(MainWindow); - m_encryptWalletAction->setObjectName(QStringLiteral("m_encryptWalletAction")); - m_encryptWalletAction->setEnabled(true); - m_changePasswordAction = new QAction(MainWindow); - m_changePasswordAction->setObjectName(QStringLiteral("m_changePasswordAction")); - m_changePasswordAction->setEnabled(true); - m_aboutIntensecoinAction = new QAction(MainWindow); - m_aboutIntensecoinAction->setObjectName(QStringLiteral("m_aboutIntensecoinAction")); - m_aboutIntensecoinAction->setEnabled(true); - m_aboutQtAction = new QAction(MainWindow); - m_aboutQtAction->setObjectName(QStringLiteral("m_aboutQtAction")); - m_aboutQtAction->setEnabled(true); - m_backupWalletAction = new QAction(MainWindow); - m_backupWalletAction->setObjectName(QStringLiteral("m_backupWalletAction")); - m_backupWalletAction->setEnabled(true); - m_autostartAction = new QAction(MainWindow); - m_autostartAction->setObjectName(QStringLiteral("m_autostartAction")); - m_autostartAction->setCheckable(true); - m_minimizeToTrayAction = new QAction(MainWindow); - m_minimizeToTrayAction->setObjectName(QStringLiteral("m_minimizeToTrayAction")); - m_minimizeToTrayAction->setCheckable(true); - m_closeToTrayAction = new QAction(MainWindow); - m_closeToTrayAction->setObjectName(QStringLiteral("m_closeToTrayAction")); - m_closeToTrayAction->setCheckable(true); - m_preferencesAction = new QAction(MainWindow); - m_preferencesAction->setObjectName(QStringLiteral("m_preferencesAction")); - m_recentWalletsAction = new QAction(MainWindow); - m_recentWalletsAction->setObjectName(QStringLiteral("m_recentWalletsAction")); - m_exportTrackingKeyAction = new QAction(MainWindow); - m_exportTrackingKeyAction->setObjectName(QStringLiteral("m_exportTrackingKeyAction")); - m_importKeyAction = new QAction(MainWindow); - m_importKeyAction->setObjectName(QStringLiteral("m_importKeyAction")); - m_communityForumAction = new QAction(MainWindow); - m_communityForumAction->setObjectName(QStringLiteral("m_communityForumAction")); - m_reportIssueAction = new QAction(MainWindow); - m_reportIssueAction->setObjectName(QStringLiteral("m_reportIssueAction")); - m_resetAction = new QAction(MainWindow); - m_resetAction->setObjectName(QStringLiteral("m_resetAction")); - m_saveKeysAction = new QAction(MainWindow); - m_saveKeysAction->setObjectName(QStringLiteral("m_saveKeysAction")); - m_exportKeyAction = new QAction(MainWindow); - m_exportKeyAction->setObjectName(QStringLiteral("m_exportKeyAction")); - m_removePendingTxAction = new QAction(MainWindow); - m_removePendingTxAction->setObjectName(QStringLiteral("m_removePendingTxAction")); - m_removePendingTxAction->setCheckable(false); - centralwidget = new QWidget(MainWindow); - centralwidget->setObjectName(QStringLiteral("centralwidget")); - verticalLayout_2 = new QVBoxLayout(centralwidget); - verticalLayout_2->setSpacing(0); - verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); - verticalLayout_2->setContentsMargins(0, 0, 0, 0); - m_headerFrame = new QFrame(centralwidget); - m_headerFrame->setObjectName(QStringLiteral("m_headerFrame")); - m_headerFrame->setMinimumSize(QSize(0, 116)); - m_headerFrame->setMaximumSize(QSize(16777215, 116)); - m_headerFrame->setFrameShape(QFrame::NoFrame); - m_headerFrame->setFrameShadow(QFrame::Raised); - horizontalLayout_3 = new QHBoxLayout(m_headerFrame); - horizontalLayout_3->setSpacing(0); - horizontalLayout_3->setObjectName(QStringLiteral("horizontalLayout_3")); - horizontalLayout_3->setContentsMargins(0, 0, 25, 0); - horizontalSpacer_2 = new QSpacerItem(30, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); - - horizontalLayout_3->addItem(horizontalSpacer_2); - - m_logoLabel = new QLabel(m_headerFrame); - m_logoLabel->setObjectName(QStringLiteral("m_logoLabel")); - - horizontalLayout_3->addWidget(m_logoLabel); - - horizontalSpacer_5 = new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); - - horizontalLayout_3->addItem(horizontalSpacer_5); - - m_noWalletLabel = new WalletGui::WalletSmallGrayTextLabel(m_headerFrame); - m_noWalletLabel->setObjectName(QStringLiteral("m_noWalletLabel")); - - horizontalLayout_3->addWidget(m_noWalletLabel); - - m_walletFrame = new QFrame(m_headerFrame); - m_walletFrame->setObjectName(QStringLiteral("m_walletFrame")); - m_walletFrame->setFrameShape(QFrame::NoFrame); - m_walletFrame->setFrameShadow(QFrame::Raised); - verticalLayout_3 = new QVBoxLayout(m_walletFrame); - verticalLayout_3->setSpacing(5); - verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); - verticalLayout_3->setContentsMargins(0, 0, 0, 0); - verticalSpacer_3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Minimum); - - verticalLayout_3->addItem(verticalSpacer_3); - - m_walletLabel = new WalletGui::WalletSmallGrayTextLabel(m_walletFrame); - m_walletLabel->setObjectName(QStringLiteral("m_walletLabel")); - m_walletLabel->setIndent(0); - - verticalLayout_3->addWidget(m_walletLabel); - - m_addressLabel = new QLabel(m_walletFrame); - m_addressLabel->setObjectName(QStringLiteral("m_addressLabel")); - sizePolicy.setHeightForWidth(m_addressLabel->sizePolicy().hasHeightForWidth()); - m_addressLabel->setSizePolicy(sizePolicy); - m_addressLabel->setCursor(QCursor(Qt::PointingHandCursor)); - m_addressLabel->setIndent(0); - - verticalLayout_3->addWidget(m_addressLabel); - - horizontalLayout_2 = new QHBoxLayout(); - horizontalLayout_2->setSpacing(0); - horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2")); - m_notEncryptedFrame = new QFrame(m_walletFrame); - m_notEncryptedFrame->setObjectName(QStringLiteral("m_notEncryptedFrame")); - m_notEncryptedFrame->setFrameShape(QFrame::NoFrame); - m_notEncryptedFrame->setFrameShadow(QFrame::Raised); - horizontalLayout_4 = new QHBoxLayout(m_notEncryptedFrame); - horizontalLayout_4->setSpacing(0); - horizontalLayout_4->setObjectName(QStringLiteral("horizontalLayout_4")); - horizontalLayout_4->setContentsMargins(0, 0, 0, 0); - m_notEncryptedIconLabel = new QLabel(m_notEncryptedFrame); - m_notEncryptedIconLabel->setObjectName(QStringLiteral("m_notEncryptedIconLabel")); - m_notEncryptedIconLabel->setPixmap(QPixmap(QString::fromUtf8(":/icons/lock_open_gray"))); - m_notEncryptedIconLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); - - horizontalLayout_4->addWidget(m_notEncryptedIconLabel, 0, Qt::AlignVCenter); - - horizontalSpacer_11 = new QSpacerItem(5, 3, QSizePolicy::Fixed, QSizePolicy::Minimum); - - horizontalLayout_4->addItem(horizontalSpacer_11); - - m_notEncryptedTextLabel = new WalletGui::WalletTinyGrayTextLabel(m_notEncryptedFrame); - m_notEncryptedTextLabel->setObjectName(QStringLiteral("m_notEncryptedTextLabel")); - m_notEncryptedTextLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); - - horizontalLayout_4->addWidget(m_notEncryptedTextLabel, 0, Qt::AlignVCenter); - - horizontalSpacer_9 = new QSpacerItem(3, 3, QSizePolicy::Fixed, QSizePolicy::Minimum); - - horizontalLayout_4->addItem(horizontalSpacer_9); - - m_encryptButton = new WalletGui::WalletTinyLinkLikeButton(m_notEncryptedFrame); - m_encryptButton->setObjectName(QStringLiteral("m_encryptButton")); - QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Minimum); - sizePolicy1.setHorizontalStretch(0); - sizePolicy1.setVerticalStretch(0); - sizePolicy1.setHeightForWidth(m_encryptButton->sizePolicy().hasHeightForWidth()); - m_encryptButton->setSizePolicy(sizePolicy1); - m_encryptButton->setMinimumSize(QSize(0, 3)); - m_encryptButton->setCursor(QCursor(Qt::PointingHandCursor)); - m_encryptButton->setFlat(true); - - horizontalLayout_4->addWidget(m_encryptButton, 0, Qt::AlignVCenter); - - horizontalSpacer_10 = new QSpacerItem(20, 3, QSizePolicy::Fixed, QSizePolicy::Minimum); - - horizontalLayout_4->addItem(horizontalSpacer_10); - - - horizontalLayout_2->addWidget(m_notEncryptedFrame, 0, Qt::AlignTop); - - m_copyAddressButton = new WalletGui::WalletTinyLinkLikeButton(m_walletFrame); - m_copyAddressButton->setObjectName(QStringLiteral("m_copyAddressButton")); - sizePolicy1.setHeightForWidth(m_copyAddressButton->sizePolicy().hasHeightForWidth()); - m_copyAddressButton->setSizePolicy(sizePolicy1); - m_copyAddressButton->setMinimumSize(QSize(0, 3)); - m_copyAddressButton->setCursor(QCursor(Qt::PointingHandCursor)); - m_copyAddressButton->setFocusPolicy(Qt::NoFocus); - m_copyAddressButton->setAutoFillBackground(true); - m_copyAddressButton->setFlat(true); - - horizontalLayout_2->addWidget(m_copyAddressButton, 0, Qt::AlignVCenter); - - horizontalSpacer_7 = new QSpacerItem(13, 3, QSizePolicy::Fixed, QSizePolicy::Minimum); - - horizontalLayout_2->addItem(horizontalSpacer_7); - - m_copyAddressLabel = new WalletGui::CopyMagicLabel(m_walletFrame); - m_copyAddressLabel->setObjectName(QStringLiteral("m_copyAddressLabel")); - m_copyAddressLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); - - horizontalLayout_2->addWidget(m_copyAddressLabel, 0, Qt::AlignVCenter); - - horizontalSpacer = new QSpacerItem(40, 3, QSizePolicy::Expanding, QSizePolicy::Minimum); - - horizontalLayout_2->addItem(horizontalSpacer); - - - verticalLayout_3->addLayout(horizontalLayout_2); - - verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Minimum); - - verticalLayout_3->addItem(verticalSpacer_2); - - - horizontalLayout_3->addWidget(m_walletFrame); - - horizontalSpacer_3 = new QSpacerItem(34, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - - horizontalLayout_3->addItem(horizontalSpacer_3); - - horizontalSpacer_8 = new QSpacerItem(34, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); - - horizontalLayout_3->addItem(horizontalSpacer_8); - - m_balanceFrame = new QFrame(m_headerFrame); - m_balanceFrame->setObjectName(QStringLiteral("m_balanceFrame")); - gridLayout = new QGridLayout(m_balanceFrame); - gridLayout->setObjectName(QStringLiteral("gridLayout")); - gridLayout->setVerticalSpacing(3); - gridLayout->setContentsMargins(0, 30, 0, 0); - verticalLayout_4 = new QVBoxLayout(); - verticalLayout_4->setObjectName(QStringLiteral("verticalLayout_4")); - m_balanceTextLabel = new QLabel(m_balanceFrame); - m_balanceTextLabel->setObjectName(QStringLiteral("m_balanceTextLabel")); - - verticalLayout_4->addWidget(m_balanceTextLabel); - - m_balanceLabel = new QLabel(m_balanceFrame); - m_balanceLabel->setObjectName(QStringLiteral("m_balanceLabel")); - m_balanceLabel->setCursor(QCursor(Qt::PointingHandCursor)); - - verticalLayout_4->addWidget(m_balanceLabel); - - - gridLayout->addLayout(verticalLayout_4, 0, 2, 1, 1); - - m_balanceCopyLabel = new WalletGui::CopyMagicLabel(m_balanceFrame); - m_balanceCopyLabel->setObjectName(QStringLiteral("m_balanceCopyLabel")); - - gridLayout->addWidget(m_balanceCopyLabel, 1, 2, 1, 1); - - horizontalSpacer_6 = new QSpacerItem(2, 39, QSizePolicy::Fixed, QSizePolicy::Minimum); - - gridLayout->addItem(horizontalSpacer_6, 0, 1, 1, 1); - - verticalSpacer_5 = new QSpacerItem(20, 50, QSizePolicy::Minimum, QSizePolicy::Expanding); - - gridLayout->addItem(verticalSpacer_5, 2, 2, 1, 1); - - m_balanceIconLabel = new QLabel(m_balanceFrame); - m_balanceIconLabel->setObjectName(QStringLiteral("m_balanceIconLabel")); - m_balanceIconLabel->setPixmap(QPixmap(QString::fromUtf8(":/icons/total_balance"))); - - gridLayout->addWidget(m_balanceIconLabel, 0, 0, 1, 1); - - - horizontalLayout_3->addWidget(m_balanceFrame, 0, Qt::AlignRight|Qt::AlignVCenter); - - - verticalLayout_2->addWidget(m_headerFrame); - - horizontalLayout = new QHBoxLayout(); - horizontalLayout->setSpacing(0); - horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); - m_toolFrame = new QFrame(centralwidget); - m_toolFrame->setObjectName(QStringLiteral("m_toolFrame")); - m_toolFrame->setFrameShape(QFrame::NoFrame); - m_toolFrame->setFrameShadow(QFrame::Plain); - m_toolFrame->setLineWidth(0); - verticalLayout = new QVBoxLayout(m_toolFrame); - verticalLayout->setSpacing(0); - verticalLayout->setObjectName(QStringLiteral("verticalLayout")); - verticalLayout->setContentsMargins(0, 0, 0, 0); - m_overviewButton = new QPushButton(m_toolFrame); - m_toolButtonGroup = new QButtonGroup(MainWindow); - m_toolButtonGroup->setObjectName(QStringLiteral("m_toolButtonGroup")); - m_toolButtonGroup->setExclusive(true); - m_toolButtonGroup->addButton(m_overviewButton); - m_overviewButton->setObjectName(QStringLiteral("m_overviewButton")); - QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Fixed); - sizePolicy2.setHorizontalStretch(0); - sizePolicy2.setVerticalStretch(0); - sizePolicy2.setHeightForWidth(m_overviewButton->sizePolicy().hasHeightForWidth()); - m_overviewButton->setSizePolicy(sizePolicy2); - m_overviewButton->setFocusPolicy(Qt::NoFocus); - m_overviewButton->setCheckable(true); - - verticalLayout->addWidget(m_overviewButton); - - m_sendButton = new QPushButton(m_toolFrame); - m_toolButtonGroup->addButton(m_sendButton); - m_sendButton->setObjectName(QStringLiteral("m_sendButton")); - sizePolicy2.setHeightForWidth(m_sendButton->sizePolicy().hasHeightForWidth()); - m_sendButton->setSizePolicy(sizePolicy2); - m_sendButton->setFocusPolicy(Qt::NoFocus); - m_sendButton->setCheckable(true); - - verticalLayout->addWidget(m_sendButton); - - m_transactionsButton = new QPushButton(m_toolFrame); - m_toolButtonGroup->addButton(m_transactionsButton); - m_transactionsButton->setObjectName(QStringLiteral("m_transactionsButton")); - sizePolicy2.setHeightForWidth(m_transactionsButton->sizePolicy().hasHeightForWidth()); - m_transactionsButton->setSizePolicy(sizePolicy2); - m_transactionsButton->setFocusPolicy(Qt::NoFocus); - m_transactionsButton->setCheckable(true); - - verticalLayout->addWidget(m_transactionsButton); - - m_blockExplorerButton = new QPushButton(m_toolFrame); - m_toolButtonGroup->addButton(m_blockExplorerButton); - m_blockExplorerButton->setObjectName(QStringLiteral("m_blockExplorerButton")); - m_blockExplorerButton->setFocusPolicy(Qt::NoFocus); - m_blockExplorerButton->setCheckable(true); - - verticalLayout->addWidget(m_blockExplorerButton); - - m_addressBookButton = new QPushButton(m_toolFrame); - m_toolButtonGroup->addButton(m_addressBookButton); - m_addressBookButton->setObjectName(QStringLiteral("m_addressBookButton")); - sizePolicy2.setHeightForWidth(m_addressBookButton->sizePolicy().hasHeightForWidth()); - m_addressBookButton->setSizePolicy(sizePolicy2); - m_addressBookButton->setFocusPolicy(Qt::NoFocus); - m_addressBookButton->setCheckable(true); - - verticalLayout->addWidget(m_addressBookButton); - - m_miningButton = new QPushButton(m_toolFrame); - m_toolButtonGroup->addButton(m_miningButton); - m_miningButton->setObjectName(QStringLiteral("m_miningButton")); - m_miningButton->setFocusPolicy(Qt::NoFocus); - m_miningButton->setCheckable(true); - - verticalLayout->addWidget(m_miningButton); - - verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); - - verticalLayout->addItem(verticalSpacer); - - - horizontalLayout->addWidget(m_toolFrame); - - m_overviewFrame = new WalletGui::OverviewFrame(centralwidget); - m_overviewFrame->setObjectName(QStringLiteral("m_overviewFrame")); - m_overviewFrame->setFrameShape(QFrame::NoFrame); - m_overviewFrame->setFrameShadow(QFrame::Raised); - - horizontalLayout->addWidget(m_overviewFrame); - - m_sendFrame = new WalletGui::SendFrame(centralwidget); - m_sendFrame->setObjectName(QStringLiteral("m_sendFrame")); - m_sendFrame->setFrameShape(QFrame::NoFrame); - m_sendFrame->setFrameShadow(QFrame::Raised); - - horizontalLayout->addWidget(m_sendFrame); - - m_transactionsFrame = new WalletGui::TransactionsFrame(centralwidget); - m_transactionsFrame->setObjectName(QStringLiteral("m_transactionsFrame")); - m_transactionsFrame->setFrameShape(QFrame::NoFrame); - m_transactionsFrame->setFrameShadow(QFrame::Raised); - - horizontalLayout->addWidget(m_transactionsFrame); - - m_addressBookFrame = new WalletGui::AddressBookFrame(centralwidget); - m_addressBookFrame->setObjectName(QStringLiteral("m_addressBookFrame")); - m_addressBookFrame->setFrameShape(QFrame::NoFrame); - m_addressBookFrame->setFrameShadow(QFrame::Raised); - - horizontalLayout->addWidget(m_addressBookFrame); - - m_noWalletFrame = new WalletGui::NoWalletFrame(centralwidget); - m_noWalletFrame->setObjectName(QStringLiteral("m_noWalletFrame")); - m_noWalletFrame->setFrameShape(QFrame::NoFrame); - m_noWalletFrame->setFrameShadow(QFrame::Raised); - - horizontalLayout->addWidget(m_noWalletFrame); - - m_blockExplorerFrame = new WalletGui::BlockExplorerFrame(centralwidget); - m_blockExplorerFrame->setObjectName(QStringLiteral("m_blockExplorerFrame")); - m_blockExplorerFrame->setFrameShape(QFrame::NoFrame); - m_blockExplorerFrame->setFrameShadow(QFrame::Raised); - - horizontalLayout->addWidget(m_blockExplorerFrame); - - m_miningFrame = new WalletGui::MiningFrame(centralwidget); - m_miningFrame->setObjectName(QStringLiteral("m_miningFrame")); - m_miningFrame->setFrameShape(QFrame::NoFrame); - m_miningFrame->setFrameShadow(QFrame::Raised); - - horizontalLayout->addWidget(m_miningFrame); - - - verticalLayout_2->addLayout(horizontalLayout); - - m_syncProgress = new QProgressBar(centralwidget); - m_syncProgress->setObjectName(QStringLiteral("m_syncProgress")); - m_syncProgress->setMaximum(100); - m_syncProgress->setValue(0); - m_syncProgress->setTextVisible(false); - - verticalLayout_2->addWidget(m_syncProgress); - - MainWindow->setCentralWidget(centralwidget); - menubar = new QMenuBar(MainWindow); - menubar->setObjectName(QStringLiteral("menubar")); - menubar->setGeometry(QRect(0, 0, 1273, 21)); - menuFile = new QMenu(menubar); - menuFile->setObjectName(QStringLiteral("menuFile")); - menuSettings = new QMenu(menubar); - menuSettings->setObjectName(QStringLiteral("menuSettings")); - menuThemes = new QMenu(menuSettings); - menuThemes->setObjectName(QStringLiteral("menuThemes")); - menuHelp = new QMenu(menubar); - menuHelp->setObjectName(QStringLiteral("menuHelp")); - MainWindow->setMenuBar(menubar); - statusBar = new WalletGui::WalletStatusBar(MainWindow); - statusBar->setObjectName(QStringLiteral("statusBar")); - MainWindow->setStatusBar(statusBar); - - menubar->addAction(menuFile->menuAction()); - menubar->addAction(menuSettings->menuAction()); - menubar->addAction(menuHelp->menuAction()); - menuFile->addAction(m_createWalletAction); - menuFile->addAction(m_openWalletAction); - menuFile->addAction(m_recentWalletsAction); - menuFile->addAction(m_backupWalletAction); - menuFile->addAction(m_saveKeysAction); - menuFile->addAction(m_resetAction); - menuFile->addAction(m_importKeyAction); - menuFile->addAction(m_exportKeyAction); - menuFile->addAction(m_exportTrackingKeyAction); - menuFile->addAction(m_exitAction); - menuSettings->addAction(m_encryptWalletAction); - menuSettings->addAction(m_changePasswordAction); - menuSettings->addAction(m_removePendingTxAction); - menuSettings->addSeparator(); - menuSettings->addAction(m_autostartAction); - menuSettings->addAction(m_minimizeToTrayAction); - menuSettings->addAction(m_closeToTrayAction); - menuSettings->addSeparator(); - menuSettings->addAction(m_preferencesAction); - menuSettings->addAction(menuThemes->menuAction()); - menuHelp->addAction(m_communityForumAction); - menuHelp->addAction(m_reportIssueAction); - menuHelp->addAction(m_aboutIntensecoinAction); - menuHelp->addAction(m_aboutQtAction); - - retranslateUi(MainWindow); - QObject::connect(m_createWalletAction, SIGNAL(triggered()), MainWindow, SLOT(createWallet())); - QObject::connect(m_openWalletAction, SIGNAL(triggered()), MainWindow, SLOT(openWallet())); - QObject::connect(m_encryptWalletAction, SIGNAL(triggered()), MainWindow, SLOT(encryptWallet())); - QObject::connect(m_changePasswordAction, SIGNAL(triggered()), MainWindow, SLOT(encryptWallet())); - QObject::connect(m_removePendingTxAction, SIGNAL(triggered()), MainWindow, SLOT(removePendingTx())); - QObject::connect(m_aboutQtAction, SIGNAL(triggered()), MainWindow, SLOT(aboutQt())); - QObject::connect(m_backupWalletAction, SIGNAL(triggered()), MainWindow, SLOT(backupWallet())); - QObject::connect(m_aboutIntensecoinAction, SIGNAL(triggered()), MainWindow, SLOT(about())); - QObject::connect(m_overviewButton, SIGNAL(toggled(bool)), m_overviewFrame, SLOT(setVisible(bool))); - QObject::connect(m_transactionsButton, SIGNAL(toggled(bool)), m_transactionsFrame, SLOT(setVisible(bool))); - QObject::connect(m_addressBookButton, SIGNAL(toggled(bool)), m_addressBookFrame, SLOT(setVisible(bool))); - QObject::connect(m_sendButton, SIGNAL(toggled(bool)), m_sendFrame, SLOT(setVisible(bool))); - QObject::connect(m_copyAddressButton, SIGNAL(clicked()), MainWindow, SLOT(copyAddress())); - QObject::connect(m_autostartAction, SIGNAL(triggered(bool)), MainWindow, SLOT(setStartOnLoginEnabled(bool))); - QObject::connect(m_minimizeToTrayAction, SIGNAL(triggered(bool)), MainWindow, SLOT(setMinimizeToTrayEnabled(bool))); - QObject::connect(m_closeToTrayAction, SIGNAL(triggered(bool)), MainWindow, SLOT(setCloseToTrayEnabled(bool))); - QObject::connect(m_encryptButton, SIGNAL(clicked()), m_encryptWalletAction, SLOT(trigger())); - QObject::connect(m_preferencesAction, SIGNAL(triggered()), MainWindow, SLOT(showPreferences())); - QObject::connect(m_blockExplorerButton, SIGNAL(toggled(bool)), m_blockExplorerFrame, SLOT(setVisible(bool))); - QObject::connect(m_miningButton, SIGNAL(toggled(bool)), m_miningFrame, SLOT(setVisible(bool))); - QObject::connect(m_exportTrackingKeyAction, SIGNAL(triggered()), MainWindow, SLOT(exportTrackingKey())); - QObject::connect(m_importKeyAction, SIGNAL(triggered()), MainWindow, SLOT(importKey())); - QObject::connect(m_communityForumAction, SIGNAL(triggered()), MainWindow, SLOT(communityForumTriggered())); - QObject::connect(m_reportIssueAction, SIGNAL(triggered()), MainWindow, SLOT(reportIssueTriggered())); - QObject::connect(m_resetAction, SIGNAL(triggered()), MainWindow, SLOT(resetWallet())); - QObject::connect(m_saveKeysAction, SIGNAL(triggered()), MainWindow, SLOT(saveWalletKeys())); - QObject::connect(m_exportKeyAction, SIGNAL(triggered()), MainWindow, SLOT(exportKey())); - - QMetaObject::connectSlotsByName(MainWindow); - } // setupUi - - void retranslateUi(QMainWindow *MainWindow) - { - MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", Q_NULLPTR)); - m_exitAction->setText(QApplication::translate("MainWindow", "Exit", Q_NULLPTR)); - m_exitAction->setShortcut(QApplication::translate("MainWindow", "Ctrl+Q", Q_NULLPTR)); - m_createWalletAction->setText(QApplication::translate("MainWindow", "Create wallet", Q_NULLPTR)); - m_openWalletAction->setText(QApplication::translate("MainWindow", "Open wallet", Q_NULLPTR)); - m_encryptWalletAction->setText(QApplication::translate("MainWindow", "Encrypt wallet", Q_NULLPTR)); - m_changePasswordAction->setText(QApplication::translate("MainWindow", "Change password", Q_NULLPTR)); -#ifndef QT_NO_TOOLTIP - m_changePasswordAction->setToolTip(QApplication::translate("MainWindow", "Change password", Q_NULLPTR)); -#endif // QT_NO_TOOLTIP - m_aboutIntensecoinAction->setText(QApplication::translate("MainWindow", "About Intensecoin", Q_NULLPTR)); - m_aboutQtAction->setText(QApplication::translate("MainWindow", "About Qt", Q_NULLPTR)); - m_backupWalletAction->setText(QApplication::translate("MainWindow", "Backup wallet", Q_NULLPTR)); - m_autostartAction->setText(QApplication::translate("MainWindow", "Start on system login", Q_NULLPTR)); - m_minimizeToTrayAction->setText(QApplication::translate("MainWindow", "Minimize to tray", Q_NULLPTR)); - m_closeToTrayAction->setText(QApplication::translate("MainWindow", "Close to tray", Q_NULLPTR)); - m_preferencesAction->setText(QApplication::translate("MainWindow", "Preferences", Q_NULLPTR)); - m_recentWalletsAction->setText(QApplication::translate("MainWindow", "Recent wallets", Q_NULLPTR)); - m_exportTrackingKeyAction->setText(QApplication::translate("MainWindow", "Export tracking key", Q_NULLPTR)); -#ifndef QT_NO_TOOLTIP - m_exportTrackingKeyAction->setToolTip(QApplication::translate("MainWindow", "Export tracking key", Q_NULLPTR)); -#endif // QT_NO_TOOLTIP - m_importKeyAction->setText(QApplication::translate("MainWindow", "Import key", Q_NULLPTR)); -#ifndef QT_NO_TOOLTIP - m_importKeyAction->setToolTip(QApplication::translate("MainWindow", "Import key", Q_NULLPTR)); -#endif // QT_NO_TOOLTIP - m_communityForumAction->setText(QApplication::translate("MainWindow", "Join us on Slack", Q_NULLPTR)); - m_reportIssueAction->setText(QApplication::translate("MainWindow", "Report an issue", Q_NULLPTR)); - m_resetAction->setText(QApplication::translate("MainWindow", "Reset wallet", Q_NULLPTR)); - m_saveKeysAction->setText(QApplication::translate("MainWindow", "Save wallet keys", Q_NULLPTR)); - m_exportKeyAction->setText(QApplication::translate("MainWindow", "Export key", Q_NULLPTR)); -#ifndef QT_NO_TOOLTIP - m_exportKeyAction->setToolTip(QApplication::translate("MainWindow", "Export key", Q_NULLPTR)); -#endif // QT_NO_TOOLTIP - m_removePendingTxAction->setText(QApplication::translate("MainWindow", "Remove pending TXs", Q_NULLPTR)); - m_logoLabel->setText(QString()); - m_noWalletLabel->setText(QApplication::translate("MainWindow", "No active wallet", Q_NULLPTR)); - m_walletLabel->setText(QApplication::translate("MainWindow", "Your wallet:", Q_NULLPTR)); -#ifndef QT_NO_TOOLTIP - m_addressLabel->setToolTip(QApplication::translate("MainWindow", "Click to copy", Q_NULLPTR)); -#endif // QT_NO_TOOLTIP - m_addressLabel->setText(QApplication::translate("MainWindow", "ADDRESS", Q_NULLPTR)); - m_notEncryptedIconLabel->setText(QString()); - m_notEncryptedTextLabel->setText(QApplication::translate("MainWindow", "Wallet not encrypted!", Q_NULLPTR)); - m_encryptButton->setText(QApplication::translate("MainWindow", "Set password", Q_NULLPTR)); - m_copyAddressButton->setText(QApplication::translate("MainWindow", "Copy address", Q_NULLPTR)); - m_copyAddressLabel->setText(QApplication::translate("MainWindow", "Address copied to clipboard", Q_NULLPTR)); - m_balanceTextLabel->setText(QApplication::translate("MainWindow", "Total balance", Q_NULLPTR)); -#ifndef QT_NO_TOOLTIP - m_balanceLabel->setToolTip(QApplication::translate("MainWindow", "Click to copy", Q_NULLPTR)); -#endif // QT_NO_TOOLTIP - m_balanceLabel->setText(QApplication::translate("MainWindow", "0.00", Q_NULLPTR)); - m_balanceCopyLabel->setText(QApplication::translate("MainWindow", "Copied!", Q_NULLPTR)); - m_balanceIconLabel->setText(QString()); - m_overviewButton->setText(QApplication::translate("MainWindow", "OVERVIEW", Q_NULLPTR)); - m_sendButton->setText(QApplication::translate("MainWindow", "SEND INTENSECOINS", Q_NULLPTR)); - m_transactionsButton->setText(QApplication::translate("MainWindow", "TRANSACTIONS", Q_NULLPTR)); - m_blockExplorerButton->setText(QApplication::translate("MainWindow", "BLOCK EXPLORER", Q_NULLPTR)); - m_addressBookButton->setText(QApplication::translate("MainWindow", "CONTACTS", Q_NULLPTR)); - m_miningButton->setText(QApplication::translate("MainWindow", "MINING", Q_NULLPTR)); - menuFile->setTitle(QApplication::translate("MainWindow", "File", Q_NULLPTR)); - menuSettings->setTitle(QApplication::translate("MainWindow", "Settings", Q_NULLPTR)); - menuThemes->setTitle(QApplication::translate("MainWindow", "Themes", Q_NULLPTR)); - menuHelp->setTitle(QApplication::translate("MainWindow", "Help", Q_NULLPTR)); - } // retranslateUi - -}; - -namespace Ui { - class MainWindow: public Ui_MainWindow {}; -} // namespace Ui - -QT_END_NAMESPACE - -#endif // UI_MAINWINDOW_H +/******************************************************************************** +** Form generated from reading UI file 'MainWindow.ui' +** +** Created by: Qt User Interface Compiler version 5.8.0 +** +** WARNING! All changes made in this file will be lost when recompiling UI file! +********************************************************************************/ + +#ifndef UI_MAINWINDOW_H +#define UI_MAINWINDOW_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Gui/AddressBook/AddressBookFrame.h" +#include "Gui/BlockchainExplorer/BlockExplorerFrame.h" +#include "Gui/Common/CopyMagicLabel.h" +#include "Gui/Common/WalletLinkLikeButton.h" +#include "Gui/Common/WalletTextLabel.h" +#include "Gui/MainWindow/WalletStatusBar.h" +#include "Gui/Mining/MiningFrame.h" +#include "Gui/NoWallet/NoWalletFrame.h" +#include "Gui/Overview/OverviewFrame.h" +#include "Gui/Send/SendFrame.h" +#include "Gui/Transactions/TransactionsFrame.h" + +QT_BEGIN_NAMESPACE + +class Ui_MainWindow +{ +public: + QAction *m_exitAction; + QAction *m_createWalletAction; + QAction *m_openWalletAction; + QAction *m_encryptWalletAction; + QAction *m_changePasswordAction; + QAction *m_aboutIntensecoinAction; + QAction *m_aboutQtAction; + QAction *m_backupWalletAction; + QAction *m_autostartAction; + QAction *m_minimizeToTrayAction; + QAction *m_closeToTrayAction; + QAction *m_preferencesAction; + QAction *m_recentWalletsAction; + QAction *m_exportTrackingKeyAction; + QAction *m_importKeyAction; + QAction *m_communityForumAction; + QAction *m_reportIssueAction; + QAction *m_resetAction; + QAction *m_saveKeysAction; + QAction *m_exportKeyAction; + QAction *m_exportPrivateKeyAction; + QAction *m_removePendingTxAction; + QWidget *centralwidget; + QVBoxLayout *verticalLayout_2; + QFrame *m_headerFrame; + QHBoxLayout *horizontalLayout_3; + QSpacerItem *horizontalSpacer_2; + QLabel *m_logoLabel; + QSpacerItem *horizontalSpacer_5; + WalletGui::WalletSmallGrayTextLabel *m_noWalletLabel; + QFrame *m_walletFrame; + QVBoxLayout *verticalLayout_3; + QSpacerItem *verticalSpacer_3; + WalletGui::WalletSmallGrayTextLabel *m_walletLabel; + QLabel *m_addressLabel; + QHBoxLayout *horizontalLayout_2; + QFrame *m_notEncryptedFrame; + QHBoxLayout *horizontalLayout_4; + QLabel *m_notEncryptedIconLabel; + QSpacerItem *horizontalSpacer_11; + WalletGui::WalletTinyGrayTextLabel *m_notEncryptedTextLabel; + QSpacerItem *horizontalSpacer_9; + WalletGui::WalletTinyLinkLikeButton *m_encryptButton; + QSpacerItem *horizontalSpacer_10; + WalletGui::WalletTinyLinkLikeButton *m_copyAddressButton; + QSpacerItem *horizontalSpacer_7; + WalletGui::CopyMagicLabel *m_copyAddressLabel; + QSpacerItem *horizontalSpacer; + QSpacerItem *verticalSpacer_2; + QSpacerItem *horizontalSpacer_3; + QSpacerItem *horizontalSpacer_8; + QFrame *m_balanceFrame; + QGridLayout *gridLayout; + QVBoxLayout *verticalLayout_4; + QLabel *m_balanceTextLabel; + QLabel *m_balanceLabel; + WalletGui::CopyMagicLabel *m_balanceCopyLabel; + QSpacerItem *horizontalSpacer_6; + QSpacerItem *verticalSpacer_5; + QLabel *m_balanceIconLabel; + QHBoxLayout *horizontalLayout; + QFrame *m_toolFrame; + QVBoxLayout *verticalLayout; + QPushButton *m_overviewButton; + QPushButton *m_sendButton; + QPushButton *m_transactionsButton; + QPushButton *m_blockExplorerButton; + QPushButton *m_addressBookButton; + QPushButton *m_miningButton; + QSpacerItem *verticalSpacer; + WalletGui::OverviewFrame *m_overviewFrame; + WalletGui::SendFrame *m_sendFrame; + WalletGui::TransactionsFrame *m_transactionsFrame; + WalletGui::AddressBookFrame *m_addressBookFrame; + WalletGui::NoWalletFrame *m_noWalletFrame; + WalletGui::BlockExplorerFrame *m_blockExplorerFrame; + WalletGui::MiningFrame *m_miningFrame; + QProgressBar *m_syncProgress; + QMenuBar *menubar; + QMenu *menuFile; + QMenu *menuSettings; + QMenu *menuThemes; + QMenu *menuHelp; + WalletGui::WalletStatusBar *statusBar; + QButtonGroup *m_toolButtonGroup; + + void setupUi(QMainWindow *MainWindow) + { + if (MainWindow->objectName().isEmpty()) + MainWindow->setObjectName(QStringLiteral("MainWindow")); + MainWindow->resize(1273, 824); + QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth(MainWindow->sizePolicy().hasHeightForWidth()); + MainWindow->setSizePolicy(sizePolicy); + MainWindow->setMinimumSize(QSize(1260, 600)); + MainWindow->setMaximumSize(QSize(16777215, 16777215)); + QIcon icon; + icon.addFile(QStringLiteral(":/images/intensecoin"), QSize(), QIcon::Normal, QIcon::Off); + MainWindow->setWindowIcon(icon); + m_exitAction = new QAction(MainWindow); + m_exitAction->setObjectName(QStringLiteral("m_exitAction")); + m_exitAction->setCheckable(false); + m_exitAction->setEnabled(true); + m_createWalletAction = new QAction(MainWindow); + m_createWalletAction->setObjectName(QStringLiteral("m_createWalletAction")); + m_createWalletAction->setEnabled(true); + m_openWalletAction = new QAction(MainWindow); + m_openWalletAction->setObjectName(QStringLiteral("m_openWalletAction")); + m_openWalletAction->setEnabled(true); + m_encryptWalletAction = new QAction(MainWindow); + m_encryptWalletAction->setObjectName(QStringLiteral("m_encryptWalletAction")); + m_encryptWalletAction->setEnabled(true); + m_changePasswordAction = new QAction(MainWindow); + m_changePasswordAction->setObjectName(QStringLiteral("m_changePasswordAction")); + m_changePasswordAction->setEnabled(true); + m_aboutIntensecoinAction = new QAction(MainWindow); + m_aboutIntensecoinAction->setObjectName(QStringLiteral("m_aboutIntensecoinAction")); + m_aboutIntensecoinAction->setEnabled(true); + m_aboutQtAction = new QAction(MainWindow); + m_aboutQtAction->setObjectName(QStringLiteral("m_aboutQtAction")); + m_aboutQtAction->setEnabled(true); + m_backupWalletAction = new QAction(MainWindow); + m_backupWalletAction->setObjectName(QStringLiteral("m_backupWalletAction")); + m_backupWalletAction->setEnabled(true); + m_autostartAction = new QAction(MainWindow); + m_autostartAction->setObjectName(QStringLiteral("m_autostartAction")); + m_autostartAction->setCheckable(true); + m_minimizeToTrayAction = new QAction(MainWindow); + m_minimizeToTrayAction->setObjectName(QStringLiteral("m_minimizeToTrayAction")); + m_minimizeToTrayAction->setCheckable(true); + m_closeToTrayAction = new QAction(MainWindow); + m_closeToTrayAction->setObjectName(QStringLiteral("m_closeToTrayAction")); + m_closeToTrayAction->setCheckable(true); + m_preferencesAction = new QAction(MainWindow); + m_preferencesAction->setObjectName(QStringLiteral("m_preferencesAction")); + m_recentWalletsAction = new QAction(MainWindow); + m_recentWalletsAction->setObjectName(QStringLiteral("m_recentWalletsAction")); + m_exportTrackingKeyAction = new QAction(MainWindow); + m_exportTrackingKeyAction->setObjectName(QStringLiteral("m_exportTrackingKeyAction")); + m_importKeyAction = new QAction(MainWindow); + m_importKeyAction->setObjectName(QStringLiteral("m_importKeyAction")); + m_communityForumAction = new QAction(MainWindow); + m_communityForumAction->setObjectName(QStringLiteral("m_communityForumAction")); + m_reportIssueAction = new QAction(MainWindow); + m_reportIssueAction->setObjectName(QStringLiteral("m_reportIssueAction")); + m_resetAction = new QAction(MainWindow); + m_resetAction->setObjectName(QStringLiteral("m_resetAction")); + m_saveKeysAction = new QAction(MainWindow); + m_saveKeysAction->setObjectName(QStringLiteral("m_saveKeysAction")); + m_exportKeyAction = new QAction(MainWindow); + m_exportKeyAction->setObjectName(QStringLiteral("m_exportKeyAction")); + m_exportPrivateKeyAction = new QAction(MainWindow); + m_exportPrivateKeyAction->setObjectName(QStringLiteral("m_exportPrivateKeyAction")); + m_removePendingTxAction = new QAction(MainWindow); + m_removePendingTxAction->setObjectName(QStringLiteral("m_removePendingTxAction")); + m_removePendingTxAction->setCheckable(false); + centralwidget = new QWidget(MainWindow); + centralwidget->setObjectName(QStringLiteral("centralwidget")); + verticalLayout_2 = new QVBoxLayout(centralwidget); + verticalLayout_2->setSpacing(0); + verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); + verticalLayout_2->setContentsMargins(0, 0, 0, 0); + m_headerFrame = new QFrame(centralwidget); + m_headerFrame->setObjectName(QStringLiteral("m_headerFrame")); + m_headerFrame->setMinimumSize(QSize(0, 116)); + m_headerFrame->setMaximumSize(QSize(16777215, 116)); + m_headerFrame->setFrameShape(QFrame::NoFrame); + m_headerFrame->setFrameShadow(QFrame::Raised); + horizontalLayout_3 = new QHBoxLayout(m_headerFrame); + horizontalLayout_3->setSpacing(0); + horizontalLayout_3->setObjectName(QStringLiteral("horizontalLayout_3")); + horizontalLayout_3->setContentsMargins(0, 0, 25, 0); + horizontalSpacer_2 = new QSpacerItem(30, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); + + horizontalLayout_3->addItem(horizontalSpacer_2); + + m_logoLabel = new QLabel(m_headerFrame); + m_logoLabel->setObjectName(QStringLiteral("m_logoLabel")); + + horizontalLayout_3->addWidget(m_logoLabel); + + horizontalSpacer_5 = new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); + + horizontalLayout_3->addItem(horizontalSpacer_5); + + m_noWalletLabel = new WalletGui::WalletSmallGrayTextLabel(m_headerFrame); + m_noWalletLabel->setObjectName(QStringLiteral("m_noWalletLabel")); + + horizontalLayout_3->addWidget(m_noWalletLabel); + + m_walletFrame = new QFrame(m_headerFrame); + m_walletFrame->setObjectName(QStringLiteral("m_walletFrame")); + m_walletFrame->setFrameShape(QFrame::NoFrame); + m_walletFrame->setFrameShadow(QFrame::Raised); + verticalLayout_3 = new QVBoxLayout(m_walletFrame); + verticalLayout_3->setSpacing(5); + verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); + verticalLayout_3->setContentsMargins(0, 0, 0, 0); + verticalSpacer_3 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Minimum); + + verticalLayout_3->addItem(verticalSpacer_3); + + m_walletLabel = new WalletGui::WalletSmallGrayTextLabel(m_walletFrame); + m_walletLabel->setObjectName(QStringLiteral("m_walletLabel")); + m_walletLabel->setIndent(0); + + verticalLayout_3->addWidget(m_walletLabel); + + m_addressLabel = new QLabel(m_walletFrame); + m_addressLabel->setObjectName(QStringLiteral("m_addressLabel")); + sizePolicy.setHeightForWidth(m_addressLabel->sizePolicy().hasHeightForWidth()); + m_addressLabel->setSizePolicy(sizePolicy); + m_addressLabel->setCursor(QCursor(Qt::PointingHandCursor)); + m_addressLabel->setIndent(0); + + verticalLayout_3->addWidget(m_addressLabel); + + horizontalLayout_2 = new QHBoxLayout(); + horizontalLayout_2->setSpacing(0); + horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2")); + m_notEncryptedFrame = new QFrame(m_walletFrame); + m_notEncryptedFrame->setObjectName(QStringLiteral("m_notEncryptedFrame")); + m_notEncryptedFrame->setFrameShape(QFrame::NoFrame); + m_notEncryptedFrame->setFrameShadow(QFrame::Raised); + horizontalLayout_4 = new QHBoxLayout(m_notEncryptedFrame); + horizontalLayout_4->setSpacing(0); + horizontalLayout_4->setObjectName(QStringLiteral("horizontalLayout_4")); + horizontalLayout_4->setContentsMargins(0, 0, 0, 0); + m_notEncryptedIconLabel = new QLabel(m_notEncryptedFrame); + m_notEncryptedIconLabel->setObjectName(QStringLiteral("m_notEncryptedIconLabel")); + m_notEncryptedIconLabel->setPixmap(QPixmap(QString::fromUtf8(":/icons/lock_open_gray"))); + m_notEncryptedIconLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); + + horizontalLayout_4->addWidget(m_notEncryptedIconLabel, 0, Qt::AlignVCenter); + + horizontalSpacer_11 = new QSpacerItem(5, 3, QSizePolicy::Fixed, QSizePolicy::Minimum); + + horizontalLayout_4->addItem(horizontalSpacer_11); + + m_notEncryptedTextLabel = new WalletGui::WalletTinyGrayTextLabel(m_notEncryptedFrame); + m_notEncryptedTextLabel->setObjectName(QStringLiteral("m_notEncryptedTextLabel")); + m_notEncryptedTextLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); + + horizontalLayout_4->addWidget(m_notEncryptedTextLabel, 0, Qt::AlignVCenter); + + horizontalSpacer_9 = new QSpacerItem(3, 3, QSizePolicy::Fixed, QSizePolicy::Minimum); + + horizontalLayout_4->addItem(horizontalSpacer_9); + + m_encryptButton = new WalletGui::WalletTinyLinkLikeButton(m_notEncryptedFrame); + m_encryptButton->setObjectName(QStringLiteral("m_encryptButton")); + QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Minimum); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth(m_encryptButton->sizePolicy().hasHeightForWidth()); + m_encryptButton->setSizePolicy(sizePolicy1); + m_encryptButton->setMinimumSize(QSize(0, 3)); + m_encryptButton->setCursor(QCursor(Qt::PointingHandCursor)); + m_encryptButton->setFlat(true); + + horizontalLayout_4->addWidget(m_encryptButton, 0, Qt::AlignVCenter); + + horizontalSpacer_10 = new QSpacerItem(20, 3, QSizePolicy::Fixed, QSizePolicy::Minimum); + + horizontalLayout_4->addItem(horizontalSpacer_10); + + + horizontalLayout_2->addWidget(m_notEncryptedFrame, 0, Qt::AlignTop); + + m_copyAddressButton = new WalletGui::WalletTinyLinkLikeButton(m_walletFrame); + m_copyAddressButton->setObjectName(QStringLiteral("m_copyAddressButton")); + sizePolicy1.setHeightForWidth(m_copyAddressButton->sizePolicy().hasHeightForWidth()); + m_copyAddressButton->setSizePolicy(sizePolicy1); + m_copyAddressButton->setMinimumSize(QSize(0, 3)); + m_copyAddressButton->setCursor(QCursor(Qt::PointingHandCursor)); + m_copyAddressButton->setFocusPolicy(Qt::NoFocus); + m_copyAddressButton->setAutoFillBackground(true); + m_copyAddressButton->setFlat(true); + + horizontalLayout_2->addWidget(m_copyAddressButton, 0, Qt::AlignVCenter); + + horizontalSpacer_7 = new QSpacerItem(13, 3, QSizePolicy::Fixed, QSizePolicy::Minimum); + + horizontalLayout_2->addItem(horizontalSpacer_7); + + m_copyAddressLabel = new WalletGui::CopyMagicLabel(m_walletFrame); + m_copyAddressLabel->setObjectName(QStringLiteral("m_copyAddressLabel")); + m_copyAddressLabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); + + horizontalLayout_2->addWidget(m_copyAddressLabel, 0, Qt::AlignVCenter); + + horizontalSpacer = new QSpacerItem(40, 3, QSizePolicy::Expanding, QSizePolicy::Minimum); + + horizontalLayout_2->addItem(horizontalSpacer); + + + verticalLayout_3->addLayout(horizontalLayout_2); + + verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Minimum); + + verticalLayout_3->addItem(verticalSpacer_2); + + + horizontalLayout_3->addWidget(m_walletFrame); + + horizontalSpacer_3 = new QSpacerItem(34, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + + horizontalLayout_3->addItem(horizontalSpacer_3); + + horizontalSpacer_8 = new QSpacerItem(34, 20, QSizePolicy::Fixed, QSizePolicy::Minimum); + + horizontalLayout_3->addItem(horizontalSpacer_8); + + m_balanceFrame = new QFrame(m_headerFrame); + m_balanceFrame->setObjectName(QStringLiteral("m_balanceFrame")); + gridLayout = new QGridLayout(m_balanceFrame); + gridLayout->setObjectName(QStringLiteral("gridLayout")); + gridLayout->setVerticalSpacing(3); + gridLayout->setContentsMargins(0, 30, 0, 0); + verticalLayout_4 = new QVBoxLayout(); + verticalLayout_4->setObjectName(QStringLiteral("verticalLayout_4")); + m_balanceTextLabel = new QLabel(m_balanceFrame); + m_balanceTextLabel->setObjectName(QStringLiteral("m_balanceTextLabel")); + + verticalLayout_4->addWidget(m_balanceTextLabel); + + m_balanceLabel = new QLabel(m_balanceFrame); + m_balanceLabel->setObjectName(QStringLiteral("m_balanceLabel")); + m_balanceLabel->setCursor(QCursor(Qt::PointingHandCursor)); + + verticalLayout_4->addWidget(m_balanceLabel); + + + gridLayout->addLayout(verticalLayout_4, 0, 2, 1, 1); + + m_balanceCopyLabel = new WalletGui::CopyMagicLabel(m_balanceFrame); + m_balanceCopyLabel->setObjectName(QStringLiteral("m_balanceCopyLabel")); + + gridLayout->addWidget(m_balanceCopyLabel, 1, 2, 1, 1); + + horizontalSpacer_6 = new QSpacerItem(2, 39, QSizePolicy::Fixed, QSizePolicy::Minimum); + + gridLayout->addItem(horizontalSpacer_6, 0, 1, 1, 1); + + verticalSpacer_5 = new QSpacerItem(20, 50, QSizePolicy::Minimum, QSizePolicy::Expanding); + + gridLayout->addItem(verticalSpacer_5, 2, 2, 1, 1); + + m_balanceIconLabel = new QLabel(m_balanceFrame); + m_balanceIconLabel->setObjectName(QStringLiteral("m_balanceIconLabel")); + m_balanceIconLabel->setPixmap(QPixmap(QString::fromUtf8(":/icons/total_balance"))); + + gridLayout->addWidget(m_balanceIconLabel, 0, 0, 1, 1); + + + horizontalLayout_3->addWidget(m_balanceFrame, 0, Qt::AlignRight|Qt::AlignVCenter); + + + verticalLayout_2->addWidget(m_headerFrame); + + horizontalLayout = new QHBoxLayout(); + horizontalLayout->setSpacing(0); + horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); + m_toolFrame = new QFrame(centralwidget); + m_toolFrame->setObjectName(QStringLiteral("m_toolFrame")); + m_toolFrame->setFrameShape(QFrame::NoFrame); + m_toolFrame->setFrameShadow(QFrame::Plain); + m_toolFrame->setLineWidth(0); + verticalLayout = new QVBoxLayout(m_toolFrame); + verticalLayout->setSpacing(0); + verticalLayout->setObjectName(QStringLiteral("verticalLayout")); + verticalLayout->setContentsMargins(0, 0, 0, 0); + m_overviewButton = new QPushButton(m_toolFrame); + m_toolButtonGroup = new QButtonGroup(MainWindow); + m_toolButtonGroup->setObjectName(QStringLiteral("m_toolButtonGroup")); + m_toolButtonGroup->setExclusive(true); + m_toolButtonGroup->addButton(m_overviewButton); + m_overviewButton->setObjectName(QStringLiteral("m_overviewButton")); + QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Fixed); + sizePolicy2.setHorizontalStretch(0); + sizePolicy2.setVerticalStretch(0); + sizePolicy2.setHeightForWidth(m_overviewButton->sizePolicy().hasHeightForWidth()); + m_overviewButton->setSizePolicy(sizePolicy2); + m_overviewButton->setFocusPolicy(Qt::NoFocus); + m_overviewButton->setCheckable(true); + + verticalLayout->addWidget(m_overviewButton); + + m_sendButton = new QPushButton(m_toolFrame); + m_toolButtonGroup->addButton(m_sendButton); + m_sendButton->setObjectName(QStringLiteral("m_sendButton")); + sizePolicy2.setHeightForWidth(m_sendButton->sizePolicy().hasHeightForWidth()); + m_sendButton->setSizePolicy(sizePolicy2); + m_sendButton->setFocusPolicy(Qt::NoFocus); + m_sendButton->setCheckable(true); + + verticalLayout->addWidget(m_sendButton); + + m_transactionsButton = new QPushButton(m_toolFrame); + m_toolButtonGroup->addButton(m_transactionsButton); + m_transactionsButton->setObjectName(QStringLiteral("m_transactionsButton")); + sizePolicy2.setHeightForWidth(m_transactionsButton->sizePolicy().hasHeightForWidth()); + m_transactionsButton->setSizePolicy(sizePolicy2); + m_transactionsButton->setFocusPolicy(Qt::NoFocus); + m_transactionsButton->setCheckable(true); + + verticalLayout->addWidget(m_transactionsButton); + + m_blockExplorerButton = new QPushButton(m_toolFrame); + m_toolButtonGroup->addButton(m_blockExplorerButton); + m_blockExplorerButton->setObjectName(QStringLiteral("m_blockExplorerButton")); + m_blockExplorerButton->setFocusPolicy(Qt::NoFocus); + m_blockExplorerButton->setCheckable(true); + + verticalLayout->addWidget(m_blockExplorerButton); + + m_addressBookButton = new QPushButton(m_toolFrame); + m_toolButtonGroup->addButton(m_addressBookButton); + m_addressBookButton->setObjectName(QStringLiteral("m_addressBookButton")); + sizePolicy2.setHeightForWidth(m_addressBookButton->sizePolicy().hasHeightForWidth()); + m_addressBookButton->setSizePolicy(sizePolicy2); + m_addressBookButton->setFocusPolicy(Qt::NoFocus); + m_addressBookButton->setCheckable(true); + + verticalLayout->addWidget(m_addressBookButton); + + m_miningButton = new QPushButton(m_toolFrame); + m_toolButtonGroup->addButton(m_miningButton); + m_miningButton->setObjectName(QStringLiteral("m_miningButton")); + m_miningButton->setFocusPolicy(Qt::NoFocus); + m_miningButton->setCheckable(true); + + verticalLayout->addWidget(m_miningButton); + + verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); + + verticalLayout->addItem(verticalSpacer); + + + horizontalLayout->addWidget(m_toolFrame); + + m_overviewFrame = new WalletGui::OverviewFrame(centralwidget); + m_overviewFrame->setObjectName(QStringLiteral("m_overviewFrame")); + m_overviewFrame->setFrameShape(QFrame::NoFrame); + m_overviewFrame->setFrameShadow(QFrame::Raised); + + horizontalLayout->addWidget(m_overviewFrame); + + m_sendFrame = new WalletGui::SendFrame(centralwidget); + m_sendFrame->setObjectName(QStringLiteral("m_sendFrame")); + m_sendFrame->setFrameShape(QFrame::NoFrame); + m_sendFrame->setFrameShadow(QFrame::Raised); + + horizontalLayout->addWidget(m_sendFrame); + + m_transactionsFrame = new WalletGui::TransactionsFrame(centralwidget); + m_transactionsFrame->setObjectName(QStringLiteral("m_transactionsFrame")); + m_transactionsFrame->setFrameShape(QFrame::NoFrame); + m_transactionsFrame->setFrameShadow(QFrame::Raised); + + horizontalLayout->addWidget(m_transactionsFrame); + + m_addressBookFrame = new WalletGui::AddressBookFrame(centralwidget); + m_addressBookFrame->setObjectName(QStringLiteral("m_addressBookFrame")); + m_addressBookFrame->setFrameShape(QFrame::NoFrame); + m_addressBookFrame->setFrameShadow(QFrame::Raised); + + horizontalLayout->addWidget(m_addressBookFrame); + + m_noWalletFrame = new WalletGui::NoWalletFrame(centralwidget); + m_noWalletFrame->setObjectName(QStringLiteral("m_noWalletFrame")); + m_noWalletFrame->setFrameShape(QFrame::NoFrame); + m_noWalletFrame->setFrameShadow(QFrame::Raised); + + horizontalLayout->addWidget(m_noWalletFrame); + + m_blockExplorerFrame = new WalletGui::BlockExplorerFrame(centralwidget); + m_blockExplorerFrame->setObjectName(QStringLiteral("m_blockExplorerFrame")); + m_blockExplorerFrame->setFrameShape(QFrame::NoFrame); + m_blockExplorerFrame->setFrameShadow(QFrame::Raised); + + horizontalLayout->addWidget(m_blockExplorerFrame); + + m_miningFrame = new WalletGui::MiningFrame(centralwidget); + m_miningFrame->setObjectName(QStringLiteral("m_miningFrame")); + m_miningFrame->setFrameShape(QFrame::NoFrame); + m_miningFrame->setFrameShadow(QFrame::Raised); + + horizontalLayout->addWidget(m_miningFrame); + + + verticalLayout_2->addLayout(horizontalLayout); + + m_syncProgress = new QProgressBar(centralwidget); + m_syncProgress->setObjectName(QStringLiteral("m_syncProgress")); + m_syncProgress->setMaximum(100); + m_syncProgress->setValue(0); + m_syncProgress->setTextVisible(false); + + verticalLayout_2->addWidget(m_syncProgress); + + MainWindow->setCentralWidget(centralwidget); + menubar = new QMenuBar(MainWindow); + menubar->setObjectName(QStringLiteral("menubar")); + menubar->setGeometry(QRect(0, 0, 1273, 21)); + menuFile = new QMenu(menubar); + menuFile->setObjectName(QStringLiteral("menuFile")); + menuSettings = new QMenu(menubar); + menuSettings->setObjectName(QStringLiteral("menuSettings")); + menuThemes = new QMenu(menuSettings); + menuThemes->setObjectName(QStringLiteral("menuThemes")); + menuHelp = new QMenu(menubar); + menuHelp->setObjectName(QStringLiteral("menuHelp")); + MainWindow->setMenuBar(menubar); + statusBar = new WalletGui::WalletStatusBar(MainWindow); + statusBar->setObjectName(QStringLiteral("statusBar")); + MainWindow->setStatusBar(statusBar); + + menubar->addAction(menuFile->menuAction()); + menubar->addAction(menuSettings->menuAction()); + menubar->addAction(menuHelp->menuAction()); + menuFile->addAction(m_createWalletAction); + menuFile->addAction(m_openWalletAction); + menuFile->addAction(m_recentWalletsAction); + menuFile->addAction(m_backupWalletAction); + menuFile->addAction(m_saveKeysAction); + menuFile->addAction(m_resetAction); + menuFile->addAction(m_importKeyAction); + menuFile->addAction(m_exportPrivateKeyAction); + menuFile->addAction(m_exportKeyAction); + menuFile->addAction(m_exportTrackingKeyAction); + menuFile->addAction(m_exitAction); + menuSettings->addAction(m_encryptWalletAction); + menuSettings->addAction(m_changePasswordAction); + //menuSettings->addAction(m_removePendingTxAction); + menuSettings->addSeparator(); + menuSettings->addAction(m_autostartAction); + menuSettings->addAction(m_minimizeToTrayAction); + menuSettings->addAction(m_closeToTrayAction); + menuSettings->addSeparator(); + menuSettings->addAction(m_preferencesAction); + menuSettings->addAction(menuThemes->menuAction()); + menuHelp->addAction(m_communityForumAction); + menuHelp->addAction(m_reportIssueAction); + menuHelp->addAction(m_aboutIntensecoinAction); + menuHelp->addAction(m_aboutQtAction); + + retranslateUi(MainWindow); + QObject::connect(m_createWalletAction, SIGNAL(triggered()), MainWindow, SLOT(createWallet())); + QObject::connect(m_openWalletAction, SIGNAL(triggered()), MainWindow, SLOT(openWallet())); + QObject::connect(m_encryptWalletAction, SIGNAL(triggered()), MainWindow, SLOT(encryptWallet())); + QObject::connect(m_changePasswordAction, SIGNAL(triggered()), MainWindow, SLOT(encryptWallet())); + QObject::connect(m_removePendingTxAction, SIGNAL(triggered()), MainWindow, SLOT(removePendingTx())); + QObject::connect(m_aboutQtAction, SIGNAL(triggered()), MainWindow, SLOT(aboutQt())); + QObject::connect(m_backupWalletAction, SIGNAL(triggered()), MainWindow, SLOT(backupWallet())); + QObject::connect(m_aboutIntensecoinAction, SIGNAL(triggered()), MainWindow, SLOT(about())); + QObject::connect(m_overviewButton, SIGNAL(toggled(bool)), m_overviewFrame, SLOT(setVisible(bool))); + QObject::connect(m_transactionsButton, SIGNAL(toggled(bool)), m_transactionsFrame, SLOT(setVisible(bool))); + QObject::connect(m_addressBookButton, SIGNAL(toggled(bool)), m_addressBookFrame, SLOT(setVisible(bool))); + QObject::connect(m_sendButton, SIGNAL(toggled(bool)), m_sendFrame, SLOT(setVisible(bool))); + QObject::connect(m_copyAddressButton, SIGNAL(clicked()), MainWindow, SLOT(copyAddress())); + QObject::connect(m_autostartAction, SIGNAL(triggered(bool)), MainWindow, SLOT(setStartOnLoginEnabled(bool))); + QObject::connect(m_minimizeToTrayAction, SIGNAL(triggered(bool)), MainWindow, SLOT(setMinimizeToTrayEnabled(bool))); + QObject::connect(m_closeToTrayAction, SIGNAL(triggered(bool)), MainWindow, SLOT(setCloseToTrayEnabled(bool))); + QObject::connect(m_encryptButton, SIGNAL(clicked()), m_encryptWalletAction, SLOT(trigger())); + QObject::connect(m_preferencesAction, SIGNAL(triggered()), MainWindow, SLOT(showPreferences())); + QObject::connect(m_blockExplorerButton, SIGNAL(toggled(bool)), m_blockExplorerFrame, SLOT(setVisible(bool))); + QObject::connect(m_miningButton, SIGNAL(toggled(bool)), m_miningFrame, SLOT(setVisible(bool))); + QObject::connect(m_exportTrackingKeyAction, SIGNAL(triggered()), MainWindow, SLOT(exportTrackingKey())); + QObject::connect(m_importKeyAction, SIGNAL(triggered()), MainWindow, SLOT(importKey())); + QObject::connect(m_communityForumAction, SIGNAL(triggered()), MainWindow, SLOT(communityForumTriggered())); + QObject::connect(m_reportIssueAction, SIGNAL(triggered()), MainWindow, SLOT(reportIssueTriggered())); + QObject::connect(m_resetAction, SIGNAL(triggered()), MainWindow, SLOT(resetWallet())); + QObject::connect(m_saveKeysAction, SIGNAL(triggered()), MainWindow, SLOT(saveWalletKeys())); + QObject::connect(m_exportKeyAction, SIGNAL(triggered()), MainWindow, SLOT(exportKey())); + QObject::connect(m_exportPrivateKeyAction, SIGNAL(triggered()), MainWindow, SLOT(exportPrivateKeys())); + + QMetaObject::connectSlotsByName(MainWindow); + } // setupUi + + void retranslateUi(QMainWindow *MainWindow) + { + MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", Q_NULLPTR)); + m_exitAction->setText(QApplication::translate("MainWindow", "Exit", Q_NULLPTR)); + m_exitAction->setShortcut(QApplication::translate("MainWindow", "Ctrl+Q", Q_NULLPTR)); + m_createWalletAction->setText(QApplication::translate("MainWindow", "Create wallet", Q_NULLPTR)); + m_openWalletAction->setText(QApplication::translate("MainWindow", "Open wallet", Q_NULLPTR)); + m_encryptWalletAction->setText(QApplication::translate("MainWindow", "Encrypt wallet", Q_NULLPTR)); + m_changePasswordAction->setText(QApplication::translate("MainWindow", "Change password", Q_NULLPTR)); +#ifndef QT_NO_TOOLTIP + m_changePasswordAction->setToolTip(QApplication::translate("MainWindow", "Change password", Q_NULLPTR)); +#endif // QT_NO_TOOLTIP + m_aboutIntensecoinAction->setText(QApplication::translate("MainWindow", "About Intensecoin", Q_NULLPTR)); + m_aboutQtAction->setText(QApplication::translate("MainWindow", "About Qt", Q_NULLPTR)); + m_backupWalletAction->setText(QApplication::translate("MainWindow", "Backup wallet", Q_NULLPTR)); + m_autostartAction->setText(QApplication::translate("MainWindow", "Start on system login", Q_NULLPTR)); + m_minimizeToTrayAction->setText(QApplication::translate("MainWindow", "Minimize to tray", Q_NULLPTR)); + m_closeToTrayAction->setText(QApplication::translate("MainWindow", "Close to tray", Q_NULLPTR)); + m_preferencesAction->setText(QApplication::translate("MainWindow", "Preferences", Q_NULLPTR)); + m_recentWalletsAction->setText(QApplication::translate("MainWindow", "Recent wallets", Q_NULLPTR)); + m_exportTrackingKeyAction->setText(QApplication::translate("MainWindow", "Export tracking key", Q_NULLPTR)); +#ifndef QT_NO_TOOLTIP + m_exportTrackingKeyAction->setToolTip(QApplication::translate("MainWindow", "Export tracking key", Q_NULLPTR)); +#endif // QT_NO_TOOLTIP + m_importKeyAction->setText(QApplication::translate("MainWindow", "Import key", Q_NULLPTR)); +#ifndef QT_NO_TOOLTIP + m_importKeyAction->setToolTip(QApplication::translate("MainWindow", "Import key", Q_NULLPTR)); +#endif // QT_NO_TOOLTIP + m_communityForumAction->setText(QApplication::translate("MainWindow", "Join us on Slack", Q_NULLPTR)); + m_reportIssueAction->setText(QApplication::translate("MainWindow", "Report an issue", Q_NULLPTR)); + m_resetAction->setText(QApplication::translate("MainWindow", "Reset wallet", Q_NULLPTR)); + m_saveKeysAction->setText(QApplication::translate("MainWindow", "Save wallet keys", Q_NULLPTR)); + m_exportKeyAction->setText(QApplication::translate("MainWindow", "Export key", Q_NULLPTR)); + m_exportPrivateKeyAction->setText(QApplication::translate("MainWindow", "Export secret key", Q_NULLPTR)); +#ifndef QT_NO_TOOLTIP + m_exportKeyAction->setToolTip(QApplication::translate("MainWindow", "Export key", Q_NULLPTR)); + m_exportPrivateKeyAction->setToolTip(QApplication::translate("MainWindow", "Export secret key", Q_NULLPTR)); +#endif // QT_NO_TOOLTIP + m_removePendingTxAction->setText(QApplication::translate("MainWindow", "Remove pending TXs", Q_NULLPTR)); + m_logoLabel->setText(QString()); + m_noWalletLabel->setText(QApplication::translate("MainWindow", "No active wallet", Q_NULLPTR)); + m_walletLabel->setText(QApplication::translate("MainWindow", "Your wallet:", Q_NULLPTR)); +#ifndef QT_NO_TOOLTIP + m_addressLabel->setToolTip(QApplication::translate("MainWindow", "Click to copy", Q_NULLPTR)); +#endif // QT_NO_TOOLTIP + m_addressLabel->setText(QApplication::translate("MainWindow", "ADDRESS", Q_NULLPTR)); + m_notEncryptedIconLabel->setText(QString()); + m_notEncryptedTextLabel->setText(QApplication::translate("MainWindow", "Wallet not encrypted!", Q_NULLPTR)); + m_encryptButton->setText(QApplication::translate("MainWindow", "Set password", Q_NULLPTR)); + m_copyAddressButton->setText(QApplication::translate("MainWindow", "Copy address", Q_NULLPTR)); + m_copyAddressLabel->setText(QApplication::translate("MainWindow", "Address copied to clipboard", Q_NULLPTR)); + m_balanceTextLabel->setText(QApplication::translate("MainWindow", "Total balance", Q_NULLPTR)); +#ifndef QT_NO_TOOLTIP + m_balanceLabel->setToolTip(QApplication::translate("MainWindow", "Click to copy", Q_NULLPTR)); +#endif // QT_NO_TOOLTIP + m_balanceLabel->setText(QApplication::translate("MainWindow", "0.00", Q_NULLPTR)); + m_balanceCopyLabel->setText(QApplication::translate("MainWindow", "Copied!", Q_NULLPTR)); + m_balanceIconLabel->setText(QString()); + m_overviewButton->setText(QApplication::translate("MainWindow", "OVERVIEW", Q_NULLPTR)); + m_sendButton->setText(QApplication::translate("MainWindow", "SEND INTENSECOINS", Q_NULLPTR)); + m_transactionsButton->setText(QApplication::translate("MainWindow", "TRANSACTIONS", Q_NULLPTR)); + m_blockExplorerButton->setText(QApplication::translate("MainWindow", "BLOCK EXPLORER", Q_NULLPTR)); + m_addressBookButton->setText(QApplication::translate("MainWindow", "CONTACTS", Q_NULLPTR)); + m_miningButton->setText(QApplication::translate("MainWindow", "MINING", Q_NULLPTR)); + menuFile->setTitle(QApplication::translate("MainWindow", "File", Q_NULLPTR)); + menuSettings->setTitle(QApplication::translate("MainWindow", "Settings", Q_NULLPTR)); + menuThemes->setTitle(QApplication::translate("MainWindow", "Themes", Q_NULLPTR)); + menuHelp->setTitle(QApplication::translate("MainWindow", "Help", Q_NULLPTR)); + } // retranslateUi + +}; + +namespace Ui { + class MainWindow: public Ui_MainWindow {}; +} // namespace Ui + +QT_END_NAMESPACE + +#endif // UI_MAINWINDOW_H