Commit dddbb58f by NitefullWind

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

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