void Controller_run::execute(){
int frequency = run->ui.leFrequency->text().toInt();
int total = run->ui.leTotal->text().toInt();
timerFrequency
= new QTimer(this);
timeLine->setDuration(total);
timeLine->setFrameRange(0, 150); // update every second
timeLine->setLoopCount(1);
run->ui.progressBar->setRange(0, 150);
connect(timerFrequency, SIGNAL(timeout()), this, SLOT(send_receive()));
connect(timeLine, SIGNAL(frameChanged(int)), run->ui.progressBar, SLOT(setValue(int)));
run->ui.progressBar->setValue(0);
connect(run->ui.btStop, SIGNAL (clicked()), this, SLOT(stopall()));
connect(timeLine, SIGNAL(finished()), this, SLOT(stopall()));
timerFrequency->start(frequency);
timeLine->start();
}
void Controller_run::stopall(){
timerFrequency->deleteLater();
timeLine->stop();
run->ui.btRun->setEnabled("true");
run->ui.btStop->setDisabled("true");
save_xml_file();
}
void Controller_run::execute(){
int frequency = run->ui.leFrequency->text().toInt();
int total = run->ui.leTotal->text().toInt();
timerFrequency = new QTimer(this);
timeLine = new QTimeLine;
timeLine->setDuration(total);
timeLine->setFrameRange(0, 150); // update every second
timeLine->setLoopCount(1);
run->ui.progressBar->setRange(0, 150);
connect(timerFrequency, SIGNAL(timeout()), this, SLOT(send_receive()));
connect(timeLine, SIGNAL(frameChanged(int)), run->ui.progressBar, SLOT(setValue(int)));
run->ui.progressBar->setValue(0);
connect(run->ui.btStop, SIGNAL (clicked()), this, SLOT(stopall()));
connect(timeLine, SIGNAL(finished()), this, SLOT(stopall()));
timerFrequency->start(frequency);
timeLine->start();
}
void Controller_run::stopall(){
timerFrequency->deleteLater();
timeLine->stop();
run->ui.btRun->setEnabled("true");
run->ui.btStop->setDisabled("true");
save_xml_file();
}
To copy to clipboard, switch view to plain text mode
Bookmarks