logic: Allow project opening in trial mode

* added open project button to start screen in trial mode
* allow ide communication in trial
This commit is contained in:
Eberhard Graether
2017-02-11 17:22:14 +01:00
parent ba984121a2
commit 0eb959bf54
6 changed files with 24 additions and 36 deletions
@@ -105,9 +105,7 @@ void IDECommunicationController::handleSetActiveTokenMessage(
MessageStatus("Activating source location from plug-in succeeded: " + message.fileLocation + ", row: " +
std::to_string(message.row) + ", col: " + std::to_string(message.column)).dispatch();
MessageDispatchWhenLicenseValid(
std::make_shared<MessageActivateTokenLocations>(selectedLocationIds)
).dispatch();
MessageActivateTokenLocations(selectedLocationIds).dispatch();
MessageActivateWindow().dispatch();
return;
}
@@ -116,9 +114,7 @@ void IDECommunicationController::handleSetActiveTokenMessage(
Id fileId = m_storageAccess->getTokenIdForFileNode(message.fileLocation);
if (fileId > 0)
{
MessageDispatchWhenLicenseValid(
std::make_shared<MessageActivateFile>(message.fileLocation, message.row)
).dispatchImmediately();
MessageActivateFile(message.fileLocation, message.row).dispatchImmediately();
MessageActivateWindow().dispatch();
}
else
@@ -171,21 +167,21 @@ void IDECommunicationController::handlePing(const NetworkProtocolHelper::PingMes
{
if (message.valid)
{
std::shared_ptr<MessagePingReceived> msg = std::make_shared<MessagePingReceived>();
msg->ideId = message.ideId;
MessagePingReceived msg;
msg.ideId = message.ideId;
std::string ideName = "unknown";
if (msg->ideId == "vs")
if (msg.ideId == "vs")
{
ideName = "Visual Studio";
}
// TODO: add the other ides
std::string message = ideName + " instance detected via plugin port";
std::string statusMessage = ideName + " instance detected via plugin port";
MessageStatus(message, false, false).dispatch();
MessageDispatchWhenLicenseValid(msg).dispatch();
MessageStatus(statusMessage, false, false).dispatch();
msg.dispatch();
}
else
{
@@ -4,7 +4,6 @@
#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"
@@ -180,9 +179,7 @@ void CommandLineParser::projectLoad()
{
if (m_projectFile.exists() && m_projectFile.extension() == ".coatiproject")
{
MessageDispatchWhenLicenseValid(
std::make_shared<MessageLoadProject>(m_projectFile.str(), m_force)
).dispatch();
MessageLoadProject(m_projectFile.str(), m_force).dispatch();
}
}
+1 -4
View File
@@ -3,7 +3,6 @@
#include <QFileOpenEvent>
#include "utility/file/FilePath.h"
#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h"
#include "utility/messaging/type/MessageLoadProject.h"
#include "utility/logging/LogManager.h"
#include "component/controller/LogController.h"
@@ -36,9 +35,7 @@ bool QtApplication::event(QEvent *event)
if (path.exists() && path.extension() == ".coatiproject")
{
MessageDispatchWhenLicenseValid(
std::make_shared<MessageLoadProject>(path.str(), false)
).dispatch();
MessageLoadProject(path.str(), false).dispatch();
return true;
}
}
+2 -5
View File
@@ -29,7 +29,6 @@
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/messaging/type/MessageCodeReference.h"
#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h"
#include "utility/messaging/type/MessageEnteredLicense.h"
#include "utility/messaging/type/MessageFind.h"
#include "utility/messaging/type/MessageInterruptTasks.h"
@@ -420,9 +419,7 @@ void QtMainWindow::openProject()
if (!fileName.isEmpty())
{
MessageDispatchWhenLicenseValid(
std::make_shared<MessageLoadProject>(fileName.toStdString(), false)
).dispatch();
MessageLoadProject(fileName.toStdString(), false).dispatch();
m_windowStack.clearWindows();
}
}
@@ -563,7 +560,7 @@ void QtMainWindow::setupProjectMenu()
menuBar()->addMenu(menu);
m_trialDisabledActions.push_back(menu->addAction(tr("&New Project..."), this, SLOT(newProject()), QKeySequence::New));
m_trialDisabledActions.push_back(menu->addAction(tr("&Open Project..."), this, SLOT(openProject()), QKeySequence::Open));
menu->addAction(tr("&Open Project..."), this, SLOT(openProject()), QKeySequence::Open);
QMenu *recentProjectMenu = new QMenu(tr("Recent Projects"));
menu->addMenu(recentProjectMenu);
+10 -2
View File
@@ -150,7 +150,7 @@ void QtStartScreen::setupStartScreen(bool unlocked)
if (!unlocked)
{
col->addSpacing(50);
col->addSpacing(4);
QLabel* welcomeLabel = new QLabel(
"Welcome to the <b>Coati trial</b>!<br /><br />"
@@ -166,12 +166,20 @@ void QtStartScreen::setupStartScreen(bool unlocked)
col->addWidget(welcomeLabel, 0, Qt::AlignHCenter | Qt::AlignTop);
col->addStretch();
QPushButton* openProjectButton = new QPushButton("Open Project", this);
openProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
openProjectButton->setObjectName("projectButton");
openProjectButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
connect(openProjectButton, SIGNAL(clicked()), this, SLOT(handleOpenProjectButton()));
col->addWidget(openProjectButton);
col->addSpacing(8);
QPushButton* unlockButton = new QPushButton("Unlock", this);
unlockButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
unlockButton->setObjectName("projectButton");
unlockButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
connect(unlockButton, SIGNAL(clicked()), this, SLOT(handleUnlockButton()));
col->addWidget(unlockButton);
QHBoxLayout* row = new QHBoxLayout();
row->addWidget(unlockButton);
@@ -19,7 +19,6 @@
#include "settings/JavaProjectSettings.h"
#include "utility/file/FileSystem.h"
#include "utility/logging/logging.h"
#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h"
#include "utility/messaging/type/MessageLoadProject.h"
#include "utility/messaging/type/MessagePluginPortChange.h"
#include "utility/messaging/type/MessageRefresh.h"
@@ -681,9 +680,7 @@ void QtProjectWizzard::createProject()
MessageStatus("Created project: " + path.str()).dispatch();
}
MessageDispatchWhenLicenseValid(
std::make_shared<MessageLoadProject>(path, forceRefreshProject)
).dispatch();
MessageLoadProject(path, forceRefreshProject).dispatch();
finishWizzard();
}
@@ -710,11 +707,7 @@ void QtProjectWizzard::savePreferences()
Project* currentProject = Application::getInstance()->getCurrentProject().get();
if (currentProject)
{
MessageDispatchWhenLicenseValid(
std::make_shared<MessageLoadProject>(
currentProject->getProjectSettingsFilePath(), true
)
).dispatch();
MessageLoadProject(currentProject->getProjectSettingsFilePath(), true).dispatch();
}
}
else