├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── LatestStableVersion.txt ├── README.md ├── ReleaseNotes.md ├── Windows Installer ├── Installer.sln ├── Installer.vdproj ├── Installer.wxs └── Installer32.vdproj ├── azure-pipelines.yml └── src ├── IMinerWorker.h ├── IMiningManager.h ├── IPoolClient.h ├── IPoolMiner.h ├── JsonRpc ├── JsonRpcClient.cpp ├── JsonRpcClient.h ├── JsonRpcNotification.cpp ├── JsonRpcNotification.h ├── JsonRpcObject.cpp ├── JsonRpcObject.h ├── JsonRpcObjectFactory.cpp ├── JsonRpcObjectFactory.h ├── JsonRpcRequest.cpp ├── JsonRpcRequest.h ├── JsonRpcResponse.cpp └── JsonRpcResponse.h ├── Miner ├── Miner.cpp ├── Miner.h ├── StratumClient.cpp ├── StratumClient.h ├── Worker.cpp └── Worker.h ├── MinerDelegate.cpp ├── MinerDelegate.h ├── MinerModel.cpp ├── MinerModel.h ├── MiningFrame.cpp ├── MiningFrame.h ├── MiningFrame.ui ├── MiningManager.cpp ├── MiningManager.h ├── PoolTreeView.cpp ├── PoolTreeView.h ├── aboutdialog.cpp ├── aboutdialog.h ├── aboutdialog.ui ├── addressbookdelegate.cpp ├── addressbookdelegate.h ├── addressbookdialog.cpp ├── addressbookdialog.h ├── addressbookdialog.ui ├── addressbookframe.cpp ├── addressbookframe.h ├── addressbookframe.ui ├── addressbookmanager.cpp ├── addressbookmanager.h ├── addressbookmodel.cpp ├── addressbookmodel.h ├── addressbooksortedmodel.cpp ├── addressbooksortedmodel.h ├── application.cpp ├── application.h ├── askpassworddialog.cpp ├── askpassworddialog.h ├── askpassworddialog.ui ├── balanceoverviewframe.cpp ├── balanceoverviewframe.h ├── balanceoverviewframe.ui ├── bytecoin-gui.pro ├── bytecoinwallet.desktop ├── bytecoinwallet.qss ├── bytecoinwallet.rc ├── changepassworddialog.cpp ├── changepassworddialog.h ├── changepassworddialog.ui ├── checkproofdialog.cpp ├── checkproofdialog.h ├── checkproofdialog.ui ├── common.cpp ├── common.h ├── connectionoptionsframe.cpp ├── connectionoptionsframe.h ├── connectionoptionsframe.ui ├── connectselectiondialog.cpp ├── connectselectiondialog.h ├── connectselectiondialog.ui ├── crashdialog.cpp ├── crashdialog.h ├── crashdialog.ui ├── createproofdialog.cpp ├── createproofdialog.h ├── createproofdialog.ui ├── elidedlabel.cpp ├── elidedlabel.h ├── exportkeydialog.cpp ├── exportkeydialog.h ├── exportkeydialog.ui ├── filedownloader.cpp ├── filedownloader.h ├── font ├── OpenSans-Bold.ttf ├── OpenSans-BoldItalic.ttf ├── OpenSans-ExtraBold.ttf ├── OpenSans-ExtraBoldItalic.ttf ├── OpenSans-Italic.ttf ├── OpenSans-Light.ttf ├── OpenSans-LightItalic.ttf ├── OpenSans-Regular.ttf ├── OpenSans-Semibold.ttf ├── OpenSans-SemiboldItalic.ttf ├── WorkSans-Black.ttf ├── WorkSans-BlackItalic.ttf ├── WorkSans-Bold.ttf ├── WorkSans-BoldItalic.ttf ├── WorkSans-ExtraBold.ttf ├── WorkSans-ExtraBoldItalic.ttf ├── WorkSans-ExtraLight.ttf ├── WorkSans-ExtraLightItalic.ttf ├── WorkSans-Italic.ttf ├── WorkSans-Light.ttf ├── WorkSans-LightItalic.ttf ├── WorkSans-Medium.ttf ├── WorkSans-MediumItalic.ttf ├── WorkSans-Regular.ttf ├── WorkSans-SemiBold.ttf ├── WorkSans-SemiBoldItalic.ttf ├── WorkSans-Thin.ttf └── WorkSans-ThinItalic.ttf ├── icons ├── actual_balance.png ├── address_book.png ├── address_book_bl.png ├── address_book_bl_disabled.png ├── arrow_circle.png ├── arrow_circle_hover.png ├── arrow_circle_up.png ├── arrow_circle_up_hover.png ├── arrow_left_black.png ├── arrow_right_black.png ├── balance.png ├── balance_bl.png ├── balance_new.png ├── big_arrow.png ├── big_arrow_black.png ├── block_explorer.png ├── block_explorer_bl.png ├── block_explorer_bl_disabled.png ├── blog.png ├── connected.png ├── connected_bl.png ├── copy.png ├── delete_pool.png ├── delete_pool_hover.png ├── disconnected.png ├── disconnected_bl.png ├── donation_address.png ├── donation_address_small.png ├── donation_clock1.png ├── donation_clock2.png ├── donation_clock3.png ├── donation_clock4.png ├── donation_clock5.png ├── donation_confirmed.png ├── donation_unconfirmed.png ├── down-arrow.png ├── inp_clock1.png ├── inp_clock2.png ├── inp_clock3.png ├── inp_clock4.png ├── inp_clock5.png ├── inp_confirmed.png ├── inp_unconfirmed.png ├── lock_closed.png ├── lock_closed_bl.png ├── lock_open.png ├── lock_open_bl.png ├── lock_open_gray.png ├── logo.png ├── logo_bl.png ├── logo_stage.png ├── logo_test.png ├── mined_clock1.png ├── mined_clock2.png ├── mined_clock3.png ├── mined_clock4.png ├── mined_clock5.png ├── mined_confirmed.png ├── miner.png ├── miner_big.png ├── miner_bl.png ├── miner_bl_disabled.png ├── mining.png ├── not_synced.png ├── opt_confirmed.png ├── out_clock1.png ├── out_clock2.png ├── out_clock3.png ├── out_clock4.png ├── out_clock5.png ├── out_confirmed.png ├── out_failed.png ├── out_unconfirmed.png ├── overview.png ├── overview_bl.png ├── overview_bl_disabled.png ├── pending_balance.png ├── pool_stats.png ├── scroll_news_down.png ├── scroll_news_down_hover.png ├── scroll_news_up.png ├── scroll_news_up_hover.png ├── send.png ├── send_bl.png ├── send_bl_disabled.png ├── slider_handle.png ├── start.png ├── stop.png ├── sync.png ├── sync_bl.png ├── sync_lag.png ├── sync_sprite.png ├── sync_sprite_bl.png ├── synced.png ├── synced_bl.png ├── total_balance.png ├── transactions.png ├── transactions_bl.png ├── transactions_bl_disabled.png ├── twitter.png ├── up-arrow.png ├── up_big_arrow.png ├── up_big_arrow_black.png ├── wallet_sync.gif └── wallet_sync_dark.gif ├── images ├── add_address_helper.png ├── bytecoin.icns ├── bytecoin.ico ├── bytecoin.png ├── bytecoin_stage.png ├── bytecoin_test.png └── splash.png ├── importkeydialog.cpp ├── importkeydialog.h ├── importkeydialog.ui ├── logframe.cpp ├── logframe.h ├── logframe.ui ├── logger.cpp ├── logger.h ├── main.cpp ├── mainwindow.cpp ├── mainwindow.h ├── mainwindow.ui ├── miningoverviewframe.cpp ├── miningoverviewframe.h ├── miningoverviewframe.ui ├── mnemonicdialog.cpp ├── mnemonicdialog.h ├── mnemonicdialog.ui ├── myaddressesframe.cpp ├── myaddressesframe.h ├── myaddressesframe.ui ├── newaddressdialog.cpp ├── newaddressdialog.h ├── newaddressdialog.ui ├── newmyaddressdialog.cpp ├── newmyaddressdialog.h ├── newmyaddressdialog.ui ├── okbutton.cpp ├── okbutton.h ├── optionsdialog.ui ├── overviewframe.cpp ├── overviewframe.h ├── overviewframe.ui ├── popup.cpp ├── popup.h ├── progressbar.cpp ├── progressbar.h ├── questiondialog.cpp ├── questiondialog.h ├── questiondialog.ui ├── resizablescrollarea.cpp ├── resizablescrollarea.h ├── resources.qrc ├── rpcapi.cpp ├── rpcapi.h ├── sendconfirmationdialog.cpp ├── sendconfirmationdialog.h ├── sendframe.cpp ├── sendframe.h ├── sendframe.ui ├── settings.cpp ├── settings.h ├── signalhandler.cpp ├── signalhandler.h ├── statusbar.cpp ├── statusbar.h ├── transferframe.cpp ├── transferframe.h ├── transferframe.ui ├── version.cpp ├── version.h ├── walletd.cpp ├── walletd.h ├── walletdparamsdialog.cpp ├── walletdparamsdialog.h ├── walletdparamsdialog.ui ├── walletmodel.cpp ├── walletmodel.h ├── windoweditemmodel.cpp └── windoweditemmodel.h /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | bin/ 3 | Windows Installer/Debug/ 4 | Windows Installer/Release/ 5 | Windows Installer/.vs/ 6 | 7 | Windows Installer/*.msi 8 | Windows Installer/*.wixobj 9 | Windows Installer/*.wixpdb 10 | 11 | build-bytecoin-gui* 12 | 13 | *~ 14 | CMakeLists.txt.user* 15 | *.pro.user* 16 | 17 | # Mac specific 18 | .DS_Store 19 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # to build on mac you should have added a path to your qt directory in CMAKE_PREFIX_PATH environment variable 2 | # for ex.: export CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH:/Users/testnet/Qt/5.9.2/clang_64/lib/cmake" 3 | 4 | cmake_minimum_required(VERSION 3.0.2) 5 | project(bytecoin-gui) 6 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin") 7 | 8 | find_package(Qt5Core REQUIRED) 9 | find_package(Qt5Gui REQUIRED) 10 | find_package(Qt5Network REQUIRED) 11 | find_package(Qt5Widgets REQUIRED) 12 | 13 | set(CMAKE_AUTOMOC ON) 14 | set(CMAKE_AUTOUIC ON) 15 | set(CMAKE_AUTORCC ON) 16 | 17 | set(CMAKE_CXX_STANDARD 14) 18 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") 19 | set(CONFIG "${CONFIG} c++14 strict_c++") 20 | 21 | if(APPLE) 22 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.11") 23 | endif() 24 | 25 | set(SOURCES 26 | src/main.cpp 27 | src/mainwindow.cpp 28 | src/signalhandler.cpp 29 | src/overviewframe.cpp 30 | src/aboutdialog.cpp 31 | src/JsonRpc/JsonRpcClient.cpp 32 | src/JsonRpc/JsonRpcNotification.cpp 33 | src/JsonRpc/JsonRpcObject.cpp 34 | src/JsonRpc/JsonRpcObjectFactory.cpp 35 | src/JsonRpc/JsonRpcRequest.cpp 36 | src/JsonRpc/JsonRpcResponse.cpp 37 | src/application.cpp 38 | src/logger.cpp 39 | src/okbutton.cpp 40 | src/statusbar.cpp 41 | src/windoweditemmodel.cpp 42 | src/walletmodel.cpp 43 | src/sendframe.cpp 44 | src/transferframe.cpp 45 | src/resizablescrollarea.cpp 46 | src/common.cpp 47 | src/connectionoptionsframe.cpp 48 | src/settings.cpp 49 | src/Miner/Miner.cpp 50 | src/Miner/StratumClient.cpp 51 | src/Miner/Worker.cpp 52 | src/MinerDelegate.cpp 53 | src/MinerModel.cpp 54 | src/MiningFrame.cpp 55 | src/MiningManager.cpp 56 | src/connectselectiondialog.cpp 57 | src/walletd.cpp 58 | src/rpcapi.cpp 59 | src/progressbar.cpp 60 | src/addressbookframe.cpp 61 | src/addressbookmodel.cpp 62 | src/addressbooksortedmodel.cpp 63 | src/newaddressdialog.cpp 64 | src/addressbookdelegate.cpp 65 | src/addressbookmanager.cpp 66 | src/balanceoverviewframe.cpp 67 | src/miningoverviewframe.cpp 68 | src/crashdialog.cpp 69 | src/changepassworddialog.cpp 70 | src/sendconfirmationdialog.cpp 71 | src/addressbookdialog.cpp 72 | src/popup.cpp 73 | src/logframe.cpp 74 | src/askpassworddialog.cpp 75 | src/importkeydialog.cpp 76 | src/questiondialog.cpp 77 | src/PoolTreeView.cpp 78 | src/createproofdialog.cpp 79 | src/checkproofdialog.cpp 80 | src/walletdparamsdialog.cpp 81 | src/exportkeydialog.cpp 82 | src/filedownloader.cpp 83 | src/mnemonicdialog.cpp 84 | src/version.cpp 85 | ) 86 | 87 | include_directories(${CMAKE_BINARY_DIR} src ) 88 | include_directories(../bytecoin/include) 89 | include_directories(../bytecoin/src) 90 | link_directories(../bytecoin/libs) 91 | add_executable(bytecoin-gui ${SOURCES} src/resources.qrc) 92 | target_link_libraries(bytecoin-gui bytecoin-crypto) 93 | qt5_use_modules(bytecoin-gui Core Network Gui Widgets) 94 | -------------------------------------------------------------------------------- /LatestStableVersion.txt: -------------------------------------------------------------------------------- 1 | 3.4.2 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # bytecoin-gui 2 | 3 | [![Build Status](https://dev.azure.com/bcndev/bytecoin/_apis/build/status/bytecoin-desktop?branchName=releases/3.5.1)](https://dev.azure.com/bcndev/bytecoin/_build/latest?definitionId=2&branchName=releases/3.5.1) 4 | 5 | ## How to build binaries from source code 6 | 7 | ### Windows 8 | To build the gui you must have built bytecoin core, so please do all steps from [here](https://github.com/bcndev/bytecoin#building-on-windows) before proceed. Install [QtCreator](https://www.qt.io/download-thank-you?os=windows), open the project file bytecoin-gui/src/bytecoin-gui.pro in QtCreator and build it using MSVS kit (you must have MSVS installed already to build bytecoin core). 9 | 10 | ### MacOS 11 | 12 | To build the gui you must have built bytecoin core, so please do all steps from [here](https://github.com/bcndev/bytecoin#building-on-mac-osx) before proceed. Install [QtCreator](https://www.qt.io/download-thank-you?os=macos), open the project file bytecoin-gui/src/bytecoin-gui.pro in QtCreator and build it using clang kit (you must have XCode installed already to build bytecoin core). 13 | 14 | ### Linux 15 | ``` 16 | # To install all required packages on Ubuntu use the following command: 17 | $ sudo apt install qt5-qmake qtbase5-dev qtbase5-dev-tools 18 | 19 | $ git clone https://github.com/bcndev/bytecoin.git 20 | $ cd bytecoin 21 | $ mkdir -p build 22 | $ cd build 23 | $ cmake .. 24 | $ make -j4 bytecoin-crypto 25 | $ cd ../.. 26 | $ git clone https://github.com/bcndev/bytecoin-gui.git 27 | $ cd bytecoin-gui 28 | $ mkdir -p build 29 | $ cd build 30 | $ cmake .. 31 | $ make -j4 32 | ``` 33 | Alternative way: 34 | ``` 35 | # Install QtCreator: 36 | $ sudo apt install qtcreator 37 | 38 | $ git clone https://github.com/bcndev/bytecoin.git 39 | $ cd bytecoin 40 | $ mkdir -p build 41 | $ cd build 42 | $ cmake .. 43 | $ make -j4 bytecoin-crypto 44 | $ cd ../.. 45 | $ git clone https://github.com/bcndev/bytecoin-gui.git 46 | ``` 47 | Now open the project file bytecoin-gui/src/bytecoin-gui.pro in QtCreator and build it. 48 | -------------------------------------------------------------------------------- /Windows Installer/Installer.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27130.2010 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Bytecoin", "Installer.vdproj", "{301C59C1-45B8-4C42-9696-555FBB855FD6}" 7 | EndProject 8 | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "Bytecoin(32)", "Installer32.vdproj", "{0E4F4AED-6460-4A0A-A77F-C3E093DF3825}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Default = Debug|Default 13 | Release|Default = Release|Default 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {301C59C1-45B8-4C42-9696-555FBB855FD6}.Debug|Default.ActiveCfg = Debug 17 | {301C59C1-45B8-4C42-9696-555FBB855FD6}.Debug|Default.Build.0 = Debug 18 | {301C59C1-45B8-4C42-9696-555FBB855FD6}.Release|Default.ActiveCfg = Release 19 | {301C59C1-45B8-4C42-9696-555FBB855FD6}.Release|Default.Build.0 = Release 20 | {0E4F4AED-6460-4A0A-A77F-C3E093DF3825}.Debug|Default.ActiveCfg = Debug 21 | {0E4F4AED-6460-4A0A-A77F-C3E093DF3825}.Debug|Default.Build.0 = Debug 22 | {0E4F4AED-6460-4A0A-A77F-C3E093DF3825}.Release|Default.ActiveCfg = Release 23 | {0E4F4AED-6460-4A0A-A77F-C3E093DF3825}.Release|Default.Build.0 = Release 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {01BF056F-8CB4-449F-B030-DF9F3387646C} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /src/IMinerWorker.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace WalletGUI { 9 | 10 | struct Job { 11 | QString jobId; 12 | quint32 target; 13 | QByteArray blob; 14 | }; 15 | 16 | class IMinerWorkerObserver { 17 | public: 18 | virtual ~IMinerWorkerObserver() {} 19 | virtual void shareFound(const QString& _jobId, quint32 _nonce, const QByteArray& _result) = 0; 20 | }; 21 | 22 | class IMinerWorker { 23 | public: 24 | virtual ~IMinerWorker() {} 25 | 26 | virtual void start() = 0; 27 | virtual void stop() = 0; 28 | virtual void addObserver(IMinerWorkerObserver* _observer) = 0; 29 | virtual void removeObserver(IMinerWorkerObserver* _observer) = 0; 30 | virtual void addAlternateObserver(IMinerWorkerObserver* _observer) = 0; 31 | virtual void removeAlternateObserver(IMinerWorkerObserver* _observer) = 0; 32 | }; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/IMiningManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace WalletGUI { 9 | 10 | enum class MiningPoolSwitchStrategy : int; 11 | class IPoolMiner; 12 | class WalletModel; 13 | 14 | class IMinerManagerObserver { 15 | public: 16 | virtual ~IMinerManagerObserver() {} 17 | virtual void minersLoaded() = 0; 18 | virtual void minersUnloaded() = 0; 19 | virtual void miningStarted() = 0; 20 | virtual void miningStopped() = 0; 21 | virtual void activeMinerChanged(quintptr _minerIndex) = 0; 22 | virtual void schedulePolicyChanged(MiningPoolSwitchStrategy _schedulePolicy) = 0; 23 | virtual void cpuCoreCountChanged(quint32 _cpuCoreCount) = 0; 24 | virtual void minerAdded(quintptr _minerIndex) = 0; 25 | virtual void minerRemoved(quintptr _minerIndex) = 0; 26 | virtual void stateChanged(quintptr _minerIndex, int _newState) = 0; 27 | virtual void hashRateChanged(quintptr _minerIndex, quint32 _hashRate) = 0; 28 | virtual void alternateHashRateChanged(quintptr _minerIndex, quint32 _hashRate) = 0; 29 | virtual void difficultyChanged(quintptr _minerIndex, quint32 _difficulty) = 0; 30 | virtual void goodShareCountChanged(quintptr _minerIndex, quint32 _goodShareCount) = 0; 31 | virtual void goodAlternateShareCountChanged(quintptr _minerIndex, quint32 _goodShareCount) = 0; 32 | virtual void badShareCountChanged(quintptr _minerIndex, quint32 _badShareCount) = 0; 33 | virtual void connectionErrorCountChanged(quintptr _minerIndex, quint32 _connectionErrorCount) = 0; 34 | virtual void lastConnectionErrorTimeChanged(quintptr _minerIndex, const QDateTime& _lastConnectionErrorTime) = 0; 35 | }; 36 | 37 | class IMiningManager { 38 | public: 39 | virtual ~IMiningManager() {} 40 | 41 | virtual void startMining() = 0; 42 | virtual void stopMining() = 0; 43 | 44 | virtual MiningPoolSwitchStrategy getSchedulePolicy() const = 0; 45 | virtual quint32 getCpuCoreCount() const = 0; 46 | virtual quintptr getMinerCount() const = 0; 47 | virtual IPoolMiner* getMiner(quintptr _minerIndex) const = 0; 48 | 49 | virtual void setWalletModel(WalletModel* walletModel) = 0; 50 | virtual void setSchedulePolicy(MiningPoolSwitchStrategy _policy) = 0; 51 | virtual void setCpuCoreCount(quint32 _cpuCoreCount) = 0; 52 | virtual quintptr addMiner(const QString& _host, quint16 _port, quint32 _difficulty) = 0; 53 | virtual void removeMiner(quintptr _minerIndex) = 0; 54 | virtual void moveMiner(quintptr _fromIndex, quintptr _toIndex) = 0; 55 | virtual void restoreDefaultMinerList() = 0; 56 | 57 | virtual void addObserver(IMinerManagerObserver* _observer) = 0; 58 | virtual void removeObserver(IMinerManagerObserver* _observer) = 0; 59 | }; 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/IPoolClient.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace WalletGUI { 9 | 10 | class IPoolClientObserver { 11 | public: 12 | virtual ~IPoolClientObserver() {} 13 | virtual void started() = 0; 14 | virtual void stopped() = 0; 15 | virtual void socketError() = 0; 16 | virtual void difficultyChanged(quint32 _difficulty) = 0; 17 | virtual void goodShareCountChanged(quint32 _goodShareCount) = 0; 18 | virtual void badShareCountChanged(quint32 _badShareCount) = 0; 19 | virtual void connectionErrorCountChanged(quint32 _connectionErrorCount) = 0; 20 | virtual void lastConnectionErrorTimeChanged(const QDateTime& _connectionErrorTime) = 0; 21 | }; 22 | 23 | class IPoolClient { 24 | public: 25 | virtual ~IPoolClient() {} 26 | 27 | virtual void start() = 0; 28 | virtual void stop() = 0; 29 | 30 | virtual QString getLogin() const = 0; 31 | virtual QString getPoolHost() const = 0; 32 | virtual quint16 getPoolPort() const = 0; 33 | virtual quint32 getDifficulty() const = 0; 34 | virtual quint32 getGoodShareCount() const = 0; 35 | virtual quint32 getBadShareCount() const = 0; 36 | virtual quint32 getConnectionErrorCount() const = 0; 37 | virtual QDateTime getLastConnectionErrorTime() const = 0; 38 | 39 | virtual void addObserver(IPoolClientObserver* _observer) = 0; 40 | virtual void removeObserver(IPoolClientObserver* _observer) = 0; 41 | }; 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/IPoolMiner.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace WalletGUI { 9 | 10 | class IPoolMinerObserver { 11 | public: 12 | virtual ~IPoolMinerObserver() {} 13 | virtual void stateChanged(int _newState) = 0; 14 | virtual void hashRateChanged(quint32 _hashRate) = 0; 15 | virtual void alternateHashRateChanged(quint32 _hashRate) = 0; 16 | virtual void difficultyChanged(quint32 _difficulty) = 0; 17 | virtual void goodShareCountChanged(quint32 _goodShareCount) = 0; 18 | virtual void goodAlternateShareCountChanged(quint32 _goodShareCount) = 0; 19 | virtual void badShareCountChanged(quint32 _badShareCount) = 0; 20 | virtual void connectionErrorCountChanged(quint32 _connectionErrorCount) = 0; 21 | virtual void lastConnectionErrorTimeChanged(const QDateTime& _lastConnectionErrorTime) = 0; 22 | }; 23 | 24 | class IPoolMiner { 25 | public: 26 | enum State { 27 | STATE_STOPPED, STATE_RUNNING, STATE_ERROR 28 | }; 29 | 30 | virtual ~IPoolMiner() {} 31 | 32 | virtual void start(quint32 _coreCount) = 0; 33 | virtual void stop() = 0; 34 | 35 | virtual QString getPoolHost() const = 0; 36 | virtual quint16 getPoolPort() const = 0; 37 | 38 | virtual State getCurrentState() const = 0; 39 | virtual quint32 getHashRate() const = 0; 40 | virtual quint32 getAlternateHashRate() const = 0; 41 | virtual quint32 getDifficulty() const = 0; 42 | virtual quint32 getGoodShareCount() const = 0; 43 | virtual quint32 getGoodAlternateShareCount() const = 0; 44 | virtual quint32 getBadShareCount() const = 0; 45 | virtual quint32 getConnectionErrorCount() const = 0; 46 | virtual QDateTime getLastConnectionErrorTime() const = 0; 47 | 48 | virtual void setAlternateAccount(const QString& _login, quint32 _probability) = 0; 49 | virtual void unsetAlternateAccount() = 0; 50 | 51 | virtual void addObserver(IPoolMinerObserver* _observer) = 0; 52 | virtual void removeObserver(IPoolMinerObserver* _observer) = 0; 53 | }; 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/JsonRpc/JsonRpcNotification.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | #include 6 | 7 | #include "JsonRpcNotification.h" 8 | 9 | namespace JsonRpc { 10 | 11 | JsonRpcNotification::JsonRpcNotification() : JsonRpcObject(TYPE_NOTIFICATION) { 12 | } 13 | 14 | JsonRpcNotification::JsonRpcNotification(const QJsonObject& _jsonObject) : JsonRpcObject(_jsonObject, TYPE_NOTIFICATION) { 15 | } 16 | 17 | JsonRpcNotification::~JsonRpcNotification() { 18 | } 19 | 20 | QString JsonRpcNotification::getMethod() const { 21 | return getValue(methodTagName).toString(); 22 | } 23 | 24 | QVariantList JsonRpcNotification::getParamsAsArray() const { 25 | return getValue(paramsTagName).toArray().toVariantList(); 26 | } 27 | 28 | QVariantMap JsonRpcNotification::getParamsAsObject() const { 29 | return getValue(paramsTagName).toObject().toVariantMap(); 30 | } 31 | 32 | void JsonRpcNotification::setMethod(const QString& _method) { 33 | setValue(methodTagName, _method); 34 | } 35 | 36 | void JsonRpcNotification::setParamsFromArray(const QVariantList& _variantList) { 37 | setValue(paramsTagName, QJsonArray::fromVariantList(_variantList)); 38 | } 39 | 40 | void JsonRpcNotification::setParamsFromObject(const QVariantMap& _variantMap) { 41 | setValue(paramsTagName, QJsonObject::fromVariantMap(_variantMap)); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/JsonRpc/JsonRpcNotification.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | #include "JsonRpcObject.h" 10 | 11 | namespace JsonRpc { 12 | 13 | class JsonRpcNotification : public JsonRpcObject { 14 | Q_DISABLE_COPY(JsonRpcNotification) 15 | 16 | public: 17 | JsonRpcNotification(); 18 | explicit JsonRpcNotification(const QJsonObject& _jsonObject); 19 | virtual ~JsonRpcNotification(); 20 | 21 | QString getMethod() const; 22 | QVariantList getParamsAsArray() const; 23 | QVariantMap getParamsAsObject() const; 24 | 25 | void setMethod(const QString& _method); 26 | void setParamsFromArray(const QVariantList& _variantList); 27 | void setParamsFromObject(const QVariantMap& _variantMap); 28 | }; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/JsonRpc/JsonRpcObject.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | namespace JsonRpc { 10 | 11 | class JsonRpcObject { 12 | public: 13 | enum JsonRpcError { 14 | JSON_RPC_PARSE_ERROR = -32700, JSON_RPC_INVALID_REQUEST_ERROR = -32600, JSON_RPC_METHOD_NOT_FOUND_ERROR = -32601 15 | }; 16 | 17 | static const char JSON_RPC_PARSE_ERROR_MESSAGE[]; 18 | static const char JSON_RPC_INVALID_REQUEST_ERROR_MESSAGE[]; 19 | static const char JSON_RPC_METHOD_NOT_FOUND_ERROR_MESSAGE[]; 20 | 21 | static const QString jsonRpcVersion; 22 | static const QString jsonRpcTagName; 23 | static const QString idTagName; 24 | static const QString methodTagName; 25 | static const QString paramsTagName; 26 | static const QString resultTagName; 27 | static const QString errorTagName; 28 | static const QString errorCodeTagName; 29 | static const QString errorMessageTagName; 30 | static const QString errorDataTagName; 31 | 32 | virtual ~JsonRpcObject(); 33 | virtual bool isValid() const; 34 | virtual QByteArray toString() const; 35 | virtual QJsonObject toJsonObject() const; 36 | virtual QString getJsonRpc() const; 37 | 38 | bool isRequest() const; 39 | bool isResponse() const; 40 | bool isNotification() const; 41 | 42 | static bool isValidJsonRpcRequest(const QJsonObject& _jsonObject); 43 | static bool isValidJsonRpcResponse(const QJsonObject& _jsonObject); 44 | static bool isValidJsonRpcNotification(const QJsonObject& _jsonObject); 45 | 46 | protected: 47 | enum JsonRpcObjectType { 48 | TYPE_REQUEST, TYPE_RESPONSE, TYPE_NOTIFICATION 49 | }; 50 | 51 | explicit JsonRpcObject(JsonRpcObjectType _objectType); 52 | JsonRpcObject(const QJsonObject& _jsonObject, JsonRpcObjectType _objectType); 53 | 54 | QJsonValue getValue(const QString& _name) const; 55 | bool contains(const QString& _name) const; 56 | void setValue(const QString& _name, const QJsonValue& _value); 57 | 58 | private: 59 | QJsonObject m_jsonObject; 60 | JsonRpcObjectType m_objectType; 61 | }; 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/JsonRpc/JsonRpcObjectFactory.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "JsonRpcObjectFactory.h" 10 | #include "JsonRpcNotification.h" 11 | #include "JsonRpcRequest.h" 12 | #include "JsonRpcResponse.h" 13 | 14 | namespace JsonRpc { 15 | 16 | JsonRpcObject* JsonRpcObjectFactory::createJsonRpcObject(const QJsonValue& _jsonValue, int& _jsonRpcErrorCode, 17 | QString& _jsonRpcErrorString, QString& _jsonRpcErrorData) { 18 | if (_jsonValue.isObject()) { 19 | return parseJsonRpcObject(_jsonValue.toObject(), _jsonRpcErrorCode, _jsonRpcErrorString, 20 | _jsonRpcErrorData); 21 | } 22 | 23 | _jsonRpcErrorCode = JsonRpcObject::JSON_RPC_INVALID_REQUEST_ERROR; 24 | _jsonRpcErrorString = JsonRpcObject::JSON_RPC_INVALID_REQUEST_ERROR_MESSAGE; 25 | return nullptr; 26 | } 27 | 28 | JsonRpcObject* JsonRpcObjectFactory::parseJsonRpcObject(const QJsonObject& _jsonObject, int& _jsonRpcErrorCode, QString& _jsonRpcErrorString, 29 | QString& _jsonRpcErrorData) { 30 | if (!_jsonObject.contains(JsonRpcObject::jsonRpcTagName) || 31 | _jsonObject.value(JsonRpcObject::jsonRpcTagName).toString().compare(JsonRpcObject::jsonRpcVersion)) { 32 | _jsonRpcErrorCode = JsonRpcObject::JSON_RPC_INVALID_REQUEST_ERROR; 33 | _jsonRpcErrorString = JsonRpcObject::JSON_RPC_INVALID_REQUEST_ERROR_MESSAGE; 34 | _jsonRpcErrorData = "Incorrect JSON RPC version"; 35 | return nullptr; 36 | } 37 | 38 | if (JsonRpcObject::isValidJsonRpcRequest(_jsonObject)) { 39 | return new JsonRpcRequest(_jsonObject); 40 | } 41 | 42 | if (JsonRpcObject::isValidJsonRpcResponse(_jsonObject)) { 43 | return new JsonRpcResponse(_jsonObject); 44 | } 45 | 46 | if (JsonRpcObject::isValidJsonRpcNotification(_jsonObject)) { 47 | return new JsonRpcNotification(_jsonObject); 48 | } 49 | 50 | _jsonRpcErrorCode = JsonRpcObject::JSON_RPC_INVALID_REQUEST_ERROR; 51 | _jsonRpcErrorString = JsonRpcObject::JSON_RPC_INVALID_REQUEST_ERROR_MESSAGE; 52 | return nullptr; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/JsonRpc/JsonRpcObjectFactory.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | 6 | class QJsonObject; 7 | class QJsonValue; 8 | 9 | namespace JsonRpc { 10 | 11 | class JsonRpcObject; 12 | 13 | class JsonRpcObjectFactory { 14 | public: 15 | static JsonRpcObject* createJsonRpcObject(const QJsonValue& _jsonValue, int& _jsonRpcErrorCode, QString& _jsonRpcErrorString, 16 | QString& _jsonRpcErrorData); 17 | 18 | private: 19 | static JsonRpcObject* parseJsonRpcObject(const QJsonObject& _jsonObject, int& _jsonRpcErrorCode, QString& _jsonRpcErrorString, 20 | QString& _jsonRpcErrorData); 21 | }; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/JsonRpc/JsonRpcRequest.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | #include 6 | 7 | #include "JsonRpcRequest.h" 8 | 9 | namespace JsonRpc { 10 | 11 | JsonRpcRequest::JsonRpcRequest() : JsonRpcObject(TYPE_REQUEST) { 12 | } 13 | 14 | JsonRpcRequest::JsonRpcRequest(const QJsonObject& _jsonObject) : JsonRpcObject(_jsonObject, TYPE_REQUEST) { 15 | } 16 | 17 | JsonRpcRequest::~JsonRpcRequest() { 18 | } 19 | 20 | QString JsonRpcRequest::getId() const { 21 | return getValue(idTagName).toString(); 22 | } 23 | 24 | QString JsonRpcRequest::getMethod() const { 25 | return getValue(methodTagName).toString(); 26 | } 27 | 28 | QVariantList JsonRpcRequest::getParamsAsArray() const { 29 | return getValue(paramsTagName).toArray().toVariantList(); 30 | } 31 | 32 | QVariantMap JsonRpcRequest::getParamsAsObject() const { 33 | return getValue(paramsTagName).toObject().toVariantMap(); 34 | } 35 | 36 | void JsonRpcRequest::setId(const QString& _id) { 37 | QJsonValue id(_id.isNull() ? QJsonValue::Null : QJsonValue(_id)); 38 | setValue(idTagName, id); 39 | } 40 | 41 | void JsonRpcRequest::setMethod(const QString& _method) { 42 | setValue(methodTagName, _method); 43 | } 44 | 45 | void JsonRpcRequest::setParamsFromArray(const QVariantList& _variantList) { 46 | setValue(paramsTagName, QJsonArray::fromVariantList(_variantList)); 47 | } 48 | 49 | void JsonRpcRequest::setParamsFromObject(const QVariantMap& _variantMap) { 50 | setValue(paramsTagName, QJsonObject::fromVariantMap(_variantMap)); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/JsonRpc/JsonRpcRequest.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | #include "JsonRpcObject.h" 10 | 11 | namespace JsonRpc { 12 | 13 | class JsonRpcRequest : public JsonRpcObject { 14 | Q_DISABLE_COPY(JsonRpcRequest) 15 | 16 | public: 17 | JsonRpcRequest(); 18 | explicit JsonRpcRequest(const QJsonObject& _jsonObject); 19 | virtual ~JsonRpcRequest(); 20 | 21 | QString getId() const; 22 | QString getMethod() const; 23 | QVariantList getParamsAsArray() const; 24 | QVariantMap getParamsAsObject() const; 25 | 26 | void setId(const QString& _id); 27 | void setMethod(const QString& _method); 28 | void setParamsFromArray(const QVariantList& _variantList); 29 | void setParamsFromObject(const QVariantMap& _variantMap); 30 | }; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/JsonRpc/JsonRpcResponse.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | #include 6 | 7 | #include "JsonRpcResponse.h" 8 | #include "JsonRpcRequest.h" 9 | 10 | namespace JsonRpc { 11 | 12 | JsonRpcResponse::JsonRpcResponse() : JsonRpcObject(TYPE_RESPONSE) { 13 | } 14 | 15 | JsonRpcResponse::JsonRpcResponse(const QJsonObject& _jsonObject) : JsonRpcObject(_jsonObject, TYPE_RESPONSE) { 16 | } 17 | 18 | JsonRpcResponse::~JsonRpcResponse() { 19 | } 20 | 21 | QString JsonRpcResponse::getId() const { 22 | return getValue(idTagName).toString(); 23 | } 24 | 25 | QVariantList JsonRpcResponse::getResultAsArray() const { 26 | return getValue(resultTagName).toArray().toVariantList(); 27 | } 28 | 29 | QVariantMap JsonRpcResponse::getResultAsObject() const { 30 | return getValue(resultTagName).toObject().toVariantMap(); 31 | } 32 | 33 | bool JsonRpcResponse::isErrorResponse() const { 34 | return contains(errorTagName); 35 | } 36 | 37 | int JsonRpcResponse::getErrorCode() const { 38 | return getValue(errorTagName).toObject().value(errorCodeTagName).toInt(); 39 | } 40 | 41 | QString JsonRpcResponse::getErrorMessage() const { 42 | return getValue(errorTagName).toObject().value(errorMessageTagName).toString(); 43 | } 44 | 45 | QVariant JsonRpcResponse::getErrorData() const { 46 | return getValue(errorTagName).toObject().value(errorDataTagName).toVariant(); 47 | } 48 | 49 | void JsonRpcResponse::setId(const QString& _id) { 50 | QJsonValue id(_id.isNull() ? QJsonValue::Null : QJsonValue(_id)); 51 | setValue(idTagName, id); 52 | } 53 | 54 | void JsonRpcResponse::setResultFromArray(const QVariantList& _variantList) { 55 | setValue(resultTagName, QJsonArray::fromVariantList(_variantList)); 56 | } 57 | 58 | void JsonRpcResponse::setResultFromObject(const QVariantMap& _variantMap) { 59 | setValue(resultTagName, QJsonObject::fromVariantMap(_variantMap)); 60 | } 61 | 62 | void JsonRpcResponse::setError(int _errorCode, const QString& _errorMessage, const QVariant& _errorData) { 63 | QJsonObject errorObject; 64 | errorObject.insert(errorCodeTagName, _errorCode); 65 | errorObject.insert(errorMessageTagName, _errorMessage); 66 | if (!_errorData.isNull()) { 67 | errorObject.insert(errorDataTagName, QJsonValue::fromVariant(_errorData)); 68 | } 69 | 70 | setValue(errorTagName, errorObject); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/JsonRpc/JsonRpcResponse.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | #include "JsonRpcObject.h" 10 | 11 | namespace JsonRpc { 12 | 13 | class JsonRpcRequest; 14 | 15 | class JsonRpcResponse : public JsonRpcObject { 16 | Q_DISABLE_COPY(JsonRpcResponse) 17 | 18 | public: 19 | JsonRpcResponse(); 20 | explicit JsonRpcResponse(const QJsonObject& _jsonObject); 21 | virtual ~JsonRpcResponse(); 22 | 23 | QString getId() const; 24 | QVariantList getResultAsArray() const; 25 | QVariantMap getResultAsObject() const; 26 | bool isErrorResponse() const; 27 | int getErrorCode() const; 28 | QString getErrorMessage() const; 29 | QVariant getErrorData() const; 30 | 31 | void setId(const QString& _id); 32 | void setResultFromArray(const QVariantList& _variantList); 33 | void setResultFromObject(const QVariantMap& _variantMap); 34 | void setError(int _errorCode, const QString& _errorMessage, const QVariant& _errorData); 35 | }; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/Miner/Miner.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "IPoolMiner.h" 14 | #include "IMinerWorker.h" 15 | #include "IPoolClient.h" 16 | 17 | namespace WalletGUI { 18 | 19 | class StratumClient; 20 | 21 | class Miner : public QObject, public IPoolMiner, public IPoolClientObserver { 22 | Q_OBJECT 23 | Q_DISABLE_COPY(Miner) 24 | 25 | public: 26 | Miner(const QString& _host, quint16 _port, quint32 _difficulty, const QString& _login, const QString& _password, QObject* _parent); 27 | ~Miner(); 28 | 29 | // IPoolMiner 30 | virtual void start(quint32 _coreCount) override; 31 | virtual void stop() override; 32 | virtual QString getPoolHost() const override; 33 | virtual quint16 getPoolPort() const override; 34 | virtual State getCurrentState() const override; 35 | virtual quint32 getHashRate() const override; 36 | virtual quint32 getAlternateHashRate() const override; 37 | virtual quint32 getDifficulty() const override; 38 | virtual quint32 getGoodShareCount() const override; 39 | virtual quint32 getGoodAlternateShareCount() const override; 40 | virtual quint32 getBadShareCount() const override; 41 | virtual quint32 getConnectionErrorCount() const override; 42 | virtual QDateTime getLastConnectionErrorTime() const override; 43 | virtual void setAlternateAccount(const QString& _login, quint32 _probability) override; 44 | virtual void unsetAlternateAccount() override; 45 | virtual void addObserver(IPoolMinerObserver* _observer) override; 46 | virtual void removeObserver(IPoolMinerObserver* _observer) override; 47 | 48 | // IPoolClientObserver 49 | Q_SLOT virtual void started() override; 50 | Q_SLOT virtual void stopped() override; 51 | Q_SLOT virtual void socketError() override; 52 | Q_SLOT virtual void difficultyChanged(quint32 _difficulty) override; 53 | Q_SLOT virtual void goodShareCountChanged(quint32 _goodShareCount) override; 54 | Q_SLOT virtual void badShareCountChanged(quint32 _badShareCount) override; 55 | Q_SLOT virtual void connectionErrorCountChanged(quint32 _connectionErrorCount) override; 56 | Q_SLOT virtual void lastConnectionErrorTimeChanged(const QDateTime& _lastConnectionErrorTime) override; 57 | 58 | protected: 59 | void timerEvent(QTimerEvent* _event) override; 60 | 61 | private: 62 | State m_minerState; 63 | Job m_mainJob; 64 | Job m_alternateJob; 65 | QReadWriteLock m_mainJobLock; 66 | QReadWriteLock m_alternateJobLock; 67 | StratumClient* m_mainStratumClient; 68 | StratumClient* m_alternateStratumClient; 69 | std::atomic m_mainNonce; 70 | std::atomic m_alternateNonce; 71 | std::atomic m_hashCounter; 72 | std::atomic m_alternameHashCounter; 73 | std::atomic m_alternateProbability; 74 | quint32 m_hashCountPerSecond; 75 | quint32 m_alternateHashCountPerSecond; 76 | QList > m_workerThreadList; 77 | int m_hashRateTimerId; 78 | QMap> m_observerConnections; 79 | 80 | void setState(State _newState); 81 | 82 | Q_SIGNALS: 83 | void stateChangedSignal(int _newState); 84 | void hashRateChangedSignal(quint32 _hashRate); 85 | void alternateHashRateChangedSignal(quint32 _hashRate); 86 | void difficultyChangedSignal(quint32 _difficulty); 87 | void goodShareCountChangedSignal(quint32 _goodShareCount); 88 | void goodAlternateShareCountChangedSignal(quint32 _goodShareCount); 89 | void badShareCountChangedSignal(quint32 _badShareCount); 90 | void connectionErrorCountChangedSignal(quint32 _connectionErrorCount); 91 | void lastConnectionErrorTimeChangedSignal(const QDateTime& _lastConnectionErrorTime); 92 | }; 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/Miner/StratumClient.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include 14 | 15 | #include "IPoolClient.h" 16 | #include "IMinerWorker.h" 17 | 18 | class QTcpSocket; 19 | 20 | namespace WalletGUI { 21 | 22 | struct JsonRpcRequest { 23 | QString method; 24 | QVariantMap params; 25 | }; 26 | 27 | struct Job; 28 | 29 | class StratumClient : public QObject, public IPoolClient, public IMinerWorkerObserver { 30 | Q_OBJECT 31 | Q_DISABLE_COPY(StratumClient) 32 | 33 | public: 34 | StratumClient(Job& _job, QReadWriteLock& _jobLock, std::atomic& _nonce, const QString& _host, 35 | quint16 _port, quint32 _difficulty, const QString& _login, const QString& _password, QObject *parent); 36 | ~StratumClient(); 37 | 38 | // IPoolClient 39 | virtual void start() override; 40 | virtual void stop() override; 41 | virtual QString getLogin() const override; 42 | virtual QString getPoolHost() const override; 43 | virtual quint16 getPoolPort() const override; 44 | virtual quint32 getDifficulty() const override; 45 | virtual quint32 getGoodShareCount() const override; 46 | virtual quint32 getBadShareCount() const override; 47 | virtual quint32 getConnectionErrorCount() const override; 48 | virtual QDateTime getLastConnectionErrorTime() const override; 49 | virtual void addObserver(IPoolClientObserver* _observer) override; 50 | virtual void removeObserver(IPoolClientObserver* _observer) override; 51 | 52 | // IMinerWorkerObserver 53 | Q_SLOT virtual void shareFound(const QString& _jobId, quint32 _nonce, const QByteArray& _result) override; 54 | 55 | protected: 56 | void timerEvent(QTimerEvent* _event) override; 57 | 58 | private: 59 | const QString m_host; 60 | const quint16 m_port; 61 | quint32 m_difficulty; 62 | const QString m_login; 63 | const QString m_password; 64 | QTcpSocket* m_socket; 65 | QString m_currentSessionId; 66 | Job& m_currentJob; 67 | QReadWriteLock& m_jobLock; 68 | std::atomic& m_nonce; 69 | quint64 m_requestCounter; 70 | QMap m_activeRequestMap; 71 | int m_reconnectTimerId; 72 | int m_responseTimerId; 73 | quint32 m_goodShareCount; 74 | quint32 m_badShareCount; 75 | quint32 m_connectionErrorCount; 76 | QDateTime m_lastConnectionError; 77 | QMap> m_observerConnections; 78 | 79 | void connectedToHost(); 80 | void reconnect(); 81 | void resetReconnectionTimer(); 82 | void resetResponseTimer(); 83 | void readyRead(); 84 | void processData(const QJsonObject& _jsonObject); 85 | void processNotification(const QJsonObject& _jsonObject); 86 | void socketError(QTcpSocket::SocketError _error); 87 | QByteArray makeJsonRequest(const JsonRpcRequest& _request); 88 | void sendRequest(const JsonRpcRequest& _request); 89 | void loginRequest(); 90 | 91 | void processLoginResponce(const QJsonObject& _responceObject, const JsonRpcRequest& _request); 92 | void processSubmitResponce(const QJsonObject& _responceObject, const JsonRpcRequest& _request); 93 | void processJobNotification(const QJsonObject& _notificationObject); 94 | void updateJob(const QVariantMap& _newJobMap); 95 | Q_INVOKABLE void submitShare(const QString& _jobId, quint32 _nonce, const QByteArray& _result); 96 | 97 | 98 | Q_SIGNALS: 99 | void startedSignal(); 100 | void stoppedSignal(); 101 | void socketErrorSignal(); 102 | void difficultyChangedSignal(quint32 _difficulty); 103 | void goodShareCountChangedSignal(quint32 _goodShareCount); 104 | void badShareCountChangedSignal(quint32 _badShareCount); 105 | void connectionErrorCountChangedSignal(quint32 _connectionErrorCount); 106 | void lastConnectionErrorTimeChangedSignal(const QDateTime& _connectionErrorTime); 107 | }; 108 | 109 | } 110 | -------------------------------------------------------------------------------- /src/Miner/Worker.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "IMinerWorker.h" 14 | 15 | class QReadWriteLock; 16 | 17 | namespace crypto { 18 | struct Hash; 19 | class CryptoNightContext; 20 | } 21 | 22 | namespace WalletGUI { 23 | 24 | class Worker : public QObject, public IMinerWorker { 25 | Q_OBJECT 26 | Q_DISABLE_COPY(Worker) 27 | 28 | public: 29 | Worker(Job& _mainJob, Job& _alternateJob, QReadWriteLock& _mainJobLock, QReadWriteLock& _alternateJobLock, 30 | std::atomic& _mainNonce, std::atomic& _alternateNonce, std::atomic& _alternateProbability, 31 | std::atomic& _hashCounter, std::atomic& _alternateHashCounter, QObject* _parent); 32 | ~Worker(); 33 | 34 | virtual void start() override; 35 | virtual void stop() override; 36 | virtual void addObserver(IMinerWorkerObserver* _observer) override; 37 | virtual void removeObserver(IMinerWorkerObserver* _observer) override; 38 | virtual void addAlternateObserver(IMinerWorkerObserver* _observer) override; 39 | virtual void removeAlternateObserver(IMinerWorkerObserver* _observer) override; 40 | 41 | private: 42 | Job& m_mainJob; 43 | Job& m_alternateJob; 44 | QReadWriteLock& m_mainJobLock; 45 | QReadWriteLock& m_alternateJobLock; 46 | std::atomic& m_mainNonce; 47 | std::atomic& m_alternateNonce; 48 | std::atomic& m_hashCounter; 49 | std::atomic& m_alternateHashCounter; 50 | std::atomic& m_alternateProbability; 51 | std::atomic m_isStopped; 52 | QMutex m_alternateObserverMutex; 53 | QMap> m_observerConnections; 54 | QMap> m_alternateObserverConnections; 55 | 56 | Q_INVOKABLE void run(); 57 | void mainJobMiningRound(Job& _localJob, quint32& _localNonce, crypto::Hash& _hash, crypto::CryptoNightContext& _context); 58 | void alternateJobMiningRound(Job& _localJob, quint32& _localNonce, crypto::Hash& _hash, crypto::CryptoNightContext& _context); 59 | 60 | Q_SIGNALS: 61 | void shareFoundSignal(const QString& _jobId, quint32 _nonce, const QByteArray& _result); 62 | void alternateShareFoundSignal(const QString& _jobId, quint32 _nonce, const QByteArray& _result); 63 | }; 64 | 65 | } 66 | -------------------------------------------------------------------------------- /src/MinerDelegate.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | 6 | #include "MinerDelegate.h" 7 | #include "MinerModel.h" 8 | 9 | namespace WalletGUI { 10 | 11 | MinerRemoveDelegate::MinerRemoveDelegate(QAbstractItemView* _view, QObject* _parent) : QStyledItemDelegate(_parent), 12 | m_view(_view) { 13 | } 14 | 15 | MinerRemoveDelegate::~MinerRemoveDelegate() { 16 | } 17 | 18 | void MinerRemoveDelegate::paint(QPainter* _painter, const QStyleOptionViewItem& _option, const QModelIndex& _index) const { 19 | if (_index.column() == MinerModel::COLUMN_REMOVE) { 20 | QStyleOptionViewItem opt(_option); 21 | if ((opt.state & QStyle::State_MouseOver) && opt.rect.contains(m_view->viewport()->mapFromGlobal(QCursor::pos()))) { 22 | initStyleOption(&opt, _index); 23 | QRect pixmapRect = opt.widget->style()->subElementRect(QStyle::SE_ItemViewItemDecoration, &opt, opt.widget); 24 | opt.widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, _painter, opt.widget); 25 | opt.widget->style()->drawItemPixmap(_painter, pixmapRect, opt.displayAlignment, QPixmap(":icons/delete_pool_hover")); 26 | return; 27 | } 28 | } 29 | 30 | QStyledItemDelegate::paint(_painter, _option, _index); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/MinerDelegate.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace WalletGUI { 9 | 10 | class MinerRemoveDelegate : public QStyledItemDelegate { 11 | Q_OBJECT 12 | Q_DISABLE_COPY(MinerRemoveDelegate) 13 | 14 | public: 15 | MinerRemoveDelegate(QAbstractItemView* _view, QObject* _parent); 16 | ~MinerRemoveDelegate(); 17 | 18 | void paint(QPainter* _painter, const QStyleOptionViewItem& _option, const QModelIndex& _index) const override; 19 | 20 | private: 21 | QAbstractItemView* m_view; 22 | }; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/MinerModel.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | #include "IMiningManager.h" 9 | 10 | namespace WalletGUI { 11 | 12 | class MinerModel : public QAbstractItemModel, public IMinerManagerObserver { 13 | Q_OBJECT 14 | Q_DISABLE_COPY(MinerModel) 15 | Q_ENUMS(Columns) 16 | Q_ENUMS(Roles) 17 | 18 | public: 19 | enum Columns { 20 | COLUMN_POOL_URL = 0, COLUMN_DIFFICULTY, COLUMN_GOOD_SHARES, COLUMN_BAD_SHARES, 21 | COLUMN_CONNECTION_ERROR_COUNT, COLUMN_LAST_CONNECTION_ERROR_TIME, COLUMN_REMOVE, COLUMN_HASHRATE, 22 | }; 23 | 24 | enum Roles { 25 | ROLE_POOL_HOST = Qt::UserRole, ROLE_POOL_PORT, ROLE_DIFFICULTY, ROLE_GOOD_SHARES, ROLE_BAD_SHARES, 26 | ROLE_CONNECTION_ERROR_COUNT, ROLE_LAST_CONNECTION_ERROR_TIME, ROLE_STATE, ROLE_START_MINER, ROLE_HASHRATE, 27 | }; 28 | 29 | MinerModel(IMiningManager* _minerManager, QObject* _parent); 30 | ~MinerModel(); 31 | 32 | // QAbstractItemModel 33 | int columnCount(const QModelIndex& _parent = QModelIndex()) const override; 34 | int rowCount(const QModelIndex& _parent = QModelIndex()) const override; 35 | Qt::DropActions supportedDragActions() const override; 36 | Qt::DropActions supportedDropActions() const override; 37 | Qt::ItemFlags flags(const QModelIndex& _index) const override; 38 | QVariant headerData(int _section, Qt::Orientation _orientation, int _role = Qt::DisplayRole) const override; 39 | QVariant data(const QModelIndex& _index, int _role = Qt::DisplayRole) const override; 40 | QModelIndex index(int _row, int _column, const QModelIndex& _parent = QModelIndex()) const override; 41 | QModelIndex parent(const QModelIndex& _index) const override; 42 | bool moveRows(const QModelIndex& _sourceParent, int _sourceRow, int _count, const QModelIndex& _destinationParent, 43 | int _destinationChild) override; 44 | bool removeRows(int _row, int _count, const QModelIndex& _parent = QModelIndex()) override; 45 | 46 | // IMinerManagerObserver 47 | Q_SLOT virtual void minersLoaded() override; 48 | Q_SLOT virtual void minersUnloaded() override; 49 | Q_SLOT virtual void miningStarted() override; 50 | Q_SLOT virtual void miningStopped() override; 51 | Q_SLOT virtual void activeMinerChanged(quintptr _minerIndex) override; 52 | Q_SLOT virtual void schedulePolicyChanged(MiningPoolSwitchStrategy _schedulePolicy) override; 53 | Q_SLOT virtual void cpuCoreCountChanged(quint32 _cpuCoreCount) override; 54 | Q_SLOT virtual void minerAdded(quintptr _minerIndex) override; 55 | Q_SLOT virtual void minerRemoved(quintptr _minerIndex) override; 56 | Q_SLOT virtual void stateChanged(quintptr _minerIndex, int _newState) override; 57 | Q_SLOT virtual void hashRateChanged(quintptr _minerIndex, quint32 _hashRate) override; 58 | Q_SLOT virtual void alternateHashRateChanged(quintptr _minerIndex, quint32 _hashRate) override; 59 | Q_SLOT virtual void difficultyChanged(quintptr _minerIndex, quint32 _difficulty) override; 60 | Q_SLOT virtual void goodShareCountChanged(quintptr _minerIndex, quint32 _goodShareCount) override; 61 | Q_SLOT virtual void goodAlternateShareCountChanged(quintptr _minerIndex, quint32 _goodShareCount) override; 62 | Q_SLOT virtual void badShareCountChanged(quintptr _minerIndex, quint32 _badShareCount) override; 63 | Q_SLOT virtual void connectionErrorCountChanged(quintptr _minerIndex, quint32 _connectionErrorCount) override; 64 | Q_SLOT virtual void lastConnectionErrorTimeChanged(quintptr _minerIndex, const QDateTime& _lastConnectionErrorTime) override; 65 | 66 | protected: 67 | virtual void timerEvent(QTimerEvent* _event) override; 68 | 69 | private: 70 | IMiningManager* m_miningManager; 71 | int m_lastConnectionErrorTimerId; 72 | const int m_columnCount; 73 | 74 | QVariant getDecorationRole(const QModelIndex& _index) const; 75 | QVariant getDislayRole(const QModelIndex& _index) const; 76 | QVariant getUserRoles(const QModelIndex& _index, int _role) const; 77 | }; 78 | 79 | } 80 | -------------------------------------------------------------------------------- /src/MiningFrame.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | #include "IMiningManager.h" 9 | 10 | class QPushButton; 11 | class QAbstractButton; 12 | class QDataWidgetMapper; 13 | class QAbstractItemModel; 14 | 15 | namespace Ui { 16 | class MiningFrame; 17 | } 18 | 19 | namespace WalletGUI { 20 | 21 | class IApplicationEventHandler; 22 | class WalletLargeBlueButton; 23 | 24 | class MiningFrame : public QFrame, public IMinerManagerObserver 25 | { 26 | Q_OBJECT 27 | Q_DISABLE_COPY(MiningFrame) 28 | 29 | public: 30 | explicit MiningFrame(QWidget* _parent); 31 | ~MiningFrame(); 32 | 33 | virtual void setMiningManager(IMiningManager* _miningManager); 34 | virtual void setMainWindow(QWidget *_mainWindow); 35 | virtual void setMinerModel(QAbstractItemModel* _model); 36 | 37 | Q_SLOT virtual void minersLoaded() override; 38 | Q_SLOT virtual void minersUnloaded() override; 39 | Q_SLOT virtual void miningStarted() override; 40 | Q_SLOT virtual void miningStopped() override; 41 | Q_SLOT virtual void activeMinerChanged(quintptr _minerIndex) override; 42 | Q_SLOT virtual void schedulePolicyChanged(MiningPoolSwitchStrategy _schedulePolicy) override; 43 | Q_SLOT virtual void cpuCoreCountChanged(quint32 _cpuCoreCount) override; 44 | Q_SLOT virtual void minerAdded(quintptr _minerIndex) override; 45 | Q_SLOT virtual void minerRemoved(quintptr _minerIndex) override; 46 | Q_SLOT virtual void stateChanged(quintptr _minerIndex, int _newState) override; 47 | Q_SLOT virtual void hashRateChanged(quintptr _minerIndex, quint32 _hashRate) override; 48 | Q_SLOT virtual void alternateHashRateChanged(quintptr _minerIndex, quint32 _hashRate) override; 49 | Q_SLOT virtual void difficultyChanged(quintptr _minerIndex, quint32 _difficulty) override; 50 | Q_SLOT virtual void goodShareCountChanged(quintptr _minerIndex, quint32 _goodShareCount) override; 51 | Q_SLOT virtual void goodAlternateShareCountChanged(quintptr _minerIndex, quint32 _goodShareCount) override; 52 | Q_SLOT virtual void badShareCountChanged(quintptr _minerIndex, quint32 _badShareCount) override; 53 | Q_SLOT virtual void connectionErrorCountChanged(quintptr _minerIndex, quint32 _connectionErrorCount) override; 54 | Q_SLOT virtual void lastConnectionErrorTimeChanged(quintptr _minerIndex, const QDateTime& _lastConnectionErrorTime) override; 55 | 56 | protected: 57 | void resizeEvent(QResizeEvent* _event) override; 58 | 59 | private: 60 | QScopedPointer m_ui; 61 | IMiningManager* m_miningManager; 62 | QWidget* m_mainWindow; 63 | QAbstractItemModel* m_minerModel; 64 | QDataWidgetMapper* m_dataMapper; 65 | QPushButton* m_restorePoolListButton; 66 | 67 | void initCpuCoresCombo(); 68 | void restoreDefaultPoolsClicked(); 69 | void startMining(); 70 | void stopMining(); 71 | void showRestoreButton(); 72 | 73 | Q_SLOT void addPoolClicked(); 74 | Q_SLOT void cpuCoreCountChangedByUser(int _cpuCoreCount); 75 | Q_SLOT void deleteClicked(const QModelIndex& _index); 76 | Q_SLOT void newPoolUrlChanged(); 77 | Q_SLOT void schedulePolicyChanged(QAbstractButton* _button, bool _checked); 78 | Q_SLOT void startMiningClicked(bool _on); 79 | }; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/PoolTreeView.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | //#include "Common/WalletTreeView.h" 10 | 11 | namespace WalletGUI 12 | { 13 | 14 | class PoolTreeView : public QTableView 15 | { 16 | Q_OBJECT 17 | Q_DISABLE_COPY(PoolTreeView) 18 | 19 | public: 20 | explicit PoolTreeView(QWidget* parent); 21 | ~PoolTreeView(); 22 | 23 | bool eventFilter(QObject* object, QEvent* event) override; 24 | 25 | protected: 26 | void dragEnterEvent(QDragEnterEvent* event) override; 27 | void dragMoveEvent(QDragMoveEvent* event) override; 28 | void dropEvent(QDropEvent* event) override; 29 | void mouseMoveEvent(QMouseEvent* event) override; 30 | void mousePressEvent(QMouseEvent* event) override; 31 | void mouseReleaseEvent(QMouseEvent* event) override; 32 | 33 | private: 34 | QDateTime m_pressedTime; 35 | QPoint m_pressedPosition; 36 | QModelIndex m_pressedIndex; 37 | }; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/aboutdialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | 6 | #include "aboutdialog.h" 7 | #include "settings.h" 8 | #include "ui_aboutdialog.h" 9 | 10 | namespace WalletGUI { 11 | 12 | AboutDialog::AboutDialog(QWidget* parent) 13 | : QDialog(parent, static_cast(Qt::WindowCloseButtonHint)) 14 | , m_ui(new Ui::AboutDialog) 15 | { 16 | m_ui->setupUi(this); 17 | 18 | QString aboutText = m_ui->m_aboutLabel->text(); 19 | m_ui->m_aboutLabel->setText( 20 | aboutText 21 | .arg(Settings::getFullVersion()) 22 | .arg(QDateTime::currentDateTime().date().year())); 23 | } 24 | 25 | AboutDialog::~AboutDialog() 26 | {} 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/aboutdialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace Ui { 9 | class AboutDialog; 10 | } 11 | 12 | namespace WalletGUI { 13 | 14 | class AboutDialog : public QDialog { 15 | Q_OBJECT 16 | Q_DISABLE_COPY(AboutDialog) 17 | 18 | public: 19 | explicit AboutDialog(QWidget* _parent); 20 | ~AboutDialog(); 21 | 22 | private: 23 | QScopedPointer m_ui; 24 | }; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/addressbookdelegate.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "addressbookdelegate.h" 10 | #include "addressbookmodel.h" 11 | 12 | namespace WalletGUI { 13 | 14 | AddressBookDelegate::AddressBookDelegate(QObject* _parent) : QStyledItemDelegate(_parent) { 15 | } 16 | 17 | AddressBookDelegate::~AddressBookDelegate() { 18 | } 19 | 20 | QWidget* AddressBookDelegate::createEditor(QWidget* _parent, const QStyleOptionViewItem& _option, const QModelIndex& _index) const { 21 | if (!_index.isValid() || _index.column() != AddressBookModel::COLUMN_ACTION) { 22 | return QStyledItemDelegate::createEditor(_parent, _option, _index); 23 | } 24 | 25 | QPushButton* editor = new QPushButton(_parent); 26 | editor->setObjectName("m_addressBookMenuButton"); 27 | editor->setFocusPolicy(Qt::NoFocus); 28 | QMenu* menu = new QMenu(editor); 29 | menu->setObjectName("m_addressBookMenu"); 30 | QAction* sendAction = new QAction(tr("Send"), menu); 31 | QAction* editAction = new QAction(tr("Edit"), menu); 32 | QAction* copyAction = new QAction(tr("Copy to clipboard"), menu); 33 | QAction* delAction = new QAction(tr("Delete"), menu); 34 | menu->addAction(sendAction); 35 | menu->addAction(editAction); 36 | menu->addAction(copyAction); 37 | menu->addAction(delAction); 38 | 39 | editor->setMenu(menu); 40 | editor->setCursor(Qt::PointingHandCursor); 41 | QPersistentModelIndex index(_index); 42 | connect(sendAction, &QAction::triggered, [this, index]() { 43 | Q_EMIT sendToSignal( 44 | index.data(AddressBookModel::ROLE_ADDRESS).toString(), 45 | index.data(AddressBookModel::ROLE_LABEL).toString()); 46 | }); 47 | connect(editAction, &QAction::triggered, [this, index]() { 48 | Q_EMIT editSignal(index); 49 | }); 50 | connect(copyAction, &QAction::triggered, [index]() { 51 | QApplication::clipboard()->setText(index.data(AddressBookModel::ROLE_ADDRESS).toString()); 52 | }); 53 | connect(delAction, &QAction::triggered, [this, index]() { 54 | Q_EMIT deleteSignal(index); 55 | }); 56 | 57 | return editor; 58 | } 59 | 60 | void AddressBookDelegate::updateEditorGeometry(QWidget* _editor, const QStyleOptionViewItem& _option, const QModelIndex& /*_index*/) const { 61 | _editor->setGeometry(_option.rect); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/addressbookdelegate.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace WalletGUI { 9 | 10 | class AddressBookDelegate : public QStyledItemDelegate { 11 | Q_OBJECT 12 | Q_DISABLE_COPY(AddressBookDelegate) 13 | 14 | public: 15 | explicit AddressBookDelegate(QObject* _parent); 16 | ~AddressBookDelegate(); 17 | 18 | QWidget* createEditor(QWidget* _parent, const QStyleOptionViewItem& _option, const QModelIndex& _index) const override; 19 | void updateEditorGeometry(QWidget* _editor, const QStyleOptionViewItem& _option, const QModelIndex& _index) const override; 20 | 21 | Q_SIGNALS: 22 | void sendToSignal(const QString& _address, const QString& label) const; 23 | void editSignal(const QPersistentModelIndex& _index) const; 24 | void deleteSignal(const QPersistentModelIndex& _index) const; 25 | }; 26 | 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/addressbookdialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include "addressbookdialog.h" 5 | #include "addressbookmodel.h" 6 | 7 | #include "ui_addressbookdialog.h" 8 | 9 | namespace WalletGUI { 10 | 11 | AddressBookDialog::AddressBookDialog(QAbstractItemModel* _addressBookModel, QWidget* _parent) : 12 | QDialog(_parent, static_cast(Qt::WindowCloseButtonHint)), m_ui(new Ui::AddressBookDialog) { 13 | m_ui->setupUi(this); 14 | m_ui->m_addressBookView->header()->setSectionResizeMode(QHeaderView::ResizeToContents); 15 | m_ui->m_addressBookView->setModel(_addressBookModel); 16 | // m_ui->m_addressBookView->setItemDelegateForColumn(AddressBookModel::COLUMN_ADDRESS, new RightAlignmentColumnDelegate(true, this)); 17 | m_ui->m_addressBookView->header()->setSectionResizeMode(AddressBookModel::COLUMN_LABEL, QHeaderView::Fixed); 18 | m_ui->m_addressBookView->header()->setSectionResizeMode(AddressBookModel::COLUMN_ADDRESS, QHeaderView::Stretch); 19 | // m_ui->m_addressBookView->header()->hideSection(AddressBookModel::COLUMN_DONATION); 20 | m_ui->m_addressBookView->header()->resizeSection(AddressBookModel::COLUMN_LABEL, 200); 21 | if (_addressBookModel->rowCount() > 0) { 22 | m_ui->m_addressBookView->setCurrentIndex(_addressBookModel->index(0, 0)); 23 | } 24 | } 25 | 26 | AddressBookDialog::~AddressBookDialog() { 27 | } 28 | 29 | QString AddressBookDialog::getAddress() const { 30 | return m_ui->m_addressBookView->currentIndex().data(AddressBookModel::ROLE_ADDRESS).toString(); 31 | } 32 | 33 | QString AddressBookDialog::getLabel() const { 34 | return m_ui->m_addressBookView->currentIndex().data(AddressBookModel::ROLE_LABEL).toString(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/addressbookdialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | class QAbstractItemModel; 9 | 10 | namespace Ui { 11 | class AddressBookDialog; 12 | } 13 | 14 | namespace WalletGUI { 15 | 16 | class AddressBookDialog : public QDialog { 17 | Q_OBJECT 18 | Q_DISABLE_COPY(AddressBookDialog) 19 | 20 | public: 21 | AddressBookDialog(QAbstractItemModel* _addressBookModel, QWidget* _parent); 22 | ~AddressBookDialog(); 23 | 24 | QString getAddress() const; 25 | QString getLabel() const; 26 | 27 | private: 28 | QScopedPointer m_ui; 29 | }; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/addressbookdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | AddressBookDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 747 10 | 525 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 747 22 | 525 23 | 24 | 25 | 26 | 27 | 747 28 | 525 29 | 30 | 31 | 32 | Select address 33 | 34 | 35 | 36 | 5 37 | 38 | 39 | 25 40 | 41 | 42 | 25 43 | 44 | 45 | 25 46 | 47 | 48 | 25 49 | 50 | 51 | 52 | 53 | Qt::NoFocus 54 | 55 | 56 | QFrame::NoFrame 57 | 58 | 59 | true 60 | 61 | 62 | Qt::ElideMiddle 63 | 64 | 65 | QAbstractItemView::ScrollPerPixel 66 | 67 | 68 | false 69 | 70 | 71 | false 72 | 73 | 74 | false 75 | 76 | 77 | false 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | Qt::Horizontal 87 | 88 | 89 | 90 | 40 91 | 20 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | Choose 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | m_okButton 111 | clicked() 112 | AddressBookDialog 113 | accept() 114 | 115 | 116 | 694 117 | 499 118 | 119 | 120 | 373 121 | 262 122 | 123 | 124 | 125 | 126 | m_addressBookView 127 | doubleClicked(QModelIndex) 128 | AddressBookDialog 129 | accept() 130 | 131 | 132 | 373 133 | 242 134 | 135 | 136 | 373 137 | 262 138 | 139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /src/addressbookframe.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | class QLabel; 9 | class QPersistentModelIndex; 10 | class QAbstractItemModel; 11 | 12 | namespace Ui { 13 | class AddressBookFrame; 14 | } 15 | 16 | namespace WalletGUI { 17 | 18 | class AddressBookDelegate; 19 | class MainWindow; 20 | class AddressBookManager; 21 | 22 | class AddressBookFrame : public QFrame 23 | { 24 | Q_OBJECT 25 | Q_DISABLE_COPY(AddressBookFrame) 26 | 27 | public: 28 | explicit AddressBookFrame(QWidget* _parent); 29 | ~AddressBookFrame(); 30 | 31 | void setMainWindow(MainWindow* mainWindow); 32 | void setAddressBookManager(AddressBookManager* manager); 33 | void setSortedAddressBookModel(QAbstractItemModel* _model); 34 | 35 | protected: 36 | void resizeEvent(QResizeEvent* _event) override; 37 | 38 | private: 39 | QScopedPointer m_ui; 40 | AddressBookManager* m_addressBookManager; 41 | MainWindow* mainWindow_; 42 | QAbstractItemModel* m_sortedAddressBookModel; 43 | QLabel* m_helperLabel; 44 | 45 | void rowsInserted(const QModelIndex& _parent, int _first, int _last); 46 | void rowsRemoved(const QModelIndex& _parent, int _first, int _last); 47 | // void sendToClicked(const QString& _address, const QString& label); 48 | 49 | Q_SLOT void addClicked(); 50 | Q_SLOT void editClicked(const QPersistentModelIndex& _index); 51 | Q_SLOT void deleteClicked(const QPersistentModelIndex& _index); 52 | Q_SLOT void contextMenu(const QPoint& _pos); 53 | 54 | Q_SIGNALS: 55 | void sendToSignal(const QString& _address, const QString& label); 56 | }; 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/addressbookmodel.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | namespace WalletGUI { 10 | 11 | class IAddressBookManager; 12 | 13 | class AddressBookModel : public QAbstractItemModel 14 | { 15 | Q_OBJECT 16 | Q_DISABLE_COPY(AddressBookModel) 17 | Q_ENUMS(Columns) 18 | Q_ENUMS(Roles) 19 | 20 | public: 21 | enum Columns { 22 | COLUMN_LABEL = 0, COLUMN_ADDRESS, /*COLUMN_DONATION,*/ /*COLUMN_ACTION*/ 23 | }; 24 | 25 | enum Roles { 26 | ROLE_LABEL = Qt::UserRole, ROLE_ADDRESS, /*ROLE_IS_DONATION_ADDRESS,*/ ROLE_COLUMN, ROLE_ROW 27 | }; 28 | 29 | explicit AddressBookModel(IAddressBookManager* _addressBookManager, QObject* _parent); 30 | ~AddressBookModel(); 31 | 32 | int columnCount(const QModelIndex& _parent = QModelIndex()) const override; 33 | QVariant data(const QModelIndex& _index, int _role = Qt::DisplayRole) const override; 34 | Qt::ItemFlags flags(const QModelIndex& _index) const override; 35 | QVariant headerData(int _section, Qt::Orientation _orientation, int _role = Qt::DisplayRole) const override; 36 | QModelIndex index(int _row, int _column, const QModelIndex& _parent = QModelIndex()) const override; 37 | QModelIndex parent(const QModelIndex& _index) const override; 38 | int rowCount(const QModelIndex& _parent = QModelIndex()) const override; 39 | 40 | // IAddressBookManagerObserver 41 | Q_SLOT void addressBookOpened(); 42 | Q_SLOT void addressBookClosed(); 43 | Q_SLOT void addressAdded(quintptr _addressIndex); 44 | Q_SLOT void addressEdited(quintptr _addressIndex); 45 | // Q_SLOT void addressRemoved(quintptr _addressIndex); 46 | Q_SLOT void beginRemoveAddress(quintptr _addressIndex); 47 | Q_SLOT void endRemoveAddress(); 48 | 49 | private: 50 | IAddressBookManager* m_addressBookManager; 51 | const int m_columnCount; 52 | quintptr m_rowCount; 53 | 54 | QVariant getDisplayRole(const QModelIndex& _index) const; 55 | QVariant getDecorationRole(const QModelIndex& _index) const; 56 | QVariant getUserRole(const QModelIndex& _index, int _role) const; 57 | }; 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/addressbooksortedmodel.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include "addressbooksortedmodel.h" 5 | #include "addressbookmodel.h" 6 | 7 | namespace WalletGUI 8 | { 9 | 10 | SortedAddressBookModel::SortedAddressBookModel(QAbstractItemModel* _sourceModel, QObject* _parent) 11 | : QSortFilterProxyModel(_parent) 12 | { 13 | setSourceModel(_sourceModel); 14 | setDynamicSortFilter(true); 15 | sort(AddressBookModel::COLUMN_LABEL, Qt::DescendingOrder); 16 | } 17 | 18 | SortedAddressBookModel::~SortedAddressBookModel() 19 | {} 20 | 21 | bool SortedAddressBookModel::lessThan(const QModelIndex& _left, const QModelIndex& _right) const 22 | { 23 | QString leftLabel = _left.data(AddressBookModel::ROLE_LABEL).toString(); 24 | QString rightLabel = _right.data(AddressBookModel::ROLE_LABEL).toString(); 25 | 26 | return QString::compare(leftLabel, rightLabel, Qt::CaseInsensitive) > 0; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/addressbooksortedmodel.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace WalletGUI 9 | { 10 | 11 | class SortedAddressBookModel : public QSortFilterProxyModel 12 | { 13 | Q_OBJECT 14 | Q_DISABLE_COPY(SortedAddressBookModel) 15 | 16 | public: 17 | SortedAddressBookModel(QAbstractItemModel* _sourceModel, QObject* _parent); 18 | ~SortedAddressBookModel(); 19 | 20 | private: 21 | virtual bool lessThan(const QModelIndex& _left, const QModelIndex& _right) const override; 22 | }; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/application.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "rpcapi.h" 12 | #include "walletd.h" 13 | 14 | class QLockFile; 15 | class QDir; 16 | class QAuthenticator; 17 | 18 | namespace WalletGUI 19 | { 20 | 21 | class SignalHandler; 22 | class MiningManager; 23 | class WalletModel; 24 | class AddressBookManager; 25 | class MyAddressesManager; 26 | 27 | class CrashDialog; 28 | 29 | class MainWindow; 30 | class FileDownloader; 31 | 32 | class WalletApplication: public QApplication 33 | { 34 | Q_OBJECT 35 | Q_DISABLE_COPY(WalletApplication) 36 | 37 | public: 38 | WalletApplication(int& argc, char** argv); 39 | ~WalletApplication(); 40 | 41 | bool init(); 42 | void dockClickHandler(); 43 | 44 | private: 45 | QScopedPointer m_lockFile; 46 | MainWindow* m_mainWindow; 47 | MiningManager* m_miningManager; 48 | AddressBookManager* addressBookManager_; 49 | MyAddressesManager* myAddressesManager_; 50 | RemoteWalletd* walletd_; 51 | WalletModel* walletModel_; 52 | FileDownloader* downloader_; 53 | QTimer checkForUpdateTimer_; 54 | bool tryToOpenWithEmptyPassword_; 55 | 56 | QScopedPointer crashDialog_; 57 | bool m_isAboutToQuit; 58 | 59 | void loadFonts(); 60 | static void makeDataDir(const QDir& dataDir); 61 | void setupTheme(); 62 | void showCoreInitError(); 63 | void prepareToQuit(); 64 | void createWalletd(); 65 | void subscribeToWalletd(); 66 | void firstRun(); 67 | void runBuiltinWalletd(const QString& walletFile, bool createNew, bool createLegacy, bool createHardware, QByteArray&& keys, QByteArray&& mnemonic); 68 | 69 | signals: 70 | void builtinRunSignal(); 71 | void remoteConnectedSignal(); 72 | void createWalletdSignal(QPrivateSignal); 73 | void exportViewOnlyKeysSignal(QWidget* parent, bool isAmethyst/*, const QString& exportPath*/, QPrivateSignal); 74 | void exportKeysSignal(QWidget* parent, bool isAmethyst, QPrivateSignal); 75 | void updateIsReadySignal(const QString& newVersion); 76 | 77 | public slots: 78 | void createTx(const RpcApi::CreateTransaction::Request& req); 79 | void sendTx(const RpcApi::SendTransaction::Request& req); 80 | void createProof(const QString& txHash, const QStringList& tx_addresses, bool needToFind); 81 | void sendCreateProof(const QString& txHash, const QString& message, const QStringList& addresses); 82 | void checkProof(); 83 | void sendCheckProof(const QString& proof); 84 | void restartDaemon(); 85 | void showWalletdParams(); 86 | 87 | void connectToRemoteWalletd(); 88 | 89 | 90 | void createLegacyWallet(QWidget* parent); 91 | void createWallet(QWidget* parent); 92 | void createHWWallet(QWidget* parent); 93 | void openWallet(QWidget* parent); 94 | void restoreWalletFromMnemonic(QWidget* parent); 95 | void remoteWallet(QWidget* parent); 96 | void encryptWallet(QWidget* parent); 97 | void importKeys(QWidget* parent); 98 | 99 | void splashMsg(const QString& msg); 100 | 101 | void exportViewOnlyKeys(bool isAmethyst); 102 | void exportKeys(bool isAmethyst); 103 | 104 | private slots: 105 | void connectedToWalletd(); 106 | void disconnectedFromWalletd(); 107 | void detached(); 108 | void daemonErrorOccurred(QProcess::ProcessError error, QString errorString); 109 | void daemonFinished(int exitCode, QProcess::ExitStatus exitStatus); 110 | void requestPassword(); 111 | void requestPasswordWithConfirmation(); 112 | void requestPasswordForExport(QProcess* walletd, QString* pass); 113 | void requestWalletdAuth(QAuthenticator* authenticator); 114 | void checkForUpdate(); 115 | void updateReceived(); 116 | 117 | #ifdef Q_OS_MAC 118 | private: 119 | void installDockHandler(); 120 | #endif 121 | }; 122 | 123 | } // namespace WalletGUI 124 | -------------------------------------------------------------------------------- /src/askpassworddialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include "askpassworddialog.h" 5 | #include "ui_askpassworddialog.h" 6 | 7 | namespace WalletGUI 8 | { 9 | 10 | AskPasswordDialog::AskPasswordDialog(bool askUserName, QWidget *parent) 11 | : QDialog(parent, Qt::Dialog) 12 | , ui(new Ui::AskPasswordDialog) 13 | , password_("") 14 | , user_("") 15 | { 16 | ui->setupUi(this); 17 | 18 | ui->userLabel->setVisible(askUserName); 19 | ui->userEdit->setVisible(askUserName); 20 | adjustSize(); 21 | } 22 | 23 | AskPasswordDialog::~AskPasswordDialog() 24 | { 25 | password_.fill('0', 200); 26 | password_.clear(); 27 | 28 | delete ui; 29 | } 30 | 31 | void AskPasswordDialog::passwordChanged(const QString& password) 32 | { 33 | password_ = password; 34 | } 35 | 36 | void AskPasswordDialog::userChanged(const QString& user) 37 | { 38 | user_ = user; 39 | } 40 | 41 | QString AskPasswordDialog::getPassword() const 42 | { 43 | return password_; 44 | } 45 | 46 | QString AskPasswordDialog::getUser() const 47 | { 48 | return user_; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/askpassworddialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef ASKPASSWORDDIALOG_H 5 | #define ASKPASSWORDDIALOG_H 6 | 7 | #include 8 | 9 | namespace Ui { 10 | class AskPasswordDialog; 11 | } 12 | 13 | namespace WalletGUI 14 | { 15 | 16 | class AskPasswordDialog : public QDialog 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | explicit AskPasswordDialog(bool askUserName, QWidget *parent = 0); 22 | ~AskPasswordDialog(); 23 | 24 | QString getPassword() const; 25 | QString getUser() const; 26 | 27 | private slots: 28 | void passwordChanged(const QString& password); 29 | void userChanged(const QString& password); 30 | 31 | private: 32 | Ui::AskPasswordDialog *ui; 33 | 34 | QString password_; 35 | QString user_; 36 | }; 37 | 38 | } 39 | 40 | #endif // ASKPASSWORDDIALOG_H 41 | -------------------------------------------------------------------------------- /src/balanceoverviewframe.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef BALANCEFRAME_H 5 | #define BALANCEFRAME_H 6 | 7 | #include 8 | 9 | class QMovie; 10 | class QDataWidgetMapper; 11 | class QLabel; 12 | 13 | namespace Ui { 14 | class BalanceFrame; 15 | } 16 | 17 | namespace WalletGUI { 18 | 19 | class WalletModel; 20 | class CopiedToolTip; 21 | 22 | class BalanceOverviewFrame : public QFrame 23 | { 24 | Q_OBJECT 25 | 26 | public: 27 | explicit BalanceOverviewFrame(QWidget *parent = 0); 28 | ~BalanceOverviewFrame(); 29 | 30 | void setWalletModel(WalletModel* walletModel); 31 | 32 | signals: 33 | void copiedToClipboardSignal(); 34 | 35 | private: 36 | void updateSyncState(); 37 | void balanceChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector& roles); 38 | virtual bool eventFilter(QObject* object, QEvent* event) override; 39 | 40 | void copySpendableBalance(); 41 | void copySpendableDustBalance(); 42 | void copyLockedOrUnconfirmedBalance(); 43 | void copyTotalBalance(); 44 | 45 | void copyBalanceString(QString&& balanceString); 46 | 47 | Ui::BalanceFrame *ui; 48 | 49 | WalletModel* walletModel_; 50 | QMovie* syncMovie_; 51 | CopiedToolTip* copiedToolTip_; 52 | bool isSynchronized_; 53 | QDataWidgetMapper* stateMapper_; 54 | QLabel* syncLabel_; 55 | }; 56 | 57 | } 58 | 59 | #endif // BALANCEFRAME_H 60 | -------------------------------------------------------------------------------- /src/bytecoinwallet.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF-8 3 | Name=Bytecoin Wallet 4 | Comment=Bytecoin wallet 5 | Exec=bytecoinwallet %U 6 | Terminal=false 7 | Type=Application 8 | Icon=bytecoin 9 | MimeType=x-scheme-handler/bytecoin; 10 | Categories=Office;Finance; 11 | -------------------------------------------------------------------------------- /src/bytecoinwallet.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON "images\bytecoin.ico" -------------------------------------------------------------------------------- /src/changepassworddialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | 6 | #include "changepassworddialog.h" 7 | #include "ui_changepassworddialog.h" 8 | 9 | namespace WalletGUI { 10 | 11 | ChangePasswordDialog::ChangePasswordDialog(bool askCurrentPassword, QWidget *parent) 12 | : QDialog(parent) 13 | , ui(new Ui::ChangePasswordDialog) 14 | , oldPassword_("") 15 | , newPassword_("") 16 | , confirmation_("") 17 | { 18 | ui->setupUi(this); 19 | 20 | ui->currPasswordLabel->setVisible(askCurrentPassword); 21 | ui->currPasswordEdit->setVisible(askCurrentPassword); 22 | adjustSize(); 23 | } 24 | 25 | ChangePasswordDialog::~ChangePasswordDialog() 26 | { 27 | oldPassword_.fill('0', 200); 28 | newPassword_.fill('0', 200); 29 | confirmation_.fill('0', 200); 30 | oldPassword_.clear(); 31 | newPassword_.clear(); 32 | confirmation_.clear(); 33 | 34 | delete ui; 35 | } 36 | 37 | void ChangePasswordDialog::passwordChanged(const QString& password) 38 | { 39 | newPassword_ = password; 40 | updateOkButton(); 41 | } 42 | 43 | void ChangePasswordDialog::confirmationChanged(const QString& confirmation) 44 | { 45 | confirmation_ = confirmation; 46 | updateOkButton(); 47 | } 48 | 49 | void ChangePasswordDialog::updateOkButton() 50 | { 51 | const bool ok = (newPassword_ == confirmation_); 52 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ok); 53 | } 54 | 55 | QString ChangePasswordDialog::getOldPassword() const 56 | { 57 | return ui->currPasswordEdit->text(); 58 | } 59 | 60 | QString ChangePasswordDialog::getNewPassword() const 61 | { 62 | return newPassword_; 63 | } 64 | 65 | } // namespace WalletGUI 66 | -------------------------------------------------------------------------------- /src/changepassworddialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef WALLETGUI_CHANGEPASSWORDDIALOG_H 5 | #define WALLETGUI_CHANGEPASSWORDDIALOG_H 6 | 7 | #include 8 | 9 | namespace Ui { 10 | class ChangePasswordDialog; 11 | } 12 | 13 | namespace WalletGUI { 14 | 15 | class ChangePasswordDialog : public QDialog 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | explicit ChangePasswordDialog(bool askCurrentPassword, QWidget *parent = 0); 21 | ~ChangePasswordDialog(); 22 | 23 | QString getOldPassword() const; 24 | QString getNewPassword() const; 25 | 26 | private slots: 27 | void passwordChanged(const QString& password); 28 | void confirmationChanged(const QString& confirmation); 29 | 30 | private: 31 | Ui::ChangePasswordDialog *ui; 32 | QString oldPassword_; 33 | QString newPassword_; // TODO: secure functions 34 | QString confirmation_; 35 | 36 | void updateOkButton(); 37 | }; 38 | 39 | } // namespace WalletGUI 40 | #endif // WALLETGUI_CHANGEPASSWORDDIALOG_H 41 | -------------------------------------------------------------------------------- /src/checkproofdialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "checkproofdialog.h" 9 | #include "ui_checkproofdialog.h" 10 | #include "common.h" 11 | 12 | namespace WalletGUI 13 | { 14 | 15 | CheckProofDialog::CheckProofDialog(QWidget *parent) 16 | : QDialog(parent) 17 | , ui(new Ui::CheckProofDialog) 18 | { 19 | ui->setupUi(this); 20 | clear(); 21 | } 22 | 23 | CheckProofDialog::~CheckProofDialog() 24 | { 25 | delete ui; 26 | } 27 | 28 | void CheckProofDialog::clear() 29 | { 30 | ui->messageLabel->clear(); 31 | ui->amountLabel->clear(); 32 | ui->addressLabel->clear(); 33 | ui->txHashLabel->clear(); 34 | } 35 | 36 | void CheckProofDialog::pasteFromClipboard() 37 | { 38 | ui->proofEdit->setPlainText(QApplication::clipboard()->text()); 39 | } 40 | 41 | void CheckProofDialog::proofChanged() 42 | { 43 | ui->resultLabel->setText(/*QString("%1").arg(*/tr("Ready to check"))/*)*/; 44 | 45 | clear(); 46 | 47 | // const QString proofString = ui->proofEdit->toPlainText(); 48 | // const QByteArray proofBytes = proofString.toLatin1(); 49 | 50 | // QJsonParseError parseError; 51 | // QJsonDocument jsonDocument = QJsonDocument::fromJson(proofBytes, &parseError); 52 | // if (parseError.error != QJsonParseError::NoError) 53 | // { 54 | // ui->resultLabel->setText(QString("%1").arg(tr("The entered text is not a valid JSON object"))); 55 | // return; 56 | // } 57 | 58 | // if (!jsonDocument.isObject()) 59 | // { 60 | // ui->resultLabel->setText(QString("%1").arg(tr("The entered text is not a valid JSON object"))); 61 | // return; 62 | // } 63 | // const QJsonObject json = jsonDocument.object(); 64 | // const RpcApi::Proof proof = RpcApi::Proof::fromJson(json.toVariantMap()); 65 | 66 | // ui->messageLabel->setText(proof.message); 67 | // ui->amountLabel->setText(formatAmount(proof.amount) + " BCN"); 68 | // ui->addressLabel->setText(proof.address); 69 | // ui->txHashLabel->setText(proof.transaction_hash); 70 | } 71 | 72 | void CheckProofDialog::checkProof() 73 | { 74 | emit checkProofSignal(ui->proofEdit->toPlainText()); 75 | } 76 | 77 | void CheckProofDialog::showCheckResult(const RpcApi::ProofCheck& result) 78 | { 79 | if (!result.validation_error.isEmpty()) 80 | ui->resultLabel->setText(QString("%1").arg(result.validation_error)); 81 | else 82 | { 83 | ui->resultLabel->setText(QString("%1").arg(tr("The proof is correct!"))); 84 | ui->messageLabel->setText(result.message); 85 | ui->amountLabel->setText(formatAmount(result.amount)); 86 | ui->addressLabel->setText(result.address); 87 | ui->txHashLabel->setText(result.transaction_hash); 88 | } 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/checkproofdialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef CHECKPROOFDIALOG_H 5 | #define CHECKPROOFDIALOG_H 6 | 7 | #include 8 | #include "rpcapi.h" 9 | 10 | namespace Ui { 11 | class CheckProofDialog; 12 | } 13 | 14 | namespace WalletGUI 15 | { 16 | 17 | class CheckProofDialog : public QDialog 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit CheckProofDialog(QWidget *parent = 0); 23 | ~CheckProofDialog(); 24 | 25 | public slots: 26 | void showCheckResult(const RpcApi::ProofCheck& result); 27 | 28 | signals: 29 | void checkProofSignal(const QString& proof); 30 | 31 | private: 32 | Ui::CheckProofDialog *ui; 33 | 34 | void clear(); 35 | 36 | private slots: 37 | void pasteFromClipboard(); 38 | void proofChanged(); 39 | void checkProof(); 40 | 41 | }; 42 | 43 | } 44 | 45 | #endif // CHECKPROOFDIALOG_H 46 | -------------------------------------------------------------------------------- /src/common.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef COMMON_H 5 | #define COMMON_H 6 | 7 | #include 8 | #include 9 | 10 | class QUrl; 11 | class QWidget; 12 | 13 | constexpr const char CURRENCY_TICKER[] = "BCN"; 14 | //constexpr const uint64_t MAXIMUM_UNSYNCED_BLOCKS_WHEN_SEND_AVAILABLE = 5; 15 | constexpr const uint64_t COIN = 100000000; 16 | constexpr const uint32_t CONFIRMATIONS = 5; 17 | constexpr const int NUMBER_OF_DECIMAL_PLACES = 8; 18 | constexpr const int64_t DEFAULT_MIXIN_VALUE = 6; 19 | constexpr const int64_t MAX_MIXIN_VALUE = 1000; 20 | constexpr const int64_t CRITICAL_MIXIN_BOUND = 3; 21 | constexpr const int64_t NORMAL_MIXIN_BOUND = 6; 22 | constexpr const uint16_t RPC_DEFAULT_PORT = 8070; 23 | 24 | constexpr const uint64_t DIFFICULTY_TARGET = 120; // seconds 25 | constexpr const uint64_t CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS = 1; 26 | constexpr const uint64_t CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS = DIFFICULTY_TARGET * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS; 27 | constexpr const uint32_t CRYPTONOTE_MAX_BLOCK_NUMBER = 500000000; 28 | 29 | namespace WalletGUI 30 | { 31 | 32 | constexpr const char MAIN_NET_COLOR[] = "#EE4486"; 33 | constexpr const char STAGE_NET_COLOR[] = "#44EE86"; 34 | constexpr const char TEST_NET_COLOR[] = "#8644EE"; 35 | 36 | bool isTransactionSpendTimeUnlocked(uint64_t unlockTime, uint32_t blockIndex, uint64_t blockTimestampMedian); 37 | QString formatUnsignedAmount(quint64 amount, bool trim = true); 38 | QString formatAmount(qint64 amount); 39 | QString formatHashRate(quint64 hashRate); 40 | //quint64 convertAmountFromHumanReadable(double amount); 41 | bool parseAmount(const QString& str, qint64& amount); 42 | 43 | bool isIpOrHostName(const QString& string); 44 | 45 | QString rpcUrlToString(const QUrl& url); 46 | 47 | QString formatTimeDiff(quint64 timeDiff); 48 | 49 | void scaleWidgetText(QWidget* w, int scale); 50 | 51 | } 52 | 53 | #endif // COMMON_H 54 | 55 | -------------------------------------------------------------------------------- /src/connectionoptionsframe.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace Ui { 9 | class ConnectionOptionsFrame; 10 | } 11 | 12 | namespace WalletGUI 13 | { 14 | 15 | enum class NodeType 16 | { 17 | UNKNOWN, IN_PROCESS, RPC 18 | }; 19 | 20 | class ConnectionOptionsFrame : public QFrame 21 | { 22 | Q_OBJECT 23 | Q_DISABLE_COPY(ConnectionOptionsFrame) 24 | 25 | public: 26 | explicit ConnectionOptionsFrame(QWidget* parent = nullptr); 27 | ~ConnectionOptionsFrame(); 28 | 29 | void load(); 30 | void save(); 31 | bool canAccept() const; 32 | 33 | private: 34 | QScopedPointer m_ui; 35 | 36 | Q_SLOT bool remoteHostNameChanged(const QString& host); 37 | Q_SLOT bool walletFileNameChanged(const QString& wallet); 38 | Q_SLOT void connectionButtonClicked(int buttonId); 39 | Q_SLOT void showOpenWalletFileDialog(); 40 | Q_SLOT void showCreateWalletFileDialog(); 41 | 42 | Q_SIGNALS: 43 | void showRestartWarningSignal(bool show); 44 | void disableAcceptButtonSignal(bool disable); 45 | }; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/connectselectiondialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | 6 | #include "connectselectiondialog.h" 7 | #include "ui_connectselectiondialog.h" 8 | 9 | namespace WalletGUI 10 | { 11 | 12 | ConnectSelectionDialog::ConnectSelectionDialog(QWidget *parent) : 13 | QDialog(parent), 14 | ui(new Ui::ConnectSelectionDialog) 15 | { 16 | ui->setupUi(this); 17 | ui->buttonBox->button(QDialogButtonBox::Ok)-> setEnabled(false); 18 | connect(ui->m_connectionOptionsFrame, &ConnectionOptionsFrame::disableAcceptButtonSignal, 19 | [this](bool disable) 20 | { 21 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!disable); 22 | }); 23 | ui->m_connectionOptionsFrame->load(); 24 | } 25 | 26 | ConnectSelectionDialog::~ConnectSelectionDialog() 27 | { 28 | delete ui; 29 | } 30 | 31 | void ConnectSelectionDialog::accept() 32 | { 33 | ui->m_connectionOptionsFrame->save(); 34 | QDialog::accept(); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/connectselectiondialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef CONNECTSELECTIONDIALOG_H 5 | #define CONNECTSELECTIONDIALOG_H 6 | 7 | #include 8 | 9 | namespace Ui { 10 | class ConnectSelectionDialog; 11 | } 12 | 13 | namespace WalletGUI 14 | { 15 | 16 | class ConnectSelectionDialog : public QDialog 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | explicit ConnectSelectionDialog(QWidget *parent = 0); 22 | ~ConnectSelectionDialog(); 23 | 24 | Q_SLOT void accept() override; 25 | 26 | private: 27 | Ui::ConnectSelectionDialog *ui; 28 | }; 29 | 30 | } 31 | 32 | #endif // CONNECTSELECTIONDIALOG_H 33 | -------------------------------------------------------------------------------- /src/connectselectiondialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ConnectSelectionDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 410 10 | 182 11 | 12 | 13 | 14 | Dialog 15 | 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 0 23 | 24 | 25 | 26 | Please specify walletd address 27 | 28 | 29 | Qt::AlignCenter 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | Qt::Horizontal 40 | 41 | 42 | QDialogButtonBox::Close|QDialogButtonBox::Ok 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | WalletGUI::ConnectionOptionsFrame 51 | QWidget 52 |
connectionoptionsframe.h
53 | 1 54 |
55 |
56 | 57 | 58 | 59 | buttonBox 60 | accepted() 61 | ConnectSelectionDialog 62 | accept() 63 | 64 | 65 | 248 66 | 254 67 | 68 | 69 | 157 70 | 274 71 | 72 | 73 | 74 | 75 | buttonBox 76 | rejected() 77 | ConnectSelectionDialog 78 | reject() 79 | 80 | 81 | 316 82 | 260 83 | 84 | 85 | 286 86 | 274 87 | 88 | 89 | 90 | 91 |
92 | -------------------------------------------------------------------------------- /src/crashdialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include "crashdialog.h" 5 | #include "ui_crashdialog.h" 6 | #include "mainwindow.h" 7 | 8 | namespace WalletGUI { 9 | 10 | CrashDialog::CrashDialog(QWidget *parent) 11 | : QDialog(parent) 12 | , ui(new Ui::CrashDialog) 13 | , mainWindow_(nullptr) 14 | { 15 | ui->setupUi(this); 16 | } 17 | 18 | CrashDialog::~CrashDialog() 19 | { 20 | delete ui; 21 | } 22 | 23 | void CrashDialog::enablePasswordEdit(bool enable) 24 | { 25 | ui->passwordLabel->setVisible(enable); 26 | ui->passwordLineEdit->setVisible(enable); 27 | ui->passwordLineEdit->setText(""); 28 | } 29 | 30 | int CrashDialog::execWithReason(const QString& reason, bool enablePassword) 31 | { 32 | enablePasswordEdit(enablePassword); 33 | ui->reasonLabel->setText(reason); 34 | return QDialog::exec(); 35 | } 36 | 37 | QString CrashDialog::getPassword() const 38 | { 39 | return ui->passwordLineEdit->text(); 40 | } 41 | 42 | void CrashDialog::showDaemonConsole() 43 | { 44 | if (mainWindow_) 45 | mainWindow_->showLog(); 46 | } 47 | 48 | void CrashDialog::setMainWindow(MainWindow* mainWindow) 49 | { 50 | mainWindow_ = mainWindow; 51 | } 52 | 53 | } // namespace WalletGUI 54 | -------------------------------------------------------------------------------- /src/crashdialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef WALLETGUI_CRASHDIALOG_H 5 | #define WALLETGUI_CRASHDIALOG_H 6 | 7 | #include 8 | 9 | namespace Ui { 10 | class CrashDialog; 11 | } 12 | 13 | namespace WalletGUI { 14 | 15 | class MainWindow; 16 | 17 | class CrashDialog : public QDialog 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit CrashDialog(QWidget *parent = 0); 23 | ~CrashDialog(); 24 | 25 | void setMainWindow(MainWindow* mainWindow); 26 | int execWithReason(const QString& reason, bool enablePassword); 27 | QString getPassword() const; 28 | 29 | public slots: 30 | void showDaemonConsole(); 31 | 32 | private: 33 | void enablePasswordEdit(bool enable); 34 | 35 | Ui::CrashDialog *ui; 36 | MainWindow* mainWindow_; 37 | }; 38 | 39 | 40 | } // namespace WalletGUI 41 | #endif // WALLETGUI_CRASHDIALOG_H 42 | -------------------------------------------------------------------------------- /src/crashdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | CrashDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 348 10 | 144 11 | 12 | 13 | 14 | 15 | 16 | 17 | Qt::Vertical 18 | 19 | 20 | 21 | 20 22 | 40 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | Reason 31 | 32 | 33 | true 34 | 35 | 36 | 37 | 38 | 39 | 40 | Qt::Vertical 41 | 42 | 43 | 44 | 20 45 | 40 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | Password: 54 | 55 | 56 | 57 | 58 | 59 | 60 | QLineEdit::Password 61 | 62 | 63 | 64 | 65 | 66 | 67 | Qt::Vertical 68 | 69 | 70 | 71 | 20 72 | 40 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | Qt::Horizontal 83 | 84 | 85 | QDialogButtonBox::Cancel|QDialogButtonBox::Retry 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | buttonBox 97 | accepted() 98 | CrashDialog 99 | accept() 100 | 101 | 102 | 248 103 | 254 104 | 105 | 106 | 157 107 | 274 108 | 109 | 110 | 111 | 112 | buttonBox 113 | rejected() 114 | CrashDialog 115 | reject() 116 | 117 | 118 | 316 119 | 260 120 | 121 | 122 | 286 123 | 274 124 | 125 | 126 | 127 | 128 | 129 | showDaemonConsole() 130 | 131 | 132 | -------------------------------------------------------------------------------- /src/createproofdialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "createproofdialog.h" 9 | #include "ui_createproofdialog.h" 10 | 11 | namespace WalletGUI 12 | { 13 | 14 | CreateProofDialog::CreateProofDialog(const QString& txHash, const QStringList& addresses, QWidget *parent) 15 | : QDialog(parent) 16 | , ui(new Ui::CreateProofDialog) 17 | , txHash_(txHash) 18 | { 19 | ui->setupUi(this); 20 | ui->addressesBox->addItems(addresses); 21 | // showElements(false); 22 | // adjustSize(); 23 | // ui->verticalLayout->update(); 24 | } 25 | 26 | CreateProofDialog::~CreateProofDialog() 27 | { 28 | delete ui; 29 | } 30 | 31 | //void CreateProofDialog::showElements(bool show) 32 | //{ 33 | //// ui->addressLabel->setVisible(show); 34 | //// ui->addressesBox->setVisible(show); 35 | // ui->proofLabel->setVisible(show); 36 | // ui->proofEdit->setVisible(show); 37 | // ui->copyButton->setVisible(show); 38 | //} 39 | 40 | //QString CreateProofDialog::extractAddress(const QString& proof) 41 | //{ 42 | // static constexpr char ADDRESS_KEY[] = "address"; 43 | 44 | // QJsonParseError parseError; 45 | // QJsonDocument jsonDocument = QJsonDocument::fromJson(proof.toLatin1(), &parseError); 46 | // if (parseError.error != QJsonParseError::NoError) 47 | // { 48 | // ui->proofEdit->setTextColor(Qt::red); 49 | // ui->proofEdit->setText(parseError.errorString()); 50 | // return QString{}; 51 | // } 52 | 53 | // if (!jsonDocument.isObject()) 54 | // { 55 | // ui->proofEdit->setTextColor(Qt::red); 56 | // ui->proofEdit->setText(tr("JSON document is not an object.")); 57 | // return QString{}; 58 | // } 59 | // const QJsonObject json = jsonDocument.object(); 60 | // const bool containsAddress = json.contains(ADDRESS_KEY); 61 | // if (!containsAddress) 62 | // { 63 | // ui->proofEdit->setTextColor(Qt::red); 64 | // ui->proofEdit->setText(tr("The proof does not contain any address.")); 65 | // return QString{}; 66 | // } 67 | // return json[ADDRESS_KEY].toString(); 68 | //} 69 | 70 | void CreateProofDialog::addProofs(const QStringList& proofs) 71 | { 72 | ui->proofEdit->clear(); 73 | // ui->addressesBox->clear(); 74 | proofs_.clear(); 75 | // showElements(true); 76 | 77 | if (proofs.isEmpty()) 78 | { 79 | ui->proofEdit->setTextColor(Qt::red); 80 | ui->proofEdit->setText(tr("No proofs were generated.")); 81 | return; 82 | } 83 | 84 | if (proofs.size() > 1) 85 | { 86 | ui->proofEdit->setTextColor(Qt::red); 87 | ui->proofEdit->setText(tr("Several proofs were generated.")); 88 | return; 89 | } 90 | 91 | // for (int i = 0; i < proofs.size(); ++i) 92 | // { 93 | // const QString address = extractAddress(proofs[i]); 94 | // if (address.isEmpty()) 95 | // continue; 96 | // proofs_.insert(i, proofs[i]); 97 | // ui->addressesBox->addItem(address); 98 | // } 99 | const int index = ui->addressesBox->currentIndex(); 100 | proofs_.insert(index, proofs.front()); 101 | ui->proofEdit->setText(proofs.front()); 102 | } 103 | 104 | void CreateProofDialog::generateProof() 105 | { 106 | emit generateProofSignal(txHash_, ui->addressesBox->currentText(), ui->messageEdit->text()); 107 | } 108 | 109 | void CreateProofDialog::copyToClipboard() 110 | { 111 | QApplication::clipboard()->setText(ui->proofEdit->toPlainText()); 112 | } 113 | 114 | void CreateProofDialog::addressChanged(int index) 115 | { 116 | ui->proofEdit->setText(proofs_[index]); 117 | } 118 | 119 | void CreateProofDialog::currentAddressChanged() 120 | { 121 | ui->proofEdit->setText(proofs_[ui->addressesBox->currentIndex()]); 122 | } 123 | 124 | } 125 | -------------------------------------------------------------------------------- /src/createproofdialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef CREATEPROOFDIALOG_H 5 | #define CREATEPROOFDIALOG_H 6 | 7 | #include 8 | #include 9 | 10 | namespace Ui { 11 | class CreateProofDialog; 12 | } 13 | 14 | namespace WalletGUI 15 | { 16 | 17 | class CreateProofDialog : public QDialog 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit CreateProofDialog(const QString& txHash, const QStringList& addresses, QWidget *parent = 0); 23 | ~CreateProofDialog(); 24 | 25 | public slots: 26 | void addProofs(const QStringList& proofs); 27 | void copyToClipboard(); 28 | void addressChanged(int index); 29 | void currentAddressChanged(); 30 | 31 | signals: 32 | void generateProofSignal(const QString& txHash, const QString& address, const QString& message); 33 | 34 | private slots: 35 | void generateProof(); 36 | 37 | private: 38 | Ui::CreateProofDialog *ui; 39 | QString txHash_; 40 | QMap proofs_; 41 | 42 | // QString extractAddress(const QString& proof); 43 | // void showElements(bool show); 44 | }; 45 | 46 | } 47 | 48 | #endif // CREATEPROOFDIALOG_H 49 | -------------------------------------------------------------------------------- /src/elidedlabel.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "elidedlabel.h" 5 | 6 | namespace WalletGUI { 7 | 8 | void ElidedLabel::setElideMode(Qt::TextElideMode elideMode) 9 | { 10 | m_elideMode = elideMode; 11 | m_cachedText.clear(); 12 | update(); 13 | } 14 | 15 | void ElidedLabel::resizeEvent(QResizeEvent *e) 16 | { 17 | QLabel::resizeEvent(e); 18 | m_cachedText.clear(); 19 | } 20 | 21 | void ElidedLabel::paintEvent(QPaintEvent *e) 22 | { 23 | if (m_elideMode == Qt::ElideNone) 24 | return QLabel::paintEvent(e); 25 | 26 | updateCachedTexts(); 27 | QLabel::setText(m_cachedElidedText); 28 | QLabel::paintEvent(e); 29 | QLabel::setText(m_cachedText); 30 | } 31 | 32 | void ElidedLabel::updateCachedTexts() 33 | { 34 | const auto txt = text(); 35 | if (m_cachedText == txt) 36 | return; 37 | m_cachedText = txt; 38 | const QFontMetrics fm(fontMetrics()); 39 | m_cachedElidedText = fm.elidedText(text(), m_elideMode, width(), Qt::TextShowMnemonic); 40 | // make sure to show at least the first character 41 | if (!m_cachedText.isEmpty()) 42 | { 43 | const QString showFirstCharacter = m_cachedText.at(0) + QStringLiteral("..."); 44 | setMinimumWidth(fm.width(showFirstCharacter) + 1); 45 | } 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/elidedlabel.h: -------------------------------------------------------------------------------- 1 | #ifndef ELLIDEDLABEL_H 2 | #define ELLIDEDLABEL_H 3 | 4 | #include 5 | 6 | namespace WalletGUI { 7 | 8 | class ElidedLabel : public QLabel 9 | { 10 | Q_OBJECT 11 | public: 12 | using QLabel::QLabel; 13 | void setElideMode(Qt::TextElideMode elideMode); 14 | Qt::TextElideMode elideMode() const { return m_elideMode; } 15 | 16 | protected: 17 | void paintEvent(QPaintEvent *e) override; 18 | void resizeEvent(QResizeEvent *e) override; 19 | 20 | private: 21 | void updateCachedTexts(); 22 | 23 | private: 24 | Qt::TextElideMode m_elideMode = Qt::ElideMiddle; 25 | QString m_cachedElidedText; 26 | QString m_cachedText; 27 | }; 28 | 29 | } 30 | 31 | #endif // ELLIDEDLABEL_H 32 | -------------------------------------------------------------------------------- /src/exportkeydialog.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "exportkeydialog.h" 5 | #include "ui_exportkeydialog.h" 6 | 7 | namespace WalletGUI 8 | { 9 | 10 | ExportKeyDialog::ExportKeyDialog(const QString& key, QWidget *parent) 11 | : QDialog(parent) 12 | , ui(new Ui::ExportKeyDialog) 13 | { 14 | ui->setupUi(this); 15 | ui->keyEdit->setPlainText(key); 16 | if (key.contains(' ')) 17 | { 18 | ui->saveButton->setEnabled(false); 19 | ui->saveButton->setVisible(false); 20 | } 21 | } 22 | 23 | ExportKeyDialog::~ExportKeyDialog() 24 | { 25 | ui->keyEdit->setText(QString{1000, '0'}); 26 | ui->keyEdit->clear(); 27 | delete ui; 28 | } 29 | 30 | void ExportKeyDialog::saveKey() 31 | { 32 | const QString filePath = 33 | QFileDialog::getSaveFileName( 34 | this, 35 | tr("Save key to..."), 36 | QDir::homePath(), 37 | tr("Key file (*)")); 38 | 39 | if (filePath.isEmpty()) 40 | return; 41 | 42 | QFile keyFile(filePath); 43 | if (!keyFile.open(QIODevice::WriteOnly)) 44 | { 45 | QMessageBox::critical(this, tr("Error"), tr("Failed to save key to the selected file.")); 46 | return; 47 | } 48 | 49 | keyFile.write(QByteArray::fromHex(ui->keyEdit->toPlainText().toUtf8())); 50 | keyFile.close(); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/exportkeydialog.h: -------------------------------------------------------------------------------- 1 | #ifndef EXPORTKEYDIALOG_H 2 | #define EXPORTKEYDIALOG_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class ExportKeyDialog; 8 | } 9 | 10 | namespace WalletGUI 11 | { 12 | 13 | class ExportKeyDialog : public QDialog 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit ExportKeyDialog(const QString& key, QWidget *parent = 0); 19 | ~ExportKeyDialog(); 20 | 21 | public slots: 22 | void saveKey(); 23 | 24 | private: 25 | Ui::ExportKeyDialog *ui; 26 | }; 27 | 28 | } 29 | 30 | #endif // EXPORTKEYDIALOG_H 31 | -------------------------------------------------------------------------------- /src/exportkeydialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ExportKeyDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 366 10 | 133 11 | 12 | 13 | 14 | Export keys 15 | 16 | 17 | 18 | 19 | 20 | true 21 | 22 | 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Save to file 33 | 34 | 35 | 36 | 37 | 38 | 39 | Qt::Horizontal 40 | 41 | 42 | 43 | 40 44 | 20 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | Qt::Horizontal 53 | 54 | 55 | QDialogButtonBox::Ok 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | buttonBox 67 | accepted() 68 | ExportKeyDialog 69 | accept() 70 | 71 | 72 | 248 73 | 254 74 | 75 | 76 | 157 77 | 274 78 | 79 | 80 | 81 | 82 | buttonBox 83 | rejected() 84 | ExportKeyDialog 85 | reject() 86 | 87 | 88 | 316 89 | 260 90 | 91 | 92 | 286 93 | 274 94 | 95 | 96 | 97 | 98 | saveButton 99 | clicked() 100 | ExportKeyDialog 101 | saveKey() 102 | 103 | 104 | 49 105 | 110 106 | 107 | 108 | 182 109 | 66 110 | 111 | 112 | 113 | 114 | 115 | saveKey() 116 | copyToClipboard() 117 | 118 | 119 | -------------------------------------------------------------------------------- /src/filedownloader.cpp: -------------------------------------------------------------------------------- 1 | #include "filedownloader.h" 2 | 3 | namespace WalletGUI { 4 | 5 | FileDownloader::FileDownloader(QObject *parent) 6 | : QObject(parent) 7 | { 8 | connect(&netManager_, &QNetworkAccessManager::finished, this, &FileDownloader::fileDownloaded); 9 | } 10 | 11 | FileDownloader::~FileDownloader() 12 | {} 13 | 14 | void FileDownloader::download(QUrl fileUrl) 15 | { 16 | QNetworkRequest request(fileUrl); 17 | netManager_.get(request); 18 | } 19 | 20 | void FileDownloader::fileDownloaded(QNetworkReply* reply) 21 | { 22 | data_ = reply->readAll(); 23 | reply->deleteLater(); 24 | emit downloaded(); 25 | } 26 | 27 | QByteArray FileDownloader::downloadedData() const 28 | { 29 | return data_; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/filedownloader.h: -------------------------------------------------------------------------------- 1 | #ifndef FILEDOWNLOADER_H 2 | #define FILEDOWNLOADER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace WalletGUI { 11 | 12 | class FileDownloader : public QObject 13 | { 14 | Q_OBJECT 15 | public: 16 | explicit FileDownloader(QObject *parent = 0); 17 | virtual ~FileDownloader(); 18 | QByteArray downloadedData() const; 19 | 20 | signals: 21 | void downloaded(); 22 | 23 | public slots: 24 | void download(QUrl fileUrl); 25 | 26 | private slots: 27 | void fileDownloaded(QNetworkReply* reply); 28 | 29 | private: 30 | QNetworkAccessManager netManager_; 31 | QByteArray data_; 32 | }; 33 | 34 | } 35 | 36 | #endif // FILEDOWNLOADER_H 37 | -------------------------------------------------------------------------------- /src/font/OpenSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/OpenSans-Bold.ttf -------------------------------------------------------------------------------- /src/font/OpenSans-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/OpenSans-BoldItalic.ttf -------------------------------------------------------------------------------- /src/font/OpenSans-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/OpenSans-ExtraBold.ttf -------------------------------------------------------------------------------- /src/font/OpenSans-ExtraBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/OpenSans-ExtraBoldItalic.ttf -------------------------------------------------------------------------------- /src/font/OpenSans-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/OpenSans-Italic.ttf -------------------------------------------------------------------------------- /src/font/OpenSans-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/OpenSans-Light.ttf -------------------------------------------------------------------------------- /src/font/OpenSans-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/OpenSans-LightItalic.ttf -------------------------------------------------------------------------------- /src/font/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /src/font/OpenSans-Semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/OpenSans-Semibold.ttf -------------------------------------------------------------------------------- /src/font/OpenSans-SemiboldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/OpenSans-SemiboldItalic.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-Black.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-BlackItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-BlackItalic.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-Bold.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-BoldItalic.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-ExtraBold.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-ExtraBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-ExtraBoldItalic.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-ExtraLight.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-ExtraLightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-ExtraLightItalic.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-Italic.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-Light.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-LightItalic.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-Medium.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-MediumItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-MediumItalic.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-Regular.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-SemiBold.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-SemiBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-SemiBoldItalic.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-Thin.ttf -------------------------------------------------------------------------------- /src/font/WorkSans-ThinItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/font/WorkSans-ThinItalic.ttf -------------------------------------------------------------------------------- /src/icons/actual_balance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/actual_balance.png -------------------------------------------------------------------------------- /src/icons/address_book.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/address_book.png -------------------------------------------------------------------------------- /src/icons/address_book_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/address_book_bl.png -------------------------------------------------------------------------------- /src/icons/address_book_bl_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/address_book_bl_disabled.png -------------------------------------------------------------------------------- /src/icons/arrow_circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/arrow_circle.png -------------------------------------------------------------------------------- /src/icons/arrow_circle_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/arrow_circle_hover.png -------------------------------------------------------------------------------- /src/icons/arrow_circle_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/arrow_circle_up.png -------------------------------------------------------------------------------- /src/icons/arrow_circle_up_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/arrow_circle_up_hover.png -------------------------------------------------------------------------------- /src/icons/arrow_left_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/arrow_left_black.png -------------------------------------------------------------------------------- /src/icons/arrow_right_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/arrow_right_black.png -------------------------------------------------------------------------------- /src/icons/balance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/balance.png -------------------------------------------------------------------------------- /src/icons/balance_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/balance_bl.png -------------------------------------------------------------------------------- /src/icons/balance_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/balance_new.png -------------------------------------------------------------------------------- /src/icons/big_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/big_arrow.png -------------------------------------------------------------------------------- /src/icons/big_arrow_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/big_arrow_black.png -------------------------------------------------------------------------------- /src/icons/block_explorer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/block_explorer.png -------------------------------------------------------------------------------- /src/icons/block_explorer_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/block_explorer_bl.png -------------------------------------------------------------------------------- /src/icons/block_explorer_bl_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/block_explorer_bl_disabled.png -------------------------------------------------------------------------------- /src/icons/blog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/blog.png -------------------------------------------------------------------------------- /src/icons/connected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/connected.png -------------------------------------------------------------------------------- /src/icons/connected_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/connected_bl.png -------------------------------------------------------------------------------- /src/icons/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/copy.png -------------------------------------------------------------------------------- /src/icons/delete_pool.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/delete_pool.png -------------------------------------------------------------------------------- /src/icons/delete_pool_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/delete_pool_hover.png -------------------------------------------------------------------------------- /src/icons/disconnected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/disconnected.png -------------------------------------------------------------------------------- /src/icons/disconnected_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/disconnected_bl.png -------------------------------------------------------------------------------- /src/icons/donation_address.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/donation_address.png -------------------------------------------------------------------------------- /src/icons/donation_address_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/donation_address_small.png -------------------------------------------------------------------------------- /src/icons/donation_clock1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/donation_clock1.png -------------------------------------------------------------------------------- /src/icons/donation_clock2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/donation_clock2.png -------------------------------------------------------------------------------- /src/icons/donation_clock3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/donation_clock3.png -------------------------------------------------------------------------------- /src/icons/donation_clock4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/donation_clock4.png -------------------------------------------------------------------------------- /src/icons/donation_clock5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/donation_clock5.png -------------------------------------------------------------------------------- /src/icons/donation_confirmed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/donation_confirmed.png -------------------------------------------------------------------------------- /src/icons/donation_unconfirmed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/donation_unconfirmed.png -------------------------------------------------------------------------------- /src/icons/down-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/down-arrow.png -------------------------------------------------------------------------------- /src/icons/inp_clock1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/inp_clock1.png -------------------------------------------------------------------------------- /src/icons/inp_clock2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/inp_clock2.png -------------------------------------------------------------------------------- /src/icons/inp_clock3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/inp_clock3.png -------------------------------------------------------------------------------- /src/icons/inp_clock4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/inp_clock4.png -------------------------------------------------------------------------------- /src/icons/inp_clock5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/inp_clock5.png -------------------------------------------------------------------------------- /src/icons/inp_confirmed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/inp_confirmed.png -------------------------------------------------------------------------------- /src/icons/inp_unconfirmed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/inp_unconfirmed.png -------------------------------------------------------------------------------- /src/icons/lock_closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/lock_closed.png -------------------------------------------------------------------------------- /src/icons/lock_closed_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/lock_closed_bl.png -------------------------------------------------------------------------------- /src/icons/lock_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/lock_open.png -------------------------------------------------------------------------------- /src/icons/lock_open_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/lock_open_bl.png -------------------------------------------------------------------------------- /src/icons/lock_open_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/lock_open_gray.png -------------------------------------------------------------------------------- /src/icons/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/logo.png -------------------------------------------------------------------------------- /src/icons/logo_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/logo_bl.png -------------------------------------------------------------------------------- /src/icons/logo_stage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/logo_stage.png -------------------------------------------------------------------------------- /src/icons/logo_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/logo_test.png -------------------------------------------------------------------------------- /src/icons/mined_clock1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/mined_clock1.png -------------------------------------------------------------------------------- /src/icons/mined_clock2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/mined_clock2.png -------------------------------------------------------------------------------- /src/icons/mined_clock3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/mined_clock3.png -------------------------------------------------------------------------------- /src/icons/mined_clock4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/mined_clock4.png -------------------------------------------------------------------------------- /src/icons/mined_clock5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/mined_clock5.png -------------------------------------------------------------------------------- /src/icons/mined_confirmed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/mined_confirmed.png -------------------------------------------------------------------------------- /src/icons/miner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/miner.png -------------------------------------------------------------------------------- /src/icons/miner_big.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/miner_big.png -------------------------------------------------------------------------------- /src/icons/miner_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/miner_bl.png -------------------------------------------------------------------------------- /src/icons/miner_bl_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/miner_bl_disabled.png -------------------------------------------------------------------------------- /src/icons/mining.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/mining.png -------------------------------------------------------------------------------- /src/icons/not_synced.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/not_synced.png -------------------------------------------------------------------------------- /src/icons/opt_confirmed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/opt_confirmed.png -------------------------------------------------------------------------------- /src/icons/out_clock1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/out_clock1.png -------------------------------------------------------------------------------- /src/icons/out_clock2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/out_clock2.png -------------------------------------------------------------------------------- /src/icons/out_clock3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/out_clock3.png -------------------------------------------------------------------------------- /src/icons/out_clock4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/out_clock4.png -------------------------------------------------------------------------------- /src/icons/out_clock5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/out_clock5.png -------------------------------------------------------------------------------- /src/icons/out_confirmed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/out_confirmed.png -------------------------------------------------------------------------------- /src/icons/out_failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/out_failed.png -------------------------------------------------------------------------------- /src/icons/out_unconfirmed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/out_unconfirmed.png -------------------------------------------------------------------------------- /src/icons/overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/overview.png -------------------------------------------------------------------------------- /src/icons/overview_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/overview_bl.png -------------------------------------------------------------------------------- /src/icons/overview_bl_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/overview_bl_disabled.png -------------------------------------------------------------------------------- /src/icons/pending_balance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/pending_balance.png -------------------------------------------------------------------------------- /src/icons/pool_stats.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/pool_stats.png -------------------------------------------------------------------------------- /src/icons/scroll_news_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/scroll_news_down.png -------------------------------------------------------------------------------- /src/icons/scroll_news_down_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/scroll_news_down_hover.png -------------------------------------------------------------------------------- /src/icons/scroll_news_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/scroll_news_up.png -------------------------------------------------------------------------------- /src/icons/scroll_news_up_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/scroll_news_up_hover.png -------------------------------------------------------------------------------- /src/icons/send.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/send.png -------------------------------------------------------------------------------- /src/icons/send_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/send_bl.png -------------------------------------------------------------------------------- /src/icons/send_bl_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/send_bl_disabled.png -------------------------------------------------------------------------------- /src/icons/slider_handle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/slider_handle.png -------------------------------------------------------------------------------- /src/icons/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/start.png -------------------------------------------------------------------------------- /src/icons/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/stop.png -------------------------------------------------------------------------------- /src/icons/sync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/sync.png -------------------------------------------------------------------------------- /src/icons/sync_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/sync_bl.png -------------------------------------------------------------------------------- /src/icons/sync_lag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/sync_lag.png -------------------------------------------------------------------------------- /src/icons/sync_sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/sync_sprite.png -------------------------------------------------------------------------------- /src/icons/sync_sprite_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/sync_sprite_bl.png -------------------------------------------------------------------------------- /src/icons/synced.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/synced.png -------------------------------------------------------------------------------- /src/icons/synced_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/synced_bl.png -------------------------------------------------------------------------------- /src/icons/total_balance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/total_balance.png -------------------------------------------------------------------------------- /src/icons/transactions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/transactions.png -------------------------------------------------------------------------------- /src/icons/transactions_bl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/transactions_bl.png -------------------------------------------------------------------------------- /src/icons/transactions_bl_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/transactions_bl_disabled.png -------------------------------------------------------------------------------- /src/icons/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/twitter.png -------------------------------------------------------------------------------- /src/icons/up-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/up-arrow.png -------------------------------------------------------------------------------- /src/icons/up_big_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/up_big_arrow.png -------------------------------------------------------------------------------- /src/icons/up_big_arrow_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/up_big_arrow_black.png -------------------------------------------------------------------------------- /src/icons/wallet_sync.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/wallet_sync.gif -------------------------------------------------------------------------------- /src/icons/wallet_sync_dark.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/icons/wallet_sync_dark.gif -------------------------------------------------------------------------------- /src/images/add_address_helper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/images/add_address_helper.png -------------------------------------------------------------------------------- /src/images/bytecoin.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/images/bytecoin.icns -------------------------------------------------------------------------------- /src/images/bytecoin.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/images/bytecoin.ico -------------------------------------------------------------------------------- /src/images/bytecoin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/images/bytecoin.png -------------------------------------------------------------------------------- /src/images/bytecoin_stage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/images/bytecoin_stage.png -------------------------------------------------------------------------------- /src/images/bytecoin_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/images/bytecoin_test.png -------------------------------------------------------------------------------- /src/images/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bcndev/bytecoin-gui/da3795cd14d8b16332fdff9e3f2f81a432228e78/src/images/splash.png -------------------------------------------------------------------------------- /src/importkeydialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | #include 6 | 7 | #include "importkeydialog.h" 8 | #include "ui_importkeydialog.h" 9 | 10 | namespace WalletGUI 11 | { 12 | 13 | ImportKeyDialog::ImportKeyDialog(QWidget *parent) 14 | : QDialog(parent) 15 | , ui(new Ui::ImportKeyDialog) 16 | { 17 | ui->setupUi(this); 18 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); 19 | } 20 | 21 | ImportKeyDialog::~ImportKeyDialog() 22 | { 23 | ui->keyEdit->setText(QString{1000, '0'}); 24 | ui->keyEdit->clear(); 25 | delete ui; 26 | } 27 | 28 | QByteArray ImportKeyDialog::getKey() const 29 | { 30 | return QByteArray::fromHex(ui->keyEdit->toPlainText().toUtf8()); 31 | } 32 | 33 | void ImportKeyDialog::loadKey() 34 | { 35 | const QString filePath = 36 | QFileDialog::getOpenFileName( 37 | this, 38 | tr("Load key from..."), 39 | QDir::homePath(), 40 | tr("Key file (*)")); 41 | 42 | if (filePath.isEmpty()) 43 | return; 44 | 45 | QFile keyFile(filePath); 46 | if (!keyFile.open(QIODevice::ReadOnly)) 47 | { 48 | QMessageBox::critical(this, tr("Error"), tr("Failed to read key from the selected file.")); 49 | return; 50 | } 51 | 52 | key_ = keyFile.readAll(); 53 | keyFile.close(); 54 | ui->keyEdit->setPlainText(key_.toHex().toUpper()); 55 | } 56 | 57 | void ImportKeyDialog::keyChanged() 58 | { 59 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ui->keyEdit->toPlainText().length() == 256); 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/importkeydialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef IMPORTKEYDIALOG_H 5 | #define IMPORTKEYDIALOG_H 6 | 7 | #include 8 | 9 | namespace Ui { 10 | class ImportKeyDialog; 11 | } 12 | 13 | namespace WalletGUI 14 | { 15 | 16 | class ImportKeyDialog : public QDialog 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | explicit ImportKeyDialog(QWidget *parent = 0); 22 | ~ImportKeyDialog(); 23 | 24 | QByteArray getKey() const; 25 | 26 | private slots: 27 | void loadKey(); 28 | void keyChanged(); 29 | 30 | private: 31 | Ui::ImportKeyDialog *ui; 32 | QByteArray key_; 33 | }; 34 | 35 | } 36 | 37 | #endif // IMPORTKEYDIALOG_H 38 | -------------------------------------------------------------------------------- /src/importkeydialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | ImportKeyDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 366 10 | 133 11 | 12 | 13 | 14 | Import key 15 | 16 | 17 | 18 | 19 | 20 | QFrame::NoFrame 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Load from file 30 | 31 | 32 | 33 | 34 | 35 | 36 | Qt::Horizontal 37 | 38 | 39 | 40 | 40 41 | 20 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | Qt::Horizontal 50 | 51 | 52 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | buttonBox 64 | accepted() 65 | ImportKeyDialog 66 | accept() 67 | 68 | 69 | 248 70 | 254 71 | 72 | 73 | 157 74 | 274 75 | 76 | 77 | 78 | 79 | buttonBox 80 | rejected() 81 | ImportKeyDialog 82 | reject() 83 | 84 | 85 | 316 86 | 260 87 | 88 | 89 | 286 90 | 274 91 | 92 | 93 | 94 | 95 | loadButton 96 | clicked() 97 | ImportKeyDialog 98 | loadKey() 99 | 100 | 101 | 56 102 | 109 103 | 104 | 105 | 182 106 | 66 107 | 108 | 109 | 110 | 111 | keyEdit 112 | textChanged() 113 | ImportKeyDialog 114 | keyChanged() 115 | 116 | 117 | 182 118 | 49 119 | 120 | 121 | 182 122 | 66 123 | 124 | 125 | 126 | 127 | 128 | keyChanged() 129 | loadKey() 130 | 131 | 132 | -------------------------------------------------------------------------------- /src/logframe.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include "logframe.h" 5 | #include "ui_logframe.h" 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace WalletGUI 13 | { 14 | 15 | static constexpr int MAX_LINES = 10000; 16 | static constexpr int MAX_TEXT_SIZE = 1024 * 1024; 17 | 18 | LogFrame::LogFrame(QWidget *parent) 19 | : QFrame(parent) 20 | , ui(new Ui::LogFrame) 21 | , mutex_(new QMutex) 22 | , autoScroll_(true) 23 | { 24 | ui->setupUi(this); 25 | const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); 26 | ui->textEdit->setFont(fixedFont); 27 | defaultColor_ = ui->textEdit->textColor(); 28 | 29 | ui->textEdit->document()->setMaximumBlockCount(MAX_LINES); 30 | 31 | QScrollBar* verticalScrollBar = ui->textEdit->verticalScrollBar(); 32 | connect(verticalScrollBar, &QScrollBar::valueChanged, this, &LogFrame::scrolled); 33 | } 34 | 35 | LogFrame::~LogFrame() 36 | { 37 | delete mutex_; 38 | delete ui; 39 | } 40 | 41 | void LogFrame::scrolled(int value) 42 | { 43 | const QScrollBar* verticalScrollBar = ui->textEdit->verticalScrollBar(); 44 | autoScroll_ = (value == verticalScrollBar->maximum()); 45 | } 46 | 47 | void LogFrame::scrollDown() 48 | { 49 | QScrollBar* verticalScrollBar = ui->textEdit->verticalScrollBar(); 50 | verticalScrollBar->setValue(verticalScrollBar->maximum()); 51 | } 52 | 53 | void LogFrame::addDaemonOutput(const QString& data) 54 | { 55 | print(data); 56 | } 57 | 58 | void LogFrame::addDaemonError(const QString& data) 59 | { 60 | print(data, Qt::red); 61 | } 62 | 63 | void LogFrame::addGuiMessage(const QString& data) 64 | { 65 | print(data, Qt::blue); 66 | } 67 | 68 | void LogFrame::addNetworkMessage(const QString& data) 69 | { 70 | print(data, Qt::darkGreen); 71 | } 72 | 73 | void LogFrame::print(const QString& data, const QColor& color) 74 | { 75 | QMutexLocker locker(mutex_); 76 | insertText(data, color); 77 | if (autoScroll_) 78 | scrollDown(); 79 | } 80 | 81 | void LogFrame::insertText(const QString& data, const QColor& color) 82 | { 83 | ui->textEdit->setTextColor(color.isValid() ? color : defaultColor_); 84 | if (data.size() > MAX_TEXT_SIZE) 85 | ui->textEdit->append(data.left(MAX_TEXT_SIZE)); 86 | else 87 | ui->textEdit->append(data); 88 | } 89 | 90 | void LogFrame::copyToClipboard() 91 | { 92 | QApplication::clipboard()->setText(ui->textEdit->toPlainText()); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/logframe.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef LOGFRAME_H 5 | #define LOGFRAME_H 6 | 7 | #include 8 | #include 9 | 10 | class QMutex; 11 | 12 | namespace Ui { 13 | class LogFrame; 14 | } 15 | 16 | namespace WalletGUI { 17 | 18 | class LogFrame : public QFrame 19 | { 20 | Q_OBJECT 21 | 22 | public: 23 | explicit LogFrame(QWidget *parent = 0); 24 | ~LogFrame(); 25 | 26 | public slots: 27 | void addDaemonOutput(const QString& data); 28 | void addDaemonError(const QString& data); 29 | void addGuiMessage(const QString& data); 30 | void addNetworkMessage(const QString& data); 31 | void copyToClipboard(); 32 | 33 | private: 34 | Ui::LogFrame *ui; 35 | QColor defaultColor_; 36 | QMutex* mutex_; 37 | bool autoScroll_; 38 | 39 | void scrollDown(); 40 | void print(const QString& data, const QColor& color = QColor()); 41 | void insertText(const QString& data, const QColor& color); 42 | 43 | private slots: 44 | void scrolled(int value); 45 | }; 46 | 47 | } 48 | 49 | #endif // LOGFRAME_H 50 | -------------------------------------------------------------------------------- /src/logframe.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | LogFrame 4 | 5 | 6 | 7 | 0 8 | 0 9 | 619 10 | 426 11 | 12 | 13 | 14 | Frame 15 | 16 | 17 | QFrame::StyledPanel 18 | 19 | 20 | QFrame::Raised 21 | 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 0 31 | 32 | 33 | 10 34 | 35 | 36 | 37 | 38 | QFrame::NoFrame 39 | 40 | 41 | true 42 | 43 | 44 | 45 | 46 | 47 | 48 | 6 49 | 50 | 51 | 0 52 | 53 | 54 | 6 55 | 56 | 57 | 0 58 | 59 | 60 | 61 | 62 | Qt::Horizontal 63 | 64 | 65 | 66 | 40 67 | 20 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Copy to clipboard 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | copyButton 87 | clicked() 88 | LogFrame 89 | copyToClipboard() 90 | 91 | 92 | 549 93 | 401 94 | 95 | 96 | 309 97 | 212 98 | 99 | 100 | 101 | 102 | 103 | copyToClipboard() 104 | 105 | 106 | -------------------------------------------------------------------------------- /src/logger.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | class QDir; 9 | class QFile; 10 | 11 | namespace WalletGUI { 12 | 13 | class WalletLogger :public QObject 14 | { 15 | Q_OBJECT 16 | Q_DISABLE_COPY(WalletLogger) 17 | 18 | public: 19 | static void init(const QDir& logDir, bool debug, QObject* parent); 20 | static void deinit(); 21 | static void debug(const QString& message); 22 | static void info(const QString& message); 23 | static void warning(const QString& message); 24 | static void critical(const QString& message); 25 | 26 | private: 27 | static QThread* m_loggerThread; 28 | static WalletLogger* m_instance; 29 | static QFile* m_logFile; 30 | 31 | WalletLogger(bool debug, QObject* parent); 32 | ~WalletLogger(); 33 | 34 | static void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg); 35 | 36 | Q_INVOKABLE void debugImpl(const QString& message); 37 | Q_INVOKABLE void infoImpl(const QString& message); 38 | Q_INVOKABLE void warningImpl(const QString& message); 39 | Q_INVOKABLE void criticalImpl(const QString& message); 40 | }; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | #include 6 | #include "mainwindow.h" 7 | #include "application.h" 8 | 9 | int main(int argc, char *argv[]) 10 | { 11 | WalletGUI::WalletApplication app(argc, argv); 12 | try 13 | { 14 | if (!app.init()) 15 | return 0; 16 | return app.exec(); 17 | } 18 | catch (const std::exception& _error) 19 | { 20 | fprintf(stderr, "[Main] Unhandled exception: %s\n", _error.what()); 21 | return 0; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/miningoverviewframe.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | 6 | #include "miningoverviewframe.h" 7 | #include "ui_miningoverviewframe.h" 8 | #include "MiningManager.h" 9 | #include "MinerModel.h" 10 | #include "walletmodel.h" 11 | #include "common.h" 12 | 13 | namespace WalletGUI { 14 | 15 | const char MINING_OVERVIEW_STYLE_SHEET_TEMPLATE[] = 16 | "WalletGUI--MiningOverviewFrame {" 17 | "border: 1px solid #c4c4c4" 18 | "}"; 19 | 20 | const char TEXT_LABEL_STYLE_SHEET_TEMPLATE[] = 21 | "QLabel {" 22 | "color: rgba(0,0,0,0.5);" 23 | "}"; 24 | 25 | constexpr int UI_SCALE = 90; 26 | 27 | MiningOverviewFrame::MiningOverviewFrame(QWidget *parent) 28 | : QFrame(parent) 29 | , ui(new Ui::MiningOverviewFrame) 30 | , miningManager_(nullptr) 31 | , miningMapper_(new QDataWidgetMapper(this)) 32 | , started_(false) 33 | { 34 | ui->setupUi(this); 35 | 36 | scaleWidgetText(ui->m_titleLabel, UI_SCALE); 37 | 38 | QFont font = ui->m_overviewHashrateLabel->font(); 39 | font.setBold(true); 40 | ui->m_overviewHashrateLabel->setFont(font); 41 | ui->m_miningStateLabel->setFont(font); 42 | ui->m_overviewNetworkHashrateLabel->setFont(font); 43 | ui->m_overviewNetworkDifficultyLabel->setFont(font); 44 | 45 | ui->m_miningStatusTextLabel->setStyleSheet(TEXT_LABEL_STYLE_SHEET_TEMPLATE); 46 | ui->m_overviewHashrateTextLabel->setStyleSheet(TEXT_LABEL_STYLE_SHEET_TEMPLATE); 47 | ui->m_overviewNetworkHashrateTextLabel->setStyleSheet(TEXT_LABEL_STYLE_SHEET_TEMPLATE); 48 | ui->m_overviewNetworkDifficultyTextLabel->setStyleSheet(TEXT_LABEL_STYLE_SHEET_TEMPLATE); 49 | 50 | setStyleSheet(MINING_OVERVIEW_STYLE_SHEET_TEMPLATE); 51 | } 52 | 53 | MiningOverviewFrame::~MiningOverviewFrame() 54 | { 55 | delete ui; 56 | } 57 | 58 | void MiningOverviewFrame::setMiningManager(MiningManager* miningManager) 59 | { 60 | miningManager_ = miningManager; 61 | 62 | connect(miningManager_, &MiningManager::miningStartedSignal, this, &MiningOverviewFrame::miningStarted); 63 | connect(miningManager_, &MiningManager::miningStoppedSignal, this, &MiningOverviewFrame::miningStopped); 64 | connect(miningManager_, &MiningManager::activeMinerChangedSignal, this, &MiningOverviewFrame::activeMinerChanged); 65 | } 66 | 67 | void MiningOverviewFrame::setMinerModel(QAbstractItemModel* model) 68 | { 69 | miningMapper_->setModel(model); 70 | miningMapper_->addMapping(ui->m_overviewHashrateLabel, MinerModel::COLUMN_HASHRATE, "text"); 71 | if (model->rowCount() > 0) 72 | miningMapper_->setCurrentIndex(0); 73 | else 74 | ui->m_overviewHashrateLabel->setText("0 H/s"); 75 | } 76 | 77 | void MiningOverviewFrame::setWalletModel(QAbstractItemModel* model) 78 | { 79 | QDataWidgetMapper* stateMapper = new QDataWidgetMapper(this); 80 | stateMapper->setModel(model); 81 | stateMapper->addMapping(ui->m_overviewNetworkHashrateLabel, WalletModel::COLUMN_NETWORK_HASHRATE, "text"); 82 | stateMapper->addMapping(ui->m_overviewNetworkDifficultyLabel, WalletModel::COLUMN_TOP_BLOCK_DIFFICULTY, "text"); 83 | stateMapper->toFirst(); 84 | connect(model, &QAbstractItemModel::modelReset, stateMapper, &QDataWidgetMapper::toFirst); 85 | } 86 | 87 | void MiningOverviewFrame::startMiningClicked() 88 | { 89 | if (started_) 90 | { 91 | miningStopped(); 92 | miningManager_->stopMining(); 93 | } 94 | else 95 | { 96 | miningStarted(); 97 | miningManager_->startMining(); 98 | } 99 | } 100 | 101 | void MiningOverviewFrame::miningStarted() 102 | { 103 | ui->m_miningStateLabel->setText(tr("ON")); 104 | started_ = true; 105 | } 106 | 107 | void MiningOverviewFrame::miningStopped() 108 | { 109 | ui->m_miningStateLabel->setText(tr("OFF")); 110 | started_ = false; 111 | } 112 | 113 | void MiningOverviewFrame::activeMinerChanged(quintptr _minerIndex) 114 | { 115 | miningMapper_->setCurrentIndex(_minerIndex); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /src/miningoverviewframe.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef MININGOVERVIEWFRAME_H 5 | #define MININGOVERVIEWFRAME_H 6 | 7 | #include 8 | 9 | class QAbstractItemModel; 10 | class QDataWidgetMapper; 11 | 12 | namespace Ui { 13 | class MiningOverviewFrame; 14 | } 15 | 16 | namespace WalletGUI { 17 | 18 | class MiningManager; 19 | class WalletModel; 20 | 21 | class MiningOverviewFrame : public QFrame 22 | { 23 | Q_OBJECT 24 | 25 | public: 26 | explicit MiningOverviewFrame(QWidget *parent = 0); 27 | ~MiningOverviewFrame(); 28 | 29 | void setMiningManager(MiningManager* miningManager); 30 | void setMinerModel(QAbstractItemModel* model); 31 | void setWalletModel(QAbstractItemModel* model); 32 | 33 | void miningStarted(); 34 | void miningStopped(); 35 | void activeMinerChanged(quintptr minerIndex); 36 | 37 | Q_SLOT void startMiningClicked(); 38 | 39 | private: 40 | Ui::MiningOverviewFrame *ui; 41 | 42 | MiningManager* miningManager_; 43 | QDataWidgetMapper* miningMapper_; 44 | bool started_; 45 | }; 46 | 47 | } 48 | 49 | #endif // MININGOVERVIEWFRAME_H 50 | -------------------------------------------------------------------------------- /src/mnemonicdialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include "mnemonicdialog.h" 5 | #include "ui_mnemonicdialog.h" 6 | #include "walletd.h" 7 | 8 | namespace WalletGUI 9 | { 10 | 11 | MnemonicDialog::MnemonicDialog(bool generate, QWidget *parent) 12 | : QDialog(parent) 13 | , ui(new Ui::MnemonicDialog) 14 | , parent_(parent) 15 | { 16 | ui->setupUi(this); 17 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); 18 | ui->mnemonicEdit->setReadOnly(generate); 19 | ui->generateButton->setEnabled(generate); 20 | ui->generateButton->setVisible(generate); 21 | ui->descriptionLabel->setVisible(generate); 22 | if (generate) 23 | generateMnemonic(); 24 | } 25 | MnemonicDialog::~MnemonicDialog() 26 | { 27 | ui->mnemonicEdit->setText(QString{1000, '0'}); 28 | ui->mnemonicEdit->clear(); 29 | delete ui; 30 | } 31 | 32 | QByteArray MnemonicDialog::getMnemonic() const 33 | { 34 | return ui->mnemonicEdit->toPlainText().simplified().toUtf8(); 35 | } 36 | 37 | void MnemonicDialog::mnemonicChanged() 38 | { 39 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!ui->mnemonicEdit->toPlainText().isEmpty()); 40 | } 41 | 42 | void MnemonicDialog::generateMnemonic() 43 | { 44 | ui->mnemonicEdit->setText(BuiltinWalletd::generateMnemonic(parent_, std::bind(&MnemonicDialog::daemonStandardErrorReady, this, std::placeholders::_1)).simplified()); 45 | } 46 | 47 | void MnemonicDialog::daemonStandardErrorReady(QString err) 48 | { 49 | ui->mnemonicEdit->setText(QString{"%1"}.arg(err)); 50 | ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); 51 | } 52 | 53 | 54 | } 55 | 56 | -------------------------------------------------------------------------------- /src/mnemonicdialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef MNEMONICDIALOG_H 5 | #define MNEMONICDIALOG_H 6 | 7 | #include 8 | 9 | namespace Ui { 10 | class MnemonicDialog; 11 | } 12 | 13 | namespace WalletGUI 14 | { 15 | 16 | class MnemonicDialog : public QDialog 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | explicit MnemonicDialog(bool generate, QWidget *parent = 0); 22 | ~MnemonicDialog(); 23 | 24 | QByteArray getMnemonic() const; 25 | 26 | private slots: 27 | void generateMnemonic(); 28 | void mnemonicChanged(); 29 | 30 | private: 31 | Ui::MnemonicDialog *ui; 32 | QWidget* parent_; 33 | 34 | void daemonStandardErrorReady(QString err); 35 | }; 36 | 37 | } 38 | 39 | #endif // MNEMONICDIALOG_H 40 | -------------------------------------------------------------------------------- /src/mnemonicdialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MnemonicDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 494 10 | 200 11 | 12 | 13 | 14 | Mnemonic generation 15 | 16 | 17 | 18 | 19 | 20 | Your wallet seed: 21 | 22 | 23 | 24 | 25 | 26 | 27 | false 28 | 29 | 30 | 31 | 32 | 33 | 34 | Please save these words on paper (order is important). This seed will allow you to recover your wallet. 35 | 36 | 37 | true 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | Generate another seed 47 | 48 | 49 | 50 | 51 | 52 | 53 | Qt::Horizontal 54 | 55 | 56 | 57 | 40 58 | 20 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | buttonBox 78 | accepted() 79 | MnemonicDialog 80 | accept() 81 | 82 | 83 | 388 84 | 176 85 | 86 | 87 | 246 88 | 99 89 | 90 | 91 | 92 | 93 | buttonBox 94 | rejected() 95 | MnemonicDialog 96 | reject() 97 | 98 | 99 | 388 100 | 176 101 | 102 | 103 | 246 104 | 99 105 | 106 | 107 | 108 | 109 | mnemonicEdit 110 | textChanged() 111 | MnemonicDialog 112 | mnemonicChanged() 113 | 114 | 115 | 246 116 | 82 117 | 118 | 119 | 246 120 | 99 121 | 122 | 123 | 124 | 125 | generateButton 126 | clicked() 127 | MnemonicDialog 128 | generateMnemonic() 129 | 130 | 131 | 49 132 | 176 133 | 134 | 135 | 246 136 | 99 137 | 138 | 139 | 140 | 141 | 142 | mnemonicChanged() 143 | generateMnemonic() 144 | 145 | 146 | -------------------------------------------------------------------------------- /src/myaddressesframe.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "myaddressesframe.h" 10 | #include "addressbookmanager.h" 11 | #include "questiondialog.h" 12 | #include "addressbookmodel.h" 13 | #include "newmyaddressdialog.h" 14 | #include "ui_myaddressesframe.h" 15 | #include "mainwindow.h" 16 | 17 | namespace WalletGUI 18 | { 19 | 20 | MyAddressesFrame::MyAddressesFrame(QWidget* parent) 21 | : QFrame(parent) 22 | , m_ui(new Ui::MyAddressesFrame) 23 | // , m_addressBookManager(nullptr) 24 | , mainWindow_(nullptr) 25 | , m_sortedAddressBookModel(nullptr) 26 | { 27 | m_ui->setupUi(this); 28 | } 29 | 30 | MyAddressesFrame::~MyAddressesFrame() { 31 | } 32 | 33 | void MyAddressesFrame::setAddressBookManager(IAddressBookManager* manager) 34 | { 35 | m_addressBookManager = manager; 36 | } 37 | 38 | void MyAddressesFrame::setMainWindow(MainWindow* _mainWindow) 39 | { 40 | mainWindow_ = _mainWindow; 41 | } 42 | 43 | void MyAddressesFrame::setSortedAddressBookModel(QAbstractItemModel* _model) { 44 | m_sortedAddressBookModel = _model; 45 | m_ui->m_addressBookView->setModel(m_sortedAddressBookModel); 46 | m_ui->m_addressBookView->header()->setSectionResizeMode(AddressBookModel::COLUMN_LABEL, QHeaderView::Fixed); 47 | m_ui->m_addressBookView->header()->setSectionResizeMode(AddressBookModel::COLUMN_ADDRESS, QHeaderView::Stretch); 48 | m_ui->m_addressBookView->header()->setResizeContentsPrecision(-1); 49 | m_ui->m_addressBookView->header()->resizeSection(AddressBookModel::COLUMN_LABEL, 250); 50 | } 51 | 52 | void MyAddressesFrame::addClicked() { 53 | m_addressBookManager->addAddress(QString{}, QString{}); 54 | } 55 | 56 | void MyAddressesFrame::editClicked(const QPersistentModelIndex& _index) { 57 | NewMyAddressDialog dlg{m_addressBookManager, _index, mainWindow_}; 58 | if (dlg.exec() == QDialog::Accepted) { 59 | QString label = dlg.getLabel(); 60 | m_addressBookManager->editAddress(_index.data(AddressBookModel::ROLE_ROW).toInt(), label, QString{}); 61 | } 62 | } 63 | 64 | void MyAddressesFrame::contextMenu(const QPoint& _pos) { 65 | QPersistentModelIndex index = m_ui->m_addressBookView->indexAt(_pos); 66 | if (!index.isValid()) { 67 | return; 68 | } 69 | 70 | QMenu menu; 71 | menu.setObjectName("m_addressBookMenu"); 72 | QAction* editAction = new QAction(tr("Edit"), &menu); 73 | QAction* copyAction = new QAction(tr("Copy to clipboard"), &menu); 74 | menu.addAction(editAction); 75 | menu.addAction(copyAction); 76 | 77 | connect(editAction, &QAction::triggered, [this, index]() { 78 | Q_EMIT this->editClicked(index); 79 | }); 80 | connect(copyAction, &QAction::triggered, [index]() { 81 | QApplication::clipboard()->setText(index.data(AddressBookModel::ROLE_ADDRESS).toString()); 82 | }); 83 | 84 | menu.exec(m_ui->m_addressBookView->mapToGlobal(_pos) + QPoint(-10, 20)); 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /src/myaddressesframe.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | class QLabel; 9 | class QPersistentModelIndex; 10 | class QAbstractItemModel; 11 | 12 | namespace Ui { 13 | class MyAddressesFrame; 14 | } 15 | 16 | namespace WalletGUI { 17 | 18 | class MainWindow; 19 | class IAddressBookManager; 20 | 21 | class MyAddressesFrame : public QFrame 22 | { 23 | Q_OBJECT 24 | Q_DISABLE_COPY(MyAddressesFrame) 25 | 26 | public: 27 | explicit MyAddressesFrame(QWidget* _parent); 28 | ~MyAddressesFrame(); 29 | 30 | void setMainWindow(MainWindow* mainWindow); 31 | void setAddressBookManager(IAddressBookManager* manager); 32 | void setSortedAddressBookModel(QAbstractItemModel* _model); 33 | 34 | private: 35 | QScopedPointer m_ui; 36 | IAddressBookManager* m_addressBookManager; 37 | MainWindow* mainWindow_; 38 | QAbstractItemModel* m_sortedAddressBookModel; 39 | 40 | Q_SLOT void addClicked(); 41 | Q_SLOT void editClicked(const QPersistentModelIndex& _index); 42 | Q_SLOT void contextMenu(const QPoint& _pos); 43 | }; 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/newaddressdialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | class QPersistentModelIndex; 9 | 10 | namespace Ui { 11 | class NewAddressDialog; 12 | } 13 | 14 | namespace WalletGUI { 15 | 16 | class AddressBookManager; 17 | 18 | class NewAddressDialog : public QDialog 19 | { 20 | Q_OBJECT 21 | Q_DISABLE_COPY(NewAddressDialog) 22 | 23 | public: 24 | NewAddressDialog(AddressBookManager* addressBookManager, QWidget* _parent); 25 | NewAddressDialog(AddressBookManager* addressBookManager, const QPersistentModelIndex& _index, QWidget* _parent); 26 | ~NewAddressDialog(); 27 | 28 | QString getAddress() const; 29 | QString getLabel() const; 30 | bool hasDonationFlag() const; 31 | 32 | void setAddressError(bool _error); 33 | void setAddressDuplicationError(bool _error); 34 | void setLabelDuplicationError(bool _error); 35 | 36 | private: 37 | QScopedPointer m_ui; 38 | AddressBookManager* m_addressBookManager; 39 | 40 | bool checkForErrors() const; 41 | 42 | Q_SLOT void validateAddress(const QString& _address); 43 | Q_SLOT void validateLabel(const QString& _label); 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/newmyaddressdialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | class QPersistentModelIndex; 9 | 10 | namespace Ui { 11 | class NewMyAddressDialog; 12 | } 13 | 14 | namespace WalletGUI { 15 | 16 | class IAddressBookManager; 17 | 18 | class NewMyAddressDialog : public QDialog 19 | { 20 | Q_OBJECT 21 | Q_DISABLE_COPY(NewMyAddressDialog) 22 | 23 | public: 24 | NewMyAddressDialog(IAddressBookManager* addressBookManager, QWidget* _parent); 25 | NewMyAddressDialog(IAddressBookManager* addressBookManager, const QPersistentModelIndex& _index, QWidget* _parent); 26 | ~NewMyAddressDialog(); 27 | 28 | QString getAddress() const; 29 | QString getLabel() const; 30 | // bool hasDonationFlag() const; 31 | 32 | // void setAddressError(bool _error); 33 | // void setAddressDuplicationError(bool _error); 34 | // void setLabelDuplicationError(bool _error); 35 | 36 | private: 37 | QScopedPointer m_ui; 38 | IAddressBookManager* m_addressBookManager; 39 | 40 | // bool checkForErrors() const; 41 | 42 | // Q_SLOT void validateAddress(const QString& _address); 43 | // Q_SLOT void validateLabel(const QString& _label); 44 | }; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/okbutton.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include "okbutton.h" 5 | 6 | namespace WalletGUI { 7 | 8 | namespace { 9 | 10 | //const char WALLET_OK_BUTTON_STYLE_SHEET_TEMPLATE[] = 11 | // "* {" 12 | // "font-family: %fontFamily%;" 13 | // "}" 14 | 15 | // "WalletGui--WalletOkButton {" 16 | // "min-width: 80px;" 17 | // "max-width: 80px;" 18 | // "min-height: 30px;" 19 | // "max-height: 30px;" 20 | // "font-size: %fontSizeNormal%;" 21 | // "color: #ffffff;" 22 | // "background-color: %backgroundColorBlueNormal%;" 23 | // "border: 1px solid %backgroundColorBlueNormal%;" 24 | // "}" 25 | 26 | // "WalletGui--WalletOkButton:disabled {" 27 | // "background-color: %backgroundColorBlueDisabled%;" 28 | // "border: 1px solid %backgroundColorBlueDisabled%;" 29 | // "}" 30 | 31 | // "WalletGui--WalletOkButton:hover {" 32 | // "background-color: %backgroundColorBlueHover%;" 33 | // "border: 1px solid %backgroundColorBlueHover%;" 34 | // "}" 35 | 36 | // "WalletGui--WalletOkButton:pressed {" 37 | // "background-color: %backgroundColorBluePressed%;" 38 | // "border: 1px solid %backgroundColorBluePressed%;" 39 | // "}"; 40 | 41 | } 42 | 43 | WalletOkButton::WalletOkButton(QWidget* parent) 44 | : QPushButton(parent) 45 | { 46 | // setStyleSheet(Settings::instance().getCurrentStyle().makeStyleSheet(WALLET_OK_BUTTON_STYLE_SHEET_TEMPLATE)); 47 | } 48 | 49 | WalletOkButton::~WalletOkButton() 50 | {} 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/okbutton.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace WalletGUI { 9 | 10 | class WalletOkButton : public QPushButton 11 | { 12 | Q_OBJECT 13 | Q_DISABLE_COPY(WalletOkButton) 14 | 15 | public: 16 | explicit WalletOkButton(QWidget* parent); 17 | ~WalletOkButton(); 18 | }; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/overviewframe.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | class QAbstractItemModel; 11 | class QProgressDialog; 12 | class QFile; 13 | class QTextStream; 14 | 15 | namespace Ui { 16 | class OverviewFrame; 17 | } 18 | 19 | namespace WalletGUI { 20 | 21 | class WalletModel; 22 | class MiningManager; 23 | class CopiedToolTip; 24 | class CSVTransactionsExporter; 25 | 26 | class OverviewFrame : public QFrame 27 | { 28 | Q_OBJECT 29 | Q_DISABLE_COPY(OverviewFrame) 30 | 31 | public: 32 | explicit OverviewFrame(QWidget* parent); 33 | ~OverviewFrame(); 34 | 35 | void setMainWindow(QWidget* mainWindow); 36 | void setTransactionsModel(WalletModel* transactionsModel); 37 | void setWalletModel(WalletModel* walletModel); 38 | void setMiningManager(MiningManager* miningManager); 39 | void setMinerModel(QAbstractItemModel* model); 40 | 41 | public slots: 42 | void exportToCSV(); 43 | 44 | signals: 45 | void copiedToClipboardSignal(); 46 | void createProofSignal(const QString& txHash, const QStringList& addresses, bool needToFind); 47 | 48 | private: 49 | QScopedPointer m_ui; 50 | QWidget* m_mainWindow; 51 | WalletModel* m_transactionsModel; 52 | CSVTransactionsExporter* m_csvExporter; 53 | 54 | void rowsInserted(const QModelIndex& parent, int first, int last); 55 | bool eventFilter(QObject* object, QEvent* event) override; 56 | }; 57 | 58 | class CSVTransactionsExporter : public QObject 59 | { 60 | Q_OBJECT 61 | 62 | public: 63 | CSVTransactionsExporter(WalletModel* transactionsModel, QWidget* parent); 64 | 65 | void start(); 66 | void cancel(); 67 | 68 | private: 69 | QWidget* parent_; 70 | QFile file_; 71 | QTextStream csv_; 72 | QProgressDialog* exportProgressDlg_; 73 | WalletModel* transactionsModel_; 74 | 75 | void finish(); 76 | void fetched(); 77 | void writeHeader(); 78 | void writeData(); 79 | void close(); 80 | void reset(); 81 | }; 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/popup.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef POPUP_H 5 | #define POPUP_H 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | namespace WalletGUI 13 | { 14 | 15 | class MagicToolTip : public QWidget 16 | { 17 | Q_OBJECT 18 | 19 | Q_PROPERTY(float opacity READ opacity WRITE setOpacity) 20 | 21 | public: 22 | explicit MagicToolTip(QWidget *parent = 0); 23 | 24 | float opacity() const; 25 | QString toolTip() const; 26 | 27 | private: 28 | virtual void paintEvent(QPaintEvent *event) override; 29 | 30 | public slots: 31 | void setToolTip(const QString& text); 32 | 33 | void setMinOpacity(float value); 34 | void setMaxOpacity(float value); 35 | void setShowAnimationDuration(int msecs); 36 | void setHideAnimationDuration(int msecs); 37 | void setToolTipDuration(int msecs); 38 | 39 | void show(const QPoint& point); 40 | void show(int x, int y); 41 | 42 | private slots: 43 | void hideAnimation(); 44 | void setOpacity(float value); 45 | 46 | private: 47 | QLabel label_; 48 | QHBoxLayout layout_; 49 | QPropertyAnimation animation_; 50 | QTimer timer_; 51 | float opacity_; 52 | float minOpacity_; 53 | float maxOpacity_; 54 | int showDuration_; 55 | int hideDuration_; 56 | int toolTipDuration_; 57 | }; 58 | 59 | class CopiedToolTip : public MagicToolTip 60 | { 61 | Q_OBJECT 62 | 63 | public: 64 | explicit CopiedToolTip(QWidget *parent = 0); 65 | 66 | public slots: 67 | void showNearMouse(); 68 | }; 69 | 70 | } 71 | 72 | #endif // POPUP_H 73 | 74 | -------------------------------------------------------------------------------- /src/progressbar.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include "progressbar.h" 5 | #include "walletmodel.h" 6 | #include "common.h" 7 | 8 | namespace WalletGUI 9 | { 10 | 11 | const char PROGRESS_BAR_STYLE_SHEET_TEMPLATE[] = 12 | "WalletGUI--WalletProgressBar {" 13 | "max-height:5px;" 14 | "}" 15 | "WalletGUI--WalletProgressBar::chunk {" 16 | "background-color: %1;" 17 | "}"; 18 | 19 | WalletProgressBar::WalletProgressBar(QWidget* parent) 20 | : QProgressBar(parent) 21 | , walletModel_(nullptr) 22 | { 23 | setRange(0, 0); 24 | setValue(0); 25 | setColor(QColor{MAIN_NET_COLOR}); 26 | } 27 | 28 | WalletProgressBar::~WalletProgressBar() 29 | {} 30 | 31 | void WalletProgressBar::setColor(const QColor& color) 32 | { 33 | setStyleSheet(QString{PROGRESS_BAR_STYLE_SHEET_TEMPLATE}.arg(color.name())); 34 | } 35 | 36 | void WalletProgressBar::setWalletModel(WalletModel* model) 37 | { 38 | Q_ASSERT(model != nullptr); 39 | const bool needToDisconnect = walletModel_ != nullptr; 40 | if (needToDisconnect) 41 | disconnect(walletModel_, 0, this, 0); // disconnect all signals from walletModel_ to all our slots 42 | walletModel_ = model; 43 | connect(walletModel_, &QAbstractItemModel::dataChanged, this, &WalletProgressBar::nodeStateChanged); 44 | connect(walletModel_, &QAbstractItemModel::dataChanged, this, &WalletProgressBar::updateMinimum); 45 | } 46 | 47 | void WalletProgressBar::updateMinimum(const QModelIndex& /*topLeft*/, const QModelIndex& /*bottomRight*/, const QVector& roles) 48 | { 49 | if (!roles.contains(WalletModel::ROLE_KNOWN_TOP_BLOCK_HEIGHT)) 50 | return; 51 | 52 | Q_ASSERT(walletModel_ != nullptr); 53 | const quint32 knownBlockHeight = walletModel_->getKnownBlockHeight(); 54 | const quint32 lastBlockHeight = walletModel_->getLastBlockHeight(); 55 | if (lastBlockHeight < knownBlockHeight) 56 | { 57 | setMinimum(lastBlockHeight); 58 | disconnect(walletModel_, &QAbstractItemModel::dataChanged, this, &WalletProgressBar::updateMinimum); 59 | } 60 | } 61 | 62 | void WalletProgressBar::nodeStateChanged(const QModelIndex& /*topLeft*/, const QModelIndex& /*bottomRight*/, const QVector& roles) 63 | { 64 | if (roles.contains(WalletModel::ROLE_KNOWN_TOP_BLOCK_HEIGHT) || roles.contains(WalletModel::ROLE_TOP_BLOCK_HEIGHT)) 65 | updateSyncState(); 66 | } 67 | 68 | void WalletProgressBar::updateSyncState() 69 | { 70 | Q_ASSERT(walletModel_ != nullptr); 71 | const quint32 knownBlockHeight = walletModel_->getKnownBlockHeight(); 72 | const quint32 lastBlockHeight = walletModel_->getLastBlockHeight(); 73 | 74 | setMaximum(knownBlockHeight); 75 | setValue(lastBlockHeight); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /src/progressbar.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef PROGRESSBAR 5 | #define PROGRESSBAR 6 | 7 | #include 8 | 9 | class QAbstractItemModel; 10 | 11 | namespace WalletGUI { 12 | 13 | class WalletModel; 14 | 15 | class WalletProgressBar : public QProgressBar 16 | { 17 | Q_OBJECT 18 | Q_DISABLE_COPY(WalletProgressBar) 19 | 20 | public: 21 | explicit WalletProgressBar(QWidget* parent); 22 | virtual ~WalletProgressBar(); 23 | 24 | void setWalletModel(WalletModel* model); 25 | void setColor(const QColor& color); 26 | 27 | private: 28 | WalletModel* walletModel_; 29 | 30 | void nodeStateChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector& roles); 31 | void updateMinimum(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector& roles); 32 | void updateSyncState(); 33 | }; 34 | 35 | } 36 | #endif // PROGRESSBAR 37 | 38 | -------------------------------------------------------------------------------- /src/questiondialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include "questiondialog.h" 5 | 6 | #include "ui_questiondialog.h" 7 | 8 | namespace WalletGUI 9 | { 10 | 11 | QuestionDialog::QuestionDialog(const QString& title, const QString& text, QWidget* parent) 12 | : QDialog(parent, static_cast(Qt::WindowCloseButtonHint)) 13 | , ui(new Ui::QuestionDialog) 14 | { 15 | ui->setupUi(this); 16 | setWindowTitle(title); 17 | ui->questionLabel->setText(text); 18 | } 19 | 20 | QuestionDialog::~QuestionDialog() 21 | {} 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/questiondialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace Ui { 9 | class QuestionDialog; 10 | } 11 | 12 | namespace WalletGUI 13 | { 14 | 15 | class QuestionDialog : public QDialog 16 | { 17 | Q_OBJECT 18 | Q_DISABLE_COPY(QuestionDialog) 19 | 20 | public: 21 | QuestionDialog(const QString& title, const QString& text, QWidget* parent); 22 | ~QuestionDialog(); 23 | 24 | private: 25 | QScopedPointer ui; 26 | }; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/questiondialog.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | QuestionDialog 4 | 5 | 6 | 7 | 0 8 | 0 9 | 481 10 | 116 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | 21 | 481 22 | 116 23 | 24 | 25 | 26 | 27 | 481 28 | 130 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 0 40 | 0 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | Qt::Horizontal 54 | 55 | 56 | 57 | 40 58 | 20 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | No 67 | 68 | 69 | 70 | 71 | 72 | 73 | Yes 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | okButton 85 | clicked() 86 | QuestionDialog 87 | accept() 88 | 89 | 90 | 373 91 | 87 92 | 93 | 94 | 240 95 | 57 96 | 97 | 98 | 99 | 100 | cancelButton 101 | clicked() 102 | QuestionDialog 103 | reject() 104 | 105 | 106 | 438 107 | 87 108 | 109 | 110 | 240 111 | 57 112 | 113 | 114 | 115 | 116 | 117 | -------------------------------------------------------------------------------- /src/resizablescrollarea.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include "resizablescrollarea.h" 5 | 6 | namespace WalletGUI { 7 | 8 | ResizableScrollArea::ResizableScrollArea(QWidget* _parent) : QScrollArea(_parent) { 9 | } 10 | 11 | ResizableScrollArea::~ResizableScrollArea() { 12 | } 13 | 14 | QSize ResizableScrollArea::sizeHint() const { 15 | if (widget() == nullptr || widget()->height() == 0) { 16 | return QScrollArea::sizeHint(); 17 | } 18 | 19 | QList childList = widget()->findChildren(QString(), Qt::FindDirectChildrenOnly); 20 | int height = 0; 21 | for (QWidget* widgetItem : childList) { 22 | height += widgetItem->height(); 23 | } 24 | 25 | return QSize(width(), height + 2); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/resizablescrollarea.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace WalletGUI { 9 | 10 | class ResizableScrollArea : public QScrollArea { 11 | Q_OBJECT 12 | Q_DISABLE_COPY(ResizableScrollArea) 13 | 14 | public: 15 | explicit ResizableScrollArea(QWidget* _parent); 16 | virtual ~ResizableScrollArea(); 17 | 18 | virtual QSize sizeHint() const override; 19 | }; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/sendconfirmationdialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | #include "sendconfirmationdialog.h" 6 | 7 | namespace WalletGUI 8 | { 9 | 10 | SendConfirmationDialog::SendConfirmationDialog( 11 | const QString& title, 12 | const QString& text, 13 | int secDelay, 14 | QWidget *parent) 15 | : QMessageBox(QMessageBox::Question, title, text, QMessageBox::Yes | QMessageBox::Cancel, parent) 16 | , yesButton_(button(QMessageBox::Yes)) 17 | , seconds_(secDelay) 18 | { 19 | setDefaultButton(QMessageBox::Cancel); 20 | updateYesButton(); 21 | connect(&countDownTimer_, &QTimer::timeout, this, &SendConfirmationDialog::countDown); 22 | } 23 | 24 | int SendConfirmationDialog::exec() 25 | { 26 | updateYesButton(); 27 | countDownTimer_.start(1000); // count down every 1 sec 28 | return QMessageBox::exec(); 29 | } 30 | 31 | void SendConfirmationDialog::countDown() 32 | { 33 | --seconds_; 34 | updateYesButton(); 35 | 36 | if(seconds_ <= 0) 37 | countDownTimer_.stop(); 38 | } 39 | 40 | void SendConfirmationDialog::updateYesButton() 41 | { 42 | static int width = 0; 43 | if(seconds_ > 0) 44 | { 45 | yesButton_->setEnabled(false); 46 | yesButton_->setText(tr("Yes") + " (" + QString::number(seconds_) + ")"); 47 | width = qMax(width, yesButton_->width()); 48 | yesButton_->resize(width, yesButton_->height()); 49 | } 50 | else 51 | { 52 | yesButton_->setEnabled(true); 53 | yesButton_->setText(tr("Yes")); 54 | } 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/sendconfirmationdialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef SENDCONFIRMATIONDIALOG 5 | #define SENDCONFIRMATIONDIALOG 6 | 7 | #include 8 | #include 9 | 10 | class QAbstractButton; 11 | 12 | namespace WalletGUI 13 | { 14 | 15 | class SendConfirmationDialog : public QMessageBox 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | SendConfirmationDialog( 21 | const QString& title, 22 | const QString& text, 23 | int secDelay, 24 | QWidget *parent = 0); 25 | 26 | int exec(); 27 | 28 | private slots: 29 | void countDown(); 30 | void updateYesButton(); 31 | 32 | private: 33 | QAbstractButton* yesButton_; 34 | QTimer countDownTimer_; 35 | int seconds_; 36 | }; 37 | 38 | } 39 | 40 | #endif // SENDCONFIRMATIONDIALOG 41 | 42 | -------------------------------------------------------------------------------- /src/sendframe.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | class QAbstractItemModel; 10 | 11 | namespace Ui { 12 | class SendFrame; 13 | } 14 | 15 | namespace RpcApi { 16 | struct Transaction; 17 | } 18 | 19 | namespace WalletGUI { 20 | 21 | class TransferFrame; 22 | class WalletModel; 23 | class MainWindow; 24 | class AddressBookManager; 25 | 26 | class SendFrame : public QFrame 27 | { 28 | Q_OBJECT 29 | Q_DISABLE_COPY(SendFrame) 30 | 31 | public: 32 | explicit SendFrame(QWidget* parent); 33 | ~SendFrame(); 34 | 35 | void addRecipient(const QString& address, const QString& label = QString()); 36 | void setWalletModel(WalletModel* model); 37 | void setMainWindow(MainWindow* mainWindow); 38 | void setAddressBookModel(QAbstractItemModel* model); 39 | void setAddressBookManager(AddressBookManager* manager); 40 | 41 | Q_SLOT void clearAll(); 42 | Q_SLOT void cancelSend(); 43 | 44 | private: 45 | QScopedPointer m_ui; 46 | MainWindow* m_mainWindow; 47 | QList m_transfers; 48 | WalletModel* walletModel_; 49 | QAbstractItemModel* addressBookModel_; 50 | AddressBookManager* addressBookManager_; 51 | 52 | void setPaymentIdError(bool error); 53 | void setMixinError(bool error); 54 | void setFeeFormatError(bool error); 55 | void updateMixinSliderStyleSheet(); 56 | void amountStringChanged(const QString& amountString); 57 | void addressChanged(const QString& address); 58 | bool readyToSend() const; 59 | quint64 getFeeFromSlider(int sliderValue) const; 60 | 61 | Q_SLOT void addRecipientClicked(); 62 | Q_SLOT void sendClicked(); 63 | Q_SLOT void mixinValueChanged(int value); 64 | Q_SLOT void feeValueChanged(int value); 65 | Q_SLOT void validatePaymentId(const QString& paymentId); 66 | Q_SLOT void updateFee(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles); 67 | 68 | Q_SIGNALS: 69 | void showTransactionsFrameSignal(); 70 | void createTxSignal(const RpcApi::Transaction& tx, quint64 fee, bool subtractFee); 71 | }; 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/signalhandler.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include 5 | 6 | #include "signalhandler.h" 7 | #include "logger.h" 8 | 9 | namespace WalletGUI { 10 | 11 | SignalHandler& SignalHandler::instance() 12 | { 13 | static SignalHandler inst; 14 | return inst; 15 | } 16 | 17 | SignalHandler::SignalHandler() 18 | { 19 | std::signal(SIGINT, SignalHandler::sigHandler); 20 | std::signal(SIGTERM, SignalHandler::sigHandler); 21 | #ifndef Q_OS_WIN 22 | std::signal(SIGPIPE, SIG_IGN); 23 | #endif 24 | } 25 | 26 | SignalHandler::~SignalHandler() 27 | {} 28 | 29 | void SignalHandler::sigHandler(int signal) 30 | { 31 | WalletLogger::warning(tr("[SignalHandler] Signal received: %1").arg(signal)); 32 | emit SignalHandler::instance().quitSignal(); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/signalhandler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace WalletGUI { 9 | 10 | class SignalHandler : public QObject 11 | { 12 | Q_OBJECT 13 | Q_DISABLE_COPY(SignalHandler) 14 | 15 | public: 16 | static SignalHandler& instance(); 17 | 18 | private: 19 | SignalHandler(); 20 | ~SignalHandler(); 21 | 22 | static void sigHandler(int signal); 23 | 24 | Q_SIGNALS: 25 | void quitSignal(); 26 | }; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/statusbar.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | class QLabel; 9 | class QAbstractItemModel; 10 | class QDataWidgetMapper; 11 | class QTimer; 12 | 13 | namespace WalletGUI { 14 | 15 | class WalletModel; 16 | 17 | class WalletStatusBar : public QStatusBar 18 | { 19 | Q_OBJECT 20 | Q_DISABLE_COPY(WalletStatusBar) 21 | 22 | public: 23 | explicit WalletStatusBar(QWidget* parent); 24 | virtual ~WalletStatusBar(); 25 | 26 | void setWalletModel(WalletModel* model); 27 | 28 | private: 29 | WalletModel* walletModel_; 30 | QLabel* m_syncStatusLabel; 31 | QLabel* m_syncStatusIconLabel; 32 | // QLabel* m_encryptionStatusIconLabel; 33 | // QLabel* m_hdStatusLabel; 34 | QLabel* m_peerCountLabel; 35 | QLabel* m_walletConnectionLabel; 36 | QLabel* m_bytecoindConnectionLabel; 37 | QMovie* m_syncMovie; 38 | QDataWidgetMapper* stateMapper_; 39 | QTimer* updateTimer_; 40 | bool isSynchronized_; 41 | 42 | void nodeStateChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector& roles); 43 | void updateStatusDescription(); 44 | void updateSyncState(); 45 | void updateEncryptedState(bool isEncrypted); 46 | }; 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/transferframe.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | #include 8 | 9 | class QCompleter; 10 | 11 | namespace Ui { 12 | class TransferFrame; 13 | } 14 | 15 | namespace WalletGUI 16 | { 17 | 18 | class AddressBookManager; 19 | 20 | class TransferFrame : public QFrame 21 | { 22 | Q_OBJECT 23 | Q_DISABLE_COPY(TransferFrame) 24 | 25 | public: 26 | explicit TransferFrame(QWidget* parent); 27 | ~TransferFrame(); 28 | 29 | bool readyToSend() const; 30 | QString getAddress() const; 31 | QString getAmountString() const; 32 | quint64 getAmount() const; 33 | QString getLabel() const; 34 | 35 | void setMainWindow(QWidget* mainWindow); 36 | void setAddressBookModel(QAbstractItemModel* model); 37 | void setAddressBookManager(AddressBookManager* manager); 38 | 39 | void setAddress(const QString& address); 40 | void setAmount(qreal amount); 41 | void setLabel(const QString& label); 42 | 43 | void disableRemoveButton(bool disable); 44 | void hideBorder(); 45 | 46 | void setAddressError(bool error = true); 47 | void setDuplicationError(bool error = true); 48 | void setAmountFormatError(bool error = true); 49 | void setInsufficientFundsError(bool error = true); 50 | void setBigTransactionError(bool error = true); 51 | void setLabelLikePaymentIdError(bool error = true); 52 | 53 | virtual bool eventFilter(QObject* object, QEvent* event) override; 54 | 55 | private: 56 | QScopedPointer m_ui; 57 | QWidget* m_mainWindow; 58 | QAbstractItemModel* m_addressBookModel; 59 | AddressBookManager* m_addressBookManager; 60 | QCompleter* m_addressCompleter; 61 | 62 | Q_SLOT void validateAmount(double amount); 63 | Q_SLOT void amountStringChanged(const QString& amountString); 64 | Q_SLOT void addressChanged(const QString& address); 65 | Q_SLOT void labelOrAddressChanged(const QString& text); 66 | Q_SLOT void addressBookClicked(); 67 | Q_SLOT void pasteClicked(); 68 | 69 | Q_SIGNALS: 70 | void amountStringChangedSignal(const QString& amountString); 71 | void addressChangedSignal(const QString& address); 72 | }; 73 | 74 | } 75 | -------------------------------------------------------------------------------- /src/version.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "version.h" 4 | 5 | 6 | namespace WalletGUI { 7 | 8 | int compareVersion(const QString& newVersion, const QString& currentVersion) 9 | { 10 | const QStringList newVersions = newVersion.split('.', QString::KeepEmptyParts); 11 | const QStringList currentVersions = currentVersion.split('.', QString::KeepEmptyParts); 12 | 13 | const int newSubverCount = newVersions.size(); 14 | const int currSubverCount = currentVersions.size(); 15 | bool ok = false; 16 | int result = 0; 17 | 18 | for (int i = 0; result == 0 && i < newSubverCount && i < currSubverCount; ++i) 19 | { 20 | const int newV = newVersions[i].toInt(&ok); 21 | if (!ok) 22 | return -1; 23 | const int currV = currentVersions[i].toInt(&ok); 24 | if (!ok) 25 | return 1; 26 | result = newV > currV ? 1 : newV < currV ? -1 : 0; 27 | } 28 | if (result == 0) 29 | result = newSubverCount > currSubverCount ? 1 : newSubverCount < currSubverCount ? -1 : 0; 30 | return result; 31 | } 32 | 33 | bool isStableVersion() 34 | { 35 | return QString{VERSION_SUFFIX} == "stable"; 36 | } 37 | 38 | QString fullVersion() 39 | { 40 | return isStableVersion() ? QString{"%1 %2"}.arg(VERSION).arg(CODENAME) : QString{"%1-%2-%3-%4"}.arg(VERSION).arg(CODENAME).arg(VERSION_SUFFIX).arg(REVISION); 41 | } 42 | 43 | QString shortVersion() 44 | { 45 | return isStableVersion() ? QString{"%1"}.arg(VERSION) : QString{"%1-%2-%3"}.arg(VERSION).arg(VERSION_SUFFIX).arg(REVISION); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | #ifndef VERSION_H 2 | #define VERSION_H 3 | 4 | #include 5 | 6 | namespace WalletGUI { 7 | 8 | constexpr char VERSION[] = "3.5.1"; 9 | constexpr char CODENAME[] = "Beryl"; 10 | constexpr char VERSION_SUFFIX[] = "stable"; 11 | constexpr char REVISION[] = "20190718"; 12 | 13 | // returns <0, if newVersion is worse than currentVersion, returns >0, if newVersion is better, and returns 0, if versions are equal 14 | int compareVersion(const QString& newVersion, const QString& currentVersion); 15 | bool isStableVersion(); 16 | QString fullVersion(); 17 | QString shortVersion(); 18 | 19 | } 20 | 21 | #endif // VERSION_H 22 | -------------------------------------------------------------------------------- /src/walletdparamsdialog.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include "walletdparamsdialog.h" 5 | #include "ui_walletdparamsdialog.h" 6 | #include "settings.h" 7 | 8 | namespace WalletGUI 9 | { 10 | 11 | WalletdParamsDialog::WalletdParamsDialog(bool allowToRestart, QWidget *parent) 12 | : QDialog(parent) 13 | , ui(new Ui::WalletdParamsDialog) 14 | , allowToRestart_(allowToRestart) 15 | { 16 | ui->setupUi(this); 17 | // ui->applyButton->setEnabled(allowToRestart); 18 | ui->applyButton->setText(allowToRestart_ ? tr("Save and restart walletd") : tr("Save")); 19 | ui->paramsEdit->setText(Settings::instance().getWalletdParams()); 20 | 21 | const NetworkType net = Settings::instance().getNetworkType(); 22 | switch (net) { 23 | case NetworkType::MAIN: ui->radioMainNet->setChecked(true); break; 24 | case NetworkType::STAGE: ui->radioStageNet->setChecked(true); break; 25 | case NetworkType::TEST: ui->radioTestNet->setChecked(true); break; 26 | default: ui->radioMainNet->setChecked(true); break; 27 | } 28 | 29 | const ConnectionMethod bytecoindConnection = Settings::instance().getBytecoindConnectionMethod(); 30 | switch (bytecoindConnection) { 31 | case ConnectionMethod::BUILTIN: ui->radioBuiltinBytecoind->setChecked(true); break; 32 | case ConnectionMethod::REMOTE: ui->radioExternalBytecoind->setChecked(true); break; 33 | default: ui->radioBuiltinBytecoind->setChecked(true); break; 34 | } 35 | 36 | QUrl url{Settings::instance().getBytecoindHost()}; 37 | url.setPort(Settings::instance().getBytecoindPort()); 38 | ui->editHost->setText(url.toString()); 39 | } 40 | 41 | WalletdParamsDialog::~WalletdParamsDialog() 42 | { 43 | delete ui; 44 | } 45 | 46 | void WalletdParamsDialog::saveParams() 47 | { 48 | Settings::instance().setWalletdParams(ui->paramsEdit->toPlainText().simplified()); 49 | Settings::instance().setNetworkType( 50 | ui->radioMainNet->isChecked() ? 51 | NetworkType::MAIN : 52 | ui->radioStageNet->isChecked() ? 53 | NetworkType::STAGE : 54 | ui->radioTestNet->isChecked() ? 55 | NetworkType::TEST : 56 | NetworkType::MAIN); 57 | Settings::instance().setBytecoindConnectionMethod( 58 | ui->radioBuiltinBytecoind->isChecked() ? 59 | ConnectionMethod::BUILTIN : 60 | ui->radioExternalBytecoind->isChecked() ? 61 | ConnectionMethod::REMOTE : 62 | ConnectionMethod::BUILTIN); 63 | 64 | const QUrl url{ui->editHost->text()}; 65 | Settings::instance().setBytecoindEndPoint(url.toString(QUrl::RemovePort), url.port(Settings::instance().getDefaultBytecoindPort())); 66 | } 67 | 68 | void WalletdParamsDialog::applyParams() 69 | { 70 | saveParams(); 71 | if (allowToRestart_) 72 | emit restartWalletd(); 73 | } 74 | 75 | void WalletdParamsDialog::hostChanged() 76 | { 77 | ui->applyButton->setEnabled(!ui->editHost->text().isEmpty()); 78 | } 79 | 80 | void WalletdParamsDialog::externalBytecoindToggled(bool checked) 81 | { 82 | if (checked) 83 | ui->applyButton->setEnabled(!ui->editHost->text().isEmpty()); 84 | else 85 | ui->applyButton->setEnabled(true); 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/walletdparamsdialog.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #ifndef WALLETDPARAMSDIALOG_H 5 | #define WALLETDPARAMSDIALOG_H 6 | 7 | #include 8 | 9 | namespace Ui { 10 | class WalletdParamsDialog; 11 | } 12 | 13 | namespace WalletGUI 14 | { 15 | 16 | class WalletdParamsDialog : public QDialog 17 | { 18 | Q_OBJECT 19 | 20 | public: 21 | explicit WalletdParamsDialog(bool allowToRestart, QWidget *parent = 0); 22 | ~WalletdParamsDialog(); 23 | 24 | public slots: 25 | void saveParams(); 26 | void applyParams(); 27 | void hostChanged(); 28 | void externalBytecoindToggled(bool checked); 29 | 30 | signals: 31 | void restartWalletd(); 32 | 33 | private: 34 | Ui::WalletdParamsDialog *ui; 35 | 36 | bool allowToRestart_; 37 | }; 38 | 39 | } 40 | 41 | #endif // WALLETDPARAMSDIALOG_H 42 | -------------------------------------------------------------------------------- /src/windoweditemmodel.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #include "windoweditemmodel.h" 5 | 6 | namespace WalletGUI { 7 | 8 | WalletWindowedItemModel::WalletWindowedItemModel(int filterRole, QObject* parent) 9 | : QSortFilterProxyModel(parent) 10 | , m_filterRole(filterRole) 11 | , m_windowSize(0) 12 | , m_windowBegin(0) 13 | {} 14 | 15 | WalletWindowedItemModel::~WalletWindowedItemModel() 16 | {} 17 | 18 | int WalletWindowedItemModel::getWindowSize() const 19 | { 20 | return m_windowSize; 21 | } 22 | 23 | int WalletWindowedItemModel::getWindowBegin() const 24 | { 25 | return m_windowBegin; 26 | } 27 | 28 | void WalletWindowedItemModel::setWindowSize(int windowSize) 29 | { 30 | if (m_windowSize != windowSize) 31 | { 32 | m_windowSize = windowSize; 33 | invalidateFilter(); 34 | } 35 | } 36 | 37 | void WalletWindowedItemModel::setWindowBegin(int windowBegin) 38 | { 39 | if (m_windowBegin != windowBegin) 40 | { 41 | m_windowBegin = windowBegin; 42 | invalidateFilter(); 43 | } 44 | } 45 | 46 | bool WalletWindowedItemModel::filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const 47 | { 48 | if (getWindowSize() == 0) 49 | return false; 50 | 51 | if (m_filterRole == -1) 52 | return sourceRow >= m_windowBegin && sourceRow < m_windowBegin + m_windowSize; 53 | 54 | QModelIndex sourceIndex = sourceModel()->index(sourceRow, 0, sourceParent); 55 | return sourceIndex.data(m_filterRole).toInt() >= m_windowBegin && 56 | sourceIndex.data(m_filterRole).toInt() < m_windowBegin + m_windowSize; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/windoweditemmodel.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015-2018, The Bytecoin developers. 2 | // Licensed under the GNU Lesser General Public License. See LICENSE for details. 3 | 4 | #pragma once 5 | 6 | #include 7 | 8 | namespace WalletGUI { 9 | 10 | class WalletWindowedItemModel : public QSortFilterProxyModel 11 | { 12 | Q_OBJECT 13 | Q_DISABLE_COPY(WalletWindowedItemModel) 14 | 15 | public: 16 | WalletWindowedItemModel(int filterRole, QObject* parent); 17 | virtual ~WalletWindowedItemModel(); 18 | 19 | int getWindowSize() const; 20 | int getWindowBegin() const; 21 | void setWindowSize(int windowSize); 22 | void setWindowBegin(int windowBegin); 23 | 24 | protected: 25 | virtual bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const override; 26 | 27 | private: 28 | int m_filterRole; 29 | int m_windowSize; 30 | int m_windowBegin; 31 | }; 32 | 33 | } 34 | --------------------------------------------------------------------------------