logic: Added Non-Commercial Use option and removed trial mode
* Added non-commercial use option to enter license window * Show enter license window on first start and force license selection * Added ApplicationSettings migration that removed private/academic license and switches user to non-commercial mode * Added commandline option to choose non-commercial use and provide better hints to license selection * Removed trial mode fortune cookie message = A secret admirer will soon send you a sign of affection.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
#title {
|
||||
margin-left: 265px;
|
||||
}
|
||||
|
||||
#licenseOption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#licenseField {
|
||||
font-family: "<setting:font_name>";
|
||||
font-size: 11px;
|
||||
@@ -6,6 +14,10 @@
|
||||
width: 470px;
|
||||
}
|
||||
|
||||
#licenseField:disabled {
|
||||
background: #F5F5F5;
|
||||
}
|
||||
|
||||
#licenseError {
|
||||
color: red;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#updateButton {
|
||||
#updateButton, #upgradeButton {
|
||||
margin: 1px 0 3px;
|
||||
text-align: left;
|
||||
padding: 0;
|
||||
@@ -53,7 +53,7 @@
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#updateButton:disabled {
|
||||
#updateButton:disabled, #upgradeButton:disabled {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
<license>
|
||||
<check><!-- STRING: hashed path of the working directory used when entering the license key --></check>
|
||||
<license><!-- STRING: the license key --></license>
|
||||
<non_commercial_use><!-- BOOL: if used non-commercially --></non_commercial_use>
|
||||
</license>
|
||||
|
||||
<accepted_eula_version><!-- INTEGER: last accepted eula version --></accepted_eula_version>
|
||||
|
||||
+11
-7
@@ -23,7 +23,6 @@
|
||||
#include "utility/logging/LoggerUtility.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/logging/LogManager.h"
|
||||
#include "utility/messaging/type/MessageEnteredLicense.h"
|
||||
#include "utility/messaging/type/MessageInterruptTasks.h"
|
||||
#include "utility/messaging/type/MessageLoadProject.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
@@ -247,16 +246,21 @@ int main(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!checker->isCurrentLicenseValid()) // this works because the user cannot enter a license string while running the app in headless more.
|
||||
if (!checker->isCurrentLicenseValid() && !ApplicationSettings::getInstance()->getNonCommercialUse())
|
||||
{
|
||||
std::cout << "No or invalide License" << std::endl;
|
||||
std::string appName = argc > 0 && std::string(argv[0]).size() ? argv[0] : "sourcetrail";
|
||||
|
||||
std::cout << "\nERROR: No valid license option selected.\n\n";
|
||||
std::cout << "For commercial use please run:\n\n";
|
||||
std::cout << "\t" << appName << " config --license-string <Commercial License or Test License string>\n";
|
||||
std::cout << "or\n";
|
||||
std::cout << "\t" << appName << " config --license-file <path/to/Commercial License or Test License file>\n\n\n";
|
||||
std::cout << "For non-commercial use please run:\n\n";
|
||||
std::cout << "\t" << appName << " config --non-commercial-use true\n" << std::endl;
|
||||
|
||||
LOG_WARNING("Your current Sourcetrail license seems to be invalid. Please update your license info.");
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageEnteredLicense(checker->getCurrentLicenseType()).dispatch();
|
||||
}
|
||||
|
||||
if (commandLineParser.hasError() )
|
||||
{
|
||||
|
||||
+20
-9
@@ -7,6 +7,7 @@
|
||||
#include "utility/messaging/filter_types/MessageFilterNewErrors.h"
|
||||
#include "utility/messaging/filter_types/MessageFilterSearchAutocomplete.h"
|
||||
#include "utility/messaging/MessageQueue.h"
|
||||
#include "utility/messaging/type/MessageForceEnterLicense.h"
|
||||
#include "utility/messaging/type/MessageQuitApplication.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/scheduling/TaskScheduler.h"
|
||||
@@ -112,6 +113,7 @@ void Application::loadStyle(const FilePath& colorSchemePath)
|
||||
Application::Application(bool withGUI)
|
||||
: m_hasGUI(withGUI)
|
||||
, m_licenseType(MessageEnteredLicense::LICENSE_NONE)
|
||||
, m_lastLicenseCheck(TimeStamp::now())
|
||||
{
|
||||
LicenseChecker::createInstance();
|
||||
}
|
||||
@@ -159,11 +161,6 @@ std::shared_ptr<DialogView> Application::getDialogView()
|
||||
return std::make_shared<DialogView>(nullptr);
|
||||
}
|
||||
|
||||
bool Application::isInTrial() const
|
||||
{
|
||||
return m_licenseType == MessageEnteredLicense::LICENSE_NONE;
|
||||
}
|
||||
|
||||
void Application::updateHistory(const std::vector<SearchMatch>& history)
|
||||
{
|
||||
m_mainView->updateHistoryMenu(history);
|
||||
@@ -323,10 +320,26 @@ void Application::handleMessage(MessageSwitchColorScheme* message)
|
||||
|
||||
void Application::handleMessage(MessageWindowFocus* message)
|
||||
{
|
||||
if (message->focusIn && m_project && ApplicationSettings::getInstance()->getAutomaticUpdateCheck())
|
||||
if (!message->focusIn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_project && ApplicationSettings::getInstance()->getAutomaticUpdateCheck())
|
||||
{
|
||||
m_updateChecker->checkUpdate();
|
||||
}
|
||||
|
||||
if (!ApplicationSettings::getInstance()->getNonCommercialUse() && TimeStamp::now().deltaHours(m_lastLicenseCheck) > 1)
|
||||
{
|
||||
m_lastLicenseCheck = TimeStamp::now();
|
||||
|
||||
LicenseChecker::LicenseState state = LicenseChecker::getInstance()->checkCurrentLicense();
|
||||
if (state != LicenseChecker::LICENSE_VALID && state != LicenseChecker::LICENSE_MOVED)
|
||||
{
|
||||
MessageForceEnterLicense(state).dispatch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Application::startMessagingAndScheduling()
|
||||
@@ -406,12 +419,10 @@ void Application::updateTitle()
|
||||
|
||||
switch (m_licenseType)
|
||||
{
|
||||
case MessageEnteredLicense::LICENSE_NONE:
|
||||
title += " [trial]";
|
||||
break;
|
||||
case MessageEnteredLicense::LICENSE_TEST:
|
||||
title += " [test]";
|
||||
break;
|
||||
case MessageEnteredLicense::LICENSE_NONE:
|
||||
case MessageEnteredLicense::LICENSE_NON_COMMERCIAL:
|
||||
title += " [non-commercial]";
|
||||
break;
|
||||
|
||||
@@ -55,8 +55,6 @@ public:
|
||||
int handleDialog(const std::string& message, const std::vector<std::string>& options);
|
||||
std::shared_ptr<DialogView> getDialogView();
|
||||
|
||||
bool isInTrial() const;
|
||||
|
||||
void updateHistory(const std::vector<SearchMatch>& history);
|
||||
void updateBookmarks(const std::vector<std::shared_ptr<Bookmark>>& bookmarks);
|
||||
|
||||
@@ -93,6 +91,7 @@ private:
|
||||
std::shared_ptr<UpdateChecker> m_updateChecker;
|
||||
|
||||
MessageEnteredLicense::LicenseType m_licenseType;
|
||||
TimeStamp m_lastLicenseCheck;
|
||||
};
|
||||
|
||||
#endif // APPLICATION_H
|
||||
|
||||
@@ -385,7 +385,6 @@ add_files(
|
||||
utility/messaging/type/MessageCodeReference.h
|
||||
utility/messaging/type/MessageColorSchemeTest.h
|
||||
utility/messaging/type/MessageDeactivateEdge.h
|
||||
utility/messaging/type/MessageDispatchWhenLicenseValid.h
|
||||
utility/messaging/type/MessageDisplayBookmarkCreator.h
|
||||
utility/messaging/type/MessageDisplayBookmarks.h
|
||||
utility/messaging/type/MessageEnteredLicense.h
|
||||
|
||||
+32
-33
@@ -98,7 +98,7 @@ LicenseChecker::LicenseState LicenseChecker::checkCurrentLicense() const
|
||||
return checkLicense(license);
|
||||
}
|
||||
|
||||
LicenseChecker::LicenseState LicenseChecker::checkLicenseString(const std::string licenseString) const
|
||||
LicenseChecker::LicenseState LicenseChecker::checkLicenseString(const std::string& licenseString) const
|
||||
{
|
||||
if (licenseString.size() == 0)
|
||||
{
|
||||
@@ -145,42 +145,41 @@ MessageEnteredLicense::LicenseType LicenseChecker::getCurrentLicenseType() const
|
||||
return MessageEnteredLicense::LICENSE_COMMERCIAL;
|
||||
}
|
||||
|
||||
MessageEnteredLicense::LicenseType LicenseChecker::getLicenseType(const std::string& licenseString) const
|
||||
{
|
||||
if (licenseString.size() == 0)
|
||||
{
|
||||
return MessageEnteredLicense::LICENSE_NONE;
|
||||
}
|
||||
|
||||
License license;
|
||||
bool isLoaded = license.loadFromString(licenseString);
|
||||
if (!isLoaded)
|
||||
{
|
||||
return MessageEnteredLicense::LICENSE_NONE;
|
||||
}
|
||||
|
||||
LicenseState state = checkLicense(license);
|
||||
if (state != LICENSE_VALID)
|
||||
{
|
||||
return MessageEnteredLicense::LICENSE_NONE;
|
||||
}
|
||||
else if (license.isTestLicense())
|
||||
{
|
||||
return MessageEnteredLicense::LICENSE_TEST;
|
||||
}
|
||||
else if (license.isNonCommercialLicenseType())
|
||||
{
|
||||
return MessageEnteredLicense::LICENSE_NON_COMMERCIAL;
|
||||
}
|
||||
|
||||
return MessageEnteredLicense::LICENSE_COMMERCIAL;
|
||||
}
|
||||
|
||||
LicenseChecker::LicenseChecker()
|
||||
: m_forcedLicenseEntering(false)
|
||||
{
|
||||
}
|
||||
|
||||
void LicenseChecker::handleMessage(MessageDispatchWhenLicenseValid* message)
|
||||
{
|
||||
LicenseState state = checkCurrentLicense();
|
||||
|
||||
if (state == LICENSE_VALID)
|
||||
{
|
||||
message->content->dispatch();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pendingMessage = message->content;
|
||||
|
||||
if (!m_forcedLicenseEntering)
|
||||
{
|
||||
m_forcedLicenseEntering = true;
|
||||
MessageForceEnterLicense(state == LICENSE_EXPIRED).dispatch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LicenseChecker::handleMessage(MessageEnteredLicense* message)
|
||||
{
|
||||
m_forcedLicenseEntering = false;
|
||||
|
||||
if (m_pendingMessage)
|
||||
{
|
||||
m_pendingMessage->dispatch();
|
||||
m_pendingMessage.reset();
|
||||
}
|
||||
}
|
||||
|
||||
LicenseChecker::LicenseState LicenseChecker::checkLicense(License& license) const
|
||||
{
|
||||
if (license.isExpired())
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
#ifndef LICENSE_CHECKER_H
|
||||
#define LICENSE_CHECKER_H
|
||||
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h"
|
||||
#include "utility/messaging/type/MessageEnteredLicense.h"
|
||||
|
||||
class License;
|
||||
|
||||
class LicenseChecker
|
||||
: public MessageListener<MessageDispatchWhenLicenseValid>
|
||||
, public MessageListener<MessageEnteredLicense>
|
||||
{
|
||||
public:
|
||||
enum LicenseState
|
||||
@@ -32,24 +28,19 @@ public:
|
||||
|
||||
bool isCurrentLicenseValid();
|
||||
LicenseState checkCurrentLicense() const;
|
||||
LicenseState checkLicenseString(const std::string licenseString) const;
|
||||
LicenseState checkLicenseString(const std::string& licenseString) const;
|
||||
|
||||
MessageEnteredLicense::LicenseType getCurrentLicenseType() const;
|
||||
MessageEnteredLicense::LicenseType getLicenseType(const std::string& licenseString) const;
|
||||
|
||||
private:
|
||||
LicenseChecker();
|
||||
LicenseChecker(const LicenseChecker&) = delete;
|
||||
void operator=(const LicenseChecker&) = delete;
|
||||
|
||||
void handleMessage(MessageDispatchWhenLicenseValid* message);
|
||||
void handleMessage(MessageEnteredLicense* message);
|
||||
|
||||
LicenseState checkLicense(License& license) const;
|
||||
|
||||
static std::shared_ptr<LicenseChecker> s_instance;
|
||||
|
||||
std::shared_ptr<MessageBase> m_pendingMessage;
|
||||
bool m_forcedLicenseEntering;
|
||||
};
|
||||
|
||||
#endif // LICENSE_CHECKER_H
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/messaging/type/MessageActivateSourceLocations.h"
|
||||
#include "utility/messaging/type/MessageActivateWindow.h"
|
||||
#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h"
|
||||
#include "utility/messaging/type/MessageProjectNew.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
#include "utility/messaging/type/MessageActivateFile.h"
|
||||
@@ -143,29 +142,13 @@ void IDECommunicationController::handleSetActiveTokenMessage(
|
||||
void IDECommunicationController::handleCreateProjectMessage(const NetworkProtocolHelper::CreateProjectMessage& message)
|
||||
{
|
||||
LOG_ERROR_STREAM(<< "Network Protocol CreateProjectMessage not supported anymore.");
|
||||
|
||||
// if (message.valid)
|
||||
// {
|
||||
// if (message.ideId == "vs")
|
||||
// {
|
||||
// std::shared_ptr<MessageProjectNew> msg = std::make_shared<MessageProjectNew>();
|
||||
// msg->setSolutionPath(message.solutionFileLocation);
|
||||
// msg->ideId = message.ideId;
|
||||
// MessageDispatchWhenLicenseValid(msg).dispatch();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// LOG_ERROR_STREAM(<< "Unable to parse provided solution, unknown format");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
void IDECommunicationController::handleCreateCDBProjectMessage(const NetworkProtocolHelper::CreateCDBProjectMessage& message)
|
||||
{
|
||||
if (message.valid)
|
||||
{
|
||||
MessageDispatchWhenLicenseValid(
|
||||
std::make_shared<MessageProjectNew>(message.cdbFileLocation, message.headerPaths)).dispatch();
|
||||
MessageProjectNew(message.cdbFileLocation, message.headerPaths).dispatch();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "utility/file/FilePath.h"
|
||||
#include "utility/file/FileSystem.h"
|
||||
#include "utility/messaging/type/MessageClearErrorCount.h"
|
||||
#include "utility/messaging/type/MessageDispatchWhenLicenseValid.h"
|
||||
#include "utility/messaging/type/MessageFinishedParsing.h"
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
@@ -131,16 +130,6 @@ bool Project::refresh(bool forceRefresh)
|
||||
}
|
||||
}
|
||||
|
||||
if (Application::getInstance()->isInTrial())
|
||||
{
|
||||
std::vector<std::string> options = { "Ok" };
|
||||
dialogView->confirm("You can't refresh the project in trial mode, please unlock with a license key.", options);
|
||||
|
||||
MessageDispatchWhenLicenseValid(std::make_shared<MessageRefresh>()).dispatch();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
dialogView->showUnknownProgressDialog("Preparing Project", "Processing Files");
|
||||
|
||||
ScopedFunctor dialogHider([&dialogView](){
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#include "settings/ApplicationSettings.h"
|
||||
|
||||
#include "License.h"
|
||||
#include "settings/migration/SettingsMigrator.h"
|
||||
#include "settings/migration/SettingsMigrationLambda.h"
|
||||
#include "settings/migration/SettingsMigrationMoveKey.h"
|
||||
#include "utility/AppPath.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "utility/Status.h"
|
||||
#include "utility/TimeStamp.h"
|
||||
@@ -9,7 +12,7 @@
|
||||
#include "utility/UserPaths.h"
|
||||
#include "utility/Version.h"
|
||||
|
||||
const size_t ApplicationSettings::VERSION = 2;
|
||||
const size_t ApplicationSettings::VERSION = 3;
|
||||
|
||||
std::shared_ptr<ApplicationSettings> ApplicationSettings::s_instance;
|
||||
|
||||
@@ -57,6 +60,20 @@ bool ApplicationSettings::load(const FilePath& filePath)
|
||||
"network/coati_port",
|
||||
"network/sourcetrail_port"
|
||||
));
|
||||
migrator.addMigration(3, std::make_shared<SettingsMigrationLambda>(
|
||||
[](const SettingsMigration* migration, Settings* settings)
|
||||
{
|
||||
License license;
|
||||
bool isLoaded = license.loadFromEncodedString(
|
||||
migration->getValueFromSettings<std::string>(settings, "user/license/license", ""), AppPath::getAppPath());
|
||||
if (isLoaded && license.isValid() && license.isNonCommercialLicenseType())
|
||||
{
|
||||
migration->removeValuesInSettings(settings, "user/license/license");
|
||||
migration->removeValuesInSettings(settings, "user/license/check");
|
||||
migration->setValueInSettings(settings, "user/license/non_commercial_use", true);
|
||||
}
|
||||
}
|
||||
));
|
||||
|
||||
bool migrated = migrator.migrate(this, ApplicationSettings::VERSION);
|
||||
|
||||
@@ -524,17 +541,27 @@ std::string ApplicationSettings::getLicenseString() const
|
||||
return getValue<std::string>("user/license/license", "");
|
||||
}
|
||||
|
||||
std::string ApplicationSettings::getLicenseCheck() const
|
||||
{
|
||||
return getValue<std::string>("user/license/check", "");
|
||||
}
|
||||
|
||||
void ApplicationSettings::setLicenseString(const std::string& licenseString)
|
||||
{
|
||||
setValue<std::string>("user/license/license", licenseString);
|
||||
}
|
||||
|
||||
std::string ApplicationSettings::getLicenseCheck() const
|
||||
{
|
||||
return getValue<std::string>("user/license/check", "");
|
||||
}
|
||||
|
||||
void ApplicationSettings::setLicenseCheck(const std::string& hash)
|
||||
{
|
||||
setValue<std::string>("user/license/check", hash);
|
||||
}
|
||||
|
||||
bool ApplicationSettings::getNonCommercialUse() const
|
||||
{
|
||||
return getValue<bool>("user/license/non_commercial_use", false);
|
||||
}
|
||||
|
||||
void ApplicationSettings::setNonCommercialUse(bool nonCommercialUse)
|
||||
{
|
||||
setValue<bool>("user/license/non_commercial_use", nonCommercialUse);
|
||||
}
|
||||
|
||||
@@ -159,6 +159,9 @@ public:
|
||||
std::string getLicenseCheck() const;
|
||||
void setLicenseCheck(const std::string& hash);
|
||||
|
||||
bool getNonCommercialUse() const;
|
||||
void setNonCommercialUse(bool nonCommercialUse);
|
||||
|
||||
private:
|
||||
ApplicationSettings(const ApplicationSettings&);
|
||||
void operator=(const ApplicationSettings&);
|
||||
|
||||
@@ -111,7 +111,7 @@ void CommandConfig::setup()
|
||||
("global-framework-search-paths,F", po::value<std::vector<std::string>>(),
|
||||
"Global include paths (once per path or comma separated)")
|
||||
("show,s", "displays all settings")
|
||||
;
|
||||
("non-commercial-use", po::value<bool>(), "Enable non-commercial use. <true/false>");
|
||||
|
||||
m_options.add(options);
|
||||
}
|
||||
@@ -142,9 +142,6 @@ void CommandConfig::printSettings(ApplicationSettings* settings)
|
||||
printVector("global-header-search-paths", settings->getHeaderSearchPaths());
|
||||
printVector("global-framework-search-paths", settings->getFrameworkSearchPaths());
|
||||
printVector("jre-system-library-paths", settings->getJreSystemLibraryPaths());
|
||||
License license;
|
||||
license.loadFromEncodedString(settings->getLicenseString(), AppPath::getAppPath());
|
||||
std::cout << "\nValid license: " << license.isValid() << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -205,6 +202,8 @@ ReturnStatus CommandConfig::parse(std::vector<std::string>& args)
|
||||
parseAndSetValue(&ApplicationSettings::setHeaderSearchPaths, "global-header-search-paths", settings, vm);
|
||||
parseAndSetValue(&ApplicationSettings::setFrameworkSearchPaths, "global-framework-search-paths", settings, vm);
|
||||
|
||||
parseAndSetValue(&ApplicationSettings::setNonCommercialUse, "non-commercial-use", settings, vm);
|
||||
|
||||
// license
|
||||
if (vm.count("license-string") || vm.count("license-file") )
|
||||
{
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
#ifndef MESSAGE_DISPATCH_WHEN_LICENSE_VALID_H
|
||||
#define MESSAGE_DISPATCH_WHEN_LICENSE_VALID_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageDispatchWhenLicenseValid
|
||||
: public Message<MessageDispatchWhenLicenseValid>
|
||||
{
|
||||
public:
|
||||
MessageDispatchWhenLicenseValid(std::shared_ptr<MessageBase> content)
|
||||
: content(content)
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageDispatchWhenLicenseValid";
|
||||
}
|
||||
|
||||
std::shared_ptr<MessageBase> content;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_DISPATCH_WHEN_LICENSE_VALID_H
|
||||
@@ -1,14 +1,15 @@
|
||||
#ifndef MESSAGE_FORCE_ENTER_LICENSE_H
|
||||
#define MESSAGE_FORCE_ENTER_LICENSE_H
|
||||
|
||||
#include "LicenseChecker.h"
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageForceEnterLicense
|
||||
: public Message<MessageForceEnterLicense>
|
||||
{
|
||||
public:
|
||||
MessageForceEnterLicense(bool licenseExpired)
|
||||
: licenseExpired(licenseExpired)
|
||||
MessageForceEnterLicense(LicenseChecker::LicenseState state)
|
||||
: state(state)
|
||||
{
|
||||
setSendAsTask(false);
|
||||
}
|
||||
@@ -18,7 +19,7 @@ public:
|
||||
return "MessageForceEnterLicense";
|
||||
}
|
||||
|
||||
bool licenseExpired;
|
||||
const LicenseChecker::LicenseState state;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_FORCE_ENTER_LICENSE_H
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "data/indexer/IndexerCommandCxxManual.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "utility/utility.h"
|
||||
#include "Application.h"
|
||||
|
||||
SourceGroupCxxEmpty::SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxxEmpty> settings)
|
||||
: m_settings(settings)
|
||||
|
||||
@@ -213,8 +213,8 @@ add_files(
|
||||
qt/window/QtIndexingDialog.h
|
||||
qt/window/QtKeyboardShortcuts.cpp
|
||||
qt/window/QtKeyboardShortcuts.h
|
||||
qt/window/QtLicense.cpp
|
||||
qt/window/QtLicense.h
|
||||
qt/window/QtLicenseWindow.cpp
|
||||
qt/window/QtLicenseWindow.h
|
||||
qt/window/QtMainWindow.cpp
|
||||
qt/window/QtMainWindow.h
|
||||
qt/window/QtPreferencesWindow.cpp
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
#include "utility/messaging/type/MessageActivateFile.h"
|
||||
#include "utility/messaging/type/MessageProjectEdit.h"
|
||||
|
||||
#include "Application.h"
|
||||
#include "project/Project.h"
|
||||
#include "qt/utility/QtContextMenu.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "settings/ColorScheme.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
#include "Application.h"
|
||||
|
||||
QtCodeFileTitleButton::QtCodeFileTitleButton(QWidget* parent)
|
||||
: QPushButton(parent)
|
||||
@@ -89,26 +89,18 @@ void QtCodeFileTitleButton::setProject(const std::string& name)
|
||||
setText(name.c_str());
|
||||
m_filePath = FilePath();
|
||||
|
||||
if (Application::getInstance()->isInTrial())
|
||||
{
|
||||
setIcon(QIcon());
|
||||
setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string text = ResourcePaths::getGuiPath().str() + "code_view/images/edit.png";
|
||||
setToolTip("edit project");
|
||||
std::string text = ResourcePaths::getGuiPath().str() + "code_view/images/edit.png";
|
||||
setToolTip("edit project");
|
||||
|
||||
setIcon(utility::colorizePixmap(
|
||||
QPixmap(text.c_str()),
|
||||
ColorScheme::getInstance()->getColor("code/file/title/icon").c_str()
|
||||
));
|
||||
}
|
||||
setIcon(utility::colorizePixmap(
|
||||
QPixmap(text.c_str()),
|
||||
ColorScheme::getInstance()->getColor("code/file/title/icon").c_str()
|
||||
));
|
||||
}
|
||||
|
||||
void QtCodeFileTitleButton::updateTexts()
|
||||
{
|
||||
if (Application::getInstance()->isInTrial() || m_filePath.empty())
|
||||
if (m_filePath.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include <QPushButton>
|
||||
|
||||
#include "utility/messaging/type/MessageRefresh.h"
|
||||
|
||||
#include "utility/ResourcePaths.h"
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
@@ -26,8 +25,6 @@ QtRefreshBar::QtRefreshBar()
|
||||
m_refreshButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
layout->addWidget(m_refreshButton);
|
||||
|
||||
m_refreshButton->setEnabled(false);
|
||||
|
||||
connect(m_refreshButton, &QPushButton::clicked, this, &QtRefreshBar::refreshClicked);
|
||||
|
||||
refreshStyle();
|
||||
@@ -53,13 +50,3 @@ void QtRefreshBar::refreshStyle()
|
||||
"search/button"
|
||||
));
|
||||
}
|
||||
|
||||
void QtRefreshBar::handleMessage(MessageEnteredLicense* message)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_refreshButton->setEnabled(true);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,14 +4,11 @@
|
||||
#include <QFrame>
|
||||
|
||||
#include "qt/utility/QtThreadedFunctor.h"
|
||||
#include "utility/messaging/type/MessageEnteredLicense.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
|
||||
class QPushButton;
|
||||
|
||||
class QtRefreshBar
|
||||
: public QFrame
|
||||
, public MessageListener<MessageEnteredLicense>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -25,8 +22,6 @@ private slots:
|
||||
void refreshClicked();
|
||||
|
||||
private:
|
||||
virtual void handleMessage(MessageEnteredLicense* message);
|
||||
|
||||
QtThreadedLambdaFunctor m_onQtThread;
|
||||
|
||||
QPushButton* m_refreshButton;
|
||||
|
||||
@@ -70,14 +70,12 @@ void QtUpdateChecker::check(bool force, std::function<void(Result)> callback)
|
||||
switch (LicenseChecker::getInstance()->getCurrentLicenseType())
|
||||
{
|
||||
case MessageEnteredLicense::LICENSE_NONE:
|
||||
licenseString = "trial";
|
||||
case MessageEnteredLicense::LICENSE_NON_COMMERCIAL:
|
||||
licenseString = "private";
|
||||
break;
|
||||
case MessageEnteredLicense::LICENSE_TEST:
|
||||
licenseString = "test";
|
||||
break;
|
||||
case MessageEnteredLicense::LICENSE_NON_COMMERCIAL:
|
||||
licenseString = "private";
|
||||
break;
|
||||
case MessageEnteredLicense::LICENSE_COMMERCIAL:
|
||||
licenseString = "commercial";
|
||||
break;
|
||||
|
||||
@@ -145,12 +145,12 @@ void QtMainView::updateBookmarksMenu(const std::vector<std::shared_ptr<Bookmark>
|
||||
|
||||
void QtMainView::handleMessage(MessageForceEnterLicense* message)
|
||||
{
|
||||
bool expired = message->licenseExpired;
|
||||
LicenseChecker::LicenseState state = message->state;
|
||||
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_window->forceEnterLicense(expired);
|
||||
m_window->forceEnterLicense(state);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,169 +0,0 @@
|
||||
#include "qt/window/QtLicense.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QTextEdit>
|
||||
|
||||
#include "LicenseChecker.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
|
||||
QtLicense::QtLicense(QWidget *parent)
|
||||
: QtWindow(false, parent)
|
||||
{
|
||||
}
|
||||
|
||||
QSize QtLicense::sizeHint() const
|
||||
{
|
||||
return QSize(780, 520);
|
||||
}
|
||||
|
||||
void QtLicense::clear()
|
||||
{
|
||||
if (m_licenseText)
|
||||
{
|
||||
m_licenseText->setText("");
|
||||
}
|
||||
|
||||
if (m_errorLabel)
|
||||
{
|
||||
m_errorLabel->setText(" ");
|
||||
}
|
||||
}
|
||||
|
||||
void QtLicense::load()
|
||||
{
|
||||
clear();
|
||||
|
||||
std::string licenseString = LicenseChecker::getInstance()->getCurrentLicenseString();
|
||||
|
||||
if (licenseString.size() && m_licenseText)
|
||||
{
|
||||
m_licenseText->setText(licenseString.c_str());
|
||||
}
|
||||
|
||||
updateCloseButton("Cancel");
|
||||
}
|
||||
|
||||
void QtLicense::setErrorMessage(const QString& errorMessage)
|
||||
{
|
||||
if (m_errorLabel)
|
||||
{
|
||||
m_errorLabel->setText(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
void QtLicense::populateWindow(QWidget* widget)
|
||||
{
|
||||
QVBoxLayout* subLayout = new QVBoxLayout();
|
||||
subLayout->setContentsMargins(270, 0, 0, 0);
|
||||
|
||||
QLabel* licenseName = new QLabel();
|
||||
licenseName->setText(QString::fromLatin1("Enter Licence"));
|
||||
licenseName->setObjectName("title");
|
||||
subLayout->addWidget(licenseName);
|
||||
|
||||
subLayout->addSpacing(10);
|
||||
|
||||
QLabel* licenseIntro = new QLabel();
|
||||
licenseIntro->setText(QString::fromLatin1("Please enter a licence key to activate Sourcetrail:"));
|
||||
licenseIntro->setObjectName("licenseIntro");
|
||||
subLayout->addWidget(licenseIntro);
|
||||
|
||||
m_licenseText = new QTextEdit();
|
||||
m_licenseText->setObjectName("licenseField");
|
||||
m_licenseText->setAcceptRichText(false);
|
||||
m_licenseText->setPlaceholderText(
|
||||
"-----BEGIN LICENSE-----\n"
|
||||
"Product: Sourcetrail\n"
|
||||
"Licensed to:\n"
|
||||
"License type:\n"
|
||||
"Valid up to version:\n"
|
||||
"-\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxx\n"
|
||||
"-----END LICENSE-----\n"
|
||||
);
|
||||
subLayout->addWidget(m_licenseText);
|
||||
|
||||
m_errorLabel = new QLabel(this);
|
||||
m_errorLabel->setObjectName("licenseError");
|
||||
m_errorLabel->setText(" ");
|
||||
subLayout->addWidget(m_errorLabel);
|
||||
|
||||
subLayout->addSpacing(10);
|
||||
|
||||
QLabel* linkLabel = new QLabel(this);
|
||||
linkLabel->setObjectName("linkLabel");
|
||||
linkLabel->setText(
|
||||
"Don't have a license key yet? "
|
||||
"Please <a href=\"http://sourcetrail.com/buy-license\" style=\"color: #007AC2;\">purchase a license</a>, "
|
||||
"or get a temporary <a href=\"http://sourcetrail.com/test-license\" style=\"color: #007AC2;\">test license</a>.");
|
||||
linkLabel->setOpenExternalLinks(true);
|
||||
linkLabel->setWordWrap(true);
|
||||
linkLabel->setGeometry(275, 300, 300, 50);
|
||||
subLayout->addWidget(linkLabel);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addLayout(subLayout);
|
||||
layout->addSpacing(20);
|
||||
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
|
||||
void QtLicense::windowReady()
|
||||
{
|
||||
m_content->setStyleSheet(m_content->styleSheet() + utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("license/license.css"))).c_str());
|
||||
|
||||
addLogo();
|
||||
|
||||
updateNextButton("Activate");
|
||||
setPreviousVisible(false);
|
||||
|
||||
m_title->hide();
|
||||
}
|
||||
|
||||
void QtLicense::handleNext()
|
||||
{
|
||||
std::string licenseString = m_licenseText->toPlainText().toStdString();
|
||||
|
||||
LicenseChecker* checker = LicenseChecker::getInstance().get();
|
||||
LicenseChecker::LicenseState state = checker->checkLicenseString(licenseString);
|
||||
|
||||
std::string errorString;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case LicenseChecker::LICENSE_EMPTY:
|
||||
errorString = "No licence key was entered.";
|
||||
break;
|
||||
case LicenseChecker::LICENSE_MOVED:
|
||||
case LicenseChecker::LICENSE_MALFORMED:
|
||||
errorString = "The entered license key is malformed.";
|
||||
break;
|
||||
case LicenseChecker::LICENSE_INVALID:
|
||||
errorString = "The entered license key is invalid.";
|
||||
break;
|
||||
case LicenseChecker::LICENSE_EXPIRED:
|
||||
errorString = "The entered license key is expired.";
|
||||
break;
|
||||
case LicenseChecker::LICENSE_VALID:
|
||||
{
|
||||
checker->saveCurrentLicenseString(licenseString);
|
||||
m_errorLabel->setText(" ");
|
||||
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_errorLabel->setText(errorString.c_str());
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
#ifndef QT_LICENSE_H
|
||||
#define QT_LICENSE_H
|
||||
|
||||
#include "qt/window/QtWindow.h"
|
||||
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
class QTextEdit;
|
||||
|
||||
class QtLicense
|
||||
: public QtWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtLicense(QWidget* parent = 0);
|
||||
QSize sizeHint() const override;
|
||||
|
||||
void clear();
|
||||
void load();
|
||||
|
||||
void setErrorMessage(const QString& errorMessage);
|
||||
|
||||
protected:
|
||||
// QtWindow implementation
|
||||
virtual void populateWindow(QWidget* widget) override;
|
||||
virtual void windowReady() override;
|
||||
|
||||
virtual void handleNext() override;
|
||||
|
||||
private:
|
||||
QTextEdit* m_licenseText;
|
||||
QLabel* m_errorLabel;
|
||||
};
|
||||
|
||||
#endif // QT_LICENSE_H
|
||||
@@ -0,0 +1,326 @@
|
||||
#include "qt/window/QtLicenseWindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QRadioButton>
|
||||
#include <QTextEdit>
|
||||
|
||||
#include "LicenseChecker.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
|
||||
QtLicenseWindow::QtLicenseWindow(QWidget *parent)
|
||||
: QtWindow(false, parent)
|
||||
{
|
||||
}
|
||||
|
||||
QSize QtLicenseWindow::sizeHint() const
|
||||
{
|
||||
return QSize(700, 500);
|
||||
}
|
||||
|
||||
void QtLicenseWindow::clear()
|
||||
{
|
||||
if (m_licenseText)
|
||||
{
|
||||
m_commercialUse->setChecked(false);
|
||||
m_privateUse->setChecked(false);
|
||||
|
||||
m_licenseText->setText("");
|
||||
m_errorLabel->setText(" ");
|
||||
}
|
||||
}
|
||||
|
||||
void QtLicenseWindow::load()
|
||||
{
|
||||
clear();
|
||||
|
||||
std::string licenseString = LicenseChecker::getInstance()->getCurrentLicenseString();
|
||||
|
||||
if (licenseString.size() && m_licenseText)
|
||||
{
|
||||
m_commercialUse->setChecked(true);
|
||||
|
||||
m_licenseText->setEnabled(true);
|
||||
m_licenseText->setText(licenseString.c_str());
|
||||
}
|
||||
else if (ApplicationSettings::getInstance()->getNonCommercialUse())
|
||||
{
|
||||
m_privateUse->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
void QtLicenseWindow::setErrorMessage(const QString& errorMessage)
|
||||
{
|
||||
if (m_errorLabel)
|
||||
{
|
||||
m_errorLabel->setText(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
void QtLicenseWindow::populateWindow(QWidget* widget)
|
||||
{
|
||||
QVBoxLayout* subLayout = new QVBoxLayout();
|
||||
subLayout->setContentsMargins(270, 0, 0, 0);
|
||||
|
||||
// commercial
|
||||
m_commercialUse = new QRadioButton("Commercial Use");
|
||||
m_commercialUse->setObjectName("licenseOption");
|
||||
subLayout->addWidget(m_commercialUse);
|
||||
|
||||
QLabel* linkLabel = new QLabel(this);
|
||||
linkLabel->setText(
|
||||
"For commercial use please <a href=\"http://sourcetrail.com/buy-license\" style=\"color: #007AC2;\">purchase a license</a>, "
|
||||
"or get a temporary <a href=\"http://sourcetrail.com/test-license\" style=\"color: #007AC2;\">test license</a>.");
|
||||
linkLabel->setOpenExternalLinks(true);
|
||||
linkLabel->setWordWrap(true);
|
||||
subLayout->addWidget(linkLabel);
|
||||
|
||||
m_licenseText = new QTextEdit();
|
||||
m_licenseText->setObjectName("licenseField");
|
||||
m_licenseText->setAcceptRichText(false);
|
||||
m_licenseText->setPlaceholderText(
|
||||
"-----BEGIN LICENSE-----\n"
|
||||
"Product: Sourcetrail\n"
|
||||
"Licensed to:\n"
|
||||
"License type:\n"
|
||||
"Valid up to version:\n"
|
||||
"-\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n"
|
||||
"xxxxxxxxxxxxxx\n"
|
||||
"-----END LICENSE-----\n"
|
||||
);
|
||||
m_licenseText->setEnabled(false);
|
||||
subLayout->addWidget(m_licenseText);
|
||||
|
||||
m_errorLabel = new QLabel(" ", this);
|
||||
m_errorLabel->setObjectName("licenseError");
|
||||
m_errorLabel->setWordWrap(true);
|
||||
subLayout->addWidget(m_errorLabel);
|
||||
|
||||
subLayout->addSpacing(10);
|
||||
|
||||
|
||||
// private
|
||||
m_privateUse = new QRadioButton("Non-Commercial Use");
|
||||
m_privateUse->setObjectName("licenseOption");
|
||||
subLayout->addWidget(m_privateUse);
|
||||
|
||||
QLabel* licenseIntro2 = new QLabel("You confirm that you will use Sourcetrail solely for non-commercial purposes.");
|
||||
licenseIntro2->setWordWrap(true);
|
||||
subLayout->addWidget(licenseIntro2);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addLayout(subLayout);
|
||||
layout->addSpacing(20);
|
||||
|
||||
widget->setLayout(layout);
|
||||
|
||||
|
||||
connect(m_commercialUse, &QRadioButton::toggled, this, &QtLicenseWindow::optionChanged);
|
||||
connect(m_privateUse, &QRadioButton::toggled, this, &QtLicenseWindow::optionChanged);
|
||||
}
|
||||
|
||||
void QtLicenseWindow::windowReady()
|
||||
{
|
||||
m_content->setStyleSheet(m_content->styleSheet() +
|
||||
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("license/license.css"))).c_str());
|
||||
|
||||
addLogo();
|
||||
|
||||
updateTitle("Select Licence Option");
|
||||
|
||||
updateNextButton("Activate");
|
||||
setNextEnabled(false);
|
||||
|
||||
setPreviousVisible(false);
|
||||
updateCloseButton("Cancel");
|
||||
}
|
||||
|
||||
void QtLicenseWindow::handleNext()
|
||||
{
|
||||
if (m_commercialUse->isChecked())
|
||||
{
|
||||
std::string licenseString = m_licenseText->toPlainText().toStdString();
|
||||
|
||||
LicenseChecker* checker = LicenseChecker::getInstance().get();
|
||||
LicenseChecker::LicenseState state = checker->checkLicenseString(licenseString);
|
||||
|
||||
std::string errorString;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case LicenseChecker::LICENSE_EMPTY:
|
||||
errorString = "No licence key was entered.";
|
||||
break;
|
||||
case LicenseChecker::LICENSE_MOVED:
|
||||
case LicenseChecker::LICENSE_MALFORMED:
|
||||
errorString = "The entered license key is malformed.";
|
||||
break;
|
||||
case LicenseChecker::LICENSE_INVALID:
|
||||
errorString = "The entered license key is invalid.";
|
||||
break;
|
||||
case LicenseChecker::LICENSE_EXPIRED:
|
||||
errorString = "The entered license key is expired.";
|
||||
break;
|
||||
case LicenseChecker::LICENSE_VALID:
|
||||
{
|
||||
if (checker->getLicenseType(licenseString) == MessageEnteredLicense::LICENSE_NON_COMMERCIAL)
|
||||
{
|
||||
errorString =
|
||||
"The entered license key does not permit commercial use. You no longer need a license "
|
||||
"key for non-commercial use. Please choose the non-commercial option below.";
|
||||
break;
|
||||
}
|
||||
|
||||
checker->saveCurrentLicenseString(licenseString);
|
||||
m_errorLabel->setText(" ");
|
||||
|
||||
ApplicationSettings::getInstance()->setNonCommercialUse(false);
|
||||
ApplicationSettings::getInstance()->save();
|
||||
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_errorLabel->setText(errorString.c_str());
|
||||
}
|
||||
else if (m_privateUse->isChecked())
|
||||
{
|
||||
if (!m_confirmWindow)
|
||||
{
|
||||
m_confirmWindow = new QtNonCommercialInfoWindow();
|
||||
m_confirmWindow->setup();
|
||||
|
||||
connect(m_confirmWindow, &QtWindow::canceled,
|
||||
[this]()
|
||||
{
|
||||
m_confirmWindow->hideWindow();
|
||||
raise();
|
||||
}
|
||||
);
|
||||
|
||||
connect(m_confirmWindow, &QtWindow::finished,
|
||||
[this]()
|
||||
{
|
||||
m_confirmWindow->hideWindow();
|
||||
raise();
|
||||
|
||||
ApplicationSettings::getInstance()->setNonCommercialUse(true);
|
||||
ApplicationSettings::getInstance()->save();
|
||||
|
||||
emit finished();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
m_confirmWindow->showWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void QtLicenseWindow::optionChanged()
|
||||
{
|
||||
m_licenseText->setEnabled(m_commercialUse->isChecked());
|
||||
setNextEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
QtNonCommercialInfoWindow::QtNonCommercialInfoWindow(QWidget *parent)
|
||||
: QtWindow(false, parent)
|
||||
{
|
||||
}
|
||||
|
||||
QSize QtNonCommercialInfoWindow::sizeHint() const
|
||||
{
|
||||
return QSize(450, 500);
|
||||
}
|
||||
|
||||
void QtNonCommercialInfoWindow::populateWindow(QWidget* widget)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(widget);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
QLabel* titleLabel;
|
||||
QLabel* textLabel;
|
||||
|
||||
|
||||
titleLabel = new QLabel("Is your use non-commercial?");
|
||||
textLabel = new QLabel(
|
||||
"A use is non-commercial only if it is in no manner primarily intended for or directed toward "
|
||||
"commercial advantage or private monetary compensation.");
|
||||
|
||||
QFont font = titleLabel->font();
|
||||
font.setBold(true);
|
||||
titleLabel->setFont(font);
|
||||
textLabel->setWordWrap(true);
|
||||
|
||||
layout->addWidget(titleLabel);
|
||||
layout->addWidget(textLabel);
|
||||
layout->addSpacing(10);
|
||||
|
||||
|
||||
titleLabel = new QLabel("When does non-commercial use NOT apply?");
|
||||
textLabel = new QLabel(
|
||||
"<p>Running Sourcetrail for 'Non-Commercial Use' is not permitted, if your use is in some sense commercial. "
|
||||
"Examples of commercial uses are:</p>"
|
||||
"<ul><li> you are using Sourcetrail to work on your company's projects (no matter whether you are working on "
|
||||
"open-source projects as well),</li>"
|
||||
"<li> you are a student and you use Sourcetrail for your work as a freelancer,</li>"
|
||||
"<li> you use Sourcetrail in your spare time to help on your friend's new game and you are getting paid for that.</li></ul>"
|
||||
"<p>In cases like these you will need a commercial license.</p>"
|
||||
);
|
||||
|
||||
titleLabel->setFont(font);
|
||||
textLabel->setWordWrap(true);
|
||||
|
||||
layout->addWidget(titleLabel);
|
||||
layout->addWidget(textLabel);
|
||||
layout->addSpacing(10);
|
||||
|
||||
|
||||
titleLabel = new QLabel("Not sure?");
|
||||
textLabel = new QLabel(
|
||||
"Contact mail@sourcetrail.com and explain your intended use in detail, then we may confirm whether a "
|
||||
"non-commercial license applies."
|
||||
);
|
||||
|
||||
titleLabel->setFont(font);
|
||||
textLabel->setWordWrap(true);
|
||||
|
||||
layout->addWidget(titleLabel);
|
||||
layout->addWidget(textLabel);
|
||||
layout->addStretch();
|
||||
|
||||
QCheckBox* checkbox = new QCheckBox("I confirm solely non-commercial use of Sourcetrail according to above conditions.");
|
||||
connect(checkbox, &QCheckBox::toggled,
|
||||
[checkbox, this]()
|
||||
{
|
||||
setNextEnabled(checkbox->isChecked());
|
||||
}
|
||||
);
|
||||
layout->addWidget(checkbox);
|
||||
layout->addStretch();
|
||||
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
|
||||
void QtNonCommercialInfoWindow::windowReady()
|
||||
{
|
||||
updateTitle("Non-Commercial Use Confirmation");
|
||||
updateCloseButton("Cancel");
|
||||
updateNextButton("Confirm");
|
||||
|
||||
setNextEnabled(false);
|
||||
setPreviousVisible(false);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef QT_LICENSE_WINDOW_H
|
||||
#define QT_LICENSE_WINDOW_H
|
||||
|
||||
#include "qt/window/QtWindow.h"
|
||||
|
||||
class QLabel;
|
||||
class QRadioButton;
|
||||
class QTextEdit;
|
||||
|
||||
class QtLicenseWindow
|
||||
: public QtWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtLicenseWindow(QWidget* parent = 0);
|
||||
QSize sizeHint() const override;
|
||||
|
||||
void clear();
|
||||
void load();
|
||||
|
||||
void setErrorMessage(const QString& errorMessage);
|
||||
|
||||
protected:
|
||||
// QtWindow implementation
|
||||
virtual void populateWindow(QWidget* widget) override;
|
||||
virtual void windowReady() override;
|
||||
|
||||
virtual void handleNext() override;
|
||||
|
||||
private slots:
|
||||
void optionChanged();
|
||||
|
||||
private:
|
||||
QRadioButton* m_commercialUse;
|
||||
QRadioButton* m_privateUse;
|
||||
|
||||
QTextEdit* m_licenseText;
|
||||
QLabel* m_errorLabel;
|
||||
|
||||
QtWindow* m_confirmWindow = nullptr;
|
||||
};
|
||||
|
||||
|
||||
class QtNonCommercialInfoWindow
|
||||
: public QtWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtNonCommercialInfoWindow(QWidget* parent = 0);
|
||||
QSize sizeHint() const override;
|
||||
|
||||
protected:
|
||||
// QtWindow implementation
|
||||
virtual void populateWindow(QWidget* widget) override;
|
||||
virtual void windowReady() override;
|
||||
};
|
||||
|
||||
#endif // QT_LICENSE_WINDOW_H
|
||||
@@ -14,7 +14,6 @@
|
||||
#include "component/view/TabbedView.h"
|
||||
#include "component/view/View.h"
|
||||
#include "data/bookmark/Bookmark.h"
|
||||
#include "LicenseChecker.h"
|
||||
#include "qt/utility/QtContextMenu.h"
|
||||
#include "qt/utility/QtFileDialog.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
@@ -24,7 +23,7 @@
|
||||
#include "qt/window/QtAboutLicense.h"
|
||||
#include "qt/window/QtEulaWindow.h"
|
||||
#include "qt/window/QtKeyboardShortcuts.h"
|
||||
#include "qt/window/QtLicense.h"
|
||||
#include "qt/window/QtLicenseWindow.h"
|
||||
#include "qt/window/QtPreferencesWindow.h"
|
||||
#include "qt/window/QtStartScreen.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
@@ -263,11 +262,11 @@ void QtMainWindow::loadWindow(bool showStartWindow)
|
||||
MessageEnteredLicense(LicenseChecker::getInstance()->getCurrentLicenseType()).dispatch();
|
||||
}
|
||||
|
||||
setTrialActionsEnabled(licenseValid);
|
||||
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
|
||||
|
||||
if (state == LicenseChecker::LICENSE_MOVED)
|
||||
{
|
||||
ApplicationSettings::getInstance()->setLicenseString("");
|
||||
appSettings->setLicenseString("");
|
||||
}
|
||||
|
||||
if (showStartWindow)
|
||||
@@ -275,13 +274,13 @@ void QtMainWindow::loadWindow(bool showStartWindow)
|
||||
showStartScreen();
|
||||
}
|
||||
|
||||
if (state != LicenseChecker::LICENSE_VALID && state != LicenseChecker::LICENSE_EMPTY)
|
||||
if (state != LicenseChecker::LICENSE_VALID && !appSettings->getNonCommercialUse())
|
||||
{
|
||||
forceEnterLicense(state == LicenseChecker::LICENSE_EXPIRED);
|
||||
forceEnterLicense(state);
|
||||
}
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
if (ApplicationSettings::getInstance()->getAcceptedEulaVersion() < QtEulaWindow::EULA_VERSION)
|
||||
if (appSettings->getAcceptedEulaVersion() < QtEulaWindow::EULA_VERSION)
|
||||
{
|
||||
showEula(true);
|
||||
}
|
||||
@@ -305,26 +304,40 @@ void QtMainWindow::saveLayout()
|
||||
settings.setValue("DOCK_LOCATIONS", this->saveState());
|
||||
}
|
||||
|
||||
void QtMainWindow::forceEnterLicense(bool expired)
|
||||
void QtMainWindow::forceEnterLicense(LicenseChecker::LicenseState state)
|
||||
{
|
||||
QtLicenseWindow* window = dynamic_cast<QtLicenseWindow*>(m_windowStack.getTopWindow());
|
||||
if (window)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
enterLicense();
|
||||
|
||||
QtLicense* enterLicenseWindow = dynamic_cast<QtLicense*>(m_windowStack.getTopWindow());
|
||||
if (!enterLicenseWindow)
|
||||
window = dynamic_cast<QtLicenseWindow*>(m_windowStack.getTopWindow());
|
||||
if (!window)
|
||||
{
|
||||
LOG_ERROR("No enter license window on top of stack");
|
||||
return;
|
||||
}
|
||||
|
||||
if (expired)
|
||||
if (state == LicenseChecker::LICENSE_EXPIRED)
|
||||
{
|
||||
enterLicenseWindow->setErrorMessage("The license key is expired.");
|
||||
window->setErrorMessage("The license key is expired.");
|
||||
}
|
||||
else
|
||||
else if (state != LicenseChecker::LICENSE_VALID && state != LicenseChecker::LICENSE_EMPTY)
|
||||
{
|
||||
enterLicenseWindow->clear();
|
||||
enterLicenseWindow->setErrorMessage("Please re-enter your license key.");
|
||||
window->clear();
|
||||
window->setErrorMessage("Please re-enter your license key.");
|
||||
}
|
||||
|
||||
window->updateCloseButton("Quit");
|
||||
|
||||
setEnabled(false);
|
||||
window->setEnabled(true);
|
||||
|
||||
disconnect(window, &QtWindow::canceled, &m_windowStack, &QtWindowStack::popWindow);
|
||||
connect(window, &QtWindow::canceled, dynamic_cast<QApplication*>(QCoreApplication::instance()), &QApplication::quit);
|
||||
}
|
||||
|
||||
void QtMainWindow::updateHistoryMenu(const std::vector<SearchMatch>& history)
|
||||
@@ -458,11 +471,11 @@ void QtMainWindow::showLicenses()
|
||||
|
||||
void QtMainWindow::enterLicense()
|
||||
{
|
||||
QtLicense* enterLicenseWindow = createWindow<QtLicense>();
|
||||
QtLicenseWindow* enterLicenseWindow = createWindow<QtLicenseWindow>();
|
||||
enterLicenseWindow->setup();
|
||||
|
||||
disconnect(enterLicenseWindow, &QtLicense::finished, &m_windowStack, &QtWindowStack::clearWindows);
|
||||
connect(enterLicenseWindow, &QtLicense::finished, this, &QtMainWindow::enteredLicense);
|
||||
disconnect(enterLicenseWindow, &QtLicenseWindow::finished, &m_windowStack, &QtWindowStack::clearWindows);
|
||||
connect(enterLicenseWindow, &QtLicenseWindow::finished, this, &QtMainWindow::enteredLicense);
|
||||
|
||||
enterLicenseWindow->load();
|
||||
}
|
||||
@@ -477,9 +490,10 @@ void QtMainWindow::enteredLicense()
|
||||
|
||||
m_windowStack.clearWindows();
|
||||
|
||||
setTrialActionsEnabled(true);
|
||||
MessageEnteredLicense(LicenseChecker::getInstance()->getCurrentLicenseType()).dispatch();
|
||||
|
||||
setEnabled(true);
|
||||
|
||||
if (showStartWindow)
|
||||
{
|
||||
showStartScreen();
|
||||
@@ -732,8 +746,7 @@ void QtMainWindow::setupProjectMenu()
|
||||
QMenu *menu = new QMenu(tr("&Project"), this);
|
||||
menuBar()->addMenu(menu);
|
||||
|
||||
m_trialDisabledActions.push_back(
|
||||
menu->addAction(tr("&New Project..."), this, &QtMainWindow::newProject, QKeySequence::New));
|
||||
menu->addAction(tr("&New Project..."), this, &QtMainWindow::newProject, QKeySequence::New);
|
||||
menu->addAction(tr("&Open Project..."), this, &QtMainWindow::openProject, QKeySequence::Open);
|
||||
|
||||
QMenu *recentProjectMenu = new QMenu(tr("Recent Projects"));
|
||||
@@ -753,8 +766,8 @@ void QtMainWindow::setupProjectMenu()
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
m_trialDisabledActions.push_back(menu->addAction(tr("&Edit Project..."), this, &QtMainWindow::editProject));
|
||||
m_trialDisabledActions.push_back(menu->addSeparator());
|
||||
menu->addAction(tr("&Edit Project..."), this, &QtMainWindow::editProject);
|
||||
menu->addSeparator();
|
||||
|
||||
menu->addAction(tr("E&xit"), QCoreApplication::instance(), &QCoreApplication::quit, QKeySequence::Quit);
|
||||
}
|
||||
@@ -764,21 +777,14 @@ void QtMainWindow::setupEditMenu()
|
||||
QMenu *menu = new QMenu(tr("&Edit"), this);
|
||||
menuBar()->addMenu(menu);
|
||||
|
||||
m_trialDisabledActions.push_back(menu->addAction(tr("&Refresh"), this, &QtMainWindow::refresh, QKeySequence::Refresh));
|
||||
menu->addAction(tr("&Refresh"), this, &QtMainWindow::refresh, QKeySequence::Refresh);
|
||||
if (utility::getOsType() == OS_WINDOWS)
|
||||
{
|
||||
m_trialDisabledActions.push_back(
|
||||
menu->addAction(tr("&Full Refresh"), this, &QtMainWindow::forceRefresh, QKeySequence(Qt::SHIFT + Qt::Key_F5))
|
||||
);
|
||||
menu->addAction(tr("&Full Refresh"), this, &QtMainWindow::forceRefresh, QKeySequence(Qt::SHIFT + Qt::Key_F5));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_trialDisabledActions.push_back(menu->addAction(
|
||||
tr("&Full Refresh"),
|
||||
this,
|
||||
&QtMainWindow::forceRefresh,
|
||||
QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_R)
|
||||
));
|
||||
menu->addAction(tr("&Full Refresh"), this, &QtMainWindow::forceRefresh, QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_R));
|
||||
}
|
||||
|
||||
menu->addSeparator();
|
||||
@@ -906,10 +912,10 @@ void QtMainWindow::setupHelpMenu()
|
||||
menu->addAction(tr("Keyboard Shortcuts"), this, &QtMainWindow::showKeyboardShortcuts);
|
||||
menu->addAction(tr("Documentation"), this, &QtMainWindow::showDocumentation);
|
||||
menu->addAction(tr("Bug Tracker"), this, &QtMainWindow::showBugtracker);
|
||||
menu->addAction(tr("Enter License..."), this, &QtMainWindow::enterLicense);
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
menu->addAction(tr("Select License..."), this, &QtMainWindow::enterLicense);
|
||||
menu->addAction(tr("End User License Agreement"), this, &QtMainWindow::showEula);
|
||||
menu->addAction(tr("3rd Party Licences"), this, &QtMainWindow::showLicenses);
|
||||
menu->addAction(tr("&About Sourcetrail"), this, &QtMainWindow::about);
|
||||
@@ -920,14 +926,6 @@ void QtMainWindow::setupHelpMenu()
|
||||
menu->addAction(tr("Show Log Folder"), this, &QtMainWindow::showLogFolder);
|
||||
}
|
||||
|
||||
void QtMainWindow::setTrialActionsEnabled(bool enabled)
|
||||
{
|
||||
for (QAction* action : m_trialDisabledActions)
|
||||
{
|
||||
action->setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
QtMainWindow::DockWidget* QtMainWindow::getDockWidgetForView(View* view)
|
||||
{
|
||||
for (DockWidget& dock : m_dockWidgets)
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "data/search/SearchMatch.h"
|
||||
#include "LicenseChecker.h"
|
||||
#include "qt/window/QtWindowStack.h"
|
||||
|
||||
class Bookmark;
|
||||
@@ -71,7 +72,7 @@ public:
|
||||
void loadDockWidgetLayout();
|
||||
void loadWindow(bool showStartWindow);
|
||||
|
||||
void forceEnterLicense(bool expired);
|
||||
void forceEnterLicense(LicenseChecker::LicenseState state);
|
||||
|
||||
void updateHistoryMenu(const std::vector<SearchMatch>& history);
|
||||
void updateBookmarksMenu(const std::vector<std::shared_ptr<Bookmark>>& bookmarks);
|
||||
@@ -160,8 +161,6 @@ private:
|
||||
void setupBookmarksMenu();
|
||||
void setupHelpMenu();
|
||||
|
||||
void setTrialActionsEnabled(bool enabled);
|
||||
|
||||
DockWidget* getDockWidgetForView(View* view);
|
||||
|
||||
void setShowDockWidgetTitleBars(bool showTitleBars);
|
||||
@@ -187,8 +186,6 @@ private:
|
||||
|
||||
bool m_showDockWidgetTitleBars;
|
||||
|
||||
std::vector<QAction*> m_trialDisabledActions;
|
||||
|
||||
QtWindowStack m_windowStack;
|
||||
};
|
||||
|
||||
|
||||
@@ -145,7 +145,6 @@ void QtStartScreen::setupStartScreen()
|
||||
{
|
||||
License license;
|
||||
license.loadFromEncodedString(ApplicationSettings::getInstance()->getLicenseString(), AppPath::getAppPath());
|
||||
bool licenseValid = license.isValid();
|
||||
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("startscreen/startscreen.css"))).c_str());
|
||||
addLogo();
|
||||
@@ -166,52 +165,10 @@ void QtStartScreen::setupStartScreen()
|
||||
QtUpdateCheckerWidget* checker = new QtUpdateCheckerWidget(this);
|
||||
col->addWidget(checker);
|
||||
|
||||
if (!licenseValid)
|
||||
col->addSpacing(30);
|
||||
|
||||
if (license.isValid())
|
||||
{
|
||||
col->addSpacing(20);
|
||||
|
||||
QLabel* welcomeLabel = new QLabel(
|
||||
"<b>Welcome to the trial version of Sourcetrail!</b><br />"
|
||||
"Explore our preindexed projects to experience Sourcetrail's unique user interface. "
|
||||
"More projects are available for download <a href=\"http://sourcetrail.com/downloads#extra\" style=\"color: #007AC2;\">here</a>.<br /><br />"
|
||||
"If you want to use Sourcetrail on your own source code please "
|
||||
"<a href=\"http://sourcetrail.com/buy-license\" style=\"color: #007AC2;\">purchase a license</a>, "
|
||||
"or get a temporary <a href=\"http://sourcetrail.com/test-license\" style=\"color: #007AC2;\">test license</a>.", this);
|
||||
welcomeLabel->setOpenExternalLinks(true);
|
||||
welcomeLabel->setObjectName("welcomeLabel");
|
||||
welcomeLabel->setWordWrap(true);
|
||||
welcomeLabel->setAlignment(Qt::AlignTop);
|
||||
|
||||
col->addWidget(welcomeLabel, 0, Qt::AlignHCenter | Qt::AlignTop);
|
||||
col->addStrut(260);
|
||||
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, &QPushButton::clicked, this, &QtStartScreen::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, &QPushButton::clicked, this, &QtStartScreen::handleUnlockButton);
|
||||
|
||||
QHBoxLayout* row = new QHBoxLayout();
|
||||
row->addWidget(unlockButton);
|
||||
row->addStretch();
|
||||
col->addLayout(row);
|
||||
|
||||
layout->addStretch(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
col->addSpacing(30);
|
||||
|
||||
std::string licenseString = license.getLicenseInfo();
|
||||
|
||||
QLabel* licenseHeader = new QLabel("Licensed to:");
|
||||
@@ -221,27 +178,39 @@ void QtStartScreen::setupStartScreen()
|
||||
QLabel* licenseLabel = new QLabel(licenseString.c_str());
|
||||
licenseLabel->setObjectName("licenseLabel");
|
||||
col->addWidget(licenseLabel);
|
||||
|
||||
col->addStretch();
|
||||
|
||||
QPushButton* newProjectButton = new QPushButton("New Project", this);
|
||||
newProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
newProjectButton->setObjectName("projectButton");
|
||||
newProjectButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
connect(newProjectButton, &QPushButton::clicked, this, &QtStartScreen::handleNewProjectButton);
|
||||
col->addWidget(newProjectButton);
|
||||
|
||||
col->addSpacing(8);
|
||||
|
||||
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, &QPushButton::clicked, this, &QtStartScreen::handleOpenProjectButton);
|
||||
col->addWidget(openProjectButton);
|
||||
|
||||
layout->addStretch(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
QLabel* licenseHeader = new QLabel("Not licensed for<br />commercial use.");
|
||||
licenseHeader->setObjectName("licenseHeaderLabel");
|
||||
col->addWidget(licenseHeader);
|
||||
|
||||
QPushButton* upgradeButton = new QPushButton("upgrade");
|
||||
upgradeButton->setObjectName("upgradeButton");
|
||||
upgradeButton->setCursor(Qt::PointingHandCursor);
|
||||
col->addWidget(upgradeButton);
|
||||
connect(upgradeButton, &QPushButton::clicked, [this](){ emit openEnterLicenseDialog(); });
|
||||
}
|
||||
|
||||
col->addStretch();
|
||||
|
||||
QPushButton* newProjectButton = new QPushButton("New Project", this);
|
||||
newProjectButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
newProjectButton->setObjectName("projectButton");
|
||||
newProjectButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
connect(newProjectButton, &QPushButton::clicked, this, &QtStartScreen::handleNewProjectButton);
|
||||
col->addWidget(newProjectButton);
|
||||
|
||||
col->addSpacing(8);
|
||||
|
||||
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, &QPushButton::clicked, this, &QtStartScreen::handleOpenProjectButton);
|
||||
col->addWidget(openProjectButton);
|
||||
|
||||
layout->addStretch(2);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -249,10 +218,6 @@ void QtStartScreen::setupStartScreen()
|
||||
layout->addLayout(col, 1);
|
||||
|
||||
QLabel* recentProjectsLabel = new QLabel("Recent Projects: ", this);
|
||||
if (!licenseValid)
|
||||
{
|
||||
recentProjectsLabel->setText("Projects:");
|
||||
}
|
||||
recentProjectsLabel->setObjectName("recentLabel");
|
||||
col->addWidget(recentProjectsLabel);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user