diff --git a/PhaseCompAcq/PhaseWindow.cpp b/PhaseCompAcq/PhaseWindow.cpp index 59174b3..7134951 100644 --- a/PhaseCompAcq/PhaseWindow.cpp +++ b/PhaseCompAcq/PhaseWindow.cpp @@ -22,7 +22,7 @@ this->setWindowFlags(Qt::FramelessWindowHint); // 窗口大小为占满一屏 - QRect screenRect = QApplication::desktop()->availableGeometry(); + QRect screenRect = QApplication::desktop()->screenGeometry(); resize(screenRect.width(), screenRect.height()); setWindowIcon(QIcon(":/images/PhaseComp.png")); setWindowState(Qt::WindowFullScreen); @@ -36,7 +36,7 @@ trayIcon = new QSystemTrayIcon(this); trayIcon->setIcon(QIcon(":/images/PhaseComp.png")); - trayIcon->setToolTip(QString("相位测量数据采集软件(%1)").arg(SettingConfig::getInstance().MASTER == 1 ? "主" : "备")); + trayIcon->setToolTip(SettingConfig::getInstance().CLIENT_TITLE); trayIcon->show(); connect(trayIcon, &QSystemTrayIcon::activated, this, &PhaseWindow::onTrayIconActived); @@ -45,7 +45,7 @@ ui->scrollArea->setGeometry(0, 60, screenRect.width(), screenRect.height() - 60); ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - ui->logo->setText(QString("相位测量数据采集软件——%1").arg(SettingConfig::getInstance().MASTER == 1 ? "主" : "备")); + ui->logo->setText(SettingConfig::getInstance().CLIENT_TITLE); if (SettingConfig::getInstance().NEED_KAFKA == 1) { // kafka consumer diff --git a/PhaseCompAcq/PhaseWindow.cpp b/PhaseCompAcq/PhaseWindow.cpp index 59174b3..7134951 100644 --- a/PhaseCompAcq/PhaseWindow.cpp +++ b/PhaseCompAcq/PhaseWindow.cpp @@ -22,7 +22,7 @@ this->setWindowFlags(Qt::FramelessWindowHint); // 窗口大小为占满一屏 - QRect screenRect = QApplication::desktop()->availableGeometry(); + QRect screenRect = QApplication::desktop()->screenGeometry(); resize(screenRect.width(), screenRect.height()); setWindowIcon(QIcon(":/images/PhaseComp.png")); setWindowState(Qt::WindowFullScreen); @@ -36,7 +36,7 @@ trayIcon = new QSystemTrayIcon(this); trayIcon->setIcon(QIcon(":/images/PhaseComp.png")); - trayIcon->setToolTip(QString("相位测量数据采集软件(%1)").arg(SettingConfig::getInstance().MASTER == 1 ? "主" : "备")); + trayIcon->setToolTip(SettingConfig::getInstance().CLIENT_TITLE); trayIcon->show(); connect(trayIcon, &QSystemTrayIcon::activated, this, &PhaseWindow::onTrayIconActived); @@ -45,7 +45,7 @@ ui->scrollArea->setGeometry(0, 60, screenRect.width(), screenRect.height() - 60); ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - ui->logo->setText(QString("相位测量数据采集软件——%1").arg(SettingConfig::getInstance().MASTER == 1 ? "主" : "备")); + ui->logo->setText(SettingConfig::getInstance().CLIENT_TITLE); if (SettingConfig::getInstance().NEED_KAFKA == 1) { // kafka consumer diff --git a/PhaseCompAcq/common/utils/SettingConfig.cpp b/PhaseCompAcq/common/utils/SettingConfig.cpp index 816fbda..c6bc0d9 100644 --- a/PhaseCompAcq/common/utils/SettingConfig.cpp +++ b/PhaseCompAcq/common/utils/SettingConfig.cpp @@ -1,9 +1,10 @@ -#include "SettingConfig.h" +#include "SettingConfig.h" SettingConfig::SettingConfig() { filename = QApplication::applicationDirPath() + "/conf/config.ini"; setting = new QSettings(this->filename, QSettings::IniFormat); + setting->setIniCodec("UTF-8"); BAUD_RATE = getProperty("com", "baudRate").toInt(); @@ -27,6 +28,7 @@ MASTER_PORT = getProperty("client", "masterPort").toInt(); SERVER_PORT = getProperty("client", "serverPort").toInt(); MAX_DATA_SIZE = getProperty("client", "maxDataSize").toUInt(); + CLIENT_TITLE = getProperty("client", "title").toString(); BASE_URL = getProperty("http", "baseUrl").toString(); diff --git a/PhaseCompAcq/PhaseWindow.cpp b/PhaseCompAcq/PhaseWindow.cpp index 59174b3..7134951 100644 --- a/PhaseCompAcq/PhaseWindow.cpp +++ b/PhaseCompAcq/PhaseWindow.cpp @@ -22,7 +22,7 @@ this->setWindowFlags(Qt::FramelessWindowHint); // 窗口大小为占满一屏 - QRect screenRect = QApplication::desktop()->availableGeometry(); + QRect screenRect = QApplication::desktop()->screenGeometry(); resize(screenRect.width(), screenRect.height()); setWindowIcon(QIcon(":/images/PhaseComp.png")); setWindowState(Qt::WindowFullScreen); @@ -36,7 +36,7 @@ trayIcon = new QSystemTrayIcon(this); trayIcon->setIcon(QIcon(":/images/PhaseComp.png")); - trayIcon->setToolTip(QString("相位测量数据采集软件(%1)").arg(SettingConfig::getInstance().MASTER == 1 ? "主" : "备")); + trayIcon->setToolTip(SettingConfig::getInstance().CLIENT_TITLE); trayIcon->show(); connect(trayIcon, &QSystemTrayIcon::activated, this, &PhaseWindow::onTrayIconActived); @@ -45,7 +45,7 @@ ui->scrollArea->setGeometry(0, 60, screenRect.width(), screenRect.height() - 60); ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); - ui->logo->setText(QString("相位测量数据采集软件——%1").arg(SettingConfig::getInstance().MASTER == 1 ? "主" : "备")); + ui->logo->setText(SettingConfig::getInstance().CLIENT_TITLE); if (SettingConfig::getInstance().NEED_KAFKA == 1) { // kafka consumer diff --git a/PhaseCompAcq/common/utils/SettingConfig.cpp b/PhaseCompAcq/common/utils/SettingConfig.cpp index 816fbda..c6bc0d9 100644 --- a/PhaseCompAcq/common/utils/SettingConfig.cpp +++ b/PhaseCompAcq/common/utils/SettingConfig.cpp @@ -1,9 +1,10 @@ -#include "SettingConfig.h" +#include "SettingConfig.h" SettingConfig::SettingConfig() { filename = QApplication::applicationDirPath() + "/conf/config.ini"; setting = new QSettings(this->filename, QSettings::IniFormat); + setting->setIniCodec("UTF-8"); BAUD_RATE = getProperty("com", "baudRate").toInt(); @@ -27,6 +28,7 @@ MASTER_PORT = getProperty("client", "masterPort").toInt(); SERVER_PORT = getProperty("client", "serverPort").toInt(); MAX_DATA_SIZE = getProperty("client", "maxDataSize").toUInt(); + CLIENT_TITLE = getProperty("client", "title").toString(); BASE_URL = getProperty("http", "baseUrl").toString(); diff --git a/PhaseCompAcq/common/utils/SettingConfig.h b/PhaseCompAcq/common/utils/SettingConfig.h index bba7149..e3651cb 100644 --- a/PhaseCompAcq/common/utils/SettingConfig.h +++ b/PhaseCompAcq/common/utils/SettingConfig.h @@ -1,4 +1,4 @@ -#ifndef SETTINGCONFIG_H +#ifndef SETTINGCONFIG_H #define SETTINGCONFIG_H #include @@ -49,6 +49,7 @@ quint16 MASTER_PORT; quint16 SERVER_PORT; quint32 MAX_DATA_SIZE; + QString CLIENT_TITLE; QString BASE_URL;