mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
change sprinf to asprintf for QT obsolence
This commit is contained in:
parent
f60edcc637
commit
a0f87f72f4
@ -864,7 +864,7 @@ void gGraph::mouseMoveEvent(QMouseEvent *event)
|
||||
m_selDurString = tr("%1 days").arg(floor(d));
|
||||
} else {
|
||||
|
||||
m_selDurString.sprintf("%02i:%02i:%02i:%03i", h, m, s, ms);
|
||||
m_selDurString.asprintf("%02i:%02i:%02i:%03i", h, m, s, ms);
|
||||
}
|
||||
|
||||
ToolTipAlignment align = x >= x2 ? TT_AlignLeft : TT_AlignRight;
|
||||
|
@ -425,7 +425,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
||||
|
||||
//#define DEBUG_AUTOSCALER
|
||||
#ifdef DEBUG_AUTOSCALER
|
||||
QString a = QString().sprintf("%.2f - %.2f",miny, maxy);
|
||||
QString a = QString().asprintf("%.2f - %.2f",miny, maxy);
|
||||
w.renderText(a,width/2,top-5);
|
||||
#endif
|
||||
|
||||
|
@ -7,6 +7,9 @@
|
||||
* License. See the file COPYING in the main directory of the source code
|
||||
* for more details. */
|
||||
|
||||
#define TEST_MACROS_ENABLEDoff
|
||||
#include "test_macros.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <QLabel>
|
||||
#include <QDateTime>
|
||||
@ -954,7 +957,7 @@ jumpnext:
|
||||
if (type == ST_HOURS) {
|
||||
int h = f;
|
||||
int m = int(f * 60) % 60;
|
||||
val.sprintf("%02i:%02i", h, m);
|
||||
val.asprintf("%02i:%02i", h, m);
|
||||
ishours = true;
|
||||
} else {
|
||||
val = QString::number(f, 'f', 2);
|
||||
@ -1045,9 +1048,9 @@ QString formatTime(EventDataType v, bool show_seconds = false, bool duration = f
|
||||
}
|
||||
|
||||
if (show_seconds) {
|
||||
return QString().sprintf("%i:%02i:%02i%s", h, m, s, pm);
|
||||
return QString().asprintf("%i:%02i:%02i%s", h, m, s, pm);
|
||||
} else {
|
||||
return QString().sprintf("%i:%02i%s", h, m, pm);
|
||||
return QString().asprintf("%i:%02i%s", h, m, pm);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1117,7 +1120,7 @@ bool gOverviewGraph::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
||||
int h = t / 3600;
|
||||
int m = (t / 60) % 60;
|
||||
//int s=t % 60;
|
||||
val.sprintf("%02i:%02i", h, m);
|
||||
val.asprintf("%02i:%02i", h, m);
|
||||
} else {
|
||||
val = QString::number(d.value()[0], 'f', 2);
|
||||
}
|
||||
@ -1144,7 +1147,7 @@ bool gOverviewGraph::mouseMoveEvent(QMouseEvent *event, gGraph *graph)
|
||||
int h = t / 3600;
|
||||
int m = (t / 60) % 60;
|
||||
//int s=t % 60;
|
||||
val.sprintf("%02i:%02i", h, m);
|
||||
val.asprintf("%02i:%02i", h, m);
|
||||
} else {
|
||||
val = QString::number(d.value()[0], 'f', 2);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ void gTTIAChart::populate(Day *day, int idx)
|
||||
int h = ttia / 3600;
|
||||
int m = int(ttia) / 60 % 60;
|
||||
int s = int(ttia) % 60;
|
||||
slices.append(SummaryChartSlice(&calcitems[0], ttia / 60.0, ttia / 60.0, QObject::tr("\nTTIA: %1").arg(QString().sprintf("%02i:%02i:%02i",h,m,s)), QColor(255,147,150)));
|
||||
slices.append(SummaryChartSlice(&calcitems[0], ttia / 60.0, ttia / 60.0, QObject::tr("\nTTIA: %1").arg( QString().asprintf("%02i:%02i:%02i",h,m,s)) , QColor(255,147,150)));
|
||||
}
|
||||
|
||||
QString gTTIAChart::tooltipData(Day *, int idx)
|
||||
|
@ -343,9 +343,9 @@ const QString gYAxisTime::Format(EventDataType v, int dp)
|
||||
pm[0] = 0;
|
||||
}
|
||||
|
||||
if (dp > 2) { return QString().sprintf("%02i:%02i:%02i%s", h, m, s, pm); }
|
||||
if (dp > 2) { return QString().asprintf("%02i:%02i:%02i%s", h, m, s, pm) ; }
|
||||
|
||||
return QString().sprintf("%i:%02i%s", h, m, pm);
|
||||
return QString().asprintf("%i:%02i%s", h, m, pm) ;
|
||||
}
|
||||
|
||||
const QString gYAxisWeight::Format(EventDataType v, int dp)
|
||||
|
@ -448,9 +448,9 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
|
||||
// COMMAND_GET_SESSION_TIME --- the date part
|
||||
case 0x07: // 7,80,80,80,94,8e,88,92
|
||||
|
||||
year = QString().sprintf("%02i%02i",buffer.at(idx+4), buffer.at(idx+5)).toInt();
|
||||
month = QString().sprintf("%02i", buffer.at(idx+6)).toInt();
|
||||
day = QString().sprintf("%02i", buffer.at(idx+7)).toInt();
|
||||
year = QString().asprintf("%02i%02i",buffer.at(idx+4), buffer.at(idx+5)).toInt();
|
||||
month = QString().asprintf("%02i", buffer.at(idx+6)).toInt();
|
||||
day = QString().asprintf("%02i", buffer.at(idx+7)).toInt();
|
||||
|
||||
if ( year == 0 ) {
|
||||
imp_date = QDate::currentDate();
|
||||
@ -503,7 +503,7 @@ void CMS50F37Loader::processBytes(QByteArray bytes)
|
||||
|
||||
// COMMAND_GET_SESSION_TIME
|
||||
case 0x12: // 12,80,80,80,82,a6,92,80
|
||||
tmpstr = QString().sprintf("%02i:%02i:%02i",buffer.at(idx+4), buffer.at(idx+5), buffer.at(idx+6));
|
||||
tmpstr = QString().asprintf("%02i:%02i:%02i",buffer.at(idx+4), buffer.at(idx+5), buffer.at(idx+6));
|
||||
imp_time = QTime::fromString(tmpstr, "HH:mm:ss");
|
||||
qDebug() << "cms50f37 - pB: tmpStr:" << tmpstr << " impTime: " << imp_time;
|
||||
|
||||
@ -640,7 +640,7 @@ void CMS50F37Loader::sendCommand(quint8 c)
|
||||
|
||||
QString out;
|
||||
for (int i=0;i < 9;i++)
|
||||
out += QString().sprintf("%02X ",cmd[i]);
|
||||
out += QString().asprintf("%02X ",cmd[i]);
|
||||
qDebug() << "cms50f37 - Write:" << out;
|
||||
|
||||
if (serial.write((char *)cmd, 9) == -1) {
|
||||
@ -656,7 +656,7 @@ void CMS50F37Loader::sendCommand(quint8 c, quint8 c2)
|
||||
|
||||
QString out;
|
||||
for (int i=0; i < 9; ++i)
|
||||
out += QString().sprintf("%02X ",cmd[i]);
|
||||
out += QString().asprintf("%02X ",cmd[i]);
|
||||
qDebug() << "cms50f37 - Write:" << out;
|
||||
|
||||
if (serial.write((char *)cmd, 9) == -1) {
|
||||
@ -673,7 +673,7 @@ void CMS50F37Loader::eraseSession(int user, int session)
|
||||
|
||||
QString out;
|
||||
for (int i=0; i < 9; ++i)
|
||||
out += QString().sprintf("%02X ",cmd[i]);
|
||||
out += QString().asprintf("%02X ",cmd[i]);
|
||||
qDebug() << "cms50f37 - Erase Session: Write:" << out;
|
||||
|
||||
if (serial.write((char *)cmd, 9) == -1) {
|
||||
@ -711,7 +711,7 @@ void CMS50F37Loader::setDeviceID(const QString & newid)
|
||||
|
||||
QString out;
|
||||
for (int i=0; i < 9; ++i)
|
||||
out += QString().sprintf("%02X ",cmd[i]);
|
||||
out += QString().asprintf("%02X ",cmd[i]);
|
||||
qDebug() << "cms50f37 - setDeviceID: Write:" << out;
|
||||
|
||||
if (serial.write((char *)cmd, 9) == -1) {
|
||||
|
@ -194,7 +194,7 @@ bool MD300W1Loader::readDATFile(const QString & path)
|
||||
int gap;
|
||||
for (int pos = 0; pos < n; ++pos) {
|
||||
int i = 3 + (pos * 11);
|
||||
QString datestr = QString().sprintf("%02d/%02d/%02d %02d:%02d:%02d",
|
||||
QString datestr = QString().asprintf("%02d/%02d/%02d %02d:%02d:%02d",
|
||||
(unsigned char)data.at(i+4),(unsigned char)data.at(i+5),(unsigned char)data.at(i+3),
|
||||
(unsigned char)data.at(i+6),(unsigned char)data.at(i+7),(unsigned char)data.at(i+8));
|
||||
// Ensure date is correct first to ensure DST is handled correctly
|
||||
|
@ -389,7 +389,7 @@ int MSeriesLoader::Open(const QString & path)
|
||||
QString a;
|
||||
|
||||
for (int i = 0; i < 0x13; i++) {
|
||||
a += QString().sprintf("%02X ", cb[i]);
|
||||
a += QString().asprintf("%02X ", cb[i]);
|
||||
}
|
||||
|
||||
a += " " + date.toString() + " " + time.toString();
|
||||
|
@ -152,7 +152,7 @@ int WeinmannLoader::Open(const QString & dirpath)
|
||||
|
||||
unsigned char *p = weekco;
|
||||
for (int c=0; c < wccount; ++c) {
|
||||
int year = QString().sprintf("%02i%02i", p[0], p[1]).toInt();
|
||||
int year = QString().asprintf("%02i%02i", p[0], p[1]).toInt();
|
||||
int month = p[2];
|
||||
int day = p[3];
|
||||
int hour = p[5];
|
||||
@ -206,7 +206,7 @@ int WeinmannLoader::Open(const QString & dirpath)
|
||||
|
||||
//int c = index[DayComplianceCount];
|
||||
for (int i=0; i < 5; i++) {
|
||||
int year = QString().sprintf("%02i%02i", p[0], p[1]).toInt();
|
||||
int year = QString().asprintf("%02i%02i", p[0], p[1]).toInt();
|
||||
int month = p[2];
|
||||
int day = p[3];
|
||||
int hour = p[5];
|
||||
@ -250,7 +250,7 @@ int WeinmannLoader::Open(const QString & dirpath)
|
||||
sess->really_set_last(qint64(ts+dur) * 1000L);
|
||||
sessions[ts] = sess;
|
||||
|
||||
// qDebug() << date << ts << dur << QString().sprintf("%02i:%02i:%02i", dur / 3600, dur/60 % 60, dur % 60);
|
||||
// qDebug() << date << ts << dur << QString().asprintf("%02i:%02i:%02i", dur / 3600, dur/60 % 60, dur % 60);
|
||||
|
||||
p += 0xd6;
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ class Machine
|
||||
|
||||
|
||||
//! \brief Returns the machineID as a lower case hexadecimal string
|
||||
QString hexid() { return QString().sprintf("%08lx", m_id); }
|
||||
QString hexid() { return QString().asprintf("%08lx", m_id); }
|
||||
|
||||
|
||||
//! \brief Unused, increments the most recent sessionID
|
||||
|
@ -101,7 +101,7 @@ void Session::setEnabled(bool b)
|
||||
|
||||
QString Session::eventFile() const
|
||||
{
|
||||
return s_machine->getEventsPath()+QString().sprintf("%08lx.001", s_session);
|
||||
return s_machine->getEventsPath()+QString().asprintf("%08lx.001", s_session);
|
||||
}
|
||||
|
||||
//const int max_pack_size=128;
|
||||
@ -136,7 +136,7 @@ bool Session::Destroy()
|
||||
{
|
||||
QDir dir;
|
||||
QString base;
|
||||
base.sprintf("%08lx", s_session);
|
||||
base.asprintf("%08lx", s_session);
|
||||
|
||||
QString summaryfile = s_machine->getSummariesPath() + base + ".000";
|
||||
QString eventfile = s_machine->getEventsPath() + base + ".001";
|
||||
@ -311,7 +311,7 @@ bool Session::StoreSummary()
|
||||
return false;
|
||||
}
|
||||
|
||||
QString filename = s_machine->getSummariesPath() + QString().sprintf("%08lx.000", s_session);
|
||||
QString filename = s_machine->getSummariesPath() + QString().asprintf("%08lx.000", s_session) ;
|
||||
|
||||
QFile file(filename);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
@ -388,7 +388,7 @@ bool Session::LoadSummary()
|
||||
// static int sumcnt = 0;
|
||||
|
||||
if (s_summary_loaded) return true;
|
||||
QString filename = s_machine->getSummariesPath() + QString().sprintf("%08lx.000", s_session);
|
||||
QString filename = s_machine->getSummariesPath() + QString().asprintf("%08lx.000", s_session);
|
||||
|
||||
if (filename.isEmpty()) {
|
||||
qDebug() << "Empty summary filename";
|
||||
@ -669,7 +669,7 @@ bool Session::StoreEvents()
|
||||
QString path = s_machine->getEventsPath();
|
||||
QDir dir;
|
||||
dir.mkpath(path);
|
||||
QString filename = path+QString().sprintf("%08lx.001", s_session);
|
||||
QString filename = path+ QString().asprintf("%08lx.001", s_session) ;
|
||||
|
||||
QFile file(filename);
|
||||
if (!file.open(QIODevice::WriteOnly)) {
|
||||
|
@ -1445,7 +1445,7 @@ QString Daily::getStatisticsInfo(Day * day)
|
||||
int s = ttia % 60;
|
||||
if (ttia > 0) {
|
||||
html+="<tr><td colspan=3 align='left' bgcolor='white'><b>"+tr("Total time in apnea") +
|
||||
QString("</b></td><td colspan=2 bgcolor='white'>%1</td></tr>").arg(QString().sprintf("%02i:%02i:%02i",h,m,s));
|
||||
QString("</b></td><td colspan=2 bgcolor='white'>%1</td></tr>").arg(QString().asprintf("%02i:%02i:%02i",h,m,s));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1517,7 +1517,7 @@ QString Daily::getSleepTime(Day * day)
|
||||
.arg(date.date().toString(Qt::SystemLocaleShortDate))
|
||||
.arg(date.toString("HH:mm:ss"))
|
||||
.arg(date2.toString("HH:mm:ss"))
|
||||
.arg(QString().sprintf("%02i:%02i:%02i",h,m,s));
|
||||
.arg(QString().asprintf("%02i:%02i:%02i",h,m,s));
|
||||
html+="</table>\n";
|
||||
// html+="<hr/>";
|
||||
|
||||
|
@ -257,7 +257,8 @@ void ExportCSV::on_exportButton_clicked()
|
||||
int h = time / 3600;
|
||||
int m = int(time / 60) % 60;
|
||||
int s = int(time) % 60;
|
||||
data += sep + QString().sprintf("%02i:%02i:%02i", h, m, s);
|
||||
data += sep + QString().asprintf("%02i:%02i:%02i", h, m, s);
|
||||
|
||||
float ahi = day->calcAHI();
|
||||
data += sep + QString::number(ahi, 'f', 3);
|
||||
|
||||
@ -301,7 +302,7 @@ void ExportCSV::on_exportButton_clicked()
|
||||
int h = time / 3600;
|
||||
int m = int(time / 60) % 60;
|
||||
int s = int(time) % 60;
|
||||
data += sep + QString().sprintf("%02i:%02i:%02i", h, m, s);
|
||||
data += sep + QString().asprintf("%02i:%02i:%02i", h, m, s);
|
||||
|
||||
float ahi = sess->count(AllAhiChannels);
|
||||
//sess->count(CPAP_AllApnea) + sess->count(CPAP_Obstructive) + sess->count(CPAP_Hypopnea)
|
||||
|
@ -296,7 +296,7 @@ void OximeterImport::on_directImportButton_clicked()
|
||||
// item->setData(Qt::UserRole+2, duration);
|
||||
item->setFlags(item->flags() & ~Qt::ItemIsEditable);
|
||||
|
||||
item = new QTableWidgetItem(QString(). sprintf("%02i:%02i:%02i", h,m,s));
|
||||
item = new QTableWidgetItem( QString().asprintf("%02i:%02i:%02i", h,m,s));
|
||||
ui->tableOxiSessions->setItem(i, 1, item);
|
||||
item->setFlags(item->flags() & ~Qt::ItemIsEditable);
|
||||
|
||||
@ -740,17 +740,17 @@ void OximeterImport::updateLiveDisplay()
|
||||
pulse = (*(oximodule->oxirec))[size].pulse;
|
||||
spo2 = (*(oximodule->oxirec))[size].spo2;
|
||||
if (pulse > 0) {
|
||||
ui->pulseDisplay->display(QString().sprintf("%3i", pulse));
|
||||
ui->pulseDisplay->display(QString().asprintf("%3i", pulse));
|
||||
} else {
|
||||
ui->pulseDisplay->display("---");
|
||||
}
|
||||
if (spo2 > 0) {
|
||||
ui->spo2Display->display(QString().sprintf("%2i", spo2));
|
||||
ui->spo2Display->display(QString().asprintf("%2i", spo2));
|
||||
} else {
|
||||
ui->spo2Display->display("--");
|
||||
}
|
||||
|
||||
ui->lcdDuration->display(QString().sprintf("%02i:%02i:%02i",hours, minutes, seconds));
|
||||
ui->lcdDuration->display(QString().asprintf("%02i:%02i:%02i",hours, minutes, seconds));
|
||||
|
||||
}
|
||||
}
|
||||
@ -1089,7 +1089,7 @@ void OximeterImport::chooseSession()
|
||||
int m = (duration / 60) % 60;
|
||||
int s = duration % 60;
|
||||
|
||||
item = new QTableWidgetItem(QString(). sprintf("%02i:%02i:%02i", h,m,s));
|
||||
item = new QTableWidgetItem( QString().asprintf("%02i:%02i:%02i", h,m,s));
|
||||
ui->tableOxiSessions->setItem(row, 1, item);
|
||||
item->setFlags(item->flags() & ~Qt::ItemIsEditable);
|
||||
|
||||
|
@ -48,7 +48,7 @@ QString formatTime(float time)
|
||||
int seconds = time * 3600.0;
|
||||
int minutes = (seconds / 60) % 60;
|
||||
//seconds %= 60;
|
||||
return QString().sprintf("%02i:%02i", hours, minutes); //,seconds);
|
||||
return QString().asprintf("%02i:%02i", hours, minutes); //,seconds);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user