diff --git a/HPPA/AppSettings.cpp b/HPPA/AppSettings.cpp
index b972dff..c735ab9 100644
--- a/HPPA/AppSettings.cpp
+++ b/HPPA/AppSettings.cpp
@@ -7,6 +7,7 @@ const int AppSettings::kDefaultFrameRate = 20;
const int AppSettings::kDefaultIntegrationTime = 1;
const int AppSettings::kDefaultGain = 0;
const QString AppSettings::kDefaultSLRDataFolder = QString();
+const QString AppSettings::kDefaultDepthCameraDataFolder = QString();
AppSettings::AppSettings()
: m_settings(QSettings::IniFormat, QSettings::UserScope,
@@ -84,3 +85,18 @@ void AppSettings::setSlrDataFolder(const QString& path)
{
m_settings.setValue("General/SLRDataFolder", path);
}
+
+QString AppSettings::depthCameraDataFolder() const
+{
+ QString path = m_settings.value("General/DepthCameraDataFolder").toString();
+ if (path.isEmpty())
+ {
+ return QCoreApplication::applicationDirPath() + "/CapturedDepthImages/";
+ }
+ return path;
+}
+
+void AppSettings::setDepthCameraDataFolder(const QString& path)
+{
+ m_settings.setValue("General/DepthCameraDataFolder", path);
+}
diff --git a/HPPA/AppSettings.h b/HPPA/AppSettings.h
index 0bbad84..0bdfe32 100644
--- a/HPPA/AppSettings.h
+++ b/HPPA/AppSettings.h
@@ -30,6 +30,10 @@ public:
// 单反相机数据保存路径
QString slrDataFolder() const;
void setSlrDataFolder(const QString& path);
+
+ // 深度相机数据保存路径
+ QString depthCameraDataFolder() const;
+ void setDepthCameraDataFolder(const QString& path);
// 在此处添加更多参数的 getter/setter ...
private:
@@ -46,4 +50,5 @@ private:
static const int kDefaultIntegrationTime;
static const int kDefaultGain;
static const QString kDefaultSLRDataFolder;
+ static const QString kDefaultDepthCameraDataFolder;
};
diff --git a/HPPA/DepthCamera.ui b/HPPA/DepthCamera.ui
index 6a1f544..51bedeb 100644
--- a/HPPA/DepthCamera.ui
+++ b/HPPA/DepthCamera.ui
@@ -6,8 +6,8 @@
0
0
- 416
- 219
+ 857
+ 477
@@ -83,19 +83,6 @@ QPushButton:pressed
- -
-
-
- Qt::Horizontal
-
-
-
- 135
- 20
-
-
-
-
-
-
@@ -126,7 +113,20 @@ QPushButton:pressed
- -
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 135
+ 20
+
+
+
+
+ -
Qt::Horizontal
@@ -139,7 +139,52 @@ QPushButton:pressed
- -
+
-
+
+
-
+
+
+ QLabel {
+ color: rgb(255, 255, 255);
+}
+
+
+ 数据路径
+
+
+
+ -
+
+
+ QLineEdit {
+ background-color: #142D7F;
+ color: #e6eeff;
+ border: 1px solid #2f6bff;
+ border-radius: 6px;
+ padding: 4px 8px;
+ min-width: 70px;
+ min-height: 20px;
+ font-size: 13px;
+}
+
+
+ ./CapturedImages
+
+
+ true
+
+
+
+ -
+
+
+ ...
+
+
+
+
+
+ -
Qt::Vertical
diff --git a/HPPA/DepthCameraWindow.cpp b/HPPA/DepthCameraWindow.cpp
index 0e80437..4e7a4f4 100644
--- a/HPPA/DepthCameraWindow.cpp
+++ b/HPPA/DepthCameraWindow.cpp
@@ -10,16 +10,21 @@ DepthCameraWindow::DepthCameraWindow(QWidget* parent)
m_DepthCameraOperation->moveToThread(m_DepthCameraThread);
m_DepthCameraThread->start();
- connect(ui.openDepthCamera_btn, &QPushButton::clicked, this, &DepthCameraWindow::openDepthCamera);
- connect(ui.closeDepthCamera_btn, &QPushButton::clicked, this, &DepthCameraWindow::closeDepthCamera);
+ connect(ui.openDepthCamera_btn, &QPushButton::clicked, this, &DepthCameraWindow::openDepthCamera);
+ connect(ui.closeDepthCamera_btn, &QPushButton::clicked, this, &DepthCameraWindow::closeDepthCamera);
- connect(this, &DepthCameraWindow::openDepthCameraSignal, m_DepthCameraOperation, &DepthCameraOperation::OpenDepthCamera);
+ connect(this, &DepthCameraWindow::openDepthCameraSignal, m_DepthCameraOperation, &DepthCameraOperation::OpenDepthCamera);
- connect(m_DepthCameraOperation, &DepthCameraOperation::CamOpenedSignal, this, &DepthCameraWindow::onCamOpened);
- connect(m_DepthCameraOperation, &DepthCameraOperation::CamClosedSignal, this, &DepthCameraWindow::onCamClosed);
+ connect(m_DepthCameraOperation, &DepthCameraOperation::CamOpenedSignal, this, &DepthCameraWindow::onCamOpened);
+ connect(m_DepthCameraOperation, &DepthCameraOperation::CamClosedSignal, this, &DepthCameraWindow::onCamClosed);
- connect(m_DepthCameraOperation, &DepthCameraOperation::PlotSignal, this, &DepthCameraWindow::PlotDepthImageSignal);
- connect(m_DepthCameraOperation, &DepthCameraOperation::CamClosedSignal, this, &DepthCameraWindow::DepthCamClosedSignal);
+ connect(m_DepthCameraOperation, &DepthCameraOperation::PlotSignal, this, &DepthCameraWindow::PlotDepthImageSignal);
+ connect(m_DepthCameraOperation, &DepthCameraOperation::CamClosedSignal, this, &DepthCameraWindow::DepthCamClosedSignal);
+
+ connect(this->ui.dataFolderBtn, SIGNAL(clicked()), this, SLOT(onSelectDataFolder()));
+
+ // 初始化数据保存路径显示(从 AppSettings 恢复或使用默认)
+ ui.dataFolderLineEdit->setText(AppSettings::instance().depthCameraDataFolder());
}
DepthCameraWindow::~DepthCameraWindow()
@@ -30,6 +35,19 @@ DepthCameraWindow::~DepthCameraWindow()
m_DepthCameraOperation = nullptr;
}
+void DepthCameraWindow::onSelectDataFolder()
+{
+ QString dir = QFileDialog::getExistingDirectory(this,
+ QString::fromLocal8Bit("选择数据保存路径"),
+ ui.dataFolderLineEdit->text());
+
+ if (!dir.isEmpty())
+ {
+ ui.dataFolderLineEdit->setText(dir);
+ AppSettings::instance().setDepthCameraDataFolder(dir);
+ }
+}
+
void DepthCameraWindow::openDepthCamera()
{
if (!m_DepthCameraOperation->getRecordStatus())
@@ -131,7 +149,7 @@ void DepthCameraOperation::OpenDepthCamera()
int frameIndex = 0;
record = true;
- QString fileNamePrefix = AppSettings::instance().dataFolder() + QDir::separator() + AppSettings::instance().fileName();
+ QString fileNamePrefix = AppSettings::instance().depthCameraDataFolder() + QDir::separator() + AppSettings::instance().fileName();
QString imuFilePath = fileNamePrefix + "_IMU.txt";
std::ofstream imuFile(imuFilePath.toStdString(), std::ios::out | std::ios::trunc);
while (record)
diff --git a/HPPA/DepthCameraWindow.h b/HPPA/DepthCameraWindow.h
index 02f2901..f1506c7 100644
--- a/HPPA/DepthCameraWindow.h
+++ b/HPPA/DepthCameraWindow.h
@@ -7,6 +7,8 @@
#include
#include
#include
+//#include
+#include
#include
#include "ui_DepthCamera.h"
@@ -72,6 +74,8 @@ public Q_SLOTS:
void closeDepthCamera();
void onCamClosed();
+ void onSelectDataFolder();
+
signals:
void openDepthCameraSignal();
void PlotDepthImageSignal();