|
@@ -0,0 +1,54 @@
|
|
|
|
+#include "mainwindow.h"
|
|
|
|
+#include "ui_mainwindow.h"
|
|
|
|
+#include <QImage>
|
|
|
|
+#include <iostream>
|
|
|
|
+
|
|
|
|
+QImage ximage;
|
|
|
|
+MainWindow * mw;
|
|
|
|
+
|
|
|
|
+char * gbuffer;
|
|
|
|
+void ListenImage(const char * strdata,const unsigned int nSize,const unsigned int index,const QDateTime * dt,const char * strmemname)
|
|
|
|
+{
|
|
|
|
+ std::cout<<nSize<<std::endl;
|
|
|
|
+ if(nSize<1) return;
|
|
|
|
+ if(nSize >= 640000)
|
|
|
|
+ {
|
|
|
|
+ memcpy(gbuffer,strdata,640000);
|
|
|
|
+ }
|
|
|
|
+ mw->newimage();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+void MainWindow::UpdateImage(const char *strdata, const unsigned int nSize, const unsigned int index, const QDateTime *dt, const char *strmemname)
|
|
|
|
+{
|
|
|
|
+ if(nSize >= 640000)
|
|
|
|
+ {
|
|
|
|
+ ximage = QImage ((uchar*)strdata,200,800,QImage::Format_ARGB32);
|
|
|
|
+ ui->label->setPixmap(QPixmap::fromImage(ximage));
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void MainWindow::newimage()
|
|
|
|
+{
|
|
|
|
+ emit updateimage();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void MainWindow::drawimage()
|
|
|
|
+{
|
|
|
|
+ ximage = QImage ((uchar*)gbuffer,200,800,QImage::Format_ARGB32);
|
|
|
|
+ ui->label->setPixmap(QPixmap::fromImage(ximage));
|
|
|
|
+}
|
|
|
|
+MainWindow::MainWindow(QWidget *parent) :
|
|
|
|
+ QMainWindow(parent),
|
|
|
|
+ ui(new Ui::MainWindow)
|
|
|
|
+{
|
|
|
|
+ ui->setupUi(this);
|
|
|
|
+ gbuffer = new char[640000];
|
|
|
|
+ ModuleFun funradar =std::bind(&MainWindow::UpdateImage,this,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3,std::placeholders::_4,std::placeholders::_5);
|
|
|
|
+ void * pa = iv::modulecomm::RegisterRecvPlus("drg_image",funradar);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+MainWindow::~MainWindow()
|
|
|
|
+{
|
|
|
|
+ delete ui;
|
|
|
|
+}
|