src: Removed everything license key related

* removed license check
* removed license from ApplicationSettings
* removed LicenseGenerator
* removed license tests
* removed lib_license
* removed dependency on Botan
* removed license generation in all scripts
This commit is contained in:
Eberhard Graether
2019-10-18 13:05:30 +02:00
parent 2cfce03f6e
commit 0d8e992bdf
61 changed files with 63 additions and 3639 deletions
-2
View File
@@ -297,8 +297,6 @@ add_files(
qt/window/QtIndexingDialog.h
qt/window/QtKeyboardShortcuts.cpp
qt/window/QtKeyboardShortcuts.h
qt/window/QtLicenseWindow.cpp
qt/window/QtLicenseWindow.h
qt/window/QtMainWindow.cpp
qt/window/QtMainWindow.h
qt/window/QtPathListDialog.cpp
@@ -7,7 +7,6 @@
#include <QStyle>
#include "ApplicationSettings.h"
#include "LicenseChecker.h"
#include "logging.h"
#include "QtTextEdit.h"
#include "TimeStamp.h"
@@ -50,7 +49,6 @@ syntax:
// optional
"conditions":
{
"license": ["test", "private", "commercial"],
"os": ["windows", "macOS", "linux"],
"min_version": "2017.2.0",
"max_version": "2018.4.2",
@@ -183,20 +181,6 @@ bool QtNewsWidget::checkConditions(const QJsonObject& conditions) const
}
}
// license
{
QJsonArray licenseStrings = conditions.value("license").toArray();
if (!licenseStrings.isEmpty())
{
QString licenseString = QString::fromStdString(LicenseChecker::getCurrentLicenseTypeString());
if (!licenseStrings.contains(QJsonValue(licenseString)))
{
LOG_INFO_STREAM(<< "Failed condition license.");
return false;
}
}
}
// OS
{
QJsonArray osStrings = conditions.value("os").toArray();
+2 -4
View File
@@ -7,7 +7,6 @@
#include <QUrl>
#include "ApplicationSettings.h"
#include "LicenseChecker.h"
#include "logging.h"
#include "MessageStatus.h"
#include "QtRequest.h"
@@ -38,7 +37,7 @@ void QtUpdateChecker::check(bool force, std::function<void(Result)> callback)
appSettings->setUpdateDownloadUrl("");
appSettings->save();
QString urlString = "https://www.sourcetrail.com/api/v2/versions/latest";
QString urlString = "https://staging.sourcetrail.com/api/v2/versions/latest";
// OS
std::string osString = utility::getOsTypeString();
@@ -53,8 +52,7 @@ void QtUpdateChecker::check(bool force, std::function<void(Result)> callback)
urlString += ("&version=" + Version::getApplicationVersion().toDisplayString()).c_str();
// license
std::string licenseString = LicenseChecker::getCurrentLicenseTypeString();
urlString += ("&license=" + licenseString).c_str();
urlString += "&license=free"; // options: test, private, commercial
// user token
std::string token = appSettings->getUserToken();
+2 -12
View File
@@ -98,12 +98,12 @@ void QtMainView::saveLayout()
m_window->saveLayout();
}
void QtMainView::loadWindow(bool showStartWindow, bool showEULA, bool enterLicense, std::string licenseError)
void QtMainView::loadWindow(bool showStartWindow, bool showEULA)
{
m_onQtThread(
[=]()
{
m_window->loadWindow(showStartWindow, showEULA, enterLicense, licenseError);
m_window->loadWindow(showStartWindow, showEULA);
}
);
}
@@ -163,16 +163,6 @@ void QtMainView::activateWindow()
);
}
void QtMainView::forceEnterLicense(std::string licenseError)
{
m_onQtThread(
[=]()
{
m_window->forceEnterLicense(licenseError);
}
);
}
void QtMainView::updateRecentProjectMenu()
{
m_onQtThread(
+1 -2
View File
@@ -48,14 +48,13 @@ public:
void loadLayout() override;
void saveLayout() override;
void loadWindow(bool showStartWindow, bool showEULA, bool enterLicense, std::string licenseError) override;
void loadWindow(bool showStartWindow, bool showEULA) override;
void refreshView() override;
void hideStartScreen() override;
void setTitle(const std::wstring& title) override;
void activateWindow() override;
void forceEnterLicense(std::string licenseError) override;
void updateRecentProjectMenu() override;
-306
View File
@@ -1,306 +0,0 @@
#include "QtLicenseWindow.h"
#include <QApplication>
#include <QCheckBox>
#include <QLabel>
#include <QLineEdit>
#include <QRadioButton>
#include <QTextEdit>
#include "LicenseChecker.h"
#include "utilityQt.h"
#include "ApplicationSettings.h"
#include "ResourcePaths.h"
QtLicenseWindow::QtLicenseWindow(QWidget *parent)
: QtWindow(false, parent)
{
}
QSize QtLicenseWindow::sizeHint() const
{
return QSize(740, 550);
}
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::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"
"License holder:\n"
"License type:\n"
"Licensed number of users:\n"
"Licensed product version:\n"
"Licensed usage period:\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().concatenate(L"license/license.css")).c_str());
addLogo();
updateTitle("Select License Option");
updateNextButton("Activate");
setNextEnabled(false);
setPreviousVisible(false);
updateCloseButton("Cancel");
}
void QtLicenseWindow::handleNext()
{
if (m_commercialUse->isChecked())
{
std::string licenseString = m_licenseText->toPlainText().toStdString();
LicenseChecker::LicenseState state = LicenseChecker::checkLicenseString(licenseString);
std::string errorString = LicenseChecker::getLicenseErrorForState(state);
if (state == LicenseChecker::LicenseState::VALID)
{
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
LicenseChecker::setCurrentLicenseString(licenseString);
appSettings->setLicenseString(LicenseChecker::getCurrentLicenseStringEncoded());
appSettings->setNonCommercialUse(false);
appSettings->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* appSettings = ApplicationSettings::getInstance().get();
appSettings->setLicenseString("");
appSettings->setNonCommercialUse(true);
appSettings->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);
}
-60
View File
@@ -1,60 +0,0 @@
#ifndef QT_LICENSE_WINDOW_H
#define QT_LICENSE_WINDOW_H
#include "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
+1 -72
View File
@@ -24,12 +24,10 @@
#include "QtAboutLicense.h"
#include "QtEulaWindow.h"
#include "QtKeyboardShortcuts.h"
#include "QtLicenseWindow.h"
#include "QtPreferencesWindow.h"
#include "QtStartScreen.h"
#include "ApplicationSettings.h"
#include "FileSystem.h"
#include "LicenseChecker.h"
#include "logging.h"
#include "MessageErrorsHelpMessage.h"
#include "MessageHistoryRedo.h"
@@ -325,18 +323,13 @@ void QtMainWindow::loadDockWidgetLayout()
}
}
void QtMainWindow::loadWindow(bool showStartWindow, bool showEULA, bool enterLicense, const std::string& licenseError)
void QtMainWindow::loadWindow(bool showStartWindow, bool showEULA)
{
if (showStartWindow)
{
showStartScreen();
}
if (enterLicense)
{
forceEnterLicense(licenseError);
}
if (showEULA)
{
showEula(true);
@@ -360,37 +353,6 @@ void QtMainWindow::saveLayout()
settings.setValue("DOCK_LOCATIONS", this->saveState());
}
void QtMainWindow::forceEnterLicense(const std::string& licenseError)
{
QtLicenseWindow* window = dynamic_cast<QtLicenseWindow*>(m_windowStack.getTopWindow());
if (window)
{
return;
}
enterLicense();
window = dynamic_cast<QtLicenseWindow*>(m_windowStack.getTopWindow());
if (!window)
{
LOG_ERROR("No enter license window on top of stack");
return;
}
if (licenseError.size())
{
window->setErrorMessage(QString::fromStdString(licenseError));
}
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(std::shared_ptr<MessageBase> message)
{
const size_t historyMenuSize = 20;
@@ -601,37 +563,6 @@ void QtMainWindow::showLicenses()
licenseWindow->setup();
}
void QtMainWindow::enterLicense()
{
QtLicenseWindow* enterLicenseWindow = createWindow<QtLicenseWindow>();
enterLicenseWindow->setup();
disconnect(enterLicenseWindow, &QtLicenseWindow::finished, &m_windowStack, &QtWindowStack::clearWindows);
connect(enterLicenseWindow, &QtLicenseWindow::finished, this, &QtMainWindow::enteredLicense);
enterLicenseWindow->load();
}
void QtMainWindow::enteredLicense()
{
bool showStartWindow = false;
if (m_windowStack.getWindowCount() > 0 && dynamic_cast<QtStartScreen*>(m_windowStack.getBottomWindow()))
{
showStartWindow = true;
}
m_windowStack.clearWindows();
MessageRefreshUI().dispatch();
setEnabled(true);
if (showStartWindow)
{
showStartScreen();
}
}
void QtMainWindow::showDataFolder()
{
QDesktopServices::openUrl(QUrl(QString::fromStdWString(L"file:///" + UserPaths::getUserDataPath().makeCanonical().wstr()), QUrl::TolerantMode));
@@ -674,7 +605,6 @@ void QtMainWindow::showStartScreen()
connect(startScreen, &QtStartScreen::openOpenProjectDialog, this, &QtMainWindow::openProject);
connect(startScreen, &QtStartScreen::openNewProjectDialog, this, &QtMainWindow::newProject);
connect(startScreen, &QtStartScreen::openEnterLicenseDialog, this, &QtMainWindow::enterLicense);
}
void QtMainWindow::hideStartScreen()
@@ -1122,7 +1052,6 @@ void QtMainWindow::setupHelpMenu()
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 Licenses"), this, &QtMainWindow::showLicenses);
menu->addAction(tr("&About Sourcetrail"), this, &QtMainWindow::about);
+1 -5
View File
@@ -73,9 +73,7 @@ public:
void saveLayout();
void loadDockWidgetLayout();
void loadWindow(bool showStartWindow, bool showEULA, bool enterLicense, const std::string& licenseError);
void forceEnterLicense(const std::string& licenseError);
void loadWindow(bool showStartWindow, bool showEULA);
void updateHistoryMenu(std::shared_ptr<MessageBase> message);
void clearHistoryMenu();
@@ -111,8 +109,6 @@ public slots:
void showEula(bool forceAccept = false);
void acceptedEula();
void showLicenses();
void enterLicense();
void enteredLicense();
void showDataFolder();
void showLogFolder();
-33
View File
@@ -8,7 +8,6 @@
#include <QMessageBox>
#include "ApplicationSettings.h"
#include "LicenseChecker.h"
#include "MessageLoadProject.h"
#include "ProjectSettings.h"
#include "QtUpdateCheckerWidget.h"
@@ -169,33 +168,6 @@ void QtStartScreen::setupStartScreen()
col->addSpacing(15);
if (LicenseChecker::checkCurrentLicense() == LicenseChecker::LicenseState::VALID)
{
std::string licenseInfo = LicenseChecker::getCurrentLicense()->getLicenseInfo();
QLabel* licenseHeader = new QLabel("Licensed to:");
licenseHeader->setObjectName("boldLabel");
col->addWidget(licenseHeader);
col->addSpacing(2);
QLabel* licenseLabel = new QLabel(licenseInfo.c_str());
licenseLabel->setObjectName("textLabel");
col->addWidget(licenseLabel);
}
else
{
QLabel* licenseHeader = new QLabel("Not licensed for<br />commercial use.");
licenseHeader->setObjectName("boldLabel");
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->addSpacing(15);
{
QLabel* newsHeader = new QLabel("News:");
newsHeader->setObjectName("boldLabel");
@@ -276,11 +248,6 @@ void QtStartScreen::handleOpenProjectButton()
emit openOpenProjectDialog();
}
void QtStartScreen::handleUnlockButton()
{
emit openEnterLicenseDialog();
}
void QtStartScreen::handleRecentButton()
{
emit finished();
-2
View File
@@ -39,12 +39,10 @@ public:
signals:
void openOpenProjectDialog();
void openNewProjectDialog();
void openEnterLicenseDialog();
private slots:
void handleNewProjectButton();
void handleOpenProjectButton();
void handleUnlockButton();
void handleRecentButton();
void updateButtons();
-1
View File
@@ -9,7 +9,6 @@
#include <qprocessordetection.h>
#include <QRegularExpression>
#include "License.h"
#include "ApplicationSettings.h"
#include "logging.h"
#include "AppPath.h"
-2
View File
@@ -7,8 +7,6 @@
#include "OsType.h"
#include "FilePath.h"
class License;
namespace utility
{
std::pair<int, std::string> executeProcess(