1
0
mirror of https://gitlab.com/pholy/OSCAR-code.git synced 2025-04-12 08:40:45 +00:00

More doxygen stuff, plus cleanup and preparation for Language Translation support

This commit is contained in:
Mark Watkins 2011-12-19 02:39:36 +10:00
parent 0c59438cf1
commit 1279d0985c
21 changed files with 559 additions and 279 deletions

View File

@ -8,13 +8,22 @@
#include "day.h" #include "day.h"
//! \brief Calculate Respiratory Rate, Tidal Volume & Minute Ventilation for PRS1 data
int calcRespRate(Session *session); int calcRespRate(Session *session);
//! \brief Calculates the sliding window AHI graph
int calcAHIGraph(Session *session); int calcAHIGraph(Session *session);
//! \brief Calculates AHI for a session between start & end (a support function for the sliding window graph)
EventDataType calcAHI(Session *session,qint64 start=0, qint64 end=0); EventDataType calcAHI(Session *session,qint64 start=0, qint64 end=0);
//! \brief Leaks calculations for PRS1
int calcLeaks(Session *session); int calcLeaks(Session *session);
//! \brief Calculate Pulse change flagging, according to preferences
int calcPulseChange(Session *session); int calcPulseChange(Session *session);
//! \brief Calculate SPO2 Drop flagging, according to preferences
int calcSPO2Drop(Session *session); int calcSPO2Drop(Session *session);

View File

