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