Proxy Process와 연동
Proxy DB 저장, Local 저장 기능 git-svn-id: svn://192.168.0.12/source@53 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
@@ -29,6 +29,12 @@ Widget::Widget(QWidget *parent) :
|
||||
p_lineTime->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
p_lineProxyFile->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
|
||||
p_chkLocal = new QCheckBox("Local") ;
|
||||
p_chkDb = new QCheckBox("DB");
|
||||
p_chkLocal->setChecked(true);
|
||||
QLabel *blank = new QLabel("Update Location: ");
|
||||
|
||||
|
||||
glayout->addWidget(p_labelUrl, 0, 0);
|
||||
glayout->addWidget(p_lineUrl, 0, 1, 1, 3);
|
||||
glayout->addWidget(p_labelTime, 1, 0);
|
||||
@@ -36,10 +42,20 @@ Widget::Widget(QWidget *parent) :
|
||||
glayout->addWidget(p_labelProxyFile, 2, 0);
|
||||
glayout->addWidget(p_lineProxyFile, 2, 1, 1, 2);
|
||||
glayout->addWidget(p_btnChoose, 2, 3);
|
||||
glayout->addWidget(p_labelRecent , 3, 0);
|
||||
glayout->addWidget(p_labelRecentTime, 3, 1);
|
||||
glayout->addWidget(p_labelNext, 3, 2);
|
||||
glayout->addWidget(p_labelNextTime, 3, 3);
|
||||
glayout->addWidget(p_chkLocal, 3, 1);
|
||||
glayout->addWidget(p_chkDb, 3, 2);
|
||||
|
||||
|
||||
glayout->addWidget(p_labelRecent , 4, 0);
|
||||
glayout->addWidget(p_labelRecentTime, 4, 1);
|
||||
glayout->addWidget(p_labelNext, 4, 2);
|
||||
glayout->addWidget(p_labelNextTime, 4, 3);
|
||||
glayout->addWidget(blank, 3, 0);
|
||||
|
||||
connect(p_chkDb,SIGNAL(clicked()),this, SLOT(chkDb()));
|
||||
connect(p_chkLocal,SIGNAL(clicked()),this, SLOT(chkLocal()));
|
||||
|
||||
|
||||
/*
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
@@ -77,8 +93,10 @@ Widget::Widget(QWidget *parent) :
|
||||
glayout->addWidget(p_btnStop, 1, 4);
|
||||
glayout->addWidget(p_labelTimerOnOff, 2, 4);
|
||||
glayout->addWidget(p_labelStatus,3 , 4);
|
||||
QLabel *blank = new QLabel;
|
||||
glayout->addWidget(blank, 4, 0, 1, 4);
|
||||
|
||||
|
||||
QLabel *blank2 = new QLabel;
|
||||
glayout->addWidget(blank2, 5, 0, 1, 4);
|
||||
}
|
||||
|
||||
p_timer = new QTimer(this);
|
||||
@@ -87,8 +105,8 @@ Widget::Widget(QWidget *parent) :
|
||||
connect(p_btnStart, SIGNAL(clicked()), this, SLOT(btnStart()));
|
||||
connect(p_btnStop, SIGNAL(clicked()), this, SLOT(btnStop()));
|
||||
connect(p_btnChoose, SIGNAL(clicked()), this, SLOT(btnChoose()));
|
||||
connect(&v_pro,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(processFinished()));
|
||||
|
||||
connect(&v_pro,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(processFinished(int, QProcess::ExitStatus)));
|
||||
//SIGNAL(finished(int,QProcess::ExitStatus)),SLOT(processFinished(int,QProcess::ExitStatus))
|
||||
/*
|
||||
hlayoutDefault = new QHBoxLayout(this);
|
||||
hlayoutDefault->addLayout(vlayoutParam);
|
||||
@@ -144,17 +162,64 @@ void Widget::update()
|
||||
{
|
||||
qDebug("update()");
|
||||
//QDateTime time = QDateTime::currentDateTime();
|
||||
QString strCheck;
|
||||
|
||||
v_pro.start("ProxyProcess",QStringList() << p_lineUrl->text() << p_lineProxyFile->text() );
|
||||
if(p_chkDb->isChecked())
|
||||
strCheck = "db";
|
||||
if(p_chkLocal->isChecked())
|
||||
strCheck = "local";
|
||||
if(p_chkDb->isChecked() && p_chkLocal->isChecked())
|
||||
strCheck = "both";
|
||||
|
||||
v_pro.start("ProxyProcess",QStringList() << p_lineUrl->text() << p_lineProxyFile->text() << strCheck);
|
||||
//p_labelRecentTime->setText(time.toLocalTime().toString("yyyy-MM-dd hh:mm:ss"));
|
||||
p_labelNextTime->setText(QDateTime::currentDateTime().toLocalTime().addSecs(p_lineTime->text().toInt()).toString("yyyy-MM-dd hh:mm:ss"));
|
||||
p_labelStatus->setText("Updating");
|
||||
|
||||
}
|
||||
|
||||
void Widget::processFinished()
|
||||
void Widget::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
qDebug("process finished");
|
||||
QProcess *pPro = (QProcess*)sender();
|
||||
QString str = pPro->readAllStandardOutput();
|
||||
|
||||
QString message;
|
||||
if(str.right(2).compare("ok") == 0)
|
||||
{
|
||||
message = "Update Done";
|
||||
}
|
||||
else if(str.right(7).compare("dbcfail") == 0)
|
||||
{
|
||||
message = "DB connection\nFail";
|
||||
}
|
||||
else if(str.right(7).compare("dbufail") == 0)
|
||||
{
|
||||
message = "DB update Fail";
|
||||
}
|
||||
else if(str.right(8).compare("savefail") == 0)
|
||||
{
|
||||
message = "Saving file\nFail";
|
||||
}
|
||||
else if(str.right(7).compare("timeout") == 0)
|
||||
{
|
||||
message = "TimeOut";
|
||||
}
|
||||
else
|
||||
message = "Unknown Error";
|
||||
|
||||
pPro->kill();
|
||||
|
||||
p_labelRecentTime->setText(QDateTime::currentDateTime().toLocalTime().toString("yyyy-MM-dd hh:mm:ss"));
|
||||
p_labelStatus->setText("Update Done");
|
||||
p_labelStatus->setText(message);
|
||||
}
|
||||
|
||||
void Widget::chkDb()
|
||||
{
|
||||
p_chkLocal->setChecked(true);
|
||||
}
|
||||
|
||||
|
||||
void Widget::chkLocal()
|
||||
{
|
||||
p_chkDb->setChecked(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user