mirror of
https://gitee.com/nikolan/keil_development_assistant.git
synced 2025-01-26 05:52:53 +08:00
59 lines
1.1 KiB
C++
59 lines
1.1 KiB
C++
#include "mainwindow.h"
|
|
#include <QApplication>
|
|
|
|
#include <QSharedMemory>
|
|
#include <QMessageBox>
|
|
|
|
MainWindow* main_window=nullptr;
|
|
|
|
#include "only_run_by_file.h"
|
|
void onAppExit()
|
|
{
|
|
// 删除 run 文件
|
|
QFile::remove("run");
|
|
}
|
|
|
|
QString project_path;
|
|
QString map_path;
|
|
bool only_printf=false;
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
|
|
// for(int i=0;i<argc;i++)
|
|
// qDebug() <<argv[i];
|
|
|
|
if(argc>3)
|
|
{
|
|
project_path=argv[1];
|
|
map_path=argv[2];
|
|
only_printf=argv[3];
|
|
|
|
}else if(argc>2)
|
|
{
|
|
project_path=map_path=argv[1];
|
|
only_printf=argv[2];
|
|
}
|
|
if(argc>1)
|
|
{
|
|
project_path="./";
|
|
map_path="./";
|
|
only_printf=argv[1];
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
if(!only_printf) w.show();
|
|
|
|
return a.exec();
|
|
}
|