Skip to content

Commit 424ed85

Browse files
committed
Merge branch 'master' into Nordictrack-GX-4.5-Pro
2 parents 410409f + 1ff9da3 commit 424ed85

8 files changed

Lines changed: 178 additions & 48 deletions

File tree

build-qdomyos-zwift-Qt_5_15_2_for_iOS-Debug/qdomyoszwift.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4583,7 +4583,7 @@
45834583
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
45844584
CODE_SIGN_ENTITLEMENTS = "../src/ios/qdomyos-zwift.entitlements";
45854585
COPY_PHASE_STRIP = NO;
4586-
CURRENT_PROJECT_VERSION = 1277;
4586+
CURRENT_PROJECT_VERSION = 1278;
45874587
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
45884588
DEVELOPMENT_TEAM = 6335M7T29D;
45894589
ENABLE_BITCODE = NO;
@@ -4784,7 +4784,7 @@
47844784
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
47854785
CODE_SIGN_ENTITLEMENTS = "../src/ios/qdomyos-zwift.entitlements";
47864786
COPY_PHASE_STRIP = NO;
4787-
CURRENT_PROJECT_VERSION = 1277;
4787+
CURRENT_PROJECT_VERSION = 1278;
47884788
DEBUG_INFORMATION_FORMAT = dwarf;
47894789
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
47904790
DEVELOPMENT_TEAM = 6335M7T29D;
@@ -5021,7 +5021,7 @@
50215021
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
50225022
CODE_SIGN_IDENTITY = "Apple Development";
50235023
CODE_SIGN_STYLE = Automatic;
5024-
CURRENT_PROJECT_VERSION = 1277;
5024+
CURRENT_PROJECT_VERSION = 1278;
50255025
DEVELOPMENT_TEAM = 6335M7T29D;
50265026
ENABLE_BITCODE = YES;
50275027
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -5117,7 +5117,7 @@
51175117
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
51185118
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
51195119
CODE_SIGN_STYLE = Automatic;
5120-
CURRENT_PROJECT_VERSION = 1277;
5120+
CURRENT_PROJECT_VERSION = 1278;
51215121
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
51225122
DEVELOPMENT_TEAM = 6335M7T29D;
51235123
ENABLE_BITCODE = YES;
@@ -5209,7 +5209,7 @@
52095209
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
52105210
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
52115211
CODE_SIGN_STYLE = Automatic;
5212-
CURRENT_PROJECT_VERSION = 1277;
5212+
CURRENT_PROJECT_VERSION = 1278;
52135213
DEVELOPMENT_ASSET_PATHS = "\"watchkit Extension/Preview Content\"";
52145214
ENABLE_BITCODE = YES;
52155215
ENABLE_PREVIEWS = YES;
@@ -5325,7 +5325,7 @@
53255325
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
53265326
CODE_SIGN_ENTITLEMENTS = "watchkit Extension/WatchKit Extension.entitlements";
53275327
CODE_SIGN_STYLE = Automatic;
5328-
CURRENT_PROJECT_VERSION = 1277;
5328+
CURRENT_PROJECT_VERSION = 1278;
53295329
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
53305330
DEVELOPMENT_ASSET_PATHS = "\"watchkit Extension/Preview Content\"";
53315331
ENABLE_BITCODE = YES;
@@ -5435,7 +5435,7 @@
54355435
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
54365436
CODE_SIGN_ENTITLEMENTS = QZWidgetExtension.entitlements;
54375437
CODE_SIGN_STYLE = Automatic;
5438-
CURRENT_PROJECT_VERSION = 1277;
5438+
CURRENT_PROJECT_VERSION = 1278;
54395439
DEVELOPMENT_TEAM = 6335M7T29D;
54405440
ENABLE_STRICT_OBJC_MSGSEND = YES;
54415441
ENABLE_TESTABILITY = YES;
@@ -5526,7 +5526,7 @@
55265526
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
55275527
CODE_SIGN_ENTITLEMENTS = QZWidgetExtension.entitlements;
55285528
CODE_SIGN_STYLE = Automatic;
5529-
CURRENT_PROJECT_VERSION = 1277;
5529+
CURRENT_PROJECT_VERSION = 1278;
55305530
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
55315531
DEVELOPMENT_TEAM = 6335M7T29D;
55325532
ENABLE_NS_ASSERTIONS = NO;

