re-organize folder structure
This commit is contained in:
18
include/aboutwidget.h
Normal file
18
include/aboutwidget.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef ABOUTWIDGET_H
|
||||
#define ABOUTWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
|
||||
class AboutWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutWidget(QWidget *parent = nullptr);
|
||||
|
||||
private:
|
||||
void setupUI();
|
||||
};
|
||||
|
||||
#endif // ABOUTWIDGET_H
|
||||
88
include/cameracontrolwidget.h
Normal file
88
include/cameracontrolwidget.h
Normal file
@@ -0,0 +1,88 @@
|
||||
#ifndef CAMERACONTROLWIDGET_H
|
||||
#define CAMERACONTROLWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QSlider>
|
||||
#include <QSpinBox>
|
||||
#include <QComboBox>
|
||||
#include <QRadioButton>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QGroupBox>
|
||||
#include "socketclient.h"
|
||||
|
||||
class CameraControlWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CameraControlWidget(SocketClient* socketClient, QWidget *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void onGetFormats();
|
||||
void onSetFormat();
|
||||
void onSetExposure();
|
||||
void onSetWhiteBalance();
|
||||
void onBrightnessChanged(int value);
|
||||
void onContrastChanged(int value);
|
||||
void onSaturationChanged(int value);
|
||||
void onSharpnessChanged(int value);
|
||||
void onGammaChanged(int value);
|
||||
void onGainChanged(int value);
|
||||
void onExposureModeChanged();
|
||||
void onWhiteBalanceModeChanged();
|
||||
|
||||
private:
|
||||
void setupUI();
|
||||
QGroupBox* createFormatGroup();
|
||||
QGroupBox* createExposureGroup();
|
||||
QGroupBox* createWhiteBalanceGroup();
|
||||
QGroupBox* createImageAdjustmentGroup();
|
||||
QWidget* createSliderControl(const QString& label, int min, int max, int defaultValue,
|
||||
QSlider** slider, QSpinBox** spinBox);
|
||||
|
||||
SocketClient* m_socketClient;
|
||||
|
||||
// Format controls
|
||||
QComboBox* m_formatCombo;
|
||||
QPushButton* m_getFormatsBtn;
|
||||
QPushButton* m_setFormatBtn;
|
||||
|
||||
// Exposure controls
|
||||
QRadioButton* m_exposureAuto;
|
||||
QRadioButton* m_exposureManual;
|
||||
QSpinBox* m_exposureValue;
|
||||
QPushButton* m_setExposureBtn;
|
||||
|
||||
// White Balance controls
|
||||
QRadioButton* m_whiteBalanceAuto;
|
||||
QRadioButton* m_whiteBalanceManual;
|
||||
QSpinBox* m_whiteBalanceTemp;
|
||||
QPushButton* m_setWhiteBalanceBtn;
|
||||
|
||||
// Image adjustment controls
|
||||
QSlider* m_brightnessSlider;
|
||||
QSpinBox* m_brightnessSpinBox;
|
||||
|
||||
QSlider* m_contrastSlider;
|
||||
QSpinBox* m_contrastSpinBox;
|
||||
|
||||
QSlider* m_saturationSlider;
|
||||
QSpinBox* m_saturationSpinBox;
|
||||
|
||||
QSlider* m_sharpnessSlider;
|
||||
QSpinBox* m_sharpnessSpinBox;
|
||||
|
||||
QSlider* m_gammaSlider;
|
||||
QSpinBox* m_gammaSpinBox;
|
||||
|
||||
QSlider* m_gainSlider;
|
||||
QSpinBox* m_gainSpinBox;
|
||||
|
||||
// Status display
|
||||
QLabel* m_statusLabel;
|
||||
|
||||
void updateStatus(const QString& status, bool isSuccess);
|
||||
};
|
||||
|
||||
#endif // CAMERACONTROLWIDGET_H
|
||||
46
include/gstreamerpipelinewidget.h
Normal file
46
include/gstreamerpipelinewidget.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef GSTREAMERPIPELINEWIDGET_H
|
||||
#define GSTREAMERPIPELINEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTextEdit>
|
||||
#include <QPushButton>
|
||||
#include <QLabel>
|
||||
#include <QComboBox>
|
||||
#include "socketclient.h"
|
||||
|
||||
class GStreamerPipelineWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit GStreamerPipelineWidget(SocketClient* socketClient, QWidget *parent = nullptr);
|
||||
|
||||
private slots:
|
||||
void onSetPipeline();
|
||||
void onStartStream();
|
||||
void onStopStream();
|
||||
void onGetStatus();
|
||||
void onPipelinePresetChanged(int index);
|
||||
void onQuickStart();
|
||||
void onFormatsReceived(const QJsonObject& response);
|
||||
|
||||
private:
|
||||
void setupUI();
|
||||
void updateStatus(const QString& status, bool streaming);
|
||||
void setFormatAndPipeline();
|
||||
void fetchAvailableFormats();
|
||||
|
||||
SocketClient* m_socketClient;
|
||||
QTextEdit* m_pipelineEdit;
|
||||
QPushButton* m_setPipelineBtn;
|
||||
QPushButton* m_startStreamBtn;
|
||||
QPushButton* m_stopStreamBtn;
|
||||
QPushButton* m_getStatusBtn;
|
||||
QPushButton* m_quickStartBtn;
|
||||
QLabel* m_statusLabel;
|
||||
QLabel* m_infoLabel;
|
||||
QComboBox* m_pipelinePresets;
|
||||
QComboBox* m_formatCombo;
|
||||
};
|
||||
|
||||
#endif // GSTREAMERPIPELINEWIDGET_H
|
||||
35
include/mainwindow.h
Normal file
35
include/mainwindow.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include "socketclient.h"
|
||||
#include "gstreamerpipelinewidget.h"
|
||||
#include "cameracontrolwidget.h"
|
||||
#include "videoviewerwidget.h"
|
||||
#include "aboutwidget.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private:
|
||||
void setupUI();
|
||||
|
||||
Ui::MainWindow *ui;
|
||||
SocketClient* m_socketClient;
|
||||
GStreamerPipelineWidget* m_pipelineWidget;
|
||||
CameraControlWidget* m_cameraWidget;
|
||||
VideoViewerWidget* m_videoWidget;
|
||||
AboutWidget* m_aboutWidget;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
33
include/socketclient.h
Normal file
33
include/socketclient.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef SOCKETCLIENT_H
|
||||
#define SOCKETCLIENT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <functional>
|
||||
|
||||
class SocketClient : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SocketClient(const QString& socketPath = "/tmp/vizion_control.sock", QObject *parent = nullptr);
|
||||
|
||||
using ResponseCallback = std::function<void(const QJsonObject&)>;
|
||||
using ErrorCallback = std::function<void(const QString&)>;
|
||||
|
||||
void sendCommand(const QString& command, const QJsonObject& params = QJsonObject(),
|
||||
ResponseCallback onSuccess = nullptr, ErrorCallback onError = nullptr);
|
||||
|
||||
signals:
|
||||
void commandSuccess(const QJsonObject& response);
|
||||
void commandError(const QString& errorMessage);
|
||||
void connectionError(const QString& errorMessage);
|
||||
|
||||
private:
|
||||
QString m_socketPath;
|
||||
QJsonObject executeCommand(const QString& command, const QJsonObject& params);
|
||||
};
|
||||
|
||||
#endif // SOCKETCLIENT_H
|
||||
82
include/videoviewerwidget.h
Normal file
82
include/videoviewerwidget.h
Normal file
@@ -0,0 +1,82 @@
|
||||
#ifndef VIDEOVIEWERWIDGET_H
|
||||
#define VIDEOVIEWERWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QPushButton>
|
||||
#include <QComboBox>
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QImage>
|
||||
#include <QSlider>
|
||||
#include <QScrollArea>
|
||||
#include <QCheckBox>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/app/gstappsink.h>
|
||||
|
||||
class VideoViewerWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit VideoViewerWidget(QWidget *parent = nullptr);
|
||||
~VideoViewerWidget() override;
|
||||
|
||||
signals:
|
||||
void newFrameAvailable(const QImage& frame);
|
||||
|
||||
private slots:
|
||||
void onStartViewer();
|
||||
void onStopViewer();
|
||||
void onSourceTypeChanged(int index);
|
||||
void onZoomChanged(int value);
|
||||
void onRotationChanged(int index);
|
||||
void onFlipHorizontalChanged(Qt::CheckState state);
|
||||
void onFlipVerticalChanged(Qt::CheckState state);
|
||||
void displayFrame(const QImage& frame);
|
||||
|
||||
private:
|
||||
void setupUI();
|
||||
void initGStreamer();
|
||||
void cleanupGStreamer();
|
||||
void startPipeline();
|
||||
void stopPipeline();
|
||||
QString buildPipelineString() const;
|
||||
|
||||
static gboolean busCallback(GstBus* bus, GstMessage* msg, gpointer data);
|
||||
static GstFlowReturn newSampleCallback(GstAppSink* appsink, gpointer user_data);
|
||||
|
||||
// UI elements (8-byte pointers)
|
||||
QScrollArea* m_scrollArea;
|
||||
QLabel* m_videoDisplay;
|
||||
QPushButton* m_startBtn;
|
||||
QPushButton* m_stopBtn;
|
||||
QComboBox* m_sourceType;
|
||||
QLineEdit* m_hostEdit;
|
||||
QLineEdit* m_portEdit;
|
||||
QLabel* m_statusLabel;
|
||||
QSlider* m_zoomSlider;
|
||||
QLabel* m_zoomLabel;
|
||||
QComboBox* m_rotationCombo;
|
||||
QCheckBox* m_flipHorizontal;
|
||||
QCheckBox* m_flipVertical;
|
||||
|
||||
// GStreamer elements (8-byte pointers)
|
||||
GstElement* m_pipeline;
|
||||
GstElement* m_appSink;
|
||||
|
||||
// Zoom factor (8-byte double)
|
||||
double m_zoomFactor;
|
||||
|
||||
// Bus watch ID (4-byte unsigned int)
|
||||
guint m_busWatchId;
|
||||
|
||||
// Transformation settings (4 bytes + 2 bytes)
|
||||
int m_rotationAngle;
|
||||
bool m_flipHorizontalEnabled;
|
||||
bool m_flipVerticalEnabled;
|
||||
|
||||
// Video state (large object at end)
|
||||
QImage m_currentFrame;
|
||||
};
|
||||
|
||||
#endif // VIDEOVIEWERWIDGET_H
|
||||
Reference in New Issue
Block a user