logic: Fixed cli message handling and Mac build
This commit is contained in:
@@ -2,19 +2,9 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/AppPath.h"
|
||||
#include "utility/UserPaths.h"
|
||||
#include "utility/utilityApp.h"
|
||||
#include "License.h"
|
||||
|
||||
QtCoreApplication::QtCoreApplication(int argc, char **argv )
|
||||
: QCoreApplication(argc, argv)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
QtCoreApplication::~QtCoreApplication()
|
||||
@@ -23,6 +13,7 @@ QtCoreApplication::~QtCoreApplication()
|
||||
|
||||
void QtCoreApplication::handleMessage(MessageQuitApplication* message)
|
||||
{
|
||||
std::cout << "quit" << std::endl;
|
||||
emit quit();
|
||||
}
|
||||
|
||||
@@ -30,8 +21,3 @@ void QtCoreApplication::handleMessage(MessageStatus* message)
|
||||
{
|
||||
std::cout << message->status << std::endl;
|
||||
}
|
||||
|
||||
bool QtCoreApplication::saveLicense(License license)
|
||||
{
|
||||
return utility::saveLicense(&license);
|
||||
}
|
||||
|
||||
@@ -2,30 +2,25 @@
|
||||
#define QT_COREAPPLICTION_H
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/MessageQuitApplication.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
|
||||
class License;
|
||||
class UnixSignalWatcher;
|
||||
|
||||
class QtCoreApplication
|
||||
: public QCoreApplication
|
||||
, public MessageListener<MessageQuitApplication>
|
||||
, public MessageListener<MessageStatus>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtCoreApplication(int argc, char **argv);
|
||||
virtual ~QtCoreApplication();
|
||||
bool saveLicense(License license);
|
||||
signals:
|
||||
void quitSignal();
|
||||
|
||||
private:
|
||||
virtual void handleMessage(MessageQuitApplication* message);
|
||||
virtual void handleMessage(MessageStatus* message);
|
||||
};
|
||||
|
||||
|
||||
#endif // QT_COREAPPLICATION
|
||||
|
||||
|
||||
@@ -104,16 +104,17 @@ int utility::getIdealThreadCount()
|
||||
return QThread::idealThreadCount();
|
||||
}
|
||||
|
||||
bool utility::saveLicense(License* license)
|
||||
bool utility::saveLicense(const License* license)
|
||||
{
|
||||
if (license == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (license->isValid())
|
||||
{
|
||||
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
|
||||
if (appSettings == NULL)
|
||||
if (appSettings == nullptr)
|
||||
{
|
||||
LOG_ERROR_STREAM(<< "Unable to retrieve app settings");
|
||||
return false;
|
||||
@@ -121,10 +122,8 @@ bool utility::saveLicense(License* license)
|
||||
|
||||
std::string appLocation = AppPath::getAppPath();
|
||||
appSettings->setLicenseString(license->getLicenseEncodedString(appLocation));
|
||||
FilePath p(appLocation);
|
||||
appSettings->setLicenseCheck(license->hashLocation(p.absolute().str()));
|
||||
appSettings->save(UserPaths::getAppSettingsPath());
|
||||
|
||||
appSettings->setLicenseCheck(license->hashLocation(FilePath(appLocation).absolute().str()));
|
||||
appSettings->save();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace utility
|
||||
int getIdealThreadCount();
|
||||
|
||||
OsType getOsType();
|
||||
bool saveLicense(License* license);
|
||||
|
||||
bool saveLicense(const License* license);
|
||||
}
|
||||
|
||||
#endif // UTILITY_APP_H
|
||||
|
||||
Reference in New Issue
Block a user