gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / patches / tipp10-remove-license-code.patch
1 Description: Remove license dialog and license key checking
2
3 https://sources.debian.net/data/main/t/tipp10/2.1.0-2/debian/patches/0002-RemoveLicenseCode
4
5 --- a/main.cpp
6 +++ b/main.cpp
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"
13
14 int main(int argc, char *argv[]) {
15 @@ -59,7 +58,7 @@ int main(int argc, char *argv[]) {
16 QSettings settings;
17 #endif
18
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",
26 "").toString();
27
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();
31 settings.endGroup();
32 --- a/tipp10.pro
33 +++ b/tipp10.pro
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 \
41 sql/connection.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
51 +++ /dev/null
52 @@ -1,168 +0,0 @@
53 -/*
54 -Copyright (c) 2006-2009, Tom Thielicke IT Solutions
55 -
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
59 -of the License.
60 -
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.
65 -
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
69 -02110-1301, USA.
70 -*/
71 -
72 -/****************************************************************
73 -**
74 -** Implementation of the LicenseDialog class
75 -** File name: licensedialog.cpp
76 -**
77 -****************************************************************/
78 -
79 -#include <QHBoxLayout>
80 -#include <QVBoxLayout>
81 -#include <QMessageBox>
82 -#include <QSettings>
83 -#include <QCoreApplication>
84 -
85 -#include "licensedialog.h"
86 -#include "def/defines.h"
87 -
88 -LicenseDialog::LicenseDialog(QWidget *parent) : QDialog(parent) {
89 -
90 - setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
91 -
92 - setWindowTitle(tr("Lizenznummer"));
93 - setWindowIcon(QIcon(":/img/" + QString(ICON_FILENAME)));
94 -
95 - // Create texbox
96 - createLineEdit();
97 -
98 - // Create buttons
99 - createButtons();
100 -
101 - // Set the layout of all widgets created above
102 - createLayout();
103 -
104 - lineLicensing->setFocus();
105 -}
106 -
107 -void LicenseDialog::createButtons() {
108 - //Buttons
109 - buttonOk = new QPushButton(this);
110 - buttonDemo = new QPushButton(this);
111 -
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"));
116 -
117 - buttonOk->setDefault(true);
118 - // Widget connections
119 - connect(buttonOk, SIGNAL(clicked()), this, SLOT(clickOk()));
120 - connect(buttonDemo, SIGNAL(clicked()), this, SLOT(clickDemo()));
121 -}
122 -
123 -void LicenseDialog::createLineEdit() {
124 -
125 - lineLicensing = new QLineEdit();
126 - lineLicensing->setInputMask(">NNNNNNNNNNNNNN");
127 -
128 - labelLicensing = new QLabel(tr("Bitte geben Sie Ihre Lizenznummer "
129 - "(ohne Leerzeichen) ein, "
130 - "die Sie im Arbeitsbuch (Schulbuch) auf Seite 3 finden:"));
131 -
132 - labelLicensing->setWordWrap(true);
133 -}
134 -
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);
153 -}
154 -
155 -void LicenseDialog::clickOk() {
156 -
157 - // Check license key
158 - if (!checkLicenseKey(lineLicensing->text())) {
159 -
160 - // License key is wrong
161 -
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."));
166 -
167 - lineLicensing->setFocus();
168 -
169 - } else {
170 -
171 - // License key is ok
172 - writeSettings();
173 - accept();
174 - }
175 -}
176 -
177 -void LicenseDialog::clickDemo() {
178 - accept();
179 -}
180 -
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()) {
200 -
201 - return true;
202 - }
203 - return false;
204 -}
205 -
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)
210 - #if APP_PORTABLE
211 - QSettings settings(QCoreApplication::applicationDirPath() +
212 - "/portable/settings.ini", QSettings::IniFormat);
213 - #else
214 - QSettings settings;
215 - #endif
216 -
217 - settings.beginGroup("general");
218 - settings.setValue("licensekey", lineLicensing->text());
219 - settings.endGroup();
220 -}
221 --- a/widget/licensedialog.h
222 +++ /dev/null
223 @@ -1,85 +0,0 @@
224 -/*
225 -Copyright (c) 2006-2009, Tom Thielicke IT Solutions
226 -
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
230 -of the License.
231 -
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.
236 -
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
240 -02110-1301, USA.
241 -*/
242 -
243 -/****************************************************************
244 -**
245 -** Definition of the LicenseDialog class
246 -** File name: licensedialog.h
247 -**
248 -****************************************************************/
249 -
250 -#ifndef LICENSEDIALOG_H
251 -#define LICENSEDIALOG_H
252 -
253 -#include <QDialog>
254 -#include <QWidget>
255 -#include <QPushButton>
256 -#include <QLabel>
257 -#include <QLineEdit>
258 -#include <QString>
259 -
260 -//! The LicenseDialog class provides a license input widget.
261 -/*!
262 - The LicenseDialog class shows a dialog to enter a license key.
263 -
264 - @author Tom Thielicke, s712715
265 - @version 0.0.1
266 - @date 09.09.2008
267 -*/
268 -class LicenseDialog : public QDialog {
269 - Q_OBJECT
270 -
271 - public:
272 -
273 - //! Constructor, creates two table objects and provide it in two tabs.
274 - LicenseDialog(QWidget *parent = 0);
275 -
276 - bool checkLicenseKey(QString licenseKey);
277 -
278 - public slots:
279 -
280 - private slots:
281 -
282 - //! Start button pressed
283 - void clickOk();
284 -
285 - //! Demo button pressed
286 - void clickDemo();
287 -
288 - private:
289 -
290 - //! Creates a cancel and a ok button.
291 - void createButtons();
292 -
293 - //! Creates a textbox.
294 - void createLineEdit();
295 -
296 - //! Creates the layout of the complete class.
297 - void createLayout();
298 -
299 - //! Writes user settings
300 - void writeSettings();
301 -
302 - QPushButton *buttonOk;
303 - QPushButton *buttonDemo;
304 - QLabel *labelLicensing;
305 - QLineEdit *lineLicensing;
306 -};
307 -
308 -#endif //LICENSEDIALOG_H
309 --- a/widget/mainwindow.cpp
310 +++ b/widget/mainwindow.cpp
311 @@ -116,11 +116,6 @@ void MainWindow::closeEvent(QCloseEvent
312 }
313 }
314
315 -bool MainWindow::checkLicenseKey(QString licenseKey) {
316 -
317 - return false;
318 -}
319 -
320 void MainWindow::createMenu() {
321 //Mac-Version:
322 //-----------
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"
332