-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Remember plot settings for each table #819
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
Conversation
Store and restore the plot settings for each table - just like the filter values or the column widths. This way you can have multiple plots, one for each table. Also, save these settings in the project files.
Putting this in a PR for a quick review and Travis check because of Qt4. The plot stuff is a little chaotic but I tried to keep the changes to it minimal. Might need a rework some day though. Anyway, maybe somebody wants to do some testing of this - might be that I've forgotten to save some combination of settings or whatever. |
Oh I forgot: this PR is related to #816. |
Where and how are these saved? |
There is a data structure called BrowseDataTableSettings (see https://github.com/sqlitebrowser/sqlitebrowser/blob/storeplot/src/MainWindow.h#L60) where all these sort of things are stored in. This PR adds some more entries to it for storing the plot information. We have a map (here https://github.com/sqlitebrowser/sqlitebrowser/blob/storeplot/src/MainWindow.h#L163) which maps one table to one of these structs, so there is an instance of this struct for each table. Now the PR adds code here and there to access the new attributes: store the updated information the map when the user changes some settings, get the stored information from the map when the user changes the current table. This map is just stored as-is in the project files. Here's the loading code (https://github.com/sqlitebrowser/sqlitebrowser/blob/storeplot/src/MainWindow.cpp#L2237) and here's the saving code (https://github.com/sqlitebrowser/sqlitebrowser/blob/storeplot/src/MainWindow.cpp#L234). These lines didn't need to be changed for this. But you'll see we use the operator<< and operator>> there. These operators are overloaded here (https://github.com/sqlitebrowser/sqlitebrowser/blob/storeplot/src/MainWindow.h#L72). This PR adds two lines to each of these functions to store the new attributes in the struct to the project files or load it from the project files. Hope this explanation wasn't to long or too unstructured to be understood 😃 |
It seems like a really well written to me. 😄 Maybe we should cut-n-paste stuff like this into a wiki page for other developers too? |
Yeah, sure. Might be hard to keep these things up-to-date but we can always delete explanations like these when we feel they do more harm than good. |
Great explanation! Yeah, I think this should be in a wiki too, though with more class/struct/method names inline than links to lines of code, as they will change over time. |
@revolter Good thinking, that an even better solution! And at least this piece of code should be more or less stable for the next time. Does somebody volunteer to start the Wiki page? I could do some proof reading afterwards. |
@chrisjlocke @glawrence Any interest in helping with #819 (comment)? 😄 |
Started something here: https://github.com/sqlitebrowser/sqlitebrowser/wiki/Source-code-highlights. Feedback welcomed 😄 |
Somebody tested the commit itself already? 😺 |
Just updated the commit a bit to make absolutely sure we're backward compatible with project files from older versions of DB4S. So if the Travis check doesn't fail, I'm just going to proactively merge this 😃 It really shouldn't make things any worse 😉 |
@MKleusberg, Never used project files, if I remember to test this, I will do so. If not, our users will test in when it's live 😆 |
To be honest, I don't use them either 😉 But some real life testing won't hurt anyway. |
Someone's been watching South Park. 😁 |
Store and restore the plot settings for each table - just like the filter values or the column widths. This way you can have multiple plots, one for each table. Also, save these settings in the project files.
Store and restore the plot settings for each table - just like the
filter values or the column widths. This way you can have multiple
plots, one for each table.
Also, save these settings in the project files.