107 lines
2.2 KiB
C++
107 lines
2.2 KiB
C++
#ifndef IMAGEVIEWER_H
|
|
#define IMAGEVIEWER_H
|
|
|
|
#include <QMainWindow>
|
|
#include <QTimer>
|
|
#include "pylonwrapper.h"
|
|
#include "imagebuffer.h"
|
|
#include "grabber.h"
|
|
#include "writer.h"
|
|
|
|
#include <QImage>
|
|
#if defined(QT_PRINTSUPPORT_LIB)
|
|
# include <QtPrintSupport/qtprintsupportglobal.h>
|
|
|
|
# if QT_CONFIG(printer)
|
|
# include <QPrinter>
|
|
#include <QProgressBar>
|
|
# endif
|
|
#endif
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
class QAction;
|
|
class QLabel;
|
|
class QMenu;
|
|
class QScrollArea;
|
|
class QScrollBar;
|
|
QT_END_NAMESPACE
|
|
|
|
//! [0]
|
|
class PylonRecorder : public QMainWindow
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
PylonRecorder(QWidget *parent = nullptr);
|
|
~PylonRecorder();
|
|
|
|
bool loadFile(const QString &);
|
|
|
|
private slots:
|
|
void grabStillFromPylon();
|
|
void open();
|
|
void saveAs();
|
|
void print();
|
|
void copy();
|
|
void paste();
|
|
void zoomIn();
|
|
void zoomOut();
|
|
void normalSize();
|
|
void fitToWindow();
|
|
void about();
|
|
void connectCamera();
|
|
void disconnectCamera();
|
|
void startRecording();
|
|
void stopRecording();
|
|
void quitApplication();
|
|
void displaySingleFrame();
|
|
void displayBufferPreassure();
|
|
void writerDone();
|
|
|
|
private:
|
|
void createActions();
|
|
void createMenus();
|
|
void createToolBar();
|
|
void updateActions();
|
|
QColor progressColor(int value);
|
|
|
|
bool saveFile(const QString &fileName);
|
|
void setImage(const QImage &newImage);
|
|
void scaleImage(double factor);
|
|
void adjustScrollBar(QScrollBar *scrollBar, double factor);
|
|
|
|
QImage image;
|
|
QTimer *frameTimer;
|
|
QTimer *preassureTimer;
|
|
QLabel *imageLabel;
|
|
QProgressBar *preassureBar;
|
|
QProgressBar *loadBar;
|
|
QScrollArea *scrollArea;
|
|
double scaleFactor = 1;
|
|
PylonWrapper *pylon;
|
|
ImageBuffer *buffer;
|
|
Grabber *grabber;
|
|
Writer *writer;
|
|
bool grabbing;
|
|
QPalette progressPalette;
|
|
|
|
#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printer)
|
|
QPrinter printer;
|
|
#endif
|
|
|
|
QAction *saveAsAct;
|
|
QAction *printAct;
|
|
QAction *copyAct;
|
|
QAction *zoomInAct;
|
|
QAction *zoomOutAct;
|
|
QAction *normalSizeAct;
|
|
QAction *fitToWindowAct;
|
|
QAction *grab_still_action;
|
|
QAction *grab_continuous_action;
|
|
QAction *grab_stop_action;
|
|
QAction *connect_camera_action;
|
|
QAction *disconnect_camera_action;
|
|
};
|
|
|
|
#endif
|