Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

license + dialog #176

Merged
merged 3 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions src/gui/license_dialog.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "license_dialog.h"

#include "../license/license.h"

#include <QPushButton>
#include <QTextEdit>
#include <QVBoxLayout>

#include <QtGlobal> // version check


LicenseDialog::LicenseDialog(QWidget* parent) :
QDialog(parent)
{
setModal(true);
setWindowTitle("License Information");

if (parent != nullptr) {
setGeometry(parent->x() + 50, parent->y() + 50, parent->width() * 4 / 5, parent->height() * 4 / 5);
}

QVBoxLayout* layout = new QVBoxLayout(this);

QTextEdit* text = new QTextEdit();
text->setReadOnly(true);

const auto LICENSE{ QString::fromStdString(tobor::License::get_markdown_license()) };

#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
text->setPlainText(LICENSE);
#else
text->setMarkdown(LICENSE);
#endif

text->setTextInteractionFlags(Qt::LinksAccessibleByMouse);

QPushButton* ok_button = new QPushButton("OK");

layout->addWidget(text);
layout->addWidget(ok_button);

QObject::connect(ok_button, &QPushButton::clicked, this, &QDialog::accept, Qt::AutoConnection);
}
9 changes: 9 additions & 0 deletions src/gui/license_dialog.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

#include <QDialog>

class LicenseDialog : public QDialog {
public:
LicenseDialog(QWidget* parent = nullptr);

};
43 changes: 43 additions & 0 deletions src/license/license.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#pragma once

#include <string>

namespace tobor {

class License {
private:
inline static const std::string MD_LIC{
R"xxx(## Tobor License Information

* All rights reserved, unless stated otherwise for certain parts.
* Tobor is a software written as a private project for the authors' own fulfillment.
* Authors:
* Maximilian Starke: [GitHub: https://github.com/Necktschnagge](https://github.com/Necktschnagge), [e-mail: maximilian.starke@medionmail.com](mailto:maximilian.starke@medionmail.com)
* Daniel Wehmeyer: [GitHub: https://github.com/r0ost3r](https://github.com/r0ost3r), [e-mail: danweh@spamfence.net](mailto:danweh@spamfence.net)
* You are alllowed to download and enjoy this software for your private purpose of entertainment or together with friends.
* You are not allowed to re-upload or distribute Tobor in any way.
* Commercial use is forbidden unless you purchase an aditional commercial license.
* In this case, please contact main author Maximilian Starke [GitHub: https://github.com/Necktschnagge](https://github.com/Necktschnagge), [e-mail: maximilian.starke@medionmail.com](mailto:maximilian.starke@medionmail.com).

* License on certain parts:
* This project uses several external libraries via e.g. git submodules. Please stick to their licenses when using them.
* Some tools may be committed as files to Tobor's repository. If a file has its own license information, only the license information given in this particular file will be valid for this particular file.
* License on SVG content:
* All SVG content in this software is licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/), including entire SVGs that may be exported runnign Tobor as well as snippets of SVGs to be found in the code.
* For some of our SVG content we remixed or simply reused SVG emojis by [OpenMoji](https://openmoji.org). Therefore we decided to share *every* part of our SVG content under the same license CC BY-SA 4.0.


By using this software you agree to the license restrictions above.

Have fun and enjoy our software!
)xxx"
};

public:

inline static std::string get_markdown_license() {
return MD_LIC;
}
};

}
5 changes: 4 additions & 1 deletion src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "custom_traits.h"

#include "./ui_mainwindow.h"
#include "gui/license_dialog.h"


#include "special_case_22_game_factory.h"
#include "original_game_factory.h"
Expand Down Expand Up @@ -367,7 +369,8 @@ void MainWindow::on_actionStop_Solver_triggered()

void MainWindow::on_actionLicense_Information_triggered()
{
showErrorDialog("Not yet implemented.");
LicenseDialog* dialog = new LicenseDialog(this);
dialog->open();
}


Expand Down