代码拉取完成,页面将自动刷新
同步操作将从 AGeek/keil_development_assistant 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "mainwindow.h"
#include <QApplication>
#include <QSharedMemory>
#include <QMessageBox>
#include <QString>
#include <QTextCodec>
MainWindow* main_window=nullptr;
#include "only_run_by_file.h"
void onAppExit()
{
// 删除 run 文件
QFile::remove("run");
}
QString project_path;
QString map_path;
QString gb2312ToQString(const char *gb2312Data) {
QTextCodec *gb2312Codec = QTextCodec::codecForName("GB2312");
if (!gb2312Codec) {
qWarning("GB2312 codec not available. Cannot convert to QString.");
return QString();
}
QByteArray byteArray = QByteArray::fromRawData(gb2312Data, strlen(gb2312Data));
return gb2312Codec->toUnicode(byteArray);
}
//QString executeCmdCommand(const QString& cmdCommand) {
// QProcess process;
// // Set the command to be executed (cmd in this case)
// QString command = "cmd.exe";
// // Set the arguments to pass to the command
// QStringList arguments;
// arguments << "/c" << cmdCommand;
// // Start the process
// process.start(command, arguments);
// // Wait for the process to finish
// process.waitForFinished();
// // Read the output from the process
// QString output = process.readAllStandardOutput();
// return output;
//}
int main(int argc, char *argv[])
{
// Execute the cmd command and get the output
// QString result = executeCmdCommand("cd ");
// Display the output
// qDebug() << "Output:" << result;
for(int i=0;i<argc;i++)
qDebug() <<argv[i];
if(argc==3)
{
project_path=gb2312ToQString(argv[1]);
map_path=gb2312ToQString(argv[2]);
project_path.replace("\"", "");
map_path.replace("\"", "");
project_path.replace("“", "");
project_path.replace("”", "");
map_path.replace("“", "");
map_path.replace("”", "");
}else if(argc==2)
{
project_path=map_path=gb2312ToQString(argv[1]);
project_path.replace("\"", "");
map_path.replace("\"", "");
project_path.replace("“", "");
project_path.replace("”", "");
map_path.replace("“", "");
map_path.replace("”", "");
}else
{
project_path=map_path="";
}
QApplication a(argc, argv);
// only_run_by_file programController;
// QObject::connect(&programController, &only_run_by_file::runFileDeleted, &a, &QCoreApplication::quit);
// 注册程序退出的处理函数
QObject::connect(&a, &QCoreApplication::aboutToQuit, onAppExit);
MainWindow w;
w.show();
return a.exec();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。