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

76 lines
1.3 KiB
C++

//#include <QTextCodec>
#include <QtWidgets/QtWidgets>
#include <QtWidgets/QApplication>
#include <exception>
#include "QMainFrame.h"
#include "QLoginWidget.h"
#include "SystemData.h"
using namespace std;
int main( int argc, char * argv[] )
{
QApplication * pApp = new QApplication(argc, argv);;
QLoginWidget * pLogin = NULL;
QMainFrame * pMainFrame = NULL;
//返回值
int iReturnCode = 0;
try
{
//初始化参数数据库
init_parameters();
}
catch ( std::runtime_error & error )
{
QMessageBox::critical( NULL,
QString::fromLocal8Bit( "参数读取错误" ),
QString::fromLocal8Bit( error.what() ) );
return iReturnCode;
}
try
{
//pApp =
pLogin = new QLoginWidget();
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;
}
if ( pMainFrame != NULL )
{
delete pMainFrame;
}
if (pApp != NULL)
{
delete pApp;
}
return iReturnCode;
}