Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ExternalStorage] Add widget to configure/edit and visualize external storage #44533

Merged
merged 11 commits into from
Aug 16, 2021

Conversation

troopa81
Copy link
Contributor

@troopa81 troopa81 commented Aug 3, 2021

This is the following of #43882

It provides UI elements to deal with external storage backends

Here is a little demo of how it works

dms_qgis_demo

The demo use a Netcloud server with a Webdav backend. This last will come in a separate PR.

Few optimisations/improvments will come in separate PR (don't fetch what we just store, deal correctly with folder...) because I don't want to make this one to big to review.

EDIT: Directory selection with an external storage is a complicated matter so for now, Storage mode (File or Directory) widget is not visible when external storage is selected. Same for relative path which has no meaning with external storage.

cc @Jean-Roc
cc @3nids for review

Funded by Lille Metropole

@github-actions github-actions bot added this to the 3.22.0 milestone Aug 3, 2021
python/gui/auto_generated/qgsfilewidget.sip.in Outdated Show resolved Hide resolved
src/gui/editorwidgets/qgsexternalresourceconfigdlg.cpp Outdated Show resolved Hide resolved
src/gui/qgsexternalresourcewidget.h Outdated Show resolved Hide resolved
src/gui/qgsfilewidget.h Outdated Show resolved Hide resolved
* \see setStorageUrlExpression()
* \since 3.22
*/
QgsExpression *storageUrlExpression() const;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why a pointer return here? The ownership is unclear

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has no need for QGIS application, it's just in case, somebody need somehow to interact with the defined expression through the API. It mas mostly to be consistent wtih what is done in QgsFeatureRequest.

The ownership is unclear

I would have said that when returning a pointer, the default expected behavior when nothing else is specified is that object keep ownership of the returned pointer, like it's done in Qt for instance or QGIS.

But, If you think it's necessary, I can add it.

@troopa81 troopa81 force-pushed the feat_dms_connexion_widget branch 2 times, most recently from 02c63f4 to 89c2988 Compare August 5, 2021 07:36
@zacharlie zacharlie added the Changelog Items that are queued to appear in the visual changelog - remove after harvesting label Aug 7, 2021
@troopa81
Copy link
Contributor Author

troopa81 commented Aug 9, 2021

@3nids Did you have the time to take a look at this one?

Copy link
Member

@3nids 3nids left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some minor remarks
good job for writing detailed tests!

src/gui/editorwidgets/qgsexternalresourceconfigdlg.cpp Outdated Show resolved Hide resolved
src/gui/editorwidgets/qgsexternalresourceconfigdlg.cpp Outdated Show resolved Hide resolved
src/gui/editorwidgets/qgsexternalresourceconfigdlg.h Outdated Show resolved Hide resolved
@@ -354,56 +341,61 @@ void QgsFileWidget::openFileDialog()
return;

if ( mStorageMode != GetMultipleFiles )
fileNames << fileName;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't we need this anymore?
QDir::toNativeSeparators( QDir::cleanPath( QFileInfo( fileName ).absoluteFilePath() ) );

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still do. It's done 3 lines later, in the for loop for every filename in fileNames.

In the rest of the code, I only deal with fileNames and no longer fileName.

* \see setStorageUrlExpression()
* \since 3.22
*/
QgsExpression *storageUrlExpression() const;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

following the discussion here #44533 (comment)
indeed in other places, expression are returned by pointer.
any suggestion/objection @nyalldawson

@troopa81 troopa81 force-pushed the feat_dms_connexion_widget branch 2 times, most recently from a2f2977 to add8818 Compare August 11, 2021 15:50
@3nids
Copy link
Member

3nids commented Aug 16, 2021

@troopa81 ok to merge?

@troopa81
Copy link
Contributor Author

@3nids I had to rebase, but once everything is green yes!

@troopa81
Copy link
Contributor Author

@3nids everything is green. OK to merge

@zacharlie zacharlie added ChangelogHarvested This PR description has been harvested in the Changelog already. and removed Changelog Items that are queued to appear in the visual changelog - remove after harvesting labels Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ChangelogHarvested This PR description has been harvested in the Changelog already. Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants