调整版本对比,增加用户反馈功能

This commit is contained in:
yangjiaxuan 2022-07-20 17:30:27 +08:00
parent 6c15386537
commit 27fe3692fe
8 changed files with 185 additions and 5 deletions

View File

@ -0,0 +1,53 @@
#include "dialog_feedback.h"
#include "ui_dialog_feedback.h"
#include <QMessageBox>
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();
}

View File

@ -0,0 +1,30 @@
#ifndef DIALOG_FEEDBACK_H
#define DIALOG_FEEDBACK_H
#include <QDialog>
#include "VersionDll.h"
namespace Ui {
class Dialog_Feedback;
}
class Dialog_Feedback : public QDialog
{
Q_OBJECT
public:
explicit Dialog_Feedback(class VersionDll *versionDll, QWidget *parent = nullptr);
~Dialog_Feedback();
private slots:
void on_pbtn_submit_clicked();
void on_pbtn_cancel_clicked();
private:
Ui::Dialog_Feedback *ui;
VersionDll *m_versionDll;
};
#endif // DIALOG_FEEDBACK_H

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog_Feedback</class>
<widget class="QDialog" name="Dialog_Feedback">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>383</width>
<height>214</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_feedback">
<property name="text">
<string>feedback:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEdit"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_contact">
<property name="text">
<string>contact:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbtn_submit">
<property name="text">
<string>submit</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbtn_cancel">
<property name="text">
<string>cancel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -47,7 +47,7 @@ Dialog_upgrade::Dialog_upgrade(class VersionDll *versionDll, QWidget *parent) :
HGInt result = 0;
std::string newestVersionNum = ui->listWidget->item(0)->text().toStdString().c_str();
m_versionDll->CompareVersion(currVersion, newestVersionNum.c_str(), &result);
if(result == 0)
if(result == 0 || result == 1)
{
ui->label_detectResult->setText(tr("The current version is the latest! The current version number is : ") + currVersion);
ui->pbtn_upgrade->setVisible(false);

View File

@ -30,6 +30,7 @@
#include "dialog_imageeditor.h"
#include "dialog_updateprogress.h"
#include "dialog_upgrade.h"
#include "dialog_feedback.h"
#include "hg_settingdialog.h"
#include "base/HGInfo.h"
#include "imgfmt/HGPdf.h"
@ -3159,3 +3160,9 @@ void MainWindow::on_actionact_update_triggered()
return;
}
}
void MainWindow::on_act_feedback_triggered()
{
Dialog_Feedback dlg(m_versionDll, this);
dlg.exec();
}

View File

@ -204,6 +204,8 @@ private slots:
void on_actionact_update_triggered();
void on_act_feedback_triggered();
public slots:
void my_url_handler(const QUrl& url);

View File

@ -156,6 +156,7 @@
<addaction name="separator"/>
<addaction name="actionact_update"/>
<addaction name="act_about"/>
<addaction name="act_feedback"/>
</widget>
<widget class="device_menu" name="menu_device">
<property name="title">
@ -583,6 +584,14 @@
<string>act_update</string>
</property>
</action>
<action name="act_feedback">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>act_feedback</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -54,7 +54,7 @@ unix {
contains(DISTRIBUTION, UnionTech){
message('UOS')
DEFINES += UOS
contains(ARCH, x86_64){
contains(ARCH, x86_64){
LIBS += -L../../../../release/uos/x86_64 -lHGBase -lHGImgFmt -lHGImgProc -lsane-hgsane -lhgdriver
CONFIG(release, debug|release) {
DESTDIR = ../../../../release/uos/x86_64/
@ -164,7 +164,8 @@ SOURCES += \
../../../utility/HGString.cpp \
../../../app/scanner/dialog_input.cpp \
../../../app/scanner/dialog_updateprogress.cpp \
../../../app/scanner/dialog_upgrade.cpp
../../../app/scanner/dialog_upgrade.cpp \
../../../app/scanner/dialog_feedback.cpp
HEADERS += \
../../../app/scanner/VersionDll.h \
@ -211,7 +212,8 @@ HEADERS += \
../../../app/scanner/dialog_input.h \
../../../app/scanner/custom_file_dialog.h \
../../../app/scanner/dialog_updateprogress.h \
../../../app/scanner/dialog_upgrade.h
../../../app/scanner/dialog_upgrade.h \
../../../app/scanner/dialog_feedback.h
FORMS += \
../../../app/scanner/cutdialog.ui \
@ -243,7 +245,8 @@ FORMS += \
../../../app/scanner/dialog_log.ui \
../../../app/scanner/dialog_input.ui \
../../../app/scanner/dialog_updateprogress.ui \
../../../app/scanner/dialog_upgrade.ui
../../../app/scanner/dialog_upgrade.ui \
../../../app/scanner/dialog_feedback.ui
TRANSLATIONS += \
../../../app/scanner/Scanner_zh_CN.ts \