Obsoleesence QTime.start/elpased move QElapseTime.start/elapsed. also fixed sprintf. and using QdateTime(date) to get startOfDay.

This commit is contained in:
LoudSnorer 2023-02-11 20:50:02 -05:00
parent a0a0e08bc7
commit 99a3c009f7
13 changed files with 43 additions and 27 deletions

View File

@ -26,6 +26,7 @@
#include <QDoubleSpinBox>
#include <QToolButton>
#include <QTimer>
#include <QElapsedTimer>
#include <QGestureEvent>
#include <QPinchGesture>
@ -103,7 +104,7 @@ public:
QFont m_font;
QString m_text;
Qt::Alignment m_alignment;
QTime time;
QElapsedTimer time;
protected slots:
void doRedraw();
@ -717,7 +718,7 @@ class gGraphView
QPixmapCache pixmapcache;
QTime horizScrollTime, vertScrollTime;
QElapsedTimer horizScrollTime, vertScrollTime;
QMenu * context_menu;
QAction * pin_action;
QAction * popout_action;

View File

@ -377,7 +377,7 @@ void gLineOverlaySummary::paint(QPainter &painter, gGraph &w, const QRegion &reg
a = QObject::tr("Duration")+": "+w.selDurString();
} else {
a = QObject::tr("Events") + ": " + QString::number(cnt) + ", " +
QObject::tr("Duration") + " " + QString().sprintf("%02i:%02i:%02i", h, m, s) + ", " +
QObject::tr("Duration") + " " + QString().asprintf("%02i:%02i:%02i", h, m, s) + ", " +
m_text + ": " + QString::number(val, 'f', 2);
}
if (isSpan) {

View File

@ -10,6 +10,7 @@
#ifndef CMS50LOADER_H
#define CMS50LOADER_H
#include <QElapsedTimer>
#include "SleepLib/serialoximeter.h"
const QString cms50_class_name = "CMS50";
@ -73,7 +74,7 @@ protected:
EventList *PULSE;
EventList *SPO2;
QTime m_time;
QElapsedTimer m_time;
QByteArray buffer;

View File

@ -194,7 +194,7 @@ QString CMS50F37Loader::getUser()
sendCommand(COMMAND_GET_USER_INFO);
QTime time;
QElapsedTimer time;
time.start();
do {
QApplication::processEvents();
@ -210,7 +210,7 @@ QString CMS50F37Loader::getVendor()
sendCommand(COMMAND_GET_OXIMETER_VENDOR);
QTime time;
QElapsedTimer time;
time.start();
do {
QApplication::processEvents();
@ -227,7 +227,7 @@ QString CMS50F37Loader::getModel()
modelsegments = 0;
sendCommand(COMMAND_GET_OXIMETER_MODEL);
QTime time;
QElapsedTimer time;
time.start();
do {
QApplication::processEvents();
@ -260,7 +260,7 @@ QString CMS50F37Loader::getDeviceID()
sendCommand(COMMAND_GET_OXIMETER_DEVICEID);
QTime time;
QElapsedTimer time;
time.start();
do {
QApplication::processEvents();
@ -275,7 +275,7 @@ int CMS50F37Loader::getUserCount() // for future use, check, then add select us
userCount = -1;
sendCommand(COMMAND_GET_USER_COUNT);
QTime time;
QElapsedTimer time;
time.start();
do {
QApplication::processEvents();
@ -290,7 +290,7 @@ int CMS50F37Loader::getSessionCount()
session_count = -1;
sendCommand(COMMAND_GET_SESSION_COUNT);
QTime time;
QElapsedTimer time;
time.start();
do {
QApplication::processEvents();
@ -304,7 +304,7 @@ int CMS50F37Loader::getOximeterInfo()
{
device_info = -1;
sendCommand(COMMAND_GET_OXIMETER_INFO);
QTime time;
QElapsedTimer time;
time.start();
do {
QApplication::processEvents();
@ -321,7 +321,7 @@ int CMS50F37Loader::getDuration(int session)
duration = -1;
sendCommand(COMMAND_GET_SESSION_DURATION, session);
QTime time;
QElapsedTimer time;
time.start();
do {
QApplication::processEvents();
@ -338,7 +338,7 @@ QDateTime CMS50F37Loader::getDateTime(int session)
imp_date = QDate();
imp_time = QTime();
sendCommand(COMMAND_GET_SESSION_TIME, session);
QTime time;
QElapsedTimer time;
time.start();
do {
QApplication::processEvents();
@ -681,7 +681,7 @@ void CMS50F37Loader::eraseSession(int user, int session)
}
int z = timectr;
QTime time;
QElapsedTimer time;
time.start();
do {
QApplication::processEvents();
@ -721,7 +721,7 @@ void CMS50F37Loader::setDeviceID(const QString & newid)
// Supposed to return 0x04 command, so reset devid..
devid = QString();
QTime time;
QElapsedTimer time;
time.start();
do {
QApplication::processEvents();
@ -745,7 +745,7 @@ void CMS50F37Loader::syncClock()
qDebug() << "cms50f37 - Couldn't write date bytes to CMS50F";
}
QTime time;
QElapsedTimer time;
time.start();
do {
QApplication::processEvents();

View File

@ -10,6 +10,7 @@
#ifndef CMS50F37LOADER_H
#define CMS50F37LOADER_H
#include <QElapsedTimer>
#include "SleepLib/serialoximeter.h"
const QString cms50f37_class_name = "CMS50F37";
@ -107,7 +108,7 @@ protected:
EventList *PULSE;
EventList *SPO2;
QTime m_time;
QElapsedTimer m_time;
QByteArray buffer;

View File

@ -10,6 +10,7 @@
#ifndef MD300W1LOADER_H
#define MD300W1LOADER_H
#include <QElapsedTimer>
#include "SleepLib/serialoximeter.h"
const QString md300w1_class_name = "MD300W1";
@ -69,7 +70,7 @@ protected:
EventList *PULSE;
EventList *SPO2;
QTime m_time;
QElapsedTimer m_time;
QByteArray buffer;

View File

@ -706,7 +706,7 @@ bool Machine::Load(ProgressDialog *progress)
progress->setProgressValue(0);
QApplication::processEvents();
QTime time;
QElapsedTimer time;
time.start();
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
@ -899,7 +899,7 @@ const int summaryxml_version=1;
bool Machine::LoadSummary(ProgressDialog * progress)
{
QTime time;
QElapsedTimer time;
time.start();
QString filename = getDataPath() + summaryFileName + ".gz";

View File

@ -12,6 +12,7 @@
#include <QNetworkAccessManager>
#include <QMainWindow>
#include <QElapsedTimer>
#include <QProgressDialog>
/*! \class CheckUpdates
@ -44,7 +45,7 @@ class CheckUpdates : public QMainWindow
private:
QNetworkAccessManager *manager;
QTime readTimer;
QElapsedTimer readTimer;
float elapsedTime;
QString msg; // Message to show to user

View File

@ -15,6 +15,7 @@
#include <QTextBlock>
#include <QColorDialog>
#include <QSpacerItem>
#include <QElapsedTimer>
#include <QBuffer>
#include <QPixmap>
#include <QMessageBox>
@ -934,7 +935,7 @@ void Daily::on_ReloadDay()
}
inReload = true;
graphView()->releaseKeyboard();
QTime time;
QElapsedTimer time;
time_t unload_time, load_time, other_time;
time.start();

View File

@ -7,6 +7,7 @@
#include <QMutex>
#include <QWaitCondition>
#include <QTime>
#include <QElapsedTimer>
void initializeLogger();
void shutdownLogger();
@ -41,7 +42,7 @@ signals:
void outputLog(QString);
protected:
volatile bool running;
QTime logtime;
QElapsedTimer logtime;
bool connected;
class QFile* m_logFile;
class QTextStream* m_logStream;

View File

@ -17,6 +17,7 @@
#include <QResource>
#include <QProgressBar>
#include <QTimer>
#include <QElapsedTimer>
#include <QSettings>
#include <QPixmap>
#include <QDesktopWidget>
@ -914,7 +915,7 @@ QList<ImportPath> MainWindow::detectCPAPCards()
QString lastpath = (*p_profile)[STR_PREF_LastCPAPPath].toString();
QList<MachineLoader *>loaders = GetLoaders(MT_CPAP);
QTime time;
QElapsedTimer time;
time.start();
// Create dialog
@ -1041,7 +1042,7 @@ QList<ImportPath> MainWindow::selectCPAPDataCards(const QString & prompt, bool a
QList<MachineLoader *>loaders = GetLoaders(MT_CPAP);
QTime time;
QElapsedTimer time;
time.start();

View File

@ -39,8 +39,15 @@
#include "mainwindow.h"
extern MainWindow *mainwin;
qint64 convertDateToTimeRtn(const QDate &date,int hours,int min,int sec) {
return QDateTime(date).addSecs(((hours*60+min)*60)+sec).toMSecsSinceEpoch();
// date.startOfDay was introduced in 5.14. ubuntu 22.04 LTS used QT5.15
#if QT_VERSION > QT_VERSION_CHECK(5,15,0)
return date.startOfDay().addSecs(((hours*60+min)*60)+sec).toMSecsSinceEpoch();
#else
// this version works in QT 5.12
return QDateTime(date).addSecs(((hours*60+min)*60)+sec).toMSecsSinceEpoch();
#endif
}
qint64 convertDateToStartTime(const QDate &date) {

View File

@ -12,6 +12,7 @@
#include <QFileDialog>
#include <QStandardPaths>
#include <QDesktopServices>
#include <QElapsedTimer>
#include "Graphs/gYAxis.h"
#include "Graphs/gXAxis.h"
@ -190,7 +191,7 @@ SerialOximeter * OximeterImport::detectOximeter()
ui->progressBar->setMaximum(PORTSCAN_TIMEOUT);
QTime time;
QElapsedTimer time;
time.start();
oximodule = nullptr;