一、简介
centos6.4下自己写的代码需要进行简单的加密处理,使用第三方的加密需要费用。于是利用Qt界面配合自己写了一套加密算法,一般也是可以保证安全的。效果如下:
二、详解
1、代码
(1)autosetup.h
#ifndef WIDGET_H
#define WIDGET_H
#include <QtCore>
#include <QtGui>
#include <QWidget>
#include <QProgressBar>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <unistd.h>
#include "custombtn.h"
#include "vmcontrol.h"
#include "waitting_label.h"
#include "calendarselected.h"
#include "licensehelper.h"
using namespace RJ_LICENSE;
class AutoSetup : public QWidget
{
Q_OBJECT
public:
AutoSetup(QWidget *parent = 0);
~AutoSetup();
protected:
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *event );
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
private:
QPoint dragPosition;
bool bPressFlag;
QPixmap backGroundPix;
QPixmap logoIcon;
QColor backGroundColor;
CustomBtn *closeBtn;
QLabel *titleLabel;
QLabel *displayInfoLabel;
QLabel *progressLabel;
QTextBrowser *textBrowser;
QProgressBar *progressBar;
QLabel *driverLabel;
CustomBtn *requestBtn;
VmmLineEdit *requestLineEdit;
CustomBtn *licenseBtn;
VmmLineEdit *licenseLineEdit;
QLabel *timeLabel;
CalendarSelected *calendarTime;
QCheckBox *foreverCheckBox;
CustomBtn *generateBtn;
RotatingLabel *waittingLable;
private:
void check_all_btn_status();
private slots:
void slotRequestBtn();
void slotLicenseBtn();
void slotforeverCheckBox(bool checked);
void slotGenerateBtn();
void slotTextChanged(const QString &text);
void slotCloseWin();
};
#endif // WIDGET_H
(2)autosetup.cpp
#include "autosetup.h"
#include "messageinfo.h"
//#include "initmanager.h"
#include "appinitview.h"
#include "licensehelper.h"
using namespace RJ_LICENSE;
AutoSetup::AutoSetup(QWidget *parent)
: QWidget(parent, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint)
,bPressFlag(false)
{
QString _version = "";
QString titleText = tr("Ruijie") + _version + tr("Setup Wizard");
titleLabel = new QLabel(this);
titleLabel->setText(titleText);
titleLabel->setStyleSheet("color:#FFFFFF");
titleLabel->setFont(QFont("arial", 12, QFont::Bold));
/***************bakeground********************/
backGroundPix = QPixmap(":/resources/images/formDialog.png");
backGroundPix = backGroundPix.scaled(440, 440, Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
logoIcon = QPixmap(QString(":/resources/images/logo.png"));
resize(backGroundPix.width(), backGroundPix.height());
backGroundColor = QColor(0xFF,0xF