On 31 December 2015 at 02:41, Dirk Hohndel <[email protected]> wrote: > > > On Dec 30, 2015, at 5:22 AM, Rick Walsh <[email protected]> wrote: > > > > Scale the QML profile in two stages. Firstly, scale to fit. Secondly, > scale > > again to 95% to create a margin around the profile. > > > > The previous method scales to fit a create a margin in one step. It > appears > > more elegant, and the margin is calculated more rationally. > Unfortunately on > > some devices, including mine, the resulting profile is cropped for no > obvious > > reason. > > This does create a bigger margin than I want on some of the larger > devices, but as you point out, it appears to work which beats the hell out > of anything I achieved in three days of poking at this. > > The 95% was really an arbitrary scale to prove that at least there was some way to create a margin. It needed to be significant enough that it was clear it was definitely doing something on my phone. The attached patch should emulate what was supposed to happen with your method, with proportionally 1.5 times greater reduction in height than width, reflecting the dimensions of the profile.
> Well done, Rick! Again. > > Can I point you at a dozen more issues with Subsurface-mobile since you > clearly are the more competent person to work on this? :-) > > That was Qt/QML/Android beginners' luck, combined with my summer break, and it being hot enough outside that I actually prefer being inside during the day. Today is forecast to reach 39 C / 102 F, so I might have another commit left in me after I go for a run while it's still coolish outside. Expect very little from me in the New Year - I'm back at work on Monday, and have some data collection (diving) to do before then. > New binaries are up on the daily download site and should percolate to the > Google Play store eventually. > > Incidentally, those are also built with Qt 5.6 (current master). Since > none of my approaches worked I figured I'd try to see if anything had > changed with the very latest Qt and built the Android cross build > infrastructure from source (a very entertaining endeavor, I might add). But > I verified that Rick's patch fixes things with 5.5.1 as well. > Qt for Android from source? I thought you had enough to keep you busy as it was. If the new Qt means that the margins work as intended with your method, I will not be offended if you don't take the attached patch, and revert my previous one. Cheers, Rick
From b032b73c716b55d758027ea8749d9da3551d623b Mon Sep 17 00:00:00 2001 From: Rick Walsh <[email protected]> Date: Thu, 31 Dec 2015 06:29:21 +1100 Subject: [PATCH] QML UI: make profile margin scale proportional to dimensions The QMLProfile height is specified as ~2/3 (actually 0.66) width in DiveDetailsView.qml. In order to produce an even margin around the profile, the scaling factor reduction for height needs to be 3/2 times that for width. MarginFactor is specified as 0.013 to approximate the margin calculated by commits ef653b4 and 7e2898d for my Galaxy S6. MarginFactor = margin / width = 18 / 1365 = 0.132 Signed-off-by: Rick Walsh <[email protected]> --- qt-mobile/qmlprofile.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qt-mobile/qmlprofile.cpp b/qt-mobile/qmlprofile.cpp index ee0eea7..9c1fd32 100644 --- a/qt-mobile/qmlprofile.cpp +++ b/qt-mobile/qmlprofile.cpp @@ -40,6 +40,7 @@ void QMLProfile::setDiveId(const QString &diveId) static bool firstRun = true; static QTransform profileTransform; m_diveId = diveId; + double marginFactor = 0.013; // margin as proportion of profile display width struct dive *d = get_dive_by_uniq_id(m_diveId.toInt()); if (m_diveId.toInt() < 1) return; @@ -68,5 +69,7 @@ void QMLProfile::setDiveId(const QString &diveId) m_profileWidget->plotDive(d); // scale the profile to create a margin - m_profileWidget->scale(0.95, 0.95); + // the profile height is ~2/3 the width, so to create an even margin, + // the scale reduction for height should be 3/2 the reduction for width + m_profileWidget->scale(1 - 2 * marginFactor, 1 - 3 * marginFactor); } -- 2.5.0
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
