[libcamera-devel] [PATCH] qcam: Use standard PicturesLocation path for capture
Niklas Söderlund
niklas.soderlund at ragnatech.se
Tue Feb 18 21:25:30 CET 2020
Hi Kieran,
Thanks for your patch.
On 2020-02-17 15:39:41 +0000, Kieran Bingham wrote:
> Utilise the QStandardPaths::PicturesLocation as a starting point for
> saving images from qcam.
I feel applications that use these default locations for file types are
annoying and anti the *NIX way of working, which to me is to default all
interactions to the current working directory.
I don't feel strongly about this so I won't block this change just want
to voice that ;-)
>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
> src/qcam/main_window.cpp | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
> index 29eaba8454f8..09e4bfc11300 100644
> --- a/src/qcam/main_window.cpp
> +++ b/src/qcam/main_window.cpp
> @@ -17,6 +17,7 @@
> #include <QImage>
> #include <QImageWriter>
> #include <QInputDialog>
> +#include <QStandardPaths>
> #include <QTimer>
> #include <QToolBar>
> #include <QToolButton>
> @@ -348,8 +349,9 @@ void MainWindow::stopCapture()
> void MainWindow::saveImageAs()
> {
> QImage image = viewfinder_->getCurrentImage();
> + QString defaultPath = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).last();
>
> - QString filename = QFileDialog::getSaveFileName(this, "Save Image", "",
> + QString filename = QFileDialog::getSaveFileName(this, "Save Image", defaultPath,
> "Image Files (*.png *.jpg *.jpeg)");
>
> std::cout << "Save image to " << filename.toStdString() << std::endl;
> --
> 2.20.1
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
--
Regards,
Niklas Söderlund
More information about the libcamera-devel
mailing list