GrabBag/App/ScrewPosition/ScrewPositionApp/dialogdetectionconfig.h

86 lines
2.6 KiB
C
Raw Normal View History

#ifndef DIALOGDETECTIONCONFIG_H
#define DIALOGDETECTIONCONFIG_H
#include <QDialog>
#include <QString>
#include <vector>
#include "IVrConfig.h"
class QLineEdit;
class HandEyeCalibWidget;
class ScrewPositionPresenter;
namespace Ui {
class DialogDetectionConfig;
}
/**
* @brief × ( / ) 4
*
* UI dialogdetectionconfig.ui Designer (, )
* QTabWidget / Tab
* (, )
* / 4 ConfigManager config.xml
*/
class DialogDetectionConfig : public QDialog
{
Q_OBJECT
public:
explicit DialogDetectionConfig(QWidget *parent = nullptr);
~DialogDetectionConfig() override;
void SetPresenter(ScrewPositionPresenter* presenter);
private slots:
void onSelectionChanged();
void onOkClicked();
void onCancelClicked();
void onApplyClicked();
void onResetCurrentClicked();
private:
struct WorkingSet
{
int cameraIndex = 1;
DetectionType detectionType = DETECTION_TYPE_SCREW;
VrHandEyeCalibMatrix handEyeMatrix;
VrAlgorithmParams algorithmParams;
};
void initNumericEditors();
void initHandEyeCalibTab();
2026-06-04 09:36:25 +08:00
void initNetworkConfigControls();
void loadNetworkConfig();
void rebuildCameraSelector();
void loadFromConfig();
bool commitCurrentEditorsToWorkingSet(QString* errMsg = nullptr);
void loadWorkingSetToEditors(int workingIndex);
bool saveAllWorkingSetsToConfig();
int findWorkingIndex(int cameraIndex, DetectionType type) const;
int currentWorkingIndex() const;
static void setDoubleEditorText(QLineEdit* edit, double value);
static void setIntEditorText(QLineEdit* edit, int value);
bool tryGetDouble(QLineEdit* edit, const QString& label, double& value);
bool tryGetInt(QLineEdit* edit, const QString& label, int& value);
static QString detectionTypeLabel(DetectionType type);
private:
Ui::DialogDetectionConfig* ui = nullptr;
ScrewPositionPresenter* m_presenter = nullptr;
// 嵌入 tabHandEye 的 verticalLayout_handEyeCalibHost 里
HandEyeCalibWidget* m_handEyeCalibWidget = nullptr;
// 内部工作缓存4 条 (camera, type) set
std::vector<WorkingSet> m_workingSets;
int m_currentLoadedIndex = -1; // 当前编辑器映射到的 m_workingSets 下标
int m_cameraCount = 1;
};
#endif // DIALOGDETECTIONCONFIG_H