ui: Remove EULA from GUI and Windows installer
This commit is contained in:
+2
-46
@@ -26,7 +26,6 @@
|
||||
#include "ScopedFunctor.h"
|
||||
#include "SourceGroupFactory.h"
|
||||
#include "SourceGroupFactoryModuleCustom.h"
|
||||
#include "TextAccess.h"
|
||||
#include "UserPaths.h"
|
||||
#include "utility.h"
|
||||
#include "utilityApp.h"
|
||||
@@ -94,18 +93,6 @@ void addLanguagePackages()
|
||||
#endif // BUILD_JAVA_LANGUAGE_PACKAGE
|
||||
}
|
||||
|
||||
QCoreApplication* createApplication(int &argc, char *argv[], bool noGUI = false)
|
||||
{
|
||||
if (noGUI)
|
||||
{
|
||||
return new QtCoreApplication(argc, argv);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new QtApplication(argc, argv);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication::addLibraryPath(".");
|
||||
@@ -159,37 +146,7 @@ int main(int argc, char *argv[])
|
||||
Application::destroyInstance();
|
||||
});
|
||||
|
||||
// check if already agreed to EULA
|
||||
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
|
||||
if (appSettings->getAcceptedEulaVersion() < Application::EULA_VERSION)
|
||||
{
|
||||
if (!commandLineParser.acceptedEULA())
|
||||
{
|
||||
// to avoid interferring with other console output
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250));
|
||||
|
||||
std::shared_ptr<TextAccess> text =
|
||||
TextAccess::createFromFile(ResourcePaths::getLicensePath().concatenate(L"EULA.txt"));
|
||||
|
||||
std::cout << std::endl << text->getText() << std::endl;
|
||||
std::cout << "Do you accept the Sourcetrail End User License Agreement? (y/n)" << std::endl;
|
||||
|
||||
char c = 'n';
|
||||
std::cin >> c;
|
||||
|
||||
if (c != 'Y' && c != 'y')
|
||||
{
|
||||
std::cout << "\nAgreement not accepted. quitting..." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "\nSourcetrail End User License Agreement accepted.\n" << std::endl;
|
||||
appSettings->setAcceptedEulaVersion(Application::EULA_VERSION);
|
||||
appSettings->save();
|
||||
}
|
||||
|
||||
ApplicationSettingsPrefiller::prefillPaths(appSettings);
|
||||
ApplicationSettingsPrefiller::prefillPaths(ApplicationSettings::getInstance().get());
|
||||
addLanguagePackages();
|
||||
|
||||
signal(SIGINT, signalHandler);
|
||||
@@ -248,8 +205,7 @@ int main(int argc, char *argv[])
|
||||
Application::destroyInstance();
|
||||
});
|
||||
|
||||
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
|
||||
ApplicationSettingsPrefiller::prefillPaths(appSettings);
|
||||
ApplicationSettingsPrefiller::prefillPaths(ApplicationSettings::getInstance().get());
|
||||
addLanguagePackages();
|
||||
|
||||
utility::loadFontsFromDirectory(ResourcePaths::getFontsPath(), L".otf");
|
||||
|
||||
@@ -384,8 +384,6 @@ add_files(
|
||||
utility/commandline/CommandLineParser.h
|
||||
utility/commandline/commands/CommandlineCommand.cpp
|
||||
utility/commandline/commands/CommandlineCommand.h
|
||||
utility/commandline/commands/CommandlineCommandAcceptEULA.cpp
|
||||
utility/commandline/commands/CommandlineCommandAcceptEULA.h
|
||||
utility/commandline/commands/CommandlineCommandConfig.cpp
|
||||
utility/commandline/commands/CommandlineCommandConfig.h
|
||||
utility/commandline/commands/CommandlineCommandIndex.cpp
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
std::shared_ptr<Application> Application::s_instance;
|
||||
std::string Application::s_uuid;
|
||||
bool Application::EULA_ACCEPT_REQUIRED = true;
|
||||
|
||||
void Application::createInstance(
|
||||
const Version& version, ViewFactory* viewFactory, NetworkFactory* networkFactory
|
||||
@@ -424,9 +423,7 @@ void Application::loadWindow(bool showStartWindow)
|
||||
|
||||
updateTitle();
|
||||
|
||||
bool showEula = (EULA_ACCEPT_REQUIRED && appSettings->getAcceptedEulaVersion() < EULA_VERSION);
|
||||
|
||||
m_mainView->loadWindow(showStartWindow, showEula);
|
||||
m_mainView->loadWindow(showStartWindow);
|
||||
m_loadedWindow = true;
|
||||
}
|
||||
else if (!showStartWindow)
|
||||
|
||||
@@ -35,9 +35,6 @@ class Application
|
||||
, public MessageListener<MessageWindowFocus>
|
||||
{
|
||||
public:
|
||||
static const int EULA_VERSION = 5;
|
||||
static bool EULA_ACCEPT_REQUIRED;
|
||||
|
||||
static void createInstance(const Version& version, ViewFactory* viewFactory, NetworkFactory* networkFactory);
|
||||
static std::shared_ptr<Application> getInstance();
|
||||
static void destroyInstance();
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
|
||||
virtual void refreshView() = 0;
|
||||
|
||||
virtual void loadWindow(bool showStartWindow, bool showEULA) = 0;
|
||||
virtual void loadWindow(bool showStartWindow) = 0;
|
||||
|
||||
virtual void hideStartScreen() = 0;
|
||||
virtual void setTitle(const std::wstring& title) = 0;
|
||||
|
||||
@@ -553,16 +553,6 @@ bool ApplicationSettings::setRecentProjects(const std::vector<FilePath> &recentP
|
||||
return setPathValues("user/recent_projects/recent_project", recentProjects);
|
||||
}
|
||||
|
||||
int ApplicationSettings::getAcceptedEulaVersion() const
|
||||
{
|
||||
return getValue<int>("user/accepted_eula_version", 0);
|
||||
}
|
||||
|
||||
void ApplicationSettings::setAcceptedEulaVersion(int version)
|
||||
{
|
||||
setValue<int>("user/accepted_eula_version", version);
|
||||
}
|
||||
|
||||
std::string ApplicationSettings::getUserToken() const
|
||||
{
|
||||
return getValue<std::string>("user/token", "");
|
||||
|
||||
@@ -152,9 +152,6 @@ public:
|
||||
std::vector<FilePath> getRecentProjects() const;
|
||||
bool setRecentProjects(const std::vector<FilePath>& recentProjects);
|
||||
|
||||
int getAcceptedEulaVersion() const;
|
||||
void setAcceptedEulaVersion(int version);
|
||||
|
||||
std::string getUserToken() const;
|
||||
void setUserToken(std::string token);
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include "CommandlineHelper.h"
|
||||
#include "CommandlineCommandAcceptEULA.h"
|
||||
#include "CommandlineCommandConfig.h"
|
||||
#include "CommandlineCommandIndex.h"
|
||||
#include "ConfigManager.h"
|
||||
@@ -42,7 +41,6 @@ void CommandLineParser::setup()
|
||||
|
||||
addCommand(std::make_unique<commandline::CommandlineCommandConfig>(this));
|
||||
addCommand(std::make_unique<commandline::CommandlineCommandIndex>(this));
|
||||
addCommand(std::make_unique<commandline::CommandlineCommandAcceptEULA>(this));
|
||||
|
||||
for (auto& command : m_commands)
|
||||
{
|
||||
@@ -76,7 +74,6 @@ void CommandLineParser::preparse(std::vector<std::string>& args)
|
||||
{
|
||||
if ( m_args[0] == command->name())
|
||||
{
|
||||
command->preparse();
|
||||
m_withoutGUI = true;
|
||||
return;
|
||||
}
|
||||
@@ -193,11 +190,6 @@ bool CommandLineParser::exitApplication() const
|
||||
return m_quit;
|
||||
}
|
||||
|
||||
bool CommandLineParser::acceptedEULA() const
|
||||
{
|
||||
return m_acceptEULA;
|
||||
}
|
||||
|
||||
bool CommandLineParser::hasError() const
|
||||
{
|
||||
return !m_errorString.empty();
|
||||
@@ -247,11 +239,6 @@ void CommandLineParser::incompleteRefresh()
|
||||
m_refreshMode = REFRESH_UPDATED_AND_INCOMPLETE_FILES;
|
||||
}
|
||||
|
||||
void CommandLineParser::acceptEULA()
|
||||
{
|
||||
m_acceptEULA = true;
|
||||
}
|
||||
|
||||
const FilePath& CommandLineParser::getProjectFilePath() const
|
||||
{
|
||||
return m_projectFile;
|
||||
|
||||
@@ -30,12 +30,10 @@ public:
|
||||
|
||||
bool runWithoutGUI() const;
|
||||
bool exitApplication() const;
|
||||
bool acceptedEULA() const;
|
||||
|
||||
bool hasError() const;
|
||||
std::wstring getError();
|
||||
|
||||
void acceptEULA();
|
||||
void fullRefresh();
|
||||
void incompleteRefresh();
|
||||
|
||||
@@ -61,7 +59,6 @@ private:
|
||||
|
||||
bool m_quit = false;
|
||||
bool m_withoutGUI = false;
|
||||
bool m_acceptEULA = false;
|
||||
|
||||
std::wstring m_errorString;
|
||||
};
|
||||
|
||||
@@ -27,7 +27,6 @@ public:
|
||||
const std::string& description();
|
||||
|
||||
virtual void setup() = 0;
|
||||
virtual void preparse() = 0;
|
||||
virtual ReturnStatus parse(std::vector<std::string>& args) = 0;
|
||||
|
||||
virtual bool hasHelp() const = 0;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#include "CommandlineCommandAcceptEULA.h"
|
||||
|
||||
#include "CommandlineHelper.h"
|
||||
#include "CommandLineParser.h"
|
||||
|
||||
namespace commandline
|
||||
{
|
||||
|
||||
CommandlineCommandAcceptEULA::CommandlineCommandAcceptEULA(CommandLineParser* parser)
|
||||
: CommandlineCommand("accept-eula", "Accept the Sourcetrail End User License Agreement.", parser)
|
||||
{
|
||||
}
|
||||
|
||||
CommandlineCommandAcceptEULA::~CommandlineCommandAcceptEULA()
|
||||
{
|
||||
}
|
||||
|
||||
void CommandlineCommandAcceptEULA::setup()
|
||||
{
|
||||
}
|
||||
|
||||
void CommandlineCommandAcceptEULA::preparse()
|
||||
{
|
||||
m_parser->acceptEULA();
|
||||
}
|
||||
|
||||
CommandlineCommand::ReturnStatus CommandlineCommandAcceptEULA::parse(std::vector<std::string>& args)
|
||||
{
|
||||
return ReturnStatus::CMD_QUIT;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
#ifndef COMMANDLINE_COMMAND_ACCEPT_EULA_H
|
||||
#define COMMANDLINE_COMMAND_ACCEPT_EULA_H
|
||||
|
||||
#include "CommandlineCommand.h"
|
||||
|
||||
class CommandLineParser;
|
||||
|
||||
namespace commandline
|
||||
{
|
||||
|
||||
class CommandlineCommandAcceptEULA
|
||||
: public CommandlineCommand
|
||||
{
|
||||
public:
|
||||
CommandlineCommandAcceptEULA(CommandLineParser* parser);
|
||||
virtual ~CommandlineCommandAcceptEULA();
|
||||
|
||||
virtual void setup();
|
||||
virtual void preparse();
|
||||
virtual ReturnStatus parse(std::vector<std::string>& args);
|
||||
|
||||
virtual bool hasHelp() const { return false; }
|
||||
};
|
||||
|
||||
} // namespace commandline
|
||||
|
||||
#endif // COMMANDLINE_COMMAND_ACCEPT_EULA_H
|
||||
@@ -121,10 +121,6 @@ void CommandlineCommandConfig::setup()
|
||||
m_options.add(options);
|
||||
}
|
||||
|
||||
void CommandlineCommandConfig::preparse()
|
||||
{
|
||||
}
|
||||
|
||||
CommandlineCommand::ReturnStatus CommandlineCommandConfig::parse(std::vector<std::string>& args)
|
||||
{
|
||||
po::variables_map vm;
|
||||
|
||||
@@ -14,7 +14,6 @@ public:
|
||||
virtual ~CommandlineCommandConfig();
|
||||
|
||||
virtual void setup();
|
||||
virtual void preparse();
|
||||
virtual ReturnStatus parse(std::vector<std::string>& args);
|
||||
|
||||
virtual bool hasHelp() const { return true; }
|
||||
|
||||
@@ -33,10 +33,6 @@ void CommandlineCommandIndex::setup()
|
||||
m_positional.add("project-file", 1);
|
||||
}
|
||||
|
||||
void CommandlineCommandIndex::preparse()
|
||||
{
|
||||
}
|
||||
|
||||
CommandlineCommand::ReturnStatus CommandlineCommandIndex::parse(std::vector<std::string>& args)
|
||||
{
|
||||
po::variables_map vm;
|
||||
|
||||
@@ -13,7 +13,6 @@ public:
|
||||
virtual ~CommandlineCommandIndex();
|
||||
|
||||
virtual void setup();
|
||||
virtual void preparse();
|
||||
virtual ReturnStatus parse(std::vector<std::string>& args);
|
||||
|
||||
virtual bool hasHelp() const { return true; }
|
||||
|
||||
@@ -253,8 +253,6 @@ add_files(
|
||||
qt/window/QtBookmarkBrowser.h
|
||||
qt/window/QtBookmarkCreator.cpp
|
||||
qt/window/QtBookmarkCreator.h
|
||||
qt/window/QtEulaWindow.cpp
|
||||
qt/window/QtEulaWindow.h
|
||||
qt/window/QtIndexingDialog.cpp
|
||||
qt/window/QtIndexingDialog.h
|
||||
qt/window/QtIndexingProgressDialog.cpp
|
||||
|
||||
@@ -63,8 +63,6 @@ void setupApp(int argc, char *argv[])
|
||||
userDataPath.concatenate(L"Sourcetrail/");
|
||||
}
|
||||
userDataPath.makeCanonical();
|
||||
Application::EULA_ACCEPT_REQUIRED = false;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -98,12 +98,12 @@ void QtMainView::saveLayout()
|
||||
m_window->saveLayout();
|
||||
}
|
||||
|
||||
void QtMainView::loadWindow(bool showStartWindow, bool showEULA)
|
||||
void QtMainView::loadWindow(bool showStartWindow)
|
||||
{
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
m_window->loadWindow(showStartWindow, showEULA);
|
||||
m_window->loadWindow(showStartWindow);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
void loadLayout() override;
|
||||
void saveLayout() override;
|
||||
|
||||
void loadWindow(bool showStartWindow, bool showEULA) override;
|
||||
void loadWindow(bool showStartWindow) override;
|
||||
|
||||
void refreshView() override;
|
||||
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
#include "QtEulaWindow.h"
|
||||
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
#include "ResourcePaths.h"
|
||||
#include "TextAccess.h"
|
||||
|
||||
QtEulaWindow::QtEulaWindow(QWidget *parent, bool forceAccept)
|
||||
: QtWindow(false, parent)
|
||||
, m_forceAccept(forceAccept)
|
||||
{
|
||||
}
|
||||
|
||||
QSize QtEulaWindow::sizeHint() const
|
||||
{
|
||||
return QSize(700, 600);
|
||||
}
|
||||
|
||||
void QtEulaWindow::populateWindow(QWidget* widget)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(widget);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
if (m_forceAccept)
|
||||
{
|
||||
layout->addSpacing(5);
|
||||
|
||||
QLabel* label = new QLabel("Please read and agree to our End User License Agreement:");
|
||||
QFont _font = label->font();
|
||||
_font.setBold(true);
|
||||
label->setFont(_font);
|
||||
layout->addWidget(label);
|
||||
}
|
||||
|
||||
std::shared_ptr<TextAccess> text =
|
||||
TextAccess::createFromFile(ResourcePaths::getLicensePath().concatenate(L"EULA.txt"));
|
||||
|
||||
QTextEdit* licenseText = new QTextEdit();
|
||||
licenseText->setObjectName("textField");
|
||||
licenseText->setReadOnly(true);
|
||||
licenseText->setText(QString::fromStdString(text->getText()));
|
||||
layout->addWidget(licenseText);
|
||||
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
|
||||
void QtEulaWindow::windowReady()
|
||||
{
|
||||
updateTitle("End User License Agreement");
|
||||
|
||||
if (m_forceAccept)
|
||||
{
|
||||
updateCloseButton("Quit");
|
||||
updateNextButton("I agree");
|
||||
}
|
||||
else
|
||||
{
|
||||
updateCloseButton("Close");
|
||||
setNextVisible(false);
|
||||
}
|
||||
|
||||
setPreviousVisible(false);
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#ifndef QT_EULA_LICENSE_H
|
||||
#define QT_EULA_LICENSE_H
|
||||
|
||||
#include "QtWindow.h"
|
||||
|
||||
class QtEulaWindow
|
||||
: public QtWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtEulaWindow(QWidget* parent, bool forceAccept);
|
||||
QSize sizeHint() const override;
|
||||
|
||||
protected:
|
||||
// QtWindow implementation
|
||||
virtual void populateWindow(QWidget* widget) override;
|
||||
virtual void windowReady() override;
|
||||
|
||||
private:
|
||||
bool m_forceAccept;
|
||||
};
|
||||
|
||||
#endif // QT_EULA_LICENSE_H
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "QtProjectWizard.h"
|
||||
#include "QtAbout.h"
|
||||
#include "QtAboutLicense.h"
|
||||
#include "QtEulaWindow.h"
|
||||
#include "QtKeyboardShortcuts.h"
|
||||
#include "QtPreferencesWindow.h"
|
||||
#include "QtStartScreen.h"
|
||||
@@ -323,17 +322,12 @@ void QtMainWindow::loadDockWidgetLayout()
|
||||
}
|
||||
}
|
||||
|
||||
void QtMainWindow::loadWindow(bool showStartWindow, bool showEULA)
|
||||
void QtMainWindow::loadWindow(bool showStartWindow)
|
||||
{
|
||||
if (showStartWindow)
|
||||
{
|
||||
showStartScreen();
|
||||
}
|
||||
|
||||
if (showEULA)
|
||||
{
|
||||
showEula(true);
|
||||
}
|
||||
}
|
||||
|
||||
void QtMainWindow::saveLayout()
|
||||
@@ -528,35 +522,6 @@ void QtMainWindow::showBugtracker()
|
||||
QDesktopServices::openUrl(QUrl("https://github.com/CoatiSoftware/SourcetrailBugTracker/issues"));
|
||||
}
|
||||
|
||||
void QtMainWindow::showEula(bool forceAccept)
|
||||
{
|
||||
QtEulaWindow* window = new QtEulaWindow(this, forceAccept);
|
||||
m_windowStack.pushWindow(window);
|
||||
window->setup();
|
||||
|
||||
if (forceAccept)
|
||||
{
|
||||
setEnabled(false);
|
||||
window->setEnabled(true);
|
||||
|
||||
connect(window, &QtEulaWindow::finished, this, &QtMainWindow::acceptedEula);
|
||||
connect(window, &QtEulaWindow::canceled, dynamic_cast<QApplication*>(QCoreApplication::instance()), &QApplication::quit);
|
||||
}
|
||||
else
|
||||
{
|
||||
connect(window, &QtEulaWindow::canceled, &m_windowStack, &QtWindowStack::popWindow);
|
||||
}
|
||||
}
|
||||
|
||||
void QtMainWindow::acceptedEula()
|
||||
{
|
||||
ApplicationSettings::getInstance()->setAcceptedEulaVersion(Application::EULA_VERSION);
|
||||
ApplicationSettings::getInstance()->save();
|
||||
|
||||
setEnabled(true);
|
||||
m_windowStack.popWindow();
|
||||
}
|
||||
|
||||
void QtMainWindow::showLicenses()
|
||||
{
|
||||
QtAboutLicense* licenseWindow = createWindow<QtAboutLicense>();
|
||||
@@ -1052,7 +1017,6 @@ void QtMainWindow::setupHelpMenu()
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
void saveLayout();
|
||||
|
||||
void loadDockWidgetLayout();
|
||||
void loadWindow(bool showStartWindow, bool showEULA);
|
||||
void loadWindow(bool showStartWindow);
|
||||
|
||||
void updateHistoryMenu(std::shared_ptr<MessageBase> message);
|
||||
void clearHistoryMenu();
|
||||
@@ -106,8 +106,6 @@ public slots:
|
||||
void showDocumentation();
|
||||
void showKeyboardShortcuts();
|
||||
void showErrorHelpMessage();
|
||||
void showEula(bool forceAccept = false);
|
||||
void acceptedEula();
|
||||
void showLicenses();
|
||||
|
||||
void showDataFolder();
|
||||
|
||||
Reference in New Issue
Block a user