Commit 6124a71e authored by Jan Möbius's avatar Jan Möbius

Improved license manager and keygen

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10588 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 404c622d
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>206</height>
<height>312</height>
</rect>
</property>
<property name="windowTitle">
......@@ -15,45 +15,166 @@
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Request data:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="requestData">
<property name="toolTip">
<string>Enter the request received from the user into this field.</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" rowspan="2" colspan="2">
<widget class="QPushButton" name="splitButton">
<property name="text">
<string>Request data:</string>
<string>Split</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QTextEdit" name="requestData">
<property name="toolTip">
<string>Enter the request received from the user into this field.</string>
<item row="2" column="1">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Expires:</string>
</property>
</widget>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QPushButton" name="validButton">
<property name="text">
<string>Valid</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Days</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="days"/>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Months</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="months"/>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Years</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="years"/>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QDateEdit" name="expires">
<property name="toolTip">
<string>The date, when the license will expire.</string>
</property>
<property name="dateTime">
<datetime>
<hour>9</hour>
<minute>0</minute>
<second>0</second>
<year>2009</year>
<month>1</month>
<day>1</day>
</datetime>
<item row="4" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Expires:</string>
</property>
</widget>
</item>
<item>
<widget class="QDateEdit" name="expires">
<property name="toolTip">
<string>The date, when the license will expire.</string>
</property>
<property name="dateTime">
<datetime>
<hour>9</hour>
<minute>0</minute>
<second>0</second>
<year>2009</year>
<month>1</month>
<day>1</day>
</datetime>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="6" column="0" colspan="2">
<widget class="QPushButton" name="generateButton">
<property name="text">
<string>Generate</string>
......
......@@ -53,12 +53,41 @@ KeyGenWidget::KeyGenWidget(QMainWindow *parent)
setupUi(this);
connect(generateButton,SIGNAL(clicked()),this,SLOT(slotGenerateButton()));
// Automatically set expire date to current date + 1 Year
connect(splitButton,SIGNAL(clicked()),this,SLOT(slotSplit()));
connect(validButton,SIGNAL(clicked()),this,SLOT(slotValid()));
// Automatically set expire date to current date
// For security reasons no default span is set here!
expires->setDate( QDate::currentDate());
}
void KeyGenWidget::slotValid() {
std::cerr << "Valid" << std::endl;
QDate today = QDate::currentDate();
expires->setDate(today.addYears(1));
today = today.addDays(days->value());
today = today.addMonths(months->value());
today = today.addYears(years->value());
expires->setDate(today);
}
void KeyGenWidget::slotSplit() {
// Get request data
QString inputData = requestData->toPlainText();
// Split with ;
QStringList data = inputData.split(";",QString::SkipEmptyParts);
QString newText = data.join("\n");
requestData->setText(newText);
}
KeyGenWidget::~KeyGenWidget() {
}
......
......@@ -57,6 +57,12 @@ public:
public slots:
void slotGenerateButton();
// Button slot taking license duration and convert to expiration date
void slotValid();
// Split Code based on ;; for broken windows requests
void slotSplit();
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment