[libcamera-devel] [PATCH] qcam: Use standard PicturesLocation path for capture

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Feb 18 02:05:57 CET 2020


Hi Kieran,

Thank you for the patch.

On Mon, Feb 17, 2020 at 03:39:41PM +0000, Kieran Bingham wrote:
> Utilise the QStandardPaths::PicturesLocation as a starting point for
> saving images from qcam.
> 
> 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();

QStandardPaths::standardLocations() sorts the result from high to low
priority, shouldn't we thus pick the first entry ? How about using
QStandardPaths::writableLocation() instead ?

>  
> -	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;

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list