Commit 3a01234c authored by Jan Möbius's avatar Jan Möbius

Improved keygen Gui



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6684 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b96e21db
...@@ -16,6 +16,7 @@ int main(int argc, char **argv) ...@@ -16,6 +16,7 @@ int main(int argc, char **argv)
QString pluginHash; QString pluginHash;
QString macHash; QString macHash;
QString requestSig; QString requestSig;
QString expiryDate;
if (argc == 3) { if (argc == 3) {
...@@ -34,19 +35,25 @@ int main(int argc, char **argv) ...@@ -34,19 +35,25 @@ int main(int argc, char **argv)
pluginHash = file.readLine().simplified(); pluginHash = file.readLine().simplified();
macHash = file.readLine().simplified(); macHash = file.readLine().simplified();
requestSig = file.readLine().simplified(); requestSig = file.readLine().simplified();
expiryDate = argv[2];
file.close(); file.close();
} else { } else {
MainWindow* mainWindow = new MainWindow(); KeyGenWidget* keyGenWidget = new KeyGenWidget(0);
mainWindow->show();
// Automatically set expire date to current date + 1 Year
QDate today = QDate::currentDate();
keyGenWidget->expires->setDate(today.addYears(1));
// Show the widget
keyGenWidget->show();
a.exec(); a.exec();
QString inputData = mainWindow->textEdit_->toPlainText();
QStringList data = inputData.split('\n'); QString inputData = keyGenWidget->requestData->toPlainText();
QStringList data = inputData.split('\n',QString::SkipEmptyParts);
if ( data.size() != 5 ) { if ( data.size() != 5 ) {
std::cerr << "Request data has to containe 5 lines!" << std::endl; std::cerr << "Request data has to containe 5 lines!" << std::endl;
...@@ -59,7 +66,9 @@ int main(int argc, char **argv) ...@@ -59,7 +66,9 @@ int main(int argc, char **argv)
pluginHash = data[2].simplified(); pluginHash = data[2].simplified();
macHash = data[3].simplified(); macHash = data[3].simplified();
requestSig = data[4].simplified(); requestSig = data[4].simplified();
expiryDate = keyGenWidget->expires->date().toString(Qt::ISODate);
} }
std::cerr << "Generating key for Plugin : " << name.toStdString() << std::endl; std::cerr << "Generating key for Plugin : " << name.toStdString() << std::endl;
...@@ -67,6 +76,7 @@ int main(int argc, char **argv) ...@@ -67,6 +76,7 @@ int main(int argc, char **argv)
std::cerr << "Plugin Hash : " << pluginHash.toStdString() << std::endl; std::cerr << "Plugin Hash : " << pluginHash.toStdString() << std::endl;
std::cerr << "macHash is : " << macHash.toStdString() << std::endl; std::cerr << "macHash is : " << macHash.toStdString() << std::endl;
std::cerr << "requestSignature is : " << requestSig.toStdString() << std::endl; std::cerr << "requestSignature is : " << requestSig.toStdString() << std::endl;
std::cerr << "expiryDate is : " << expiryDate.toStdString() << std::endl;
// Get the salts // Get the salts
QString saltPre; QString saltPre;
...@@ -99,7 +109,7 @@ int main(int argc, char **argv) ...@@ -99,7 +109,7 @@ int main(int argc, char **argv)
output << macHash << "\n"; output << macHash << "\n";
// Add expiryDate // Add expiryDate
QDate date = QDate::fromString(argv[2],Qt::ISODate); QDate date = QDate::fromString(expiryDate,Qt::ISODate);
output << date.toString(Qt::ISODate) << "\n"; output << date.toString(Qt::ISODate) << "\n";
......
#include <QtGui> #include <QtGui>
#include "keygenWidget.hh" #include "keygenWidget.hh"
#include <iostream>
MainWindow::MainWindow() #include "salt.hh"
KeyGenWidget::KeyGenWidget(QMainWindow *parent)
: QMainWindow(parent)
{ {
setupUi(this);
connect(generateButton,SIGNAL(clicked()),this,SLOT(slotGenerateButton()));
}
textEdit_ = new QTextEdit(this); KeyGenWidget::~KeyGenWidget() {
setCentralWidget(textEdit_);
} }
MainWindow::~MainWindow() { void KeyGenWidget::slotGenerateButton() {
QString inputData = requestData->toPlainText();
QStringList data = inputData.split('\n',QString::SkipEmptyParts);
if ( data.size() != 5) {
QMessageBox::critical(this,"Wrong request data","The request has to contain 5 lines of data");
} else {
close();
}
} }
...@@ -3,19 +3,19 @@ ...@@ -3,19 +3,19 @@
#ifndef KEYGENWINDOW_HH #ifndef KEYGENWINDOW_HH
#define KEYGENWINDOW_HH #define KEYGENWINDOW_HH
#include <QMainWindow> #include <ui_keygen.hh>
#include <QTextEdit>
class MainWindow : public QMainWindow class KeyGenWidget : public QMainWindow, public Ui::keyWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
MainWindow(); KeyGenWidget(QMainWindow *parent);
virtual ~MainWindow(); virtual ~KeyGenWidget();
QTextEdit* textEdit_; public slots:
void slotGenerateButton();
}; };
......
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