[ref]同步711

This commit is contained in:
shi_jq 2025-03-13 15:19:38 +08:00
parent f3d3161b8e
commit 2318011ca8
29 changed files with 467 additions and 297 deletions

View File

@ -7,7 +7,7 @@
#include <QDragEnterEvent> #include <QDragEnterEvent>
#include <QMimeData> #include <QMimeData>
const char* magicString = "KBDCT"; const char* magicString = "EMS60";
const int productInfoLength = 8; const int productInfoLength = 8;
const int productBit = productInfoLength - 1 -1 ; const int productBit = productInfoLength - 1 -1 ;
const int isExclusiveBit = productInfoLength - 1 ; const int isExclusiveBit = productInfoLength - 1 ;
@ -96,7 +96,7 @@ bool MainWindow::appendProductInfo(const QString & fileName)
bool MainWindow::fillProductInfoFlag(char *productFlag, int length) bool MainWindow::fillProductInfoFlag(char *productFlag, int length)
{ {
//拷贝kbdct //拷贝EMS60
memcpy(productFlag,magicString,6); memcpy(productFlag,magicString,6);
if(ui->comboBox_productName->currentText() == "PSCADA") if(ui->comboBox_productName->currentText() == "PSCADA")

View File

@ -2,7 +2,7 @@
CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g') CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
THRESHOLD=90 THRESHOLD=90
if [ "$CURRENT" -gt "$THRESHOLD" ] ; then if [ "$CURRENT" -gt "$THRESHOLD" ] ; then
mail -s 'Linux构建服务器磁盘空间剩余空间小于10%' -r 'Linux构建服务器 <no_reply_phabricator@kbdct.com>' ganyuhang@kbdct.com zhouzhenglong@kbdct.com<< EOF mail -s 'Linux构建服务器磁盘空间剩余空间小于10%' -r 'Linux构建服务器 <user1@test.com>' user2@test.com user3@test.com<< EOF
服务器地址[192.168.79.70]磁盘剩余空间(root分区). 已使用: $CURRENT%,请及时清理/ptsa/iscs路径下过期文件 服务器地址[192.168.79.70]磁盘剩余空间(root分区). 已使用: $CURRENT%,请及时清理/ptsa/iscs路径下过期文件
EOF EOF
fi fi

View File

@ -5,14 +5,14 @@ $drives = @("D");
$minSize = 20GB; $minSize = 20GB;
# SMTP configuration: username, password & so on # SMTP configuration: username, password & so on
$email_username = "no_reply_phabricator@kbdct.com"; $email_username = "user1@test.com";
$email_password = "kbdct@101"; $email_password = "user1@101";
$email_smtp_host = "smtp.qiye.163.com"; $email_smtp_host = "smtp.qiye.163.com";
$email_smtp_port = 25; $email_smtp_port = 25;
$email_smtp_SSL = 0; $email_smtp_SSL = 0;
$email_from_address = "no_reply_phabricator@kbdct.com"; $email_from_address = "user1@test.com";
$email_to_addressArray = @("ganyuhang@kbdct.com", "zhouzhenglong@kbdct.com"); $email_to_addressArray = @("user2@test.com", "user3@test.com");
#$email_to_addressArray = @("ganyuhang@kbdct.com"); #$email_to_addressArray = @("user2@test.com");
if ($drives -eq $null -Or $drives -lt 1) { if ($drives -eq $null -Or $drives -lt 1) {

View File

@ -1,13 +1,16 @@
include(../setup_common.pri) include(../setup_common.pri)
TEMPLATE = aux TEMPLATE = aux
SETUP_UNZIP_DIR = $$system_path($$SETUP_SRC_DIR/iscs6000_unzip) SETUP_UNZIP_DIR = $$system_path($$SETUP_SRC_DIR/ems60_unzip)
SETUP_PDB_UNZIP_DIR = $$system_path($$SETUP_SRC_DIR/../ems60_pdb_unzip)
win32:script_ex = bat win32:script_ex = bat
linux:script_ex = sh linux:script_ex = sh
SCRIPT_FILE = copy_src.$$script_ex SCRIPT_FILE = copy_src.$$script_ex
win32: COPY_SRC_DIR += "if exist $$SETUP_UNZIP_DIR $$RMDIR $$SETUP_UNZIP_DIR " win32: COPY_SRC_DIR += "if exist $$SETUP_UNZIP_DIR $$RMDIR $$SETUP_UNZIP_DIR "
win32: COPY_SRC_DIR += "if exist $$SETUP_PDB_UNZIP_DIR $$RMDIR $$SETUP_PDB_UNZIP_DIR "
win32: COPY_SRC_DIR += "$$QMAKE_MKDIR $$SETUP_PDB_UNZIP_DIR"
linux: COPY_SRC_DIR += "if [ -d $$SETUP_UNZIP_DIR ]; then $$RMDIR $$SETUP_UNZIP_DIR; fi " linux: COPY_SRC_DIR += "if [ -d $$SETUP_UNZIP_DIR ]; then $$RMDIR $$SETUP_UNZIP_DIR; fi "
@ -15,16 +18,22 @@ COPY_SRC_DIR += \
"$$QMAKE_MKDIR $$SETUP_UNZIP_DIR" "$$QMAKE_MKDIR $$SETUP_UNZIP_DIR"
linux: COPY_SRC_DIR += "$$QMAKE_MKDIR $$SETUP_UNZIP_DIR/platform" linux: COPY_SRC_DIR += "$$QMAKE_MKDIR $$SETUP_UNZIP_DIR/platform"
linux: COPY_SRC_DIR += "$$QMAKE_MKDIR $$SETUP_UNZIP_DIR/product" linux: COPY_SRC_DIR += "$$QMAKE_MKDIR $$SETUP_UNZIP_DIR/product"
linux: COPY_SRC_DIR += "$$QMAKE_MKDIR $$SETUP_UNZIP_DIR/products"
win32: COPY_SRC_DIR += "chcp 65001 " win32: COPY_SRC_DIR += "chcp 65001 "
COPY_SRC_DIR += \ COPY_SRC_DIR += \
"$$copyToDestDir($$ISCS6000_HOME/resource/,$$SETUP_UNZIP_DIR/resource) " \
"$$copyToDestDir($$ISCS6000_HOME/product/common/,$$SETUP_UNZIP_DIR/product/common) " \ "$$copyToDestDir($$ISCS6000_HOME/product/common/,$$SETUP_UNZIP_DIR/product/common) " \
"$$copyToDestDir($$ISCS6000_HOME/platform/common/,$$SETUP_UNZIP_DIR/platform/common) " \ "$$copyToDestDir($$ISCS6000_HOME/platform/common/,$$SETUP_UNZIP_DIR/platform/common) " \
"$$copyToDestDir($$ISCS6000_HOME/product/$$PLATFORM_DIR_NAME/,$$SETUP_UNZIP_DIR/product/$$PLATFORM_DIR_NAME) " \ "$$copyToDestDir($$ISCS6000_HOME/product/$$PLATFORM_DIR_NAME/,$$SETUP_UNZIP_DIR/product/$$PLATFORM_DIR_NAME) " \
"$$copyToDestDir($$ISCS6000_HOME/platform/$$PLATFORM_DIR_NAME/,$$SETUP_UNZIP_DIR/platform/$$PLATFORM_DIR_NAME) " \ "$$copyToDestDir($$ISCS6000_HOME/platform/$$PLATFORM_DIR_NAME/,$$SETUP_UNZIP_DIR/platform/$$PLATFORM_DIR_NAME) " \
"$$copyToDestDir($$ISCS6000_HOME/products/,$$SETUP_UNZIP_DIR/products) " \ "$$copyToDestDir($$ISCS6000_HOME/products/EMS/,$$SETUP_UNZIP_DIR/products/EMS) " \
"$$copyToDestDir($$ISCS6000_SUPPORT_DIR/,$$SETUP_UNZIP_DIR/support) " \ "$$copyToDestDir($$ISCS6000_SUPPORT_DIR/,$$SETUP_UNZIP_DIR/support) " \
"$$copyToDestDir($$ISCS6000_HOME/web/$$ISCS6000_OS/,$$SETUP_UNZIP_DIR/web) " \ "$$copyToDestDir($$ISCS6000_HOME/setup_web/$$ISCS6000_OS/,$$SETUP_UNZIP_DIR/web) "
"$$copyToDestDir($$ISCS6000_DOC_DIR/,$$SETUP_UNZIP_DIR/doc)" "$$copyToDestDir($$ISCS6000_DOC_DIR/,$$SETUP_UNZIP_DIR/doc)"
win32: COPY_SRC_DIR += \
"$$copyPDBToDestDir($$ISCS6000_HOME/platform/$$PLATFORM_DIR_NAME,$$SETUP_PDB_UNZIP_DIR/platform/$$PLATFORM_DIR_NAME) " \
"$$copyPDBToDestDir($$ISCS6000_HOME/product/$$PLATFORM_DIR_NAME,$$SETUP_PDB_UNZIP_DIR/product/$$PLATFORM_DIR_NAME) "
win32: COPY_SRC_DIR += "IF %ERRORLEVEL% LEQ 1 exit /b 0 " win32: COPY_SRC_DIR += "IF %ERRORLEVEL% LEQ 1 exit /b 0 "
write_file($$OUT_PWD/$$SCRIPT_FILE,COPY_SRC_DIR) write_file($$OUT_PWD/$$SCRIPT_FILE,COPY_SRC_DIR)
linux { linux {

View File

@ -1,11 +1,10 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
#include <QDirIterator> #include <QDirIterator>
#include <QTextCodec> #include <QTextCodec>
#include <iostream> #include <iostream>
#include "setup/CommonDef.h"
#define EMPTY_DIR_FILENAME ".kbdct_installer"
bool createEmptyDirMsk(const QString &src_path) bool createEmptyDirMsk(const QString &src_path)
{ {
@ -24,7 +23,7 @@ bool createEmptyDirMsk(const QString &src_path)
// 为空 // 为空
if(QDir(it.filePath()).isEmpty()) if(QDir(it.filePath()).isEmpty())
{ {
QFile file(it.filePath() + QDir::separator() + EMPTY_DIR_FILENAME ); QFile file(it.filePath() + QDir::separator() + g_pszEmptyDirFileName );
file.open(QIODevice::WriteOnly); // Or QIODevice::ReadWrite file.open(QIODevice::WriteOnly); // Or QIODevice::ReadWrite
} }
} }

View File

@ -9,7 +9,8 @@ SUBDIRS += \
qrcGen \ qrcGen \
setupConfigSet \ setupConfigSet \
readVersion \ readVersion \
mkenv mkenv \
setup_installer
ISCS6000_PATCH=$$(ISCS6000_PATCH) ISCS6000_PATCH=$$(ISCS6000_PATCH)

View File

@ -77,8 +77,7 @@ bool parseCommandline(QCoreApplication& app)
// qDebug() << parser.value(jobid); // qDebug() << parser.value(jobid);
qDebug() << parser.value(configPath); qDebug() << parser.value(configPath);
//setConfig(parser.value(configPath),parser.value(revision)); setConfig(parser.value(configPath),parser.value(revision));
return true; return true;
} }

View File

@ -7,14 +7,16 @@ ISCS6000_DOC_DIR = $$(ISCS6000_DOC_DIR)
ISCS6000_SUPPORT_DIR = $$(ISCS6000_SUPPORT_DIR) ISCS6000_SUPPORT_DIR = $$(ISCS6000_SUPPORT_DIR)
win32:QMAKE_STATIC_BIN = $$(QMAKE_STATIC_BIN) win32:QMAKE_STATIC_BIN = $$(QMAKE_STATIC_BIN)
win32:JOM_BIN = $$(JOM_BIN) win32:JOM_BIN = $$(JOM_BIN)
CUSTOM_SVN_VERSION = "20240510" #注释掉此变量则会使用SVN版本号
################################################ ################################################
#=========================================================================================================================== #===========================================================================================================================
isEmpty(SETUP_DEBUG_RELEASE):SETUP_DEBUG_RELEASE = debug # 默认debug isEmpty(SETUP_DEBUG_RELEASE):SETUP_DEBUG_RELEASE = release # 默认debug
isEmpty(ISCS6000_DOC_DIR):ISCS6000_DOC_DIR = $$clean_path($$SRC_ROOT_PATH/../../../ISCS6000文档/08用户文档) #文档目录,默认按照SVN路径来构建可以手动指定目录 #isEmpty(ISCS6000_DOC_DIR):ISCS6000_DOC_DIR = $$clean_path($$SRC_ROOT_PATH/../../../ISCS6000文档/08用户文档) #文档目录,默认按照SVN路径来构建可以手动指定目录
isEmpty(ISCS6000_SUPPORT_DIR):ISCS6000_SUPPORT_DIR = $$clean_path($$SRC_ROOT_PATH/../../support) #support目录默认SVN路径下可以手动指定目录 isEmpty(ISCS6000_DOC_DIR):ISCS6000_DOC_DIR = $$clean_path($$SRC_ROOT_PATH/../../setup_doc) #文档目录,默认按照SVN路径来构建可以手动指定目录
win32:isEmpty(QMAKE_STATIC_BIN):QMAKE_STATIC_BIN = $$clean_path(D:/qtstatic/bin/qmake.exe) #static qmake路径 isEmpty(ISCS6000_SUPPORT_DIR):ISCS6000_SUPPORT_DIR = $$clean_path($$SRC_ROOT_PATH/../../setup_support) #support目录默认SVN路径下可以手动指定目录
win32:isEmpty(JOM_BIN):JOM_BIN = $$clean_path(C:/Qt/Qt5.9.2/Tools/QtCreator/bin/jom.exe) win32:isEmpty(QMAKE_STATIC_BIN):QMAKE_STATIC_BIN = $$clean_path(G:/dev_tools/qt592static/bin/qmake.exe) #static qmake路径
win32:isEmpty(JOM_BIN):JOM_BIN = $$clean_path(D:/dev_tool/Qt592/Tools/QtCreator/bin/jom.exe)
#============================================================================================================================ #============================================================================================================================
################################################################ ################################################################
@ -41,11 +43,15 @@ win32:{
CONFIG(debug): error("please use release build configuration") #判定当前的编译配置为release版本 CONFIG(debug): error("please use release build configuration") #判定当前的编译配置为release版本
} }
DISTSUBNAME = _$${SETUP_DEBUG_RELEASE}_setup DISTSUBNAME = _$${SETUP_DEBUG_RELEASE}_setup
SVNN = $$system("svn info --no-newline --show-item last-changed-revision ../../") SVNN = $$system("svnversion -n ..")
#SVNN = $$replace(SVNN,"M","") SVNN = $$replace(SVNN,"M","")
#SVNN = $$replace(SVNN,"S","") SVNN = $$replace(SVNN,"S","")
#SVNN = $$replace(SVNN,"P","") SVNN = $$replace(SVNN,"P","")
#SVNN = $$section(SVNN, :, 0, 0) SVNN = $$section(SVNN, :, 0, 0)
!isEmpty(CUSTOM_SVN_VERSION):SVNN = $$CUSTOM_SVN_VERSION
message("VERSION:" $$SVNN)
isEmpty(SVNN): error("svn revision number is empty!") isEmpty(SVNN): error("svn revision number is empty!")
isEmpty(SRC_ROOT_PATH):error("SRC_ROOT_PATH not found") isEmpty(SRC_ROOT_PATH):error("SRC_ROOT_PATH not found")
isEmpty(ISCS6000_OS):error("ISCS6000_OS not found") isEmpty(ISCS6000_OS):error("ISCS6000_OS not found")
@ -57,6 +63,7 @@ SETUP_PATCH_DIR = $$system_path($$SETUP_DEST_DIR/patch)
win32:{ win32:{
RMDIR = $$QMAKE_DEL_DIR /s /q RMDIR = $$QMAKE_DEL_DIR /s /q
COPYFLAG = /E /NP /NS /NC /NFL /NDL /UNICODE /MT /XD .svn /XF *.exp *.lib *.pdb *.ilk COPYFLAG = /E /NP /NS /NC /NFL /NDL /UNICODE /MT /XD .svn /XF *.exp *.lib *.pdb *.ilk
PDB_COPYFLAG = /NP /NS /NC /NFL /NDL /UNICODE /MT *.pdb
COPYFILE = robocopy COPYFILE = robocopy
} }
@ -82,5 +89,12 @@ defineReplace(copyToDestDir) {
linux: return( $$COPYFILE $$COPYFLAG $$1 $$2 ) linux: return( $$COPYFILE $$COPYFLAG $$1 $$2 )
} }
defineReplace(copyPDBToDestDir) {
src = $$1
dst = $$2
win32: return( $$COPYFILE $$system_path($$1) $$system_path($$2) $$PDB_COPYFLAG )
}
ISCS6000_HOME = $$clean_path($$SRC_ROOT_PATH/../../) ISCS6000_HOME = $$clean_path($$SRC_ROOT_PATH/../../)

View File

@ -3,9 +3,7 @@
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#include <setupCommon.h> #include <setupCommon.h>
#include "setup/CommonDef.h"
#define EMPTY_DIR_FILENAME ".kbdct_installer"
CInstallWorker::CInstallWorker(QObject *parent) : QObject(parent) CInstallWorker::CInstallWorker(QObject *parent) : QObject(parent)
{ {
@ -40,7 +38,7 @@ bool CInstallWorker::cpyDir(const QString &srcPath, const QString &dstPath, bool
QString dstFilePath; QString dstFilePath;
foreach (QString fileName, origDir.entryList(QDir::Files)) foreach (QString fileName, origDir.entryList(QDir::Files))
{ {
if(fileName.compare(EMPTY_DIR_FILENAME) == 0) // 空目录占位符文件不复制 if(fileName.compare(g_pszEmptyDirFileName) == 0) // 空目录占位符文件不复制
continue; continue;
srcFilePath = srcPath + QDir::separator() + fileName; srcFilePath = srcPath + QDir::separator() + fileName;
@ -65,8 +63,7 @@ bool CInstallWorker::cpyDir(const QString &srcPath, const QString &dstPath, bool
#endif #endif
if(!result) if(!result)
{ {
emit error( tr("拷贝") + "[" + dstFilePath + "]" emit error( tr("拷贝") + "[" + dstFilePath + "]" + tr("失败"));
+ tr("失败") );
} }
} }
@ -127,15 +124,16 @@ void CInstallWorker::doCopy(const QString &mainProgramPath,const QString &produc
emit error(tr("创建新目录过程错误")); emit error(tr("创建新目录过程错误"));
} }
QString srcDir(":iscs6000_unzip"); QString srcDir = QString(":%1").arg(g_pszSetupUnzipDir);
QString dstDir(mainProgramPath); QString dstDir(mainProgramPath);
QStringList srcDirs; QStringList srcDirs;
srcDirs << QStringLiteral("product") srcDirs << QStringLiteral("product")
<< QStringLiteral("platform") << QStringLiteral("platform")
<< "support"; << QStringLiteral("resource")
<< QStringLiteral("support");
if(isWeb) if(isWeb)
{ {
srcDirs << "web"; srcDirs << QStringLiteral("web");
} }
if(!cpyDir(srcDir,srcDirs,dstDir,true)) if(!cpyDir(srcDir,srcDirs,dstDir,true))

View File

@ -56,5 +56,5 @@ bool setSysctl();
#endif #endif
} //< iot_sys } //< namespace iot_sys

View File

@ -15,6 +15,7 @@
#include "setupCommon.h" #include "setupCommon.h"
#include <QStandardPaths> #include <QStandardPaths>
#include <QProcess> #include <QProcess>
#include "setup/CommonDef.h"
namespace iot_sys namespace iot_sys
{ {
@ -38,13 +39,6 @@ QString getDesktopPath()
} }
} }
static const char *pszSystemdCfgFile = "/usr/lib/systemd/system/iscs6000_launcher.service";
//< 前面需加上用户HOME目录路径
static const char *pszXdgCfgDir = "/.config/autostart/";
static const char *pszXdgCfgFile = "iscs6000_hmi_explorer.desktop";
static const char *pszDesktopEntryDirName = "iscs6000";
static const char *pszAppDir = "/usr/share/applications";
const QString desktopDir = getDesktopPath(); const QString desktopDir = getDesktopPath();
@ -52,7 +46,7 @@ const QString desktopDir = getDesktopPath();
bool regSysService(QString &strErr,QString path) bool regSysService(QString &strErr,QString path)
{ {
//< 判断服务是否已注册,普通用户权限可执行 //< 判断服务是否已注册,普通用户权限可执行
if (0 == QProcess::execute("systemctl is-enabled iscs6000_launcher.service")) if (0 == QProcess::execute(QString("systemctl is-enabled %1.service").arg(g_pszLauncherServiceName) ) )
{ {
strErr = QObject::tr("已设置服务自启动,若需重新设置,请先取消!"); strErr = QObject::tr("已设置服务自启动,若需重新设置,请先取消!");
return false; return false;
@ -83,13 +77,13 @@ bool regSysService(QString &strErr,QString path)
//< 生成或修改systemd服务配置文件 //< 生成或修改systemd服务配置文件
{ {
QSettings objIniSetting(pszSystemdCfgFile, QSettings::IniFormat); QSettings objIniSetting(g_pszLauncherServiceFile, QSettings::IniFormat);
objIniSetting.setIniCodec( QTextCodec::codecForLocale() ); objIniSetting.setIniCodec( QTextCodec::codecForLocale() );
if (!objIniSetting.isWritable()) if (!objIniSetting.isWritable())
{ {
strErr = QObject::tr("服务配置文件不可写,请确认是否具有权限!") strErr = QObject::tr("服务配置文件不可写,请确认是否具有权限!")
+ "\n" + pszSystemdCfgFile; + "\n" + g_pszLauncherServiceFile;
return false; return false;
} }
@ -98,7 +92,7 @@ bool regSysService(QString &strErr,QString path)
objIniSetting.clear(); objIniSetting.clear();
objIniSetting.beginGroup("Unit"); objIniSetting.beginGroup("Unit");
objIniSetting.setValue("Description", "iscs6000_launcher"); objIniSetting.setValue("Description", g_pszLauncherServiceName);
objIniSetting.setValue("After", "network.target"); objIniSetting.setValue("After", "network.target");
objIniSetting.endGroup(); objIniSetting.endGroup();
@ -123,7 +117,7 @@ bool regSysService(QString &strErr,QString path)
if (QSettings::NoError != objIniSetting.status()) if (QSettings::NoError != objIniSetting.status())
{ {
strErr = QObject::tr("写入服务配置文件失败!") strErr = QObject::tr("写入服务配置文件失败!")
+ "\n" + pszSystemdCfgFile; + "\n" + g_pszLauncherServiceFile;
return false; return false;
} }
} }
@ -136,7 +130,7 @@ bool regSysService(QString &strErr,QString path)
} }
//< 设置服务开机自启动 //< 设置服务开机自启动
if (0 != QProcess::execute("systemctl enable iscs6000_launcher.service")) if (0 != QProcess::execute(QString("systemctl enable %1.service").arg(g_pszLauncherServiceName) ))
{ {
strErr = QObject::tr("设置服务开机自启动失败!"); strErr = QObject::tr("设置服务开机自启动失败!");
return false; return false;
@ -163,9 +157,9 @@ bool setHmiAutoStart(QString &strErr,QString path)
{ {
strCfgFileDir = QString("/home/%1").arg(sudo_user); strCfgFileDir = QString("/home/%1").arg(sudo_user);
} }
strCfgFileDir += pszXdgCfgDir; strCfgFileDir += g_pszXdgAutoStartCfgDir;
const QString strCfgFileFullPath = strCfgFileDir + pszXdgCfgFile; const QString strCfgFileFullPath = strCfgFileDir + g_pszHMIXdgDesktopCfgFile;
if (QFile::exists(strCfgFileFullPath)) if (QFile::exists(strCfgFileFullPath))
{ {
@ -224,7 +218,7 @@ bool setHmiAutoStart(QString &strErr,QString path)
{ {
QTextStream objStreamOut(&objFile); QTextStream objStreamOut(&objFile);
objStreamOut << "[Desktop Entry]" << endl; objStreamOut << "[Desktop Entry]" << endl;
objStreamOut << "Name=iscs6000_hmi_explorer" << endl; objStreamOut << "Name=" << g_pszHMIXdgDesktopName << endl;
objStreamOut << "Exec=" << strExec << endl; objStreamOut << "Exec=" << strExec << endl;
objStreamOut << "Type=Application" << endl; objStreamOut << "Type=Application" << endl;
objStreamOut << "X-GNOME-AutoRestart=false" << endl; objStreamOut << "X-GNOME-AutoRestart=false" << endl;
@ -247,12 +241,20 @@ public:
QString comment; QString comment;
QString exec; QString exec;
QString icon; QString icon;
CDesktopEntry(const QString destopName_,const QString name_, const QString comment_, const QString exec_, const QString icon_=""):
// 用于窗体识别,解决某些桌面组件无法识别窗体而导致的问题
// 比如dash-to-dock上收藏的图标与运行的图标分离正常应该是一个图标
// 参见https://github.com/micheleg/dash-to-dock/issues/215
QString startupWMClass;
CDesktopEntry(const QString destopName_,const QString name_, const QString comment_, const QString exec_,
const QString icon_="", const QString startupWMClass_=""):
desktopName(destopName_), desktopName(destopName_),
name(name_), name(name_),
comment(comment_), comment(comment_),
exec(exec_), exec(exec_),
icon(icon_) icon(icon_),
startupWMClass(startupWMClass_)
{ {
} }
@ -277,10 +279,12 @@ bool createDesktopEntry(const QString &entrypath, const CDesktopEntry &entry, QS
QTextStream objStreamOut(&objFile); QTextStream objStreamOut(&objFile);
objStreamOut << "[Desktop Entry]" << endl; objStreamOut << "[Desktop Entry]" << endl;
objStreamOut << "Name=" << entry.name << endl; objStreamOut << "Name=" << entry.name << endl;
objStreamOut << "Exec=sh -c \"export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Qt5.9.9/5.9.9/gcc_64/lib;" << entry.exec << "\"" <<endl; objStreamOut << "Exec=" << entry.exec <<endl;
objStreamOut << "Comment=" << entry.comment << endl; objStreamOut << "Comment=" << entry.comment << endl;
if(entry.icon != "") if(!entry.icon.isEmpty())
objStreamOut << "Icon=" << entry.icon << endl; objStreamOut << "Icon=" << entry.icon << endl;
if(!entry.startupWMClass.isEmpty())
objStreamOut << "StartupWMClass=" << entry.startupWMClass << endl;
objStreamOut << "Type=Application" << endl; objStreamOut << "Type=Application" << endl;
objStreamOut << "Categories=GNOME;Application;Other;Settings" << endl; objStreamOut << "Categories=GNOME;Application;Other;Settings" << endl;
} }
@ -310,17 +314,17 @@ bool creatShortcut(QString &strErr,QString path)
const QString execPlatDir = path + "/platform/" + g_platform_dir_name; const QString execPlatDir = path + "/platform/" + g_platform_dir_name;
const QString iconDir = path + "/product/common/resource/zh/setup/icons"; const QString iconDir = path + "/resource/zh/setup/icons";
QDir appDir(pszAppDir); QDir appDir(g_pszAppDir);
appDir.mkdir(pszDesktopEntryDirName); appDir.mkdir(g_pszDesktopEntryDirName);
QString appDestPath = appDir.absoluteFilePath(pszDesktopEntryDirName); QString appDestPath = appDir.absoluteFilePath(g_pszDesktopEntryDirName);
if(!QDir(appDestPath).exists()) if(!QDir(appDestPath).exists())
{ {
strErr = appDestPath + QObject::tr("不存在或无法创建"); strErr = appDestPath + QObject::tr("不存在或无法创建");
return false; return false;
} }
createDesktopEntry(desktopDir,CDesktopEntry("sys_startup",QObject::tr("实时监控"),"iscs6000 system management",execProdDir+"/sys_startup",iconDir + "/sys_startup.ico"),strErr,false); createDesktopEntry(desktopDir,CDesktopEntry("sys_startup",QObject::tr("实时监控"),"system management",execProdDir+"/sys_startup",iconDir + "/sys_startup.ico", "sys_startup"),strErr,false);
return true; return true;
@ -334,10 +338,10 @@ bool createStartProgram(QString &strErr,const QString& path)
const QString execPlatDir = path + "/platform/" + g_platform_dir_name; const QString execPlatDir = path + "/platform/" + g_platform_dir_name;
const QString iconDir = path + "/product/common/resource/zh/setup/icons"; const QString iconDir = path + "/resource/zh/setup/icons";
QDir appDir(pszAppDir); QDir appDir(g_pszAppDir);
appDir.mkdir(pszDesktopEntryDirName); appDir.mkdir(g_pszDesktopEntryDirName);
QString appDestPath = appDir.absoluteFilePath(pszDesktopEntryDirName); QString appDestPath = appDir.absoluteFilePath(g_pszDesktopEntryDirName);
if(!QDir(appDestPath).exists()) if(!QDir(appDestPath).exists())
{ {
strErr = appDestPath + QObject::tr("不存在或无法创建"); strErr = appDestPath + QObject::tr("不存在或无法创建");
@ -345,16 +349,16 @@ bool createStartProgram(QString &strErr,const QString& path)
} }
createDesktopEntry(appDestPath,CDesktopEntry("sys_dog_auth_check", QObject::tr("超级狗检查"), "check system dog authentication",execProdDir+"/sys_dog_auth_check"),strErr); createDesktopEntry(appDestPath,CDesktopEntry("sys_dog_auth_check", QObject::tr("超级狗检查"), "check system dog authentication",execProdDir+"/sys_dog_auth_check"),strErr);
createDesktopEntry(appDestPath,CDesktopEntry("FesSim", QObject::tr("前置调试"),"iscs6000 fes debug tool",execProdDir+"/FesSim",iconDir + "/fes_sim.ico"),strErr); createDesktopEntry(appDestPath,CDesktopEntry("FesSim", QObject::tr("前置调试"),"fes debug tool",execProdDir+"/FesSim",iconDir + "/fes_sim.ico"),strErr);
createDesktopEntry(appDestPath,CDesktopEntry("debug_tool", QObject::tr("工程调试工具"),"iscs6000 debug tool",execProdDir+"/debug_tool",iconDir + "/debug_tool.ico"),strErr); createDesktopEntry(appDestPath,CDesktopEntry("debug_tool", QObject::tr("工程调试工具"),"debug tool",execProdDir+"/debug_tool",iconDir + "/debug_tool.ico"),strErr);
createDesktopEntry(appDestPath,CDesktopEntry("sys_command",QObject::tr("命令窗口"),"iscs6000 bin exec environment",execProdDir+"/sys_command.sh"),strErr); createDesktopEntry(appDestPath,CDesktopEntry("sys_command",QObject::tr("命令窗口"),"bin exec environment",execProdDir+"/sys_command.sh"),strErr);
createDesktopEntry(appDestPath,CDesktopEntry("model_system_config",QObject::tr("系统建模"),"iscs6000 system model configuration",execPlatDir+"/model_system_config",iconDir + "/systemConfig.ico"),strErr); createDesktopEntry(appDestPath,CDesktopEntry("model_system_config",QObject::tr("系统建模"),"system model configuration",execPlatDir+"/model_system_config",iconDir + "/systemConfig.ico"),strErr);
createDesktopEntry(appDestPath,CDesktopEntry("model_studio",QObject::tr("设备建模"),"iscs6000 model studio",execPlatDir+"/model_studio",iconDir + "/studio.ico"),strErr); createDesktopEntry(appDestPath,CDesktopEntry("model_studio",QObject::tr("设备建模"),"model studio",execPlatDir+"/model_studio",iconDir + "/studio.ico"),strErr);
createDesktopEntry(appDestPath,CDesktopEntry("hmi",QObject::tr("画面组态"),"iscs6000 human machine interface app",execPlatDir+"/hmi",iconDir + "/fes_sim.ico"),strErr); createDesktopEntry(appDestPath,CDesktopEntry("hmi",QObject::tr("画面组态"),"human machine interface app",execPlatDir+"/hmi",iconDir + "/fes_sim.ico"),strErr);
createDesktopEntry(appDestPath,CDesktopEntry("fbd_editor",QObject::tr("逻辑编程"),"iscs6000 fbd editor",execPlatDir+"/fbd_designer",iconDir + "/fbd_editor.ico"),strErr); createDesktopEntry(appDestPath,CDesktopEntry("fbd_editor",QObject::tr("逻辑编程"),"fbd editor",execPlatDir+"/fbd_designer",iconDir + "/fbd_editor.ico"),strErr);
createDesktopEntry(appDestPath,CDesktopEntry("db_manager",QObject::tr("工程管理"),"iscs6000 database management",execPlatDir+"/db_manager",iconDir + "/db_manager.ico"),strErr); createDesktopEntry(appDestPath,CDesktopEntry("db_manager",QObject::tr("工程管理"),"database management",execPlatDir+"/db_manager",iconDir + "/db_manager.ico"),strErr);
createDesktopEntry(appDestPath,CDesktopEntry("sys_startup",QObject::tr("实时监控"),"iscs6000 system management",execProdDir+"/sys_startup",iconDir + "/sys_startup.ico"),strErr); createDesktopEntry(appDestPath,CDesktopEntry("sys_startup",QObject::tr("实时监控"),"system management",execProdDir+"/sys_startup",iconDir + "/sys_startup.ico","sys_startup"),strErr);
createDesktopEntry(appDestPath,CDesktopEntry("hmi_explorer",QObject::tr("人机界面"),"open iscs66000 hmi",execPlatDir+"/hmi_explorer.sh"),strErr); createDesktopEntry(appDestPath,CDesktopEntry("hmi_explorer",QObject::tr("人机界面"),"open hmi",execPlatDir+"/hmi_explorer.sh"),strErr);
return true; return true;
} }
@ -368,7 +372,7 @@ bool setSysctl()
} }
} //< iot_sys } //< namespace iot_sys
#endif //< #ifdef OS_LINUX #endif //< #ifdef OS_LINUX

View File

@ -17,21 +17,18 @@
#include "SetupFunc.h" #include "SetupFunc.h"
#include "setupCommon.h" #include "setupCommon.h"
#include "setup/CommonDef.h"
namespace iot_sys namespace iot_sys
{ {
const static char* g_platform_dir_name = PLATFORM_DIR;
static const TCHAR *pszServiceName = _T("iscs6000_launcher");
static const char *pszAutoRunRegPath = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
static const char *pszUninstallRegPath = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\ISCS6000";
//< 注册系统服务,并设置自启动 //< 注册系统服务,并设置自启动
bool regSysService(QString &strErr,QString path) bool regSysService(QString &strErr,QString path)
{ {
bool bRet = false; bool bRet = false;
const QString strExec = QDir::toNativeSeparators const QString strExec = QDir::toNativeSeparators
(path + "/platform/windows10_debug" + "/sys_launcher_srv.exe"); (path + QString("/platform/%1/sys_launcher_srv.exe").arg(PLATFORM_DIR));
qDebug() << strExec; qDebug() << strExec;
//< 判断文件存在 //< 判断文件存在
@ -50,7 +47,7 @@ bool regSysService(QString &strErr,QString path)
else else
{ {
//< 判断服务是否已存在 //< 判断服务是否已存在
SC_HANDLE hService = ::OpenService(hSCM, pszServiceName, SERVICE_QUERY_CONFIG); SC_HANDLE hService = ::OpenService(hSCM, g_pTCharLauncherServiceName, SERVICE_QUERY_CONFIG);
if (NULL == hService) if (NULL == hService)
{ {
//< 创建服务 //< 创建服务
@ -63,7 +60,7 @@ bool regSysService(QString &strErr,QString path)
//< 2、多用户登录时会启动多个实例而实际上由于端口占用等原因是起不来的 //< 2、多用户登录时会启动多个实例而实际上由于端口占用等原因是起不来的
//< 3、本程序停止服务时存在困难见下面unregSysService()中的注释。 //< 3、本程序停止服务时存在困难见下面unregSysService()中的注释。
hService = ::CreateService( hService = ::CreateService(
hSCM, pszServiceName, pszServiceName, hSCM, g_pTCharLauncherServiceName, g_pTCharLauncherServiceName,
SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL,
strExec.toStdWString().c_str(), NULL, NULL, NULL, NULL, NULL); strExec.toStdWString().c_str(), NULL, NULL, NULL, NULL, NULL);
@ -75,7 +72,7 @@ bool regSysService(QString &strErr,QString path)
else else
{ {
SERVICE_DESCRIPTION stSrvDesc; SERVICE_DESCRIPTION stSrvDesc;
TCHAR szDesc[] = _T("宏茂技术监控系统加载服务"); TCHAR szDesc[] = _T("监控系统加载服务");
stSrvDesc.lpDescription = szDesc; stSrvDesc.lpDescription = szDesc;
if (::ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &stSrvDesc)) if (::ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &stSrvDesc))
{ {
@ -112,9 +109,9 @@ bool setHmiAutoStart(QString &strErr,QString path)
return false; return false;
} }
QSettings objRegSetting(pszAutoRunRegPath, QSettings::NativeFormat); QSettings objRegSetting(g_pszAutoRunRegPath, QSettings::NativeFormat);
if (objRegSetting.contains("iscs6000_hmi_explorer")) if (objRegSetting.contains(g_pszAutoRunHMI))
{ {
strErr = QObject::tr("已设置HMI自启动若需重新设置请先取消"); strErr = QObject::tr("已设置HMI自启动若需重新设置请先取消");
return false; return false;
@ -127,7 +124,7 @@ bool setHmiAutoStart(QString &strErr,QString path)
return false; return false;
} }
objRegSetting.setValue("iscs6000_hmi_explorer", QString("\"") + strExec + QString("\"")); objRegSetting.setValue(g_pszAutoRunHMI, QString("\"") + strExec + QString("\""));
if (QSettings::NoError != objRegSetting.status()) if (QSettings::NoError != objRegSetting.status())
{ {
@ -172,10 +169,10 @@ bool setSysStartupAutoStartByVbs(QString &strErr,QString path)
{ {
QString vbsTxt; QString vbsTxt;
vbsTxt += "Set WshShell = CreateObject(\"WScript.Shell\" )\n"; vbsTxt += "Set WshShell = CreateObject(\"WScript.Shell\" )\n";
vbsTxt += QString("WshShell.Run \"") + "\"\"" + QDir::toNativeSeparators(path + "\\product\\windows10_debug" + "\\sys_startup.exe\"\" -hide") + "\"\n"; vbsTxt += QString("WshShell.Run \"") + "\"\"" + QDir::toNativeSeparators(path + "\\product\\" + QString(g_platform_dir_name) + "\\sys_startup.exe\"\" -hide") + "\"\n";
vbsTxt += "Set WshShell = Nothing"; vbsTxt += "Set WshShell = Nothing";
QFile vbsFile( QDir::toNativeSeparators(QString("C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp") + "\\sys_startup.vbs" ) ); QFile vbsFile( QDir::toNativeSeparators(QString(g_pszAutoStartSysStartupPath) ) );
if(!vbsFile.open(QFile::WriteOnly | QFile::Truncate)) if(!vbsFile.open(QFile::WriteOnly | QFile::Truncate))
{ {
strErr = QObject::tr("启动文件无法写入"); strErr = QObject::tr("启动文件无法写入");
@ -218,7 +215,7 @@ bool createStartProgram(QString &strErr,const QString& path)
//<开始菜单 //<开始菜单
QDir dir; QDir dir;
QString startMenuPath=QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)+"/PowerSCADA3000W"; QString startMenuPath=QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)+"/EMS60";
dir.mkpath(startMenuPath); dir.mkpath(startMenuPath);
QString startMenuNormalPath = startMenuPath + "/常用工具"; QString startMenuNormalPath = startMenuPath + "/常用工具";
dir.mkpath(startMenuNormalPath); dir.mkpath(startMenuNormalPath);
@ -242,7 +239,7 @@ bool createStartProgram(QString &strErr,const QString& path)
app.link(prodPath + "/sys_startup.exe", startMenuSystemPath+"/实时监控.lnk"); app.link(prodPath + "/sys_startup.exe", startMenuSystemPath+"/实时监控.lnk");
app.link(platPath + "/hmi_explorer.bat", startMenuSystemPath+"/人机界面.lnk"); app.link(platPath + "/hmi_explorer.bat", startMenuSystemPath+"/人机界面.lnk");
app.link(prodPath + "/uninstall.exe", startMenuPath+"/系统卸载.lnk"); app.link(prodPath + "/" + QString(UNINSTALL_EXEC_NAME), startMenuPath+"/系统卸载.lnk");
//>开始菜单 //>开始菜单
return true; return true;
@ -300,7 +297,7 @@ bool regMysqlService(QString &path,QString &strErr)
else else
{ {
//< 判断服务是否已存在 //< 判断服务是否已存在
SC_HANDLE hService = ::OpenService(hSCM, pszServiceName, SERVICE_QUERY_CONFIG); SC_HANDLE hService = ::OpenService(hSCM, g_pTCharLauncherServiceName, SERVICE_QUERY_CONFIG);
if (NULL == hService) if (NULL == hService)
{ {
//< 创建服务 //< 创建服务
@ -313,7 +310,7 @@ bool regMysqlService(QString &path,QString &strErr)
//< 2、多用户登录时会启动多个实例而实际上由于端口占用等原因是起不来的 //< 2、多用户登录时会启动多个实例而实际上由于端口占用等原因是起不来的
//< 3、本程序停止服务时存在困难见下面unregSysService()中的注释。 //< 3、本程序停止服务时存在困难见下面unregSysService()中的注释。
hService = ::CreateService( hService = ::CreateService(
hSCM, pszServiceName, pszServiceName, hSCM, g_pTCharLauncherServiceName, g_pTCharLauncherServiceName,
SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS, SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, SERVICE_AUTO_START, SERVICE_ERROR_NORMAL,
strExec.toStdWString().c_str(), NULL, NULL, NULL, NULL, NULL); strExec.toStdWString().c_str(), NULL, NULL, NULL, NULL, NULL);
@ -349,7 +346,7 @@ bool regMysqlService(QString &path,QString &strErr)
bool regUninstallReg(const QString &iconPath,const QString &version,const QString &uninstallerPath,QString &strErr) bool regUninstallReg(const QString &iconPath,const QString &version,const QString &uninstallerPath,QString &strErr)
{ {
QSettings objRegSetting(pszUninstallRegPath, QSettings::NativeFormat); QSettings objRegSetting(g_pszRegUninstallRegPath, QSettings::NativeFormat);
if(!objRegSetting.isWritable()) if(!objRegSetting.isWritable())
{ {
@ -358,15 +355,15 @@ bool regUninstallReg(const QString &iconPath,const QString &version,const QStrin
} }
objRegSetting.setValue("DisplayIcon",iconPath); // 需要自定义 objRegSetting.setValue("DisplayIcon",iconPath); // 需要自定义
objRegSetting.setValue("DisplayName","PowerSCADA3000W"); objRegSetting.setValue("DisplayName","DiCS-EMS60");
objRegSetting.setValue("DisplayVersion",version); // 需要拼接 objRegSetting.setValue("DisplayVersion",version); // 需要拼接
objRegSetting.setValue("Publisher","SHENZHEN KANGBIDA CONTROL TECHNOLOGY CO.LTD"); objRegSetting.setValue("Publisher","BYD CO.LTD");
objRegSetting.setValue("UninstallString",uninstallerPath); //需要拼接 objRegSetting.setValue("UninstallString",uninstallerPath); //需要拼接
return true; return true;
} }
} //< iot_sys } //< namespace iot_sys

View File

@ -59,15 +59,15 @@ bool SetupWidget::isOpenGauss()
bool SetupWidget::isKingBase() bool SetupWidget::isKingBase()
{ {
if( isKylin()) if (ui->comboBox_dbtype->currentText() == "KingBase")
{ {
if (ui->comboBox_dbtype->currentText() == "KingBase") return true;
return true;
} }
return false; return false;
} }
const char* magicString = "KBDCT"; const char* magicString = "EMS60";
const int productInfoLength = 8; const int productInfoLength = 8;
const int productBit = productInfoLength - 1 -1 ; const int productBit = productInfoLength - 1 -1 ;
const int isExclusiveBit = productInfoLength - 1 ; const int isExclusiveBit = productInfoLength - 1 ;
@ -175,10 +175,6 @@ bool SetupWidget::SaveSetupXml(const QString &fileName)
{ {
return false; return false;
} }
if(isKylin())
{
m_nProductId = m_nProductId + 100 ;
}
QDomNode module=root.firstChild(); QDomNode module=root.firstChild();
QDomElement element=module.toElement(); QDomElement element=module.toElement();
if(!element.isNull()) if(!element.isNull())
@ -283,7 +279,7 @@ bool SetupWidget::CopyFileToPath(QString sourcePath, QString dstPath, bool overr
bool SetupWidget::getPreSetConfig() bool SetupWidget::getPreSetConfig()
{ {
QFile file(":/iscs6000_unzip/product/common/sysconfig/setup_config.xml"); QFile file(QString(":/%1/product/common/sysconfig/setup_config.xml").arg(g_pszSetupUnzipDir));
if(!file.open(QFile::ReadOnly)) if(!file.open(QFile::ReadOnly))
{ {
file.close(); file.close();
@ -560,9 +556,9 @@ void SetupWidget::on_NextButton1_clicked()
#endif #endif
#ifdef OS_LINUX #ifdef OS_LINUX
if((isMainProgram&&isDatabase&&isWeb)==false) if((isMainProgram||isDatabase||isWeb)==false)
{ {
MessageDlg dlg(this,false,tr("当前版本必须选择全部组件")); MessageDlg dlg(this,false,tr("安装组件不能为空"));
dlg.exec(); dlg.exec();
return; return;
} }
@ -751,23 +747,7 @@ void SetupWidget::initConnect()
void SetupWidget::initUi() void SetupWidget::initUi()
{ {
ui->stackedWidget->setCurrentIndex(0); ui->stackedWidget->setCurrentIndex(0);
initDatabaseParam();
if( !isKylin()) {
ui->label_35->setHidden(true);
ui->comboBox_dbtype->setHidden(true);
}
else
{
ui->comboBox_dbtype->setCurrentText("MySQL");
}
#ifdef OS_LINUX
if( isMySQL())
ui->LineEdit_port->setText("3306");
if( isOpenGauss() )
ui->LineEdit_port->setText("5432");
if( isKingBase() )
ui->LineEdit_port->setText("54321");
#endif
#ifdef OS_WINDOWS #ifdef OS_WINDOWS
this->setWindowFlag(Qt::FramelessWindowHint); this->setWindowFlag(Qt::FramelessWindowHint);
@ -788,6 +768,9 @@ void SetupWidget::initUi()
msgColor = QColor(1, 194, 231); msgColor = QColor(1, 194, 231);
errColor = QColor(255, 255, 255); errColor = QColor(255, 255, 255);
ui->DecompressButton2->hide(); //默认禁用掉解压2按钮
m_bOnlyDecompress = false;
} }
void SetupWidget::on_PushButton_1_clicked() void SetupWidget::on_PushButton_1_clicked()
@ -829,6 +812,11 @@ void SetupWidget::on_checkBox_3_stateChanged(int arg1)
void SetupWidget::startInstall() void SetupWidget::startInstall()
{ {
if(m_bOnlyDecompress)
{
slotInstallHelperFinishedHandler(0,QProcess::NormalExit);
return;
}
QString config_path = SYS_CONFIG_PATH; QString config_path = SYS_CONFIG_PATH;
QDir dir(config_path); QDir dir(config_path);
@ -907,28 +895,27 @@ bool SetupWidget::fillHelperArgs(QStringList &arguments)
arguments << "en"; arguments << "en";
} }
//--port 3306 --username root --password kbdct --dbname iscs6000 //--port 3306 --username root --password emspasswd --dbname ems
arguments << "--ip" << ui->LineEdit_ip->text(); arguments << "--ip" << ui->LineEdit_ip->text();
arguments << "--port" << ui->LineEdit_port->text(); arguments << "--port" << ui->LineEdit_port->text();
arguments << "--dbname" << ui->LineEdit_dbname->text(); arguments << "--dbname" << ui->LineEdit_dbname->text();
arguments << "--username" << ui->LineEdit_db_user_name->text();
//TODO 数据库脚本修改支持修改用户名和密码 //TODO 数据库脚本修改支持修改用户名和密码
if( isMySQL()){ if( isMySQL()){
arguments << "--username" << "root";
arguments << "--dbtype" << DB_MYSQL; arguments << "--dbtype" << DB_MYSQL;
} }
if(isOpenGauss()) if(isOpenGauss())
{ {
arguments << "--username" << "iscs";
arguments << "--dbtype" << DB_OPENGAUSS; arguments << "--dbtype" << DB_OPENGAUSS;
} }
if( isKingBase()){ if( isKingBase()){
arguments << "--username" << "system";
arguments << "--dbtype" << DB_KINGBASE; arguments << "--dbtype" << DB_KINGBASE;
} }
arguments << "--password" << PASSWORD_DEFINE; /* 为以后搜索方便,保留此注释
* arguments << "--password" << EMS_DEFAULT_PASSWD;
*/
arguments << "--password" << ui->LineEdit_db_user_password->text();
return true; return true;
} }
@ -939,7 +926,7 @@ void SetupWidget::initLangUi()
tr("软件版本") tr("软件版本")
+ " ["+software_version+"]\n" + " ["+software_version+"]\n"
+ tr("版权所有") + tr("版权所有")
+ "\nShenZhen,Chinese\nKBD Control TechnoLogy Co.Ltd."; + "\nShenZhen,Chinese\nBYD Co.Ltd.";
ui->label_version->setText(str); ui->label_version->setText(str);
ui->ComboBox_components->clear(); ui->ComboBox_components->clear();
@ -983,6 +970,27 @@ void SetupWidget::showInstallFailUi()
ui->label_ico->setStyleSheet("border-image:url(:/res/安装_失败.png);"); ui->label_ico->setStyleSheet("border-image:url(:/res/安装_失败.png);");
} }
void SetupWidget::initDatabaseParam()
{
ui->LineEdit_dbname->setText(EMS_DEFAULT_DATABASE);
ui->LineEdit_db_user_password->setText(EMS_DEFAULT_PASSWD);
if( isMySQL())
{
ui->LineEdit_db_user_name->setText("root");
ui->LineEdit_port->setText("3306");
}
if( isOpenGauss() )
{
ui->LineEdit_db_user_name->setText("ems60");
ui->LineEdit_port->setText("5432");
}
if( isKingBase() )
{
ui->LineEdit_db_user_name->setText("system");
ui->LineEdit_port->setText("54321");
}
}
void SetupWidget::loadComBoboxItems() void SetupWidget::loadComBoboxItems()
{ {
loadProductItems(); loadProductItems();
@ -1061,7 +1069,7 @@ void SetupWidget::loadProductItems()
ui->comboBox_product->clear(); ui->comboBox_product->clear();
//< "product" //< "product"
QDir dir(":/iscs6000_unzip/products"); QDir dir(QString(":/%1/products").arg(g_pszSetupUnzipDir));
if(dir.exists()) if(dir.exists())
{ {
QFileInfoList list=dir.entryInfoList(); QFileInfoList list=dir.entryInfoList();
@ -1075,7 +1083,7 @@ void SetupWidget::loadProductItems()
} }
} }
ui->comboBox_product->setCurrentText(getProductChineseName("PSCADA")); ui->comboBox_product->setCurrentText(getProductChineseName("EMS"));
ProductInfo info; ProductInfo info;
if(!getIscs6000ProductInfo(QCoreApplication::applicationFilePath(),info)) if(!getIscs6000ProductInfo(QCoreApplication::applicationFilePath(),info))
@ -1113,46 +1121,46 @@ bool SetupWidget::setProductInstallPath(QString &sProductName)
if(sProductName == "PSCADA") if(sProductName == "PSCADA")
{ {
#ifdef OS_WINDOWS #ifdef OS_WINDOWS
MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "PowerSCADA3000W" ; MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_PSCADA ;
DatabasePath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "PowerSCADA3000W" + QDir::separator() + "database" ; DatabasePath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_PSCADA + QDir::separator() + "database" ;
#else #else
MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "PowerSCADA3000L"; MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_PSCADA;
#endif #endif
} }
else if(sProductName == "ISCS") else if(sProductName == "ISCS")
{ {
#ifdef OS_WINDOWS #ifdef OS_WINDOWS
MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "ISCS6000" ; MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_ISCS ;
DatabasePath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "ISCS6000" + QDir::separator() + "database" ; DatabasePath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_ISCS + QDir::separator() + "database" ;
#else #else
MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "ISCS6000"; MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_ISCS;
#endif #endif
} }
else if(sProductName == "PSMS") else if(sProductName == "PSMS")
{ {
#ifdef OS_WINDOWS #ifdef OS_WINDOWS
MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "PSMS3000"; MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_PSMS;
DatabasePath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "PSMS3000" + QDir::separator() + "database" ; DatabasePath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_PSMS + QDir::separator() + "database" ;
#else #else
MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "PSMS3000"; MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_PSMS;
#endif #endif
} }
else if(sProductName == "EMS") else if(sProductName == "EMS")
{ {
#ifdef OS_WINDOWS #ifdef OS_WINDOWS
MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "WiseEnergy"; MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_EMS;
DatabasePath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "WiseEnergy" + QDir::separator() + "database" ; DatabasePath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_EMS + QDir::separator() + "database" ;
#else #else
MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "WiseEnergy"; MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_EMS;
#endif #endif
} }
else else
{ {
#ifdef OS_WINDOWS #ifdef OS_WINDOWS
MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "ISCS6000_HOME"; MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_EMS;
DatabasePath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "ISCS6000_HOME" + QDir::separator() + "database" ; DatabasePath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_EMS + QDir::separator() + "database" ;
#else #else
MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + "ISCS6000_HOME"; MainProgramPath = QStringLiteral(INSTALL_FREFIX) + QDir::separator() + g_pszInstallDir_EMS;
#endif #endif
} }
return true; return true;
@ -1160,7 +1168,7 @@ bool SetupWidget::setProductInstallPath(QString &sProductName)
void SetupWidget::loadProjectItems() void SetupWidget::loadProjectItems()
{ {
//< "product" //< "product"
QDir dir(":/iscs6000_unzip/products/" + ui->comboBox_product->currentData().toString()); QDir dir(QString(":/%1/products/").arg(g_pszSetupUnzipDir) + ui->comboBox_product->currentData().toString());
ui->comboBox_project->clear(); ui->comboBox_project->clear();
if(dir.exists()) if(dir.exists())
{ {
@ -1188,9 +1196,9 @@ void SetupWidget::loadProjectItems()
void SetupWidget::regDbConfig() void SetupWidget::regDbConfig()
{ {
/* 为以后搜索方便,保留此注释 EMS_DEFAULT_DATABASE
QSettings settings; QSettings settings;
settings.setValue("login/psw","kbdct@0755"); settings.setValue("login/psw",EMS_DEFAULT_PASSWD);
if( isMySQL() ) if( isMySQL() )
{ {
@ -1214,7 +1222,30 @@ void SetupWidget::regDbConfig()
} }
settings.setValue("login/ip","127.0.0.1"); settings.setValue("login/ip","127.0.0.1");
settings.setValue("login/dbname","iscs6000"); settings.setValue("login/dbname",EMS_DEFAULT_DATABASE);
*/
QSettings settings;
settings.setValue("login/psw",ui->LineEdit_db_user_password->text());
settings.setValue("login/user",ui->LineEdit_db_user_name->text());
settings.setValue("login/port",ui->LineEdit_port->text().toInt());
if( isMySQL() )
{
settings.setValue("login/dbtype",0);
}
if( isOpenGauss() )
{
settings.setValue("login/dbtype",1);
}
if( isKingBase() )
{
settings.setValue("login/dbtype",3);
}
settings.setValue("login/ip",ui->LineEdit_ip->text());
settings.setValue("login/dbname",ui->LineEdit_dbname->text());
} }
void SetupWidget::addMsg(const QString &msg) void SetupWidget::addMsg(const QString &msg)
@ -1247,6 +1278,12 @@ void SetupWidget::on_btn_install_continue_clicked()
void SetupWidget::on_FinishButton_clicked() void SetupWidget::on_FinishButton_clicked()
{ {
if(m_bOnlyDecompress)
{
qApp->quit();
return;
}
QString strErr; QString strErr;
QString destPath = MainProgramPath; QString destPath = MainProgramPath;
#ifdef OS_WINDOWS #ifdef OS_WINDOWS
@ -1307,6 +1344,41 @@ void SetupWidget::on_FinishButton_clicked()
qApp->quit(); qApp->quit();
} }
void SetupWidget::on_DecompressButton_clicked()
{
ui->stackedWidget->setCurrentIndex(2);
ui->BackButton2->hide(); //禁用上一步
ui->NextButton2->hide(); //禁用下一步
ui->DecompressButton2->show(); //启用解压按钮
ui->checkBox51->hide(); //最后完成界面的显示值
ui->checkBox52->hide(); //最后完成界面的显示值
ui->checkBox53->hide(); //最后完成界面的显示值
isMainProgram = true;
isDatabase = true;
isWeb = true;
m_bOnlyDecompress = true;
}
void SetupWidget::on_DecompressButton2_clicked()
{
MainProgramPath = ui->LineEdit1->text();
QDir installDir(MainProgramPath);
if(installDir.exists())
{
MessageDlg dlg(this,false,tr("主程序路径不能为空"));
dlg.exec();
return;
}
ui->stackedWidget->setCurrentIndex(4);
ui->btn_install_continue->setDisabled(true);
//< 发送开始拷贝信号
emit startCopy(MainProgramPath,ui->comboBox_product->currentData().toString(),ui->comboBox_project->currentText(),isWeb);
addMsg(tr("正在拷贝文件..."));
}
void SetupWidget::slotInstallHelperHandler() void SetupWidget::slotInstallHelperHandler()
{ {
while(m_installHelperProcess.canReadLine()) while(m_installHelperProcess.canReadLine())
@ -1427,11 +1499,5 @@ QLocale::Language SetupWidget::getCurrentLan()
void SetupWidget::on_comboBox_dbtype_currentTextChanged(const QString &/*arg1*/) void SetupWidget::on_comboBox_dbtype_currentTextChanged(const QString &/*arg1*/)
{ {
if(!isKylin()) initDatabaseParam();
return;
if( isMySQL())
ui->LineEdit_port->setText("3306");
if( isKingBase() )
ui->LineEdit_port->setText("54321");
} }

View File

@ -11,11 +11,11 @@
#include <QProcess> #include <QProcess>
#include <QThread> #include <QThread>
#define PRODUCT_ID_PLAT 40 #define PRODUCT_ID_PLAT 10
#define PRODUCT_ID_ISCS 41 #define PRODUCT_ID_EMS 60
#define PRODUCT_ID_PSCADA 42 #define PRODUCT_ID_PSCADA 20
#define PRODUCT_ID_EMS 43 #define PRODUCT_ID_PSMS 30
#define PRODUCT_ID_PSMS 44 #define PRODUCT_ID_ISCS 40
class ProductInfo class ProductInfo
{ {
@ -69,6 +69,8 @@ private slots:
void on_NextButton3_clicked(); // 开始安装的前一步 void on_NextButton3_clicked(); // 开始安装的前一步
void on_btn_install_continue_clicked(); //安装完成后的继续按钮 void on_btn_install_continue_clicked(); //安装完成后的继续按钮
void on_FinishButton_clicked();//结束按钮 void on_FinishButton_clicked();//结束按钮
void on_DecompressButton_clicked(); //仅解压
void on_DecompressButton2_clicked(); //解压
void on_UninstallButton_clicked(); // 卸载按钮 void on_UninstallButton_clicked(); // 卸载按钮
void startInstall(); // 开始安装 void startInstall(); // 开始安装
@ -92,6 +94,7 @@ private slots:
void initLangUi(); // 初始化ui同时在语言切换时加载 void initLangUi(); // 初始化ui同时在语言切换时加载
void initInstallWorker(); //初始化安装线程,主要负责拷贝文件 void initInstallWorker(); //初始化安装线程,主要负责拷贝文件
void showInstallFailUi(); // 展示安装失败的界面 void showInstallFailUi(); // 展示安装失败的界面
void initDatabaseParam(); //填充数据库界面中默认参数
void loadComBoboxItems(); void loadComBoboxItems();
@ -175,7 +178,7 @@ private:
QFile *m_logFile; // 日志文件 QFile *m_logFile; // 日志文件
QTextStream *m_logStream; // 日志流 QTextStream *m_logStream; // 日志流
bool m_bOnlyDecompress; //是否仅解压,默认否
}; };
#endif // SETUPWIDGET_H #endif // SETUPWIDGET_H

View File

@ -199,6 +199,13 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item>
<widget class="QPushButton" name="DecompressButton">
<property name="text">
<string>仅解压</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="InstallButton"> <widget class="QPushButton" name="InstallButton">
<property name="sizePolicy"> <property name="sizePolicy">
@ -621,6 +628,13 @@ p, li { white-space: pre-wrap; }
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QPushButton" name="DecompressButton2">
<property name="text">
<string>解压</string>
</property>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_13"> <layout class="QHBoxLayout" name="horizontalLayout_13">
<item> <item>
@ -737,7 +751,7 @@ p, li { white-space: pre-wrap; }
<string>127.0.0.1</string> <string>127.0.0.1</string>
</property> </property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -754,10 +768,10 @@ p, li { white-space: pre-wrap; }
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="LineEdit_dbname"> <widget class="QLineEdit" name="LineEdit_dbname">
<property name="text"> <property name="text">
<string>iscs6000</string> <string>ems60</string>
</property> </property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -777,7 +791,38 @@ p, li { white-space: pre-wrap; }
<string>3306</string> <string>3306</string>
</property> </property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_db_user_name">
<property name="text">
<string>数据库用户名</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="LineEdit_db_user_name">
<property name="text">
<string>system</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="LineEdit_db_user_password">
<property name="text">
<string>ems@byd23</string>
</property>
<property name="echoMode">
<enum>QLineEdit::Normal</enum>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_db_user_password">
<property name="text">
<string>数据库密码</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -1163,7 +1208,4 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>
<buttongroups>
<buttongroup name="buttonGroup"/>
</buttongroups>
</ui> </ui>

View File

@ -111,7 +111,7 @@ bool iot_public::CSingleProcInstance::hasInstanceRunning(const string& strUnique
{ {
std::transform(strName.begin(), strName.end(), strName.begin(), ::tolower); std::transform(strName.begin(), strName.end(), strName.begin(), ::tolower);
} }
strName = "__kbdct_" + strName; strName = "__iot_" + strName;
if (!g_objGlobalMutex_.create(strName.c_str())) if (!g_objGlobalMutex_.create(strName.c_str()))
{ {
//_assert(false); //_assert(false);
@ -143,7 +143,7 @@ bool iot_public::CSingleProcInstance::hasInstanceRunning(const string& strUnique
{ {
std::transform(strName.begin(), strName.end(), strName.begin(), ::tolower); std::transform(strName.begin(), strName.end(), strName.begin(), ::tolower);
} }
strName = TMPDIR"/__kbdct_" + strName; strName = TMPDIR"/__iot_" + strName;
int fdLockFile; int fdLockFile;
struct flock fl; struct flock fl;
/* 打开锁文件 */ /* 打开锁文件 */

View File

@ -1,4 +1,4 @@
/*第一页*/ /*第一页*/
#Widget1, #Widget1,
#WidgetInstall1, #WidgetInstall1,
#WidgetInstall2, #WidgetInstall2,
@ -21,6 +21,8 @@ color: rgba(255,255,255,1);
font: 10pt "黑体"; font: 10pt "黑体";
} }
#DecompressButton,
#DecompressButton2,
#CancelButton, #CancelButton,
#InstallButton, #InstallButton,
#UninstallButton, #UninstallButton,
@ -223,7 +225,9 @@ QRadioButton
#label_32, #label_32,
#label_33, #label_33,
#label_34, #label_34,
#label_35 #label_35,
#label_db_user_name,
#label_db_user_password
{ {
color: rgba(0,222,255,1); color: rgba(0,222,255,1);
font-family:"黑体"; font-family:"黑体";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

After

Width:  |  Height:  |  Size: 394 KiB

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#define INSTALLER_UNIQUE_NAME "iscs6000_installer" #include "setup/CommonDef.h"
const static int pos_min_x=10; const static int pos_min_x=10;
const static int pos_max_x=560; const static int pos_max_x=560;
@ -10,23 +10,6 @@ const static int pos_max_y=400;
const static char* g_platform_dir_name = PLATFORM_DIR; const static char* g_platform_dir_name = PLATFORM_DIR;
const static char* g_iscs6000_os = ISCS6000_OS; const static char* g_iscs6000_os = ISCS6000_OS;
#ifdef OS_WINDOWS
#define SYS_CONFIG_PATH "C:/Program Files/PowerSCADA3000"
#define UNINSTALL_EXEC_NAME "uninstall.exe"
#define INSTALL_HELPER_EXEC_NAME "setup_install_helper.exe"
#define INSTALL_FREFIX "D:"
#endif
#ifdef OS_LINUX
#define SYS_CONFIG_PATH "/etc/powerscada3000"
#define UNINSTALL_EXEC_NAME "uninstall"
#define INSTALL_HELPER_EXEC_NAME "setup_install_helper"
#define INSTALL_FREFIX "/opt"
#endif
#define PASSWORD_DEFINE "kbdct@0755"
#define DB_MYSQL "mysql" #define DB_MYSQL "mysql"
#define DB_OPENGAUSS "opengauss" #define DB_OPENGAUSS "opengauss"
#define DB_KINGBASE "kingbase" #define DB_KINGBASE "kingbase"

View File

@ -10,7 +10,7 @@ TEMPLATE = app
include(../setup_common.pri) include(../setup_common.pri)
DEST_CONFIG = $$SETUP_DEBUG_RELEASE DEST_CONFIG = $$SETUP_DEBUG_RELEASE
TARGET = iscs6000_installer TARGET = DiCS-EMS60-installer
QMAKE_PROJECT_DEPTH = 0 QMAKE_PROJECT_DEPTH = 0
ISCS6000_REC_SRC = $$system_path($$SETUP_SRC_DIR/$$SETUP_SRC_QRC_NAME) ISCS6000_REC_SRC = $$system_path($$SETUP_SRC_DIR/$$SETUP_SRC_QRC_NAME)
!isEmpty(ISCS6000_REC_SRC):exists($$ISCS6000_REC_SRC): RESOURCES *= $$ISCS6000_REC_SRC !isEmpty(ISCS6000_REC_SRC):exists($$ISCS6000_REC_SRC): RESOURCES *= $$ISCS6000_REC_SRC

View File

@ -4,7 +4,7 @@
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
#define EMPTY_DIR_FILENAME ".kbdct_installer" #define EMPTY_DIR_FILENAME ".ems_installer"
CPatchWoker::CPatchWoker(QObject *parent) : QObject(parent) CPatchWoker::CPatchWoker(QObject *parent) : QObject(parent)
{ {

View File

@ -2,6 +2,7 @@
#include <QDir> #include <QDir>
#include <QSettings> #include <QSettings>
#include <QThread> #include <QThread>
#include "setup/CommonDef.h"
#ifdef OS_WINDOWS #ifdef OS_WINDOWS
#include "windows.h" #include "windows.h"
@ -9,33 +10,24 @@
#pragma comment(lib,"user32.lib") #pragma comment(lib,"user32.lib")
#endif #endif
#ifdef OS_WINDOWS
#define SYS_CONFIG_PATH "C:/Program Files/PowerSCADA3000"
#endif
#ifdef OS_LINUX
#define SYS_CONFIG_PATH "/etc/powerscada3000"
#endif
static const char *pszAUninstallRegPath = "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\";
CUninstallWorker::CUninstallWorker(QObject *parent) : QObject(parent) CUninstallWorker::CUninstallWorker(QObject *parent) : QObject(parent)
{ {
} }
void CUninstallWorker::doWork(const QString &manProgramPath, const QString &dbPath, bool isHisdataDel, bool isBackupDel) void CUninstallWorker::doWork(const QString &manProgramPath, const QString &dbPath,
const QString &dbName,const QString &dbUserName,const QString &dbUserPassword,
bool isHisdataDel, bool isBackupDel)
{ {
closeService(manProgramPath,dbPath); closeService(manProgramPath,dbPath);
delFiles(manProgramPath, dbPath,isHisdataDel, isBackupDel); delFiles(manProgramPath, dbPath,dbName,dbUserName,dbUserPassword,isHisdataDel, isBackupDel);
removeConfig(); removeConfig();
emit resultReady(); emit resultReady();
} }
void CUninstallWorker::closeService(const QString &manProgramPath,const QString &dbPath) void CUninstallWorker::closeService(const QString &manProgramPath,const QString &dbPath)
{ {
Q_UNUSED(manProgramPath);
status(tr("正在关闭服务...")); status(tr("正在关闭服务..."));
//TODO 后期变更为程序获取执行结果 //TODO 后期变更为程序获取执行结果
#ifdef OS_WINDOWS #ifdef OS_WINDOWS
@ -53,10 +45,11 @@ void CUninstallWorker::closeService(const QString &manProgramPath,const QString
system_hidden("taskkill /F /IM mysqld.exe"); system_hidden("taskkill /F /IM mysqld.exe");
system_hidden("sc stop Redis"); //< 暂时不使用Redis和nginx
system_hidden("sc delete Redis"); // system_hidden("sc stop Redis");
// system_hidden("sc delete Redis");
system_hidden("taskkill /F /IM nginx.exe"); // system_hidden("taskkill /F /IM nginx.exe");
#endif #endif
//TODO linux下暂时不停止任何应用 //TODO linux下暂时不停止任何应用
@ -74,14 +67,20 @@ void CUninstallWorker::closeService(const QString &manProgramPath,const QString
} }
void CUninstallWorker::delFiles(const QString &manProgramPath, const QString &dbPath, bool isHisdataDel, bool isBackupDel) void CUninstallWorker::delFiles(const QString &manProgramPath, const QString &dbPath,
const QString &dbName,const QString &dbUserName,const QString &dbUserPassword,
bool isHisdataDel, bool isBackupDel)
{ {
Q_UNUSED(dbName);
Q_UNUSED(dbUserName);
Q_UNUSED(dbUserPassword);
//< 获取路径 //< 获取路径
QDir mainDir(manProgramPath); QDir mainDir(manProgramPath);
//< 删除主程序其他路径程序 //< 删除主程序其他路径程序
QStringList dirNeedDel; QStringList dirNeedDel;
dirNeedDel << "data" << "doc" << "support" << "products" << "web" << "coreDump" << "miniDump" <<"log" << "doc" << "platform"; dirNeedDel << "resource" << "data" << "doc" << "support" << "products" << "web" << "coreDump" << "miniDump" <<"log" << "doc" << "platform";
//< 删除工程备份数据 //< 删除工程备份数据
if(isBackupDel) if(isBackupDel)
@ -95,7 +94,8 @@ void CUninstallWorker::delFiles(const QString &manProgramPath, const QString &db
dirNeedDel << "hisdata"; dirNeedDel << "hisdata";
// Linux 删除历史数据 // Linux 删除历史数据
#ifdef OS_LINUX #ifdef OS_LINUX
system("influx -execute 'drop database iscs6000'"); QString cmd = QString("influx -username %1 -password %2 -execute 'drop database %3'").arg(dbUserName).arg(dbUserPassword).arg(dbName);
system(cmd.toStdString().c_str());
#endif #endif
} }
@ -118,8 +118,9 @@ void CUninstallWorker::delFiles(const QString &manProgramPath, const QString &db
} }
} }
#ifdef OS_WINDOWS
// 从程序列表删除ISCS6000 // 从程序列表删除ISCS6000
QSettings objRegSetting(pszAUninstallRegPath, QSettings::NativeFormat); QSettings objRegSetting(g_pszAUninstallRegPath, QSettings::NativeFormat);
if(!objRegSetting.isWritable()) if(!objRegSetting.isWritable())
{ {
error(tr("无法写入注册表")); error(tr("无法写入注册表"));
@ -127,9 +128,9 @@ void CUninstallWorker::delFiles(const QString &manProgramPath, const QString &db
} }
else else
{ {
objRegSetting.remove("ISCS6000"); objRegSetting.remove(g_pszRegItem);
} }
#endif
//TODO 删除product //TODO 删除product
if(!emptyDir(mainDir.absoluteFilePath("product"))) if(!emptyDir(mainDir.absoluteFilePath("product")))

View File

@ -10,7 +10,9 @@ public:
explicit CUninstallWorker(QObject *parent = nullptr); explicit CUninstallWorker(QObject *parent = nullptr);
public slots: public slots:
void doWork(const QString & manProgramPath, const QString &dbPath,bool isHisdataDel, bool isBackupDel); void doWork(const QString & manProgramPath, const QString &dbPath,
const QString &dbName,const QString &dbUserName,const QString &dbUserPassword,
bool isHisdataDel, bool isBackupDel);
signals: signals:
void resultReady(); void resultReady();
@ -19,7 +21,9 @@ signals:
private: private:
void closeService(const QString &manProgramPath, const QString &dbPath); void closeService(const QString &manProgramPath, const QString &dbPath);
void delFiles(const QString & manProgramPath, const QString &dbPath,bool isHisdataDel, bool isBackupDel); void delFiles(const QString & manProgramPath, const QString &dbPath,
const QString &dbName,const QString &dbUserName,const QString &dbUserPassword,
bool isHisdataDel, bool isBackupDel);
void removeConfig(); void removeConfig();
bool emptyDir(const QString &path); bool emptyDir(const QString &path);

View File

@ -44,5 +44,5 @@ bool removeShortcut(QString &strErr);
//< 删除文件夹 //< 删除文件夹
bool DelDir(QString &path); bool DelDir(QString &path);
} //< iot_sys } //< namespace iot_sys

View File

@ -11,8 +11,8 @@
#ifdef OS_LINUX #ifdef OS_LINUX
#include <QtCore> #include <QtCore>
#include "SetupFunc.h" #include "SetupFunc.h"
#include "setup/CommonDef.h"
namespace iot_sys namespace iot_sys
{ {
@ -37,23 +37,14 @@ QString getDesktopPath()
} }
} }
static const char *pszSystemdCfgFile = "/usr/lib/systemd/system/iscs6000_launcher.service";
//< 前面需加上用户HOME目录路径
static const char *pszXdgCfgDir = "/.config/autostart/";
static const char *pszXdgCfgFile = "iscs6000_hmi_explorer.desktop";
static const char *pszDesktopEntryDirName = "iscs6000";
static const char *pszAppDir = "/usr/share/applications";
const QString desktopDir = getDesktopPath(); const QString desktopDir = getDesktopPath();
//< 注销系统服务 //< 注销系统服务
bool unregSysService(QString &strErr) bool unregSysService(QString &strErr)
{ {
//< 该路径普通用户可访问 //< 该路径普通用户可访问
if (!QFile::exists(pszSystemdCfgFile)) if (!QFile::exists(g_pszLauncherServiceFile))
{ {
//< 重新加载一次确保systemd配置与文件一致需需管理员权限 //< 重新加载一次确保systemd配置与文件一致需需管理员权限
//QProcess::execute("systemctl daemon-reload"); //QProcess::execute("systemctl daemon-reload");
@ -63,16 +54,16 @@ bool unregSysService(QString &strErr)
} }
//< 停止服务 //< 停止服务
QProcess::execute("systemctl stop iscs6000_launcher.service"); QProcess::execute(QString("systemctl stop %1.service").arg(g_pszLauncherServiceName) );
//< 取消服务开机自启动 //< 取消服务开机自启动
QProcess::execute("systemctl disable iscs6000_launcher.service"); QProcess::execute(QString("systemctl disable %1.service").arg(g_pszLauncherServiceName) );
//< 删除服务配置文件 //< 删除服务配置文件
if (!QFile::remove(pszSystemdCfgFile)) if (!QFile::remove(g_pszLauncherServiceFile))
{ {
strErr = QObject::tr("删除服务配置文件失败,请确认是否具有权限!") strErr = QObject::tr("删除服务配置文件失败,请确认是否具有权限!")
+ "\n" + pszSystemdCfgFile; + "\n" + g_pszLauncherServiceFile;
return false; return false;
} }
@ -102,9 +93,9 @@ bool unsetHmiAutoStart(QString &strErr)
{ {
strCfgFileDir = QString("/home/%1").arg(sudo_user); strCfgFileDir = QString("/home/%1").arg(sudo_user);
} }
strCfgFileDir += pszXdgCfgDir; strCfgFileDir += g_pszXdgAutoStartCfgDir;
const QString strCfgFileFullPath = strCfgFileDir + pszXdgCfgFile; const QString strCfgFileFullPath = strCfgFileDir + g_pszHMIXdgDesktopCfgFile;
if (QFile::exists(strCfgFileFullPath)) if (QFile::exists(strCfgFileFullPath))
{ {
@ -131,8 +122,8 @@ bool removeShortcut(QString &strErr)
{ {
//< todo //< todo
Q_UNUSED(strErr); Q_UNUSED(strErr);
QDir appDir(pszAppDir); QDir appDir(g_pszAppDir);
QString appDestPath = appDir.absoluteFilePath(pszDesktopEntryDirName); QString appDestPath = appDir.absoluteFilePath(g_pszDesktopEntryDirName);
if(QDir(appDestPath).exists()) if(QDir(appDestPath).exists())
{ {
QDir(appDestPath).removeRecursively(); QDir(appDestPath).removeRecursively();
@ -151,10 +142,11 @@ bool removeShortcut(QString &strErr)
bool unregHisDataSrvService(QString &strErr) bool unregHisDataSrvService(QString &strErr)
{ {
return system("systemctl disable iscs6000_db_his_data_srv.service"); QString strUnRegShell = QString("systemctl disable %1.service").arg(g_pszDBHisDataServiceName);
return system(strUnRegShell.toStdString().c_str());
} }
} //< iot_sys } //< namespace iot_sys
#endif //< #ifdef OS_LINUX #endif //< #ifdef OS_LINUX

View File

@ -16,15 +16,11 @@
#include <QtCore> #include <QtCore>
#include "SetupFunc.h" #include "SetupFunc.h"
#include "setup/CommonDef.h"
namespace iot_sys namespace iot_sys
{ {
static const TCHAR *pszServiceName = _T("iscs6000_launcher");
static const char *pszAutoRunRegPath = "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
//< 注销系统服务 //< 注销系统服务
bool unregSysService(QString &strErr) bool unregSysService(QString &strErr)
{ {
@ -38,8 +34,8 @@ bool unregSysService(QString &strErr)
} }
else else
{ {
SC_HANDLE hService = ::OpenService(hSCM, pszServiceName, SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE); SC_HANDLE hService = ::OpenService(hSCM, g_pTCharLauncherServiceName, SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE);
//SC_HANDLE hService = ::OpenService(hSCM, _T("iscs6000_launcher_17b5ab7"), SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE); //SC_HANDLE hService = ::OpenService(hSCM, _T("xxxx_launcher_17b5ab7"), SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE);
if (NULL == hService) if (NULL == hService)
{ {
@ -54,9 +50,9 @@ bool unregSysService(QString &strErr)
{ {
//< todo 当使用SERVICE_USER_XXX_PROCESS类型的服务注册时停止服务存在困难 //< todo 当使用SERVICE_USER_XXX_PROCESS类型的服务注册时停止服务存在困难
//< 此情况下服务的真实名称是注册名加上用户会话的ID而ID是变化的且微软没有开发获取的方法 //< 此情况下服务的真实名称是注册名加上用户会话的ID而ID是变化的且微软没有开发获取的方法
//< 比如真实的服务名是“iscs6000_launcher_17b5ab7”且正在运行如果查询“iscs6000_launcher”的状态是停止的 //< 比如真实的服务名是“xxxx_launcher_17b5ab7”且正在运行如果查询“xxxx_launcher”的状态是停止的
//< 也无法通过停止“iscs6000_launcher”服务来停止“iscs6000_launcher_17b5ab7” //< 也无法通过停止“xxxx_launcher”服务来停止“xxxx_launcher_17b5ab7”
//< 删除“iscs6000_launcher”服务后“iscs6000_launcher_17b5ab7”还可见必须注销重新登录才会消失 //< 删除“xxxx_launcher”服务后“xxxx_launcher_17b5ab7”还可见必须注销重新登录才会消失
if(SERVICE_STOPPED != objStatus.dwCurrentState if(SERVICE_STOPPED != objStatus.dwCurrentState
&& TRUE == ControlService(hService, SERVICE_CONTROL_STOP, &objStatus)) && TRUE == ControlService(hService, SERVICE_CONTROL_STOP, &objStatus))
@ -113,9 +109,9 @@ bool unregSysService(QString &strErr)
//< 取消HMI自启动 //< 取消HMI自启动
bool unsetHmiAutoStart(QString &strErr) bool unsetHmiAutoStart(QString &strErr)
{ {
QSettings objRegSetting(pszAutoRunRegPath, QSettings::NativeFormat); QSettings objRegSetting(g_pszAutoRunRegPath, QSettings::NativeFormat);
if (objRegSetting.contains("iscs6000_hmi_explorer")) if (objRegSetting.contains(g_pszAutoRunHMI))
{ {
if (!objRegSetting.isWritable()) if (!objRegSetting.isWritable())
{ {
@ -123,7 +119,7 @@ bool unsetHmiAutoStart(QString &strErr)
return false; return false;
} }
objRegSetting.remove("iscs6000_hmi_explorer"); objRegSetting.remove(g_pszAutoRunHMI);
if (QSettings::NoError != objRegSetting.status()) if (QSettings::NoError != objRegSetting.status())
{ {
@ -171,8 +167,8 @@ bool unsetSysStartupAutoStart(QString &strErr,QString path)
bool unsetSysStartupAutoStartByVbs(QString &strErr) bool unsetSysStartupAutoStartByVbs(QString &strErr)
{ {
Q_UNUSED(strErr) Q_UNUSED(strErr)
QDir dir("C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp"); QDir dir(g_pszAutoStartSysStartupPath);
if(dir.remove("sys_startup.vbs")) if(dir.remove(g_pszSysStartupVBS))
{ {
return true; return true;
} }
@ -194,7 +190,7 @@ bool removeShortcut(QString &strErr)
//>桌面快捷方式 //>桌面快捷方式
//<开始菜单快捷方式 //<开始菜单快捷方式
QString startMenuPath=QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)+"/PowerSCADA3000W"; QString startMenuPath=QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)+"/EMS60";
QDir startMenuPathDir(startMenuPath); QDir startMenuPathDir(startMenuPath);
if(startMenuPathDir.removeRecursively()) if(startMenuPathDir.removeRecursively())
return true; return true;
@ -237,7 +233,6 @@ bool DelDir(QString &path)
bool unregHisDataSrvService(QString &strErr) bool unregHisDataSrvService(QString &strErr)
{ {
const TCHAR *pszServiceName = _T("db_his_data_srv");
bool bRet = false; bool bRet = false;
//< 打开服务控制管理器 //< 打开服务控制管理器
@ -248,7 +243,7 @@ bool unregHisDataSrvService(QString &strErr)
} }
else else
{ {
SC_HANDLE hService = ::OpenService(hSCM, pszServiceName, SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE); SC_HANDLE hService = ::OpenService(hSCM, g_pTCharDBHisDataServiceName, SERVICE_QUERY_STATUS | SERVICE_STOP | DELETE);
if (NULL == hService) if (NULL == hService)
{ {
@ -264,9 +259,9 @@ bool unregHisDataSrvService(QString &strErr)
{ {
//< todo 当使用SERVICE_USER_XXX_PROCESS类型的服务注册时停止服务存在困难 //< todo 当使用SERVICE_USER_XXX_PROCESS类型的服务注册时停止服务存在困难
//< 此情况下服务的真实名称是注册名加上用户会话的ID而ID是变化的且微软没有开发获取的方法 //< 此情况下服务的真实名称是注册名加上用户会话的ID而ID是变化的且微软没有开发获取的方法
//< 比如真实的服务名是“iscs6000_launcher_17b5ab7”且正在运行如果查询“iscs6000_launcher”的状态是停止的 //< 比如真实的服务名是“xxxx_launcher_17b5ab7”且正在运行如果查询“xxxx_launcher”的状态是停止的
//< 也无法通过停止“iscs6000_launcher”服务来停止“iscs6000_launcher_17b5ab7” //< 也无法通过停止“xxxx_launcher”服务来停止“xxxx_launcher_17b5ab7”
//< 删除“iscs6000_launcher”服务后“iscs6000_launcher_17b5ab7”还可见必须注销重新登录才会消失 //< 删除“xxxx_launcher”服务后“xxxx_launcher_17b5ab7”还可见必须注销重新登录才会消失
if(SERVICE_STOPPED != objStatus.dwCurrentState if(SERVICE_STOPPED != objStatus.dwCurrentState
&& TRUE == ControlService(hService, SERVICE_CONTROL_STOP, &objStatus)) && TRUE == ControlService(hService, SERVICE_CONTROL_STOP, &objStatus))
@ -322,6 +317,6 @@ bool unregHisDataSrvService(QString &strErr)
} }
} //< iot_sys } //< namespace iot_sys
#endif //< #ifdef OS_WINDOWS #endif //< #ifdef OS_WINDOWS

View File

@ -15,7 +15,7 @@
#include <QPainterPath> #include <QPainterPath>
#include "SetupFunc.h" #include "SetupFunc.h"
#include "CUninstallWorker.h" #include "CUninstallWorker.h"
#include "setup/CommonDef.h"
#ifdef OS_WINDOWS #ifdef OS_WINDOWS
#include "windows.h" #include "windows.h"
@ -45,13 +45,6 @@ const static int pos_max_x=560;
const static int pos_min_y=10; const static int pos_min_y=10;
const static int pos_max_y=400; const static int pos_max_y=400;
#ifdef OS_WINDOWS
#define SYS_CONFIG_PATH "C:/Program Files/PowerSCADA3000"
#endif
#ifdef OS_LINUX
#define SYS_CONFIG_PATH "/etc/powerscada3000"
#endif
using namespace iot_sys; using namespace iot_sys;
@ -75,7 +68,7 @@ SetupWidget::SetupWidget(QWidget *parent) :
#endif #endif
#ifdef OS_LINUX #ifdef OS_LINUX
ui->gridLayout_4->setContentsMargins(0,0,0,0); ui->gridLayout_4->setContentsMargins(0,0,0,0);
ui->label->setVisible(false); // ui->label->setVisible(false);
#endif #endif
m_SetupRunPath = qApp->applicationDirPath(); m_SetupRunPath = qApp->applicationDirPath();
@ -84,6 +77,8 @@ SetupWidget::SetupWidget(QWidget *parent) :
ReadSetupXml( m_SetupRunPath + "/product/common/sysconfig/setup_config.xml"); ReadSetupXml( m_SetupRunPath + "/product/common/sysconfig/setup_config.xml");
initDBInfoLayout();
ui->stackedWidget->setCurrentIndex(0); ui->stackedWidget->setCurrentIndex(0);
initUninstallWorker(); initUninstallWorker();
@ -98,6 +93,25 @@ SetupWidget::~SetupWidget()
} }
void SetupWidget::setDBInfoValid(bool bHidden)
{
ui->label_dbName->setHidden(bHidden);
ui->label_dbPassword->setHidden(bHidden);
ui->lineEdit_dbName->setHidden(bHidden);
ui->lineEdit_dbPassword->setHidden(bHidden);
}
void SetupWidget::initDBInfoLayout()
{
ui->lineEdit_dbName->setText(EMS_DEFAULT_DATABASE);
ui->lineEdit_dbPassword->setText(EMS_DEFAULT_PASSWD);
setDBInfoValid(true);
connect(ui->checkBox_hisdata,SIGNAL(stateChanged(int)),this,SLOT(onHisDataCheckStateChanged(int)));
}
bool SetupWidget::ReadSetupXml(const QString &fileName) bool SetupWidget::ReadSetupXml(const QString &fileName)
{ {
QFile file(fileName); QFile file(fileName);
@ -293,6 +307,18 @@ void SetupWidget::paintEvent(QPaintEvent *event)
} }
} }
void SetupWidget::onHisDataCheckStateChanged(int checkState)
{
if(checkState == Qt::Checked)
{
setDBInfoValid(false);
}
else
{
setDBInfoValid(true);
}
}
void SetupWidget::addMsg(const QString &msg) void SetupWidget::addMsg(const QString &msg)
{ {
@ -318,16 +344,23 @@ void SetupWidget::on_UnNextButton1_clicked()
#ifdef OS_WINDOWS #ifdef OS_WINDOWS
system_hidden("net stop db_his_data_srv"); QString strCmdShell = QString("net stop %1").arg(g_pszDBHisDataServiceName);
system_hidden("sc delete db_his_data_srv"); system_hidden(strCmdShell.toStdString().c_str());
strCmdShell = QString("sc delete %1").arg(g_pszDBHisDataServiceName);
system_hidden(strCmdShell.toStdString().c_str());
system_hidden("net stop net_keepalived"); system_hidden("net stop net_keepalived");
system_hidden("sc delete net_keepalived"); system_hidden("sc delete net_keepalived");
system_hidden( net_keepalived_stop.toStdString().c_str() ); system_hidden( net_keepalived_stop.toStdString().c_str() );
#endif #endif
#ifdef OS_LINUX #ifdef OS_LINUX
system("systemctl stop iscs6000_db_his_data_srv"); QString strShell = QString("systemctl stop %1").arg(g_pszDBHisDataServiceName);
system("systemctl disable iscs6000_db_his_data_srv"); system(strShell.toStdString().c_str());
QString("systemctl disable %1").arg(g_pszDBHisDataServiceName);
system(strShell.toStdString().c_str());
system("systemctl stop net_keepalived"); system("systemctl stop net_keepalived");
system("systemctl disable net_keepalived"); system("systemctl disable net_keepalived");
system( net_keepalived_stop.toStdString().c_str() ); system( net_keepalived_stop.toStdString().c_str() );
@ -343,7 +376,9 @@ void SetupWidget::on_UnNextButton1_clicked()
return ; return ;
} }
emit startWork(MainProgramPath,DatabasePath,ui->checkBox_hisdata->isChecked(),ui->checkBox_backup->isChecked()); emit startWork(MainProgramPath,DatabasePath,
ui->lineEdit_dbName->text(),ui->lineEdit_dbName->text(),ui->lineEdit_dbPassword->text(),
ui->checkBox_hisdata->isChecked(),ui->checkBox_backup->isChecked());
ui->stackedWidget->setCurrentIndex(1); // 开始卸载 ui->stackedWidget->setCurrentIndex(1); // 开始卸载
ui->btn_uninstall_continue->setVisible(false); ui->btn_uninstall_continue->setVisible(false);
@ -475,7 +510,7 @@ void SetupWidget::getAllProcName(const QString &path, QStringList &procList)
procList.append(list.at(index).fileName()); procList.append(list.at(index).fileName());
} }
#else #else
if(list.at(index).fileName().endsWith(".exe") && list.at(index).fileName() != "uninstall.exe" &&list.at(index).fileName().size()>4) if(list.at(index).fileName().endsWith(".exe") && list.at(index).fileName() != UNINSTALL_EXEC_NAME &&list.at(index).fileName().size()>4)
{ {
procList.append(list.at(index).fileName()); procList.append(list.at(index).fileName());
} }
@ -566,6 +601,7 @@ QString SetupWidget::canUninstall()
} }
return runName; return runName;
} }
#else #else
QString SetupWidget::canUninstall() QString SetupWidget::canUninstall()

View File

@ -24,7 +24,9 @@ public:
~SetupWidget(); ~SetupWidget();
signals: signals:
void startWork(const QString & manProgramPath, const QString &dbPath,bool isHisdataDel, bool isBackupDel); void startWork(const QString & manProgramPath,const QString &dbPath,
const QString &dbName,const QString &dbUserName,const QString &dbUserPassword,
bool isHisdataDel, bool isBackupDel);
protected: protected:
bool ReadSetupXml(const QString &fileName); bool ReadSetupXml(const QString &fileName);
@ -37,7 +39,7 @@ protected:
private slots: private slots:
void onHisDataCheckStateChanged(int checkState);
void addMsg(const QString &msg); // 添加消息 void addMsg(const QString &msg); // 添加消息
@ -67,6 +69,9 @@ private:
QString canUninstall(); QString canUninstall();
void initDBInfoLayout();
void setDBInfoValid(bool bHidden);
private: private:
Ui::SetupWidget *ui; Ui::SetupWidget *ui;

View File

@ -44,7 +44,7 @@
<number>1</number> <number>1</number>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="page_uninstall_start"> <widget class="QWidget" name="page_uninstall_start">
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
@ -101,19 +101,37 @@
<item> <item>
<widget class="QCheckBox" name="checkBox_hisdata"> <widget class="QCheckBox" name="checkBox_hisdata">
<property name="text"> <property name="text">
<string>清理历史数据</string> <string>清理历史数据(勾选会删除数据库)</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label"> <layout class="QFormLayout" name="formLayout">
<property name="styleSheet"> <item row="0" column="0">
<string notr="true">color:rgb(255, 255, 255)</string> <widget class="QLabel" name="label_dbName">
</property> <property name="text">
<property name="text"> <string> 时数据库名</string>
<string>(勾选清理历史数据会删除数据库)</string> </property>
</property> </widget>
</widget> </item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_dbName"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_dbPassword">
<property name="text">
<string> 时数据库密码</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_dbPassword">
<property name="echoMode">
<enum>QLineEdit::Normal</enum>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="checkBox_backup"> <widget class="QCheckBox" name="checkBox_backup">