#include "dialog_feedback.h" #include "ui_dialog_feedback.h" #include Dialog_Feedback::Dialog_Feedback(class VersionDll *versionDll, QWidget *parent) : QDialog(parent) , ui(new Ui::Dialog_Feedback) , m_versionDll(versionDll) { ui->setupUi(this); setWindowTitle(tr("feedback")); setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint); ui->textEdit->setPlaceholderText(tr("Please leave your valuable comments and suggestions (required field).")); ui->lineEdit->setPlaceholderText(tr("Please leave your phone number, QQ or email address (required field).")); } Dialog_Feedback::~Dialog_Feedback() { delete ui; } void Dialog_Feedback::on_pbtn_submit_clicked() { QString feedback = ui->textEdit->toPlainText(); QString contact = ui->lineEdit->text(); if(ui->textEdit->document()->isEmpty()) { QMessageBox::critical(this, tr("error"), tr("Comments and suggestions cannot be empty.")); return; } if(ui->lineEdit->text().isEmpty()) { QMessageBox::critical(this, tr("error"), tr("The contact information column cannot be empty.")); return; } HGResult ret = m_versionDll->PostUserFeedback(HGVERSION_APPNAME_SCANNER, "feedback", feedback.toStdString().c_str(), contact.toStdString().c_str()); if(HGBASE_ERR_OK == ret) { QMessageBox::information(this, tr("tip"), tr("submit succeed.")); } else { QMessageBox::critical(this, tr("error"), tr("submit failed.")); } close(); } void Dialog_Feedback::on_pbtn_cancel_clicked() { close(); }