2019-12-16 18:20:07 +08:00
|
|
|
|
#include <QtWidgets/QtWidgets>
|
|
|
|
|
#include <QtWidgets/QApplication>
|
2020-03-06 11:43:58 +08:00
|
|
|
|
#include <stdexcept>
|
2019-12-16 18:20:07 +08:00
|
|
|
|
#include "Widgets/MainFrame/QMainFrame.h"
|
2020-03-06 11:43:58 +08:00
|
|
|
|
#include "QLoginDialog.h"
|
2019-12-19 17:10:29 +08:00
|
|
|
|
#include "test/test.h"
|
2019-12-16 18:20:07 +08:00
|
|
|
|
|
2020-03-06 11:43:58 +08:00
|
|
|
|
using namespace std;
|
|
|
|
|
|
2020-06-27 21:30:26 +08:00
|
|
|
|
int main(int argc, char* argv[])
|
2019-12-16 18:20:07 +08:00
|
|
|
|
{
|
2020-06-27 21:30:26 +08:00
|
|
|
|
QApplication* pApp = nullptr;
|
|
|
|
|
QMainFrame* pMainFrame = nullptr;
|
|
|
|
|
QLoginDialog* pLoginDialog = nullptr;
|
|
|
|
|
int returnCode = -1;
|
2019-12-16 18:20:07 +08:00
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2020-06-27 21:30:26 +08:00
|
|
|
|
pApp = new QApplication(argc, argv);
|
2019-12-16 18:20:07 +08:00
|
|
|
|
}
|
2020-06-27 21:30:26 +08:00
|
|
|
|
catch (...)
|
2019-12-16 18:20:07 +08:00
|
|
|
|
{
|
2020-06-27 21:30:26 +08:00
|
|
|
|
QMessageBox::critical(nullptr,
|
|
|
|
|
"错误!",
|
|
|
|
|
"1创建QApplication错误!\n请联系开发人员。");
|
2019-12-16 18:20:07 +08:00
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-15 21:10:04 +08:00
|
|
|
|
test();
|
2020-03-06 11:43:58 +08:00
|
|
|
|
|
2020-05-12 16:44:34 +08:00
|
|
|
|
//return 1;
|
2020-03-06 11:43:58 +08:00
|
|
|
|
|
2020-03-07 20:01:16 +08:00
|
|
|
|
//登录界面
|
2020-03-06 11:43:58 +08:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
pLoginDialog = new QLoginDialog();
|
|
|
|
|
|
|
|
|
|
pLoginDialog->exec();
|
2020-03-09 17:56:01 +08:00
|
|
|
|
|
2020-06-27 21:30:26 +08:00
|
|
|
|
if (pLoginDialog->getReturnCode() == QLoginDialog::ReturnCode::EXIT)
|
2020-03-09 17:56:01 +08:00
|
|
|
|
{
|
|
|
|
|
//用户点了退出
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2020-03-06 11:43:58 +08:00
|
|
|
|
}
|
2020-06-27 21:30:26 +08:00
|
|
|
|
catch (std::runtime_error error)
|
2020-03-06 11:43:58 +08:00
|
|
|
|
{
|
2020-06-27 21:30:26 +08:00
|
|
|
|
QMessageBox::critical(nullptr,
|
|
|
|
|
"错误!",
|
|
|
|
|
error.what());
|
2020-03-06 11:43:58 +08:00
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2019-12-19 17:10:29 +08:00
|
|
|
|
|
2019-12-16 18:20:07 +08:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
pMainFrame = new QMainFrame();
|
|
|
|
|
}
|
2020-06-27 21:30:26 +08:00
|
|
|
|
catch (std::runtime_error& error)
|
2019-12-16 18:20:07 +08:00
|
|
|
|
{
|
2020-06-27 21:30:26 +08:00
|
|
|
|
QMessageBox::critical(nullptr,
|
|
|
|
|
"错误!",
|
|
|
|
|
error.what());
|
2019-12-16 18:20:07 +08:00
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2020-06-27 21:30:26 +08:00
|
|
|
|
catch (...)
|
2019-12-16 18:20:07 +08:00
|
|
|
|
{
|
2020-06-27 21:30:26 +08:00
|
|
|
|
QMessageBox::critical(nullptr,
|
|
|
|
|
"错误!",
|
|
|
|
|
"创建窗口过程错误!\n请联系开发人员。");
|
2019-12-16 18:20:07 +08:00
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
pMainFrame->showMaximized();
|
|
|
|
|
|
|
|
|
|
returnCode = pApp->exec();
|
|
|
|
|
}
|
2020-06-27 21:30:26 +08:00
|
|
|
|
catch (std::runtime_error& error)
|
2019-12-16 18:20:07 +08:00
|
|
|
|
{
|
2020-06-27 21:30:26 +08:00
|
|
|
|
QMessageBox::critical(nullptr,
|
|
|
|
|
"错误!",
|
|
|
|
|
error.what());
|
2019-12-16 18:20:07 +08:00
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2020-06-27 21:30:26 +08:00
|
|
|
|
catch (...)
|
2019-12-16 18:20:07 +08:00
|
|
|
|
{
|
2020-06-27 21:30:26 +08:00
|
|
|
|
QMessageBox::critical(nullptr,
|
|
|
|
|
"错误!",
|
|
|
|
|
"创建窗口过程错误!\n请联系开发人员。");
|
2019-12-16 18:20:07 +08:00
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return returnCode;
|
|
|
|
|
}
|