Re: GSoC - Customizable print formats
On 7 May 2015 at 03:28, Gehad Elrobey gehadelro...@gmail.com wrote: Hello Lubomir, I think you have suggested before that I should find a way to remove all the existing printing code and replace it with the new Grantlee based printing, also you have suggested to use 'NEW_PRINTING' as a preprocessor. So now I am not sure if the old printing module will be completely obsoleted or we will still keep it as a fallback printing system in the case that someone doesn't want to build/install Grantlee. hello Gehad, that's a good catch and a bit of a contradiction in a way because i haven't clarified enough. my idea was that the temporary macro NEW_PRINTING (of sorts) should be used while the ongoing work on GSoC is happening. this means that if a version of Subsurface is released in that same period, while the new printing module is still WIP, we can simply disable the NEW_PRINTING macro. this allows your code to be in master while you work on the project. this is a complication structure and maintenance wise as we can simply phase out the old code in a GIT branch (e.g. new-print) without dealing with the macro, but this way your code should enter master all at once and the review process will be limited to visitors of your github page while the work is ongoing. i pretty much want to make Grantlee a hard dependency i.e. NO_GRANTLEE means NO_PRINTING, but this raises some community questions: Dirk and others, what do you think - should we make this new library dependency (Grantlee) optional like we do with Marble? Should the printing be completely disabled if the user decides to build with NO_GRANTLEE or should we fall back to the current Qt-only based printing (creates bloat as we are going to have 2 printing modules)? also GSoC wise, do you think the new printing code should enter master while WIP or should it do so all at once when mostly done? lubomir -- ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: GSoC - Customizable print formats
On 7 May 2015 at 07:28, Lubomir I. Ivanov neolit...@gmail.com wrote: also GSoC wise, do you think the new printing code should enter master while WIP or should it do so all at once when mostly done? Just my 2c... I would favour doing it in a branch (or in this case in Gehads own github repo), and then merging in one go at the end, over macros. Gehad can frequently merge master into his branch to keep on top of changes. Macros could get messy. ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Allow replanning of logged dives
Hi, From ec79ffdefd466d1e4a07fddfab04cdd8d3334892 Mon Sep 17 00:00:00 2001 From: Robert C. Helling hell...@atdotde.de Date: Thu, 7 May 2015 22:59:12 +0200 Subject: [PATCH 1/2] Only warn when trying to replan a logged dive If there are more than 100 samples, average some of them so we end up with no more than 100. Signed-off-by: Robert C. Helling hell...@atdotde.de --- planner.c | 2 +- qt-ui/diveplanner.cpp | 31 --- qt-ui/mainwindow.cpp | 5 +++-- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/planner.c b/planner.c index 9de6a21..af1db50 100644 --- a/planner.c +++ b/planner.c @@ -520,7 +520,7 @@ static unsigned int *sort_stops(int *dstops, int dnr, struct gaschanges *gstops, static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_disclaimer, int error) { - char buffer[2], temp[1000]; + char buffer[200], temp[10]; int len, lastdepth = 0, lasttime = 0, lastsetpoint = -1, newdepth = 0, lastprintdepth = 0; struct divedatapoint *dp = diveplan-dp; bool gaschange = !plan_verbatim, postponed = plan_verbatim; diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index a5b6e1e..42570da 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -92,10 +92,13 @@ void DivePlannerPointsModel::setupStartTime() void DivePlannerPointsModel::loadFromDive(dive *d) { + int depthsum = 0; + int samplecount = 0; bool oldRec = recalc; recalc = false; CylindersModel::instance()-updateDive(); duration_t lasttime = {}; + duration_t newtime = {}; struct gasmix gas; free_dps(diveplan); diveplan.when = d-when; @@ -104,13 +107,27 @@ void DivePlannerPointsModel::loadFromDive(dive *d) // if it is we only add the manually entered samples as waypoints to the diveplan // otherwise we have to add all of them bool hasMarkedSamples = d-dc.sample[0].manually_entered; - for (int i = 0; i d-dc.samples - 1; i++) { - const sample s = d-dc.sample[i]; - if (s.time.seconds == 0 || (hasMarkedSamples !s.manually_entered)) - continue; - get_gas_at_time(d, d-dc, lasttime, gas); - plannerModel-addStop(s.depth.mm, s.time.seconds, gas, 0, true); - lasttime = s.time; + // if this dive has more than 100 samples (so it is probably a logged dive), + // average samples so we end up with a total of 100 samples. + int plansamples = d-dc.samples = 100 ? d-dc.samples : 100; + int j = 0; + for (int i = 0; i plansamples - 1; i++) { + while (j * plansamples = i * d-dc.samples) { + const sample s = d-dc.sample[j]; + if (s.time.seconds != 0 (!hasMarkedSamples || s.manually_entered)) { + depthsum += s.depth.mm; + ++samplecount; + newtime = s.time; + } + j++; + } + if (samplecount) { + get_gas_at_time(d, d-dc, lasttime, gas); + plannerModel-addStop(depthsum / samplecount, newtime.seconds, gas, 0, true); + lasttime = newtime; + depthsum = 0; + samplecount = 0; + } } recalc = oldRec; emitDataChanged(); diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 23f9551..970c0f7 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -596,8 +596,9 @@ void MainWindow::on_actionReplanDive_triggered() if (!plannerStateClean() || !current_dive || !current_dive-dc.model) return; else if (strcmp(current_dive-dc.model, planned dive)) { - QMessageBox::warning(this, tr(Warning), tr(trying to replan a dive that's not a planned dive.)); - return; + if (QMessageBox::warning(this, tr(Warning), tr(trying to replan a dive that's not a planned dive.), +QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) + return; } // put us in PLAN mode DivePlannerPointsModel::instance()-clear(); -- 1.9.5 (Apple Git-50.3) From a29a39f4bf83be397f72cb870d1baa27da52a258 Mon Sep 17 00:00:00 2001 From: Robert C. Helling hell...@atdotde.de Date: Thu, 7 May 2015 23:40:34 +0200 Subject: [PATCH 2/2] Only print gasname for a segment in planner if it differs from the previous one This is to avoid visual clutter when replanning logged dives. Signed-off-by: Robert C. Helling hell...@atdotde.de --- qt-ui/profile/profilewidget2.cpp | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qt-ui/profile/profilewidget2.cpp
Re: GSoC - Customizable print formats
On 07-05-2015 15:48, Miika Turkia wrote: I know we have also plenty of people who are able to compile the master, but I wonder how many of them would actually go ahead and compile another remote branch. Hi: I would prefer having it on master, if it's all the same to you guys. Cheers: Pedro ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: GSoC - Customizable print formats
On Thu, May 7, 2015 at 5:29 PM, Long, Martin mar...@longhome.co.uk wrote: On 7 May 2015 at 07:28, Lubomir I. Ivanov neolit...@gmail.com wrote: also GSoC wise, do you think the new printing code should enter master while WIP or should it do so all at once when mostly done? Just my 2c... I would favour doing it in a branch (or in this case in Gehads own github repo), and then merging in one go at the end, over macros. Gehad can frequently merge master into his branch to keep on top of changes. Macros could get messy. However, if we want anyone to actually test this out, then I only see one option - master. We need the new functionality in the daily builds whenever there is something to test. I know we have also plenty of people who are able to compile the master, but I wonder how many of them would actually go ahead and compile another remote branch. miika ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface