You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.1 KiB
72 lines
2.1 KiB
#include "zqui.hpp"
|
|
|
|
using namespace std;
|
|
#define TAG "ZQUI"
|
|
|
|
/***********************************************************************************************************************
|
|
* PreviewShow *
|
|
***********************************************************************************************************************/
|
|
ZQUI *ZQUI::ins() {
|
|
static ZQUI instance;
|
|
return &instance;
|
|
}
|
|
|
|
void ZQUI::ishow(const char *fmt, ...) {
|
|
va_list args;
|
|
va_start(args, fmt);
|
|
char buf[1024] = {0};
|
|
vsnprintf(buf, sizeof(buf), fmt, args);
|
|
va_end(args);
|
|
QString text(buf);
|
|
if (m_ishow) m_ishow(text);
|
|
}
|
|
|
|
void ZQUI::instructionPreviewClear() {
|
|
if (m_instructionPreviewClear) m_instructionPreviewClear();
|
|
}
|
|
|
|
void ZQUI::rshow(const char *fmt, ...) {
|
|
va_list args;
|
|
va_start(args, fmt);
|
|
char buf[1024] = {0};
|
|
vsnprintf(buf, sizeof(buf), fmt, args);
|
|
va_end(args);
|
|
QString text(buf);
|
|
if (m_reportPreviewShow) m_reportPreviewShow(text);
|
|
}
|
|
|
|
void ZQUI::blockDataUploadPreviewShow(const char *fmt, ...) {
|
|
va_list args;
|
|
va_start(args, fmt);
|
|
char buf[1024] = {0};
|
|
vsnprintf(buf, sizeof(buf), fmt, args);
|
|
va_end(args);
|
|
QString text(buf);
|
|
if (m_blockDataUploadPreviewShow) m_blockDataUploadPreviewShow(text);
|
|
}
|
|
void ZQUI::rawDataPreviewShow(const char *fmt, ...) {
|
|
va_list args;
|
|
va_start(args, fmt);
|
|
char buf[1024] = {0};
|
|
vsnprintf(buf, sizeof(buf), fmt, args);
|
|
va_end(args);
|
|
QString text(buf);
|
|
if (m_rawDataPreviewShow) m_rawDataPreviewShow(text);
|
|
}
|
|
|
|
void ZQUI::initialize() {
|
|
qRegisterMetaType<int32_t>("int32_t");
|
|
qRegisterMetaType<uint32_t>("uint32_t");
|
|
qRegisterMetaType<float>("float");
|
|
qRegisterMetaType<function<void()>>("function<void()>");
|
|
qRegisterMetaType<QFunction>("QFunction");
|
|
connect(this, SIGNAL(doinui_signal(QFunction)), this, SLOT(doinui_slot(QFunction)));
|
|
}
|
|
void ZQUI::doinui(function<void()> dowhat) {
|
|
emit doinui_signal(QFunction([dowhat]() {
|
|
if (dowhat) dowhat();
|
|
}));
|
|
}
|
|
void ZQUI::doinui_slot(QFunction func) {
|
|
if (func.get()) func.get()();
|
|
}
|