mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-22 18:04:59 -05:00
The "core" macro conditions and actions have been extracted out to the "base" plugin. The library now mostly contains functionality which is required across all plugins and (e.g. definitions for macro segments). The goal is to reduce the complexity and cross-dependencies and group the source files in a better way. This should relsove the "library limit of 65535 objects exceeded" build issue occuring in some Windows build environments.
105 lines
2.5 KiB
C++
105 lines
2.5 KiB
C++
#pragma once
|
|
#include "paramerter-wrappers.hpp"
|
|
|
|
#include <QDialog>
|
|
#include <QLabel>
|
|
#include <QScrollArea>
|
|
#include <QThread>
|
|
#include <QMouseEvent>
|
|
#include <QRubberBand>
|
|
#include <QPoint>
|
|
#include <mutex>
|
|
|
|
namespace advss {
|
|
|
|
enum class PreviewType {
|
|
SHOW_MATCH,
|
|
SELECT_AREA,
|
|
};
|
|
|
|
class PreviewImage : public QObject {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
PreviewImage(std::mutex &);
|
|
|
|
public slots:
|
|
void CreateImage(const VideoInput &, PreviewType,
|
|
const PatternMatchParameters &,
|
|
const PatternImageData &, ObjDetectParameters,
|
|
OCRParameters, const AreaParameters &, VideoCondition);
|
|
signals:
|
|
void ImageReady(const QPixmap &);
|
|
void ValueUpdate(double);
|
|
void StatusUpdate(const QString &);
|
|
|
|
private:
|
|
void MarkMatch(QImage &screenshot, const PatternMatchParameters &,
|
|
const PatternImageData &, ObjDetectParameters &,
|
|
const OCRParameters &, VideoCondition);
|
|
|
|
std::mutex &_mtx;
|
|
};
|
|
|
|
class PreviewDialog : public QDialog {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
PreviewDialog(QWidget *parent);
|
|
virtual ~PreviewDialog();
|
|
void ShowMatch();
|
|
void SelectArea();
|
|
void Stop();
|
|
void closeEvent(QCloseEvent *event) override;
|
|
|
|
public slots:
|
|
void PatternMatchParametersChanged(const PatternMatchParameters &);
|
|
void ObjDetectParametersChanged(const ObjDetectParameters &);
|
|
void OCRParametersChanged(const OCRParameters &);
|
|
void VideoSelectionChanged(const VideoInput &);
|
|
void AreaParametersChanged(const AreaParameters &);
|
|
void ConditionChanged(int cond);
|
|
private slots:
|
|
void UpdateImage(const QPixmap &);
|
|
void UpdateValue(double);
|
|
void UpdateStatus(const QString &);
|
|
signals:
|
|
void SelectionAreaChanged(QRect area);
|
|
void NeedImage(const VideoInput &, PreviewType,
|
|
const PatternMatchParameters &, const PatternImageData &,
|
|
ObjDetectParameters, OCRParameters,
|
|
const AreaParameters &, VideoCondition);
|
|
|
|
private:
|
|
void Start();
|
|
void DrawFrame();
|
|
|
|
void mousePressEvent(QMouseEvent *event);
|
|
void mouseMoveEvent(QMouseEvent *event);
|
|
void mouseReleaseEvent(QMouseEvent *event);
|
|
|
|
VideoInput _video;
|
|
PatternMatchParameters _patternMatchParams;
|
|
PatternImageData _patternImageData;
|
|
ObjDetectParameters _objDetectParams;
|
|
OCRParameters _ocrParams;
|
|
AreaParameters _areaParams;
|
|
|
|
VideoCondition _condition = VideoCondition::PATTERN;
|
|
QScrollArea *_scrollArea;
|
|
QLabel *_valueLabel;
|
|
QLabel *_statusLabel;
|
|
QLabel *_imageLabel;
|
|
|
|
QPoint _origin;
|
|
QRubberBand *_rubberBand = nullptr;
|
|
std::atomic_bool _selectingArea = {false};
|
|
|
|
PreviewType _type = PreviewType::SHOW_MATCH;
|
|
|
|
std::mutex _mtx;
|
|
QThread _thread;
|
|
};
|
|
|
|
} // namespace advss
|