File: 0002-RemoveLicenseCode

package info (click to toggle)
tipp10 2.1.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,944 kB
  • sloc: cpp: 10,810; ansic: 143; makefile: 9
file content (328 lines) | stat: -rw-r--r-- 9,676 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
--- a/main.cpp
+++ b/main.cpp
@@ -33,7 +33,6 @@ Foundation, Inc., 51 Franklin Street, Fi
 #include "def/defines.h"
 #include "sql/connection.h"
 #include "widget/mainwindow.h"
-#include "widget/licensedialog.h"
 #include "widget/illustrationdialog.h"
 
 int main(int argc, char *argv[]) {
@@ -59,7 +58,7 @@ int main(int argc, char *argv[]) {
 	QSettings settings;
 	#endif
 
-	// Read/write language, license key and show illustration flag
+	// Read/write language and show illustration flag
 	settings.beginGroup("general");
 	QString languageGui = settings.value("language_gui",
 		QLocale::system().name()).toString();
@@ -101,7 +100,6 @@ int main(int argc, char *argv[]) {
 	QString languageLesson = settings.value("language_lesson",
 		"").toString();
 
-	QString licenseKey = settings.value("licensekey", "").toString();
 	bool showIllustration = settings.value("check_illustration", true).toBool();
 	bool useNativeStyle = settings.value("check_native_style", false).toBool();
 	settings.endGroup();
--- a/tipp10.pro
+++ b/tipp10.pro
@@ -43,7 +43,6 @@ HEADERS         += 	def/defines.h \
                     widget/helpbrowser.h \
                     widget/companylogo.h \
                     widget/errormessage.h \
-                    widget/licensedialog.h \
                     widget/txtmessagedialog.h \
                     widget/checkversion.h \
                     sql/connection.h \
@@ -78,7 +77,6 @@ SOURCES         += 	main.cpp \
                     widget/helpbrowser.cpp \
                     widget/companylogo.cpp \
                     widget/errormessage.cpp \
-                    widget/licensedialog.cpp \
                     widget/txtmessagedialog.cpp \
                     widget/checkversion.cpp \
                     sql/lessontablesql.cpp \
--- a/widget/licensedialog.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
-Copyright (c) 2006-2009, Tom Thielicke IT Solutions
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.
-*/
-
-/****************************************************************
-**
-** Implementation of the LicenseDialog class
-** File name: licensedialog.cpp
-**
-****************************************************************/
-
-#include <QHBoxLayout>
-#include <QVBoxLayout>
-#include <QMessageBox>
-#include <QSettings>
-#include <QCoreApplication>
-
-#include "licensedialog.h"
-#include "def/defines.h"
-
-LicenseDialog::LicenseDialog(QWidget *parent) : QDialog(parent) {
-
-	setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint);
-
-	setWindowTitle(tr("Lizenznummer"));
-	setWindowIcon(QIcon(":/img/" + QString(ICON_FILENAME)));
-
-	// Create texbox
-    createLineEdit();
-
-	// Create buttons
-    createButtons();
-
-	// Set the layout of all widgets created above
-	createLayout();
-
-	lineLicensing->setFocus();
-}
-
-void LicenseDialog::createButtons() {
-	//Buttons
-	buttonOk = new QPushButton(this);
-	buttonDemo = new QPushButton(this);
-
-	buttonOk->setText(tr("&Ok"));
-	buttonDemo->setText(tr("&Demo starten"));
-	buttonDemo->setToolTip(tr("Im Demo-Modus koennen pro Lektion nur\n"
-		"10 Schriftzeichen eingegeben werden"));
-
-	buttonOk->setDefault(true);
-	// Widget connections
-    connect(buttonOk, SIGNAL(clicked()), this, SLOT(clickOk()));
-    connect(buttonDemo, SIGNAL(clicked()), this, SLOT(clickDemo()));
-}
-
-void LicenseDialog::createLineEdit() {
-
-	lineLicensing = new QLineEdit();
-	lineLicensing->setInputMask(">NNNNNNNNNNNNNN");
-
-	labelLicensing = new QLabel(tr("Bitte geben Sie Ihre Lizenznummer "
-		"(ohne Leerzeichen) ein, "
-		"die Sie im Arbeitsbuch (Schulbuch) auf Seite 3 finden:"));
-
-	labelLicensing->setWordWrap(true);
-}
-
-void LicenseDialog::createLayout() {
-	// Button layout horizontal
-	QHBoxLayout *buttonLayoutHorizontal = new QHBoxLayout;
-    buttonLayoutHorizontal->addStretch(1);
-    buttonLayoutHorizontal->addWidget(buttonDemo);
-    buttonLayoutHorizontal->addWidget(buttonOk);
-	// Full layout of all widgets vertical
-	QVBoxLayout *mainLayout = new QVBoxLayout;
-    mainLayout->addSpacing(1);
-    mainLayout->addWidget(labelLicensing);
-    mainLayout->addSpacing(1);
-    mainLayout->addWidget(lineLicensing);
-    mainLayout->addSpacing(1);
-    mainLayout->addLayout(buttonLayoutHorizontal);
-    mainLayout->setMargin(15);
-    mainLayout->setSpacing(15);
-    // Pass layout to parent widget (this)
-	this->setLayout(mainLayout);
-}
-
-void LicenseDialog::clickOk() {
-
-	// Check license key
-	if (!checkLicenseKey(lineLicensing->text())) {
-
-		// License key is wrong
-
-		// Message to the user
-		QMessageBox::information(0, APP_NAME,
-			tr("Die eingegebene Lizenznummer ist leider nicht "
-			"korrekt.\nBitte ueberpruefen Sie die Schreibweise."));
-
-		lineLicensing->setFocus();
-
-	} else {
-
-		// License key is ok
-		writeSettings();
-		accept();
-	}
-}
-
-void LicenseDialog::clickDemo() {
-	accept();
-}
-
-bool LicenseDialog::checkLicenseKey(QString licenseKey) {
-	if (licenseKey.size() == 14 &&
-		licenseKey[0].isLetter() &&
-		licenseKey[1].isLetter() &&
-		(licenseKey.mid(2, 2) == "39" ||
-		licenseKey.mid(2, 2) == "41" ||
-		licenseKey.mid(2, 2) == "43" ||
-		licenseKey.mid(2, 2) == "49" ||
-		licenseKey.mid(2, 2) == "99") &&
-		licenseKey[4].isDigit() &&
-		licenseKey[5].isDigit() &&
-		licenseKey[6].isDigit() &&
-		licenseKey[7].isLetter() &&
-		licenseKey[8].isDigit() &&
-		licenseKey[9].isDigit() &&
-		licenseKey[10].isDigit() &&
-		licenseKey[11].isDigit() &&
-		licenseKey[12].isLetter() &&
-		licenseKey[13].isLetter()) {
-
-		return true;
-	}
-	return false;
-}
-
-void LicenseDialog::writeSettings() {
-	// Saves settings of the startwiget
-	// (uses the default constructor of QSettings, passing
-	// the application and company name see main function)
-	#if APP_PORTABLE
-	QSettings settings(QCoreApplication::applicationDirPath() +
-    	"/portable/settings.ini", QSettings::IniFormat);
-    #else
-	QSettings settings;
-	#endif
-
-	settings.beginGroup("general");
-	settings.setValue("licensekey", lineLicensing->text());
-	settings.endGroup();
-}
--- a/widget/licensedialog.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-Copyright (c) 2006-2009, Tom Thielicke IT Solutions
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA.
-*/
-
-/****************************************************************
-**
-** Definition of the LicenseDialog class
-** File name: licensedialog.h
-**
-****************************************************************/
-
-#ifndef LICENSEDIALOG_H
-#define LICENSEDIALOG_H
-
-#include <QDialog>
-#include <QWidget>
-#include <QPushButton>
-#include <QLabel>
-#include <QLineEdit>
-#include <QString>
-
-//! The LicenseDialog class provides a license input widget.
-/*!
-	The LicenseDialog class shows a dialog to enter a license key.
-
-	@author Tom Thielicke, s712715
-	@version 0.0.1
-	@date 09.09.2008
-*/
-class LicenseDialog : public QDialog {
-	Q_OBJECT
-
-	public:
-
-		//! Constructor, creates two table objects and provide it in two tabs.
-		LicenseDialog(QWidget *parent = 0);
-
-		bool checkLicenseKey(QString licenseKey);
-
-	public slots:
-
-	private slots:
-
-		//! Start button pressed
-		void clickOk();
-
-		//! Demo button pressed
-		void clickDemo();
-
-	private:
-
-		//! Creates a cancel and a ok button.
-		void createButtons();
-
-		//! Creates a textbox.
-		void createLineEdit();
-
-		//! Creates the layout of the complete class.
-		void createLayout();
-
-		//! Writes user settings
-		void writeSettings();
-
-		QPushButton *buttonOk;
-		QPushButton *buttonDemo;
-		QLabel *labelLicensing;
-		QLineEdit *lineLicensing;
-};
-
-#endif //LICENSEDIALOG_H
--- a/widget/mainwindow.cpp
+++ b/widget/mainwindow.cpp
@@ -116,11 +116,6 @@ void MainWindow::closeEvent(QCloseEvent
 	}
 }
 
-bool MainWindow::checkLicenseKey(QString licenseKey) {
-
-    return false;
-}
-
 void MainWindow::createMenu() {
 	//Mac-Version:
 	//-----------
--- a/widget/mainwindow.h
+++ b/widget/mainwindow.h
@@ -39,7 +39,6 @@ Foundation, Inc., 51 Franklin Street, Fi
 #include "trainingwidget.h"
 #include "evaluationwidget.h"
 #include "illustrationdialog.h"
-#include "licensedialog.h"
 #include "games/abcrainwidget.h"
 #include "helpbrowser.h"