-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[needs-doc] Add stable id, save id, save count to project spec #6527
Conversation
Some background on why this might be a good idea. I would like to generate preview images for each project that is opened so I can use them in tooltips, however I have no stable ID I can use for filenames. This would provide that and would allow for moving the projects around but keeping the previews. Another user for id() and saveId() is a possible future saving of projects in database or web server. Using these two ids we can track if a project has changed on the server by someone else etc. Would also allow backends to implement versioning around project save without making their own ids. |
static QString generateUuid() | ||
{ | ||
QString uuid = QUuid::createUuid().toString(); | ||
return uuid.mid( 1, uuid.length() - 3 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
off topic - but wow it annoys me the format QUuid uses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You and be both. Never once have I thought "man I wish this guid had { } around it". Silly.
src/core/qgsproject.h
Outdated
QString mSaveId; // changing id for each save. | ||
QString mSaveUser; // last saved user. | ||
QString mSaveUserFull; // last saved user. | ||
int mSaveCounter; // increasing save counter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initialize to 0 here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@nirvn @m-kuhn @wonder-sk how do you feel about these? |
I think it is a bit tricky with the IDs... if I have an existing project and use save-as to make a copy and modify that project afterwards, I would end up with both original and the new project sharing the same ID right? And how would we use saveCounter()? |
Yes - that's the purpose of the persistent id -- it would allow tracking of project "forks" like this. The saveId() will be regenerated though and will be new. |
Hmm Martins point is valid if I wanted to use the id() to assign generate a
thumbnail using just that. The thumbnail is a minor thing I can think
about later so I still think it's valid to have these ids.
…On Tue, Mar 6, 2018 at 9:39 AM, Nyall Dawson ***@***.***> wrote:
I think it is a bit tricky with the IDs... if I have an existing project
and use save-as to make a copy and modify that project afterwards, I would
end up with both original and the new project sharing the same ID right?
Yes - that's the purpose of the persistent id -- it would allow tracking
of project "forks" like this. The saveId() will be regenerated though and
will be new.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#6527 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAXS3OwZHu-7FatT1PHaiMBjc5NfLjWtks5tbcyngaJpZM4Sbs65>
.
|
Wouldn't you use saveId() for that? Otherwise you'd see an outdated thumbnail.
Very much so! I can see lots of potential use for them, and the sooner they start to be recorded in projects the better... |
Yeah i guess we can use save id and just delete the old one after each
save. That is a good point.
…On Tue, 6 Mar. 2018, 10:32 am Nyall Dawson, ***@***.***> wrote:
Hmm Martins point is valid if I wanted to use the id() to assign generate a
thumbnail using just that.
Wouldn't you use saveId() for that? Otherwise you'd see an outdated
thumbnail.
so I still think it's valid to have these ids.
Very much so! I can see lots of potential use for them, and the sooner
they start to be recorded in projects the better...
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#6527 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAXS3D10dCsWp64hwr1-ZRaxlvXhzrcUks5tbdkugaJpZM4Sbs65>
.
|
Doesn't that break to "save as" case though? E.g. open existing project, save as => original project thumbnail is deleted. |
Thumbnails will be generated on load anyway so you will get it back right
away.
|
What about saving the thumbnail straight into the project file? |
@m-kuhn , that's what I suggested (off github) yesterday. IMHO, that's what makes the most sense on the longer term. |
I thought about that however the downside is that we need to load and parse
the xml for each project in the browser tree which might be slow over
networks.
…On Tue, Mar 6, 2018 at 1:09 PM, Matthias Kuhn ***@***.***> wrote:
What about saving the thumbnail straight into the project file?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#6527 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAXS3Pe8mBxZOFg2uw8UDaCUSjXkH15dks5tbf3OgaJpZM4Sbs65>
.
|
Is everyone ok with this id idea though so that we could use it for other
things?
In theory keeping the id() stable even if you copy the project is not a bad
things (unless you do Save As in which case I will change it). If you
combine savecounter + path + id() you can see if two projects files are the
same and if they have changed over time
e.g
C:\temp\project.qgs ID1 Count3
C:\temp\project-copy.qgs ID1 Count7
|
Isn't that the same with the metadata in discussion here? |
haha good point. Never mind then :) *headdesk*
So maybe we will just store them in the project file as base64. I would
still like to see this ID stuff implemented for other future uses though.
…On Tue, Mar 6, 2018 at 2:17 PM, Matthias Kuhn ***@***.***> wrote:
I thought about that however the downside is that we need to load and
parse the xml for each project in the browser tree which might be slow over
networks.
Isn't that the same with the metadata in discussion here?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#6527 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAXS3EL9a55YXV7m7vw2O5DFTjzlHFOyks5tbg3agaJpZM4Sbs65>
.
|
can we go for qgd and ship it binary? |
Possible. I know there has been talk about just swapping to qgz as the
default format. I'm unsure how I feel about that yet but if we do I'm ok
putting into qgd.
Putting projects inside qgz also might raise network issues. Nyall thoughts?
…On Tue, Mar 6, 2018 at 2:25 PM, Matthias Kuhn ***@***.***> wrote:
So maybe we will just store them in the project file as base64
can we go for qgd and ship it binary?
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#6527 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAXS3NeisB5D9Fpg3okoXaqmxoLYJiBQks5tbg_WgaJpZM4Sbs65>
.
|
So any thoughts on this logic? Even if we go with a qgz default format in future I still think having this logic in the project would be handy for tracking or other uses. |
I'm +1. Obviously it has limitations, but I'd still find it super-useful. The only improvement I can think of is adding (yet another) uuid - so we have:
|
I don't see any big downsides. One shouldn't blindly trust it, but if it's useful for something, go ahead. I can't see a better approach nor any risks. |
@wonder-sk your thoughts? |
I think I am still confused about how all this would be used and what expectations developers can have from these new values:
By the way... recently at Lutra we have been tasked to add support for loading/saving projects in PostgreSQL database. In a couple of days Peter or me should get back with a QEP discussing that. |
Ping @probot |
The QGIS project highly values your contribution and would love to see this work merged! Unfortunately this PR has not had any activity in the last 14 days and is being automatically marked as "stale". If you think this pull request should be merged, please check
|
While we hate to see this happen, this PR has been automatically closed because it has not had any activity in the last 21 days. If this pull request should be reconsidered, please follow the guidelines in the previous comment and reopen this pull request. Or, if you have any further questions, just ask! We love to help, and if there's anything the QGIS project can do to help push this PR forward please let us know how we can assist. |
Hi @NathanW2: I picked up your idea of adding the username to the QGIS project file in my pullrequest 33843. Do you think it is pointed out enough that the code snippets were originally written by you or do you have any suggestions? |
Adds some new metadata about the project itself for future use.
Adds the following information:
NOTE: I was considering backporting this into 3.0 so that we can start getting projects including those ids for future release. If you save with a older version of QGIS it will nuke these values.