- 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.
34 lines
794 B
C++
34 lines
794 B
C++
#include "qt/QtApplication.h"
|
|
|
|
#include <QFileOpenEvent>
|
|
|
|
#include "utility/file/FilePath.h"
|
|
#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h"
|
|
#include "utility/messaging/type/MessageLoadProject.h"
|
|
|
|
QtApplication::QtApplication(int& argc, char** argv)
|
|
: QApplication(argc, argv)
|
|
{
|
|
}
|
|
|
|
// responds to FileOpenEvent specific for Mac
|
|
bool QtApplication::event(QEvent *event)
|
|
{
|
|
if (event->type() == QEvent::FileOpen)
|
|
{
|
|
QFileOpenEvent* fileEvent = dynamic_cast<QFileOpenEvent*>(event);
|
|
|
|
FilePath path(fileEvent->file().toStdString());
|
|
|
|
if (path.exists() && path.extension() == ".coatiproject")
|
|
{
|
|
MessageDispatchWhenLicenseValid(
|
|
std::make_shared<MessageLoadProject>(path.str(), false)
|
|
).dispatch();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return QApplication::event(event);
|
|
}
|