telsale-management/代码/cpp/telsale_aux_kit/source/main.cpp

76 lines
1.3 KiB
C++
Raw Normal View History

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>
#include <QtWidgets/QApplication>
#include <exception>
#include "QMainFrame.h"
#include "QLoginWidget.h"
#include "SystemData.h"
using namespace std;
2018-06-01 10:21:26 +00:00
int main( int argc, char * argv[] )
{
2018-06-15 06:41:32 +00: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 10:21:26 +00:00
QMessageBox::critical( NULL,
QString::fromLocal8Bit( "参数读取错误" ),
QString::fromLocal8Bit( error.what() ) );
2018-06-01 10:21:26 +00:00
return iReturnCode;
}
try
{
2018-06-15 06:41:32 +00:00
//pApp =
pLogin = new QLoginWidget();
2018-06-15 06:41:32 +00: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 06:41:32 +00:00
if ( pMainFrame != NULL )
{
2018-06-15 06:41:32 +00:00
delete pMainFrame;
}
2018-06-15 06:41:32 +00:00
if (pApp != NULL)
{
2018-06-15 06:41:32 +00:00
delete pApp;
}
return iReturnCode;
}