|
|
|
|
|
#include "qaddtimedlg.h"
|
|
|
|
|
|
#include "InfoFile.h"
|
|
|
|
|
|
|
|
|
|
|
|
QAddTimeDlg::QAddTimeDlg(QWidget *parent)
|
|
|
|
|
|
: QDialog(parent)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui.setupUi(this);
|
|
|
|
|
|
setWindowFlags(Qt::WindowCloseButtonHint);
|
|
|
|
|
|
connect(ui.pushButton, SIGNAL(clicked()), this, SLOT(SlotOK()));
|
|
|
|
|
|
connect(ui.pushButton_2, SIGNAL(clicked()), this, SLOT(SlotCancle()));
|
|
|
|
|
|
setWindowIcon(QIcon(":/image/leaper"));
|
|
|
|
|
|
ui.timeEdit_Start->setDisplayFormat("hh:mm");
|
|
|
|
|
|
ui.timeEdit_end->setDisplayFormat("hh:mm");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QAddTimeDlg::~QAddTimeDlg()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void QAddTimeDlg::SlotOK()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (ui.lineEdit->text() == "")
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
QDialog::accept();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QAddTimeDlg::SetInfo(TimeStruct m_timeStruct, int model/*=0*/)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (model == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui.lineEdit->setText(m_timeStruct.m_name);
|
|
|
|
|
|
ui.timeEdit_Start->setTime(m_timeStruct.m_startTime);
|
|
|
|
|
|
ui.timeEdit_end->setTime(m_timeStruct.m_endTime);
|
|
|
|
|
|
ui.comboBox_Start->setCurrentIndex((int)m_timeStruct.time_start);
|
|
|
|
|
|
ui.comboBox_end->setCurrentIndex((int)m_timeStruct.time_end);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
ui.lineEdit->setText("");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QAddTimeDlg::GetInfo(TimeStruct &m_timeStruct)
|
|
|
|
|
|
{
|
|
|
|
|
|
QString str_name = ui.lineEdit->text();
|
|
|
|
|
|
QTime startime = ui.timeEdit_Start->time();
|
|
|
|
|
|
QTime endtime = ui.timeEdit_end->time();
|
|
|
|
|
|
m_timeStruct.time_start = (AMPMType)ui.comboBox_Start->currentIndex();
|
|
|
|
|
|
m_timeStruct.time_end = (AMPMType)ui.comboBox_end->currentIndex();
|
|
|
|
|
|
m_timeStruct.m_name = str_name;
|
|
|
|
|
|
m_timeStruct.m_startTime = startime;
|
|
|
|
|
|
m_timeStruct.m_endTime = endtime;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_SLOT void QAddTimeDlg::SlotCancle()
|
|
|
|
|
|
{
|
|
|
|
|
|
QDialog::close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void QAddTimeDlg::changeEvent(QEvent *event)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (event->type() == QEvent::LanguageChange)
|
|
|
|
|
|
{
|
|
|
|
|
|
ui.retranslateUi(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|