src/Wizard.qml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ Page {
3131
property int age: 35
3232
property string sex: "Male"
3333
property bool miles_unit: false
34+
property bool weight_kg_unit: false
3435
property string heart_rate_belt_name: "Disabled"
3536
property bool garmin_companion: false
3637
property string filter_device: "Disabled"
38+
property bool weight_kg_unit: false
3739
}
3840

3941
background: Rectangle {
@@ -1181,21 +1183,21 @@ Page {
11811183

11821184
Text {
11831185
Layout.alignment: Qt.AlignHCenter
1184-
text: qsTr("Weight (" + (settings.miles_unit ? "lbs" : "kg") + ")")
1186+
text: qsTr("Weight (" + ((settings.miles_unit && !settings.weight_kg_unit) ? "lbs" : "kg") + ")")
11851187
font.pixelSize: 20
11861188
color: "white"
11871189
}
11881190

11891191
SpinBox {
11901192
id: weightSpinBox
11911193
Layout.alignment: Qt.AlignHCenter
1192-
from: settings.miles_unit ? 660 : 300 // 66.0 lbs or 30.0 kg
1193-
to: settings.miles_unit ? 4400 : 2000 // 440.0 lbs or 200.0 kg
1194-
value: settings.miles_unit ? (settings.weight * 2.20462 * 10).toFixed(0) : (settings.weight * 10)
1194+
from: (settings.miles_unit && !settings.weight_kg_unit) ? 660 : 300 // 66.0 lbs or 30.0 kg
1195+
to: (settings.miles_unit && !settings.weight_kg_unit) ? 4400 : 2000 // 440.0 lbs or 200.0 kg
1196+
value: (settings.miles_unit && !settings.weight_kg_unit) ? (settings.weight * 2.20462 * 10).toFixed(0) : (settings.weight * 10)
11951197
stepSize: 1
11961198
editable: true
11971199

1198-
property real realValue: settings.miles_unit ? value / 22.0462 : value / 10
1200+
property real realValue: (settings.miles_unit && !settings.weight_kg_unit) ? value / 22.0462 : value / 10
11991201

12001202
textFromValue: function(value, locale) {
12011203
return Number(value / 10).toLocaleString(locale, 'f', 1)

src/devices/bluetooth.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ void bluetooth::deviceDiscovered(const QBluetoothDeviceInfo &device) {
15381538
b.name().toUpper().startsWith(QStringLiteral("TM4500")) ||
15391539
b.name().toUpper().startsWith(QStringLiteral("TM6500")) ||
15401540
b.name().toUpper().startsWith(QStringLiteral("RUNN ")) ||
1541-
b.name().toUpper().startsWith(QStringLiteral("YS_T1MPLUST")) ||
1541+
b.name().toUpper().startsWith(QStringLiteral("YS_T")) ||
15421542
b.name().toUpper().startsWith(QStringLiteral("YPOO-MINI PRO-")) ||
15431543
b.name().toUpper().startsWith(QStringLiteral("BFX_T")) ||
15441544
(b.name().toUpper().startsWith("3G PRO ")) ||

src/homeform.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5396,6 +5396,7 @@ void homeform::update() {
53965396
double stepCount = 0;
53975397

53985398
bool miles = settings.value(QZSettings::miles_unit, QZSettings::default_miles_unit).toBool();
5399+
bool weight_kg_unit = settings.value(QZSettings::weight_kg_unit, QZSettings::default_weight_kg_unit).toBool();
53995400
double ftpSetting = settings.value(QZSettings::ftp, QZSettings::default_ftp).toDouble();
54005401
double unit_conversion = 1.0;
54015402
double meter_feet_conversion = 1.0;
@@ -5679,7 +5680,7 @@ void homeform::update() {
56795680
datetime->setValue(formattedTime);
56805681
watts = bluetoothManager->device()->wattsMetricforUI();
56815682
watt->setValue(QString::number(watts, 'f', 0));
5682-
weightLoss->setValue(QString::number(miles ? bluetoothManager->device()->weightLoss() * 35.274
5683+
weightLoss->setValue(QString::number((miles && !weight_kg_unit) ? bluetoothManager->device()->weightLoss() * 35.274
56835684
: bluetoothManager->device()->weightLoss(),
56845685
'f', 2));
56855686

src/inner_templates/googlemaps/maps.htm

Lines changed: 111 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@
7171
</body>
7272
<body>
7373
<div id="cesiumContainer" class="cesiumContainer"></div>
74-
<div id="metricsContainer" style="position: absolute; bottom: 0px; right: 0px; width: 200px; height: 250px; touch-action: none; user-select: none;">
75-
<div class="metrics" style="color: #FFFFFF; width: 100%; height: 100%; margin: 0; border-radius: 25px; border: 2px solid #73AD21; background: #73AD21; padding: 8px; box-sizing: border-box; overflow: hidden; position: relative;">
74+
<div id="metricsContainer" style="position: absolute; bottom: 0px; right: 0px; width: 200px; height: 250px; touch-action: none; user-select: none; z-index: 1000;">
75+
<div class="metrics" style="color: #FFFFFF; width: 100%; height: 100%; margin: 0; border-radius: 25px; border: 2px solid #73AD21; background: #73AD21; padding: 8px; box-sizing: border-box; overflow: hidden; position: relative; touch-action: none;">
7676
<div id="metricsText" style="font-size: 12px; line-height: 1.4;">🏃Speed: 0.00<br>🚴Cadence:0<br>💓Heart:0<br>🔥Calories:0.0<br>📏Odometer:0.00<br>⚡Watt:0<br>⏲️Elapsed:0:00:00<br>📐Inclination:0.0<br>🧲Resistance:0<br>✈️Altitude:0.0<br>⛰️Elevation:0.0</div>
77-
<div id="resizeHandle" style="position: absolute; bottom: 0; right: 0; width: 20px; height: 20px; background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.5) 50%); cursor: nwse-resize; border-bottom-right-radius: 23px;"></div>
77+
<div id="resizeHandle" style="position: absolute; bottom: 0; right: 0; width: 50px; height: 50px; background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.8) 50%); cursor: nwse-resize; border-bottom-right-radius: 23px; display: flex; align-items: flex-end; justify-content: flex-end; font-size: 24px; color: rgba(0,0,0,0.6); padding-bottom: 2px; padding-right: 4px;"></div>
7878
</div>
7979
</div>
80-
<div style="border: 0px solid #aaa; border-radius: 10px; overflow: hidden; position:absolute; bottom: 0px; right: 150px; width=150px; height=75px"><canvas id="canvasChart" style="width=150px; height=75px; border-right: 0pt solid #ffff00;"></canvas></div>
80+
<div id="chartContainer" style="border: 0px solid #aaa; border-radius: 10px; overflow: hidden; position:absolute; bottom: 0px; right: 150px; width=150px; height=75px; z-index: 999; touch-action: none;"><canvas id="canvasChart" style="width=150px; height=75px; border-right: 0pt solid #ffff00;"></canvas></div>
8181
<script type="text/javascript">
8282
let cameraComplete = true
8383
let lastAzimuth = 0
@@ -325,12 +325,29 @@
325325
const container = document.getElementById('metricsContainer');
326326
const resizeHandle = document.getElementById('resizeHandle');
327327
const metricsText = document.getElementById('metricsText');
328+
const chartContainer = document.getElementById('chartContainer');
328329

329330
let isDragging = false;
330331
let isResizing = false;
331332
let startX, startY, startLeft, startTop, startWidth, startHeight;
332333
let resizeTimeout = null;
333334

335+
// Update chart position to follow metrics container
336+
function updateChartPosition() {
337+
// Position chart to the left of metrics container, aligned at bottom
338+
const metricsLeft = container.offsetLeft;
339+
const metricsTop = container.offsetTop;
340+
const metricsHeight = container.offsetHeight;
341+
const chartWidth = chartContainer.offsetWidth;
342+
const chartHeight = chartContainer.offsetHeight;
343+
344+
// Position chart: 10px to the left of metrics, aligned at bottom
345+
chartContainer.style.left = (metricsLeft - chartWidth - 10) + 'px';
346+
chartContainer.style.top = (metricsTop + metricsHeight - chartHeight) + 'px';
347+
chartContainer.style.right = 'auto';
348+
chartContainer.style.bottom = 'auto';
349+
}
350+
334351
// Load saved position and size
335352
function loadState() {
336353
const saved = localStorage.getItem('metricsContainerState');
@@ -343,6 +360,7 @@
343360
if (state.bottom !== undefined) container.style.bottom = state.bottom + 'px';
344361
if (state.width) container.style.width = state.width + 'px';
345362
if (state.height) container.style.height = state.height + 'px';
363+
updateChartPosition();
346364
updateFontSize();
347365
} catch (e) {
348366
console.error('Error loading metrics state:', e);
@@ -438,6 +456,18 @@
438456
return { x: e.clientX, y: e.clientY };
439457
}
440458

459+
// Check if touch/click is in resize handle area (bottom-right 50x50px)
460+
function isInResizeHandle(x, y) {
461+
const rect = container.getBoundingClientRect();
462+
const handleSize = 50;
463+
return (
464+
x >= rect.right - handleSize &&
465+
x <= rect.right &&
466+
y >= rect.bottom - handleSize &&
467+
y <= rect.bottom
468+
);
469+
}
470+
441471
// Start dragging
442472
function startDrag(e) {
443473
if (isResizing) return;
@@ -449,6 +479,15 @@
449479
startTop = container.offsetTop;
450480
container.style.right = 'auto';
451481
container.style.bottom = 'auto';
482+
483+
// Add global listeners
484+
document.addEventListener('mousemove', handleMove);
485+
document.addEventListener('touchmove', handleMove, { passive: false });
486+
document.addEventListener('mouseup', endDragOrResize);
487+
document.addEventListener('touchend', endDragOrResize);
488+
document.addEventListener('touchcancel', endDragOrResize);
489+
490+
e.stopPropagation();
452491
e.preventDefault();
453492
}
454493

@@ -460,19 +499,34 @@
460499
startY = coords.y;
461500
startWidth = container.offsetWidth;
462501
startHeight = container.offsetHeight;
502+
503+
// Add global listeners
504+
document.addEventListener('mousemove', handleMove);
505+
document.addEventListener('touchmove', handleMove, { passive: false });
506+
document.addEventListener('mouseup', endDragOrResize);
507+
document.addEventListener('touchend', endDragOrResize);
508+
document.addEventListener('touchcancel', endDragOrResize);
509+
463510
e.stopPropagation();
464511
e.preventDefault();
465512
}
466513

467514
// Handle move
468515
function handleMove(e) {
516+
// Only handle if we're actually dragging or resizing
517+
if (!isDragging && !isResizing) {
518+
return;
519+
}
520+
469521
const coords = getCoordinates(e);
470522

471523
if (isDragging) {
472524
const deltaX = coords.x - startX;
473525
const deltaY = coords.y - startY;
474526
container.style.left = (startLeft + deltaX) + 'px';
475527
container.style.top = (startTop + deltaY) + 'px';
528+
updateChartPosition();
529+
e.stopPropagation();
476530
e.preventDefault();
477531
} else if (isResizing) {
478532
const deltaX = coords.x - startX;
@@ -481,49 +535,84 @@
481535
const newHeight = Math.max(100, startHeight + deltaY);
482536
container.style.width = newWidth + 'px';
483537
container.style.height = newHeight + 'px';
538+
updateChartPosition();
484539
debouncedUpdateFontSize();
540+
e.stopPropagation();
485541
e.preventDefault();
486542
}
487543
}
488544

489545
// End drag or resize
490546
function endDragOrResize(e) {
491-
if (isDragging || isResizing) {
547+
const wasDragging = isDragging;
548+
const wasResizing = isResizing;
549+
550+
// Always reset state first
551+
isDragging = false;
552+
isResizing = false;
553+
554+
// Always remove listeners to prevent leaks
555+
document.removeEventListener('mousemove', handleMove);
556+
document.removeEventListener('touchmove', handleMove);
557+
document.removeEventListener('mouseup', endDragOrResize);
558+
document.removeEventListener('touchend', endDragOrResize);
559+
document.removeEventListener('touchcancel', endDragOrResize);
560+
561+
// Only save state if we were actually dragging/resizing
562+
if (wasDragging || wasResizing) {
492563
saveState();
493564
// If we were resizing, clear pending timeout and update immediately
494-
if (isResizing) {
565+
if (wasResizing) {
495566
if (resizeTimeout) {
496567
clearTimeout(resizeTimeout);
497568
resizeTimeout = null;
498569
}
499570
updateFontSize();
500571
}
501572
}
502-
isDragging = false;
503-
isResizing = false;
504573
}
505574

506-
// Add event listeners for dragging (on container, but not on resize handle)
575+
// Check if touch/click is inside container
576+
function isInsideContainer(x, y) {
577+
const rect = container.getBoundingClientRect();
578+
return (
579+
x >= rect.left &&
580+
x <= rect.right &&
581+
y >= rect.top &&
582+
y <= rect.bottom
583+
);
584+
}
585+
586+
// Add event listeners for dragging/resizing on container
507587
container.addEventListener('mousedown', function(e) {
508-
if (e.target !== resizeHandle) startDrag(e);
588+
const coords = getCoordinates(e);
589+
// Double check we're actually inside the container
590+
if (!isInsideContainer(coords.x, coords.y)) {
591+
return;
592+
}
593+
if (isInResizeHandle(coords.x, coords.y)) {
594+
startResize(e);
595+
} else {
596+
startDrag(e);
597+
}
509598
});
510599
container.addEventListener('touchstart', function(e) {
511-
if (e.target !== resizeHandle) startDrag(e);
512-
});
513-
514-
// Add event listeners for resizing (on resize handle)
515-
resizeHandle.addEventListener('mousedown', startResize);
516-
resizeHandle.addEventListener('touchstart', startResize);
517-
518-
// Add global move and end listeners
519-
document.addEventListener('mousemove', handleMove);
520-
document.addEventListener('touchmove', handleMove, { passive: false });
521-
document.addEventListener('mouseup', endDragOrResize);
522-
document.addEventListener('touchend', endDragOrResize);
600+
const coords = getCoordinates(e);
601+
// Double check we're actually inside the container
602+
if (!isInsideContainer(coords.x, coords.y)) {
603+
return;
604+
}
605+
if (isInResizeHandle(coords.x, coords.y)) {
606+
startResize(e);
607+
} else {
608+
startDrag(e);
609+
}
610+
}, { passive: false });
523611

524612
// Load saved state and set initial font size
525613
loadState();
526614
updateFontSize();
615+
updateChartPosition();
527616
})();
528617
</script>
529618
</body>

src/qzsettings.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ const QString QZSettings::default_user_email = QLatin1String("");
9292
const QString QZSettings::user_nickname = QStringLiteral("user_nickname");
9393
const QString QZSettings::default_user_nickname = QStringLiteral("");
9494
const QString QZSettings::miles_unit = QStringLiteral("miles_unit");
95+
const QString QZSettings::weight_kg_unit = QStringLiteral("weight_kg_unit");
9596
const QString QZSettings::pause_on_start = QStringLiteral("pause_on_start");
9697
const QString QZSettings::treadmill_force_speed = QStringLiteral("treadmill_force_speed");
9798
const QString QZSettings::pause_on_start_treadmill = QStringLiteral("pause_on_start_treadmill");
@@ -1112,6 +1113,7 @@ QVariant allSettings[allSettingsCount][2] = {
11121113
{QZSettings::user_email, QZSettings::default_user_email},
11131114
{QZSettings::user_nickname, QZSettings::default_user_nickname},
11141115
{QZSettings::miles_unit, QZSettings::default_miles_unit},
1116+
{QZSettings::weight_kg_unit, QZSettings::default_weight_kg_unit},
11151117
{QZSettings::pause_on_start, QZSettings::default_pause_on_start},
11161118
{QZSettings::treadmill_force_speed, QZSettings::default_treadmill_force_speed},
11171119
{QZSettings::pause_on_start_treadmill, QZSettings::default_pause_on_start_treadmill},

src/qzsettings.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,12 @@ class QZSettings {
272272
static const QString miles_unit;
273273
static constexpr bool default_miles_unit = false;
274274

275+
/**
276+
*@brief Use kg for weight even when miles_unit is true (for UK users).
277+
*/
278+
static const QString weight_kg_unit;
279+
static constexpr bool default_weight_kg_unit = false;
280+
275281
static const QString pause_on_start;
276282
static constexpr bool default_pause_on_start = false;
277283

0 commit comments

Comments
 (0)