feat: v0.1.0更新
This commit is contained in:
106
src/config/ConfigManager.cpp
Normal file
106
src/config/ConfigManager.cpp
Normal file
@@ -0,0 +1,106 @@
|
||||
#include "config/ConfigManager.h"
|
||||
|
||||
ConfigManager::ConfigManager()
|
||||
: m_settings(std::make_unique<QSettings>("D330Viewer", "D330Viewer"))
|
||||
{
|
||||
// 构造函数:初始化QSettings
|
||||
}
|
||||
|
||||
ConfigManager::~ConfigManager()
|
||||
{
|
||||
// 析构函数:QSettings会自动保存
|
||||
}
|
||||
|
||||
// ========== 网络配置 ==========
|
||||
QString ConfigManager::getIpAddress() const
|
||||
{
|
||||
return m_settings->value("Network/IpAddress", "192.168.0.90").toString();
|
||||
}
|
||||
|
||||
void ConfigManager::setIpAddress(const QString &ip)
|
||||
{
|
||||
m_settings->setValue("Network/IpAddress", ip);
|
||||
}
|
||||
|
||||
int ConfigManager::getControlPort() const
|
||||
{
|
||||
return m_settings->value("Network/ControlPort", 6790).toInt();
|
||||
}
|
||||
|
||||
void ConfigManager::setControlPort(int port)
|
||||
{
|
||||
m_settings->setValue("Network/ControlPort", port);
|
||||
}
|
||||
|
||||
int ConfigManager::getDataPort() const
|
||||
{
|
||||
return m_settings->value("Network/DataPort", 3957).toInt();
|
||||
}
|
||||
|
||||
void ConfigManager::setDataPort(int port)
|
||||
{
|
||||
m_settings->setValue("Network/DataPort", port);
|
||||
}
|
||||
|
||||
// ========== 相机配置 ==========
|
||||
int ConfigManager::getExposureTime() const
|
||||
{
|
||||
return m_settings->value("Camera/ExposureTime", 10000).toInt();
|
||||
}
|
||||
|
||||
void ConfigManager::setExposureTime(int exposure)
|
||||
{
|
||||
m_settings->setValue("Camera/ExposureTime", exposure);
|
||||
}
|
||||
|
||||
// ========== 拍照配置 ==========
|
||||
QString ConfigManager::getSavePath() const
|
||||
{
|
||||
return m_settings->value("Capture/SavePath", "").toString();
|
||||
}
|
||||
|
||||
void ConfigManager::setSavePath(const QString &path)
|
||||
{
|
||||
m_settings->setValue("Capture/SavePath", path);
|
||||
}
|
||||
|
||||
QString ConfigManager::getDepthFormat() const
|
||||
{
|
||||
return m_settings->value("Capture/DepthFormat", "both").toString();
|
||||
}
|
||||
|
||||
void ConfigManager::setDepthFormat(const QString &format)
|
||||
{
|
||||
m_settings->setValue("Capture/DepthFormat", format);
|
||||
}
|
||||
|
||||
QString ConfigManager::getPointCloudFormat() const
|
||||
{
|
||||
return m_settings->value("Capture/PointCloudFormat", "both").toString();
|
||||
}
|
||||
|
||||
void ConfigManager::setPointCloudFormat(const QString &format)
|
||||
{
|
||||
m_settings->setValue("Capture/PointCloudFormat", format);
|
||||
}
|
||||
|
||||
// ========== 窗口配置 ==========
|
||||
QByteArray ConfigManager::getWindowGeometry() const
|
||||
{
|
||||
return m_settings->value("Window/Geometry").toByteArray();
|
||||
}
|
||||
|
||||
void ConfigManager::setWindowGeometry(const QByteArray &geometry)
|
||||
{
|
||||
m_settings->setValue("Window/Geometry", geometry);
|
||||
}
|
||||
|
||||
QByteArray ConfigManager::getWindowState() const
|
||||
{
|
||||
return m_settings->value("Window/State").toByteArray();
|
||||
}
|
||||
|
||||
void ConfigManager::setWindowState(const QByteArray &state)
|
||||
{
|
||||
m_settings->setValue("Window/State", state);
|
||||
}
|
||||
Reference in New Issue
Block a user