StillImageCamera: fix multiple prompt
This commit is contained in:
parent
a15e4e80c6
commit
3c554153c7
2 changed files with 19 additions and 2 deletions
|
@ -13,6 +13,10 @@ namespace Camera {
|
|||
StillImageCamera::StillImageCamera(QImage image_, const Service::CAM::Flip& flip)
|
||||
: QtCameraInterface(flip), image(std::move(image_)) {}
|
||||
|
||||
StillImageCamera::~StillImageCamera() {
|
||||
StillImageCameraFactory::last_path.clear();
|
||||
}
|
||||
|
||||
void StillImageCamera::StartCapture() {}
|
||||
|
||||
void StillImageCamera::StopCapture() {}
|
||||
|
@ -25,7 +29,12 @@ bool StillImageCamera::IsPreviewAvailable() {
|
|||
return !image.isNull();
|
||||
}
|
||||
|
||||
std::string StillImageCameraFactory::last_path;
|
||||
|
||||
const std::string StillImageCameraFactory::GetFilePath() const {
|
||||
if (!last_path.empty()) {
|
||||
return last_path;
|
||||
}
|
||||
QList<QByteArray> types = QImageReader::supportedImageFormats();
|
||||
QList<QString> temp_filters;
|
||||
for (QByteArray type : types) {
|
||||
|
@ -33,8 +42,9 @@ const std::string StillImageCameraFactory::GetFilePath() const {
|
|||
}
|
||||
|
||||
QString filter = QObject::tr("Supported image files (%1)").arg(temp_filters.join(" "));
|
||||
return QFileDialog::getOpenFileName(nullptr, QObject::tr("Open File"), ".", filter)
|
||||
.toStdString();
|
||||
last_path =
|
||||
QFileDialog::getOpenFileName(nullptr, QObject::tr("Open File"), ".", filter).toStdString();
|
||||
return last_path;
|
||||
}
|
||||
|
||||
std::unique_ptr<CameraInterface> StillImageCameraFactory::Create(const std::string& config,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue