Skip to content

Commit

Permalink
map
Browse files Browse the repository at this point in the history
  • Loading branch information
ic005k committed Feb 18, 2025
1 parent 871672e commit a426ee6
Show file tree
Hide file tree
Showing 5 changed files with 228 additions and 203 deletions.
12 changes: 11 additions & 1 deletion src/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -4005,7 +4005,7 @@ QSlider::handle:horizontal:disabled {
<enum>QTabWidget::South</enum>
</property>
<property name="currentIndex">
<number>3</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab_Steps">
<attribute name="title">
Expand Down Expand Up @@ -4556,6 +4556,16 @@ QSlider::handle:horizontal:disabled {
<string>Map</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_42">
<item>
<widget class="QLabel" name="lblGpsDateTime">
<property name="text">
<string>GPS Date Time</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QQuickWidget" name="qwMap">
<property name="sizePolicy">
Expand Down
23 changes: 19 additions & 4 deletions src/Steps/Steps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ Steps::Steps(QWidget* parent) : QDialog(parent) {
QFont font0 = m_Method->getNewFont(15);
mw_one->ui->lblSteps->setFont(font0);

font0.setBold(true);
font0.setPointSize(13);
mw_one->ui->lblGpsDateTime->setFont(font0);
font0.setBold(true);
mw_one->ui->lblCurrent->setFont(font0);
mw_one->ui->lblToNow->setFont(font0);
mw_one->ui->lblNow->setFont(font0);
Expand All @@ -51,6 +52,8 @@ Steps::Steps(QWidget* parent) : QDialog(parent) {
mw_one->ui->lblGpsInfo->setStyleSheet(lblStyle);
mw_one->ui->lblMonthTotal->setStyleSheet(lblStyle);
mw_one->ui->btnGetGpsListData->hide();

timer = new QTimer(this);
}

Steps::~Steps() {}
Expand Down Expand Up @@ -394,7 +397,6 @@ void Steps::startRecordMotion() {
}
#endif

timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, [this]() {
m_time = m_time.addSecs(1);

Expand All @@ -407,6 +409,8 @@ void Steps::startRecordMotion() {
if (!isGpsTest) {
latitude = m_activity.callMethod<jdouble>("getLatitude", "()D");
longitude = m_activity.callMethod<jdouble>("getLongitude", "()D");
latitude = QString::number(latitude, 'f', 6).toDouble();
longitude = QString::number(longitude, 'f', 6).toDouble();
}
QAndroidJniObject jstrGpsStatus =
m_activity.callObjectMethod<jstring>("getGpsStatus");
Expand Down Expand Up @@ -450,8 +454,7 @@ void Steps::startRecordMotion() {

mw_one->ui->qwMap->rootContext()->setContextProperty("strDistance",
str1);
mw_one->ui->qwMap->rootContext()->setContextProperty(
"strSpeed", QString::number(mySpeed) + " km/h");
mw_one->ui->qwMap->rootContext()->setContextProperty("strSpeed", str3);
}
}

Expand Down Expand Up @@ -527,6 +530,7 @@ void Steps::startRecordMotion() {

strStartTime = QTime::currentTime().toString();
t0 = QDate::currentDate().toString();
mw_one->ui->lblGpsDateTime->setText(t0 + " " + strStartTime);
mw_one->ui->qwMap->rootContext()->setContextProperty("isGpsRun", true);
}

Expand Down Expand Up @@ -806,6 +810,8 @@ void Steps::writeGpsPos(double lat, double lon, int i, int count) {
}

void Steps::getGpsTrack() {
if (timer->isActive()) return;

QQuickItem* root = mw_one->ui->qwGpsList->rootObject();
QVariant itemCount;
QMetaObject::invokeMethod((QObject*)root, "getTimeString",
Expand All @@ -814,12 +820,21 @@ void Steps::getGpsTrack() {
QStringList list = mStr.split("-=-");
QString st1 = list.at(0);
QString st2 = list.at(1);
mw_one->ui->lblGpsDateTime->setText(st1 + " " + st2);
QString st3 = list.at(2);
QString st4 = list.at(3);
st1 = st1.replace(" ", "");
st2 = st2.split("-").at(0);
QStringList list2 = st2.split(":");
st2 = list2.at(1) + list2.at(2) + list2.at(3);
st1 = st1.trimmed();
st2 = st2.trimmed();
st3 = st3.split(":").at(1);
st3 = st3.trimmed();
st4 = st4.split(":").at(1);
st4 = st4.trimmed();
mw_one->ui->qwMap->rootContext()->setContextProperty("strDistance", st3);
mw_one->ui->qwMap->rootContext()->setContextProperty("strSpeed", st4);

QString gpsFile = iniDir + st1 + "-gps-" + st2 + ".ini";
if (QFile::exists(gpsFile)) {
Expand Down
Binary file modified src/cn.qm
Binary file not shown.
Loading

0 comments on commit a426ee6

Please sign in to comment.