Commit 032d7e1c by Carwyn

1.重做 “界面调整,修复点击崩溃bug修复,动画可配置,任务栏小框显示汉字标题,查询实时响应,修复未选择退款bug”

parent d75b38fb
#include "fmp_epay_p.h"
#include "fmp_epay_def.h"
#include "fmp_pe_handlers.h"
#include <QDateTime>
class ctkPluginContext;
FMPePay::FMPePay(ctkPluginContext *context)
: FMPePayInterface(context),
_url(DEFAULT_EPAY_RWQUESTURL),
_inited(false),
_databasename(DEFAULT_EPAY_DATABASENAME),
_table(DEFAULT_EPAY_TABLE),
_businessdate(QDateTime::currentDateTime().toString("yyyy-MM-dd")),
_ordershelflife(DEFAULT_EPAY_ORDERLIFE),
_operator_id(DEFAULT_EPAY_OPTID),
_store_id(DEFAULT_EPAY_STRID),
_station_id(DEFAULT_EPAY_STNID),
_ste_handler(new FMPStartEventHandler(_ctx, this)),
d_ptr(new FMPePayPrivate(this))
{
}
int FMPePay::StopService()
{
if (!_inited) return FMP_SUCCESS;
Q_D(FMPePay);
return d->StopService();
}
int FMPePay::Pay()
{
Q_D(FMPePay);
return d->Pay();
}
void FMPePay::SetBasicInfo(QVariantHash hash)
{
Q_D(FMPePay);
this->_businessdate = hash[FMP_BASIC_BUSINESSDATE].toString();
d->SetBasicInfo(hash);
}
#include "fmp_epay_p.h"
#include "fmp_epay_def.h"
#include "fmp_pe_handlers.h"
#include <QDateTime>
class ctkPluginContext;
FMPePay::FMPePay(ctkPluginContext *context)
: FMPePayInterface(context),
_url(DEFAULT_EPAY_RWQUESTURL),
_inited(false),
_needanimation(false),
_databasename(DEFAULT_EPAY_DATABASENAME),
_table(DEFAULT_EPAY_TABLE),
_businessdate(QDateTime::currentDateTime().toString("yyyy-MM-dd")),
_ordershelflife(DEFAULT_EPAY_ORDERLIFE),
_operator_id(DEFAULT_EPAY_OPTID),
_store_id(DEFAULT_EPAY_STRID),
_station_id(DEFAULT_EPAY_STNID),
_ste_handler(new FMPStartEventHandler(_ctx, this)),
d_ptr(new FMPePayPrivate(this))
{
}
int FMPePay::StopService()
{
if (!_inited) return FMP_SUCCESS;
Q_D(FMPePay);
return d->StopService();
}
int FMPePay::Pay()
{
if (_inited) return FMP_SUCCESS;
Q_D(FMPePay);
return d->Pay();
}
void FMPePay::SetBasicInfo(QVariantHash hash)
{
Q_D(FMPePay);
this->_businessdate = hash[FMP_BASIC_BUSINESSDATE].toString();
d->SetBasicInfo(hash);
}
#ifndef FMP_EPAY_H
#define FMP_EPAY_H
#include <QObject>
#include <QPointer>
#include "fmp_epay_i.h"
class FMPePayPrivate;
class FMPStartEventHandler;
class FMPePay : public QObject, public FMPePayInterface
{
Q_OBJECT
Q_INTERFACES(FMPBaseInterface)
Q_INTERFACES(FMPePayInterface)
Q_DECLARE_PRIVATE(FMPePay)
public:
FMPePay(ctkPluginContext *context);
int StopService();
int Pay();
void SetBasicInfo(QVariantHash hash);
private:
bool _inited;
QString _url;
QString _databasename;
QString _table;
QString _businessdate;
QString _store_id;
QString _station_id;
QString _operator_id;
//销售单保存时间
int _ordershelflife;
FMPePayPrivate* d_ptr;
QPointer<FMPStartEventHandler> _ste_handler;
};
#endif // FMP_EPAY_H
#ifndef FMP_EPAY_H
#define FMP_EPAY_H
#include <QObject>
#include <QPointer>
#include "fmp_epay_i.h"
class FMPePayPrivate;
class FMPStartEventHandler;
class FMPePay : public QObject, public FMPePayInterface
{
Q_OBJECT
Q_INTERFACES(FMPBaseInterface)
Q_INTERFACES(FMPePayInterface)
Q_DECLARE_PRIVATE(FMPePay)
public:
FMPePay(ctkPluginContext *context);
int StopService();
int Pay();
void SetBasicInfo(QVariantHash hash);
private:
bool _inited;
bool _needanimation;
QString _url;
QString _databasename;
QString _table;
QString _businessdate;
QString _store_id;
QString _station_id;
QString _operator_id;
//销售单保存时间
int _ordershelflife;
FMPePayPrivate* d_ptr;
QPointer<FMPStartEventHandler> _ste_handler;
};
#endif // FMP_EPAY_H
......@@ -49,12 +49,12 @@ public:
}
QWidget * createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const Q_DECL_OVERRIDE
{
return 0;
}
// QWidget * createEditor(QWidget *parent,
// const QStyleOptionViewItem &option,
// const QModelIndex &index) const Q_DECL_OVERRIDE
// {
// return 0;
// }
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
......
......@@ -5,7 +5,7 @@
#define FMP_EPAY_VER "ver"
#define FMP_EPAY_CLIENTREQCOUNT "clientReqCount"
#define FMP_EPAY_BUSINESSDATE "business_date"
#define FMP_EPAY_OPERATORID "operator_id"
#define FMP_EPAY_OPERATORID "operator_id"
#define FMP_EPAY_REQUESTTYPE "reqtype"
#define FMP_EPAY_STATIONID "station_id"
#define FMP_EPAY_STOREID "store_id"
......@@ -13,6 +13,7 @@
#define FMP_EPAY_TRANSTRACTION "transactions"
#define FMP_EPAY_TRANSTRACTION_AMOUNT "amount"
#define FMP_EPAY_TRANSTRACTION_CODE "code"
#define FMP_EPAY_ANIMATION "needanimation"
//支付返回
#define FMP_RPAY_PAY_RETURN_PAYID "pay_id"
......
#ifndef FMP_EPAY_I_H
#define FMP_EPAY_I_H
#include <fmp_plugin_i.h>
/**
* 业务插件接口,必须继承自 FMPluginInterface
* @brief The FMPePayInterface class
*/
class FMPePayInterface : public FMPluginInterface
{
public:
explicit FMPePayInterface(ctkPluginContext *ctx) : FMPluginInterface(ctx) {}
virtual int Pay() = 0;
// /**
// * @brief ShowPayDialog
// * 呈现支付主界面
// * @return
// */
// virtual int ShowPayDialog() = 0;
// /**
// * @brief ControlPayJson
// * 获取发送支付请求
// * @param sum
// * @param code
// */
// virtual void ControlPayJson(QString sum, QString code) = 0;
// /**
// * @brief ControlRefundJson
// * 获取发送退款请求
// * @param sum
// * @param code(fmID/pay_transId)
// */
// virtual void ControlRefundJson(QString sum, QString code) = 0;
// /**
// * @brief ControlReverseJson
// * 冲正
// */
// virtual void ControlReverseJson() = 0;
};
Q_DECLARE_INTERFACE(FMPePayInterface, "com.fmp.epay")
#endif // FMP_LOGGER_I_H
#ifndef FMP_EPAY_I_H
#define FMP_EPAY_I_H
#include <fmp_plugin_i.h>
/**
* 业务插件接口,必须继承自 FMPluginInterface
* @brief The FMPePayInterface class
*/
class FMPePayInterface : public FMPluginInterface
{
public:
explicit FMPePayInterface(ctkPluginContext *ctx) : FMPluginInterface(ctx) {}
virtual int Pay() = 0;
// /**
// * @brief ShowPayDialog
// * 呈现支付主界面
// * @return
// */
// virtual int ShowPayDialog() = 0;
// /**
// * @brief ControlPayJson
// * 获取发送支付请求
// * @param sum
// * @param code
// */
// virtual void ControlPayJson(QString sum, QString code) = 0;
// /**
// * @brief ControlRefundJson
// * 获取发送退款请求
// * @param sum
// * @param code(fmID/pay_transId)
// */
// virtual void ControlRefundJson(QString sum, QString code) = 0;
// /**
// * @brief ControlReverseJson
// * 冲正
// */
// virtual void ControlReverseJson() = 0;
};
Q_DECLARE_INTERFACE(FMPePayInterface, "com.fmp.epay")
#endif // FMP_LOGGER_I_H
#ifndef FMP_EPAY_P_H
#define FMP_EPAY_P_H
#include "fmp_epay.h"
#include <QObject>
#include <QFuture>
#include <QJsonObject>
class FMPPayDialog;
class FMPSettingsInterface;
class FMPLoggerInterface;
class FMPNetworkInterface;
class FMPDataBase;
class QSqlTableModel;
class FMPePayPrivate : public QObject
{
Q_OBJECT
Q_DECLARE_PUBLIC(FMPePay)
public:
explicit FMPePayPrivate(FMPePay* parent);
~FMPePayPrivate();
int StopService();
int Pay();
void ControlPayJson(QString sum, QString code);
void ControlRefundJson(QString sum, QString code);
void GetCheckMode(QString sum);
void GetMode();
QSqlTableModel *model() const;
private:
void ControlReverseJson();
bool GetRefundJson(const QString &sum, const QString &code, QString ebcode, QString transid);
void GetReverseJson();
bool GetPayJson(const QString &sum, const QString &code);
bool HttpPost(QJsonObject& outjson, QJsonObject json, QString &error, int timeout = 60);
bool CheckReturnJson(QByteArray data, QJsonObject &returnjson);
void SetBasicInfo(QVariantHash hash);
void clearorder();
signals:
void showPayWnd();
void error(QString errormsg);
void finished(QJsonObject json);
public slots:
void onShowPayWnd();
void witedata();
public:
FMPePay *q_ptr;
FMPPayDialog *_payDialog;
FMPSettingsInterface *_setting;
FMPLoggerInterface *_logger;
FMPNetworkInterface *_network;
private:
QJsonObject _current_json;
bool _reverse_flag;
static unsigned int s_ClientReqCount;
FMPDataBase *_db;
QSqlTableModel *_model;
QFutureWatcher<QByteArray> *_watcher;
void HttpPost(const QString &url, const QByteArray &data, QFutureWatcher<QByteArray> *furture, int timeout = 10);
};
#endif // FMP_EPAY_P_H
#ifndef FMP_EPAY_P_H
#define FMP_EPAY_P_H
#include "fmp_epay.h"
#include <QObject>
#include <QFuture>
#include <QJsonObject>
class FMPPayDialog;
class FMPSettingsInterface;
class FMPLoggerInterface;
class FMPNetworkInterface;
class FMPDataBase;
class QSqlTableModel;
class FMPePayPrivate : public QObject
{
Q_OBJECT
Q_DECLARE_PUBLIC(FMPePay)
public:
explicit FMPePayPrivate(FMPePay* parent);
~FMPePayPrivate();
int StopService();
int Pay();
void ControlPayJson(QString sum, QString code);
void ControlRefundJson(QString sum, QString code);
void GetCheckMode(QString sum);
void GetMode();
QSqlTableModel *model() const;
private:
void ControlReverseJson();
bool GetRefundJson(const QString &sum, const QString &code, QString ebcode, QString transid);
void GetReverseJson();
bool GetPayJson(const QString &sum, const QString &code);
bool HttpPost(QJsonObject& outjson, QJsonObject json, QString &error, int timeout = 60);
bool CheckReturnJson(QByteArray data, QJsonObject &returnjson);
void SetBasicInfo(QVariantHash hash);
void clearorder();
signals:
void showPayWnd();
void error(QString errormsg);
void finished(QJsonObject json);
public slots:
void onShowPayWnd();
void witedata();
public:
FMPePay *q_ptr;
FMPPayDialog *_payDialog;
FMPSettingsInterface *_setting;
FMPLoggerInterface *_logger;
FMPNetworkInterface *_network;
private:
QJsonObject _current_json;
bool _reverse_flag;
static unsigned int s_ClientReqCount;
FMPDataBase *_db;
QSqlTableModel *_model;
QFutureWatcher<QByteArray> *_watcher;
void HttpPost(const QString &url, const QByteArray &data, QFutureWatcher<QByteArray> *furture, int timeout = 10);
};
#endif // FMP_EPAY_P_H
/*=============================================================================
Library: CTK
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include "fmp_epay_plugin_p.h"
#include "fmp_epay.h"
#include <QtPlugin>
#include <QStringList>
#include <QDebug>
FMPePayPlugin::FMPePayPlugin()
: _epay_service(0)
{
}
void FMPePayPlugin::start(ctkPluginContext* context)
{
_epay_service = new FMPePay(context);
context->registerService<FMPePayInterface>( _epay_service);
}
void FMPePayPlugin::stop(ctkPluginContext* context)
{
Q_UNUSED(context)
if (_epay_service)
{
delete _epay_service;
_epay_service = 0;
}
}
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
Q_EXPORT_PLUGIN2(fmp_epay, FMPePayPlugin)
#endif
/*=============================================================================
Library: CTK
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=============================================================================*/
#include "fmp_epay_plugin_p.h"
#include "fmp_epay.h"
#include <QtPlugin>
#include <QStringList>
#include <QDebug>
FMPePayPlugin::FMPePayPlugin()
: _epay_service(0)
{
}
void FMPePayPlugin::start(ctkPluginContext* context)
{
_epay_service = new FMPePay(context);
context->registerService<FMPePayInterface>( _epay_service);
}
void FMPePayPlugin::stop(ctkPluginContext* context)
{
Q_UNUSED(context)
if (_epay_service)
{
delete _epay_service;
_epay_service = 0;
}
}
#if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
Q_EXPORT_PLUGIN2(fmp_epay, FMPePayPlugin)
#endif
#ifndef FMP_EPAY_PLUGIN_P_H
#define FMP_EPAY_PLUGIN_P_H
#include <ctkPluginActivator.h>
class FMPePay;
class FMPePayPlugin : public QObject, public ctkPluginActivator
{
Q_OBJECT
Q_INTERFACES(ctkPluginActivator)
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
Q_PLUGIN_METADATA(IID "com_fmp_epay")
#endif
public:
explicit FMPePayPlugin();
void start(ctkPluginContext* context);
void stop(ctkPluginContext* context);
private:
FMPePay* _epay_service;
}; // FMPePayPlugin
#endif // FMP_EPAY_PLUGIN_P_H
#ifndef FMP_EPAY_PLUGIN_P_H
#define FMP_EPAY_PLUGIN_P_H
#include <ctkPluginActivator.h>
class FMPePay;
class FMPePayPlugin : public QObject, public ctkPluginActivator
{
Q_OBJECT
Q_INTERFACES(ctkPluginActivator)
#if (QT_VERSION > QT_VERSION_CHECK(5,0,0))
Q_PLUGIN_METADATA(IID "com_fmp_epay")
#endif
public:
explicit FMPePayPlugin();
void start(ctkPluginContext* context);
void stop(ctkPluginContext* context);
private:
FMPePay* _epay_service;
}; // FMPePayPlugin
#endif // FMP_EPAY_PLUGIN_P_H
#ifndef DIALOG_H
#define DIALOG_H
#include <QJsonObject>
#include <QJsonArray>
#include <QVariantHash>
#include <QJsonDocument>
#include <QModelIndex>
#include <QDateTime>
#include <QTimer>
#include <QDialog>
#include <QLineEdit>
#include "fmp_epayview_wait.h"
#include "fmp_epayview_focuslineedit.h"
class FMPePayPrivate;
class FMPLoggerInterface;
namespace Ui {
class FMPPayDialog;
}
class FMPPayDialog : public QDialog
{
Q_OBJECT
typedef enum
{
TopToBtm = 0,
BtmToTop,
LeftToRight,
RightToLeft
} Movemode;
public:
explicit FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger, QVariantHash basicinfo, QWidget *parent = 0);
~FMPPayDialog();
public slots:
void showErrorMsg(QString errormsg);
void showSuccessMsg(QJsonObject json);
void onSelectionChanged(QModelIndex idx);
void setBasicInfo(QVariantHash basicinfo);
protected:
void keyPressEvent(QKeyEvent *);
void mousePressEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *);
private slots:
void onWidgetChange();
void onBtnNumClicked();
void onBtnConfirmClicked();
void on_btn_backspace_clicked();
void on_btn_clear_clicked();
void on_btn_close_clicked();
void onLineeditCodeGetFocus();
void on_btn_success_confirm_clicked();
void on_btn_paycheck_clicked();
void on_pushButton_2_clicked();
void on_btn_clear_refund_clicked();
void on_btn_backspace_refund_clicked();
private:
void setPayView();
void setRefundView();
void setCheckView();
void setPaySuccessView(QJsonObject json);
void setRefundSuccessView(QJsonObject json);
bool CheckLineEditSum(QString sum);
bool CheckLineEditCode(QString code);
//-----------
void PlayAnimation(QWidget* target0, QWidget* target1, Movemode movemode);
private:
Ui::FMPPayDialog *ui;
FMPFocusLineEdit *_current_LineEdit;
FMPePayPrivate *_control;
FMPPayWait *_wait;
FMPLoggerInterface *_logger;
//----------
QPushButton* _curt_btn;
bool _success_flag;
bool _is_amt;
bool _b_mouse_pressed;
QPoint _mMovePosition;
};
#endif // DIALOG_H
#ifndef DIALOG_H
#define DIALOG_H
#include <QJsonObject>
#include <QJsonArray>
#include <QVariantHash>
#include <QJsonDocument>
#include <QModelIndex>
#include <QDateTime>
#include <QTimer>
#include <QDialog>
#include <QLineEdit>
#include "fmp_epayview_wait.h"
#include "fmp_epayview_focuslineedit.h"
class FMPePayPrivate;
class FMPLoggerInterface;
namespace Ui {
class FMPPayDialog;
}
class FMPPayDialog : public QDialog
{
Q_OBJECT
typedef enum
{
TopToBtm = 0,
BtmToTop,
LeftToRight,
RightToLeft
} Movemode;
public:
explicit FMPPayDialog(FMPePayPrivate *control, FMPLoggerInterface *logger, QVariantHash basicinfo, QWidget *parent = 0);
~FMPPayDialog();
public slots:
void showErrorMsg(QString errormsg);
void showSuccessMsg(QJsonObject json);
void onSelectionChanged(QModelIndex idx);
void setBasicInfo(QVariantHash basicinfo);
protected:
void keyPressEvent(QKeyEvent *);
void mousePressEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *);
private slots:
void onWidgetChange();
void onBtnNumClicked();
void onBtnConfirmClicked();
void on_btn_backspace_clicked();
void on_btn_clear_clicked();
void on_btn_close_clicked();
void onLineeditCodeGetFocus();
void on_btn_success_confirm_clicked();
void on_btn_paycheck_clicked();
void on_pushButton_2_clicked();
void on_btn_clear_refund_clicked();
void on_btn_backspace_refund_clicked();
void on_lineEdit_textChanged(const QString &arg1);
private:
void setPayView();
void setRefundView();
void setCheckView();
void setPaySuccessView(QJsonObject json);
void setRefundSuccessView(QJsonObject json);
bool CheckLineEditSum(QString sum);
bool CheckLineEditCode(QString code);
//-----------
void PlayAnimation(QWidget* target0, QWidget* target1, Movemode movemode);
private:
Ui::FMPPayDialog *ui;
FMPFocusLineEdit *_current_LineEdit;
FMPePayPrivate *_control;
FMPPayWait *_wait;
FMPLoggerInterface *_logger;
//----------
QPushButton* _curt_btn;
bool _success_flag;
bool _is_amt;
bool _needanimation;
bool _b_mouse_pressed;
QPoint _mMovePosition;
};
#endif // DIALOG_H
This source diff could not be displayed because it is too large. You can view the blob instead.
#include "fmp_epayview_wait.h"
#include "fmp_epayview_dialog.h"
#include "ui_fmp_epayview_wait.h"
FMPPayWait::FMPPayWait(QWidget *parent) : QDialog(parent), ui(new Ui::FMPPayWait)
{
ui->setupUi(this);
setAttribute(Qt::WA_TranslucentBackground);
ui->widget->setWindowOpacity(1);
setGeometry(parent->geometry());
this->move(parent->pos());
setWindowFlags(Qt::FramelessWindowHint| Qt::Tool );
connect(ui->btn_confirm, &QPushButton::clicked, this, &FMPPayWait::accept);
qRegisterMetaType<FMPPayWait::Type>("FMPPayWait::Type");
//setStyleSheet("QWidget#mainWdg{background:rgba(110,110,110,0.5)}");
}
FMPPayWait::~FMPPayWait()
{
delete ui;
}
void FMPPayWait::SetContent(FMPPayWait::Type type, const QString &msg)
{
switch (type) {
case FMPPayWait::SUCCESS:
ui->btn_confirm->setVisible(true);
ui->label_logo->setStyleSheet("#label_logo {background: url(:/img/loading.png) center no-repeat;}");
break;
case FMPPayWait::ERROR:
ui->btn_confirm->setVisible(true);
ui->label_logo->setStyleSheet("#label_logo {background: url(:/img/fmclient-icon_payment_fail.png) center no-repeat;}");
break;
case FMPPayWait::LOADING:
ui->label_logo->setStyleSheet("#label_logo {background: url(:/img/loading.png) center no-repeat;}");
ui->btn_confirm->setVisible(false);
break;
default:
ui->btn_confirm->setVisible(true);
ui->label_logo->setStyleSheet("#label_logo {background: url(:/img/loading.png) center no-repeat;}");
break;
}
ui->label_msg->setText(msg);
}
#include "fmp_epayview_wait.h"
#include "fmp_epayview_dialog.h"
#include "ui_fmp_epayview_wait.h"
FMPPayWait::FMPPayWait(QWidget *parent) : QDialog(parent), ui(new Ui::FMPPayWait)
{
ui->setupUi(this);
setAttribute(Qt::WA_TranslucentBackground);
ui->widget->setWindowOpacity(1);
setGeometry(parent->geometry());
this->move(parent->pos());
setWindowFlags(Qt::FramelessWindowHint| Qt::Tool );
connect(ui->btn_confirm, &QPushButton::clicked, this, &FMPPayWait::accept);
qRegisterMetaType<FMPPayWait::Type>("FMPPayWait::Type");
//setStyleSheet("QWidget#mainWdg{background:rgba(110,110,110,0.5)}");
}
FMPPayWait::~FMPPayWait()
{
delete ui;
}
void FMPPayWait::SetContent(FMPPayWait::Type type, const QString &msg)
{
switch (type) {
case FMPPayWait::SUCCESS:
ui->btn_confirm->setVisible(true);
ui->label_logo->setStyleSheet("#label_logo {background: url(:/img/loading.png) center no-repeat;}");
break;
case FMPPayWait::ERROR:
ui->btn_confirm->setVisible(true);
ui->label_logo->setStyleSheet("#label_logo {background: url(:/img/fmclient-icon_payment_fail.png) center no-repeat;}");
break;
case FMPPayWait::LOADING:
ui->label_logo->setStyleSheet("#label_logo {background: url(:/img/loading.png) center no-repeat;}");
ui->btn_confirm->setVisible(false);
break;
default:
ui->btn_confirm->setVisible(true);
ui->label_logo->setStyleSheet("#label_logo {background: url(:/img/loading.png) center no-repeat;}");
break;
}
ui->label_msg->setText(msg);
}
#ifndef WAITDIALOG_H
#define WAITDIALOG_H
#include <QDialog>
namespace Ui {
class FMPPayWait;
}
class FMPPayWait : public QDialog
{
Q_OBJECT
public:
explicit FMPPayWait(QWidget *parent = 0);
~FMPPayWait();
typedef enum
{
SUCCESS=0,
ERROR,
LOADING
}Type;
void SetContent(FMPPayWait::Type type, const QString& msg);
private:
Ui::FMPPayWait *ui;
};
#endif // WAITDIALOG_H
#ifndef WAITDIALOG_H
#define WAITDIALOG_H
#include <QDialog>
namespace Ui {
class FMPPayWait;
}
class FMPPayWait : public QDialog
{
Q_OBJECT
public:
explicit FMPPayWait(QWidget *parent = 0);
~FMPPayWait();
typedef enum
{
SUCCESS=0,
ERROR,
LOADING
}Type;
void SetContent(FMPPayWait::Type type, const QString& msg);
private:
Ui::FMPPayWait *ui;
};
#endif // WAITDIALOG_H
#include <fmp_logger_i.h>
#include "fmp_pe_handlers.h"
#include "fmp_epay.h"
FMPStartEventHandler::FMPStartEventHandler(ctkPluginContext *ctx, FMPePay *epay)
: FMPePayEventHandler(FMP_TOPICS_SERVICES FMPE_SERVICE_ACK_START "/"
+ QString::number(ctx->getPlugin()->getPluginId()), epay),
_ctx(ctx)
{
FMPProps props;
props[ctkEventConstants::EVENT_TOPIC] = _topic;
_ctx->registerService<ctkEventHandler>(this, props);
}
void FMPStartEventHandler::handleEvent(const ctkEvent &event)
{
if (_epay) {
if (event.getProperty(FMP_PROPKEY_AGREED).toBool()) {
// _epay->UpgradeOldPlugins(event.getProperty(FMP_PROPKEY_PID_LIST).toList());
_epay->Pay();
}
else {
FMP_WARN_CTX(_ctx) << "Refused start request" << event.getTopic();
}
}
else {
FMP_DEBUG_CTX(_ctx) << "No handler instance for event" << event.getTopic();
}
}
FMPNetWorkEventHandler::FMPNetWorkEventHandler(ctkPluginContext *ctx, FMPePay *epay)
: FMPePayEventHandler(FMP_TOPICS_SERVICES FMPE_SERVICE_ACK_START "/"
+ QString::number(ctx->getPlugin()->getPluginId()), epay),
_ctx(ctx)
{
FMPProps props;
props[ctkEventConstants::EVENT_TOPIC] = _topic;
_ctx->registerService<ctkEventHandler>(this, props);
}
void FMPNetWorkEventHandler::handleEvent(const ctkEvent &event)
{
if (_epay) {
if (event.getProperty(FMP_PROPKEY_AGREED).toBool()) {
_epay->Pay();
}
else {
FMP_WARN_CTX(_ctx) << "Refused start request" << event.getTopic();
}
}
else {
FMP_DEBUG_CTX(_ctx) << "No handler instance for event" << event.getTopic();
}
}
#include <fmp_logger_i.h>
#include "fmp_pe_handlers.h"
#include "fmp_epay.h"
FMPStartEventHandler::FMPStartEventHandler(ctkPluginContext *ctx, FMPePay *epay)
: FMPePayEventHandler(FMP_TOPICS_SERVICES FMPE_SERVICE_ACK_START "/"
+ QString::number(ctx->getPlugin()->getPluginId()), epay),
_ctx(ctx)
{
FMPProps props;
props[ctkEventConstants::EVENT_TOPIC] = _topic;
_ctx->registerService<ctkEventHandler>(this, props);
}
void FMPStartEventHandler::handleEvent(const ctkEvent &event)
{
if (_epay) {
if (event.getProperty(FMP_PROPKEY_AGREED).toBool()) {
// _epay->UpgradeOldPlugins(event.getProperty(FMP_PROPKEY_PID_LIST).toList());
_epay->Pay();
}
else {
FMP_WARN_CTX(_ctx) << "Refused start request" << event.getTopic();
}
}
else {
FMP_DEBUG_CTX(_ctx) << "No handler instance for event" << event.getTopic();
}
}
FMPNetWorkEventHandler::FMPNetWorkEventHandler(ctkPluginContext *ctx, FMPePay *epay)
: FMPePayEventHandler(FMP_TOPICS_SERVICES FMPE_SERVICE_ACK_START "/"
+ QString::number(ctx->getPlugin()->getPluginId()), epay),
_ctx(ctx)
{
FMPProps props;
props[ctkEventConstants::EVENT_TOPIC] = _topic;
_ctx->registerService<ctkEventHandler>(this, props);
}
void FMPNetWorkEventHandler::handleEvent(const ctkEvent &event)
{
if (_epay) {
if (event.getProperty(FMP_PROPKEY_AGREED).toBool()) {
_epay->Pay();
}
else {
FMP_WARN_CTX(_ctx) << "Refused start request" << event.getTopic();
}
}
else {
FMP_DEBUG_CTX(_ctx) << "No handler instance for event" << event.getTopic();
}
}
#ifndef FMP_MANAGER_EVENT_HANDLERS_H
#define FMP_MANAGER_EVENT_HANDLERS_H
#include <QObject>
#include <service/event/ctkEventConstants.h>
#include <service/event/ctkEventHandler.h>
class FMPePay;
class FMPePayEventHandler : public ctkEventHandler
{
public:
explicit FMPePayEventHandler(const QString &topic, FMPePay *epay) : _epay(epay), _topic(topic) {}
protected:
FMPePay* _epay;
const QString _topic;
};
/**
* 升级事件处理类
* @brief The FMPUpgradeEventHandler class
*/
class FMPStartEventHandler : public QObject, public FMPePayEventHandler
{
Q_OBJECT
Q_INTERFACES(ctkEventHandler)
public:
explicit FMPStartEventHandler(ctkPluginContext *ctx, FMPePay *epay);
void handleEvent(const ctkEvent &event);
private:
ctkPluginContext* _ctx;
};
/**
* 升级事件处理类(网络)
* @brief TheNetWorkFMPUpgradeEventHandler class
*/
class FMPNetWorkEventHandler : public QObject, public FMPePayEventHandler
{
Q_OBJECT
Q_INTERFACES(ctkEventHandler)
public:
explicit FMPNetWorkEventHandler(ctkPluginContext *ctx, FMPePay *epay);
void handleEvent(const ctkEvent &event);
private:
ctkPluginContext* _ctx;
};
#endif // FMP_MANAGER_EVENT_HANDLERS_H
#ifndef FMP_MANAGER_EVENT_HANDLERS_H
#define FMP_MANAGER_EVENT_HANDLERS_H
#include <QObject>
#include <service/event/ctkEventConstants.h>
#include <service/event/ctkEventHandler.h>
class FMPePay;
class FMPePayEventHandler : public ctkEventHandler
{
public:
explicit FMPePayEventHandler(const QString &topic, FMPePay *epay) : _epay(epay), _topic(topic) {}
protected:
FMPePay* _epay;
const QString _topic;
};
/**
* 升级事件处理类
* @brief The FMPUpgradeEventHandler class
*/
class FMPStartEventHandler : public QObject, public FMPePayEventHandler
{
Q_OBJECT
Q_INTERFACES(ctkEventHandler)
public:
explicit FMPStartEventHandler(ctkPluginContext *ctx, FMPePay *epay);
void handleEvent(const ctkEvent &event);
private:
ctkPluginContext* _ctx;
};
/**
* 升级事件处理类(网络)
* @brief TheNetWorkFMPUpgradeEventHandler class
*/
class FMPNetWorkEventHandler : public QObject, public FMPePayEventHandler
{
Q_OBJECT
Q_INTERFACES(ctkEventHandler)
public:
explicit FMPNetWorkEventHandler(ctkPluginContext *ctx, FMPePay *epay);
void handleEvent(const ctkEvent &event);
private:
ctkPluginContext* _ctx;
};
#endif // FMP_MANAGER_EVENT_HANDLERS_H
<RCC>
<qresource prefix="/">
<file>img/fmclient-icon_payment_back.png</file>
<file>img/fmclient-icon_payment_delete.png</file>
<file>img/fmclient-icon_payment_fail.png</file>
<file>img/fmclient-icon_payment_s1.png</file>
<file>img/fmclient-icon_payment_s2.png</file>
<file>img/fmclient-icon_payment_success.png</file>
<file>img/fmclient-icon_payment_t1.png</file>
<file>img/fmclient-icon_payment_t2.png</file>
<file>img/fm-icon_close_02.png</file>
<file>img/loading.png</file>
<file>img/check0.png</file>
<file>img/check1.png</file>
<file>img/dlt01.png</file>
<file>img/dlt02.png</file>
<file>img/dot01.png</file>
<file>img/dot02.png</file>
</qresource>
</RCC>
<RCC>
<qresource prefix="/">
<file>img/fmclient-icon_payment_back.png</file>
<file>img/fmclient-icon_payment_delete.png</file>
<file>img/fmclient-icon_payment_fail.png</file>
<file>img/fmclient-icon_payment_s1.png</file>
<file>img/fmclient-icon_payment_s2.png</file>
<file>img/fmclient-icon_payment_success.png</file>
<file>img/fmclient-icon_payment_t1.png</file>
<file>img/fmclient-icon_payment_t2.png</file>
<file>img/fm-icon_close_02.png</file>
<file>img/loading.png</file>
<file>img/check0.png</file>
<file>img/check1.png</file>
<file>img/dlt01.png</file>
<file>img/dlt02.png</file>
<file>img/dot01.png</file>
<file>img/dot02.png</file>
</qresource>
</RCC>
......@@ -5,7 +5,7 @@
#define VER_MINOR 1
#define VER_REVISION 0
#define VER_BUILD 35
#define VER_BUILD 11
//! Convert version numbers to string
#define _STR(S) #S
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment