From becd48f35240d9ba9afad818e796b68498c7a76a Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Wed, 14 May 2014 23:35:55 +1000 Subject: [PATCH] Fix some untranslatable strings --- sleepyhead/Graphs/gLineChart.cpp | 2 +- sleepyhead/Graphs/gSummaryChart.cpp | 48 ++++++++++++++--------------- sleepyhead/SleepLib/common.cpp | 2 ++ sleepyhead/SleepLib/common.h | 1 + sleepyhead/mainwindow.cpp | 4 +-- sleepyhead/statistics.cpp | 6 ++-- 6 files changed, 33 insertions(+), 30 deletions(-) diff --git a/sleepyhead/Graphs/gLineChart.cpp b/sleepyhead/Graphs/gLineChart.cpp index f10c7167..90684774 100644 --- a/sleepyhead/Graphs/gLineChart.cpp +++ b/sleepyhead/Graphs/gLineChart.cpp @@ -706,7 +706,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion) if (!total_points) { // No Data? if (m_report_empty) { - QString msg = "No Waveform Available"; + QString msg = QObject::tr("No Waveform Available"); int x, y; GetTextExtent(msg, x, y, bigfont); //DrawText(w,msg,left+(width/2.0)-(x/2.0),scry-w.GetBottomMargin()-height/2.0+y/2.0,0,Qt::gray,bigfont); diff --git a/sleepyhead/Graphs/gSummaryChart.cpp b/sleepyhead/Graphs/gSummaryChart.cpp index ddb86624..64d87329 100644 --- a/sleepyhead/Graphs/gSummaryChart.cpp +++ b/sleepyhead/Graphs/gSummaryChart.cpp @@ -831,27 +831,27 @@ jumpnext: break; case ST_PERC: - if (tval >= 0.99) { b = "Max"; } - else if (tval == 0.5) { b = "Med"; } + if (tval >= 0.99) { b = STR_TR_Max; } + else if (tval == 0.5) { b = STR_TR_Med; } else { b = QString("%1%").arg(tval * 100.0, 0, 'f', 0); } break; //b=QString("%1%").arg(tval*100.0,0,'f',0); break; case ST_MIN: - b = "Min"; + b = STR_TR_Min; break; case ST_MAX: - b = "Max"; + b = STR_TR_Max; break; case ST_SETMIN: - b = "Min"; + b = STR_TR_Min; break; case ST_SETMAX: - b = "Max"; + b = STR_TR_Max; break; case ST_CPH: @@ -867,7 +867,7 @@ jumpnext: break; case ST_SESSIONS: - b = "Sessions"; + b = STR_TR_Sessions; break; default: @@ -943,13 +943,13 @@ jumpnext: // } }*/ - a += "Days=" + QString::number(total_days, 'f', 0); + a += QString(QObject::tr("Days=%1")).arg(total_days, 0); if (PROFILE.cpap->showComplianceInfo()) { if (ishours && incompliant > 0) { - a += " Low Usage Days=" + QString::number(incompliant, 'f', - 0) + " (%" + QString::number((1.0 / daynum) * (total_days - incompliant) * 100.0, 'f', - 2) + " compliant, defined as >" + QString::number(compliance_hours, 'f', 1) + " hours)"; + a += " "+QString(QObject::tr("Low Usage Days=%1")).arg(incompliant, 0)+ + " "+QString(QObject::tr("(%%1 compliant, defined as > %2 hours)")). + arg((1.0 / daynum) * (total_days - incompliant) * 100.0, 0, 'f', 2).arg(compliance_hours, 0, 'f', 1); } } @@ -1061,7 +1061,7 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph) z += "\r\n" + m_label + "=" + val; if (m_type[1] == ST_SESSIONS) { - z += " (Sess=" + QString::number(day->size(), 'f', 0) + ")"; + z += " "+QString(QObject::tr("(Sess=%1)")).arg(day->size(), 0); } EventDataType v = m_times[zd][0]; @@ -1069,9 +1069,9 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph) if (lastt < 0) { lastt = 0; } - z += "\r\nBedtime=" + formatTime(v, false, false, true); + z += "\r\n"+QString(QObject::tr("Bedtime=%1")).arg(formatTime(v, false, false, true)); v = m_times[zd][lastt] + m_values[zd][lastt]; - z += "\r\nWaketime=" + formatTime(v, false, false, true); + z += "\r\n"+QString(QObject::tr("Waketime=%1")).arg(formatTime(v, false, false, true)); } else if (m_graphtype == GT_BAR) { if (m_type[0] == ST_HOURS) { @@ -1103,30 +1103,30 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph) switch (m_type[i]) { case ST_WAVG: - a = "W-avg"; + a = STR_TR_WAvg; break; case ST_AVG: - a = "Avg"; + a = STR_TR_Avg; break; case ST_90P: - a = "90%"; + a = QObject::tr("90%"); break; case ST_PERC: - if (tval >= 0.99) { a = "Max"; } - else if (tval == 0.5) { a = "Med"; } + if (tval >= 0.99) { a = STR_TR_Max; } + else if (tval == 0.5) { a = STR_TR_Med; } else { a = QString("%1%").arg(tval * 100.0, 0, 'f', 0); } break; case ST_MIN: - a = "Min"; + a = STR_TR_Min; break; case ST_MAX: - a = "Max"; + a = STR_TR_Max; break; case ST_CPH: @@ -1142,15 +1142,15 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event, gGraph *graph) break; case ST_SESSIONS: - a = "Sessions"; + a = STR_TR_Sessions; break; case ST_SETMIN: - a = "Min"; + a = STR_TR_Min; break; case ST_SETMAX: - a = "Max"; + a = STR_TR_Max; break; default: diff --git a/sleepyhead/SleepLib/common.cpp b/sleepyhead/SleepLib/common.cpp index 84ebec2c..31426914 100644 --- a/sleepyhead/SleepLib/common.cpp +++ b/sleepyhead/SleepLib/common.cpp @@ -253,6 +253,7 @@ QString STR_TR_Off; QString STR_TR_Min; // Minimum QString STR_TR_Max; // Maximum +QString STR_TR_Med; // Median QString STR_TR_Average; QString STR_TR_Median; @@ -412,6 +413,7 @@ void initializeStrings() STR_TR_Min = QObject::tr("Min"); // Minimum STR_TR_Max = QObject::tr("Max"); // Maximum + STR_TR_Max = QObject::tr("Med"); // Median STR_TR_Average = QObject::tr("Average"); STR_TR_Median = QObject::tr("Median"); diff --git a/sleepyhead/SleepLib/common.h b/sleepyhead/SleepLib/common.h index 1f933232..fe701ddd 100644 --- a/sleepyhead/SleepLib/common.h +++ b/sleepyhead/SleepLib/common.h @@ -266,6 +266,7 @@ extern QString STR_TR_Off; extern QString STR_TR_Min; // Minimum extern QString STR_TR_Max; // Maximum +extern QString STR_TR_Med; // Median extern QString STR_TR_Average; extern QString STR_TR_Median; diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index fa463569..b3b76130 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -508,7 +508,7 @@ QStringList MainWindow::detectCPAPCards() QLabel waitmsg(tr("Please wait, scanning for CPAP data cards...")); QProgressBar progress; QVBoxLayout waitlayout(&popup); - QPushButton skipbtn("Click here to choose a folder"); + QPushButton skipbtn(tr("Click here to choose a folder")); waitlayout.addWidget(&waitmsg,1,Qt::AlignCenter); waitlayout.addWidget(&progress,1); waitlayout.addWidget(&skipbtn); @@ -984,7 +984,7 @@ void MainWindow::on_action_About_triggered() QString gitrev = QString(GIT_REVISION); - if (!gitrev.isEmpty()) { gitrev = "Revision: " + gitrev + " (" + QString(GIT_BRANCH) + " branch)"; } + if (!gitrev.isEmpty()) { gitrev = tr("Revision:")+" " + gitrev + " (" + QString(GIT_BRANCH) + " " + tr("branch") + ")"; } // "
" QString msg = QString("" diff --git a/sleepyhead/statistics.cpp b/sleepyhead/statistics.cpp index 9d0a06e3..84374b7f 100644 --- a/sleepyhead/statistics.cpp +++ b/sleepyhead/statistics.cpp @@ -610,13 +610,13 @@ QString Statistics::GenerateHTML() arg(QString(tr("No %1 data available.")).arg(machine)); } else if (value == 1) { html+=QString("%2\n").arg(periods.size()+1). - arg(QString("%1 day of %2 Data on %3") + arg(QString(tr("%1 day of %2 Data on %3")) .arg(value) .arg(machine) .arg(last.toString())); } else { html+=QString("%2\n").arg(periods.size()+1). - arg(QString("%1 days of %2 Data, between %3 and %4") + arg(QString(tr("%1 days of %2 Data, between %3 and %4")) .arg(value) .arg(machine) .arg(first.toString()) @@ -634,7 +634,7 @@ QString Statistics::GenerateHTML() if ((id == NoChannel) || (!PROFILE.hasChannel(id))) { continue; } - name = calcnames[row.calc].arg(row.src); + name = calcnames[row.calc].arg(schema::channel[id].fullname()); } html += QString("%1").arg(name); for (int j=0; j < periods.size(); j++) {