Add pending function to guimessagedialog.
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
#include "guimessagedialog.h"
|
#include "guimessagedialog.h"
|
||||||
#include "ui_guimessagedialog.h"
|
#include "ui_guimessagedialog.h"
|
||||||
#include "event/EventCenter.h"
|
#include "event/EventCenter.h"
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QHBoxLayout>
|
||||||
GUIMessageDialog::GUIMessageDialog(QWidget *parent) :
|
GUIMessageDialog::GUIMessageDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::GUIMessageDialog)
|
ui(new Ui::GUIMessageDialog)
|
||||||
@@ -12,8 +14,21 @@ GUIMessageDialog::GUIMessageDialog(QWidget *parent) :
|
|||||||
this->showFullScreen ();
|
this->showFullScreen ();
|
||||||
ui->lbl_msg->setVisible(false);
|
ui->lbl_msg->setVisible(false);
|
||||||
ui->lbl_progressicon->setVisible(false);
|
ui->lbl_progressicon->setVisible(false);
|
||||||
ui->btn_main->setVisible(false);
|
btn_main = new QToolButton(this);
|
||||||
ui->btn_main->setText("OK");
|
btn_main->setObjectName("btn_main");
|
||||||
|
btn_main->setVisible(false);
|
||||||
|
btn_main->setText("OK");
|
||||||
|
btn_Append = new QToolButton(this);
|
||||||
|
btn_Append->setObjectName("btn_main");
|
||||||
|
btn_Append->setVisible(false);
|
||||||
|
btn_Append->setText("Stop");
|
||||||
|
QWidget* btnContainer = new QWidget(this);
|
||||||
|
QHBoxLayout* hlayout = new QHBoxLayout(btnContainer);
|
||||||
|
hlayout->setMargin(0);
|
||||||
|
hlayout->addWidget(btn_main);
|
||||||
|
hlayout->addWidget(btn_Append);
|
||||||
|
|
||||||
|
ui->widget_2->layout()->addWidget(btnContainer);
|
||||||
this->setWindowOpacity(0.6);
|
this->setWindowOpacity(0.6);
|
||||||
for (int i=1; i<=6;i++)
|
for (int i=1; i<=6;i++)
|
||||||
{
|
{
|
||||||
@@ -51,14 +66,14 @@ void GUIMessageDialog::stopLoading() {
|
|||||||
killTimer(timerID);
|
killTimer(timerID);
|
||||||
timerID=-1;
|
timerID=-1;
|
||||||
}
|
}
|
||||||
disconnect(ui->btn_main,0,0,0);
|
disconnect(btn_main,0,0,0);
|
||||||
ui->lbl_progressicon->setVisible(false);
|
ui->lbl_progressicon->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIMessageDialog::startLoading() {
|
void GUIMessageDialog::startLoading() {
|
||||||
ui->lbl_progressicon->setVisible(true);
|
ui->lbl_progressicon->setVisible(true);
|
||||||
disconnect(ui->btn_main,0,0,0);
|
disconnect(btn_main,0,0,0);
|
||||||
connect(ui->btn_main,&QToolButton::clicked,[=](){
|
connect(btn_main,&QToolButton::clicked,[=](){
|
||||||
if (timerID != -1){
|
if (timerID != -1){
|
||||||
killTimer(timerID);
|
killTimer(timerID);
|
||||||
timerID = -1;
|
timerID = -1;
|
||||||
@@ -68,9 +83,8 @@ void GUIMessageDialog::startLoading() {
|
|||||||
LOG_USER_OPERATION(Stop);
|
LOG_USER_OPERATION(Stop);
|
||||||
});
|
});
|
||||||
timerID = startTimer(100);
|
timerID = startTimer(100);
|
||||||
ui->btn_main->setText("Stop");
|
btn_main->setText("Stop");
|
||||||
ui->btn_main->setVisible(true);
|
btn_main->setVisible(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIMessageDialog::showMessage(QString msg) {
|
void GUIMessageDialog::showMessage(QString msg) {
|
||||||
@@ -79,10 +93,10 @@ void GUIMessageDialog::showMessage(QString msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GUIMessageDialog::showExitButton() {
|
void GUIMessageDialog::showExitButton() {
|
||||||
ui->btn_main->setText("OK");
|
btn_main->setText("OK");
|
||||||
ui->btn_main->setVisible(true);
|
btn_main->setVisible(true);
|
||||||
disconnect(ui->btn_main,0,0,0);
|
disconnect(btn_main,0,0,0);
|
||||||
connect(ui->btn_main,&QToolButton::clicked,[=](){
|
connect(btn_main,&QToolButton::clicked,[=](){
|
||||||
if (timerID != -1){
|
if (timerID != -1){
|
||||||
killTimer(timerID);
|
killTimer(timerID);
|
||||||
timerID = -1;
|
timerID = -1;
|
||||||
@@ -98,10 +112,27 @@ void GUIMessageDialog::hideMessage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GUIMessageDialog::hideExitButton() {
|
void GUIMessageDialog::hideExitButton() {
|
||||||
ui->btn_main->setVisible(false);
|
btn_main->setVisible(false);
|
||||||
disconnect(ui->btn_main,0,0,0);
|
disconnect(btn_main,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIMessageDialog::setOpacity(double opacity) {
|
void GUIMessageDialog::setOpacity(double opacity) {
|
||||||
this->setWindowOpacity(opacity);
|
this->setWindowOpacity(opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GUIMessageDialog::startPending() {
|
||||||
|
disconnect(btn_Append,0,0,0);
|
||||||
|
connect(btn_Append,&QToolButton::clicked,[=](){
|
||||||
|
EventCenter::Default()->triggerEvent(GUIEvents::RequestContinueScan, nullptr, nullptr);
|
||||||
|
stopPending();
|
||||||
|
});
|
||||||
|
btn_Append->setText("Next");
|
||||||
|
btn_Append->setVisible(true);
|
||||||
|
pending = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GUIMessageDialog::stopPending() {
|
||||||
|
disconnect(btn_Append,0,0,0);
|
||||||
|
btn_Append->setVisible(false);
|
||||||
|
pending = false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
namespace Ui {
|
namespace Ui {
|
||||||
class GUIMessageDialog;
|
class GUIMessageDialog;
|
||||||
}
|
}
|
||||||
|
class QToolButton;
|
||||||
class GUIMessageDialog : public QDialog
|
class GUIMessageDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -20,14 +20,22 @@ public:
|
|||||||
void hideExitButton();
|
void hideExitButton();
|
||||||
void startLoading();
|
void startLoading();
|
||||||
void stopLoading();
|
void stopLoading();
|
||||||
|
void startPending();
|
||||||
|
void stopPending();
|
||||||
|
bool Pending(){
|
||||||
|
return pending;
|
||||||
|
}
|
||||||
void setOpacity(double);
|
void setOpacity(double);
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent* event) override ;
|
void timerEvent(QTimerEvent* event) override ;
|
||||||
private:
|
private:
|
||||||
Ui::GUIMessageDialog *ui;
|
Ui::GUIMessageDialog *ui;
|
||||||
QList<QString> frame;
|
QList<QString> frame;
|
||||||
|
QToolButton *btn_main;
|
||||||
|
QToolButton *btn_Append;
|
||||||
int frameIndex=0;
|
int frameIndex=0;
|
||||||
int timerID = -1;
|
int timerID = -1;
|
||||||
|
bool pending = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GUIMESSAGEDIALOG_H
|
#endif // GUIMESSAGEDIALOG_H
|
||||||
|
|||||||
@@ -96,13 +96,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignHCenter">
|
|
||||||
<widget class="QToolButton" name="btn_main">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user