logic: refactored license checking
This commit is contained in:
@@ -123,7 +123,7 @@ void LicenseChecker::handleMessage(MessageDispatchWhenLicenseValid* message)
|
||||
|
||||
MessageStatus("ready").dispatch();
|
||||
|
||||
if (state == LICENSE_VALID || message->allowTrial)
|
||||
if (state == LICENSE_VALID)
|
||||
{
|
||||
message->content->dispatch();
|
||||
}
|
||||
|
||||
@@ -7,9 +7,8 @@ class MessageDispatchWhenLicenseValid
|
||||
: public Message<MessageDispatchWhenLicenseValid>
|
||||
{
|
||||
public:
|
||||
MessageDispatchWhenLicenseValid(std::shared_ptr<MessageBase> content, bool allowTrial = false)
|
||||
MessageDispatchWhenLicenseValid(std::shared_ptr<MessageBase> content)
|
||||
: content(content)
|
||||
, allowTrial(allowTrial)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -19,7 +18,6 @@ public:
|
||||
}
|
||||
|
||||
std::shared_ptr<MessageBase> content;
|
||||
const bool allowTrial;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_DISPATCH_WHEN_LICENSE_VALID_H
|
||||
|
||||
@@ -429,20 +429,14 @@ void QtMainWindow::newProjectFromSolution(const std::string& ideId, const std::s
|
||||
wizzard->newProjectFromSolution(ideId, solutionPath);
|
||||
}
|
||||
|
||||
void QtMainWindow::openProject(const QString &path)
|
||||
void QtMainWindow::openProject()
|
||||
{
|
||||
QString fileName = path;
|
||||
|
||||
if (fileName.isNull())
|
||||
{
|
||||
fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "", "Coati Project Files (*.coatiproject)");
|
||||
}
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "", "Coati Project Files (*.coatiproject)");
|
||||
|
||||
if (!fileName.isEmpty())
|
||||
{
|
||||
MessageDispatchWhenLicenseValid(
|
||||
std::make_shared<MessageLoadProject>(fileName.toStdString(), false),
|
||||
true
|
||||
std::make_shared<MessageLoadProject>(fileName.toStdString(), false)
|
||||
).dispatch();
|
||||
m_windowStack.clearWindows();
|
||||
}
|
||||
@@ -535,7 +529,8 @@ void QtMainWindow::openRecentProject()
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
if (action)
|
||||
{
|
||||
openProject(action->data().toString());
|
||||
MessageLoadProject(action->data().toString().toStdString(), false).dispatch();
|
||||
m_windowStack.clearWindows();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ public slots:
|
||||
|
||||
void newProject();
|
||||
void newProjectFromSolution(const std::string& ideId, const std::string& solutionPath);
|
||||
void openProject(const QString &path = QString());
|
||||
void openProject();
|
||||
void editProject();
|
||||
|
||||
void find();
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#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"
|
||||
|
||||
@@ -47,10 +46,7 @@ void QtRecentProjectButton::handleButtonClick()
|
||||
{
|
||||
if (m_projectExists)
|
||||
{
|
||||
MessageDispatchWhenLicenseValid(
|
||||
std::make_shared<MessageLoadProject>(m_projectFilePath.str(), false),
|
||||
true
|
||||
).dispatch();
|
||||
MessageLoadProject(m_projectFilePath.str(), false).dispatch();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user