2018-06-01 09:36:01 +00:00
|
|
|
#include <Qtwidgets/QtWidgets>
|
|
|
|
#include "QConfigurationWidget.h"
|
|
|
|
#include "SystemDataQuery.h"
|
|
|
|
#include "SystemData.h"
|
|
|
|
|
|
|
|
QConfigurationWidget::QConfigurationWidget(QWidget *parent)
|
|
|
|
: QWidget(parent)
|
|
|
|
{
|
|
|
|
setupUi(this);
|
|
|
|
|
|
|
|
init();
|
|
|
|
initWidget();
|
|
|
|
initSignal();
|
|
|
|
initData();
|
|
|
|
}
|
|
|
|
|
|
|
|
QConfigurationWidget::~QConfigurationWidget()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void QConfigurationWidget::init()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void QConfigurationWidget::initWidget()
|
|
|
|
{
|
|
|
|
setLayout( pLayoutMain );
|
|
|
|
|
|
|
|
setMaximumWidth( 800 );
|
|
|
|
}
|
|
|
|
|
|
|
|
void QConfigurationWidget::initSignal()
|
|
|
|
{
|
|
|
|
connect( pEditAutoTraderCode, SIGNAL(editingFinished()), this, SLOT(onAutoTraderCodeEdited()));
|
|
|
|
connect( pEditAutoTraderCode, SIGNAL(textChanged(const QString &)), this, SLOT(onAutoTraderCodeChanged()) );
|
|
|
|
connect( pButtonSave, SIGNAL(clicked()), this, SLOT(onSave()) );
|
|
|
|
connect( pButtonReset, SIGNAL(clicked()), this, SLOT(onReset()) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void QConfigurationWidget::initData()
|
|
|
|
{
|
2018-06-15 06:35:27 +00:00
|
|
|
pEditAutoTraderCode->setText( QString::fromLocal8Bit( pParameters->getParameter("默认车商代码").c_str() ));
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
emit pEditAutoTraderCode->editingFinished();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QConfigurationWidget::onAutoTraderCodeEdited()
|
|
|
|
{
|
|
|
|
string strAutoTraderCode = pEditAutoTraderCode->text().trimmed().toUpper().toLocal8Bit().data();
|
|
|
|
string strAutoTraderName;
|
|
|
|
|
2018-06-15 07:32:41 +00:00
|
|
|
query_auto_trader_info( strAutoTraderCode, strAutoTraderName );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
pEditAutoTraderName->setText( QString::fromLocal8Bit( strAutoTraderName.c_str() ));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QConfigurationWidget::onAutoTraderCodeChanged()
|
|
|
|
{
|
|
|
|
pEditAutoTraderName->clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QConfigurationWidget::onSave()
|
|
|
|
{
|
|
|
|
if ( pEditAutoTraderName->text().isEmpty() )
|
|
|
|
{
|
|
|
|
emit pEditAutoTraderCode->editingFinished();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( pEditAutoTraderName->text().isEmpty() )
|
|
|
|
{
|
2018-06-01 10:21:26 +00:00
|
|
|
QMessageBox::critical( this, QString::fromLocal8Bit("错误!"), QString::fromLocal8Bit("车商代码错误!") );
|
2018-06-01 09:36:01 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-06-15 06:35:27 +00:00
|
|
|
pParameters->setParameter( "默认车商代码", pEditAutoTraderCode->text().toLocal8Bit().data() );
|
2018-06-01 09:36:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QConfigurationWidget::onReset()
|
|
|
|
{
|
|
|
|
initData();
|
|
|
|
}
|