@ -11,8 +11,13 @@
//#include "SleepLib/session.h" //#include "SleepLib/session.h"
#include "machine_common.h" #include "machine_common.h"
//! \brief EventLists can either be Waveform or Event types
enum EventListType { EVL_Waveform, EVL_Event }; enum EventListType { EVL_Waveform, EVL_Event };
/*! \class EventList
\author Mark Watkins <jedimark_at_users.sourceforge.net>
\brief EventLists contains waveforms at a specified rate, or a list of event and time data.
*/
class EventList class EventList
{ {
friend class Session; friend class Session;
@ -20,60 +25,135 @@ public:
EventList(EventListType et,EventDataType gain=1.0, EventDataType offset=0.0, EventDataType min=0.0, EventDataType max=0.0, double rate=0.0,bool second_field=false); EventList(EventListType et,EventDataType gain=1.0, EventDataType offset=0.0, EventDataType min=0.0, EventDataType max=0.0, double rate=0.0,bool second_field=false);
~EventList(); ~EventList();
/*! \brief Add an event starting at time, containing data to this event list
Note, data2 is only used if second_field is specified in the constructor */
void AddEvent(qint64 time, EventStoreType data, EventStoreType data2=0); void AddEvent(qint64 time, EventStoreType data, EventStoreType data2=0);
void AddWaveform(qint64 start, qint16 * data, int recs, qint64 duration); void AddWaveform(qint64 start, qint16 * data, int recs, qint64 duration);
void AddWaveform(qint64 start, unsigned char * data, int recs, qint64 duration); void AddWaveform(qint64 start, unsigned char * data, int recs, qint64 duration);
void AddWaveform(qint64 start, char * data, int recs, qint64 duration); void AddWaveform(qint64 start, char * data, int recs, qint64 duration);
//! \brief Returns a count of records contained in this EventList
inline const quint32 & count() { return m_count; } inline const quint32 & count() { return m_count; }
//! \brief Manually sets a count of records contained in this EventList
void setCount(quint32 count) { m_count=count; } void setCount(quint32 count) { m_count=count; }
//! \brief Returns a raw ("ungained") data value from index position i
inline EventStoreType raw(int i) { return m_data[i]; } inline EventStoreType raw(int i) { return m_data[i]; }
//! \brief Returns a raw ("ungained") data2 value from index position i
inline EventStoreType raw2(int i) { return m_data2[i]; } inline EventStoreType raw2(int i) { return m_data2[i]; }
//! \brief Returns a data value multiplied by gain from index position i
EventDataType data(quint32 i); EventDataType data(quint32 i);
//! \brief Returns a data2 value multiplied by gain from index position i
EventDataType data2(quint32 i); EventDataType data2(quint32 i);
//! \brief Returns either the timestamp for the i'th event, or calculates the waveform time position i
qint64 time(quint32 i); qint64 time(quint32 i);
//! \brief Returns true if this EventList uses the second data field
bool hasSecondField() { return m_second_field; } bool hasSecondField() { return m_second_field; }
//! \brief Returns the first events/waveforms starting time in milliseconds since epoch
inline const qint64 & first() { return m_first; } inline const qint64 & first() { return m_first; }
//! \brief Returns the last events/waveforms ending time in milliseconds since epoch
inline const qint64 & last() { return m_last; } inline const qint64 & last() { return m_last; }
//! \brief Returns the timespan covered by this EventList, in milliseconds since epoch
inline qint64 duration() { return m_last-m_first; } inline qint64 duration() { return m_last-m_first; }
//! \brief Sets the first events/waveforms starting time in milliseconds since epoch
void setFirst(qint64 val) { m_first=val; } void setFirst(qint64 val) { m_first=val; }
//! \brief Sets the last events/waveforms ending time in milliseconds since epoch
void setLast(qint64 val) { m_last=val; } void setLast(qint64 val) { m_last=val; }
//! \brief Set this EventList to either EVL_Waveform or EVL_Event type
void setType(EventListType type) { m_type=type; } void setType(EventListType type) { m_type=type; }
//! \brief Change the gain multiplier value
void setGain(EventDataType v) { m_gain=v; } void setGain(EventDataType v) { m_gain=v; }
//! \brief Change the gain offset value
void setOffset(EventDataType v) { m_offset=v; } void setOffset(EventDataType v) { m_offset=v; }
//! \brief Set the Minimum value for data
void setMin(EventDataType v) { m_min=v; } void setMin(EventDataType v) { m_min=v; }
//! \brief Set the Maximum value for data
void setMax(EventDataType v) { m_max=v; } void setMax(EventDataType v) { m_max=v; }
//! \brief Set the Minimum value for data2
void setMin2(EventDataType v) { m_min2=v; } void setMin2(EventDataType v) { m_min2=v; }
//! \brief Set the Maximum value for data2
void setMax2(EventDataType v) { m_max2=v; } void setMax2(EventDataType v) { m_max2=v; }
//! \brief Set the sample rate
void setRate(EventDataType v) { m_rate=v; } void setRate(EventDataType v) { m_rate=v; }
//void setCode(ChannelID id) { m_code=id; } //void setCode(ChannelID id) { m_code=id; }
//! \brief Return the Minimum data value
inline const EventDataType & Min() { return m_min; } inline const EventDataType & Min() { return m_min; }
//! \brief Return the Maximum data value
inline const EventDataType & Max() { return m_max; } inline const EventDataType & Max() { return m_max; }
//! \brief Return the Minimum data2 value
inline const EventDataType & min2() { return m_min2; } inline const EventDataType & min2() { return m_min2; }
//! \brief Return the Maximum data value
inline const EventDataType & max2() { return m_max2; } inline const EventDataType & max2() { return m_max2; }
//! \brief Return the gain value
inline const EventDataType & gain() { return m_gain; } inline const EventDataType & gain() { return m_gain; }
//! \brief Return the gain offset
inline const EventDataType & offset() { return m_offset; } inline const EventDataType & offset() { return m_offset; }
//! \brief Return the sample rate
inline const EventDataType & rate() { return m_rate; } inline const EventDataType & rate() { return m_rate; }
//! \brief Return the EventList type, either EVL_Waveform or EVL_Event
inline const EventListType & type() { return m_type; } inline const EventListType & type() { return m_type; }
//inline const ChannelID & code() { return m_code; } //inline const ChannelID & code() { return m_code; }
//! \brief Returns whether or not min/max values are updated while adding events
inline const bool & update_minmax() { return m_update_minmax; } inline const bool & update_minmax() { return m_update_minmax; }
//! \brief Returns the dimension (units type) of the contained data object
QString dimension() { return m_dimension; } QString dimension() { return m_dimension; }
//! \brief Sets the dimension (units type) of the contained data object
void setDimension(QString dimension) { m_dimension=dimension; } void setDimension(QString dimension) { m_dimension=dimension; }
//! \brief Returns the data storage vector
QVector<EventStoreType> & getData() { return m_data; } QVector<EventStoreType> & getData() { return m_data; }
//! \brief Returns the data2 storage vector
QVector<EventStoreType> & getData2() { return m_data2; } QVector<EventStoreType> & getData2() { return m_data2; }
//! \brief Returns the time storage vector (only used in EVL_Event types)
QVector<quint32> & getTime() { return m_time; } QVector<quint32> & getTime() { return m_time; }
protected: protected:
QVector<quint32> m_time; // 32bitalize this.. add offsets to m_first
//! \brief The time storage vector, in 32bits delta format, added as offsets to m_first
QVector<quint32> m_time;
//! \brief The "ungained" raw data storage vector
QVector<EventStoreType> m_data; QVector<EventStoreType> m_data;
//! \brief The "ungained" raw data2 storage vector
QVector<EventStoreType> m_data2; QVector<EventStoreType> m_data2;
//ChannelID m_code; //ChannelID m_code;
//! \brief Either EVL_Waveform or EVL_Event
EventListType m_type; EventListType m_type;
//! \brief Count of events
quint32 m_count; quint32 m_count;
EventDataType m_gain; EventDataType m_gain;

View File

@ -1,8 +1,8 @@
/******************************************************************** /*
SleepLib Machine Loader Class Implementation SleepLib Machine Loader Class Implementation
Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net> Copyright (c)2011 Mark Watkins <jedimark@users.sourceforge.net>
License: GPL License: GPL
*********************************************************************/ */
#include <QFile> #include <QFile>
#include <QDir> #include <QDir>

View File

@ -29,7 +29,7 @@ const QString & getUserName()
userName=getenv("USER"); userName=getenv("USER");
if (userName.isEmpty()) { if (userName.isEmpty()) {
userName="Windows User"; userName=QObject::tr("Windows User");
#if defined (Q_WS_WIN32) #if defined (Q_WS_WIN32)
#if defined(UNICODE) #if defined(UNICODE)

View File

@ -101,16 +101,17 @@ Profile::~Profile()
} }
void Profile::DataFormatError(Machine *m) void Profile::DataFormatError(Machine *m)
{ {
QString msg="Software changes have been made that require the reimporting of the following machines data:\n\n"; QString msg=QObject::tr("Software changes have been made that require the reimporting of the following machines data:\n\n");
msg=msg+m->properties["Brand"]+" "+m->properties["Model"]+" "+m->properties["Serial"]; msg=msg+m->properties["Brand"]+" "+m->properties["Model"]+" "+m->properties["Serial"];
msg=msg+"\n\nThis is still only alpha software and these changes are sometimes necessary.\n\n"; msg=msg+QObject::tr("\n\nThis is still only alpha software and these changes are sometimes necessary.\n\n");
msg=msg+"I can automatically purge this data for you, or you can cancel now and continue to run in a previous version.\n\n"; msg=msg+QObject::tr("I can automatically purge this data for you, or you can cancel now and continue to run in a previous version.\n\n");
msg=msg+"Would you like me to purge this data this for you so you can run the new version?"; msg=msg+QObject::tr("Would you like me to purge this data this for you so you can run the new version?");
if (QMessageBox::warning(NULL,"Machine Database Changes",msg,QMessageBox::Yes | QMessageBox::Cancel,QMessageBox::Yes)==QMessageBox::Yes) { if (QMessageBox::warning(NULL,QObject::tr("Machine Database Changes"),msg,QMessageBox::Yes | QMessageBox::Cancel,QMessageBox::Yes)==QMessageBox::Yes) {
if (!m->Purge(3478216)) { // Do not copy this line without thinking.. You will be eaten by a Grue if you do if (!m->Purge(3478216)) { // Do not copy this line without thinking.. You will be eaten by a Grue if you do
QMessageBox::critical(NULL,"Purge Failed","Sorry, I could not purge this data, which means this version of SleepyHead can't start.. SleepyHead's Data folder needs to be removed manually\n\nThis folder currently resides at the following location:\n"+PREF["DataFolder"].toString(),QMessageBox::Ok);
QMessageBox::critical(NULL,QObject::tr("Purge Failed"),QObject::tr("Sorry, I could not purge this data, which means this version of SleepyHead can't start.. SleepyHead's Data folder needs to be removed manually\n\nThis folder currently resides at the following location:\n")+PREF["DataFolder"].toString(),QMessageBox::Ok);
exit(-1); exit(-1);
} }
} else { } else {
@ -140,7 +141,7 @@ void Profile::LoadMachineData()
PROFILE["RebuildCache"]=false; PROFILE["RebuildCache"]=false;
} else { } else {
if (mainwin) { if (mainwin) {
mainwin->Notify("Caching session data, this may take a little while."); mainwin->Notify(QObject::tr("Caching session data, this may take a little while."));
PROFILE["RebuildCache"]=true; PROFILE["RebuildCache"]=true;
QApplication::processEvents(); QApplication::processEvents();
@ -319,10 +320,6 @@ Day * Profile::GetDay(QDate date,MachineType type)
} }
/**
* @brief Import Machine Data
* @param path
*/
int Profile::Import(QString path) int Profile::Import(QString path)
{ {
int c=0; int c=0;
@ -522,5 +519,5 @@ void Scan()
} }
}; // namespace Profiles } // namespace Profiles

View File

@ -16,12 +16,12 @@ License: GPL
#include "preferences.h" #include "preferences.h"
class Machine; class Machine;
/** /*!
* @class Profile \class Profile
* @author Mark Watkins \author Mark Watkins
* @date 28/04/11 \date 28/04/11
* @file profiles.h \file profiles.h
* @brief User profile system \brief User profile system
*/ */
class Profile:public Preferences class Profile:public Preferences
{ {
@ -30,22 +30,47 @@ public:
Profile(); Profile();
virtual ~Profile(); virtual ~Profile();
//! \brief Save Profile object (This is an extension to Preference::Save(..))
virtual bool Save(QString filename=""); virtual bool Save(QString filename="");
bool is_first_day; bool is_first_day;
//! \brief List of machines, indexed by MachineID
QHash<MachineID,Machine *> machlist; QHash<MachineID,Machine *> machlist;
//! \brief Add machine to this profiles machlist
void AddMachine(Machine *m); void AddMachine(Machine *m);
//! \brief Remove machine from this profiles machlist
void DelMachine(Machine *m); void DelMachine(Machine *m);
//! \brief Loads all machine (summary) data belonging to this profile
void LoadMachineData(); void LoadMachineData();
//! \brief Barf because data format has changed. This does a purge of CPAP data for machine *m
void DataFormatError(Machine *m); void DataFormatError(Machine *m);
/*! \brief Import Machine Data
\param path
*/
int Import(QString path); int Import(QString path);
//! \brief Remove a session from day object, without deleting the Session object
void RemoveSession(Session * sess); void RemoveSession(Session * sess);
//! \brief Add Day record to Profile Day list
void AddDay(QDate date,Day *day,MachineType mt); void AddDay(QDate date,Day *day,MachineType mt);
//! \brief Get Day record if data available for date and machine type, else return NULL
Day * GetDay(QDate date,MachineType type=MT_UNKNOWN); Day * GetDay(QDate date,MachineType type=MT_UNKNOWN);
//! \brief Returns a list of all machines of type t
QList<Machine *> GetMachines(MachineType t); QList<Machine *> GetMachines(MachineType t);
//! \brief Returns the machine of type t used on date, NULL if none..
Machine * GetMachine(MachineType t,QDate date); Machine * GetMachine(MachineType t,QDate date);
//! \brief return the first machine of type t
Machine * GetMachine(MachineType t); Machine * GetMachine(MachineType t);
virtual void ExtraLoad(QDomElement & root); virtual void ExtraLoad(QDomElement & root);

View File

@ -964,7 +964,7 @@ EventList * Session::AddEventList(ChannelID code, EventListType et,EventDataType
{ {
schema::Channel * channel=&schema::channel[code]; schema::Channel * channel=&schema::channel[code];
if (!channel) { if (!channel) {
qWarning() << "Channel" << chan << "does not exist!"; qWarning() << "Channel" << code << "does not exist!";
//return NULL; //return NULL;
} }
EventList * el=new EventList(et,gain,offset,min,max,rate,second_field); EventList * el=new EventList(et,gain,offset,min,max,rate,second_field);

View File

@ -80,8 +80,9 @@ void UpdaterWindow::checkForUpdates()
return; return;
} }
} }
mainwin->Notify("Checking for SleepyHead Updates"); mainwin->Notify(tr("Checking for SleepyHead Updates"));
// language code?
update_url=QUrl("http://sourceforge.net/projects/sleepyhead/files/AutoUpdate/update.xml/download"); update_url=QUrl("http://sourceforge.net/projects/sleepyhead/files/AutoUpdate/update.xml/download");
downloadUpdateXML(); downloadUpdateXML();
} }
@ -93,7 +94,7 @@ void UpdaterWindow::downloadUpdateXML()
QNetworkRequest req=QNetworkRequest(update_url); QNetworkRequest req=QNetworkRequest(update_url);
req.setRawHeader("User-Agent", "Wget/1.12 (linux-gnu)"); req.setRawHeader("User-Agent", "Wget/1.12 (linux-gnu)");
reply=netmanager->get(req); reply=netmanager->get(req);
ui->plainTextEdit->appendPlainText("Requesting "+update_url.toString()); ui->plainTextEdit->appendPlainText(tr("Requesting ")+update_url.toString());
netmanager->connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this, SLOT(downloadProgress(qint64,qint64))); netmanager->connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this, SLOT(downloadProgress(qint64,qint64)));
dltime.start(); dltime.start();
} }
@ -146,14 +147,14 @@ void UpdaterWindow::requestFile()
bar->setStyleSheet(style); bar->setStyleSheet(style);
QString filename=update->filename; QString filename=update->filename;
ui->plainTextEdit->appendPlainText("Requesting "+update->url); ui->plainTextEdit->appendPlainText(tr("Requesting ")+update->url);
requestmode=RM_GetFile; requestmode=RM_GetFile;
QString path=QApplication::applicationDirPath()+"/Download"; QString path=QApplication::applicationDirPath()+"/Download";
QDir().mkpath(path); QDir().mkpath(path);
path+="/"+filename; path+="/"+filename;
ui->plainTextEdit->appendPlainText("Saving as "+path); ui->plainTextEdit->appendPlainText(tr("Saving as ")+path);
file.setFileName(path); file.setFileName(path);
file.open(QFile::WriteOnly); file.open(QFile::WriteOnly);
dltime.start(); dltime.start();
@ -171,7 +172,7 @@ void UpdaterWindow::ParseUpdateXML(QIODevice * dev)
QXmlSimpleReader reader; QXmlSimpleReader reader;
reader.setContentHandler(&updateparser); reader.setContentHandler(&updateparser);
if (reader.parse(src)) { if (reader.parse(src)) {
ui->plainTextEdit->appendPlainText("XML update structure parsed cleanly"); ui->plainTextEdit->appendPlainText(tr("XML update structure parsed cleanly"));
QStringList versions; QStringList versions;
for (QHash<QString,Release>::iterator it=updateparser.releases.begin();it!=updateparser.releases.end();it++) { for (QHash<QString,Release>::iterator it=updateparser.releases.begin();it!=updateparser.releases.end();it++) {
@ -189,7 +190,7 @@ void UpdaterWindow::ParseUpdateXML(QIODevice * dev)
} else release=NULL; } else release=NULL;
} }
if (!release || (VersionString() > release->version)) { if (!release || (VersionString() > release->version)) {
mainwin->Notify("No updates were found for your platform.",5000,"SleepyHead Updates"); mainwin->Notify(tr("No updates were found for your platform."),tr("SleepyHead Updates"),5000);
close(); close();
return; return;
} }
@ -225,18 +226,18 @@ void UpdaterWindow::ParseUpdateXML(QIODevice * dev)
if (updates.size()>0) { if (updates.size()>0) {
QString html="<html><h3>SleepyHead v"+release->version+" codename \""+release->codename+"\"</h3><p>"+release->notes[""]+"</p><b>"; QString html="<html><h3>"+tr("SleepyHead v%1, codename \"%2\"").arg(release->version).arg(release->codename)+"</h3><p>"+release->notes[""]+"</p><b>";
html+=platform.left(1).toUpper()+platform.mid(1); html+=platform.left(1).toUpper()+platform.mid(1);
html+=" platform notes</b><p>"+release->notes[platform]+"</p></html>"; html+=" "+tr("platform notes")+"</b><p>"+release->notes[platform]+"</p></html>";
ui->webView->setHtml(html); ui->webView->setHtml(html);
QString info; QString info;
if (VersionString()< release->version) { if (VersionString()< release->version) {
ui->Title->setText("<font size=+1>A new version of SleepyHead is available!</font>"); ui->Title->setText("<font size=+1>"+tr("A new version of SleepyHead is available!")+"</font>");
info="Shiny new <b>v"+latestapp+"</b> is available. You're running old and busted v"+VersionString(); info=tr("Shiny new <b>v%1</b> is available. You're running old and busted v%2").arg(latestapp).arg(VersionString());
ui->notesTabWidget->setCurrentIndex(0); ui->notesTabWidget->setCurrentIndex(0);
} else { } else {
ui->Title->setText("<font size=+1>An update for SleepyHead is available.</font>"); ui->Title->setText("<font size=+1>"+tr("An update for SleepyHead is available.")+"</font>");
info="Version <b>"+latestapp+"</b> is available. You're currently running v"+VersionString(); info=tr("Version <b>%1</b> is available. You're currently running v%1").arg(latestapp).arg(VersionString());
ui->notesTabWidget->setCurrentIndex(1); ui->notesTabWidget->setCurrentIndex(1);
} }
ui->versionInfo->setText(info); ui->versionInfo->setText(info);
@ -245,9 +246,9 @@ void UpdaterWindow::ParseUpdateXML(QIODevice * dev)
for (int i=0;i<release->updates[platform].size();i++) { for (int i=0;i<release->updates[platform].size();i++) {
update=&release->updates[platform][i]; update=&release->updates[platform][i];
if ((update->type=="application") && (update->version > VersionString())) { if ((update->type=="application") && (update->version > VersionString())) {
notes+="<b>SleepyHead v"+update->version+" build notes</b><br/>"+update->notes.trimmed()+"<br/><br/>"; notes+="<b>"+tr("SleepyHead v%1 build notes").arg(update->version)+"</b><br/>"+update->notes.trimmed()+"<br/><br/>";
} else if ((update->type=="qtlibs") && (update->version > QT_VERSION_STR)) { } else if ((update->type=="qtlibs") && (update->version > QT_VERSION_STR)) {
notes+="<b>Update to QtLibs (v"+update->version+")</b><br/>"+update->notes.trimmed(); notes+="<b>"+tr("Update to QtLibs (v%1)").arg(update->version)+"</b><br/>"+update->notes.trimmed();
} }
} }
ui->buildNotes->setText(notes); ui->buildNotes->setText(notes);
@ -255,7 +256,7 @@ void UpdaterWindow::ParseUpdateXML(QIODevice * dev)
show(); show();
} }
} else { } else {
mainwin->Notify("There was an error parsing the XML Update file."); mainwin->Notify(tr("There was an error parsing the XML Update file."));
} }
} }
@ -273,7 +274,7 @@ void UpdaterWindow::replyFinished(QNetworkReply * reply)
return; return;
} }
ui->plainTextEdit->appendPlainText(QString::number(reply->size())+" bytes received."); ui->plainTextEdit->appendPlainText(tr("%1 bytes received").arg(reply->size()));
QString filename=QApplication::applicationDirPath()+"/update.xml"; QString filename=QApplication::applicationDirPath()+"/update.xml";
qDebug() << filename; qDebug() << filename;
QFile file(filename); QFile file(filename);
@ -301,7 +302,7 @@ void UpdaterWindow::replyFinished(QNetworkReply * reply)
if (!redirectUrl.isEmpty() && (redirectUrl!=reply->url())) { if (!redirectUrl.isEmpty() && (redirectUrl!=reply->url())) {
file.open(QFile::WriteOnly); //reopen file.. file.open(QFile::WriteOnly); //reopen file..
update->url=redirectUrl.toString(); update->url=redirectUrl.toString();
ui->plainTextEdit->appendPlainText("Redirected to "+update->url); ui->plainTextEdit->appendPlainText(tr("Redirected to ")+update->url);
QTimer::singleShot(100,this,SLOT(requestFile())); QTimer::singleShot(100,this,SLOT(requestFile()));
reply->deleteLater(); reply->deleteLater();
return; return;
@ -312,7 +313,7 @@ void UpdaterWindow::replyFinished(QNetworkReply * reply)
double s2=ui->tableWidget->item(current_row,2)->text().toDouble(); double s2=ui->tableWidget->item(current_row,2)->text().toDouble();
if (s1!=s2) { if (s1!=s2) {
failed=true; failed=true;
ui->plainTextEdit->appendPlainText("File size mismatch for "+update->filename); ui->plainTextEdit->appendPlainText(tr("File size mismatch for %1").arg(update->filename));
} }
} else { } else {
QString path=QApplication::applicationDirPath()+"/Download/"+update->filename; QString path=QApplication::applicationDirPath()+"/Download/"+update->filename;
@ -322,7 +323,7 @@ void UpdaterWindow::replyFinished(QNetworkReply * reply)
hash.addData(f.readAll()); hash.addData(f.readAll());
QString res=hash.result().toHex(); QString res=hash.result().toHex();
if (res!=update->hash) { if (res!=update->hash) {
ui->plainTextEdit->appendPlainText("File integrity check failed for "+update->filename); ui->plainTextEdit->appendPlainText(tr("File integrity check failed for %1").arg(update->filename));
failed=true; failed=true;
} }
} }
@ -350,7 +351,7 @@ void UpdaterWindow::replyFinished(QNetworkReply * reply)
QDir().mkpath(backups); QDir().mkpath(backups);
for (int i=0;i<fsize;i++) { for (int i=0;i<fsize;i++) {
ui->plainTextEdit->appendPlainText("Extracting "+files.at(i)); ui->plainTextEdit->appendPlainText(tr("Extracting ")+files.at(i));
QuaZipFile qzf(file.fileName(),files.at(i)); QuaZipFile qzf(file.fileName(),files.at(i));
qzf.open(QuaZipFile::ReadOnly); qzf.open(QuaZipFile::ReadOnly);
@ -399,7 +400,7 @@ void UpdaterWindow::replyFinished(QNetworkReply * reply)
// gone and wrecked the install here.. // gone and wrecked the install here..
// probably should wait till get here before replacing files.. // probably should wait till get here before replacing files..
// but then again, this is probably what would screw up // but then again, this is probably what would screw up
mainwin->Notify("You may need to reinstall manually. Sorry :(",5000,"Ugh.. Something went wrong with unzipping."); mainwin->Notify(tr("You might need to reinstall manually. Sorry :("),tr("Ugh.. Something went wrong with unzipping."),5000);
// TODO: Roll back from the backup folder // TODO: Roll back from the backup folder
failed=true; failed=true;
} }
@ -409,7 +410,7 @@ void UpdaterWindow::replyFinished(QNetworkReply * reply)
if (failed) { if (failed) {
qDebug() << "File is corrupted"; qDebug() << "File is corrupted";
if (bar) { if (bar) {
bar->setFormat("Failed"); bar->setFormat(tr("Failed"));
QString style="QProgressBar{\ QString style="QProgressBar{\
border: 1px solid gray;\ border: 1px solid gray;\
border-radius: 3px;\ border-radius: 3px;\
@ -428,11 +429,11 @@ void UpdaterWindow::replyFinished(QNetworkReply * reply)
} }
ui->tableWidget->item(current_row,0)->setData(Qt::UserRole+1,failed); ui->tableWidget->item(current_row,0)->setData(Qt::UserRole+1,failed);
QTimer::singleShot(100,this,SLOT(upgradeNext())); QTimer::singleShot(100,this,SLOT(upgradeNext()));
ui->plainTextEdit->appendPlainText("Download Complete"); ui->plainTextEdit->appendPlainText(tr("Download Complete"));
} }
} else { } else {
mainwin->Notify("There was an error completing a network request:\n\n("+reply->errorString()+")"); mainwin->Notify(tr("There was an error completing a network request:\n\n(")+reply->errorString()+")");
} }
} }
@ -468,17 +469,17 @@ void UpdaterWindow::upgradeNext()
} }
if (ok) { if (ok) {
success=true; success=true;
//QMessageBox::information(this,"Updates Complete","SleepyHead has been updated and needs to restart.",QMessageBox::Ok); //QMessageBox::information(this,tr("Updates Complete"),tr("SleepyHead has been updated and needs to restart."),QMessageBox::Ok);
ui->downloadTitle->setText("Update Complete!"); ui->downloadTitle->setText(tr("Update Complete!"));
ui->FinishedButton->setVisible(true); ui->FinishedButton->setVisible(true);
ui->downloadLabel->setText("Updates Complete. SleepyHead needs to restart now, click Finished to do so."); ui->downloadLabel->setText(tr("Updates Complete. SleepyHead needs to restart now, click Finished to do so."));
PREF["Updates_LastChecked"]=QDateTime::currentDateTime(); PREF["Updates_LastChecked"]=QDateTime::currentDateTime();
} else { } else {
ui->downloadTitle->setText("Update Failed :("); ui->downloadTitle->setText(tr("Update Failed :("));
success=false; success=false;
ui->downloadLabel->setText("Download Error. Sorry, try again later."); ui->downloadLabel->setText(tr("Download Error. Sorry, try again later."));
ui->FinishedButton->setVisible(true); ui->FinishedButton->setVisible(true);
//QMessageBox::warning(this,"Download Error","Sorry, could not get all necessary files for upgrade.. Try again later.",QMessageBox::Ok); //QMessageBox::warning(this,tr("Download Error"),tr("Sorry, could not get all necessary files for upgrade.. Try again later."),QMessageBox::Ok);
//close(); //close();
} }
} }
@ -492,8 +493,8 @@ void UpdaterWindow::on_upgradeButton_clicked()
ui->tableWidget->setColumnHidden(4,true); ui->tableWidget->setColumnHidden(4,true);
ui->tableWidget->setColumnHidden(5,true); ui->tableWidget->setColumnHidden(5,true);
ui->FinishedButton->setVisible(false); ui->FinishedButton->setVisible(false);
ui->downloadLabel->setText("Downloading & Installing Updates..."); ui->downloadLabel->setText(tr("Downloading & Installing Updates..."));
ui->downloadTitle->setText("Please wait while downloading and installing updates."); ui->downloadTitle->setText(tr("Please wait while downloading and installing updates."));
success=false; success=false;
for (int i=0;i<updates.size();i++) { for (int i=0;i<updates.size();i++) {
update=updates.at(i); update=updates.at(i);

View File

@ -356,7 +356,7 @@ void Daily::Link_clicked(const QUrl &url)
ui->treeWidget->setCurrentItem(wi); ui->treeWidget->setCurrentItem(wi);
ui->tabWidget->setCurrentIndex(1); ui->tabWidget->setCurrentIndex(1);
} else { } else {
mainwin->Notify("No "+schema::channel[data].description()+" events are recorded this day",1500); mainwin->Notify(tr("No %1 events are recorded this day").arg(schema::channel[data].description()),"",1500);
} }
} else if (code=="graph") { } else if (code=="graph") {
qDebug() << "Select graph " << data; qDebug() << "Select graph " << data;
@ -579,15 +579,15 @@ void Daily::Load(QDate date)
if (cpap && oxi) { if (cpap && oxi) {
qint64 len=qAbs(cpap->first() - oxi->first()); qint64 len=qAbs(cpap->first() - oxi->first());
if (len>30000) { if (len>30000) {
GraphView->findGraph("Pulse Rate")->setGroup(1); GraphView->findGraph(tr("Pulse Rate"))->setGroup(1);
GraphView->findGraph("SpO2")->setGroup(1); GraphView->findGraph(tr("SpO2"))->setGroup(1);
GraphView->findGraph("Plethy")->setGroup(1); GraphView->findGraph(tr("Plethy"))->setGroup(1);
mainwin->Notify("Oximetry data exists for this day, however it's timestamps are too different, so the Graphs will not be linked.",3000); mainwin->Notify(tr("Oximetry data exists for this day, however it's timestamps are too different, so the Graphs will not be linked."),"",3000);
} else { } else {
//mainwin->Notify("Oximetry & CPAP graphs are linked for this day",2000); //mainwin->Notify(tr("Oximetry & CPAP graphs are linked for this day"),"",2000);
GraphView->findGraph("Pulse Rate")->setGroup(0); GraphView->findGraph(tr("Pulse Rate"))->setGroup(0);
GraphView->findGraph("SpO2")->setGroup(0); GraphView->findGraph(tr("SpO2"))->setGroup(0);
GraphView->findGraph("Plethy")->setGroup(0); GraphView->findGraph(tr("Plethy"))->setGroup(0);
} }
} }
lastcpapday=cpap; lastcpapday=cpap;
@ -647,10 +647,10 @@ void Daily::Load(QDate date)
bool isBrick=false; bool isBrick=false;
if (cpap) { if (cpap) {
if (GraphView->isEmpty()) { if (GraphView->isEmpty()) {
GraphView->setEmptyText("Brick Machine :("); GraphView->setEmptyText(tr("Brick Machine :("));
isBrick=true; isBrick=true;
} else { } else {
GraphView->setEmptyText("No Data"); GraphView->setEmptyText(tr("No Data"));
} }
mode=(CPAPMode)(int)cpap->settings_max(CPAP_Mode); mode=(CPAPMode)(int)cpap->settings_max(CPAP_Mode);
@ -686,15 +686,15 @@ void Daily::Load(QDate date)
EventDataType min=cpap->settings_min(CPAP_PressureMin); EventDataType min=cpap->settings_min(CPAP_PressureMin);
EventDataType max=cpap->settings_max(CPAP_PressureMax); EventDataType max=cpap->settings_max(CPAP_PressureMax);
if (mode==MODE_CPAP) html+="CPAP "+QString::number(min)+"cmH2O"; if (mode==MODE_CPAP) html+=tr("CPAP")+" "+QString::number(min)+tr("cmH2O");
else if (mode==MODE_APAP) html+="APAP "+QString::number(min)+"-"+QString::number(max)+"cmH2O"; else if (mode==MODE_APAP) html+=tr("APAP")+" "+QString::number(min)+"-"+QString::number(max)+tr("cmH2O");
else if (mode==MODE_BIPAP) html+="Bi-Level"; else if (mode==MODE_BIPAP) html+=tr("Bi-Level");
else if (mode==MODE_ASV) html+="ASV"; else if (mode==MODE_ASV) html+=tr("ASV");
else html+="Unknown"; else html+=tr("Unknown");
html+="</td></tr>\n"; html+="</td></tr>\n";
html+="<tr><td align='center'><b>Date</b></td><td align='center'><b>"+tr("Sleep")+"</b></td><td align='center'><b>"+tr("Wake")+"</b></td><td align='center'><b>"+tr("Hours")+"</b></td></tr>"; html+="<tr><td align='center'><b>"+tr("Date")+"</b></td><td align='center'><b>"+tr("Sleep")+"</b></td><td align='center'><b>"+tr("Wake")+"</b></td><td align='center'><b>"+tr("Hours")+"</b></td></tr>";
int tt=qint64(cpap->total_time())/1000L; int tt=qint64(cpap->total_time())/1000L;
QDateTime date=QDateTime::fromTime_t(cpap->first()/1000L); QDateTime date=QDateTime::fromTime_t(cpap->first()/1000L);
QDateTime date2=QDateTime::fromTime_t(cpap->last()/1000L); QDateTime date2=QDateTime::fromTime_t(cpap->last()/1000L);
@ -807,8 +807,8 @@ void Daily::Load(QDate date)
} }
} else { } else {
html+="<tr><td colspan='5' align='center'><b><h2>"+tr("BRICK :(")+"</h2></b></td></tr>"; html+="<tr><td colspan='5' align='center'><b><h2>"+tr("BRICK :(")+"</h2></b></td></tr>";
html+="<tr><td colspan='5' align='center'><i>Sorry, your machine does not record data.</i></td></tr>\n"; html+="<tr><td colspan='5' align='center'><i>"+tr("Sorry, your machine does not record data.")+"</i></td></tr>\n";
html+="<tr><td colspan='5' align='center'><i>Complain to your Equipment Provider!</i></td></tr>\n"; html+="<tr><td colspan='5' align='center'><i>"+tr("Complain to your Equipment Provider!")+"</i></td></tr>\n";
html+="<tr><td colspan='5'>&nbsp;</td></tr>\n"; html+="<tr><td colspan='5'>&nbsp;</td></tr>\n";
} }
} else { } else {
@ -859,15 +859,15 @@ void Daily::Load(QDate date)
int j=cpap->settings_max(PRS1_FlexSet); int j=cpap->settings_max(PRS1_FlexSet);
QString flexstr=(i>1) ? schema::channel[PRS1_FlexMode].option(i)+" "+schema::channel[PRS1_FlexSet].option(j) : "None"; QString flexstr=(i>1) ? schema::channel[PRS1_FlexMode].option(i)+" "+schema::channel[PRS1_FlexSet].option(j) : "None";
html+="<tr><td colspan=4>Pressure Relief: "+flexstr+"</td></tr>"; html+="<tr><td colspan=4>"+tr("Pressure Relief:")+" "+flexstr+"</td></tr>";
i=cpap->settings_max(PRS1_HumidSetting); i=cpap->settings_max(PRS1_HumidSetting);
QString humid=(i==0) ? "Off" : "x"+QString::number(i); QString humid=(i==0) ? tr("Off") : "x"+QString::number(i);
html+="<tr><td colspan=4>Humidifier Setting: "+humid+"</td></tr>"; html+="<tr><td colspan=4>"+tr("Humidifier Setting:")+" "+humid+"</td></tr>";
} else if (cpap->machine->GetClass()=="ResMed") { } else if (cpap->machine->GetClass()=="ResMed") {
int epr=cpap->settings_max("EPR"); int epr=cpap->settings_max("EPR");
int epr2=cpap->settings_max("EPRSet"); int epr2=cpap->settings_max("EPRSet");
html+="<tr><td colspan=4>EPR Setting: "+QString::number(epr)+" / "+QString::number(epr2)+"</td></tr>"; html+="<tr><td colspan=4>"+tr("EPR Setting:")+" "+QString::number(epr)+" / "+QString::number(epr2)+"</td></tr>";
//epr=schema::channel[PRS1_FlexSet].optionString(pr)+QString(" x%1").arg((int)cpap->settings_max(PRS1_FlexSet)); //epr=schema::channel[PRS1_FlexSet].optionString(pr)+QString(" x%1").arg((int)cpap->settings_max(PRS1_FlexSet));
} }
@ -879,8 +879,8 @@ void Daily::Load(QDate date)
bool corrupted_waveform=false; bool corrupted_waveform=false;
QString tooltip; QString tooltip;
if (cpap) { if (cpap) {
html+="<tr><td align=left><b>SessionID</b></td><td align=center><b>Date</b></td><td align=center><b>Start</b></td><td align=center><b>End</b></td></tr>"; html+="<tr><td align=left><b>"+tr("SessionID")+"</b></td><td align=center><b>"+tr("Date")+"</b></td><td align=center><b>"+tr("Start")+"</b></td><td align=center><b>"+tr("End")+"</b></td></tr>";
html+="<tr><td align=left colspan=4><i>CPAP Sessions</i></td></tr>"; html+="<tr><td align=left colspan=4><i>"+tr("CPAP Sessions")+"</i></td></tr>";
for (QVector<Session *>::iterator s=cpap->begin();s!=cpap->end();s++) { for (QVector<Session *>::iterator s=cpap->begin();s!=cpap->end();s++) {
fd=QDateTime::fromTime_t((*s)->first()/1000L); fd=QDateTime::fromTime_t((*s)->first()/1000L);
ld=QDateTime::fromTime_t((*s)->last()/1000L); ld=QDateTime::fromTime_t((*s)->last()/1000L);
@ -889,7 +889,9 @@ void Daily::Load(QDate date)
int m=(len/60) % 60; int m=(len/60) % 60;
int s1=len % 60; int s1=len % 60;
QHash<ChannelID,QVariant>::iterator i=(*s)->settings.find("BrokenWaveform"); QHash<ChannelID,QVariant>::iterator i=(*s)->settings.find("BrokenWaveform");
tooltip=cpap->machine->GetClass()+" CPAP "+QString().sprintf("%2ih&nbsp;%2im&nbsp;%2is",h,m,s1); tooltip=cpap->machine->GetClass()+" "+tr("CPAP")+" "+QString().sprintf("%2ih&nbsp;%2im&nbsp;%2is",h,m,s1);
// tooltip needs to lookup language.. :-/
if ((i!=(*s)->settings.end()) && i.value().toBool()) corrupted_waveform=true; if ((i!=(*s)->settings.end()) && i.value().toBool()) corrupted_waveform=true;
tmp.sprintf(("<tr><td align=left><a href='cpap=%i' title='"+tooltip+"'>%08i</a></td><td align=center>"+fd.date().toString(Qt::SystemLocaleShortDate)+"</td><td align=center>"+fd.toString("HH:mm ")+"</td><td align=center>"+ld.toString("HH:mm")+"</td></tr>").toLatin1(),(*s)->session(),(*s)->session()); tmp.sprintf(("<tr><td align=left><a href='cpap=%i' title='"+tooltip+"'>%08i</a></td><td align=center>"+fd.date().toString(Qt::SystemLocaleShortDate)+"</td><td align=center>"+fd.toString("HH:mm ")+"</td><td align=center>"+ld.toString("HH:mm")+"</td></tr>").toLatin1(),(*s)->session(),(*s)->session());
html+=tmp; html+=tmp;
@ -897,8 +899,7 @@ void Daily::Load(QDate date)
//if (oxi) html+="<tr><td colspan=4><hr></td></tr>"; //if (oxi) html+="<tr><td colspan=4><hr></td></tr>";
} }
if (oxi) { if (oxi) {
html+="<tr><td align=left colspan=4><i>Oximetry Sessions</i></td></tr>"; html+="<tr><td align=left colspan=4><i>"+tr("Oximetry Sessions")+"</i></td></tr>";
//html+="<tr><td align=left>SessionID</td><td align=center>Date</td><td align=center>Start</td><td align=center>End</td></tr>";
for (QVector<Session *>::iterator s=oxi->begin();s!=oxi->end();s++) { for (QVector<Session *>::iterator s=oxi->begin();s!=oxi->end();s++) {
fd=QDateTime::fromTime_t((*s)->first()/1000L); fd=QDateTime::fromTime_t((*s)->first()/1000L);
ld=QDateTime::fromTime_t((*s)->last()/1000L); ld=QDateTime::fromTime_t((*s)->last()/1000L);
@ -907,7 +908,9 @@ void Daily::Load(QDate date)
int m=(len/60) % 60; int m=(len/60) % 60;
int s1=len % 60; int s1=len % 60;
QHash<ChannelID,QVariant>::iterator i=(*s)->settings.find("BrokenWaveform"); QHash<ChannelID,QVariant>::iterator i=(*s)->settings.find("BrokenWaveform");
tooltip=oxi->machine->GetClass()+" Oximeter "+QString().sprintf("%2ih,&nbsp;%2im,&nbsp;%2is",h,m,s1); tooltip=oxi->machine->GetClass()+" "+tr("Oximeter")+" "+QString().sprintf("%2ih,&nbsp;%2im,&nbsp;%2is",h,m,s1);
if ((i!=(*s)->settings.end()) && i.value().toBool()) corrupted_waveform=true; if ((i!=(*s)->settings.end()) && i.value().toBool()) corrupted_waveform=true;
tmp.sprintf(("<tr><td align=left><a href='oxi=%i' title='"+tooltip+"'>%08i</a></td><td align=center>"+fd.date().toString(Qt::SystemLocaleShortDate)+"</td><td align=center>"+fd.toString("HH:mm ")+"</td><td align=center>"+ld.toString("HH:mm")+"</td></tr>").toLatin1(),(*s)->session(),(*s)->session()); tmp.sprintf(("<tr><td align=left><a href='oxi=%i' title='"+tooltip+"'>%08i</a></td><td align=center>"+fd.date().toString(Qt::SystemLocaleShortDate)+"</td><td align=center>"+fd.toString("HH:mm ")+"</td><td align=center>"+ld.toString("HH:mm")+"</td></tr>").toLatin1(),(*s)->session(),(*s)->session());
html+=tmp; html+=tmp;
@ -915,7 +918,7 @@ void Daily::Load(QDate date)
} }
html+="</table>"; html+="</table>";
if (corrupted_waveform) { if (corrupted_waveform) {
html+="<hr><div align=center><i>One or more waveform record for this session had faulty source data. Some waveform overlay points may not match up correctly.</i></div>"; html+="<hr><div align=center><i>"+tr("One or more waveform record for this session had faulty source data. Some waveform overlay points may not match up correctly.")+"</i></div>";
} }
} }
html+="</body></html>"; html+="</body></html>";
@ -924,11 +927,11 @@ void Daily::Load(QDate date)
ui->JournalNotes->clear(); ui->JournalNotes->clear();
ui->bookmarkTable->clear(); ui->bookmarkTable->clearContents();
ui->bookmarkTable->setRowCount(0); ui->bookmarkTable->setRowCount(0);
QStringList sl; QStringList sl;
sl.append("Starts"); //sl.append(tr("Starts"));
sl.append("Notes"); //sl.append(tr("Notes"));
ui->bookmarkTable->setHorizontalHeaderLabels(sl); ui->bookmarkTable->setHorizontalHeaderLabels(sl);
ui->ZombieMeter->blockSignals(true); ui->ZombieMeter->blockSignals(true);
ui->weightSpinBox->blockSignals(true); ui->weightSpinBox->blockSignals(true);

View File

@ -51,7 +51,7 @@ ExportCSV::ExportCSV(QWidget *parent) :
connect(ui->startDate->calendarWidget(),SIGNAL(currentPageChanged(int,int)),SLOT(startDate_currentPageChanged(int,int))); connect(ui->startDate->calendarWidget(),SIGNAL(currentPageChanged(int,int)),SLOT(startDate_currentPageChanged(int,int)));
connect(ui->endDate->calendarWidget(),SIGNAL(currentPageChanged(int,int)),SLOT(endDate_currentPageChanged(int,int))); connect(ui->endDate->calendarWidget(),SIGNAL(currentPageChanged(int,int)),SLOT(endDate_currentPageChanged(int,int)));
on_quickRangeCombo_activated("Most Recent Day"); on_quickRangeCombo_activated(tr("Most Recent Day"));
ui->rb1_details->clearFocus(); ui->rb1_details->clearFocus();
ui->quickRangeCombo->setFocus(); ui->quickRangeCombo->setFocus();
ui->exportButton->setEnabled(false); ui->exportButton->setEnabled(false);
@ -64,17 +64,17 @@ ExportCSV::~ExportCSV()
void ExportCSV::on_filenameBrowseButton_clicked() void ExportCSV::on_filenameBrowseButton_clicked()
{ {
QString timestamp="SleepyHead_"; QString timestamp=tr("SleepyHead_");
timestamp+=PROFILE.Get("Username")+"_"; timestamp+=PROFILE.Get("Username")+"_";
if (ui->rb1_details->isChecked()) timestamp+="Details_"; if (ui->rb1_details->isChecked()) timestamp+=tr("Details_");
if (ui->rb1_Sessions->isChecked()) timestamp+="Sessions_"; if (ui->rb1_Sessions->isChecked()) timestamp+=tr("Sessions_");
if (ui->rb1_Summary->isChecked()) timestamp+="Summary_"; if (ui->rb1_Summary->isChecked()) timestamp+=tr("Summary_");
timestamp+=ui->startDate->date().toString(Qt::ISODate); timestamp+=ui->startDate->date().toString(Qt::ISODate);
if (ui->startDate->date()!=ui->endDate->date()) timestamp+="_"+ui->endDate->date().toString(Qt::ISODate); if (ui->startDate->date()!=ui->endDate->date()) timestamp+="_"+ui->endDate->date().toString(Qt::ISODate);
timestamp+=".csv"; timestamp+=".csv";
QString name=QFileDialog::getSaveFileName(this,"Select file to export to",PREF.Get("{home}/")+timestamp,"CSV Files (*.csv)"); QString name=QFileDialog::getSaveFileName(this,tr("Select file to export to"),PREF.Get("{home}/")+timestamp,tr("CSV Files (*.csv)"));
if (name.isEmpty()) { if (name.isEmpty()) {
ui->exportButton->setEnabled(false); ui->exportButton->setEnabled(false);
return; return;
@ -91,7 +91,7 @@ void ExportCSV::on_quickRangeCombo_activated(const QString &arg1)
{ {
QDate first=PROFILE.FirstDay(); QDate first=PROFILE.FirstDay();
QDate last=PROFILE.LastDay(); QDate last=PROFILE.LastDay();
if (arg1=="Custom") { if (arg1==tr("Custom")) {
ui->startDate->setEnabled(true); ui->startDate->setEnabled(true);
ui->endDate->setEnabled(true); ui->endDate->setEnabled(true);
ui->startLabel->setEnabled(true); ui->startLabel->setEnabled(true);
@ -102,25 +102,25 @@ void ExportCSV::on_quickRangeCombo_activated(const QString &arg1)
ui->startLabel->setEnabled(false); ui->startLabel->setEnabled(false);
ui->endLabel->setEnabled(false); ui->endLabel->setEnabled(false);
if (arg1=="Everything") { if (arg1==tr("Everything")) {
ui->startDate->setDate(first); ui->startDate->setDate(first);
ui->endDate->setDate(last); ui->endDate->setDate(last);
} else if (arg1=="Most Recent Day") { } else if (arg1==tr("Most Recent Day")) {
ui->startDate->setDate(last); ui->startDate->setDate(last);
ui->endDate->setDate(last); ui->endDate->setDate(last);
} else if (arg1=="Last Week") { } else if (arg1==tr("Last Week")) {
ui->startDate->setDate(last.addDays(-7)); ui->startDate->setDate(last.addDays(-7));
ui->endDate->setDate(last); ui->endDate->setDate(last);
} else if (arg1=="Last Fortnight") { } else if (arg1==tr("Last Fortnight")) {
ui->startDate->setDate(last.addDays(-14)); ui->startDate->setDate(last.addDays(-14));
ui->endDate->setDate(last); ui->endDate->setDate(last);
} else if (arg1=="Last Month") { } else if (arg1==tr("Last Month")) {
ui->startDate->setDate(last.addMonths(-1)); ui->startDate->setDate(last.addMonths(-1));
ui->endDate->setDate(last); ui->endDate->setDate(last);
} else if (arg1=="Last 6 Months") { } else if (arg1==tr("Last 6 Months")) {
ui->startDate->setDate(last.addMonths(-6)); ui->startDate->setDate(last.addMonths(-6));
ui->endDate->setDate(last); ui->endDate->setDate(last);
} else if (arg1=="Last Year") { } else if (arg1==tr("Last Year")) {
ui->startDate->setDate(last.addYears(-1)); ui->startDate->setDate(last.addYears(-1));
ui->endDate->setDate(last); ui->endDate->setDate(last);
} }
@ -154,20 +154,21 @@ void ExportCSV::on_exportButton_clicked()
p90list.append(CPAP_IPAP); p90list.append(CPAP_IPAP);
p90list.append(CPAP_EPAP); p90list.append(CPAP_EPAP);
// Not sure this section should be translateable.. :-/
if (ui->rb1_details->isChecked()) { if (ui->rb1_details->isChecked()) {
header="DateTime"+sep+"Session"+sep+"Event"+sep+"Data/Duration"; header=tr("DateTime")+sep+tr("Session")+sep+tr("Event")+sep+tr("Data/Duration");
} else { } else {
if (ui->rb1_Summary->isChecked()) { if (ui->rb1_Summary->isChecked()) {
header="Date"+sep+"Session Count"+sep+"Start"+sep+"End"+sep+"Total Time"+sep+"AHI"; header=tr("Date")+sep+tr("Session Count")+sep+tr("Start")+sep+tr("End")+sep+tr("Total Time")+sep+tr("AHI");
} else if (ui->rb1_Sessions->isChecked()) { } else if (ui->rb1_Sessions->isChecked()) {
header="Date"+sep+"Session"+sep+"Start"+sep+"End"+sep+"Total Time"+sep+"AHI"; header=tr("Date")+sep+tr("Session")+sep+tr("Start")+sep+tr("End")+sep+tr("Total Time")+sep+tr("AHI");
} }
for (int i=0;i<countlist.size();i++) for (int i=0;i<countlist.size();i++)
header+=sep+countlist[i]+" Count"; header+=sep+countlist[i]+tr(" Count");
for (int i=0;i<avglist.size();i++) for (int i=0;i<avglist.size();i++)
header+=sep+avglist[i]+" Avg"; header+=sep+avglist[i]+tr(" Avg");
for (int i=0;i<p90list.size();i++) for (int i=0;i<p90list.size();i++)
header+=sep+p90list[i]+" 90%"; header+=sep+p90list[i]+tr(" 90%");
} }
header+=newline; header+=newline;
file.write(header.toAscii()); file.write(header.toAscii());

View File

@ -61,16 +61,19 @@ void initialize()
{ {
schema::init(); schema::init();
} }
void release_notes() void release_notes()
{ {
QDialog relnotes; QDialog relnotes;
QVBoxLayout layout(&relnotes); QVBoxLayout layout(&relnotes);
QWebView web(&relnotes); QWebView web(&relnotes);
// Language???
web.load(QUrl("qrc:/docs/release_notes.html")); web.load(QUrl("qrc:/docs/release_notes.html"));
//web.page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOn); //web.page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOn);
relnotes.setLayout(&layout); relnotes.setLayout(&layout);
layout.insertWidget(0,&web,1); layout.insertWidget(0,&web,1);
QPushButton okbtn("&Ok, get on with it..",&relnotes); QPushButton okbtn(QObject::tr("&Ok, get on with it.."),&relnotes);
relnotes.connect(&okbtn,SIGNAL(clicked()),SLOT(accept())); relnotes.connect(&okbtn,SIGNAL(clicked()),SLOT(accept()));
layout.insertWidget(1,&okbtn,1); layout.insertWidget(1,&okbtn,1);
relnotes.exec(); relnotes.exec();
@ -109,12 +112,10 @@ int main(int argc, char *argv[])
IntellipapLoader::Register(); IntellipapLoader::Register();
Profiles::Scan(); Profiles::Scan();
qRegisterMetaType<Preference>("Preference"); qRegisterMetaType<Preference>("Preference");
PREF["AppName"]="SleepyHead"; PREF["AppName"]=QObject::tr("SleepyHead");
bool skip_login=(PREF.ExistsAndTrue("SkipLoginScreen")); bool skip_login=(PREF.ExistsAndTrue("SkipLoginScreen"));
if (force_login_screen) skip_login=false; if (force_login_screen) skip_login=false;
QString Version=QString("%1.%2.%3").arg(major_version).arg(minor_version).arg(revision_number);
QDateTime lastchecked, today=QDateTime::currentDateTime(); QDateTime lastchecked, today=QDateTime::currentDateTime();
if (!PREF.Exists("Updates_AutoCheck")) { if (!PREF.Exists("Updates_AutoCheck")) {
PREF["Updates_AutoCheck"]=true; PREF["Updates_AutoCheck"]=true;
@ -167,7 +168,7 @@ int main(int argc, char *argv[])
} }
} }
} }
PREF["VersionString"]=Version; PREF["VersionString"]=VersionString();
p_profile=Profiles::Get(PREF["Profile"].toString()); p_profile=Profiles::Get(PREF["Profile"].toString());

View File

@ -31,6 +31,7 @@
#include "SleepLib/schema.h" #include "SleepLib/schema.h"
#include "Graphs/glcommon.h" #include "Graphs/glcommon.h"
#include "UpdaterWindow.h" #include "UpdaterWindow.h"
#include "version.h"
QProgressBar *qprogress; QProgressBar *qprogress;
QLabel *qstatus; QLabel *qstatus;
@ -199,7 +200,7 @@ MainWindow::~MainWindow()
} }
void MainWindow::Notify(QString s,int ms,QString title) void MainWindow::Notify(QString s,QString title,int ms)
{ {
if (systray) { if (systray) {
systray->showMessage(title,s,QSystemTrayIcon::Information,ms); systray->showMessage(title,s,QSystemTrayIcon::Information,ms);
@ -724,7 +725,7 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
return; return;
} }
Notify("Printing "+name+" Report.\nThis make take some time to complete..\nPlease don't touch anything until it's done.",20000); Notify(tr("This make take some time to complete..\nPlease don't touch anything until it's done."),tr("Printing %1 Report").arg(name),20000);
QPainter painter; QPainter painter;
painter.begin(printer); painter.begin(printer);
@ -733,7 +734,7 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
float hscale=pxres.width()/pres.width(); float hscale=pxres.width()/pres.width();
float vscale=pxres.height()/pres.height(); float vscale=pxres.height()/pres.height();
QFontMetrics fm(*bigfont); //QFontMetrics fm(*bigfont);
//float title_height=fm.ascent()*vscale; //float title_height=fm.ascent()*vscale;
QFontMetrics fm2(*defaultfont); QFontMetrics fm2(*defaultfont);
float normal_height=fm2.ascent()*vscale; float normal_height=fm2.ascent()*vscale;
@ -770,7 +771,7 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
//float scalex=1.0/graph_xscale; //float scalex=1.0/graph_xscale;
float gh=full_graph_height*graph_xscale; float gh=full_graph_height*graph_xscale;
QString title=name+" Report"; QString title=tr("%1 Report").arg(name);
painter.setFont(*bigfont); painter.setFont(*bigfont);
int top=0; int top=0;
QRectF bounds=painter.boundingRect(QRectF(0,top,printer_width,0),title,QTextOption(Qt::AlignHCenter | Qt::AlignTop)); QRectF bounds=painter.boundingRect(QRectF(0,top,printer_width,0),title,QTextOption(Qt::AlignHCenter | Qt::AlignTop));
@ -784,18 +785,18 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
int maxy=0; int maxy=0;
if (!PROFILE["FirstName"].toString().isEmpty()) { if (!PROFILE["FirstName"].toString().isEmpty()) {
QString userinfo="Name:\t"+PROFILE["LastName"].toString()+", "+PROFILE["FirstName"].toString()+"\n"; QString userinfo=tr("Name:\t %1, %2\n").arg(PROFILE["LastName"].toString()).arg(PROFILE["FirstName"].toString());
userinfo+="DOB:\t"+PROFILE["DOB"].toString()+"\n"; userinfo+=tr("DOB:\t%1\n").arg(PROFILE["DOB"].toString());
userinfo+="Phone:\t"+PROFILE["Phone"].toString()+"\n"; userinfo+=tr("Phone:\t%1\n").arg(PROFILE["Phone"].toString());
userinfo+="Email:\t"+PROFILE["EmailAddress"].toString()+"\n"; userinfo+=tr("Email:\t%1\n").arg(PROFILE["EmailAddress"].toString());
if (!PROFILE["Address"].toString().isEmpty()) userinfo+="\nAddress:\n"+PROFILE["Address"].toString()+"\n"; if (!PROFILE["Address"].toString().isEmpty()) userinfo+=tr("\nAddress:\n").arg(PROFILE["Address"].toString());
QRectF bounds=painter.boundingRect(QRectF(0,top,res.width(),0),userinfo,QTextOption(Qt::AlignLeft | Qt::AlignTop)); QRectF bounds=painter.boundingRect(QRectF(0,top,res.width(),0),userinfo,QTextOption(Qt::AlignLeft | Qt::AlignTop));
painter.drawText(bounds,userinfo,QTextOption(Qt::AlignLeft | Qt::AlignTop)); painter.drawText(bounds,userinfo,QTextOption(Qt::AlignLeft | Qt::AlignTop));
if (bounds.height()>maxy) maxy=bounds.height(); if (bounds.height()>maxy) maxy=bounds.height();
} }
int graph_slots=0; int graph_slots=0;
if (name=="Daily") { if (name==tr("Daily")) {
Day *cpap=PROFILE.GetDay(date,MT_CPAP); Day *cpap=PROFILE.GetDay(date,MT_CPAP);
QString cpapinfo=date.toString(Qt::SystemLocaleLongDate)+"\n\n"; QString cpapinfo=date.toString(Qt::SystemLocaleLongDate)+"\n\n";
if (cpap) { if (cpap) {
@ -806,24 +807,24 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
int m=(tt/60)%60; int m=(tt/60)%60;
int s=tt % 60; int s=tt % 60;
cpapinfo+="Mask Time: "+QString().sprintf("%2i hours, %2i minutes, %2i seconds",h,m,s)+"\n"; cpapinfo+=tr("Mask Time: ")+QString().sprintf("%2i hours, %2i minutes, %2i seconds",h,m,s)+"\n";
cpapinfo+="Bedtime: "+QDateTime::fromTime_t(f).time().toString("HH:mm:ss")+" "; cpapinfo+=tr("Bedtime: ")+QDateTime::fromTime_t(f).time().toString("HH:mm:ss")+" ";
cpapinfo+="Wake-up: "+QDateTime::fromTime_t(l).time().toString("HH:mm:ss")+"\n\n"; cpapinfo+=tr("Wake-up: ")+QDateTime::fromTime_t(l).time().toString("HH:mm:ss")+"\n\n";
QString submodel; QString submodel;
cpapinfo+="Machine: "; cpapinfo+=tr("Machine: ");
if (cpap->machine->properties.find("SubModel")!=cpap->machine->properties.end()) if (cpap->machine->properties.find("SubModel")!=cpap->machine->properties.end())
submodel="\n"+cpap->machine->properties["SubModel"]; submodel="\n"+cpap->machine->properties["SubModel"];
cpapinfo+=cpap->machine->properties["Brand"]+" "+cpap->machine->properties["Model"]+submodel; cpapinfo+=cpap->machine->properties["Brand"]+" "+cpap->machine->properties["Model"]+submodel;
CPAPMode mode=(CPAPMode)(int)cpap->settings_max(CPAP_Mode); CPAPMode mode=(CPAPMode)(int)cpap->settings_max(CPAP_Mode);
cpapinfo+="\nMode: "; cpapinfo+=tr("\nMode: ");
EventDataType min=cpap->settings_min(CPAP_PressureMin); EventDataType min=cpap->settings_min(CPAP_PressureMin);
EventDataType max=cpap->settings_max(CPAP_PressureMax); EventDataType max=cpap->settings_max(CPAP_PressureMax);
if (mode==MODE_CPAP) cpapinfo+="CPAP "+QString::number(min)+"cmH2O"; if (mode==MODE_CPAP) cpapinfo+=tr("CPAP %1cmH2O").arg(min);
else if (mode==MODE_APAP) cpapinfo+="APAP "+QString::number(min)+"-"+QString::number(max)+"cmH2O"; else if (mode==MODE_APAP) cpapinfo+=tr("APAP %1-%2cmH2O").arg(min).arg(max);
else if (mode==MODE_BIPAP) cpapinfo+="Bi-Level"+QString::number(min)+"-"+QString::number(max)+"cmH2O"; else if (mode==MODE_BIPAP) cpapinfo+=tr("Bi-Level %1-%2cmH2O").arg(min).arg(max);
else if (mode==MODE_ASV) cpapinfo+="ASV"; else if (mode==MODE_ASV) cpapinfo+=tr("ASV");
float ahi=(cpap->count(CPAP_Obstructive)+cpap->count(CPAP_Hypopnea)+cpap->count(CPAP_ClearAirway)+cpap->count(CPAP_Apnea))/cpap->hours(); float ahi=(cpap->count(CPAP_Obstructive)+cpap->count(CPAP_Hypopnea)+cpap->count(CPAP_ClearAirway)+cpap->count(CPAP_Apnea))/cpap->hours();
float csr=(100.0/cpap->hours())*(cpap->sum(CPAP_CSR)/3600.0); float csr=(100.0/cpap->hours())*(cpap->sum(CPAP_CSR)/3600.0);
@ -845,7 +846,7 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
QString stats; QString stats;
painter.setFont(*mediumfont); painter.setFont(*mediumfont);
stats="AHI\t"+QString::number(ahi,'f',2)+"\n"; stats=tr("AHI\t%1\n").arg(ahi,0,'f',2);
QRectF bounds=painter.boundingRect(QRectF(0,0,res.width(),0),stats,QTextOption(Qt::AlignRight)); QRectF bounds=painter.boundingRect(QRectF(0,0,res.width(),0),stats,QTextOption(Qt::AlignRight));
painter.drawText(bounds,stats,QTextOption(Qt::AlignRight)); painter.drawText(bounds,stats,QTextOption(Qt::AlignRight));
@ -864,20 +865,15 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
int ttop=bounds.height(); int ttop=bounds.height();
stats="AI="+QString::number(oai,'f',2)+" "; stats=tr("AI=%1 HI=%2 CAI=%3 ").arg(oai,0,'f',2).arg(hi,0,'f',2).arg(cai,0,'f',2);
stats+="HI="+QString::number(hi,'f',2)+" ";
stats+="CAI="+QString::number(cai,'f',2)+" ";
if (cpap->machine->GetClass()=="PRS1") { if (cpap->machine->GetClass()=="PRS1") {
stats+="REI="+QString::number(rei,'f',2)+" "; stats+=tr("REI=%1 VSI=%2 FLI=%3 PB/CSR=%4%%")
stats+="VSI="+QString::number(vsi,'f',2)+" "; .arg(rei,0,'f',2).arg(vsi,0,'f',2)
stats+="FLI="+QString::number(fli,'f',2)+" "; .arg(fli,0,'f',2).arg(csr,0,'f',2);
stats+="PB/CSR="+QString::number(csr,'f',2)+"%";
} else if (cpap->machine->GetClass()=="ResMed") { } else if (cpap->machine->GetClass()=="ResMed") {
stats+="UAI="+QString::number(uai,'f',2)+" "; stats+=tr("UAI=%1 ").arg(uai,0,'f',2);
} else if (cpap->machine->GetClass()=="Intellipap") { } else if (cpap->machine->GetClass()=="Intellipap") {
stats+="NRI="+QString::number(nri,'f',2)+" "; stats+=tr("NRI=%1 LKI=%2 EPI=%3").arg(nri,0,'f',2).arg(lki,0,'f',2).arg(exp,0,'f',2);
stats+="LKI="+QString::number(lki,'f',2)+" ";
stats+="EPI="+QString::number(exp,'f',2)+" ";
} }
bounds=painter.boundingRect(QRectF(0,top+ttop,res.width(),0),stats,QTextOption(Qt::AlignCenter)); bounds=painter.boundingRect(QRectF(0,top+ttop,res.width(),0),stats,QTextOption(Qt::AlignCenter));
painter.drawText(bounds,stats,QTextOption(Qt::AlignCenter)); painter.drawText(bounds,stats,QTextOption(Qt::AlignCenter));
@ -891,17 +887,17 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
} }
graph_slots=2; graph_slots=2;
} else if (name=="Overview") { } else if (name==tr("Overview")) {
QDateTime first=QDateTime::fromTime_t((*gv)[0]->min_x/1000L); QDateTime first=QDateTime::fromTime_t((*gv)[0]->min_x/1000L);
QDateTime last=QDateTime::fromTime_t((*gv)[0]->max_x/1000L); QDateTime last=QDateTime::fromTime_t((*gv)[0]->max_x/1000L);
QString ovinfo="Reporting from "+first.date().toString(Qt::SystemLocaleShortDate)+" to "+last.date().toString(Qt::SystemLocaleShortDate); QString ovinfo=tr("Reporting from %1 to %2").arg(first.date().toString(Qt::SystemLocaleShortDate)).arg(last.date().toString(Qt::SystemLocaleShortDate));
QRectF bounds=painter.boundingRect(QRectF(0,top,res.width(),0),ovinfo,QTextOption(Qt::AlignCenter)); QRectF bounds=painter.boundingRect(QRectF(0,top,res.width(),0),ovinfo,QTextOption(Qt::AlignCenter));
painter.drawText(bounds,ovinfo,QTextOption(Qt::AlignCenter)); painter.drawText(bounds,ovinfo,QTextOption(Qt::AlignCenter));
if (bounds.height()>maxy) maxy=bounds.height(); if (bounds.height()>maxy) maxy=bounds.height();
graph_slots=1; graph_slots=1;
} else if (name=="Oximetry") { } else if (name==tr("Oximetry")) {
QString ovinfo="Reporting data goes here"; QString ovinfo=tr("Reporting data goes here");
QRectF bounds=painter.boundingRect(QRectF(0,top,res.width(),0),ovinfo,QTextOption(Qt::AlignCenter)); QRectF bounds=painter.boundingRect(QRectF(0,top,res.width(),0),ovinfo,QTextOption(Qt::AlignCenter));
painter.drawText(bounds,ovinfo,QTextOption(Qt::AlignCenter)); painter.drawText(bounds,ovinfo,QTextOption(Qt::AlignCenter));
@ -921,12 +917,12 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
gGraph *g=(*gv)[i]; gGraph *g=(*gv)[i];
if (g->isEmpty()) continue; if (g->isEmpty()) continue;
if (!g->visible()) continue; if (!g->visible()) continue;
if (print_bookmarks && (g->title()=="Flow Rate")) { if (print_bookmarks && (g->title()==tr("Flow Rate"))) {
normal=false; normal=false;
start.push_back(st); start.push_back(st);
end.push_back(et); end.push_back(et);
graphs.push_back(g); graphs.push_back(g);
labels.push_back("Current Selection"); labels.push_back(tr("Current Selection"));
if (journal) { if (journal) {
if (journal->settings.contains("BookmarkStart")) { if (journal->settings.contains("BookmarkStart")) {
QVariantList st1=journal->settings["BookmarkStart"].toList(); QVariantList st1=journal->settings["BookmarkStart"].toList();
@ -974,12 +970,12 @@ void MainWindow::PrintReport(gGraphView *gv,QString name, QDate date)
} }
if (first) { if (first) {
QString footer="SleepyHead v"+PREF["VersionString"].toString()+" - http://sleepyhead.sourceforge.net"; QString footer=tr("SleepyHead v%1 - http://sleepyhead.sourceforge.net").arg(VersionString());
QRectF bounds=painter.boundingRect(QRectF(0,res.height(),res.width(),normal_height),footer,QTextOption(Qt::AlignHCenter)); QRectF bounds=painter.boundingRect(QRectF(0,res.height(),res.width(),normal_height),footer,QTextOption(Qt::AlignHCenter));
painter.drawText(bounds,footer,QTextOption(Qt::AlignHCenter)); painter.drawText(bounds,footer,QTextOption(Qt::AlignHCenter));
QString pagestr="Page "+QString::number(page)+" of "+QString::number(pages); QString pagestr=tr("Page %1 of %2").arg(page).arg(pages);
QRectF pagebnds=painter.boundingRect(QRectF(0,res.height(),res.width(),normal_height),pagestr,QTextOption(Qt::AlignRight)); QRectF pagebnds=painter.boundingRect(QRectF(0,res.height(),res.width(),normal_height),pagestr,QTextOption(Qt::AlignRight));
painter.drawText(pagebnds,pagestr,QTextOption(Qt::AlignRight)); painter.drawText(pagebnds,pagestr,QTextOption(Qt::AlignRight));
first=false; first=false;
@ -1129,7 +1125,7 @@ void MainWindow::RestartApplication(bool force_login)
if (QProcess::startDetached("/usr/bin/open",args)) { if (QProcess::startDetached("/usr/bin/open",args)) {
QApplication::instance()->exit(); QApplication::instance()->exit();
} else QMessageBox::warning(this,"Gah!","If you can read this, the restart command didn't work. Your going to have to do it yourself manually.",QMessageBox::Ok); } else QMessageBox::warning(this,tr("Gah!"),tr("If you can read this, the restart command didn't work. Your going to have to do it yourself manually."),QMessageBox::Ok);
#else #else
apppath=QApplication::instance()->applicationFilePath(); apppath=QApplication::instance()->applicationFilePath();
@ -1145,7 +1141,7 @@ void MainWindow::RestartApplication(bool force_login)
if (force_login) args << "-l"; if (force_login) args << "-l";
if (QProcess::startDetached(apppath,args)) { if (QProcess::startDetached(apppath,args)) {
QApplication::instance()->exit(); QApplication::instance()->exit();
} else QMessageBox::warning(this,"Gah!","If you can read this, the restart command didn't work. Your going to have to do it yourself manually.",QMessageBox::Ok); } else QMessageBox::warning(this,tr("Gah!"),tr("If you can read this, the restart command didn't work. Your going to have to do it yourself manually."),QMessageBox::Ok);
#endif #endif
} }
@ -1201,7 +1197,7 @@ void MainWindow::on_actionAll_Data_for_current_CPAP_machine_triggered()
qDebug() << "Gah!! no machine to purge"; qDebug() << "Gah!! no machine to purge";
return; return;
} }
if (QMessageBox::question(this,"Are you sure?","Are you sure you want to purge all CPAP data for the following machine:\n"+m->properties["Brand"]+" "+m->properties["Model"]+" "+m->properties["ModelNumber"]+" ("+m->properties["Serial"]+")",QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) { if (QMessageBox::question(this,tr("Are you sure?"),tr("Are you sure you want to purge all CPAP data for the following machine:\n")+m->properties["Brand"]+" "+m->properties["Model"]+" "+m->properties["ModelNumber"]+" ("+m->properties["Serial"]+")",QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) {
m->Purge(3478216); m->Purge(3478216);
RestartApplication(); RestartApplication();
} }

View File

@ -32,6 +32,7 @@ class Report;
class Overview; class Overview;
/*! \class MainWindow /*! \class MainWindow
\author Mark Watkins
\brief The Main Application window for SleepyHead \brief The Main Application window for SleepyHead
*/ */
@ -56,8 +57,8 @@ public:
/*! \fn Notify(QString s,int ms=5000, QString title="SleepyHead v"+VersionString()); /*! \fn Notify(QString s,int ms=5000, QString title="SleepyHead v"+VersionString());
\brief Pops up a message box near the system tray \brief Pops up a message box near the system tray
\param QString string \param QString string
\param int ms
\param title \param title
\param int ms
Title is shown in bold Title is shown in bold
string is the main message content to show string is the main message content to show
@ -65,7 +66,7 @@ public:
Mac needs Growl notification system for this to work Mac needs Growl notification system for this to work
*/ */
void Notify(QString s,int ms=5000, QString title="SleepyHead v"+VersionString()); void Notify(QString s, QString title="SleepyHead v"+VersionString(), int ms=5000);
/*! \fn gGraphView *snapshotGraph() /*! \fn gGraphView *snapshotGraph()
\brief Returns the current snapshotGraph object used by the report printing system */ \brief Returns the current snapshotGraph object used by the report printing system */

View File

@ -38,7 +38,7 @@ NewProfile::NewProfile(QWidget *parent) :
m_passwordHashed=false; m_passwordHashed=false;
ui->heightEdit2->setVisible(false); ui->heightEdit2->setVisible(false);
ui->heightEdit->setDecimals(2); ui->heightEdit->setDecimals(2);
ui->heightEdit->setSuffix("cm"); ui->heightEdit->setSuffix(tr("cm"));
{ // process countries list { // process countries list
QFile f(":/docs/countries.txt"); QFile f(":/docs/countries.txt");
@ -46,7 +46,7 @@ NewProfile::NewProfile(QWidget *parent) :
QTextStream cnt(&f); QTextStream cnt(&f);
QString a; QString a;
ui->countryCombo->clear(); ui->countryCombo->clear();
ui->countryCombo->addItem("Select Country"); ui->countryCombo->addItem(tr("Select Country"));
do { do {
a=cnt.readLine(); a=cnt.readLine();
if (a.isEmpty()) break; if (a.isEmpty()) break;
@ -88,15 +88,15 @@ void NewProfile::on_nextButton_clicked()
switch(index) { switch(index) {
case 1: case 1:
if (ui->userNameEdit->text().isEmpty()) { if (ui->userNameEdit->text().isEmpty()) {
QMessageBox::information(this,"Error","Empty Username",QMessageBox::Ok); QMessageBox::information(this,tr("Error"),tr("Empty Username"),QMessageBox::Ok);
return; return;
} }
if (ui->genderCombo->currentIndex()==0) { if (ui->genderCombo->currentIndex()==0) {
//QMessageBox::information(this,"Notice","You did not specify Gender.",QMessageBox::Ok); //QMessageBox::information(this,tr("Notice"),tr("You did not specify Gender."),QMessageBox::Ok);
} }
if (ui->passwordGroupBox->isChecked()) { if (ui->passwordGroupBox->isChecked()) {
if (ui->passwordEdit1->text()!=ui->passwordEdit2->text()) { if (ui->passwordEdit1->text()!=ui->passwordEdit2->text()) {
QMessageBox::information(this,"Error","Passwords don't match",QMessageBox::Ok); QMessageBox::information(this,tr("Error"),tr("Passwords don't match"),QMessageBox::Ok);
return; return;
} }
if (ui->passwordEdit1->text().isEmpty()) if (ui->passwordEdit1->text().isEmpty())
@ -118,7 +118,7 @@ void NewProfile::on_nextButton_clicked()
ui->stackedWidget->setCurrentIndex(index); ui->stackedWidget->setCurrentIndex(index);
} else { } else {
// Finish button clicked. // Finish button clicked.
if (QMessageBox::question(this,"Profile Changes","Accept and save this information?",QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) { if (QMessageBox::question(this,tr("Profile Changes"),tr("Accept and save this information?"),QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) {
Profile *profile=Profiles::Get(ui->userNameEdit->text()); Profile *profile=Profiles::Get(ui->userNameEdit->text());
if (!profile) { // No profile, create one. if (!profile) { // No profile, create one.
profile=Profiles::Create(ui->userNameEdit->text()); profile=Profiles::Create(ui->userNameEdit->text());
@ -140,9 +140,9 @@ void NewProfile::on_nextButton_clicked()
} }
//prof["Password"]=""; //prof["Password"]="";
if (ui->genderCombo->currentIndex()==1) { if (ui->genderCombo->currentIndex()==1) {
prof["Gender"]="Male"; prof["Gender"]=tr("Male");
} else if (ui->genderCombo->currentIndex()==2) { } else if (ui->genderCombo->currentIndex()==2) {
prof["Gender"]="Female"; prof["Gender"]=tr("Female");
} }
prof["DateDiagnosed"]=ui->dateDiagnosedEdit->date(); prof["DateDiagnosed"]=ui->dateDiagnosedEdit->date();
prof["UntreatedAHI"]=ui->untreatedAHIEdit->value(); prof["UntreatedAHI"]=ui->untreatedAHIEdit->value();
@ -183,9 +183,9 @@ void NewProfile::on_nextButton_clicked()
} }
if (index>=max_pages) { if (index>=max_pages) {
ui->nextButton->setText("&Finish"); ui->nextButton->setText(tr("&Finish"));
} else { } else {
ui->nextButton->setText("&Next"); ui->nextButton->setText(tr("&Next"));
} }
ui->backButton->setEnabled(true); ui->backButton->setEnabled(true);
@ -193,7 +193,7 @@ void NewProfile::on_nextButton_clicked()
void NewProfile::on_backButton_clicked() void NewProfile::on_backButton_clicked()
{ {
ui->nextButton->setText("&Next"); ui->nextButton->setText(tr("&Next"));
if (ui->stackedWidget->currentIndex()>m_firstPage) { if (ui->stackedWidget->currentIndex()>m_firstPage) {
ui->stackedWidget->setCurrentIndex(ui->stackedWidget->currentIndex()-1); ui->stackedWidget->setCurrentIndex(ui->stackedWidget->currentIndex()-1);
} }
@ -294,13 +294,13 @@ void NewProfile::edit(const QString name)
ui->heightEdit2->setVisible(true); ui->heightEdit2->setVisible(true);
ui->heightEdit->setDecimals(0); ui->heightEdit->setDecimals(0);
ui->heightEdit2->setDecimals(0); ui->heightEdit2->setDecimals(0);
ui->heightEdit->setSuffix("ft"); ui->heightEdit->setSuffix(tr("ft")); // foot
ui->heightEdit2->setSuffix("\""); ui->heightEdit2->setSuffix(tr("\"")); // inches
} else { // good wholesome metric } else { // good wholesome metric
ui->heightEdit->setValue(v); ui->heightEdit->setValue(v);
ui->heightEdit2->setVisible(false); ui->heightEdit2->setVisible(false);
ui->heightEdit->setDecimals(2); ui->heightEdit->setDecimals(2);
ui->heightEdit->setSuffix("cm"); ui->heightEdit->setSuffix(tr("cm"));
} }
} }
@ -321,16 +321,16 @@ void NewProfile::on_heightCombo_currentIndexChanged(int index)
//metric //metric
ui->heightEdit2->setVisible(false); ui->heightEdit2->setVisible(false);
ui->heightEdit->setDecimals(2); ui->heightEdit->setDecimals(2);
ui->heightEdit->setSuffix("cm"); ui->heightEdit->setSuffix(tr("cm"));
double v=ui->heightEdit->value()*30.48; double v=ui->heightEdit->value()*30.48;
v+=ui->heightEdit2->value()*2.54; v+=ui->heightEdit2->value()*2.54;
ui->heightEdit->setValue(v); ui->heightEdit->setValue(v);
} else { //evil } else { //evil
ui->heightEdit->setDecimals(0); ui->heightEdit->setDecimals(0);
ui->heightEdit2->setDecimals(0); ui->heightEdit2->setDecimals(0);
ui->heightEdit->setSuffix("ft"); ui->heightEdit->setSuffix(tr("ft"));
ui->heightEdit2->setVisible(true); ui->heightEdit2->setVisible(true);
ui->heightEdit2->setSuffix("\""); ui->heightEdit2->setSuffix(tr("\""));
int v=ui->heightEdit->value()/2.54; int v=ui->heightEdit->value()/2.54;
int feet=v / 12; int feet=v / 12;
int inches=v % 12; int inches=v % 12;

View File

@ -13,6 +13,10 @@ namespace Ui {
class NewProfile; class NewProfile;
} }
/*! \class NewProfile
\author Mark Watkins <jedimark_at_users.sourceforge.net>
\brief Profile creation/editing wizard
*/
class NewProfile : public QDialog class NewProfile : public QDialog
{ {
Q_OBJECT Q_OBJECT
@ -20,11 +24,18 @@ class NewProfile : public QDialog
public: public:
explicit NewProfile(QWidget *parent = 0); explicit NewProfile(QWidget *parent = 0);
~NewProfile(); ~NewProfile();
//! \brief When used in edit mode, this skips the first page
void skipWelcomeScreen(); void skipWelcomeScreen();
//! \brief Open profile named 'name' for editing, loading all it's content
void edit(const QString name); void edit(const QString name);
private slots: private slots:
//! \brief Validate each step and move to the next page, saving at the end if requested.
void on_nextButton_clicked(); void on_nextButton_clicked();
//! \brief Go back to the previous wizard page
void on_backButton_clicked(); void on_backButton_clicked();
void on_cpapModeCombo_activated(int index); void on_cpapModeCombo_activated(int index);
@ -35,7 +46,6 @@ private slots:
void on_passwordEdit2_editingFinished(); void on_passwordEdit2_editingFinished();
void on_heightCombo_currentIndexChanged(int index); void on_heightCombo_currentIndexChanged(int index);
private: private:

View File

@ -98,70 +98,70 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
US->AddLayer(x,LayerBottom,0,gXAxis::Margin); US->AddLayer(x,LayerBottom,0,gXAxis::Margin);
US->AddLayer(new gXGrid()); US->AddLayer(new gXGrid());
PR=createGraph("Pressure","Pressure\n(cmH2O)"); PR=createGraph(tr("Pressure"),tr("Pressure\n(cmH2O)"));
SET=createGraph("Settings","Settings"); SET=createGraph(tr("Settings"),("Settings"));
LK=createGraph("Leaks","Leak Rate\n(L/min)"); LK=createGraph(tr("Leaks"),tr("Leak Rate\n(L/min)"));
NPB=createGraph("% in PB","Periodic\nBreathing\n(% of night)"); NPB=createGraph(tr("% in PB"),tr("Periodic\nBreathing\n(% of night)"));
AHIHR=createGraph("AHI/Hour","AHI Events/Hour\n(ahi/hr)"); AHIHR=createGraph(tr("AHI/Hour"),tr("AHI Events/Hour\n(ahi/hr)"));
RR=createGraph("Resp. Rate","Respiratory\nRate\n(breaths/min)"); RR=createGraph(tr("Resp. Rate"),tr("Respiratory\nRate\n(breaths/min)"));
TV=createGraph("Tidal Volume","Tidal\nVolume\n(ml)"); TV=createGraph(tr("Tidal Volume"),tr("Tidal\nVolume\n(ml)"));
MV=createGraph("Minute Vent.","Minute\nVentilation\n(L/min)"); MV=createGraph(tr("Minute Vent."),tr("Minute\nVentilation\n(L/min)"));
PTB=createGraph("Pat. Trig. Br.","Patient\nTriggered\nBreaths\n(%)"); PTB=createGraph(tr("Pat. Trig. Br."),tr("Patient\nTriggered\nBreaths\n(%)"));
SES=createGraph("Sessions","Sessions\n(count)"); SES=createGraph(tr("Sessions"),tr("Sessions\n(count)"));
PULSE=createGraph("Pulse Rate","Pulse Rate\n(bpm)"); PULSE=createGraph(tr("Pulse Rate"),tr("Pulse Rate\n(bpm)"));
SPO2=createGraph("SpO2","Oxygen Saturation\n(%)"); SPO2=createGraph(tr("SpO2"),tr("Oxygen Saturation\n(%)"));
WEIGHT=createGraph("Weight","Weight\n(kg)"); WEIGHT=createGraph(tr("Weight"),tr("Weight\n(kg)"));
BMI=createGraph("BMI","Body\nMass\nIndex"); BMI=createGraph(tr("BMI"),tr("Body\nMass\nIndex"));
ZOMBIE=createGraph("Zombie","How you felt\n(0-10)"); ZOMBIE=createGraph(tr("Zombie"),tr("How you felt\n(0-10)"));
ahihr=new SummaryChart("AHI/Hr",GT_LINE); ahihr=new SummaryChart(tr("AHI/Hr"),GT_LINE);
ahihr->addSlice(CPAP_AHI,QColor("blue"),ST_MAX,false); ahihr->addSlice(CPAP_AHI,QColor("blue"),ST_MAX,false);
ahihr->addSlice(CPAP_AHI,QColor("orange"),ST_WAVG,false); ahihr->addSlice(CPAP_AHI,QColor("orange"),ST_WAVG,false);
AHIHR->AddLayer(ahihr); AHIHR->AddLayer(ahihr);
weight=new SummaryChart("Weight",GT_LINE); weight=new SummaryChart(tr("Weight"),GT_LINE);
weight->setMachineType(MT_JOURNAL); weight->setMachineType(MT_JOURNAL);
weight->addSlice("Weight",QColor("black"),ST_SETAVG,true); weight->addSlice("Weight",QColor("black"),ST_SETAVG,true);
WEIGHT->AddLayer(weight); WEIGHT->AddLayer(weight);
bmi=new SummaryChart("BMI",GT_LINE); bmi=new SummaryChart(tr("BMI"),GT_LINE);
bmi->setMachineType(MT_JOURNAL); bmi->setMachineType(MT_JOURNAL);
bmi->addSlice("BMI",QColor("dark blue"),ST_SETAVG,true); bmi->addSlice("BMI",QColor("dark blue"),ST_SETAVG,true);
BMI->AddLayer(bmi); BMI->AddLayer(bmi);
zombie=new SummaryChart("Zombie Meter",GT_LINE); zombie=new SummaryChart(tr("Zombie Meter"),GT_LINE);
zombie->setMachineType(MT_JOURNAL); zombie->setMachineType(MT_JOURNAL);
zombie->addSlice("ZombieMeter",QColor("dark red"),ST_SETAVG,true); zombie->addSlice("ZombieMeter",QColor("dark red"),ST_SETAVG,true);
ZOMBIE->AddLayer(zombie); ZOMBIE->AddLayer(zombie);
pulse=new SummaryChart("Pulse Rate",GT_LINE); pulse=new SummaryChart(tr("Pulse Rate"),GT_LINE);
pulse->setMachineType(MT_OXIMETER); pulse->setMachineType(MT_OXIMETER);
pulse->addSlice(OXI_Pulse,QColor("red"),ST_WAVG,true); pulse->addSlice(OXI_Pulse,QColor("red"),ST_WAVG,true);
pulse->addSlice(OXI_Pulse,QColor("pink"),ST_MIN,true); pulse->addSlice(OXI_Pulse,QColor("pink"),ST_MIN,true);
pulse->addSlice(OXI_Pulse,QColor("orange"),ST_MAX,true); pulse->addSlice(OXI_Pulse,QColor("orange"),ST_MAX,true);
PULSE->AddLayer(pulse); PULSE->AddLayer(pulse);
spo2=new SummaryChart("SpO2",GT_LINE); spo2=new SummaryChart(tr("SpO2"),GT_LINE);
spo2->setMachineType(MT_OXIMETER); spo2->setMachineType(MT_OXIMETER);
spo2->addSlice(OXI_SPO2,QColor("cyan"),ST_WAVG,true); spo2->addSlice(OXI_SPO2,QColor("cyan"),ST_WAVG,true);
spo2->addSlice(OXI_SPO2,QColor("light blue"),ST_90P,true); spo2->addSlice(OXI_SPO2,QColor("light blue"),ST_90P,true);
spo2->addSlice(OXI_SPO2,QColor("blue"),ST_MIN,true); spo2->addSlice(OXI_SPO2,QColor("blue"),ST_MIN,true);
SPO2->AddLayer(spo2); SPO2->AddLayer(spo2);
uc=new SummaryChart("Hours",GT_BAR); uc=new SummaryChart(tr("Hours"),GT_BAR);
uc->addSlice("",QColor("green"),ST_HOURS,true); uc->addSlice("",QColor("green"),ST_HOURS,true);
UC->AddLayer(uc); UC->AddLayer(uc);
us=new SummaryChart("Hours",GT_SESSIONS); us=new SummaryChart(tr("Hours"),GT_SESSIONS);
us->addSlice("",QColor("dark blue"),ST_HOURS,true); us->addSlice("",QColor("dark blue"),ST_HOURS,true);
us->addSlice("",QColor("blue"),ST_SESSIONS,true); us->addSlice("",QColor("blue"),ST_SESSIONS,true);
US->AddLayer(us); US->AddLayer(us);
ses=new SummaryChart("Sessions",GT_LINE); ses=new SummaryChart(tr("Sessions"),GT_LINE);
ses->addSlice("",QColor("blue"),ST_SESSIONS,true); ses->addSlice("",QColor("blue"),ST_SESSIONS,true);
SES->AddLayer(ses); SES->AddLayer(ses);
bc=new SummaryChart("AHI",GT_BAR); bc=new SummaryChart(tr("AHI"),GT_BAR);
bc->addSlice(CPAP_Hypopnea,QColor("blue"),ST_CPH,false); bc->addSlice(CPAP_Hypopnea,QColor("blue"),ST_CPH,false);
bc->addSlice(CPAP_Apnea,QColor("dark green"),ST_CPH,false); bc->addSlice(CPAP_Apnea,QColor("dark green"),ST_CPH,false);
bc->addSlice(CPAP_Obstructive,QColor("#40c0ff"),ST_CPH,false); bc->addSlice(CPAP_Obstructive,QColor("#40c0ff"),ST_CPH,false);
@ -178,32 +178,32 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
SET->setRecMaxY(5); SET->setRecMaxY(5);
SET->AddLayer(set); SET->AddLayer(set);
rr=new SummaryChart("breaths/min",GT_LINE); rr=new SummaryChart(tr("breaths/min"),GT_LINE);
rr->addSlice(CPAP_RespRate,QColor("light blue"),ST_MIN,true); rr->addSlice(CPAP_RespRate,QColor("light blue"),ST_MIN,true);
rr->addSlice(CPAP_RespRate,QColor("light green"),ST_90P,true); rr->addSlice(CPAP_RespRate,QColor("light green"),ST_90P,true);
rr->addSlice(CPAP_RespRate,QColor("blue"),ST_WAVG,true); rr->addSlice(CPAP_RespRate,QColor("blue"),ST_WAVG,true);
RR->AddLayer(rr); RR->AddLayer(rr);
tv=new SummaryChart("L/b",GT_LINE); tv=new SummaryChart(tr("L/b"),GT_LINE);
tv->addSlice(CPAP_TidalVolume,QColor("light blue"),ST_MIN,true); tv->addSlice(CPAP_TidalVolume,QColor("light blue"),ST_MIN,true);
tv->addSlice(CPAP_TidalVolume,QColor("light green"),ST_90P,true); tv->addSlice(CPAP_TidalVolume,QColor("light green"),ST_90P,true);
tv->addSlice(CPAP_TidalVolume,QColor("blue"),ST_WAVG,true); tv->addSlice(CPAP_TidalVolume,QColor("blue"),ST_WAVG,true);
TV->AddLayer(tv); TV->AddLayer(tv);
mv=new SummaryChart("L/m",GT_LINE); mv=new SummaryChart(tr("L/m"),GT_LINE);
mv->addSlice(CPAP_MinuteVent,QColor("light blue"),ST_MIN,true); mv->addSlice(CPAP_MinuteVent,QColor("light blue"),ST_MIN,true);
mv->addSlice(CPAP_MinuteVent,QColor("light green"),ST_90P,true); mv->addSlice(CPAP_MinuteVent,QColor("light green"),ST_90P,true);
mv->addSlice(CPAP_MinuteVent,QColor("blue"),ST_WAVG,true); mv->addSlice(CPAP_MinuteVent,QColor("blue"),ST_WAVG,true);
MV->AddLayer(mv); MV->AddLayer(mv);
ptb=new SummaryChart("%PTB",GT_LINE); ptb=new SummaryChart(tr("%PTB"),GT_LINE);
ptb->addSlice(CPAP_PTB,QColor("yellow"),ST_MIN,true); ptb->addSlice(CPAP_PTB,QColor("yellow"),ST_MIN,true);
ptb->addSlice(CPAP_PTB,QColor("light gray"),ST_90P,true); ptb->addSlice(CPAP_PTB,QColor("light gray"),ST_90P,true);
ptb->addSlice(CPAP_PTB,QColor("orange"),ST_WAVG,true); ptb->addSlice(CPAP_PTB,QColor("orange"),ST_WAVG,true);
PTB->AddLayer(ptb); PTB->AddLayer(ptb);
pr=new SummaryChart("cmH2O",GT_LINE); pr=new SummaryChart(tr("cmH2O"),GT_LINE);
//PR->setRecMinY(4.0); //PR->setRecMinY(4.0);
//PR->setRecMaxY(12.0); //PR->setRecMaxY(12.0);
pr->addSlice(CPAP_Pressure,QColor("dark green"),ST_WAVG,true); pr->addSlice(CPAP_Pressure,QColor("dark green"),ST_WAVG,true);
@ -214,22 +214,22 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
pr->addSlice(CPAP_IPAP,QColor("light blue"),ST_MAX,true); pr->addSlice(CPAP_IPAP,QColor("light blue"),ST_MAX,true);
PR->AddLayer(pr); PR->AddLayer(pr);
lk=new SummaryChart("Avg Leak",GT_LINE); lk=new SummaryChart(tr("Avg Leak"),GT_LINE);
lk->addSlice(CPAP_Leak,QColor("dark grey"),ST_90P,false); lk->addSlice(CPAP_Leak,QColor("dark grey"),ST_90P,false);
lk->addSlice(CPAP_Leak,QColor("dark blue"),ST_WAVG,false); lk->addSlice(CPAP_Leak,QColor("dark blue"),ST_WAVG,false);
//lk->addSlice(CPAP_Leak,QColor("dark yellow")); //lk->addSlice(CPAP_Leak,QColor("dark yellow"));
//pr->addSlice(CPAP_IPAP,QColor("red")); //pr->addSlice(CPAP_IPAP,QColor("red"));
LK->AddLayer(lk); LK->AddLayer(lk);
NPB->AddLayer(npb=new SummaryChart("% PB",GT_BAR)); NPB->AddLayer(npb=new SummaryChart(tr("% PB"),GT_BAR));
npb->addSlice(CPAP_CSR,QColor("light green"),ST_SPH,false); npb->addSlice(CPAP_CSR,QColor("light green"),ST_SPH,false);
// <--- The code to the previous marker is crap // <--- The code to the previous marker is crap
GraphView->LoadSettings("Overview"); GraphView->LoadSettings("Overview"); //no trans
} }
Overview::~Overview() Overview::~Overview()
{ {
GraphView->SaveSettings("Overview"); GraphView->SaveSettings("Overview");//no trans
disconnect(this,SLOT(dateStart_currentPageChanged(int,int))); disconnect(this,SLOT(dateStart_currentPageChanged(int,int)));
disconnect(this,SLOT(dateEnd_currentPageChanged(int,int))); disconnect(this,SLOT(dateEnd_currentPageChanged(int,int)));
delete ui; delete ui;
@ -253,7 +253,7 @@ void Overview::ReloadGraphs()
GraphView->setDay(NULL); GraphView->setDay(NULL);
if (PROFILE.ExistsAndTrue("RebuildCache")) { if (PROFILE.ExistsAndTrue("RebuildCache")) {
PROFILE["RebuildCache"]=false; PROFILE["RebuildCache"]=false;
mainwin->Notify("Cache rebuild complete"); mainwin->Notify(tr("Cache rebuild complete"));
} }
} }
@ -338,7 +338,7 @@ void Overview::on_toolButton_clicked()
void Overview::on_printButton_clicked() void Overview::on_printButton_clicked()
{ {
mainwin->PrintReport(GraphView,"Overview"); mainwin->PrintReport(GraphView,tr("Overview")); // Must be translated the same as PrintReport checks.
} }
void Overview::ResetGraphLayout() void Overview::ResetGraphLayout()

View File

@ -20,6 +20,11 @@ namespace Ui {
} }
class Report; class Report;
/*! \class Overview
\author Mark Watkins <jedimark_at_users.sourceforge.net>
\brief Overview tab, showing overall summary data
*/
class Overview : public QWidget class Overview : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -28,19 +33,31 @@ public:
explicit Overview(QWidget *parent, gGraphView *shared=NULL); explicit Overview(QWidget *parent, gGraphView *shared=NULL);
~Overview(); ~Overview();
//! \brief Returns Overview gGraphView object containing it's graphs
gGraphView *graphView() { return GraphView; } gGraphView *graphView() { return GraphView; }
void ReloadGraphs();
void ResetGraphLayout();
void RedrawGraphs();
gGraph * createGraph(QString name,QString units="");
void PrintReport(); //! \brief Recalculates Overview chart info
void ReloadGraphs();
//! \brief Reset graphs to uniform heights
void ResetGraphLayout();
//! \brief Calls updateGL to redraw the overview charts
void RedrawGraphs();
/*! \brief Create an overview graph, adding it to the overview gGraphView object
\param QString name The title of the graph
\param QString units The units of measurements to show in the popup */
gGraph * createGraph(QString name,QString units="");
gGraph *AHI, *AHIHR, *UC, *US, *PR,*LK,*NPB,*SET,*SES,*RR,*MV,*TV,*PTB,*PULSE,*SPO2,*WEIGHT,*ZOMBIE, *BMI; gGraph *AHI, *AHIHR, *UC, *US, *PR,*LK,*NPB,*SET,*SES,*RR,*MV,*TV,*PTB,*PULSE,*SPO2,*WEIGHT,*ZOMBIE, *BMI;
SummaryChart *bc,*uc, *us, *pr,*lk,*npb,*set,*ses,*rr,*mv,*tv,*ptb,*pulse,*spo2,*weight,*zombie, *bmi, *ahihr; SummaryChart *bc,*uc, *us, *pr,*lk,*npb,*set,*ses,*rr,*mv,*tv,*ptb,*pulse,*spo2,*weight,*zombie, *bmi, *ahihr;
//! \breif List of SummaryCharts shown on the overview page
QVector<SummaryChart *> OverviewCharts; QVector<SummaryChart *> OverviewCharts;
public slots: public slots:
//! \brief Print button down the bottom, does the same as File->Print
void on_printButton_clicked(); void on_printButton_clicked();
private slots: private slots:
@ -52,12 +69,19 @@ private slots:
void on_rbEverything_clicked(); void on_rbEverything_clicked();
void on_rbDateRange_clicked(); */ void on_rbDateRange_clicked(); */
//! \brief Resets the graph view because the Start date has been changed
void on_dateStart_dateChanged(const QDate &date); void on_dateStart_dateChanged(const QDate &date);
//! \brief Resets the graph view because the End date has been changed
void on_dateEnd_dateChanged(const QDate &date); void on_dateEnd_dateChanged(const QDate &date);
//! \brief Updates the calendar highlighting when changing to a new month
void dateStart_currentPageChanged(int year, int month); void dateStart_currentPageChanged(int year, int month);
//! \brief Updates the calendar highlighting when changing to a new month
void dateEnd_currentPageChanged(int year, int month); void dateEnd_currentPageChanged(int year, int month);
//! \brief Resets view to currently shown start & end dates
void on_toolButton_clicked(); void on_toolButton_clicked();
private: private:
@ -67,7 +91,7 @@ private:
QHBoxLayout *layout; QHBoxLayout *layout;
gGraphView * m_shared; gGraphView * m_shared;
void UpdateHTML(); //! \brief Updates the calendar highlighting for the calendar object for this date.
void UpdateCalendarDay(QDateEdit * calendar,QDate date); void UpdateCalendarDay(QDateEdit * calendar,QDate date);

View File

@ -851,7 +851,7 @@ Oximetry::Oximetry(QWidget *parent,gGraphView * shared) :
lo2->SetDay(day); lo2->SetDay(day);
//go->SetDay(day); //go->SetDay(day);
GraphView->setEmptyText("No Oximetry Data"); GraphView->setEmptyText(tr("No Oximetry Data"));
GraphView->updateGL(); GraphView->updateGL();
on_RefreshPortsButton_clicked(); on_RefreshPortsButton_clicked();
@ -947,7 +947,7 @@ void Oximetry::on_SerialPortsCombo_activated(const QString &arg1)
void Oximetry::live_stopped(Session * session) void Oximetry::live_stopped(Session * session)
{ {
Q_UNUSED(session); Q_UNUSED(session);
mainwin->Notify("Oximetry live recording has been terminated due to timeout"); mainwin->Notify(tr("Oximetry live recording has been terminated due to timeout."));
//qDebug () << "Live Stopped"; //qDebug () << "Live Stopped";
on_RunButton_toggled(false); on_RunButton_toggled(false);
} }
@ -956,7 +956,7 @@ void Oximetry::on_RunButton_toggled(bool checked)
{ {
if (!checked) { if (!checked) {
oximeter->stopLive(); oximeter->stopLive();
ui->RunButton->setText("&Start"); ui->RunButton->setText(tr("&Start"));
ui->SerialPortsCombo->setEnabled(true); ui->SerialPortsCombo->setEnabled(true);
disconnect(oximeter,SIGNAL(dataChanged()),this,SLOT(data_changed())); disconnect(oximeter,SIGNAL(dataChanged()),this,SLOT(data_changed()));
disconnect(oximeter,SIGNAL(updatePulse(float)),this,SLOT(pulse_changed(float))); disconnect(oximeter,SIGNAL(updatePulse(float)),this,SLOT(pulse_changed(float)));
@ -974,7 +974,7 @@ void Oximetry::on_RunButton_toggled(bool checked)
//CONTROL->setVisible(true); //CONTROL->setVisible(true);
} else { } else {
if (oximeter->getSession() && oximeter->getSession()->IsChanged()) { if (oximeter->getSession() && oximeter->getSession()->IsChanged()) {
int res=QMessageBox::question(this,"Save Session?","Creating a new oximetry session will destroy the old one.\nWould you like to save it first?","Save","Destroy It","Cancel",0,2); int res=QMessageBox::question(this,tr("Save Session?"),tr("Creating a new oximetry session will destroy the old one.\nWould you like to save it first?"),tr("Save"),tr("Destroy It"),tr("Cancel"),0,2);
if (res==0) { if (res==0) {
ui->RunButton->setChecked(false); ui->RunButton->setChecked(false);
on_saveButton_clicked(); on_saveButton_clicked();
@ -984,7 +984,7 @@ void Oximetry::on_RunButton_toggled(bool checked)
return; return;
} }
} // else it's already saved. } // else it's already saved.
GraphView->setEmptyText("Please Wait"); GraphView->setEmptyText(tr("Please Wait"));
GraphView->updateGL(); GraphView->updateGL();
PLETHY->setRecMinY(0); PLETHY->setRecMinY(0);
@ -997,7 +997,7 @@ void Oximetry::on_RunButton_toggled(bool checked)
day->getSessions().clear(); day->getSessions().clear();
//QTimer::singleShot(10000,this,SLOT(oximeter_running_check())); //QTimer::singleShot(10000,this,SLOT(oximeter_running_check()));
if (!oximeter->startLive()) { if (!oximeter->startLive()) {
mainwin->Notify("Oximetry Error!\n\nSomething is wrong with the device connection."); mainwin->Notify(tr("Oximetry Error!\n\nSomething is wrong with the device connection."));
return; return;
} }
ui->saveButton->setEnabled(false); ui->saveButton->setEnabled(false);
@ -1033,7 +1033,7 @@ void Oximetry::on_RunButton_toggled(bool checked)
CONTROL->setVisible(false); CONTROL->setVisible(false);
// connect. // connect.
ui->RunButton->setText("&Stop"); ui->RunButton->setText(tr("&Stop"));
ui->SerialPortsCombo->setEnabled(false); ui->SerialPortsCombo->setEnabled(false);
ui->ImportButton->setEnabled(false); ui->ImportButton->setEnabled(false);
} }
@ -1088,7 +1088,7 @@ void Oximetry::data_changed()
int h=len/3600; int h=len/3600;
int m=(len /60) % 60; int m=(len /60) % 60;
int s=(len % 60); int s=(len % 60);
if (qstatus2) qstatus2->setText(QString().sprintf("Rec %02i:%02i:%02i",h,m,s)); if (qstatus2) qstatus2->setText(QString().sprintf("Rec %02i:%02i:%02i",h,m,s)); // translation fix?
} }
GraphView->updateScale(); GraphView->updateScale();
@ -1113,24 +1113,24 @@ void Oximetry::oximeter_running_check()
if (!oximeter->isOpen()) { if (!oximeter->isOpen()) {
if (oximeter->callbacks()==0) { if (oximeter->callbacks()==0) {
qDebug() << "Not sure how oximeter_running_check gets called with a closed oximeter.. Restarting import process"; qDebug() << "Not sure how oximeter_running_check gets called with a closed oximeter.. Restarting import process";
//mainwin->Notify("Oximeter Error\n\nThe device has not responded.. Make sure it's switched on2"); //mainwin->Notify(tr("Oximeter Error\n\nThe device has not responded.. Make sure it's switched on2"));
on_ImportButton_clicked(); on_ImportButton_clicked();
return; return;
} }
} }
if (oximeter->callbacks()==0) { if (oximeter->callbacks()==0) {
mainwin->Notify("Oximeter Error\n\nThe device has not responded.. Make sure it's switched on."); mainwin->Notify(tr("Oximeter Error\n\nThe device has not responded.. Make sure it's switched on."));
if (oximeter->mode()==SO_IMPORT) oximeter->stopImport(); if (oximeter->mode()==SO_IMPORT) oximeter->stopImport();
if (oximeter->mode()==SO_LIVE) oximeter->stopLive(); if (oximeter->mode()==SO_LIVE) oximeter->stopLive();
oximeter->destroySession(); oximeter->destroySession();
day->getSessions().clear(); day->getSessions().clear();
ui->SerialPortsCombo->setEnabled(true); ui->SerialPortsCombo->setEnabled(true);
qstatus->setText("Ready"); qstatus->setText(tr("Ready"));
ui->ImportButton->setEnabled(true); ui->ImportButton->setEnabled(true);
ui->RunButton->setChecked(false); ui->RunButton->setChecked(false);
ui->saveButton->setEnabled(false); ui->saveButton->setEnabled(false);
GraphView->setEmptyText("Check Oximeter is Ready"); GraphView->setEmptyText(tr("Check Oximeter is Ready"));
GraphView->updateGL(); GraphView->updateGL();
} }
@ -1144,7 +1144,7 @@ void Oximetry::on_ImportButton_clicked()
connect(oximeter,SIGNAL(updateProgress(float)),this,SLOT(update_progress(float))); connect(oximeter,SIGNAL(updateProgress(float)),this,SLOT(update_progress(float)));
if (!oximeter->startImport()) { if (!oximeter->startImport()) {
mainwin->Notify("Oximeter Error\n\nThe device did not respond.. Make sure it's switched on."); mainwin->Notify(tr("Oximeter Error\n\nThe device did not respond.. Make sure it's switched on."));
disconnect(oximeter,SIGNAL(importComplete(Session*)),this,SLOT(import_complete(Session*))); disconnect(oximeter,SIGNAL(importComplete(Session*)),this,SLOT(import_complete(Session*)));
disconnect(oximeter,SIGNAL(importAborted()),this,SLOT(import_aborted())); disconnect(oximeter,SIGNAL(importAborted()),this,SLOT(import_aborted()));
disconnect(oximeter,SIGNAL(updateProgress(float)),this,SLOT(update_progress(float))); disconnect(oximeter,SIGNAL(updateProgress(float)),this,SLOT(update_progress(float)));
@ -1163,7 +1163,7 @@ void Oximetry::on_ImportButton_clicked()
} }
ui->ImportButton->setDisabled(true); ui->ImportButton->setDisabled(true);
ui->SerialPortsCombo->setEnabled(false); ui->SerialPortsCombo->setEnabled(false);
ui->RunButton->setText("&Start"); ui->RunButton->setText(tr("&Start"));
ui->RunButton->setChecked(false); ui->RunButton->setChecked(false);
} }
@ -1174,7 +1174,7 @@ void Oximetry::import_finished()
disconnect(oximeter,SIGNAL(updateProgress(float)),this,SLOT(update_progress(float))); disconnect(oximeter,SIGNAL(updateProgress(float)),this,SLOT(update_progress(float)));
ui->SerialPortsCombo->setEnabled(true); ui->SerialPortsCombo->setEnabled(true);
qstatus->setText("Ready"); qstatus->setText(tr("Ready"));
ui->ImportButton->setDisabled(false); ui->ImportButton->setDisabled(false);
ui->saveButton->setEnabled(true); ui->saveButton->setEnabled(true);
@ -1188,8 +1188,8 @@ void Oximetry::import_aborted()
{ {
oximeter->disconnect(oximeter,SIGNAL(importProcess()),0,0); oximeter->disconnect(oximeter,SIGNAL(importProcess()),0,0);
day->getSessions().clear(); day->getSessions().clear();
//QMessageBox::warning(mainwin,"Oximeter Error","Please make sure your oximeter is switched on, and able to transmit data.\n(You may need to enter the oximeters Settings screen for it to be able to transmit.)",QMessageBox::Ok); //QMessageBox::warning(mainwin,tr("Oximeter Error"),tr("Please make sure your oximeter is switched on, and able to transmit data.\n(You may need to enter the oximeters Settings screen for it to be able to transmit.)"),QMessageBox::Ok);
mainwin->Notify("Oximeter Error!\n\nPlease make sure your oximeter is switched on, and in the right mode to transmit data."); mainwin->Notify(tr("Please make sure your oximeter is switched on, and in the right mode to transmit data."),tr("Oximeter Error!"),5000);
//qDebug() << "Oximetry import failed"; //qDebug() << "Oximetry import failed";
import_finished(); import_finished();

View File

@ -20,7 +20,13 @@
#include "Graphs/gLineChart.h" #include "Graphs/gLineChart.h"
#include "Graphs/gFooBar.h" #include "Graphs/gFooBar.h"
//! \brief Oximeters current mode
enum SerialOxMode { SO_OFF, SO_IMPORT, SO_LIVE, SO_WAIT }; enum SerialOxMode { SO_OFF, SO_IMPORT, SO_LIVE, SO_WAIT };
/*! \class SerialOximeter
\author Mark Watkins <jedimark_at_users.sourceforge.net>
\brief Base class for Serial Oximeters
*/
class SerialOximeter:public QObject class SerialOximeter:public QObject
{ {
Q_OBJECT Q_OBJECT
@ -29,49 +35,100 @@ public:
virtual ~SerialOximeter(); virtual ~SerialOximeter();
virtual void setSession(Session * sess) { session=sess; } virtual void setSession(Session * sess) { session=sess; }
//! \brief Open the serial port in either EventDriven or Polling mode
virtual bool Open(QextSerialPort::QueryMode mode=QextSerialPort::EventDriven); virtual bool Open(QextSerialPort::QueryMode mode=QextSerialPort::EventDriven);
//! \brief Close the serial port
virtual void Close(); virtual void Close();
//! \brief Virtual method for Importing the Oximeters internal recording.
virtual bool startImport()=0; virtual bool startImport()=0;
//! \brief Virtual method to Abort importing the Oximeters internal recording.
virtual void stopImport() {} // abort, default do nothing. virtual void stopImport() {} // abort, default do nothing.
//! \brief Start Serial "Live" Recording
virtual bool startLive(); virtual bool startLive();
//! \brief Stop Serial "Live" Recording
virtual void stopLive(); virtual void stopLive();
//! \brief Put the device in standard transmit mode
virtual void resetDevice()=0; virtual void resetDevice()=0;
//! \brief Put the device in record request mode
virtual void requestData()=0; virtual void requestData()=0;
//! \brief Return the current SerialOxMode, either SO_OFF, SO_IMPORT, SO_LIVE, SO_WAIT
SerialOxMode mode() { return m_mode; } SerialOxMode mode() { return m_mode; }
//! \brief Trash the session object
void destroySession() { delete session; session=NULL; } void destroySession() { delete session; session=NULL; }
//! \brief Returns true if the serial port is currently open
bool isOpen() { return m_opened; } bool isOpen() { return m_opened; }
//! \brief Returns a count of callbacks, so a Timer can see the ports alive or dead.
int callbacks() { return m_callbacks; } int callbacks() { return m_callbacks; }
//! \brief Returns the time of the last callback in milliseconds since epoch
qint64 lastTime() { return lasttime; } qint64 lastTime() { return lasttime; }
//! \brief Sets the time of the last callback in milliseconds since epoch
void setLastTime(qint64 t) { lasttime=t; } void setLastTime(qint64 t) { lasttime=t; }
//! \brief Return the current machine object
Machine * getMachine() { return machine; } Machine * getMachine() { return machine; }
//! \brief Create a new Session object for the specified date
Session *createSession(QDateTime date=QDateTime::currentDateTime()); Session *createSession(QDateTime date=QDateTime::currentDateTime());
//! \brief Returns the current session
Session * getSession() { return session; } Session * getSession() { return session; }
//! \brief Removes the TimeCodes, converting the EventList to Waveform type
void compactToWaveform(EventList *el); void compactToWaveform(EventList *el);
//! \brief Packs EventList to time delta format, also pruning zeros.
void compactToEvent(EventList *el); void compactToEvent(EventList *el);
//! \brief Packs SPO2 & Pulse to Events, and Plethy to Waveform EventList types.
void compactAll(); void compactAll();
//! \brief Sets the serial port device name
void setPortName(QString portname); void setPortName(QString portname);
//! \brief Sets the serial ports Baud Rate (eg. BAUD19200, BAUD115200)
void setBaudRate(BaudRateType baud); void setBaudRate(BaudRateType baud);
//! \brief Sets the serial ports Flow control to one of FLOW_OFF, FLOW_HARDWARE, or FLOW_XONXOFF
void setFlowControl(FlowType flow); void setFlowControl(FlowType flow);
//! \brief Sets the serial ports Parity to one of PAR_NONE, PAR_ODD, PAR_EVEN, PAR_MARK (WINDOWS ONLY), PAR_SPACE
void setParity(ParityType parity); void setParity(ParityType parity);
//! \brief Sets the serial ports Data Bits to either DATA_5, DATA_6, DATA_7, or DATA_8
void setDataBits(DataBitsType databits); void setDataBits(DataBitsType databits);
//! \brief Sets the serial ports Stop Bits to either STOP_1, STOP_1_5 (WINDOWS ONLY) or STOP_2
void setStopBits(StopBitsType stopbits); void setStopBits(StopBitsType stopbits);
//! \brief Returns the serial port device name
QString portName() { return m_portname; } QString portName() { return m_portname; }
//! \brief Returns the serial ports baud rate
BaudRateType baudRate() { return m_baud; } BaudRateType baudRate() { return m_baud; }
//! \brief Returns the serial ports flow control setting
FlowType flowControl() { return m_flow; } FlowType flowControl() { return m_flow; }
//! \brief Returns the serial ports parity setting
ParityType parity() { return m_parity; } ParityType parity() { return m_parity; }
//! \brief Returns the serial ports data bits setting
DataBitsType dataBits() { return m_databits; } DataBitsType dataBits() { return m_databits; }
//! \brief Returns the serial ports stop bits setting
StopBitsType stopBits() { return m_stopbits; } StopBitsType stopBits() { return m_stopbits; }
EventList * Pulse() { return pulse; } EventList * Pulse() { return pulse; }
EventList * Spo2() { return spo2; } EventList * Spo2() { return spo2; }
EventList * Plethy() { return plethy; } EventList * Plethy() { return plethy; }
@ -82,30 +139,52 @@ public:
signals: signals:
void sessionCreated(Session *); void sessionCreated(Session *);
void dataChanged(); void dataChanged();
//! \brief This signal is called after import completion, to parse the event data.
void importProcess(); void importProcess();
//! \brief importProcess emits this signal after completion.
void importComplete(Session *); void importComplete(Session *);
//! \brief emitted when something goes wrong during import
void importAborted(); void importAborted();
//! \brief emitted to allow for UI updates to the progress bar
void updateProgress(float f); // between 0 and 1. void updateProgress(float f); // between 0 and 1.
//! \brief emitted when live mode stops recording, passing the current Session
void liveStopped(Session *); void liveStopped(Session *);
void updatePulse(float p); void updatePulse(float p);
void updateSpO2(float p); void updateSpO2(float p);
protected slots: protected slots:
//! \brief Override this to process the serial import as it's received
virtual void ReadyRead()=0; virtual void ReadyRead()=0;
//! \brief Override this to parse the read import data
virtual void import_process()=0; virtual void import_process()=0;
//! \brief This slot gets called when the serial port Times out
virtual void Timeout(); virtual void Timeout();
//! \brief Override this to start the Import Timeout
virtual void startImportTimeout()=0; virtual void startImportTimeout()=0;
protected: protected:
//virtual void addEvents(EventDataType pr, EventDataType o2, EventDataType pleth=-1000000); //virtual void addEvents(EventDataType pr, EventDataType o2, EventDataType pleth=-1000000);
//! \brief Pointer to current session object
Session * session; Session * session;
EventList * pulse; EventList * pulse;
EventList * spo2; EventList * spo2;
EventList * plethy; EventList * plethy;
//! \brief Holds the serial port object
QextSerialPort *m_port; QextSerialPort *m_port;
SerialOxMode m_mode; SerialOxMode m_mode;
bool m_opened; bool m_opened;
QString m_oxiname; QString m_oxiname;
@ -128,19 +207,33 @@ protected:
}; };
/*! \class CMS50Serial
\author Mark Watkins <jedimark_at_users.sourceforge.net>
\brief Serial Import & Live module
*/
class CMS50Serial:public SerialOximeter class CMS50Serial:public SerialOximeter
{ {
public: public:
explicit CMS50Serial(QObject * parent,QString portname); explicit CMS50Serial(QObject * parent,QString portname);
virtual ~CMS50Serial(); virtual ~CMS50Serial();
//! \brief Start the serial parts of Import mode.
virtual bool startImport(); virtual bool startImport();
//! \brief Sends the 0xf6,0xf6,0xf6 data string to the serial port to start live mode again
virtual void resetDevice(); virtual void resetDevice();
//! \brief Sends the 0xf5, 0xf5 data string to request devices serial recording
virtual void requestData(); virtual void requestData();
protected: protected:
//! \brief CMS50 Time-out detection
virtual void startImportTimeout(); virtual void startImportTimeout();
//! \brief Called on completion of data import, to convert bytearray into event data
virtual void import_process(); virtual void import_process();
//! \brief Serial callback to process live view & store import data
virtual void ReadyRead(); virtual void ReadyRead();
bool waitf6; bool waitf6;
short cntf6; short cntf6;
@ -161,6 +254,10 @@ namespace Ui {
enum PORTMODE { PM_LIVE, PM_RECORDING }; enum PORTMODE { PM_LIVE, PM_RECORDING };
const int max_data_points=1000000; const int max_data_points=1000000;
/*! \class Oximetry
\author Mark Watkins <jedimark_at_users.sourceforge.net>
\brief Oximetry view for working with Pulse Oximetry data and devices
*/
class Oximetry : public QWidget class Oximetry : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -169,40 +266,74 @@ public:
explicit Oximetry(QWidget *parent, gGraphView * shared=NULL); explicit Oximetry(QWidget *parent, gGraphView * shared=NULL);
~Oximetry(); ~Oximetry();
//! \brief Calls updateGL to redraw the graphs
void RedrawGraphs(); void RedrawGraphs();
//! \brief Returns the gGraphView object containing Oximetry graphs
gGraphView *graphView() { return GraphView; } gGraphView *graphView() { return GraphView; }
//! \brief Loads and displays a session containing oximetry data into into the Oximetry module
void openSession(Session * session); void openSession(Session * session);
private slots: private slots:
//! \brief Scans the list of serial ports and detects any oximetry devices
void on_RefreshPortsButton_clicked(); void on_RefreshPortsButton_clicked();
//! \brief Start or Stop live view mode
void on_RunButton_toggled(bool checked); // Live mode button void on_RunButton_toggled(bool checked); // Live mode button
//! \brief This slot gets called when a new serial port is selected from the drop down
void on_SerialPortsCombo_activated(const QString &arg1); void on_SerialPortsCombo_activated(const QString &arg1);
//! \brief Start the Serial import process from the devices internal recordings
void on_ImportButton_clicked(); void on_ImportButton_clicked();
//! \brief Asks to save oximetry session into SleepLib database
void on_saveButton_clicked(); void on_saveButton_clicked();
//! \brief Data has been changed, so it sets all the bits for live graph display
void data_changed(); void data_changed();
//! \brief Updates the Pulse Rate LCD widget when the live pulse changes
void pulse_changed(float p); void pulse_changed(float p);
//! \brief Updates the SpO2 LCD widget when the live spO2 changes
void spo2_changed(float o2); void spo2_changed(float o2);
//! \brief Updates the progress bar during import
void update_progress(float f); void update_progress(float f);
//! \brief Import failed, so cleanup.
void import_aborted(); void import_aborted();
//! \brief Import completed, so get ready to display graphs
void import_complete(Session *session); void import_complete(Session *session);
//! \brief Callback to make sure the oximeter is running
void oximeter_running_check(); void oximeter_running_check();
//! \brief Callback after liveView mode is stopped
void live_stopped(Session *session); void live_stopped(Session *session);
//! \brief Open button was clicked, so select and load .spo/.spoR data files
void on_openButton_clicked(); void on_openButton_clicked();
//! \brief The datetime editor changed, so move the session data accordingly.
void on_dateEdit_dateTimeChanged(const QDateTime &date); void on_dateEdit_dateTimeChanged(const QDateTime &date);
//! \brief Reset the datetime to what was set when first loaded
void on_resetTimeButton_clicked(); void on_resetTimeButton_clicked();
private: private:
//! \brief Imports a .spo file
bool openSPOFile(QString filename); bool openSPOFile(QString filename);
//! \brief Imports a .spoR file (from SPO2Review software in windows)
bool openSPORFile(QString filename); bool openSPORFile(QString filename);
//! \brief Clean up after import process, whether successful or not
void import_finished(); void import_finished();
//! \brief update the graphs to show the session information
void updateGraphs(); void updateGraphs();
Ui::Oximetry *ui; Ui::Oximetry *ui;
@ -214,6 +345,7 @@ private:
Layer *lo1,*lo2; Layer *lo1,*lo2;
gGraph *PULSE,*SPO2,*PLETHY,*CONTROL; gGraph *PULSE,*SPO2,*PLETHY,*CONTROL;
//! \brief Contains a list of gLineCharts that display Pulse, Plethy & SPO2 data
QVector<gLineChart *> Data; QVector<gLineChart *> Data;
QextSerialPort *port; QextSerialPort *port;

View File

@ -22,11 +22,11 @@ extern QFont * bigfont;
extern MainWindow * mainwin; extern MainWindow * mainwin;
MaskProfile masks[]={ MaskProfile masks[]={
{"Unspecified",{{4,25},{8,25},{12,25},{16,25},{20,25}}}, {QObject::tr("Unspecified"),{{4,25},{8,25},{12,25},{16,25},{20,25}}},
{"Nasal Pillows",{{4,20},{8,29},{12,37},{16,43},{20,49}}}, {QObject::tr("Nasal Pillows"),{{4,20},{8,29},{12,37},{16,43},{20,49}}},
{"Hybrid F/F Mask",{{4,20},{8,29},{12,37},{16,43},{20,49}}}, {QObject::tr("Hybrid F/F Mask"),{{4,20},{8,29},{12,37},{16,43},{20,49}}},
{"Nasal Interface",{{4,20},{8,29},{12,37},{16,43},{20,49}}}, {QObject::tr("Nasal Interface"),{{4,20},{8,29},{12,37},{16,43},{20,49}}},
{"Full-Face Mask",{{4,20},{8,29},{12,37},{16,43},{20,49}}}, {QObject::tr("Full-Face Mask"),{{4,20},{8,29},{12,37},{16,43},{20,49}}},
}; };
const int num_masks=sizeof(masks)/sizeof(MaskProfile); const int num_masks=sizeof(masks)/sizeof(MaskProfile);
@ -46,7 +46,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent,Profile * _profile) :
ui->ahiGraphGroupbox->setEnabled(false); ui->ahiGraphGroupbox->setEnabled(false);
ui->customEventGroupbox->setEnabled(false); ui->customEventGroupbox->setEnabled(false);
QString masktype="Nasal Pillows"; QString masktype=tr("Nasal Pillows");
//masktype=PROFILE["MaskType"].toString(); //masktype=PROFILE["MaskType"].toString();
for (int i=0;i<num_masks;i++) { for (int i=0;i<num_masks;i++) {
ui->maskTypeCombo->addItem(masks[i].name); ui->maskTypeCombo->addItem(masks[i].name);
@ -161,16 +161,16 @@ PreferencesDialog::PreferencesDialog(QWidget *parent,Profile * _profile) :
//ui->skipEmptyDays->setChecked((*profile)["SkipEmptyDays"].toBool()); //ui->skipEmptyDays->setChecked((*profile)["SkipEmptyDays"].toBool());
general.clear(); general.clear();
general["UseAntiAliasing"]=Preference(p_profile,"UseAntiAliasing",PT_Checkbox,"Use Anti-Aliasing","Enable Graphical smoothing. Doesn't always look pretty.",false); general["UseAntiAliasing"]=Preference(p_profile,"UseAntiAliasing",PT_Checkbox,tr("Use Anti-Aliasing"),tr("Enable Graphical smoothing. Doesn't always look pretty."),false);
general["SquareWavePlots"]=Preference(p_profile,"SquareWavePlots",PT_Checkbox,"Square Wave Plots","Try to use Square Wave plots where possible",true); general["SquareWavePlots"]=Preference(p_profile,"SquareWavePlots",PT_Checkbox,tr("Square Wave Plots"),tr("Try to use Square Wave plots where possible"),true);
general["EnableGraphSnapshots"]=Preference(p_profile,"EnableGraphSnapshots",PT_Checkbox,"Event Breakdown Piechart","Shows Event Breakdown in Daily view. This may cause problems on older computers.",true); general["EnableGraphSnapshots"]=Preference(p_profile,"EnableGraphSnapshots",PT_Checkbox,tr("Event Breakdown Piechart"),tr("Shows Event Breakdown in Daily view. This may cause problems on older computers."),true);
general["SkipLoginScreen"]=Preference(p_pref,"SkipLoginScreen",PT_Checkbox,"Skip Login Screen","Bypass the login screen at startup",false); general["SkipLoginScreen"]=Preference(p_pref,"SkipLoginScreen",PT_Checkbox,tr("Skip Login Screen"),tr("Bypass the login screen at startup"),false);
general["SkipEmptyDays"]=Preference(p_profile,"SkipEmptyDays",PT_Checkbox,"Skip Empty Days","Skip over calendar days that don't have any data",true); general["SkipEmptyDays"]=Preference(p_profile,"SkipEmptyDays",PT_Checkbox,tr("Skip Empty Days"),tr("Skip over calendar days that don't have any data"),true);
general["EnableMultithreading"]=Preference(p_profile,"EnableMultithreading",PT_Checkbox,"Enable Multithreading","Try to use extra processor cores where possible",false); general["EnableMultithreading"]=Preference(p_profile,"EnableMultithreading",PT_Checkbox,tr("Enable Multithreading"),tr("Try to use extra processor cores where possible"),false);
general["MemoryHog"]=Preference(p_profile,"MemoryHog",PT_Checkbox,"Cache Session Data","Keep session data in memory to improve load speed revisiting the date.",false); general["MemoryHog"]=Preference(p_profile,"MemoryHog",PT_Checkbox,tr("Cache Session Data"),tr("Keep session data in memory to improve load speed revisiting the date."),false);
general["GraphHeight"]=Preference(p_profile,"GraphHeight",PT_Checkbox,"Graph Height","Default Graph Height",160); general["GraphHeight"]=Preference(p_profile,"GraphHeight",PT_Checkbox,tr("Graph Height"),tr("Default Graph Height"),160);
general["MaskDescription"]=Preference(p_profile,"MaskDescription",PT_Checkbox,"Mask Description","Whatever you want to record about your mask.",QString()); general["MaskDescription"]=Preference(p_profile,"MaskDescription",PT_Checkbox,tr("Mask Description"),tr("Whatever you want to record about your mask."),QString());
general["HighResPrinting"]=Preference(p_profile,"HighResPrinting",PT_Checkbox,"High Resolution Printing","Use much slower but better quality high resolution printing.",QString()); general["HighResPrinting"]=Preference(p_profile,"HighResPrinting",PT_Checkbox,tr("High Resolution Printing"),tr("Use much slower but better quality high resolution printing."),QString());
if (!(p_profile)->Exists("MaskStartDate")) { if (!(p_profile)->Exists("MaskStartDate")) {
(PROFILE["MaskStartDate"]=PROFILE.FirstDay()); (PROFILE["MaskStartDate"]=PROFILE.FirstDay());
@ -455,7 +455,7 @@ void PreferencesDialog::Save()
//PREF.Save(); //PREF.Save();
if (needs_restart) { if (needs_restart) {
if (QMessageBox::question(this,"Restart Required","One or more of the changes you have made will require this application to be restarted, in order for these changes to come into effect.\nWould you like do this now?",QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) { if (QMessageBox::question(this,tr("Restart Required"),tr("One or more of the changes you have made will require this application to be restarted, in order for these changes to come into effect.\nWould you like do this now?"),QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) {
mainwin->RestartApplication(); mainwin->RestartApplication();
} }
} }
@ -484,14 +484,14 @@ void PreferencesDialog::RefreshLastChecked()
void PreferencesDialog::on_checkForUpdatesButton_clicked() void PreferencesDialog::on_checkForUpdatesButton_clicked()
{ {
mainwin->statusBar()->showMessage("Checking for Updates"); //mainwin->statusBar()->showMessage("Checking for Updates");
ui->updateLastChecked->setText("Checking for Updates"); //ui->updateLastChecked->setText("Checking for Updates");
mainwin->CheckForUpdates(); mainwin->CheckForUpdates();
} }
void PreferencesDialog::on_addImportLocation_clicked() void PreferencesDialog::on_addImportLocation_clicked()
{ {
QString dir=QFileDialog::getExistingDirectory(this,"Add this Location to the Import List","",QFileDialog::ShowDirsOnly); QString dir=QFileDialog::getExistingDirectory(this,tr("Add this Location to the Import List"),"",QFileDialog::ShowDirsOnly);
if (!dir.isEmpty()) { if (!dir.isEmpty()) {
if (!importLocations.contains(dir)) { if (!importLocations.contains(dir)) {
@ -609,8 +609,8 @@ void PreferencesDialog::resetGraphModel()
{ {
graphModel->clear(); graphModel->clear();
QStandardItem *daily=new QStandardItem("Daily Graphs"); QStandardItem *daily=new QStandardItem(tr("Daily Graphs"));
QStandardItem *overview=new QStandardItem("Overview Graphs"); QStandardItem *overview=new QStandardItem(tr("Overview Graphs"));
daily->setEditable(false); daily->setEditable(false);
overview->setEditable(false); overview->setEditable(false);
@ -622,9 +622,9 @@ void PreferencesDialog::resetGraphModel()
// ui->graphView->setFirstColumnSpanned(0,daily->index(),true); // Crashes on windows.. Why do I need this again? // ui->graphView->setFirstColumnSpanned(0,daily->index(),true); // Crashes on windows.. Why do I need this again?
graphModel->setColumnCount(3); graphModel->setColumnCount(3);
QStringList headers; QStringList headers;
headers.append("Graph"); headers.append(tr("Graph"));
headers.append("Min"); headers.append(tr("Min"));
headers.append("Max"); headers.append(tr("Max"));
graphModel->setHorizontalHeaderLabels(headers); graphModel->setHorizontalHeaderLabels(headers);
ui->graphView->setColumnWidth(0,250); ui->graphView->setColumnWidth(0,250);
ui->graphView->setColumnWidth(1,50); ui->graphView->setColumnWidth(1,50);
@ -642,7 +642,7 @@ void PreferencesDialog::resetGraphModel()
it->setData(i,Qt::UserRole+2); it->setData(i,Qt::UserRole+2);
items.push_back(it); items.push_back(it);
if (title!="Event Flags") { if (title!=tr("Event Flags")) { // ouchie.. Translations will cause problems here..
it=new QStandardItem(QString::number((*gv)[i]->rec_miny,'f',1)); it=new QStandardItem(QString::number((*gv)[i]->rec_miny,'f',1));
it->setEditable(true); it->setEditable(true);
@ -683,7 +683,7 @@ void PreferencesDialog::resetGraphModel()
overview->insertRow(i,items); overview->insertRow(i,items);
} }
if (mainwin->getOximetry()) { if (mainwin->getOximetry()) {
QStandardItem *oximetry=new QStandardItem("Oximetry Graphs"); QStandardItem *oximetry=new QStandardItem(tr("Oximetry Graphs"));
graphModel->appendRow(oximetry); graphModel->appendRow(oximetry);
oximetry->setEditable(false); oximetry->setEditable(false);
gv=mainwin->getOximetry()->graphView(); gv=mainwin->getOximetry()->graphView();
@ -715,7 +715,7 @@ void PreferencesDialog::resetGraphModel()
void PreferencesDialog::on_resetGraphButton_clicked() void PreferencesDialog::on_resetGraphButton_clicked()
{ {
if (QMessageBox::question(this,"Confirmation","Are you sure you want to reset your graph preferences to the defaults?",QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) { if (QMessageBox::question(this,tr("Confirmation"),tr("Are you sure you want to reset your graph preferences to the defaults?"),QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes) {
gGraphView *gv[3]; gGraphView *gv[3];
gv[0]=mainwin->getDaily()->graphView(); gv[0]=mainwin->getDaily()->graphView();
gv[1]=mainwin->getOverview()->graphView(); gv[1]=mainwin->getOverview()->graphView();

View File

@ -58,10 +58,10 @@ ProfileSelect::ProfileSelect(QWidget *parent) :
hide(); hide();
} */ } */
popupMenu=new QMenu(this); popupMenu=new QMenu(this);
popupMenu->addAction("Open Profile",this,SLOT(openProfile())); popupMenu->addAction(tr("Open Profile"),this,SLOT(openProfile()));
popupMenu->addAction("Edit Profile",this,SLOT(editProfile())); popupMenu->addAction(tr("Edit Profile"),this,SLOT(editProfile()));
popupMenu->addSeparator(); popupMenu->addSeparator();
popupMenu->addAction("Delete Profile",this,SLOT(deleteProfile())); popupMenu->addAction(tr("Delete Profile"),this,SLOT(deleteProfile()));
} }
ProfileSelect::~ProfileSelect() ProfileSelect::~ProfileSelect()
@ -84,7 +84,7 @@ void ProfileSelect::editProfile()
QLineEdit *e=new QLineEdit(&dialog); QLineEdit *e=new QLineEdit(&dialog);
e->setEchoMode(QLineEdit::Password); e->setEchoMode(QLineEdit::Password);
dialog.connect(e,SIGNAL(returnPressed()),&dialog,SLOT(accept())); dialog.connect(e,SIGNAL(returnPressed()),&dialog,SLOT(accept()));
dialog.setWindowTitle("Enter Password for "+name); dialog.setWindowTitle(tr("Enter Password for %1").arg(name));
dialog.setMinimumWidth(300); dialog.setMinimumWidth(300);
QVBoxLayout *lay=new QVBoxLayout(); QVBoxLayout *lay=new QVBoxLayout();
dialog.setLayout(lay); dialog.setLayout(lay);
@ -100,9 +100,9 @@ void ProfileSelect::editProfile()
break; break;
} else { } else {
if (tries<3) { if (tries<3) {
QMessageBox::warning(this,"Error","Incorrect Password",QMessageBox::Ok); QMessageBox::warning(this,tr("Error"),tr("Incorrect Password"),QMessageBox::Ok);
} else { } else {
QMessageBox::warning(this,"Error","You entered the password wrong too many times.",QMessageBox::Ok); QMessageBox::warning(this,tr("Error"),tr("You entered the password wrong too many times."),QMessageBox::Ok);
reject(); reject();
} }
} }
@ -119,13 +119,13 @@ void ProfileSelect::editProfile()
void ProfileSelect::deleteProfile() void ProfileSelect::deleteProfile()
{ {
QString name=ui->listView->currentIndex().data().toString(); QString name=ui->listView->currentIndex().data().toString();
if (QMessageBox::question(this,"Question","Are you sure you want to trash the profile \""+name+"\"?",QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes){ if (QMessageBox::question(this,tr("Question"),tr("Are you sure you want to trash the profile \"%1\"?").arg(name),QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes){
if (QMessageBox::question(this,"Question","Double Checking: Do you really want \""+name+"\" profile to be obliterated?",QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes){ if (QMessageBox::question(this,tr("Question"),tr("Double Checking: Do you really want \"%1\" profile to be obliterated?").arg(name),QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes){
if (QMessageBox::question(this,"Question","Last chance to save the \""+name+"\" profile. Are you totally sure?",QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes){ if (QMessageBox::question(this,tr("Question"),tr("Last chance to save the \"%1\" profile. Are you totally sure?").arg(name),QMessageBox::Yes,QMessageBox::No)==QMessageBox::Yes){
bool reallydelete=false; bool reallydelete=false;
Profile *profile=Profiles::profiles[name]; Profile *profile=Profiles::profiles[name];
if (!profile) { if (!profile) {
QMessageBox::warning(this,"WTH???","If you can read this you need to delete this profile directory manually (It's under Your Documents folder -> SleepApp -> Profiles -> [profile_name])",QMessageBox::Ok); QMessageBox::warning(this,tr("WTH???"),tr("If you can read this you need to delete this profile directory manually (It's under Your Documents folder -> SleepApp -> Profiles -> [profile_name])"),QMessageBox::Ok);
return; return;
} }
if (profile->Exists("Password")) { if (profile->Exists("Password")) {
@ -133,7 +133,7 @@ void ProfileSelect::deleteProfile()
QLineEdit *e=new QLineEdit(&dialog); QLineEdit *e=new QLineEdit(&dialog);
e->setEchoMode(QLineEdit::Password); e->setEchoMode(QLineEdit::Password);
dialog.connect(e,SIGNAL(returnPressed()),&dialog,SLOT(accept())); dialog.connect(e,SIGNAL(returnPressed()),&dialog,SLOT(accept()));
dialog.setWindowTitle("Enter Password for "+name); dialog.setWindowTitle(tr("Enter Password for %1").arg(name));
dialog.setMinimumWidth(300); dialog.setMinimumWidth(300);
QVBoxLayout *lay=new QVBoxLayout(); QVBoxLayout *lay=new QVBoxLayout();
dialog.setLayout(lay); dialog.setLayout(lay);
@ -149,16 +149,16 @@ void ProfileSelect::deleteProfile()
break; break;
} else { } else {
if (tries<3) { if (tries<3) {
QMessageBox::warning(this,"Error","Incorrect Password",QMessageBox::Ok); QMessageBox::warning(this,tr("Error"),tr("Incorrect Password"),QMessageBox::Ok);
} else { } else {
QMessageBox::warning(this,"Error","Meheh... If your trying to delete because you forgot the password, your going the wrong way about it. Read the docs.\n\nSigned: Nasty Programmer",QMessageBox::Ok); QMessageBox::warning(this,tr("Error"),tr("Meheh... If your trying to delete because you forgot the password, your going the wrong way about it. Read the docs.\n\nSigned: Nasty Programmer"),QMessageBox::Ok);
} }
} }
} while (tries<3); } while (tries<3);
} else reallydelete=true; } else reallydelete=true;
if (reallydelete) { if (reallydelete) {
QMessageBox::information(this,"Whoops.","After all that nagging, I haven't got around to writing this code yet.. For now you can delete the directory in SleepApp -> Profiles -> [profile_name]",QMessageBox::Ok); QMessageBox::information(this,tr("Whoops."),tr("After all that nagging, I haven't got around to writing this code yet.. For now you can delete the directory in SleepApp -> Profiles -> [profile_name]"),QMessageBox::Ok);
qDebug() << "delete" << name; qDebug() << "delete" << name;
} }
} }
@ -210,7 +210,7 @@ void ProfileSelect::on_listView_activated(const QModelIndex &index)
QLineEdit *e=new QLineEdit(&dialog); QLineEdit *e=new QLineEdit(&dialog);
e->setEchoMode(QLineEdit::Password); e->setEchoMode(QLineEdit::Password);
dialog.connect(e,SIGNAL(returnPressed()),&dialog,SLOT(accept())); dialog.connect(e,SIGNAL(returnPressed()),&dialog,SLOT(accept()));
dialog.setWindowTitle("Enter Password"); dialog.setWindowTitle(tr("Enter Password"));
QVBoxLayout *lay=new QVBoxLayout(); QVBoxLayout *lay=new QVBoxLayout();
dialog.setLayout(lay); dialog.setLayout(lay);
lay->addWidget(e); lay->addWidget(e);
@ -224,9 +224,9 @@ void ProfileSelect::on_listView_activated(const QModelIndex &index)
} }
tries++; tries++;
if (tries<3) { if (tries<3) {
QMessageBox::warning(this,"Error","Incorrect Password",QMessageBox::Ok); QMessageBox::warning(this,tr("Error"),tr("Incorrect Password"),QMessageBox::Ok);
} else { } else {
QMessageBox::warning(this,"Error","You entered an Incorrect Password too many times. Exiting!",QMessageBox::Ok); QMessageBox::warning(this,tr("Error"),tr("You entered an Incorrect Password too many times. Exiting!"),QMessageBox::Ok);
} }
} while (tries<3); } while (tries<3);
} }