更新代码

master
feiyangqingyun 2021-06-04 13:33:16 +08:00
parent caff8c692f
commit cfa339e16f
7 changed files with 29 additions and 17 deletions

View File

@ -597,15 +597,19 @@ int QUIHelper::byteToUShortRec(const QByteArray &data)
return i;
}
QString QUIHelper::getXorEncryptDecrypt(const QString &str, char key)
QString QUIHelper::getXorEncryptDecrypt(const QString &value, char key)
{
QByteArray data = str.toLatin1();
int size = data.size();
for (int i = 0; i < size; i++) {
data[i] = data[i] ^ key;
//矫正范围外的数据
if (key < 0 || key >= 127) {
key = 127;
}
return QLatin1String(data);
QString result = value;
int count = result.count();
for (int i = 0; i < count; i++) {
result[i] = QChar(result.at(i).toLatin1() ^ key);
}
return result;
}
uchar QUIHelper::getOrCode(const QByteArray &data)

View File

@ -110,8 +110,8 @@ public:
static int byteToUShort(const QByteArray &data);
static int byteToUShortRec(const QByteArray &data);
//异或加密算法
static QString getXorEncryptDecrypt(const QString &str, char key);
//异或加密-只支持字符,如果是中文需要将其转换base64编码
static QString getXorEncryptDecrypt(const QString &value, char key);
//异或校验
static uchar getOrCode(const QByteArray &data);
//计算校验码

View File

@ -85,10 +85,12 @@ void NtpClient::readData()
QDateTime dateTime;
uint secs = seconds - epoch.secsTo(unixStart);
//两个方法二选一由于Qt6移除了setTime_t方法所以要自己计算
//dateTime.setTime_t(secs);
dateTime.setDate(QDate(1970, 1, 1).addDays(secs / 86400));
dateTime.setTime(QTime().addSecs(secs % 86400 + (8 * 60 * 60)));
#if (QT_VERSION < QT_VERSION_CHECK(6,0,0))
dateTime.setTime_t(secs);
#else
dateTime.setSecsSinceEpoch(secs);
#endif
#ifdef __arm__
#ifdef arma9

View File

@ -1,8 +1,12 @@
#include <QtCore>
#include <QtGui>
#include <QtNetwork>
#if (QT_VERSION >= QT_VERSION_CHECK(5,0,0))
#include <QtWidgets>
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
#include <QtCore5Compat>
#endif
#pragma execution_character_set("utf-8")

View File

@ -18,9 +18,9 @@ DESTDIR = $$PWD/../bin
CONFIG += warn_off
SOURCES += main.cpp
SOURCES += frmmain.cpp
HEADERS += head.h
HEADERS += frmmain.h
SOURCES += frmmain.cpp
FORMS += frmmain.ui
RESOURCES += other/qss.qrc
RESOURCES += other/main.qrc

View File

@ -64,11 +64,13 @@ void VideoPanel::initControl()
void VideoPanel::initForm()
{
//设置样式表
#ifndef no_style
QStringList qss;
qss.append("QFrame{border:2px solid #000000;}");
qss.append("QLabel{font:75 25px;color:#F0F0F0;border:2px solid #AAAAAA;background:#303030;}");
qss.append("QLabel:focus{border:2px solid #00BB9E;background:#555555;}");
this->setStyleSheet(qss.join(""));
#endif
videoMax = false;
videoCount = 64;

View File

@ -100,8 +100,8 @@ void VideoWidget::initFlowPanel()
icons << QApplication::style()->standardIcon(QStyle::SP_DialogOkButton);
icons << QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton);
#else
QList<QChar> chars;
chars << QChar(0xe68d) << QChar(0xe672) << QChar(0xe674) << QChar(0xea36) << QChar(0xe74c);
QList<int> icons;
icons << 0xe68d << 0xe672 << 0xe674 << 0xea36 << 0xe74c;
//判断图形字体是否存在,不存在则加入
QFont iconFont;
@ -143,7 +143,7 @@ void VideoWidget::initFlowPanel()
btn->setIcon(icons.at(i));
#else
btn->setFont(iconFont);
btn->setText(chars.at(i));
btn->setText((QChar)icons.at(i));
#endif
//将按钮加到布局中