1 Description: Remove license dialog and license key checking
3 https://sources.debian.net/data/main/t/tipp10/2.1.0-2/debian/patches/0002-RemoveLicenseCode
7 @@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fi
8 #include "def/defines.h"
9 #include "sql/connection.h"
10 #include "widget/mainwindow.h"
11 -#include "widget/licensedialog.h"
12 #include "widget/illustrationdialog.h"
14 int main(int argc, char *argv[]) {
15 @@ -59,7 +58,7 @@ int main(int argc, char *argv[]) {
19 - // Read/write language, license key and show illustration flag
20 + // Read/write language and show illustration flag
21 settings.beginGroup("general");
22 QString languageGui = settings.value("language_gui",
23 QLocale::system().name()).toString();
24 @@ -101,7 +100,6 @@ int main(int argc, char *argv[]) {
25 QString languageLesson = settings.value("language_lesson",
28 - QString licenseKey = settings.value("licensekey", "").toString();
29 bool showIllustration = settings.value("check_illustration", true).toBool();
30 bool useNativeStyle = settings.value("check_native_style", false).toBool();
34 @@ -43,7 +43,6 @@ HEADERS += def/defines.h \
35 widget/helpbrowser.h \
36 widget/companylogo.h \
37 widget/errormessage.h \
38 - widget/licensedialog.h \
39 widget/txtmessagedialog.h \
40 widget/checkversion.h \
42 @@ -78,7 +77,6 @@ SOURCES += main.cpp \
43 widget/helpbrowser.cpp \
44 widget/companylogo.cpp \
45 widget/errormessage.cpp \
46 - widget/licensedialog.cpp \
47 widget/txtmessagedialog.cpp \
48 widget/checkversion.cpp \
49 sql/lessontablesql.cpp \
50 --- a/widget/licensedialog.cpp
54 -Copyright (c) 2006-2009, Tom Thielicke IT Solutions
56 -This program is free software; you can redistribute it and/or
57 -modify it under the terms of the GNU General Public License
58 -as published by the Free Software Foundation; either version 2
61 -This program is distributed in the hope that it will be useful,
62 -but WITHOUT ANY WARRANTY; without even the implied warranty of
63 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64 -GNU General Public License for more details.
66 -You should have received a copy of the GNU General Public License
67 -along with this program; if not, write to the Free Software
68 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
72 -/****************************************************************
74 -** Implementation of the LicenseDialog class
75 -** File name: licensedialog.cpp
77 -****************************************************************/
79 -#include <QHBoxLayout>
80 -#include <QVBoxLayout>
81 -#include <QMessageBox>
83 -#include <QCoreApplication>
85 -#include "licensedialog.h"
86 -#include "def/defines.h"
88 -LicenseDialog::LicenseDialog(QWidget *parent) : QDialog(parent) {
90 - setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
92 - setWindowTitle(tr("Lizenznummer"));
93 - setWindowIcon(QIcon(":/img/" + QString(ICON_FILENAME)));
101 - // Set the layout of all widgets created above
104 - lineLicensing->setFocus();
107 -void LicenseDialog::createButtons() {
109 - buttonOk = new QPushButton(this);
110 - buttonDemo = new QPushButton(this);
112 - buttonOk->setText(tr("&Ok"));
113 - buttonDemo->setText(tr("&Demo starten"));
114 - buttonDemo->setToolTip(tr("Im Demo-Modus koennen pro Lektion nur\n"
115 - "10 Schriftzeichen eingegeben werden"));
117 - buttonOk->setDefault(true);
118 - // Widget connections
119 - connect(buttonOk, SIGNAL(clicked()), this, SLOT(clickOk()));
120 - connect(buttonDemo, SIGNAL(clicked()), this, SLOT(clickDemo()));
123 -void LicenseDialog::createLineEdit() {
125 - lineLicensing = new QLineEdit();
126 - lineLicensing->setInputMask(">NNNNNNNNNNNNNN");
128 - labelLicensing = new QLabel(tr("Bitte geben Sie Ihre Lizenznummer "
129 - "(ohne Leerzeichen) ein, "
130 - "die Sie im Arbeitsbuch (Schulbuch) auf Seite 3 finden:"));
132 - labelLicensing->setWordWrap(true);
135 -void LicenseDialog::createLayout() {
136 - // Button layout horizontal
137 - QHBoxLayout *buttonLayoutHorizontal = new QHBoxLayout;
138 - buttonLayoutHorizontal->addStretch(1);
139 - buttonLayoutHorizontal->addWidget(buttonDemo);
140 - buttonLayoutHorizontal->addWidget(buttonOk);
141 - // Full layout of all widgets vertical
142 - QVBoxLayout *mainLayout = new QVBoxLayout;
143 - mainLayout->addSpacing(1);
144 - mainLayout->addWidget(labelLicensing);
145 - mainLayout->addSpacing(1);
146 - mainLayout->addWidget(lineLicensing);
147 - mainLayout->addSpacing(1);
148 - mainLayout->addLayout(buttonLayoutHorizontal);
149 - mainLayout->setMargin(15);
150 - mainLayout->setSpacing(15);
151 - // Pass layout to parent widget (this)
152 - this->setLayout(mainLayout);
155 -void LicenseDialog::clickOk() {
157 - // Check license key
158 - if (!checkLicenseKey(lineLicensing->text())) {
160 - // License key is wrong
162 - // Message to the user
163 - QMessageBox::information(0, APP_NAME,
164 - tr("Die eingegebene Lizenznummer ist leider nicht "
165 - "korrekt.\nBitte ueberpruefen Sie die Schreibweise."));
167 - lineLicensing->setFocus();
171 - // License key is ok
177 -void LicenseDialog::clickDemo() {
181 -bool LicenseDialog::checkLicenseKey(QString licenseKey) {
182 - if (licenseKey.size() == 14 &&
183 - licenseKey[0].isLetter() &&
184 - licenseKey[1].isLetter() &&
185 - (licenseKey.mid(2, 2) == "39" ||
186 - licenseKey.mid(2, 2) == "41" ||
187 - licenseKey.mid(2, 2) == "43" ||
188 - licenseKey.mid(2, 2) == "49" ||
189 - licenseKey.mid(2, 2) == "99") &&
190 - licenseKey[4].isDigit() &&
191 - licenseKey[5].isDigit() &&
192 - licenseKey[6].isDigit() &&
193 - licenseKey[7].isLetter() &&
194 - licenseKey[8].isDigit() &&
195 - licenseKey[9].isDigit() &&
196 - licenseKey[10].isDigit() &&
197 - licenseKey[11].isDigit() &&
198 - licenseKey[12].isLetter() &&
199 - licenseKey[13].isLetter()) {
206 -void LicenseDialog::writeSettings() {
207 - // Saves settings of the startwiget
208 - // (uses the default constructor of QSettings, passing
209 - // the application and company name see main function)
211 - QSettings settings(QCoreApplication::applicationDirPath() +
212 - "/portable/settings.ini", QSettings::IniFormat);
214 - QSettings settings;
217 - settings.beginGroup("general");
218 - settings.setValue("licensekey", lineLicensing->text());
219 - settings.endGroup();
221 --- a/widget/licensedialog.h
225 -Copyright (c) 2006-2009, Tom Thielicke IT Solutions
227 -This program is free software; you can redistribute it and/or
228 -modify it under the terms of the GNU General Public License
229 -as published by the Free Software Foundation; either version 2
232 -This program is distributed in the hope that it will be useful,
233 -but WITHOUT ANY WARRANTY; without even the implied warranty of
234 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
235 -GNU General Public License for more details.
237 -You should have received a copy of the GNU General Public License
238 -along with this program; if not, write to the Free Software
239 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
243 -/****************************************************************
245 -** Definition of the LicenseDialog class
246 -** File name: licensedialog.h
248 -****************************************************************/
250 -#ifndef LICENSEDIALOG_H
251 -#define LICENSEDIALOG_H
255 -#include <QPushButton>
257 -#include <QLineEdit>
260 -//! The LicenseDialog class provides a license input widget.
262 - The LicenseDialog class shows a dialog to enter a license key.
264 - @author Tom Thielicke, s712715
268 -class LicenseDialog : public QDialog {
273 - //! Constructor, creates two table objects and provide it in two tabs.
274 - LicenseDialog(QWidget *parent = 0);
276 - bool checkLicenseKey(QString licenseKey);
282 - //! Start button pressed
285 - //! Demo button pressed
290 - //! Creates a cancel and a ok button.
291 - void createButtons();
293 - //! Creates a textbox.
294 - void createLineEdit();
296 - //! Creates the layout of the complete class.
297 - void createLayout();
299 - //! Writes user settings
300 - void writeSettings();
302 - QPushButton *buttonOk;
303 - QPushButton *buttonDemo;
304 - QLabel *labelLicensing;
305 - QLineEdit *lineLicensing;
308 -#endif //LICENSEDIALOG_H
309 --- a/widget/mainwindow.cpp
310 +++ b/widget/mainwindow.cpp
311 @@ -116,11 +116,6 @@ void MainWindow::closeEvent(QCloseEvent
315 -bool MainWindow::checkLicenseKey(QString licenseKey) {
320 void MainWindow::createMenu() {
323 --- a/widget/mainwindow.h
324 +++ b/widget/mainwindow.h
325 @@ -39,7 +39,6 @@ Foundation, Inc., 51 Franklin Street, Fi
326 #include "trainingwidget.h"
327 #include "evaluationwidget.h"
328 #include "illustrationdialog.h"
329 -#include "licensedialog.h"
330 #include "games/abcrainwidget.h"
331 #include "helpbrowser.h"