130 lines
3.4 KiB
C++
130 lines
3.4 KiB
C++
#ifndef IMAGEVIEWER_H
|
|
#define IMAGEVIEWER_H
|
|
|
|
#include <QMainWindow>
|
|
#include <QTimer>
|
|
#include <QSpinBox>
|
|
#include <QCheckBox>
|
|
#include <QSettings>
|
|
|
|
#include "pylonwrapper.h"
|
|
#include "imagebuffer.h"
|
|
#include "grabber.h"
|
|
#include "writer.h"
|
|
#include "projectsettings.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 displayActivity();
|
|
void writerDone();
|
|
void selectStorageLocation();
|
|
|
|
private:
|
|
void createActions();
|
|
void updateActions();
|
|
void applySettings();
|
|
void storeSettings();
|
|
void editProjectMetadata();
|
|
void setExperimentName();
|
|
void setExperimenterName();
|
|
void setSubjectID();
|
|
QColor progressColor(int value);
|
|
std::string createFilename();
|
|
|
|
bool saveFile(const QString &fileName);
|
|
void setImage(const QImage &newImage);
|
|
void scaleImage(double factor);
|
|
void applyScaling();
|
|
void adjustScrollBar(QScrollBar *scrollBar, double factor);
|
|
|
|
int defaultBufferSize = 3000, defaultFrameRate = 30, movieCount = 0, defaultExposureTime = 6000, defaultGain=13;
|
|
QSettings *settings = new QSettings;
|
|
QImage image;
|
|
QTimer *frameTimer, *preassureTimer, *labelTimer;
|
|
QLabel *imageLabel, *writingLabel, *grabbingLabel, *cameraConnectedLabel, *fileLabel;
|
|
QCheckBox *dryRunCheckBox;
|
|
QProgressBar *preassureBar;
|
|
QProgressBar *loadBar;
|
|
QScrollArea *scrollArea;
|
|
double scaleFactor = 1;
|
|
PylonWrapper *pylon;
|
|
ImageBuffer *buffer;
|
|
Grabber *grabber;
|
|
Writer *writer;
|
|
bool grabbing, stopRequest, writing, labelSwitch, dryRun;
|
|
QPalette progressPalette;
|
|
QString activeLabelStyleHigh = "QLabel { font-size: 10pt;font-family: Arial; color : red; }";
|
|
QString activeLabelStyleLow = "QLabel { font-size: 10pt;font-family: Arial; color : cmyk(0, 255, 255, 0, 50); }";
|
|
QString inactiveLabelStyle = ("QLabel { font-size: 10pt;font-family: Arial; color :gray; }");
|
|
QSpinBox *framerateSpinner, *buffersizeSpinner, *exposureSpinner, *gainSpinner;
|
|
QAction *selectStorageAction, *storeSettingsAction;
|
|
QAction *projectSettingsAction;
|
|
QString storageLocation = "";
|
|
ProjectMetadata mdata;
|
|
|
|
#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
|