diff options
author | Thomas Preud'homme <robotux@celest.fr> | 2019-02-03 00:10:52 +0000 |
---|---|---|
committer | Thomas Preud'homme <robotux@celest.fr> | 2019-02-03 00:10:52 +0000 |
commit | 9b10c21f5cad0e2ec27d23c59e65af7141a226f3 (patch) | |
tree | bf81d75a9ed990bb76488c502767600fcf7550b7 /ProductKey.cpp | |
parent | 594fcba67600704bee9115c86e18927b2237b304 (diff) |
New upstream version 1.6.1.3
Diffstat (limited to 'ProductKey.cpp')
-rw-r--r-- | ProductKey.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/ProductKey.cpp b/ProductKey.cpp new file mode 100644 index 0000000..eeb533c --- /dev/null +++ b/ProductKey.cpp @@ -0,0 +1,67 @@ +#include "ProductKey.h" +#include "ui_ProductKey.h" +#include "DebugEngine.h" +#include "OptionEngine.h" +#include "SystrayIcon.h" +#include <QMessageBox> +#include <QCryptographicHash> + +ProductKey::ProductKey(QWidget *parent) : + QDialog(parent), + ui(new Ui::ProductKey) +{ + ui->setupUi(this); + parseKey(); +} + +ProductKey::~ProductKey() +{ + delete ui; +} + +bool ProductKey::parseKey(QString orgkey) +{ + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"ultimate key"); + QString key=orgkey; + if(orgkey.isEmpty()) + key=QString::fromStdString(OptionEngine::optionEngine->getOptionValue("Ultracopier","key")); + if(!key.isEmpty()) + { + QCryptographicHash hash(QCryptographicHash::Sha224); + hash.addData(QStringLiteral("U2NgvbKVrVwlaXnx").toUtf8()); + hash.addData(key.toUtf8()); + const QByteArray &result=hash.result(); + if(!result.isEmpty() && result.at(0)==0x00 && result.at(1)==0x00) + { + if(!orgkey.isEmpty()) + OptionEngine::optionEngine->setOptionValue("Ultracopier","key",key.toStdString()); + ultimate=true; + } + else + ultimate=false; + } + else + ultimate=false; + return ultimate; +} + +bool ProductKey::isUltimate() const +{ + return ultimate; +} + +void ProductKey::on_buttonBox_accepted() +{ + if(!ProductKey::parseKey(ui->productkey->text())) + QMessageBox::critical(this,tr("Error"),"<br />"+tr("Your product key was rejected.<br />If you buy key, unmark check your spam and unmark the mail as spam<br />If you have not buy your key, go to <a href=\"https://shop.first-world.info/\">https://shop.first-world.info/</a>")); + else + { + changeToUltimate(); + hide(); + } +} + +void ProductKey::on_buttonBox_rejected() +{ + hide(); +} |