Commit dddbb58f by NitefullWind

1. 修复多次交易后CPU占用率高问题。

parent d8c2691d
......@@ -10,8 +10,6 @@
#include <QSettings>
#include <QJsonObject>
#include <QEventLoop>
#include <QFont>
#include <QFontDatabase>
#include <QApplication>
#include <QSqlError>
#include <QSqlQuery>
......@@ -78,14 +76,14 @@ void Control::Start(const char *indata, char *outdata)
bool refundflag = false;
QLOG_INFO() << "get data from pos:" << QString::fromLocal8Bit(indata);
QString appPath;
char pathStr[MAX_PATH] = { 0 };
ToolS::GetProcPath(pathStr);
appPath = QString::fromLocal8Bit(pathStr);
appPath = appPath.replace("\\", "/");
QFontDatabase::addApplicationFont(appPath + "msyh.ttf");
QFont ft("Microsoft YaHei UI Light");
qApp->setFont(ft);
// QString appPath;
// char pathStr[MAX_PATH] = { 0 };
// ToolS::GetProcPath(pathStr);
// appPath = QString::fromLocal8Bit(pathStr);
// appPath = appPath.replace("\\", "/");
// QFontDatabase::addApplicationFont(appPath + "msyh.ttf");
// QFont ft("Microsoft YaHei UI Light");
// qApp->setFont(ft);
QLOG_INFO() << "Openssl support:" << QSslSocket::supportsSsl() << QApplication::libraryPaths();
......
......@@ -48,7 +48,8 @@ QStringList FMPSettings::GetAllKeys(const QString &g)
***************************************************************
*/
FMPSettingsPrivate::FMPSettingsPrivate(QObject *parent)
: QObject(parent)
: QObject(parent),
_sets(nullptr)
{
char path[MAX_PATH] = {0};
ToolS::GetProcPath(path);
......@@ -56,6 +57,13 @@ FMPSettingsPrivate::FMPSettingsPrivate(QObject *parent)
_sets->setIniCodec(QTextCodec::codecForName("GB2312"));
}
FMPSettingsPrivate::~FMPSettingsPrivate()
{
if(_sets!=nullptr) {
delete _sets;
}
}
QVariant FMPSettingsPrivate::GetValue(const QString &k, QVariant default_val)
{
return _sets->value(k, default_val);
......
......@@ -43,6 +43,7 @@ class FMPSettingsPrivate:public QObject
Q_DECLARE_PUBLIC(FMPSettings)
public:
explicit FMPSettingsPrivate(QObject *parent = nullptr);
~FMPSettingsPrivate();
QVariant GetValue(const QString &k, QVariant default_val);
bool SetValue(const QString&k, QVariant v);
......
......@@ -8,6 +8,8 @@
#include <QMessageBox>
#include <QDateTime>
#include <windows.h>
#include <QFont>
#include <QFontDatabase>
#include "control.h"
#include "global.h"
#include "QsLog.h"
......@@ -86,9 +88,13 @@ BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpvReserved*/
QLOG_INFO() << QString("Program run. Version: %1.%2.%3.%4").arg(VER_MAJOR).arg(VER_MINOR).arg(VER_REVISION).arg(VER_BUILD);
ownApplication = QMfcApp::pluginInstance( hInstance );
QFontDatabase::addApplicationFont(path + "msyh.ttf");
QFont ft("Microsoft YaHei UI Light");
qApp->setFont(ft);
}
if ( dwReason == DLL_PROCESS_DETACH && ownApplication )
delete qApp;
delete qApp;
return TRUE;
}
......
......@@ -5,7 +5,7 @@
#define VER_MINOR 2
#define VER_REVISION 7
#define VER_BUILD 1
#define VER_BUILD 2
//! Convert version numbers to string
#define _STR(S) #S
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment