From c55098b007ca33e653ed28e1c80f7a09e579ba01 Mon Sep 17 00:00:00 2001 From: feiyangqingyun Date: Fri, 4 Jun 2021 13:33:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core_qui/quihelper.cpp | 16 +- core_qui/quihelper.h | 4 +- imagecropper/imagecropper.pro.user | 304 +++++++++++++++++++ imageviewwindow/imageviewwindow.pro.user | 304 +++++++++++++++++++ ntpclient/ntpclient.cpp | 10 +- slidepuzzlewidget/slidepuzzlewidget.pro.user | 304 +++++++++++++++++++ styledemo/head.h | 6 +- styledemo/styledemo.pro | 2 +- videopanel/videopanel.cpp | 2 + videowidget/videowidget.cpp | 6 +- 10 files changed, 941 insertions(+), 17 deletions(-) create mode 100644 imagecropper/imagecropper.pro.user create mode 100644 imageviewwindow/imageviewwindow.pro.user create mode 100644 slidepuzzlewidget/slidepuzzlewidget.pro.user diff --git a/core_qui/quihelper.cpp b/core_qui/quihelper.cpp index 3ee8e4a..527e3ea 100644 --- a/core_qui/quihelper.cpp +++ b/core_qui/quihelper.cpp @@ -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) diff --git a/core_qui/quihelper.h b/core_qui/quihelper.h index 9d4d8b3..47cd806 100644 --- a/core_qui/quihelper.h +++ b/core_qui/quihelper.h @@ -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); //计算校验码 diff --git a/imagecropper/imagecropper.pro.user b/imagecropper/imagecropper.pro.user new file mode 100644 index 0000000..53d849f --- /dev/null +++ b/imagecropper/imagecropper.pro.user @@ -0,0 +1,304 @@ + + + + + + EnvironmentId + {849db446-6f90-46aa-afcf-9e726de1fb02} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 0 + true + true + true + *.md, *.MD, Makefile + false + true + + + + ProjectExplorer.Project.PluginSettings + + + true + true + true + true + true + + + 0 + true + + + + ProjectExplorer.Project.Target.0 + + Desktop + desk5.7.0 + desk5.7.0 + {30975ac4-3883-489b-ac7a-132064e40ec0} + 0 + 0 + 0 + + 0 + I:\github\QWidgetDemo\build-imagecropper-desk5_7_0-Debug + I:/github/QWidgetDemo/build-imagecropper-desk5_7_0-Debug + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + 0 + + + I:\github\QWidgetDemo\build-imagecropper-desk5_7_0-Release + I:/github/QWidgetDemo/build-imagecropper-desk5_7_0-Release + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + I:\github\QWidgetDemo\build-imagecropper-desk5_7_0-Profile + I:/github/QWidgetDemo/build-imagecropper-desk5_7_0-Profile + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:I:/github/QWidgetDemo/imagecropper/imagecropper.pro + I:/github/QWidgetDemo/imagecropper/imagecropper.pro + false + true + true + false + true + I:/github/QWidgetDemo/build-imagecropper-desk5_7_0-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/imageviewwindow/imageviewwindow.pro.user b/imageviewwindow/imageviewwindow.pro.user new file mode 100644 index 0000000..e56f299 --- /dev/null +++ b/imageviewwindow/imageviewwindow.pro.user @@ -0,0 +1,304 @@ + + + + + + EnvironmentId + {849db446-6f90-46aa-afcf-9e726de1fb02} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 0 + true + true + true + *.md, *.MD, Makefile + false + true + + + + ProjectExplorer.Project.PluginSettings + + + true + true + true + true + true + + + 0 + true + + + + ProjectExplorer.Project.Target.0 + + Desktop + desk5.7.0 + desk5.7.0 + {30975ac4-3883-489b-ac7a-132064e40ec0} + 0 + 0 + 0 + + 0 + I:\github\QWidgetDemo\build-imageviewwindow-desk5_7_0-Debug + I:/github/QWidgetDemo/build-imageviewwindow-desk5_7_0-Debug + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + 0 + + + I:\github\QWidgetDemo\build-imageviewwindow-desk5_7_0-Release + I:/github/QWidgetDemo/build-imageviewwindow-desk5_7_0-Release + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + I:\github\QWidgetDemo\build-imageviewwindow-desk5_7_0-Profile + I:/github/QWidgetDemo/build-imageviewwindow-desk5_7_0-Profile + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:I:/github/QWidgetDemo/imageviewwindow/imageviewwindow.pro + I:/github/QWidgetDemo/imageviewwindow/imageviewwindow.pro + false + true + true + false + true + I:/github/QWidgetDemo/imageviewwindow/../bin + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/ntpclient/ntpclient.cpp b/ntpclient/ntpclient.cpp index ff35b03..d7fb2fe 100644 --- a/ntpclient/ntpclient.cpp +++ b/ntpclient/ntpclient.cpp @@ -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 diff --git a/slidepuzzlewidget/slidepuzzlewidget.pro.user b/slidepuzzlewidget/slidepuzzlewidget.pro.user new file mode 100644 index 0000000..8577406 --- /dev/null +++ b/slidepuzzlewidget/slidepuzzlewidget.pro.user @@ -0,0 +1,304 @@ + + + + + + EnvironmentId + {849db446-6f90-46aa-afcf-9e726de1fb02} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 0 + true + true + true + *.md, *.MD, Makefile + false + true + + + + ProjectExplorer.Project.PluginSettings + + + true + true + true + true + true + + + 0 + true + + + + ProjectExplorer.Project.Target.0 + + Desktop + desk5.7.0 + desk5.7.0 + {30975ac4-3883-489b-ac7a-132064e40ec0} + 0 + 0 + 0 + + 0 + I:\github\QWidgetDemo\build-slidepuzzlewidget-desk5_7_0-Debug + I:/github/QWidgetDemo/build-slidepuzzlewidget-desk5_7_0-Debug + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + 0 + + + I:\github\QWidgetDemo\build-slidepuzzlewidget-desk5_7_0-Release + I:/github/QWidgetDemo/build-slidepuzzlewidget-desk5_7_0-Release + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + + 0 + I:\github\QWidgetDemo\build-slidepuzzlewidget-desk5_7_0-Profile + I:/github/QWidgetDemo/build-slidepuzzlewidget-desk5_7_0-Profile + + + true + QtProjectManager.QMakeBuildStep + + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + + false + ProjectExplorer.DefaultDeployConfiguration + + 1 + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:I:/github/QWidgetDemo/slidepuzzlewidget/slidepuzzlewidget.pro + I:/github/QWidgetDemo/slidepuzzlewidget/slidepuzzlewidget.pro + false + true + true + false + true + I:/github/QWidgetDemo/slidepuzzlewidget/../bin + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/styledemo/head.h b/styledemo/head.h index 3d68241..a8d5a79 100644 --- a/styledemo/head.h +++ b/styledemo/head.h @@ -1,8 +1,12 @@ #include #include -#include + #if (QT_VERSION >= QT_VERSION_CHECK(5,0,0)) #include #endif +#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) +#include +#endif + #pragma execution_character_set("utf-8") diff --git a/styledemo/styledemo.pro b/styledemo/styledemo.pro index 19c587a..f406a98 100644 --- a/styledemo/styledemo.pro +++ b/styledemo/styledemo.pro @@ -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 diff --git a/videopanel/videopanel.cpp b/videopanel/videopanel.cpp index 935ba96..1beebc4 100644 --- a/videopanel/videopanel.cpp +++ b/videopanel/videopanel.cpp @@ -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; diff --git a/videowidget/videowidget.cpp b/videowidget/videowidget.cpp index dd30206..f895490 100644 --- a/videowidget/videowidget.cpp +++ b/videowidget/videowidget.cpp @@ -100,8 +100,8 @@ void VideoWidget::initFlowPanel() icons << QApplication::style()->standardIcon(QStyle::SP_DialogOkButton); icons << QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton); #else - QList chars; - chars << QChar(0xe68d) << QChar(0xe672) << QChar(0xe674) << QChar(0xea36) << QChar(0xe74c); + QList 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 //将按钮加到布局中