95 lines
3.0 KiB
C++
95 lines
3.0 KiB
C++
#ifndef PARKINGSPACEGUIDE_MAINWINDOW_H
|
|
#define PARKINGSPACEGUIDE_MAINWINDOW_H
|
|
|
|
#include <QAction>
|
|
#include <QEvent>
|
|
#include <QImage>
|
|
#include <QLabel>
|
|
#include <QListWidget>
|
|
#include <QListWidgetItem>
|
|
#include <QMainWindow>
|
|
#include <QMenu>
|
|
#include <QPushButton>
|
|
|
|
#include <thread>
|
|
|
|
#include "AboutDialog.h"
|
|
#include "DeviceStatusWidget.h"
|
|
#include "DetectLogHelper.h"
|
|
#include "ParkingSpaceGuidePresenter.h"
|
|
#include "dialogalgoarg.h"
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui { class MainWindow; }
|
|
QT_END_NAMESPACE
|
|
|
|
class MainWindow : public QMainWindow, public IYParkingSpaceGuideStatus
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit MainWindow(QWidget* parent = nullptr);
|
|
~MainWindow() override;
|
|
|
|
void updateStatusLog(const QString& message);
|
|
void clearDetectionLog();
|
|
void Init();
|
|
bool eventFilter(QObject* obj, QEvent* event) override;
|
|
|
|
void OnStatusUpdate(const std::string& statusMessage) override;
|
|
void OnDetectionResult(const DetectionResult& result) override;
|
|
void OnCamera1StatusChanged(bool isConnected) override;
|
|
void OnCamera2StatusChanged(bool isConnected) override;
|
|
void OnRobotConnectionChanged(bool isConnected) override;
|
|
void OnSerialConnectionChanged(bool isConnected) override;
|
|
void OnCameraCountChanged(int cameraCount) override;
|
|
void OnWorkStatusChanged(WorkStatus status) override;
|
|
|
|
signals:
|
|
void workStatusUpdateRequested(WorkStatus status);
|
|
void detectionResultUpdateRequested(const DetectionResult& result);
|
|
|
|
private slots:
|
|
void updateWorkStatusLabel(WorkStatus status);
|
|
void updateDetectionResultDisplay(const DetectionResult& result);
|
|
void onCameraClicked(int cameraIndex);
|
|
|
|
void on_btn_start_clicked();
|
|
void on_btn_stop_clicked();
|
|
void on_btn_camera_clicked();
|
|
void on_btn_algo_config_clicked();
|
|
void on_btn_camera_levelling_clicked();
|
|
void on_btn_hide_clicked();
|
|
void on_btn_close_clicked();
|
|
void on_btn_test_clicked();
|
|
void onSaveDetectionData();
|
|
|
|
private:
|
|
void displayImage(const QImage& image);
|
|
void addDetectionResult(const DetectionResult& result);
|
|
void setButtonsEnabled(bool enabled);
|
|
void setButtonImage(QPushButton* button, const QString& imagePath);
|
|
void setButtonSelectedState(QPushButton* button, bool selected);
|
|
void restoreAllButtonStates();
|
|
void setOtherButtonsEnabled(QPushButton* exceptButton, bool enabled);
|
|
void setupContextMenu();
|
|
void showContextMenu(const QPoint& pos);
|
|
void showParameterDialog(DialogAlgoArg::ConfigPage page, QPushButton* button);
|
|
bool saveDetectionDataToFile(const QString& filePath);
|
|
|
|
private:
|
|
Ui::MainWindow* ui = nullptr;
|
|
DialogAlgoArg* ui_dialogAlgoArg = nullptr;
|
|
ParkingSpaceGuidePresenter* m_presenter = nullptr;
|
|
DetectLogHelper* m_logHelper = nullptr;
|
|
DeviceStatusWidget* m_deviceStatusWidget = nullptr;
|
|
QPushButton* m_selectedButton = nullptr;
|
|
QMenu* m_contextMenu = nullptr;
|
|
QAction* m_saveDataAction = nullptr;
|
|
QLabel* m_versionLabel = nullptr;
|
|
std::thread m_initThread;
|
|
std::thread m_testThread;
|
|
};
|
|
|
|
#endif // PARKINGSPACEGUIDE_MAINWINDOW_H
|