add:
深度相机:改变数据保存路径;
This commit is contained in:
@ -7,6 +7,7 @@ const int AppSettings::kDefaultFrameRate = 20;
|
|||||||
const int AppSettings::kDefaultIntegrationTime = 1;
|
const int AppSettings::kDefaultIntegrationTime = 1;
|
||||||
const int AppSettings::kDefaultGain = 0;
|
const int AppSettings::kDefaultGain = 0;
|
||||||
const QString AppSettings::kDefaultSLRDataFolder = QString();
|
const QString AppSettings::kDefaultSLRDataFolder = QString();
|
||||||
|
const QString AppSettings::kDefaultDepthCameraDataFolder = QString();
|
||||||
|
|
||||||
AppSettings::AppSettings()
|
AppSettings::AppSettings()
|
||||||
: m_settings(QSettings::IniFormat, QSettings::UserScope,
|
: m_settings(QSettings::IniFormat, QSettings::UserScope,
|
||||||
@ -84,3 +85,18 @@ void AppSettings::setSlrDataFolder(const QString& path)
|
|||||||
{
|
{
|
||||||
m_settings.setValue("General/SLRDataFolder", 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);
|
||||||
|
}
|
||||||
|
|||||||
@ -30,6 +30,10 @@ public:
|
|||||||
// 单反相机数据保存路径
|
// 单反相机数据保存路径
|
||||||
QString slrDataFolder() const;
|
QString slrDataFolder() const;
|
||||||
void setSlrDataFolder(const QString& path);
|
void setSlrDataFolder(const QString& path);
|
||||||
|
|
||||||
|
// 深度相机数据保存路径
|
||||||
|
QString depthCameraDataFolder() const;
|
||||||
|
void setDepthCameraDataFolder(const QString& path);
|
||||||
// 在此处添加更多参数的 getter/setter ...
|
// 在此处添加更多参数的 getter/setter ...
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -46,4 +50,5 @@ private:
|
|||||||
static const int kDefaultIntegrationTime;
|
static const int kDefaultIntegrationTime;
|
||||||
static const int kDefaultGain;
|
static const int kDefaultGain;
|
||||||
static const QString kDefaultSLRDataFolder;
|
static const QString kDefaultSLRDataFolder;
|
||||||
|
static const QString kDefaultDepthCameraDataFolder;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>416</width>
|
<width>857</width>
|
||||||
<height>219</height>
|
<height>477</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -83,19 +83,6 @@ QPushButton:pressed
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>135</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
@ -126,7 +113,20 @@ QPushButton:pressed
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="2" column="0">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>135</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -139,7 +139,52 @@ QPushButton:pressed
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QLabel {
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>数据路径</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="dataFolderLineEdit">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">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;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>./CapturedImages</string>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="dataFolderBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
<spacer name="verticalSpacer_3">
|
<spacer name="verticalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
|||||||
@ -20,6 +20,11 @@ DepthCameraWindow::DepthCameraWindow(QWidget* parent)
|
|||||||
|
|
||||||
connect(m_DepthCameraOperation, &DepthCameraOperation::PlotSignal, this, &DepthCameraWindow::PlotDepthImageSignal);
|
connect(m_DepthCameraOperation, &DepthCameraOperation::PlotSignal, this, &DepthCameraWindow::PlotDepthImageSignal);
|
||||||
connect(m_DepthCameraOperation, &DepthCameraOperation::CamClosedSignal, this, &DepthCameraWindow::DepthCamClosedSignal);
|
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()
|
DepthCameraWindow::~DepthCameraWindow()
|
||||||
@ -30,6 +35,19 @@ DepthCameraWindow::~DepthCameraWindow()
|
|||||||
m_DepthCameraOperation = nullptr;
|
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()
|
void DepthCameraWindow::openDepthCamera()
|
||||||
{
|
{
|
||||||
if (!m_DepthCameraOperation->getRecordStatus())
|
if (!m_DepthCameraOperation->getRecordStatus())
|
||||||
@ -131,7 +149,7 @@ void DepthCameraOperation::OpenDepthCamera()
|
|||||||
|
|
||||||
int frameIndex = 0;
|
int frameIndex = 0;
|
||||||
record = true;
|
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";
|
QString imuFilePath = fileNamePrefix + "_IMU.txt";
|
||||||
std::ofstream imuFile(imuFilePath.toStdString(), std::ios::out | std::ios::trunc);
|
std::ofstream imuFile(imuFilePath.toStdString(), std::ios::out | std::ios::trunc);
|
||||||
while (record)
|
while (record)
|
||||||
|
|||||||
@ -7,6 +7,8 @@
|
|||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <Qthread>
|
#include <Qthread>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
//#include <QLabel>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "ui_DepthCamera.h"
|
#include "ui_DepthCamera.h"
|
||||||
@ -72,6 +74,8 @@ public Q_SLOTS:
|
|||||||
void closeDepthCamera();
|
void closeDepthCamera();
|
||||||
void onCamClosed();
|
void onCamClosed();
|
||||||
|
|
||||||
|
void onSelectDataFolder();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void openDepthCameraSignal();
|
void openDepthCameraSignal();
|
||||||
void PlotDepthImageSignal();
|
void PlotDepthImageSignal();
|
||||||
|
|||||||
Reference in New Issue
Block a user