2018-06-01 10:21:26 +00:00
|
|
|
//#include <QTextCodec>
|
2018-06-02 09:47:28 +00:00
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
#include <QtWidgets/QtWidgets>
|
2018-06-01 09:36:01 +00:00
|
|
|
#include <QtWidgets/QApplication>
|
|
|
|
#include <exception>
|
|
|
|
#include "QMainFrame.h"
|
|
|
|
#include "QLoginWidget.h"
|
2018-06-15 06:35:27 +00:00
|
|
|
#include "SystemData.h"
|
|
|
|
|
|
|
|
using namespace std;
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
int main( int argc, char * argv[] )
|
2018-06-01 09:36:01 +00:00
|
|
|
{
|
2018-06-15 06:41:32 +00:00
|
|
|
QApplication * pApp = new QApplication(argc, argv);;
|
2018-06-15 06:35:27 +00:00
|
|
|
QLoginWidget * pLogin = NULL;
|
|
|
|
QMainFrame * pMainFrame = NULL;
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-15 06:35:27 +00:00
|
|
|
//返回值
|
2018-06-01 09:36:01 +00:00
|
|
|
int iReturnCode = 0;
|
|
|
|
|
2018-06-15 06:35:27 +00:00
|
|
|
try
|
2018-06-01 09:36:01 +00:00
|
|
|
{
|
2018-06-15 06:35:27 +00:00
|
|
|
//初始化参数数据库
|
|
|
|
init_parameters();
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
|
|
|
catch ( std::runtime_error & error )
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
QMessageBox::critical( NULL,
|
2018-06-15 06:35:27 +00:00
|
|
|
QString::fromLocal8Bit( "参数读取错误" ),
|
|
|
|
QString::fromLocal8Bit( error.what() ) );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-01 10:21:26 +00:00
|
|
|
return iReturnCode;
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
2018-06-15 06:35:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
try
|
2018-06-01 09:36:01 +00:00
|
|
|
{
|
2018-06-15 06:41:32 +00:00
|
|
|
//pApp =
|
2018-06-15 06:35:27 +00:00
|
|
|
pLogin = new QLoginWidget();
|
2018-06-15 06:41:32 +00:00
|
|
|
|
2018-06-15 06:35:27 +00:00
|
|
|
pLogin->exec();
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-15 06:35:27 +00:00
|
|
|
if ( pLogin->isLogin() == true )
|
|
|
|
{
|
|
|
|
pMainFrame = new QMainFrame();
|
|
|
|
pMainFrame->showMaximized();
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-15 06:35:27 +00:00
|
|
|
iReturnCode = pApp->exec();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch ( runtime_error & error )
|
|
|
|
{
|
|
|
|
QMessageBox::critical( NULL,
|
|
|
|
QString::fromLocal8Bit( "错误" ),
|
|
|
|
QString::fromLocal8Bit( error.what() ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//清理
|
|
|
|
if ( pLogin != NULL )
|
2018-06-01 09:36:01 +00:00
|
|
|
{
|
2018-06-15 06:35:27 +00:00
|
|
|
delete pLogin;
|
|
|
|
}
|
2018-06-01 09:36:01 +00:00
|
|
|
|
2018-06-15 06:41:32 +00:00
|
|
|
if ( pMainFrame != NULL )
|
2018-06-15 06:35:27 +00:00
|
|
|
{
|
2018-06-15 06:41:32 +00:00
|
|
|
delete pMainFrame;
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
|
|
|
|
2018-06-15 06:41:32 +00:00
|
|
|
if (pApp != NULL)
|
2018-06-15 06:35:27 +00:00
|
|
|
{
|
2018-06-15 06:41:32 +00:00
|
|
|
delete pApp;
|
2018-06-15 06:35:27 +00:00
|
|
|
}
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
return iReturnCode;
|
|
|
|
}
|