76 lines
1.3 KiB
C++
Raw Normal View History

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