更新代码

This commit is contained in:
feiyangqingyun
2022-05-01 11:39:49 +08:00
parent 7bed44d9c0
commit 08ba30bb87
17 changed files with 869 additions and 87 deletions

View File

@@ -1,9 +1,7 @@
#include "appdata.h"
#include "quihelper.h"
QString AppData::Version = "V20220316";
QString AppData::TitleFlag = "(QQ: 517216493 WX: feiyangqingyun)";
int AppData::RowHeight = 25;
int AppData::RightWidth = 180;
int AppData::FormWidth = 1200;

View File

@@ -6,9 +6,7 @@
class AppData
{
public:
static QString Version; //版本号
static QString TitleFlag; //标题标识
static int RowHeight; //行高
static int RightWidth; //右侧宽度
static int FormWidth; //窗体宽度

View File

@@ -17,6 +17,8 @@ CONFIG += warn_off
CONFIG += resources_big
#开启后会将打印信息用控制台输出
#CONFIG += console
#开启后不会生成空的 debug release 目录
#CONFIG -= debug_and_release
#引入全志H3芯片依赖
include ($$PWD/h3.pri)

View File

@@ -1,5 +1,6 @@
#include "quihelper.h"
#include "qnetworkinterface.h"
#include "qnetworkproxy.h"
#define TIMEMS qPrintable(QTime::currentTime().toString("HH:mm:ss zzz"))
int QUIHelper::getScreenIndex()
@@ -116,11 +117,13 @@ QString QUIHelper::appPath()
static QString path;
if (path.isEmpty()) {
#ifdef Q_OS_ANDROID
//path = QString("/sdcard/Android/%1").arg(appName());
path = QString("/storage/emulated/0/%1").arg(appName());
//默认安卓根目录
path = "/storage/emulated/0";
//带上程序名称作为目录 前面加个0方便排序
path = path + "/0" + appName();
#else
path = qApp->applicationDirPath();
#endif
#endif
}
return path;
@@ -430,6 +433,8 @@ void QUIHelper::initAll(bool utf8, bool style, int fontSize)
QUIHelper::setTranslator(":/qm/widgets.qm");
QUIHelper::setTranslator(":/qm/qt_zh_CN.qm");
QUIHelper::setTranslator(":/qm/designer_zh_CN.qm");
//设置不使用本地系统环境代理配置
QNetworkProxyFactory::setUseSystemConfiguration(false);
}
void QUIHelper::initMain(bool on)
@@ -679,7 +684,7 @@ QString QUIHelper::getXorEncryptDecrypt(const QString &value, char key)
}
int count = result.count();
for (int i = 0; i < count; i++) {
for (int i = 0; i < count; ++i) {
result[i] = QChar(result.at(i).toLatin1() ^ key);
}
return result;
@@ -689,7 +694,7 @@ uchar QUIHelper::getOrCode(const QByteArray &data)
{
int len = data.length();
uchar result = 0;
for (int i = 0; i < len; i++) {
for (int i = 0; i < len; ++i) {
result ^= data.at(i);
}
@@ -700,7 +705,7 @@ uchar QUIHelper::getCheckCode(const QByteArray &data)
{
int len = data.length();
uchar temp = 0;
for (uchar i = 0; i < len; i++) {
for (uchar i = 0; i < len; ++i) {
temp += data.at(i);
}
@@ -758,7 +763,7 @@ void QUIHelper::openFile(const QString &fileName, const QString &msg)
if (!QFile(fileName).exists()) {
return;
}
if (QUIHelper::showMessageBoxQuestion(msg + "成功!确定现在就打开吗?") == QMessageBox::Yes) {
if (QUIHelper::showMessageBoxQuestion(msg + "成功, 确定现在就打开吗?") == QMessageBox::Yes) {
QString url = QString("file:///%1").arg(fileName);
QDesktopServices::openUrl(QUrl(url, QUrl::TolerantMode));
}
@@ -801,3 +806,13 @@ bool QUIHelper::checkIniFile(const QString &iniFile)
return true;
}
QString QUIHelper::cutString(const QString &text, int len, int left, int right, const QString &mid)
{
//如果是文件名则取文件名的前字符+末尾字符+去掉拓展名
QString result = text.split(".").first();
if (result.length() > len) {
result = QString("%1%2%3").arg(result.left(left)).arg(mid).arg(result.right(right));
}
return result;
}

View File

@@ -60,9 +60,9 @@ public:
static void setCode(bool utf8 = true);
//设置翻译文件
static void setTranslator(const QString &qmFile);
//一次性设置所有
static void initAll(bool utf8 = true, bool style = true, int fontSize = 13);
//一次性设置所有包括编码样式字体等
static void initAll(bool utf8 = true, bool style = true, int fontSize = 13);
//初始化main函数最前面执行的一段代码
static void initMain(bool on = true);
@@ -122,6 +122,9 @@ public:
//检查ini配置文件
static bool checkIniFile(const QString &iniFile);
//首尾截断字符串显示
static QString cutString(const QString &text, int len, int left, int right, const QString &mid = "...");
};
#endif // QUIHELPER2_H