From 2a461488b2240248e16ff7c7e1af20272dfdd45e Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Thu, 20 Jan 2022 11:50:10 -0400 Subject: [PATCH] fix: remove unneeded exceptions --- src-cpp/app/boot/app_controller_delegate.h | 17 +---- src-cpp/app/modules/main/controller.cpp | 4 +- src-cpp/app/modules/main/controller.h | 2 +- .../app/modules/main/controller_interface.h | 7 +- .../module_controller_delegate_interface.h | 5 -- .../module_view_delegate_interface.h | 7 +- src-cpp/app/modules/main/module.cpp | 5 +- src-cpp/app/modules/main/module.h | 2 +- .../modules/main/module_access_interface.h | 7 +- src-cpp/app/modules/main/view.cpp | 7 +- src-cpp/app/modules/main/view.h | 2 +- src-cpp/app/modules/startup/controller.cpp | 4 +- src-cpp/app/modules/startup/controller.h | 2 +- .../modules/startup/controller_interface.h | 11 +--- .../module_controller_delegate_interface.h | 15 +---- .../module_login_delegate_interface.h | 7 +- .../module_onboarding_delegate_interface.h | 7 +- .../module_view_delegate_interface.h | 7 +- .../app/modules/startup/login/controller.cpp | 4 +- .../app/modules/startup/login/controller.h | 2 +- .../startup/login/controller_interface.h | 23 ++----- .../module_controller_delegate_interface.h | 20 +----- .../module_view_delegate_interface.h | 16 +---- src-cpp/app/modules/startup/login/module.cpp | 6 +- src-cpp/app/modules/startup/login/module.h | 2 +- .../startup/login/module_access_interface.h | 12 +--- src-cpp/app/modules/startup/login/view.cpp | 4 +- src-cpp/app/modules/startup/login/view.h | 2 +- src-cpp/app/modules/startup/module.cpp | 5 +- src-cpp/app/modules/startup/module.h | 2 +- .../modules/startup/module_access_interface.h | 12 +--- .../modules/startup/onboarding/controller.cpp | 4 +- .../modules/startup/onboarding/controller.h | 2 +- .../startup/onboarding/controller_interface.h | 41 ++++-------- .../module_controller_delegate_interface.h | 20 +----- .../module_view_delegate_interface.h | 31 ++------- .../app/modules/startup/onboarding/module.cpp | 9 +-- .../app/modules/startup/onboarding/module.h | 2 +- .../onboarding/module_access_interface.h | 12 +--- .../app/modules/startup/onboarding/view.cpp | 6 +- src-cpp/app/modules/startup/onboarding/view.h | 2 +- src-cpp/app/modules/startup/view.cpp | 7 +- src-cpp/app/modules/startup/view.h | 2 +- .../include/accounts/service_interface.h | 66 ++++--------------- src-cpp/app_service/include/app_service.h | 7 +- 45 files changed, 112 insertions(+), 327 deletions(-) diff --git a/src-cpp/app/boot/app_controller_delegate.h b/src-cpp/app/boot/app_controller_delegate.h index eff5a52986..ccb849f2f2 100644 --- a/src-cpp/app/boot/app_controller_delegate.h +++ b/src-cpp/app/boot/app_controller_delegate.h @@ -1,22 +1,11 @@ #pragma once -#include - class AppControllerDelegate { public: - virtual void startupDidLoad() - { - throw std::domain_error("Not implemented"); - } + virtual void startupDidLoad() = 0; - virtual void mainDidLoad() - { - throw std::domain_error("Not implemented"); - } + virtual void mainDidLoad() = 0; - virtual void userLoggedIn() - { - throw std::domain_error("Not implemented"); - } + virtual void userLoggedIn() = 0; }; diff --git a/src-cpp/app/modules/main/controller.cpp b/src-cpp/app/modules/main/controller.cpp index 47a53add1a..91d27ef003 100644 --- a/src-cpp/app/modules/main/controller.cpp +++ b/src-cpp/app/modules/main/controller.cpp @@ -7,9 +7,9 @@ namespace Modules { namespace Main { -Controller::Controller(ModuleControllerDelegateInterface* d, QObject* parent) +Controller::Controller(ModuleControllerDelegateInterface* delegate, QObject* parent) : QObject(parent) - , m_delegate(d) + , m_delegate(delegate) { } void Controller::init() { } diff --git a/src-cpp/app/modules/main/controller.h b/src-cpp/app/modules/main/controller.h index 00f1bf13e9..7289b493d8 100644 --- a/src-cpp/app/modules/main/controller.h +++ b/src-cpp/app/modules/main/controller.h @@ -13,7 +13,7 @@ namespace Main class Controller : public QObject, ControllerInterface { public: - Controller(ModuleControllerDelegateInterface* d, QObject* parent = nullptr); + Controller(ModuleControllerDelegateInterface* delegate, QObject* parent = nullptr); void init() override; private: diff --git a/src-cpp/app/modules/main/controller_interface.h b/src-cpp/app/modules/main/controller_interface.h index 86de8b2019..1a1d128120 100644 --- a/src-cpp/app/modules/main/controller_interface.h +++ b/src-cpp/app/modules/main/controller_interface.h @@ -1,7 +1,5 @@ #pragma once -#include - namespace Modules { namespace Main @@ -12,10 +10,7 @@ namespace Main class ControllerInterface { public: - virtual void init() - { - throw std::domain_error("Not implemented"); - } + virtual void init() = 0; }; } // namespace Main } // namespace Modules \ No newline at end of file diff --git a/src-cpp/app/modules/main/interfaces/module_controller_delegate_interface.h b/src-cpp/app/modules/main/interfaces/module_controller_delegate_interface.h index 23547cc56a..5c87094ae7 100644 --- a/src-cpp/app/modules/main/interfaces/module_controller_delegate_interface.h +++ b/src-cpp/app/modules/main/interfaces/module_controller_delegate_interface.h @@ -1,10 +1,5 @@ #pragma once -#include "accounts/service_interface.h" -#include "app_controller_delegate.h" -#include "controller.h" -#include - namespace Modules { namespace Main diff --git a/src-cpp/app/modules/main/interfaces/module_view_delegate_interface.h b/src-cpp/app/modules/main/interfaces/module_view_delegate_interface.h index d29f50f02f..110ba6fb77 100644 --- a/src-cpp/app/modules/main/interfaces/module_view_delegate_interface.h +++ b/src-cpp/app/modules/main/interfaces/module_view_delegate_interface.h @@ -1,7 +1,5 @@ #pragma once -#include - namespace Modules { namespace Main @@ -9,10 +7,7 @@ namespace Main class ModuleViewDelegateInterface { public: - virtual void viewDidLoad() - { - throw std::domain_error("Not implemented"); - } + virtual void viewDidLoad() = 0; }; }; // namespace Main }; // namespace Modules \ No newline at end of file diff --git a/src-cpp/app/modules/main/module.cpp b/src-cpp/app/modules/main/module.cpp index 239f292a89..0017d414d1 100644 --- a/src-cpp/app/modules/main/module.cpp +++ b/src-cpp/app/modules/main/module.cpp @@ -11,10 +11,9 @@ namespace Modules { namespace Main { -Module::Module(AppControllerDelegate* d) - +Module::Module(AppControllerDelegate* delegate) + : m_delegate(delegate) { - m_delegate = d; m_controller = new Controller(this); m_view = new View(this); } diff --git a/src-cpp/app/modules/main/module.h b/src-cpp/app/modules/main/module.h index 2aa12c1bb2..6169659baa 100644 --- a/src-cpp/app/modules/main/module.h +++ b/src-cpp/app/modules/main/module.h @@ -22,7 +22,7 @@ private: Controller* m_controller; public: - Module(AppControllerDelegate* d); + Module(AppControllerDelegate* delegate); ~Module(); void load() override; void checkIfModuleDidLoad(); diff --git a/src-cpp/app/modules/main/module_access_interface.h b/src-cpp/app/modules/main/module_access_interface.h index 9325187312..e9202cb751 100644 --- a/src-cpp/app/modules/main/module_access_interface.h +++ b/src-cpp/app/modules/main/module_access_interface.h @@ -1,7 +1,5 @@ #pragma once -#include - namespace Modules { namespace Main @@ -9,10 +7,7 @@ namespace Main class ModuleAccessInterface { public: - virtual void load() - { - throw std::domain_error("Not implemented"); - } + virtual void load() = 0; }; }; // namespace Main }; // namespace Modules diff --git a/src-cpp/app/modules/main/view.cpp b/src-cpp/app/modules/main/view.cpp index 2aeeaf8a99..b31833dd9b 100644 --- a/src-cpp/app/modules/main/view.cpp +++ b/src-cpp/app/modules/main/view.cpp @@ -7,11 +7,10 @@ namespace Modules namespace Main { -View::View(ModuleViewDelegateInterface* d, QObject* parent) +View::View(ModuleViewDelegateInterface* delegate, QObject* parent) : QObject(parent) -{ - m_delegate = d; -} + , m_delegate(delegate) +{ } void View::load() { diff --git a/src-cpp/app/modules/main/view.h b/src-cpp/app/modules/main/view.h index 0c6f8c286b..93cced9695 100644 --- a/src-cpp/app/modules/main/view.h +++ b/src-cpp/app/modules/main/view.h @@ -13,7 +13,7 @@ class View : public QObject Q_OBJECT public: - explicit View(ModuleViewDelegateInterface* d, QObject* parent = nullptr); + explicit View(ModuleViewDelegateInterface* delegate, QObject* parent = nullptr); void load(); private: diff --git a/src-cpp/app/modules/startup/controller.cpp b/src-cpp/app/modules/startup/controller.cpp index 2787f71a48..5a3e28b1a1 100644 --- a/src-cpp/app/modules/startup/controller.cpp +++ b/src-cpp/app/modules/startup/controller.cpp @@ -8,12 +8,12 @@ namespace Modules { namespace Startup { -Controller::Controller(ModuleControllerDelegateInterface* d, +Controller::Controller(ModuleControllerDelegateInterface* delegate, Accounts::ServiceInterface* accountsService, QObject* parent) : QObject(parent) , m_accountsService(accountsService) - , m_delegate(d) + , m_delegate(delegate) { } void Controller::init() diff --git a/src-cpp/app/modules/startup/controller.h b/src-cpp/app/modules/startup/controller.h index e90c1432fb..b23660aa60 100644 --- a/src-cpp/app/modules/startup/controller.h +++ b/src-cpp/app/modules/startup/controller.h @@ -14,7 +14,7 @@ namespace Startup class Controller : public QObject, ControllerInterface { public: - Controller(ModuleControllerDelegateInterface* d, + Controller(ModuleControllerDelegateInterface* delegate, Accounts::ServiceInterface* accountsService, QObject* parent = nullptr); void init() override; diff --git a/src-cpp/app/modules/startup/controller_interface.h b/src-cpp/app/modules/startup/controller_interface.h index ee6b80b7ed..bd8cd443d3 100644 --- a/src-cpp/app/modules/startup/controller_interface.h +++ b/src-cpp/app/modules/startup/controller_interface.h @@ -10,14 +10,9 @@ namespace Startup class ControllerInterface { public: - virtual void init() - { - throw std::domain_error("Not implemented"); - } - virtual bool shouldStartWithOnboardingScreen() - { - throw std::domain_error("Not implemented"); - } + virtual void init() = 0; + + virtual bool shouldStartWithOnboardingScreen() = 0; }; } // namespace Startup } // namespace Modules \ No newline at end of file diff --git a/src-cpp/app/modules/startup/interfaces/module_controller_delegate_interface.h b/src-cpp/app/modules/startup/interfaces/module_controller_delegate_interface.h index 59c9a8ab07..9219eec456 100644 --- a/src-cpp/app/modules/startup/interfaces/module_controller_delegate_interface.h +++ b/src-cpp/app/modules/startup/interfaces/module_controller_delegate_interface.h @@ -1,10 +1,5 @@ #pragma once -#include "accounts/service_interface.h" -#include "app_controller_delegate.h" -#include "controller.h" -#include - namespace Modules { namespace Startup @@ -12,15 +7,9 @@ namespace Startup class ModuleControllerDelegateInterface { public: - virtual void userLoggedIn() - { - throw std::domain_error("Not implemented"); - } + virtual void userLoggedIn() = 0; - virtual void emitLogOut() - { - throw std::domain_error("Not implemented"); - } + virtual void emitLogOut() = 0; }; }; // namespace Startup }; // namespace Modules \ No newline at end of file diff --git a/src-cpp/app/modules/startup/interfaces/module_login_delegate_interface.h b/src-cpp/app/modules/startup/interfaces/module_login_delegate_interface.h index d4eb2268ea..9888b3b554 100644 --- a/src-cpp/app/modules/startup/interfaces/module_login_delegate_interface.h +++ b/src-cpp/app/modules/startup/interfaces/module_login_delegate_interface.h @@ -1,7 +1,5 @@ #pragma once -#include - namespace Modules { namespace Startup @@ -9,10 +7,7 @@ namespace Startup class ModuleLoginDelegateInterface { public: - virtual void loginDidLoad() - { - throw std::domain_error("Not implemented"); - } + virtual void loginDidLoad() = 0; }; }; // namespace Startup }; // namespace Modules \ No newline at end of file diff --git a/src-cpp/app/modules/startup/interfaces/module_onboarding_delegate_interface.h b/src-cpp/app/modules/startup/interfaces/module_onboarding_delegate_interface.h index 4e24fd9e8e..586ce75446 100644 --- a/src-cpp/app/modules/startup/interfaces/module_onboarding_delegate_interface.h +++ b/src-cpp/app/modules/startup/interfaces/module_onboarding_delegate_interface.h @@ -1,7 +1,5 @@ #pragma once -#include - namespace Modules { namespace Startup @@ -9,10 +7,7 @@ namespace Startup class ModuleOnboardingDelegateInterface { public: - virtual void onboardingDidLoad() - { - throw std::domain_error("Not implemented"); - } + virtual void onboardingDidLoad() = 0; }; }; // namespace Startup }; // namespace Modules \ No newline at end of file diff --git a/src-cpp/app/modules/startup/interfaces/module_view_delegate_interface.h b/src-cpp/app/modules/startup/interfaces/module_view_delegate_interface.h index fac1ef1e3f..459ef56729 100644 --- a/src-cpp/app/modules/startup/interfaces/module_view_delegate_interface.h +++ b/src-cpp/app/modules/startup/interfaces/module_view_delegate_interface.h @@ -1,7 +1,5 @@ #pragma once -#include - namespace Modules { namespace Startup @@ -9,10 +7,7 @@ namespace Startup class ModuleViewDelegateInterface { public: - virtual void viewDidLoad() - { - throw std::domain_error("Not implemented"); - } + virtual void viewDidLoad() = 0; }; }; // namespace Startup }; // namespace Modules \ No newline at end of file diff --git a/src-cpp/app/modules/startup/login/controller.cpp b/src-cpp/app/modules/startup/login/controller.cpp index 09f58951c7..dc1ca3f3f1 100644 --- a/src-cpp/app/modules/startup/login/controller.cpp +++ b/src-cpp/app/modules/startup/login/controller.cpp @@ -13,13 +13,13 @@ namespace Startup { namespace Login { -Controller::Controller(ModuleControllerDelegateInterface* d, +Controller::Controller(ModuleControllerDelegateInterface* delegate, // keychainService Accounts::ServiceInterface* accountsService, QObject* parent) : QObject(parent) , m_accountsService(accountsService) - , m_delegate(d) + , m_delegate(delegate) { } void Controller::init() diff --git a/src-cpp/app/modules/startup/login/controller.h b/src-cpp/app/modules/startup/login/controller.h index b6203e9fdf..05d69dbbe8 100644 --- a/src-cpp/app/modules/startup/login/controller.h +++ b/src-cpp/app/modules/startup/login/controller.h @@ -19,7 +19,7 @@ class Controller : public QObject, ControllerInterface Q_OBJECT public: - Controller(ModuleControllerDelegateInterface* d, + Controller(ModuleControllerDelegateInterface* delegate, // keychainService, Accounts::ServiceInterface* accountsService, QObject* parent = nullptr); diff --git a/src-cpp/app/modules/startup/login/controller_interface.h b/src-cpp/app/modules/startup/login/controller_interface.h index 0d1c1c0f4d..47bd931d5d 100644 --- a/src-cpp/app/modules/startup/login/controller_interface.h +++ b/src-cpp/app/modules/startup/login/controller_interface.h @@ -14,22 +14,13 @@ namespace Login class ControllerInterface { public: - virtual void init() - { - throw std::domain_error("Not implemented"); - } - virtual QVector getOpenedAccounts() - { - throw std::domain_error("Not implemented"); - } - virtual void setSelectedAccountKeyUid(QString keyUid) - { - throw std::domain_error("Not implemented"); - } - virtual void login(QString password) - { - throw std::domain_error("Not implemented"); - } + virtual void init() = 0; + + virtual QVector getOpenedAccounts() = 0; + + virtual void setSelectedAccountKeyUid(QString keyUid) = 0; + + virtual void login(QString password) = 0; }; } // namespace Login } // namespace Startup diff --git a/src-cpp/app/modules/startup/login/interfaces/module_controller_delegate_interface.h b/src-cpp/app/modules/startup/login/interfaces/module_controller_delegate_interface.h index 821be14cb3..f9d169f3d0 100644 --- a/src-cpp/app/modules/startup/login/interfaces/module_controller_delegate_interface.h +++ b/src-cpp/app/modules/startup/login/interfaces/module_controller_delegate_interface.h @@ -1,10 +1,5 @@ #pragma once -#include "accounts/service_interface.h" -#include "app_controller_delegate.h" -#include "controller.h" -#include - namespace Modules { namespace Startup @@ -14,20 +9,11 @@ namespace Login class ModuleControllerDelegateInterface { public: - virtual void emitAccountLoginError(QString error) - { - throw std::domain_error("Not implemented"); - } + virtual void emitAccountLoginError(QString error) = 0; - virtual void emitObtainingPasswordError(QString errorDescription) - { - throw std::domain_error("Not implemented"); - } + virtual void emitObtainingPasswordError(QString errorDescription) = 0; - virtual void emitObtainingPasswordSuccess(QString password) - { - throw std::domain_error("Not implemented"); - } + virtual void emitObtainingPasswordSuccess(QString password) = 0; }; }; // namespace Login }; // namespace Startup diff --git a/src-cpp/app/modules/startup/login/interfaces/module_view_delegate_interface.h b/src-cpp/app/modules/startup/login/interfaces/module_view_delegate_interface.h index df767fc247..678df2d235 100644 --- a/src-cpp/app/modules/startup/login/interfaces/module_view_delegate_interface.h +++ b/src-cpp/app/modules/startup/login/interfaces/module_view_delegate_interface.h @@ -1,7 +1,6 @@ #pragma once #include "../item.h" #include -#include namespace Modules { @@ -12,20 +11,11 @@ namespace Login class ModuleViewDelegateInterface { public: - virtual void viewDidLoad() - { - throw std::domain_error("Not implemented"); - } + virtual void viewDidLoad() = 0; - virtual void setSelectedAccount(Item item) - { - throw std::domain_error("Not implemented"); - } + virtual void setSelectedAccount(Item item) = 0; - virtual void login(QString password) - { - throw std::domain_error("Not implemented"); - } + virtual void login(QString password) = 0; }; }; // namespace Login }; // namespace Startup diff --git a/src-cpp/app/modules/startup/login/module.cpp b/src-cpp/app/modules/startup/login/module.cpp index 1dc7eae00e..d042e1f155 100644 --- a/src-cpp/app/modules/startup/login/module.cpp +++ b/src-cpp/app/modules/startup/login/module.cpp @@ -17,11 +17,11 @@ namespace Startup { namespace Login { -Module::Module(Modules::Startup::ModuleLoginDelegateInterface* d, +Module::Module(Modules::Startup::ModuleLoginDelegateInterface* delegate, // keychainService Accounts::ServiceInterface* accountsService) + : m_delegate(delegate) { - m_delegate = d; m_controller = new Controller(this, accountsService); m_view = new View(this); m_moduleLoaded = false; @@ -33,7 +33,7 @@ Module::~Module() delete m_view; } -void Module::extractImages(Accounts::AccountDto account, QString &thumbnailImage, QString &largeImage) +void Module::extractImages(Accounts::AccountDto account, QString& thumbnailImage, QString& largeImage) { foreach(const Accounts::Image& img, account.images) { diff --git a/src-cpp/app/modules/startup/login/module.h b/src-cpp/app/modules/startup/login/module.h index dce1964ec7..06025002d4 100644 --- a/src-cpp/app/modules/startup/login/module.h +++ b/src-cpp/app/modules/startup/login/module.h @@ -26,7 +26,7 @@ private: bool m_moduleLoaded; public: - Module(Modules::Startup::ModuleLoginDelegateInterface* d, + Module(Modules::Startup::ModuleLoginDelegateInterface* delegate, // keychainService Accounts::ServiceInterface* accountsService); ~Module(); diff --git a/src-cpp/app/modules/startup/login/module_access_interface.h b/src-cpp/app/modules/startup/login/module_access_interface.h index 9d6d2703cf..389a2cd7ce 100644 --- a/src-cpp/app/modules/startup/login/module_access_interface.h +++ b/src-cpp/app/modules/startup/login/module_access_interface.h @@ -1,7 +1,5 @@ #pragma once -#include - namespace Modules { namespace Startup @@ -11,15 +9,9 @@ namespace Login class ModuleAccessInterface { public: - virtual void load() - { - throw std::domain_error("Not implemented"); - } + virtual void load() = 0; - virtual bool isLoaded() - { - throw std::domain_error("Not implemented"); - } + virtual bool isLoaded() = 0; }; }; // namespace Login }; // namespace Startup diff --git a/src-cpp/app/modules/startup/login/view.cpp b/src-cpp/app/modules/startup/login/view.cpp index b29e37317b..a3351962a2 100644 --- a/src-cpp/app/modules/startup/login/view.cpp +++ b/src-cpp/app/modules/startup/login/view.cpp @@ -11,10 +11,10 @@ namespace Startup { namespace Login { -View::View(ModuleViewDelegateInterface* d, QObject* parent) +View::View(ModuleViewDelegateInterface* delegate, QObject* parent) : QObject(parent) + , m_delegate(delegate) { - m_delegate = d; m_model = new Model(); m_selectedAccount = new SelectedAccount(); } diff --git a/src-cpp/app/modules/startup/login/view.h b/src-cpp/app/modules/startup/login/view.h index 6d959490af..ae749c0a11 100644 --- a/src-cpp/app/modules/startup/login/view.h +++ b/src-cpp/app/modules/startup/login/view.h @@ -21,7 +21,7 @@ class View : public QObject Q_PROPERTY(Model* accountsModel READ getModel NOTIFY modelChanged) public: - explicit View(ModuleViewDelegateInterface* d, QObject* parent = nullptr); + explicit View(ModuleViewDelegateInterface* delegate, QObject* parent = nullptr); ~View(); void load(); diff --git a/src-cpp/app/modules/startup/module.cpp b/src-cpp/app/modules/startup/module.cpp index 0c466496c3..35ff3b99ae 100644 --- a/src-cpp/app/modules/startup/module.cpp +++ b/src-cpp/app/modules/startup/module.cpp @@ -14,12 +14,11 @@ namespace Modules { namespace Startup { -Module::Module(AppControllerDelegate* d, +Module::Module(AppControllerDelegate* delegate, /*keychainService,*/ Accounts::ServiceInterface* accountsService) - + : m_delegate(delegate) { - m_delegate = d; m_controller = new Controller(this, accountsService); m_view = new View(this); diff --git a/src-cpp/app/modules/startup/module.h b/src-cpp/app/modules/startup/module.h index 14d97c35cd..52ec026b2e 100644 --- a/src-cpp/app/modules/startup/module.h +++ b/src-cpp/app/modules/startup/module.h @@ -32,7 +32,7 @@ private: Modules::Startup::Login::ModuleAccessInterface* m_loginModule; public: - Module(AppControllerDelegate* d, + Module(AppControllerDelegate* delegate, /*keychainService,*/ Accounts::ServiceInterface* accountsService); ~Module(); void load() override; diff --git a/src-cpp/app/modules/startup/module_access_interface.h b/src-cpp/app/modules/startup/module_access_interface.h index 8ded7fc7fa..1aec7bb407 100644 --- a/src-cpp/app/modules/startup/module_access_interface.h +++ b/src-cpp/app/modules/startup/module_access_interface.h @@ -1,7 +1,5 @@ #pragma once -#include - namespace Modules { namespace Startup @@ -9,15 +7,9 @@ namespace Startup class ModuleAccessInterface { public: - virtual void load() - { - throw std::domain_error("Not implemented"); - } + virtual void load() = 0; - virtual void moveToAppState() - { - throw std::domain_error("Not implemented"); - } + virtual void moveToAppState() = 0; }; }; // namespace Startup }; // namespace Modules diff --git a/src-cpp/app/modules/startup/onboarding/controller.cpp b/src-cpp/app/modules/startup/onboarding/controller.cpp index a15552c9c4..f66e127312 100644 --- a/src-cpp/app/modules/startup/onboarding/controller.cpp +++ b/src-cpp/app/modules/startup/onboarding/controller.cpp @@ -13,12 +13,12 @@ namespace Startup { namespace Onboarding { -Controller::Controller(ModuleControllerDelegateInterface* d, +Controller::Controller(ModuleControllerDelegateInterface* delegate, Accounts::ServiceInterface* accountsService, QObject* parent) : QObject(parent) , m_accountsService(accountsService) - , m_delegate(d) + , m_delegate(delegate) { } void Controller::init() diff --git a/src-cpp/app/modules/startup/onboarding/controller.h b/src-cpp/app/modules/startup/onboarding/controller.h index e48d14be82..cd9844c508 100644 --- a/src-cpp/app/modules/startup/onboarding/controller.h +++ b/src-cpp/app/modules/startup/onboarding/controller.h @@ -19,7 +19,7 @@ class Controller : public QObject, ControllerInterface Q_OBJECT public: - Controller(ModuleControllerDelegateInterface* d, + Controller(ModuleControllerDelegateInterface* delegate, Accounts::ServiceInterface* accountsService, QObject* parent = nullptr); void init() override; diff --git a/src-cpp/app/modules/startup/onboarding/controller_interface.h b/src-cpp/app/modules/startup/onboarding/controller_interface.h index 1a236c2a4a..3b01acffa6 100644 --- a/src-cpp/app/modules/startup/onboarding/controller_interface.h +++ b/src-cpp/app/modules/startup/onboarding/controller_interface.h @@ -14,34 +14,19 @@ namespace Onboarding class ControllerInterface { public: - virtual void init() - { - throw std::domain_error("Not implemented"); - } - virtual QVector getGeneratedAccounts() - { - throw std::domain_error("Not implemented"); - } - virtual void setSelectedAccountByIndex(int index) - { - throw std::domain_error("Not implemented"); - } - virtual void storeSelectedAccountAndLogin(QString password) - { - throw std::domain_error("Not implemented"); - } - virtual Accounts::GeneratedAccountDto getImportedAccount() - { - throw std::domain_error("Not implemented"); - } - virtual QString validateMnemonic(QString mnemonic) - { - throw std::domain_error("Not implemented"); - } - virtual void importMnemonic(QString mnemonic) - { - throw std::domain_error("Not implemented"); - } + virtual void init() = 0; + + virtual QVector getGeneratedAccounts() = 0; + + virtual void setSelectedAccountByIndex(int index) = 0; + + virtual void storeSelectedAccountAndLogin(QString password) = 0; + + virtual Accounts::GeneratedAccountDto getImportedAccount() = 0; + + virtual QString validateMnemonic(QString mnemonic) = 0; + + virtual void importMnemonic(QString mnemonic) = 0; }; } // namespace Onboarding } // namespace Startup diff --git a/src-cpp/app/modules/startup/onboarding/interfaces/module_controller_delegate_interface.h b/src-cpp/app/modules/startup/onboarding/interfaces/module_controller_delegate_interface.h index 030237bdc4..340bf87932 100644 --- a/src-cpp/app/modules/startup/onboarding/interfaces/module_controller_delegate_interface.h +++ b/src-cpp/app/modules/startup/onboarding/interfaces/module_controller_delegate_interface.h @@ -1,10 +1,5 @@ #pragma once -#include "accounts/service_interface.h" -#include "app_controller_delegate.h" -#include "controller.h" -#include - namespace Modules { namespace Startup @@ -14,20 +9,11 @@ namespace Onboarding class ModuleControllerDelegateInterface { public: - virtual void setupAccountError() - { - throw std::domain_error("Not implemented"); - } + virtual void setupAccountError() = 0; - virtual void importAccountError() - { - throw std::domain_error("Not implemented"); - } + virtual void importAccountError() = 0; - virtual void importAccountSuccess() - { - throw std::domain_error("Not implemented"); - } + virtual void importAccountSuccess() = 0; }; }; // namespace Onboarding }; // namespace Startup diff --git a/src-cpp/app/modules/startup/onboarding/interfaces/module_view_delegate_interface.h b/src-cpp/app/modules/startup/onboarding/interfaces/module_view_delegate_interface.h index 6f8199a627..efcb1579be 100644 --- a/src-cpp/app/modules/startup/onboarding/interfaces/module_view_delegate_interface.h +++ b/src-cpp/app/modules/startup/onboarding/interfaces/module_view_delegate_interface.h @@ -1,7 +1,6 @@ #pragma once #include "accounts/generated_account.h" #include -#include namespace Modules { @@ -12,35 +11,17 @@ namespace Onboarding class ModuleViewDelegateInterface { public: - virtual void viewDidLoad() - { - throw std::domain_error("Not implemented"); - } + virtual void viewDidLoad() = 0; - virtual void setSelectedAccountByIndex(int index) - { - throw std::domain_error("Not implemented"); - } + virtual void setSelectedAccountByIndex(int index) = 0; - virtual void storeSelectedAccountAndLogin(QString password) - { - throw std::domain_error("Not implemented"); - } + virtual void storeSelectedAccountAndLogin(QString password) = 0; - virtual Accounts::GeneratedAccountDto getImportedAccount() - { - throw std::domain_error("Not implemented"); - } + virtual Accounts::GeneratedAccountDto getImportedAccount() = 0; - virtual QString validateMnemonic(QString mnemonic) - { - throw std::domain_error("Not implemented"); - } + virtual QString validateMnemonic(QString mnemonic) = 0; - virtual void importMnemonic(QString mnemonic) - { - throw std::domain_error("Not implemented"); - } + virtual void importMnemonic(QString mnemonic) = 0; }; }; // namespace Onboarding }; // namespace Startup diff --git a/src-cpp/app/modules/startup/onboarding/module.cpp b/src-cpp/app/modules/startup/onboarding/module.cpp index fe341b9f71..6961bf54ab 100644 --- a/src-cpp/app/modules/startup/onboarding/module.cpp +++ b/src-cpp/app/modules/startup/onboarding/module.cpp @@ -1,14 +1,14 @@ #include "module.h" +#include "../interfaces/module_onboarding_delegate_interface.h" #include "accounts/generated_account.h" #include "accounts/service_interface.h" -#include "../interfaces/module_onboarding_delegate_interface.h" #include "controller.h" #include "singleton.h" #include "view.h" +#include #include #include #include -#include #include namespace Modules @@ -17,9 +17,10 @@ namespace Startup { namespace Onboarding { -Module::Module(Modules::Startup::ModuleOnboardingDelegateInterface* d, Accounts::ServiceInterface* accountsService) +Module::Module(Modules::Startup::ModuleOnboardingDelegateInterface* delegate, + Accounts::ServiceInterface* accountsService) + : m_delegate(delegate) { - m_delegate = d; m_controller = new Controller(this, accountsService); m_view = new View(this); m_moduleLoaded = false; diff --git a/src-cpp/app/modules/startup/onboarding/module.h b/src-cpp/app/modules/startup/onboarding/module.h index 6637d9fde2..b054e544ba 100644 --- a/src-cpp/app/modules/startup/onboarding/module.h +++ b/src-cpp/app/modules/startup/onboarding/module.h @@ -25,7 +25,7 @@ private: bool m_moduleLoaded; public: - Module(Modules::Startup::ModuleOnboardingDelegateInterface* d, Accounts::ServiceInterface* accountsService); + Module(Modules::Startup::ModuleOnboardingDelegateInterface* delegate, Accounts::ServiceInterface* accountsService); ~Module(); void load() override; bool isLoaded() override; diff --git a/src-cpp/app/modules/startup/onboarding/module_access_interface.h b/src-cpp/app/modules/startup/onboarding/module_access_interface.h index 1627196bf0..22ef8cc13f 100644 --- a/src-cpp/app/modules/startup/onboarding/module_access_interface.h +++ b/src-cpp/app/modules/startup/onboarding/module_access_interface.h @@ -1,7 +1,5 @@ #pragma once -#include - namespace Modules { namespace Startup @@ -11,15 +9,9 @@ namespace Onboarding class ModuleAccessInterface { public: - virtual void load() - { - throw std::domain_error("Not implemented"); - } + virtual void load() = 0; - virtual bool isLoaded() - { - throw std::domain_error("Not implemented"); - } + virtual bool isLoaded() = 0; }; }; // namespace Onboarding }; // namespace Startup diff --git a/src-cpp/app/modules/startup/onboarding/view.cpp b/src-cpp/app/modules/startup/onboarding/view.cpp index 79c317767c..9114526733 100644 --- a/src-cpp/app/modules/startup/onboarding/view.cpp +++ b/src-cpp/app/modules/startup/onboarding/view.cpp @@ -1,7 +1,7 @@ #include "view.h" #include "interfaces/module_view_delegate_interface.h" -#include #include +#include namespace Modules { @@ -9,10 +9,10 @@ namespace Startup { namespace Onboarding { -View::View(ModuleViewDelegateInterface* d, QObject* parent) +View::View(ModuleViewDelegateInterface* delegate, QObject* parent) : QObject(parent) + , m_delegate(delegate) { - m_delegate = d; m_model = new Model(); } diff --git a/src-cpp/app/modules/startup/onboarding/view.h b/src-cpp/app/modules/startup/onboarding/view.h index 8665a16934..468b5221ed 100644 --- a/src-cpp/app/modules/startup/onboarding/view.h +++ b/src-cpp/app/modules/startup/onboarding/view.h @@ -22,7 +22,7 @@ class View : public QObject Q_PROPERTY(QString importedAccountAddress READ getImportedAccountAddress NOTIFY importedAccountChanged) public: - explicit View(ModuleViewDelegateInterface* d, QObject* parent = nullptr); + explicit View(ModuleViewDelegateInterface* delegate, QObject* parent = nullptr); ~View(); void load(); diff --git a/src-cpp/app/modules/startup/view.cpp b/src-cpp/app/modules/startup/view.cpp index d2557dbd48..8a385602cf 100644 --- a/src-cpp/app/modules/startup/view.cpp +++ b/src-cpp/app/modules/startup/view.cpp @@ -7,12 +7,11 @@ namespace Modules namespace Startup { -View::View(ModuleViewDelegateInterface* d, QObject* parent) +View::View(ModuleViewDelegateInterface* delegate, QObject* parent) : QObject(parent) , m_appState(AppState::OnboardingState) -{ - m_delegate = d; -} + , m_delegate(delegate) +{ } void View::load() { diff --git a/src-cpp/app/modules/startup/view.h b/src-cpp/app/modules/startup/view.h index edd6854fa4..ba4fb43e21 100644 --- a/src-cpp/app/modules/startup/view.h +++ b/src-cpp/app/modules/startup/view.h @@ -21,7 +21,7 @@ class View : public QObject Q_PROPERTY(int appState READ getAppState NOTIFY appStateChanged) public: - explicit View(ModuleViewDelegateInterface* d, QObject* parent = nullptr); + explicit View(ModuleViewDelegateInterface* delegate, QObject* parent = nullptr); void emitLogOut(); void setAppState(AppState state); void load(); diff --git a/src-cpp/app_service/include/accounts/service_interface.h b/src-cpp/app_service/include/accounts/service_interface.h index 50ca24da42..467cef37ce 100644 --- a/src-cpp/app_service/include/accounts/service_interface.h +++ b/src-cpp/app_service/include/accounts/service_interface.h @@ -6,7 +6,6 @@ #include #include #include -#include namespace Accounts { @@ -14,70 +13,31 @@ namespace Accounts class ServiceInterface : public AppService { public: - virtual QVector openedAccounts() - { - throw std::domain_error("Not implemented"); - } + virtual QVector openedAccounts() = 0; - virtual QVector generatedAccounts() - { - throw std::domain_error("Not implemented"); - } + virtual QVector generatedAccounts() = 0; - virtual bool setupAccount(QString accountId, QString password) - { - throw std::domain_error("Not implemented"); - } + virtual bool setupAccount(QString accountId, QString password) = 0; - virtual AccountDto getLoggedInAccount() - { - throw std::domain_error("Not implemented"); - } + virtual AccountDto getLoggedInAccount() = 0; - virtual GeneratedAccountDto getImportedAccount() - { - throw std::domain_error("Not implemented"); - } + virtual GeneratedAccountDto getImportedAccount() = 0; - virtual bool isFirstTimeAccountLogin() - { - throw std::domain_error("Not implemented"); - } + virtual bool isFirstTimeAccountLogin() = 0; - virtual QString validateMnemonic(QString mnemonic) - { - throw std::domain_error("Not implemented"); - } + virtual QString validateMnemonic(QString mnemonic) = 0; - virtual bool importMnemonic(QString mnemonic) - { - throw std::domain_error("Not implemented"); - } + virtual bool importMnemonic(QString mnemonic) = 0; - virtual QString login(AccountDto account, QString password) - { - throw std::domain_error("Not implemented"); - } + virtual QString login(AccountDto account, QString password) = 0; - virtual void clear() - { - throw std::domain_error("Not implemented"); - } + virtual void clear() = 0; - virtual QString generateAlias(QString publicKey) - { - throw std::domain_error("Not implemented"); - } + virtual QString generateAlias(QString publicKey) = 0; - virtual QString generateIdenticon(QString publicKey) - { - throw std::domain_error("Not implemented"); - } + virtual QString generateIdenticon(QString publicKey) = 0; - virtual bool verifyAccountPassword(QString account, QString password) - { - throw std::domain_error("Not implemented"); - } + virtual bool verifyAccountPassword(QString account, QString password) = 0; }; } // namespace Accounts \ No newline at end of file diff --git a/src-cpp/app_service/include/app_service.h b/src-cpp/app_service/include/app_service.h index d015e2960d..36897216c1 100644 --- a/src-cpp/app_service/include/app_service.h +++ b/src-cpp/app_service/include/app_service.h @@ -1,12 +1,7 @@ #pragma once -#include - class AppService { public: - virtual void init() - { - throw std::domain_error("Not implemented"); - } + virtual void init() = 0; };