From 73ee3a27d92cb1237877bdcd8d653647949b83ff Mon Sep 17 00:00:00 2001 From: malte_langkabel Date: Thu, 14 Apr 2016 15:25:40 +0200 Subject: [PATCH] logic: iterated on license checking - moved LicenseChecker from App to Lib project - added MessageDispatchWhenLicenseValid. This message takes another message as an argument which is dispatched once the LicenseChecher confirms the current license key or (if the key is invalid) once the user entered a valid key. This message is used when messages are sent that should not be working when no license key has been entered (LoadProject or ActivateTokenLocation via the IDE communication). - added MessageShowStartScreen which makes the MainView display this screen. This message is also sent via the MessageDispatchWhenLicenseValid. - removed startup project from appsettings. --- CMakeLists.txt | 165 +++++++++--------- bin/app/user/ApplicationSettings_template.xml | 2 - cmake/publicKey.cmake | 2 +- src/app/CMakeLists.txt | 1 - src/app/LicenseChecker.h | 148 ---------------- src/app/main.cpp | 6 +- .../utility/commandline/CommandLineParser.cpp | 9 +- src/lib/Application.cpp | 15 +- src/lib/Application.h | 2 +- src/lib/CMakeLists.txt | 4 + src/lib/LicenseChecker.cpp | 117 +++++++++++++ src/lib/LicenseChecker.h | 38 ++++ .../controller/IDECommunicationController.cpp | 15 +- src/lib/component/view/MainView.h | 2 +- src/lib/settings/ApplicationSettings.cpp | 5 - src/lib/settings/ApplicationSettings.h | 2 - src/lib/settings/ColorScheme.h | 4 +- src/lib/utility/messaging/MessageQueue.cpp | 6 +- src/lib/utility/messaging/MessageQueue.h | 6 +- .../type/MessageDispatchWhenLicenseValid.h | 23 +++ .../messaging/type/MessageShowStartScreen.h | 20 +++ src/lib_gui/qt/QtApplication.cpp | 5 +- src/lib_gui/qt/view/QtMainView.cpp | 40 ++++- src/lib_gui/qt/view/QtMainView.h | 19 +- src/lib_gui/qt/window/QtMainWindow.cpp | 37 ++-- src/lib_gui/qt/window/QtMainWindow.h | 13 +- src/lib_gui/qt/window/QtStartScreen.cpp | 20 ++- .../project_wizzard/QtProjectWizzard.cpp | 6 +- src/trial/main.cpp | 7 +- 29 files changed, 406 insertions(+), 333 deletions(-) delete mode 100644 src/app/LicenseChecker.h create mode 100644 src/lib/LicenseChecker.cpp create mode 100644 src/lib/LicenseChecker.h create mode 100644 src/lib/utility/messaging/type/MessageDispatchWhenLicenseValid.h create mode 100644 src/lib/utility/messaging/type/MessageShowStartScreen.h diff --git a/CMakeLists.txt b/CMakeLists.txt index f0a1e009..5ae3249d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,85 +123,6 @@ else() set(BOTAN_INCLUDE_DIR "$ENV{BOTAN_DIR}") endif() -# Lib -------------------------------------------------------------------------- - -#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib) -#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib) - -add_subdirectory(src/lib) -add_subdirectory(src/external) - -set_source_files_properties(${EXTERNAL_FILES} PROPERTIES COMPILE_FLAGS "-w") -set_source_files_properties(${EXTERNAL_C_FILES} PROPERTIES COMPILE_FLAGS "-std=gnu89 -w") - -add_library(${LIB_PROJECT_NAME} ${LIB_FILES} ${EXTERNAL_FILES} ${EXTERNAL_C_FILES}) - -create_source_groups(${LIB_FILES}) -create_source_groups(${EXTERNAL_FILES}) -create_source_groups(${EXTERNAL_C_FILES}) - -set_target_properties( - ${LIB_PROJECT_NAME} - PROPERTIES - DEBUG_OUTPUT_NAME ${PROJECT_NAME}_d - RELEASE_OUTPUT_NAME ${PROJECT_NAME} -) - -set_property( - TARGET ${LIB_PROJECT_NAME} - PROPERTY INCLUDE_DIRECTORIES - "${CMAKE_SOURCE_DIR}/src/lib" -) - -target_include_directories(${LIB_PROJECT_NAME} SYSTEM - PUBLIC ${LLVM_INCLUDE_DIRS} - ${CLANG_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} - ${EIGEN_ROOT} - "${CMAKE_SOURCE_DIR}/src/external" -) - -target_link_libraries(${LIB_PROJECT_NAME} ${Boost_LIBRARIES}) - -# Lib Parser ------------------------------------------------------------------- - -#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_parser) -#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_parser) - -add_subdirectory(src/lib_parser) - -set_source_files_properties(${CLANG_FILES} PROPERTIES COMPILE_FLAGS "-fno-rtti") - -add_library(${LIB_PARSER_PROJECT_NAME} ${CLANG_FILES}) - -create_source_groups(${CLANG_FILES}) - -set_property( - TARGET ${LIB_PARSER_PROJECT_NAME} - PROPERTY INCLUDE_DIRECTORIES - "${CMAKE_SOURCE_DIR}/src/lib_parser" - "${CMAKE_SOURCE_DIR}/src/lib" -) - -set_target_properties( - ${LIB_PARSER_PROJECT_NAME} - PROPERTIES - DEBUG_OUTPUT_NAME ${LIB_PARSER_PROJECT_NAME}_d - RELEASE_OUTPUT_NAME ${LIB_PARSER_PROJECT_NAME} -) - -target_include_directories(${LIB_PARSER_PROJECT_NAME} SYSTEM - PUBLIC ${LLVM_INCLUDE_DIRS} - ${CLANG_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} -) - -link_directories(${LLVM_LIBRARY_DIRS} ${CLANG_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS}) -llvm_map_components_to_libnames(REQ_LLVM_LIBS support core libdriver) - -#target_link_libraries(${LIB_PARSER_PROJECT_NAME} ${CLANG_LIBRARIES} ${LLVM_AVAILABLE_LIBS}) -target_link_libraries(${LIB_PARSER_PROJECT_NAME} ${CLANG_LIBRARIES} ${REQ_LLVM_LIBS}) - # Lib License ------------------------------------------------------------------- #set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_license) @@ -246,6 +167,86 @@ else() target_link_libraries(${LIB_LICENSE_PROJECT_NAME} optimized ${BOTAN}) endif() +# Lib -------------------------------------------------------------------------- + +#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib) +#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib) + +add_subdirectory(src/lib) +add_subdirectory(src/external) + +set_source_files_properties(${EXTERNAL_FILES} PROPERTIES COMPILE_FLAGS "-w") +set_source_files_properties(${EXTERNAL_C_FILES} PROPERTIES COMPILE_FLAGS "-std=gnu89 -w") + +add_library(${LIB_PROJECT_NAME} ${LIB_FILES} ${EXTERNAL_FILES} ${EXTERNAL_C_FILES}) + +create_source_groups(${LIB_FILES}) +create_source_groups(${EXTERNAL_FILES}) +create_source_groups(${EXTERNAL_C_FILES}) + +set_target_properties( + ${LIB_PROJECT_NAME} + PROPERTIES + DEBUG_OUTPUT_NAME ${PROJECT_NAME}_d + RELEASE_OUTPUT_NAME ${PROJECT_NAME} +) + +set_property( + TARGET ${LIB_PROJECT_NAME} + PROPERTY INCLUDE_DIRECTORIES + "${CMAKE_SOURCE_DIR}/src/lib" + "${CMAKE_SOURCE_DIR}/src/lib_license" + "${CMAKE_SOURCE_DIR}/build/src/lib_license" +) + +target_include_directories(${LIB_PROJECT_NAME} SYSTEM + PUBLIC ${LLVM_INCLUDE_DIRS} + ${CLANG_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} + ${EIGEN_ROOT} + "${CMAKE_SOURCE_DIR}/src/external" +) + +target_link_libraries(${LIB_PROJECT_NAME} ${Boost_LIBRARIES} ${LIB_LICENSE_PROJECT_NAME}) + +# Lib Parser ------------------------------------------------------------------- + +#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_parser) +#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_parser) + +add_subdirectory(src/lib_parser) + +set_source_files_properties(${CLANG_FILES} PROPERTIES COMPILE_FLAGS "-fno-rtti") + +add_library(${LIB_PARSER_PROJECT_NAME} ${CLANG_FILES}) + +create_source_groups(${CLANG_FILES}) + +set_property( + TARGET ${LIB_PARSER_PROJECT_NAME} + PROPERTY INCLUDE_DIRECTORIES + "${CMAKE_SOURCE_DIR}/src/lib_parser" + "${CMAKE_SOURCE_DIR}/src/lib" +) + +set_target_properties( + ${LIB_PARSER_PROJECT_NAME} + PROPERTIES + DEBUG_OUTPUT_NAME ${LIB_PARSER_PROJECT_NAME}_d + RELEASE_OUTPUT_NAME ${LIB_PARSER_PROJECT_NAME} +) + +target_include_directories(${LIB_PARSER_PROJECT_NAME} SYSTEM + PUBLIC ${LLVM_INCLUDE_DIRS} + ${CLANG_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} +) + +link_directories(${LLVM_LIBRARY_DIRS} ${CLANG_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS}) +llvm_map_components_to_libnames(REQ_LLVM_LIBS support core libdriver) + +target_link_libraries(${LIB_PARSER_PROJECT_NAME} ${CLANG_LIBRARIES} ${REQ_LLVM_LIBS}) + # Lib Gui ---------------------------------------------------------------------- #set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib_gui) @@ -368,7 +369,7 @@ if (WIN32) "IDI_ICON1 ICON \"${CMAKE_SOURCE_DIR}/build/coati.ico\"\n" ) - add_executable(${APP_PROJECT_NAME} ${APP_FILES} ${CLANG_FILES} ${GEN_FILES} ${CMAKE_SOURCE_DIR}/build/Coati.rc ${CMAKE_SOURCE_DIR}/build/src/lib_gui/version.h) + add_executable(${APP_PROJECT_NAME} ${APP_FILES} ${CLANG_FILES} ${GEN_FILES} ${CMAKE_SOURCE_DIR}/build/Coati.rc) # hide the console when running a release build. set_target_properties(${APP_PROJECT_NAME} PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE") @@ -378,7 +379,7 @@ if (WIN32) set_target_properties(${APP_PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE "/ENTRY:\"mainCRTStartup\" /SUBSYSTEM:WINDOWS") set_target_properties(${APP_PROJECT_NAME} PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS") else () - add_executable(${APP_PROJECT_NAME} ${APP_FILES} ${GEN_FILES} ${CMAKE_SOURCE_DIR}/build/src/lib_gui/version.h) + add_executable(${APP_PROJECT_NAME} ${APP_FILES} ${GEN_FILES}) endif () create_source_groups(${APP_FILES}) @@ -394,6 +395,7 @@ set_property( "${CMAKE_SOURCE_DIR}/src/lib_license" "${CMAKE_SOURCE_DIR}/src/lib_parser" "${CMAKE_SOURCE_DIR}/build/src/lib_gui" + "${CMAKE_SOURCE_DIR}/build/src/lib_license" "${CMAKE_SOURCE_DIR}/build/src/app" ) @@ -460,6 +462,7 @@ set_property( "${CMAKE_SOURCE_DIR}/src/lib" "${CMAKE_SOURCE_DIR}/src/lib_gui" "${CMAKE_SOURCE_DIR}/build/src/lib_gui" + "${CMAKE_SOURCE_DIR}/build/src/lib_license" ) target_include_directories(${TRIAL_PROJECT_NAME} SYSTEM diff --git a/bin/app/user/ApplicationSettings_template.xml b/bin/app/user/ApplicationSettings_template.xml index e07f4192..e6e665b7 100644 --- a/bin/app/user/ApplicationSettings_template.xml +++ b/bin/app/user/ApplicationSettings_template.xml @@ -7,8 +7,6 @@ - - diff --git a/cmake/publicKey.cmake b/cmake/publicKey.cmake index 6941f8c6..5b3a59de 100644 --- a/cmake/publicKey.cmake +++ b/cmake/publicKey.cmake @@ -18,5 +18,5 @@ endif() configure_file( ${CMAKE_SOURCE_DIR}/cmake/PublicKey.h.in - ${CMAKE_SOURCE_DIR}/build/src/lib_gui/PublicKey.h + ${CMAKE_SOURCE_DIR}/build/src/lib_license/PublicKey.h ) \ No newline at end of file diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 907787cb..77e0440b 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -7,6 +7,5 @@ add_files( utility/commandline/CommandLineParser.h isTrial.cpp - LicenseChecker.h main.cpp ) diff --git a/src/app/LicenseChecker.h b/src/app/LicenseChecker.h deleted file mode 100644 index 46b9c8d1..00000000 --- a/src/app/LicenseChecker.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef LICENSE_CHECKER_H -#define LICENSE_CHECKER_H - -#include "utility/messaging/MessageListener.h" -#include "utility/messaging/type/MessageActivateTokenLocations.h" -#include "utility/messaging/type/MessageEnteredLicense.h" -#include "utility/messaging/type/MessageLoadProject.h" -#include "utility/messaging/type/MessageProjectNew.h" -#include "utility/messaging/type/MessageStatus.h" - -#include "Application.h" -#include "License.h" -#include "PublicKey.h" -#include "settings/ApplicationSettings.h" - -#include "utility/AppPath.h" - -class LicenseChecker - : public MessageListener - , public MessageListener - , public MessageListener - , public MessageListener -{ -public: - LicenseChecker() - : m_forcedLicenseEntering(false) - { - } - - inline void setApp(Application* app) - { - m_app = app; - if (!m_forcedLicenseEntering && !checkLicenseString()) - { - m_app->showLicenseScreen(); - m_forcedLicenseEntering = true; - } - } - -private: - void handleMessage(MessageEnteredLicense* message) - { - m_forcedLicenseEntering = false; - - if (m_resendMessage) - { - m_resendMessage->dispatch(); - m_resendMessage.reset(); - } - } - - void handleMessage(MessageLoadProject* message) - { - if (!checkLicenseString()) - { - m_resendMessage = std::make_shared(*message); - message->cancel(); - - if (!m_forcedLicenseEntering) - { - m_app->showLicenseScreen(); - m_forcedLicenseEntering = true; - } - } - } - - void handleMessage(MessageProjectNew* message) - { - if (!checkLicenseString()) - { - m_resendMessage = std::make_shared(*message); - message->cancel(); - - if (!m_forcedLicenseEntering) - { - m_app->showLicenseScreen(); - m_forcedLicenseEntering = true; - } - } - } - - void handleMessage(MessageActivateTokenLocations* message) - { - if (!checkLicenseString()) - { - m_resendMessage = std::make_shared(*message); - message->cancel(); - - if (!m_forcedLicenseEntering) - { - m_app->showLicenseScreen(); - m_forcedLicenseEntering = true; - } - } - } - - inline bool checkLicenseString() - { - MessageStatus("preparing...", false, true).dispatch(); - - bool valid = false; - do - { - ApplicationSettings* appSettings = ApplicationSettings::getInstance().get(); - - std::string licenseCheck = appSettings->getLicenseCheck(); - std::string appPath = AppPath::getAppPath(); // for easier debugging... - FilePath p(appPath); - - if (!License::checkLocation(p.absolute().str(), licenseCheck)) - { - break; - } - - std::string licenseString = appSettings->getLicenseString(); - if (licenseString.size() == 0) - { - break; - } - - License license; - bool isLoaded = license.loadFromEncodedString(licenseString,AppPath::getAppPath()); - if (!isLoaded) - { - break; - } - - license.loadPublicKeyFromString(PublicKey); - valid = license.isValid(); - if (license.isExpired()) - { - valid = false; - } - - } - while (false); - - MessageStatus("ready").dispatch(); - - return valid; - } - - Application* m_app; - std::shared_ptr m_resendMessage; - bool m_forcedLicenseEntering; -}; - -#endif // LICENSE_CHECKER_H diff --git a/src/app/main.cpp b/src/app/main.cpp index fcfaa772..fac9653b 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) } commandLineParser.projectLoad(); - + // todo: set app of license checker. return qtApp.exec(); } else @@ -81,12 +81,12 @@ int main(int argc, char *argv[]) QtViewFactory viewFactory; QtNetworkFactory networkFactory; - LicenseChecker checker; + std::shared_ptr checker = LicenseChecker::getInstance(); utility::loadFontsFromDirectory(ResourcePaths::getFontsPath(), ".otf"); std::shared_ptr app = Application::create(version, &viewFactory, &networkFactory); - checker.setApp(app.get()); + checker->setApp(app.get()); commandLineParser.projectLoad(); diff --git a/src/app/utility/commandline/CommandLineParser.cpp b/src/app/utility/commandline/CommandLineParser.cpp index 01661c9e..1d2b311d 100644 --- a/src/app/utility/commandline/CommandLineParser.cpp +++ b/src/app/utility/commandline/CommandLineParser.cpp @@ -2,13 +2,14 @@ #include "boost/program_options.hpp" -#include "License.h" -#include "PublicKey.h" #include "utility/ConfigManager.h" #include "utility/file/FileSystem.h" +#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h" #include "utility/messaging/type/MessageLoadProject.h" #include "utility/messaging/type/MessageStatus.h" #include "utility/text/TextAccess.h" +#include "License.h" +#include "PublicKey.h" namespace po = boost::program_options; @@ -175,7 +176,9 @@ void CommandLineParser::projectLoad() { if (!m_projectFile.empty()) { - MessageLoadProject(m_projectFile, m_force).dispatch(); + MessageDispatchWhenLicenseValid( + std::make_shared(m_projectFile, m_force) + ).dispatch(); } } diff --git a/src/lib/Application.cpp b/src/lib/Application.cpp index 67e3addc..cf73ab61 100644 --- a/src/lib/Application.cpp +++ b/src/lib/Application.cpp @@ -3,7 +3,9 @@ #include "utility/logging/logging.h" #include "utility/messaging/MessageQueue.h" #include "utility/messaging/type/MessageActivateNodes.h" +#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h" #include "utility/messaging/type/MessageStatus.h" +#include "utility/messaging/type/MessageShowStartScreen.h" #include "utility/scheduling/TaskScheduler.h" #include "utility/UserPaths.h" #include "utility/Version.h" @@ -31,18 +33,13 @@ std::shared_ptr Application::create( ptr->m_mainView = viewFactory->createMainView(); ptr->m_mainView->setTitle("Coati"); + MessageDispatchWhenLicenseValid(std::make_shared()).dispatch(); + ptr->m_componentManager->setup(ptr->m_mainView.get()); ptr->m_mainView->loadLayout(); ptr->m_project = Project::create(ptr->m_storageCache.get()); - std::string startupProjectFilePath = ApplicationSettings::getInstance()->getStartupProjectFilePath(); - if (startupProjectFilePath.size()) - { - MessageLoadProject(startupProjectFilePath, false).dispatch(); - ptr->m_mainView->hideStartScreen(); - } - ptr->m_ideCommunicationController = networkFactory->createIDECommunicationController(ptr->m_storageCache.get()); ptr->startMessagingAndScheduling(); @@ -138,11 +135,11 @@ void Application::saveProject(const FilePath& projectSettingsFilePath) } } -void Application::showLicenseScreen() +void Application::forceEnterLicense() { if (m_hasGUI) { - m_mainView->showLicenseScreen(); + m_mainView->forceLicenseScreen(); } } diff --git a/src/lib/Application.h b/src/lib/Application.h index 7e9423ed..7160f867 100644 --- a/src/lib/Application.h +++ b/src/lib/Application.h @@ -36,7 +36,7 @@ public: void loadProject(const FilePath& projectSettingsFilePath); void refreshProject(); void saveProject(const FilePath& projectSettingsFilePath); - void showLicenseScreen(); + void forceEnterLicense(); bool hasGUI(); private: diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt index 0e5a0d21..6449018e 100644 --- a/src/lib/CMakeLists.txt +++ b/src/lib/CMakeLists.txt @@ -228,6 +228,7 @@ add_files( utility/messaging/type/MessageChangeFileView.h utility/messaging/type/MessageClearErrorCount.h utility/messaging/type/MessageDeactivateEdge.h + utility/messaging/type/MessageDispatchWhenLicenseValid.h utility/messaging/type/MessageEnteredLicense.h utility/messaging/type/MessageFind.h utility/messaging/type/MessageFinishedParsing.h @@ -250,6 +251,7 @@ add_files( utility/messaging/type/MessageSearchAutocomplete.h utility/messaging/type/MessageShowErrors.h utility/messaging/type/MessageShowScope.h + utility/messaging/type/MessageShowStartScreen.h utility/messaging/type/MessageStatus.h utility/messaging/type/MessageSwitchColorScheme.h utility/messaging/type/MessageUndo.h @@ -319,6 +321,8 @@ add_files( Application.cpp Application.h isTrial.h + LicenseChecker.cpp + LicenseChecker.h Project.cpp Project.h ) diff --git a/src/lib/LicenseChecker.cpp b/src/lib/LicenseChecker.cpp new file mode 100644 index 00000000..a14f030e --- /dev/null +++ b/src/lib/LicenseChecker.cpp @@ -0,0 +1,117 @@ +#include "LicenseChecker.h" + +#include "utility/messaging/type/MessageStatus.h" + +#include "License.h" +#include "Application.h" +#include "PublicKey.h" +#include "settings/ApplicationSettings.h" + +#include "utility/AppPath.h" + +void LicenseChecker::createInstance() +{ + if (!s_instance) + { + s_instance = std::shared_ptr(new LicenseChecker()); + } +} + +std::shared_ptr LicenseChecker::getInstance() +{ + createInstance(); + + return s_instance; +} + +LicenseChecker::~LicenseChecker() +{ +} + +void LicenseChecker::setApp(Application* app) +{ + m_app = app; +} + +LicenseChecker::LicenseChecker() + : m_app(nullptr) + , m_forcedLicenseEntering(false) +{ +} + +void LicenseChecker::handleMessage(MessageDispatchWhenLicenseValid* message) +{ + if (m_app != nullptr && !checkLicenseString()) + { + m_pendingMessage = message->content; + + if (!m_forcedLicenseEntering) + { + m_app->forceEnterLicense(); + m_forcedLicenseEntering = true; + } + } + else + { + message->content->dispatch(); + } +} + +void LicenseChecker::handleMessage(MessageEnteredLicense* message) +{ + m_forcedLicenseEntering = false; + + if (m_pendingMessage) + { + m_pendingMessage->dispatch(); + m_pendingMessage.reset(); + } +} + +bool LicenseChecker::checkLicenseString() +{ + MessageStatus("preparing...", false, true).dispatch(); + + bool valid = false; + do + { + ApplicationSettings* appSettings = ApplicationSettings::getInstance().get(); + + std::string licenseCheck = appSettings->getLicenseCheck(); + std::string appPath = AppPath::getAppPath(); // for easier debugging... + FilePath p(appPath); + + if (!License::checkLocation(p.absolute().str(), licenseCheck)) + { + break; + } + + std::string licenseString = appSettings->getLicenseString(); + if (licenseString.size() == 0) + { + break; + } + + License license; + bool isLoaded = license.loadFromEncodedString(licenseString,AppPath::getAppPath()); + if (!isLoaded) + { + break; + } + + license.loadPublicKeyFromString(PublicKey); + valid = license.isValid(); + if (license.isExpired()) + { + valid = false; + } + + } + while (false); + + MessageStatus("ready").dispatch(); + + return valid; +} + +std::shared_ptr LicenseChecker::s_instance; diff --git a/src/lib/LicenseChecker.h b/src/lib/LicenseChecker.h new file mode 100644 index 00000000..b7c4a2db --- /dev/null +++ b/src/lib/LicenseChecker.h @@ -0,0 +1,38 @@ +#ifndef LICENSE_CHECKER_H +#define LICENSE_CHECKER_H + +#include "utility/messaging/MessageListener.h" +#include "utility/messaging/type/MessageEnteredLicense.h" +#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h" + +class Application; + +class LicenseChecker + : public MessageListener + , public MessageListener +{ +public: + static void createInstance(); + static std::shared_ptr getInstance(); + + ~LicenseChecker(); + + void setApp(Application* app); + +private: + LicenseChecker(); + LicenseChecker(const LicenseChecker&) = delete; + void operator=(const LicenseChecker&) = delete; + + void handleMessage(MessageDispatchWhenLicenseValid* message); + void handleMessage(MessageEnteredLicense* message); + bool checkLicenseString(); + + static std::shared_ptr s_instance; + + Application* m_app; + std::shared_ptr m_pendingMessage; + bool m_forcedLicenseEntering; +}; + +#endif // LICENSE_CHECKER_H diff --git a/src/lib/component/controller/IDECommunicationController.cpp b/src/lib/component/controller/IDECommunicationController.cpp index 6d8ab952..e3479bc1 100644 --- a/src/lib/component/controller/IDECommunicationController.cpp +++ b/src/lib/component/controller/IDECommunicationController.cpp @@ -6,6 +6,7 @@ #include "utility/messaging/type/MessageActivateTokenLocations.h" #include "utility/messaging/type/MessageActivateWindow.h" +#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h" #include "utility/messaging/type/MessageLoadProject.h" #include "utility/messaging/type/MessageProjectNew.h" #include "utility/messaging/type/MessageStatus.h" @@ -83,14 +84,14 @@ void IDECommunicationController::handleSetActiveTokenMessage(const NetworkProtoc if (selectedLocationIds.size() > 0) { MessageStatus("Activating a source location from external succeeded.").dispatch(); - MessageActivateTokenLocations(selectedLocationIds).dispatch(); + MessageDispatchWhenLicenseValid(std::make_shared(selectedLocationIds)).dispatch(); MessageActivateWindow().dispatch(); } else { MessageStatus( "Activating a source location from external failed. No symbol(s) have been found at the selected location." - ).dispatch(); + ).dispatch(); } } } @@ -101,10 +102,10 @@ void IDECommunicationController::handleCreateProjectMessage(const NetworkProtoco { if (message.ideId == "vs") { - MessageProjectNew msg; - msg.setSolutionPath(message.solutionFileLocation); - msg.ideId = message.ideId; - msg.dispatch(); + std::shared_ptr msg = std::make_shared(); + msg->setSolutionPath(message.solutionFileLocation); + msg->ideId = message.ideId; + MessageDispatchWhenLicenseValid(msg).dispatch(); } else { @@ -125,4 +126,4 @@ void IDECommunicationController::handleMessage(MessageMoveIDECursor* message) ).dispatch(); sendMessage(networkMessage); -} \ No newline at end of file +} diff --git a/src/lib/component/view/MainView.h b/src/lib/component/view/MainView.h index 293dfe18..f8c652d4 100644 --- a/src/lib/component/view/MainView.h +++ b/src/lib/component/view/MainView.h @@ -16,7 +16,7 @@ public: virtual void setTitle(const std::string& title) = 0; virtual void activateWindow() = 0; virtual void updateRecentProjectMenu() = 0; - virtual void showLicenseScreen() = 0; + virtual void forceLicenseScreen() = 0; }; #endif // MAIN_VIEW_H diff --git a/src/lib/settings/ApplicationSettings.cpp b/src/lib/settings/ApplicationSettings.cpp index a2953005..cadf3b54 100644 --- a/src/lib/settings/ApplicationSettings.cpp +++ b/src/lib/settings/ApplicationSettings.cpp @@ -18,11 +18,6 @@ ApplicationSettings::~ApplicationSettings() { } -std::string ApplicationSettings::getStartupProjectFilePath() const -{ - return getValue("startup_project", ""); -} - int ApplicationSettings::getMaxRecentProjectsCount() const { return 7; diff --git a/src/lib/settings/ApplicationSettings.h b/src/lib/settings/ApplicationSettings.h index 5ab0b801..c15039df 100644 --- a/src/lib/settings/ApplicationSettings.h +++ b/src/lib/settings/ApplicationSettings.h @@ -12,8 +12,6 @@ public: static std::shared_ptr getInstance(); ~ApplicationSettings(); - std::string getStartupProjectFilePath() const; - int getMaxRecentProjectsCount() const; // source diff --git a/src/lib/settings/ColorScheme.h b/src/lib/settings/ColorScheme.h index 24c10de6..263b76c4 100644 --- a/src/lib/settings/ColorScheme.h +++ b/src/lib/settings/ColorScheme.h @@ -31,8 +31,8 @@ public: protected: ColorScheme(); - ColorScheme(const ColorScheme&); - void operator=(const ColorScheme&); + ColorScheme(const ColorScheme&) = delete; + void operator=(const ColorScheme&) = delete; static std::shared_ptr s_instance; diff --git a/src/lib/utility/messaging/MessageQueue.cpp b/src/lib/utility/messaging/MessageQueue.cpp index 75319c23..13ed9323 100644 --- a/src/lib/utility/messaging/MessageQueue.cpp +++ b/src/lib/utility/messaging/MessageQueue.cpp @@ -15,10 +15,14 @@ std::shared_ptr MessageQueue::getInstance() { s_instance = std::shared_ptr(new MessageQueue()); } - return s_instance; } +MessageQueue::~MessageQueue() +{ + // TODO: remove remaining listeners. And tell them that they shouldn't unregister anymore. +} + void MessageQueue::registerListener(MessageListenerBase* listener) { std::lock_guard lock(m_listenersMutex); diff --git a/src/lib/utility/messaging/MessageQueue.h b/src/lib/utility/messaging/MessageQueue.h index 2d8655b4..d9f30e64 100644 --- a/src/lib/utility/messaging/MessageQueue.h +++ b/src/lib/utility/messaging/MessageQueue.h @@ -15,6 +15,8 @@ class MessageQueue public: static std::shared_ptr getInstance(); + ~MessageQueue(); + void registerListener(MessageListenerBase* listener); void unregisterListener(MessageListenerBase* listener); @@ -38,8 +40,8 @@ private: static std::shared_ptr s_instance; MessageQueue(); - MessageQueue(const MessageQueue&); - void operator=(const MessageQueue&); + MessageQueue(const MessageQueue&) = delete; + void operator=(const MessageQueue&) = delete; void processMessages(); void sendMessage(std::shared_ptr message); diff --git a/src/lib/utility/messaging/type/MessageDispatchWhenLicenseValid.h b/src/lib/utility/messaging/type/MessageDispatchWhenLicenseValid.h new file mode 100644 index 00000000..381d1199 --- /dev/null +++ b/src/lib/utility/messaging/type/MessageDispatchWhenLicenseValid.h @@ -0,0 +1,23 @@ +#ifndef MESSAGE_DISPATCH_WHEN_LICENSE_VALID_H +#define MESSAGE_DISPATCH_WHEN_LICENSE_VALID_H + +#include "utility/messaging/Message.h" + +class MessageDispatchWhenLicenseValid + : public Message +{ +public: + MessageDispatchWhenLicenseValid(std::shared_ptr content) + : content(content) + { + } + + static const std::string getStaticType() + { + return "MessageDispatchWhenLicenseValid"; + } + + std::shared_ptr content; +}; + +#endif // MESSAGE_DISPATCH_WHEN_LICENSE_VALID_H diff --git a/src/lib/utility/messaging/type/MessageShowStartScreen.h b/src/lib/utility/messaging/type/MessageShowStartScreen.h new file mode 100644 index 00000000..a0449829 --- /dev/null +++ b/src/lib/utility/messaging/type/MessageShowStartScreen.h @@ -0,0 +1,20 @@ +#ifndef MESSAGE_SHOW_START_SCREEN_H +#define MESSAGE_SHOW_START_SCREEN_H + +#include "utility/messaging/Message.h" + +class MessageShowStartScreen + : public Message +{ +public: + MessageShowStartScreen() + { + } + + static const std::string getStaticType() + { + return "MessageShowStartScreen"; + } +}; + +#endif // MESSAGE_SHOW_START_SCREEN_H diff --git a/src/lib_gui/qt/QtApplication.cpp b/src/lib_gui/qt/QtApplication.cpp index 821117cd..adf1c7b7 100644 --- a/src/lib_gui/qt/QtApplication.cpp +++ b/src/lib_gui/qt/QtApplication.cpp @@ -3,6 +3,7 @@ #include #include "utility/file/FilePath.h" +#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h" #include "utility/messaging/type/MessageLoadProject.h" QtApplication::QtApplication(int& argc, char** argv) @@ -21,7 +22,9 @@ bool QtApplication::event(QEvent *event) if (path.exists() && path.extension() == ".coatiproject") { - MessageLoadProject(path.str(), false).dispatch(); + MessageDispatchWhenLicenseValid( + std::make_shared(path.str(), false) + ).dispatch(); return true; } } diff --git a/src/lib_gui/qt/view/QtMainView.cpp b/src/lib_gui/qt/view/QtMainView.cpp index 2571c3a1..e2bd962b 100644 --- a/src/lib_gui/qt/view/QtMainView.cpp +++ b/src/lib_gui/qt/view/QtMainView.cpp @@ -5,15 +5,16 @@ #include "qt/window/QtMainWindow.h" QtMainView::QtMainView() - : m_hideStartScreenFunctor(std::bind(&QtMainView::doHideStartScreen, this)) + : m_createNewProjectFromSolutionFunctor(std::bind(&QtMainView::doCreateNewProjectFromSolution, this, std::placeholders::_1, std::placeholders::_2)) + , m_showStartScreenFunctor(std::bind(&QtMainView::doShowStartScreen, this)) + , m_hideStartScreenFunctor(std::bind(&QtMainView::doHideStartScreen, this)) , m_setTitleFunctor(std::bind(&QtMainView::doSetTitle, this, std::placeholders::_1)) , m_activateWindowFunctor(std::bind(&QtMainView::doActivateWindow, this)) , m_updateRecentProjectMenuFunctor(std::bind(&QtMainView::doUpdateRecentProjectMenu, this)) - , m_showLicenseScreenFunctor(std::bind(&QtMainView::doShowLicenseScreen, this)) + , m_forceLicenseScreenFunctor(std::bind(&QtMainView::doForceLicenseScreen, this)) { m_window = std::make_shared(); m_window->show(); - m_window->init(); } QtMainView::~QtMainView() @@ -88,14 +89,32 @@ void QtMainView::updateRecentProjectMenu() m_updateRecentProjectMenuFunctor(); } -void QtMainView::showLicenseScreen() +void QtMainView::forceLicenseScreen() { - m_showLicenseScreenFunctor(); + m_forceLicenseScreenFunctor(); } -void QtMainView::doUpdateRecentProjectMenu() +void QtMainView::handleMessage(MessageProjectNew* message) { - m_window->updateRecentProjectMenu(); + if (message->ideId.size() != 0 && message->solutionPath.size() != 0) + { + m_createNewProjectFromSolutionFunctor(message->ideId, message->solutionPath); + } +} + +void QtMainView::handleMessage(MessageShowStartScreen* message) +{ + m_showStartScreenFunctor(); +} + +void QtMainView::doCreateNewProjectFromSolution(const std::string& ideId, const std::string& solutionPath) +{ + m_window->newProjectFromSolution(ideId, solutionPath); +} + +void QtMainView::doShowStartScreen() +{ + m_window->showStartScreen(); } void QtMainView::doHideStartScreen() @@ -116,7 +135,12 @@ void QtMainView::doActivateWindow() m_window->setFocus(Qt::ActiveWindowFocusReason); } -void QtMainView::doShowLicenseScreen() +void QtMainView::doUpdateRecentProjectMenu() +{ + m_window->updateRecentProjectMenu(); +} + +void QtMainView::doForceLicenseScreen() { m_window->forceEnterLicense(); } diff --git a/src/lib_gui/qt/view/QtMainView.h b/src/lib_gui/qt/view/QtMainView.h index 9864c24c..c61aaad3 100644 --- a/src/lib_gui/qt/view/QtMainView.h +++ b/src/lib_gui/qt/view/QtMainView.h @@ -9,11 +9,17 @@ #include "component/view/MainView.h" #include "qt/utility/QtThreadedFunctor.h" +#include "utility/messaging/MessageListener.h" +#include "utility/messaging/type/MessageProjectNew.h" +#include "utility/messaging/type/MessageShowStartScreen.h" + class QtMainWindow; class View; class QtMainView : public MainView + , public MessageListener + , public MessageListener { public: QtMainView(); @@ -37,23 +43,30 @@ public: virtual void setTitle(const std::string& title); virtual void activateWindow(); virtual void updateRecentProjectMenu(); - virtual void showLicenseScreen(); + virtual void forceLicenseScreen(); private: + void handleMessage(MessageProjectNew* message); + void handleMessage(MessageShowStartScreen* message); + + void doCreateNewProjectFromSolution(const std::string& ideId, const std::string& solutionPath); + void doShowStartScreen(); void doHideStartScreen(); void doSetTitle(const std::string& title); void doActivateWindow(); void doUpdateRecentProjectMenu(); - void doShowLicenseScreen(); + void doForceLicenseScreen(); std::shared_ptr m_window; std::vector m_views; + QtThreadedFunctor m_createNewProjectFromSolutionFunctor; + QtThreadedFunctor<> m_showStartScreenFunctor; QtThreadedFunctor<> m_hideStartScreenFunctor; QtThreadedFunctor m_setTitleFunctor; QtThreadedFunctor<> m_activateWindowFunctor; QtThreadedFunctor<> m_updateRecentProjectMenuFunctor; - QtThreadedFunctor<> m_showLicenseScreenFunctor; + QtThreadedFunctor<> m_forceLicenseScreenFunctor; }; #endif // QT_MAIN_VIEW_H diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index 419a7004..a9e02706 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -23,6 +23,7 @@ #include "settings/ProjectSettings.h" #include "utility/file/FileSystem.h" #include "utility/logging/logging.h" +#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h" #include "utility/messaging/type/MessageFind.h" #include "utility/messaging/type/MessageInterruptTasks.h" #include "utility/messaging/type/MessageLoadProject.h" @@ -130,7 +131,6 @@ void MouseWheelFilter::stopWaiting() QtMainWindow::QtMainWindow() : m_showDockWidgetTitleBars(true) , m_windowStack(this) - , m_createNewProjectFunctor(std::bind(&QtMainWindow::doCreateNewProject, this, std::placeholders::_1)) { setObjectName("QtMainWindow"); setCentralWidget(nullptr); @@ -161,11 +161,6 @@ QtMainWindow::QtMainWindow() loadLayout(); } -void QtMainWindow::init() -{ - showStartScreen(); -} - QtMainWindow::~QtMainWindow() { if (m_recentProjectAction) @@ -285,12 +280,6 @@ void QtMainWindow::forceEnterLicense() enterLicenseWindow->setEnabled(true); } -void QtMainWindow::handleMessage(MessageProjectNew* message) -{ - MessageProjectNew msg(*message); - m_createNewProjectFunctor(msg); -} - bool QtMainWindow::event(QEvent* event) { if (event->type() == QEvent::WindowActivate) @@ -374,6 +363,12 @@ void QtMainWindow::newProject() wizzard->newProject(); } +void QtMainWindow::newProjectFromSolution(const std::string& ideId, const std::string& solutionPath) +{ + QtProjectWizzard* wizzard = createWindow(); + wizzard->newProjectFromSolution(ideId, solutionPath); +} + void QtMainWindow::openProject(const QString &path) { QString fileName = path; @@ -385,7 +380,9 @@ void QtMainWindow::openProject(const QString &path) if (!fileName.isEmpty()) { - MessageLoadProject(fileName.toStdString(), false).dispatch(); + MessageDispatchWhenLicenseValid( + std::make_shared(fileName.toStdString(), false) + ).dispatch(); m_windowStack.clearWindows(); } } @@ -573,20 +570,6 @@ void QtMainWindow::toggleShowDockWidgetTitleBars() setShowDockWidgetTitleBars(!m_showDockWidgetTitleBars); } -void QtMainWindow::doCreateNewProject(MessageProjectNew message) -{ - QtProjectWizzard* wizzard = createWindow(); - - if (message.fromSolution()) - { - wizzard->newProjectFromSolution(message.ideId ,message.solutionPath); - } - else - { - wizzard->newProject(); - } -} - void QtMainWindow::setupEditMenu() { QMenu *menu = new QMenu(tr("&Edit"), this); diff --git a/src/lib_gui/qt/window/QtMainWindow.h b/src/lib_gui/qt/window/QtMainWindow.h index a0690232..1db9925f 100644 --- a/src/lib_gui/qt/window/QtMainWindow.h +++ b/src/lib_gui/qt/window/QtMainWindow.h @@ -8,9 +8,6 @@ #include #include -#include "utility/messaging/MessageListener.h" -#include "utility/messaging/type/MessageProjectNew.h" - #include "qt/utility/QtThreadedFunctor.h" #include "qt/window/QtWindowStack.h" @@ -72,7 +69,6 @@ private: class QtMainWindow : public QMainWindow - , public MessageListener { Q_OBJECT @@ -80,8 +76,6 @@ public: QtMainWindow(); ~QtMainWindow(); - void init(); - void addView(View* view); void removeView(View* view); @@ -93,8 +87,6 @@ public: void forceEnterLicense(); - void handleMessage(MessageProjectNew* message); - protected: bool event(QEvent* event); void keyPressEvent(QKeyEvent* event); @@ -113,6 +105,7 @@ public slots: void hideStartScreen(); void newProject(); + void newProjectFromSolution(const std::string& ideId, const std::string& solutionPath); void openProject(const QString &path = QString()); void editProject(); void openRecentProject(); @@ -152,8 +145,6 @@ private: QtViewToggle* toggle; }; - void doCreateNewProject(MessageProjectNew message); - void setupEditMenu(); void setupProjectMenu(); void setupViewMenu(); @@ -178,8 +169,6 @@ private: QtWindowStack m_windowStack; QShortcut* m_escapeShortcut; - - QtThreadedFunctor m_createNewProjectFunctor; }; #endif // QT_MAIN_WINDOW_H diff --git a/src/lib_gui/qt/window/QtStartScreen.cpp b/src/lib_gui/qt/window/QtStartScreen.cpp index d5a06b04..2b212de5 100644 --- a/src/lib_gui/qt/window/QtStartScreen.cpp +++ b/src/lib_gui/qt/window/QtStartScreen.cpp @@ -8,6 +8,7 @@ #include "settings/ApplicationSettings.h" #include "utility/file/FileSystem.h" +#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h" #include "utility/messaging/type/MessageLoadProject.h" #include "utility/ResourcePaths.h" @@ -31,7 +32,7 @@ void QtRecentProjectButton::setProjectPath(const FilePath& projectFilePath) m_projectFilePath = projectFilePath; m_projectExists = projectFilePath.exists(); this->setText(m_projectFilePath.withoutExtension().fileName().c_str()); - if ( m_projectExists ) + if (m_projectExists) { this->setToolTip(m_projectFilePath.str().c_str()); } @@ -44,9 +45,11 @@ void QtRecentProjectButton::setProjectPath(const FilePath& projectFilePath) void QtRecentProjectButton::handleButtonClick() { - if ( m_projectExists ) + if (m_projectExists) { - MessageLoadProject(m_projectFilePath.str(), false).dispatch(); + MessageDispatchWhenLicenseValid( + std::make_shared(m_projectFilePath.str(), false) + ).dispatch(); } else { @@ -54,14 +57,13 @@ void QtRecentProjectButton::handleButtonClick() + " in your filesystem. Delete it from this recent Proejct list?"; int ret = QMessageBox::question(this, "Missing Project File", text.c_str(), QMessageBox::Yes | QMessageBox::No); - if ( ret == QMessageBox::Yes ) + if (ret == QMessageBox::Yes) { std::vector recentProjects = ApplicationSettings::getInstance()->getRecentProjects(); - for (int i = 0 - ; i < ApplicationSettings::getInstance()->getMaxRecentProjectsCount() - ; i++) + const int maxRecentProjectsCount = ApplicationSettings::getInstance()->getMaxRecentProjectsCount(); + for (int i = 0; i < maxRecentProjectsCount; i++) { - if (recentProjects[i].str() == m_projectFilePath.str() ) + if (recentProjects[i].str() == m_projectFilePath.str()) { recentProjects.erase(recentProjects.begin()+i); ApplicationSettings::getInstance()->setRecentProjects(recentProjects); @@ -90,7 +92,7 @@ void QtStartScreen::updateButtons() { std::vector recentProjects = ApplicationSettings::getInstance()->getRecentProjects(); size_t i = 0; - for ( QtRecentProjectButton* button : m_recentProjectsButtons ) + for (QtRecentProjectButton* button : m_recentProjectsButtons) { button->disconnect(); if (i < recentProjects.size()) diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp index 4be965ea..a421204f 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzard.cpp @@ -17,9 +17,9 @@ #include "qt/window/project_wizzard/QtProjectWizzardContentSourceList.h" #include "qt/window/project_wizzard/QtProjectWizzardContentSummary.h" #include "qt/window/project_wizzard/QtProjectWizzardWindow.h" +#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h" #include "utility/messaging/type/MessageLoadProject.h" -// #include "utility/solution/SolutionParserCompilationDatabase.h" #include "utility/solution/SolutionParserVisualStudio.h" #include "utility/solution/SolutionParserCodeBlocks.h" @@ -597,7 +597,9 @@ void QtProjectWizzard::createProject() bool forceRefresh = !(m_settings == *ProjectSettings::getInstance().get()); - MessageLoadProject(path, forceRefresh).dispatch(); + MessageDispatchWhenLicenseValid( + std::make_shared(path, forceRefresh) + ).dispatch(); m_windowStack.clearWindows(); emit finished(); diff --git a/src/trial/main.cpp b/src/trial/main.cpp index d7d0fa6e..fa8b9934 100644 --- a/src/trial/main.cpp +++ b/src/trial/main.cpp @@ -8,6 +8,7 @@ #include "Application.h" #include "includes.h" // defines 'void setup(int argc, char *argv[])' +#include "LicenseChecker.h" #include "qt/network/QtNetworkFactory.h" #include "qt/QtApplication.h" #include "qt/utility/utilityQt.h" @@ -44,12 +45,14 @@ int main(int argc, char *argv[]) qtApp.setAttribute(Qt::AA_UseHighDpiPixmaps); - utility::loadFontsFromDirectory(ResourcePaths::getFontsPath(), ".otf"); - QtViewFactory viewFactory; QtNetworkFactory networkFactory; + utility::loadFontsFromDirectory(ResourcePaths::getFontsPath(), ".otf"); + std::shared_ptr app = Application::create(version, &viewFactory, &networkFactory); + LicenseChecker::createInstance(); + return qtApp.exec(); }