2014-04-09 21:01:57 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
|
|
|
*
|
|
|
|
* SleepLib Profiles Header
|
|
|
|
*
|
|
|
|
* Copyright (c) 2011 Mark Watkins <jedimark@users.sourceforge.net>
|
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file COPYING in the main directory of the Linux
|
|
|
|
* distribution for more details. */
|
2011-06-26 08:30:44 +00:00
|
|
|
|
|
|
|
#ifndef PROFILES_H
|
|
|
|
#define PROFILES_H
|
|
|
|
|
|
|
|
#include <QString>
|
2011-12-21 11:09:50 +00:00
|
|
|
#include <QCryptographicHash>
|
|
|
|
#include <QThread>
|
2011-06-26 08:30:44 +00:00
|
|
|
#include "machine.h"
|
|
|
|
#include "machine_loader.h"
|
|
|
|
#include "preferences.h"
|
2011-12-21 12:47:47 +00:00
|
|
|
#include "common.h"
|
2011-06-26 08:30:44 +00:00
|
|
|
|
|
|
|
class Machine;
|
2011-12-19 02:20:24 +00:00
|
|
|
|
2011-12-21 11:09:50 +00:00
|
|
|
enum Gender { GenderNotSpecified, Male, Female };
|
|
|
|
enum MaskType { Mask_Unknown, Mask_NasalPillows, Mask_Hybrid, Mask_StandardNasal, Mask_FullFace };
|
|
|
|
enum OverlayDisplayType { ODT_Bars, ODT_TopAndBottom };
|
2013-11-19 04:42:10 +00:00
|
|
|
enum OverviewLinechartModes { OLC_Bartop, OLC_Lines };
|
2011-12-21 11:09:50 +00:00
|
|
|
|
|
|
|
class DoctorInfo;
|
|
|
|
class UserInfo;
|
|
|
|
class UserSettings;
|
|
|
|
class OxiSettings;
|
|
|
|
class CPAPSettings;
|
|
|
|
class AppearanceSettings;
|
2011-12-21 12:47:47 +00:00
|
|
|
class SessionSettings;
|
2011-12-21 11:09:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-18 16:39:36 +00:00
|
|
|
/*!
|
|
|
|
\class Profile
|
|
|
|
\author Mark Watkins
|
|
|
|
\date 28/04/11
|
2011-12-19 02:20:24 +00:00
|
|
|
\brief The User profile system, containing all information for a user, and an index into all Machine data
|
2011-06-26 08:30:44 +00:00
|
|
|
*/
|
2014-04-17 05:58:57 +00:00
|
|
|
class Profile: public Preferences
|
2011-06-26 08:30:44 +00:00
|
|
|
{
|
2014-04-17 05:58:57 +00:00
|
|
|
public:
|
2011-12-19 02:20:24 +00:00
|
|
|
//! \brief Creates a new Profile object 'name' (which is usually just set to "Profile", the XML filename is derived from this)
|
2011-06-26 08:30:44 +00:00
|
|
|
Profile(QString name);
|
2011-12-19 02:20:24 +00:00
|
|
|
|
|
|
|
//! \brief Create a new empty Profile object
|
2011-06-26 08:30:44 +00:00
|
|
|
Profile();
|
|
|
|
virtual ~Profile();
|
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
virtual bool Open(QString filename = "");
|
2012-01-12 22:46:06 +00:00
|
|
|
|
2011-12-18 16:39:36 +00:00
|
|
|
//! \brief Save Profile object (This is an extension to Preference::Save(..))
|
2014-04-17 05:58:57 +00:00
|
|
|
virtual bool Save(QString filename = "");
|
2011-12-11 10:59:30 +00:00
|
|
|
|
2011-06-26 08:30:44 +00:00
|
|
|
bool is_first_day;
|
2011-12-18 16:39:36 +00:00
|
|
|
|
|
|
|
//! \brief List of machines, indexed by MachineID
|
2014-04-17 05:58:57 +00:00
|
|
|
QHash<MachineID, Machine *> machlist;
|
2011-12-18 16:39:36 +00:00
|
|
|
|
|
|
|
//! \brief Add machine to this profiles machlist
|
2011-06-26 08:30:44 +00:00
|
|
|
void AddMachine(Machine *m);
|
2011-12-18 16:39:36 +00:00
|
|
|
|
|
|
|
//! \brief Remove machine from this profiles machlist
|
2011-06-26 08:30:44 +00:00
|
|
|
void DelMachine(Machine *m);
|
2011-12-18 16:39:36 +00:00
|
|
|
|
|
|
|
//! \brief Loads all machine (summary) data belonging to this profile
|
2011-06-26 08:30:44 +00:00
|
|
|
void LoadMachineData();
|
2011-12-18 16:39:36 +00:00
|
|
|
|
|
|
|
//! \brief Barf because data format has changed. This does a purge of CPAP data for machine *m
|
2011-07-29 22:55:24 +00:00
|
|
|
void DataFormatError(Machine *m);
|
2011-12-18 16:39:36 +00:00
|
|
|
|
|
|
|
/*! \brief Import Machine Data
|
2011-12-19 02:20:24 +00:00
|
|
|
\param path containing import location
|
2011-12-18 16:39:36 +00:00
|
|
|
*/
|
2011-07-15 13:30:41 +00:00
|
|
|
int Import(QString path);
|
2011-12-18 16:39:36 +00:00
|
|
|
|
|
|
|
//! \brief Remove a session from day object, without deleting the Session object
|
2014-04-17 05:58:57 +00:00
|
|
|
void RemoveSession(Session *sess);
|
2011-06-26 08:30:44 +00:00
|
|
|
|
2011-12-18 16:39:36 +00:00
|
|
|
//! \brief Add Day record to Profile Day list
|
2014-04-17 05:58:57 +00:00
|
|
|
void AddDay(QDate date, Day *day, MachineType mt);
|
2011-12-18 16:39:36 +00:00
|
|
|
|
|
|
|
//! \brief Get Day record if data available for date and machine type, else return NULL
|
2014-04-17 05:58:57 +00:00
|
|
|
Day *GetDay(QDate date, MachineType type = MT_UNKNOWN);
|
2011-06-26 08:30:44 +00:00
|
|
|
|
2011-12-28 12:36:40 +00:00
|
|
|
//! \brief Get Day record if data available for date and machine type, and has enabled session data, else return NULL
|
2014-04-17 05:58:57 +00:00
|
|
|
Day *GetGoodDay(QDate date, MachineType type);
|
2011-12-28 12:36:40 +00:00
|
|
|
|
|
|
|
|
2011-12-18 16:39:36 +00:00
|
|
|
//! \brief Returns a list of all machines of type t
|
2014-04-17 05:58:57 +00:00
|
|
|
QList<Machine *> GetMachines(MachineType t = MT_UNKNOWN);
|
2011-12-18 16:39:36 +00:00
|
|
|
|
|
|
|
//! \brief Returns the machine of type t used on date, NULL if none..
|
2014-04-17 05:58:57 +00:00
|
|
|
Machine *GetMachine(MachineType t, QDate date);
|
2011-12-18 16:39:36 +00:00
|
|
|
|
|
|
|
//! \brief return the first machine of type t
|
2014-04-17 05:58:57 +00:00
|
|
|
Machine *GetMachine(MachineType t);
|
2011-06-26 08:30:44 +00:00
|
|
|
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Returns true if this profile stores this variable identified by key
|
|
|
|
bool contains(QString key) { return p_preferences.contains(key); }
|
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
int countDays(MachineType mt = MT_UNKNOWN, QDate start = QDate(), QDate end = QDate());
|
|
|
|
EventDataType calcCount(ChannelID code, MachineType mt = MT_CPAP, QDate start = QDate(),
|
|
|
|
QDate end = QDate());
|
|
|
|
double calcSum(ChannelID code, MachineType mt = MT_CPAP, QDate start = QDate(),
|
|
|
|
QDate end = QDate());
|
|
|
|
EventDataType calcHours(MachineType mt = MT_CPAP, QDate start = QDate(), QDate end = QDate());
|
|
|
|
EventDataType calcAvg(ChannelID code, MachineType mt = MT_CPAP, QDate start = QDate(),
|
|
|
|
QDate end = QDate());
|
|
|
|
EventDataType calcWavg(ChannelID code, MachineType mt = MT_CPAP, QDate start = QDate(),
|
|
|
|
QDate end = QDate());
|
|
|
|
EventDataType calcMin(ChannelID code, MachineType mt = MT_CPAP, QDate start = QDate(),
|
|
|
|
QDate end = QDate());
|
|
|
|
EventDataType calcMax(ChannelID code, MachineType mt = MT_CPAP, QDate start = QDate(),
|
|
|
|
QDate end = QDate());
|
|
|
|
EventDataType calcPercentile(ChannelID code, EventDataType percent, MachineType mt = MT_CPAP,
|
|
|
|
QDate start = QDate(), QDate end = QDate());
|
2011-12-22 13:22:40 +00:00
|
|
|
|
2012-01-25 22:34:21 +00:00
|
|
|
bool hasChannel(ChannelID code);
|
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
EventDataType calcSettingsMin(ChannelID code, MachineType mt = MT_CPAP, QDate start = QDate(),
|
|
|
|
QDate end = QDate());
|
|
|
|
EventDataType calcSettingsMax(ChannelID code, MachineType mt = MT_CPAP, QDate start = QDate(),
|
|
|
|
QDate end = QDate());
|
2011-12-23 10:52:31 +00:00
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
virtual void ExtraLoad(QDomElement &root);
|
|
|
|
virtual QDomElement ExtraSave(QDomDocument &doc);
|
2011-07-24 16:34:53 +00:00
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
QMap<QDate, QList<Day *> > daylist;
|
|
|
|
QDate FirstDay(MachineType mt = MT_UNKNOWN);
|
|
|
|
QDate LastDay(MachineType mt = MT_UNKNOWN);
|
2011-06-26 08:30:44 +00:00
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
QDate FirstGoodDay(MachineType mt = MT_UNKNOWN);
|
|
|
|
QDate LastGoodDay(MachineType mt = MT_UNKNOWN);
|
2011-12-28 12:36:40 +00:00
|
|
|
|
2011-12-21 11:09:50 +00:00
|
|
|
QString dataFolder() { return (*this).Get("{DataFolder}"); }
|
|
|
|
|
|
|
|
UserInfo *user;
|
|
|
|
CPAPSettings *cpap;
|
|
|
|
OxiSettings *oxi;
|
|
|
|
DoctorInfo *doctor;
|
|
|
|
AppearanceSettings *appearance;
|
2011-12-21 12:47:47 +00:00
|
|
|
UserSettings *general;
|
|
|
|
SessionSettings *session;
|
2011-12-21 11:09:50 +00:00
|
|
|
|
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
protected:
|
|
|
|
QDate m_first, m_last;
|
2011-06-26 08:30:44 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class MachineLoader;
|
2014-04-17 05:58:57 +00:00
|
|
|
extern MachineLoader *GetLoader(QString name);
|
2011-06-26 08:30:44 +00:00
|
|
|
|
|
|
|
extern Preferences *p_pref;
|
|
|
|
extern Preferences *p_layout;
|
2014-04-17 05:58:57 +00:00
|
|
|
extern Profile *p_profile;
|
2011-06-26 08:30:44 +00:00
|
|
|
|
|
|
|
// these are bad and must change
|
2011-10-05 07:41:56 +00:00
|
|
|
#define PREF (*p_pref)
|
|
|
|
#define LAYOUT (*p_layout)
|
|
|
|
#define PROFILE (*p_profile)
|
2011-06-26 08:30:44 +00:00
|
|
|
|
2012-01-12 22:46:06 +00:00
|
|
|
// DoctorInfo Strings
|
2014-04-17 05:58:57 +00:00
|
|
|
const QString STR_DI_Name = "DoctorName";
|
|
|
|
const QString STR_DI_Phone = "DoctorPhone";
|
|
|
|
const QString STR_DI_Email = "DoctorEmail";
|
|
|
|
const QString STR_DI_Practice = "DoctorPractice";
|
|
|
|
const QString STR_DI_Address = "DoctorAddress";
|
|
|
|
const QString STR_DI_PatientID = "DoctorPatientID";
|
2012-01-12 22:46:06 +00:00
|
|
|
|
|
|
|
// UserInfo Strings
|
2014-04-17 05:58:57 +00:00
|
|
|
const QString STR_UI_DOB = "DOB";
|
|
|
|
const QString STR_UI_FirstName = "FirstName";
|
|
|
|
const QString STR_UI_LastName = "LastName";
|
|
|
|
const QString STR_UI_UserName = "UserName";
|
|
|
|
const QString STR_UI_Password = "Password";
|
|
|
|
const QString STR_UI_Address = "Address";
|
|
|
|
const QString STR_UI_Phone = "Phone";
|
|
|
|
const QString STR_UI_EmailAddress = "EmailAddress";
|
|
|
|
const QString STR_UI_Country = "Country";
|
|
|
|
const QString STR_UI_Height = "Height";
|
|
|
|
const QString STR_UI_Gender = "Gender";
|
|
|
|
const QString STR_UI_TimeZone = "TimeZone";
|
|
|
|
const QString STR_UI_DST = "DST";
|
2012-01-12 22:46:06 +00:00
|
|
|
|
|
|
|
// OxiSettings Strings
|
2014-04-17 05:58:57 +00:00
|
|
|
const QString STR_OS_EnableOximetry = "EnableOximetry";
|
|
|
|
const QString STR_OS_SyncOximetry = "SyncOximetry";
|
|
|
|
const QString STR_OS_OximeterType = "OximeterType";
|
|
|
|
const QString STR_OS_OxiDiscardThreshold = "OxiDiscardThreshold";
|
|
|
|
const QString STR_OS_SPO2DropDuration = "SPO2DropDuration";
|
|
|
|
const QString STR_OS_SPO2DropPercentage = "SPO2DropPercentage";
|
|
|
|
const QString STR_OS_PulseChangeDuration = "PulseChangeDuration";
|
|
|
|
const QString STR_OS_PulseChangeBPM = "PulseChangeBPM";
|
2012-01-12 22:46:06 +00:00
|
|
|
|
|
|
|
// CPAPSettings Strings
|
2014-04-17 05:58:57 +00:00
|
|
|
const QString STR_CS_ComplianceHours = "ComplianceHours";
|
|
|
|
const QString STR_CS_ShowCompliance = "ShowCompliance";
|
|
|
|
const QString STR_CS_ShowLeaksMode = "ShowLeaksMode";
|
|
|
|
const QString STR_CS_MaskStartDate = "MaskStartDate";
|
|
|
|
const QString STR_CS_MaskDescription = "MaskDescription";
|
|
|
|
const QString STR_CS_MaskType = "MaskType";
|
|
|
|
const QString STR_CS_PrescribedMode = "CPAPPrescribedMode";
|
|
|
|
const QString STR_CS_PrescribedMinPressure = "CPAPPrescribedMinPressure";
|
|
|
|
const QString STR_CS_PrescribedMaxPressure = "CPAPPrescribedMaxPressure";
|
|
|
|
const QString STR_CS_UntreatedAHI = "UntreatedAHI";
|
|
|
|
const QString STR_CS_Notes = "CPAPNotes";
|
|
|
|
const QString STR_CS_DateDiagnosed = "DateDiagnosed";
|
|
|
|
const QString STR_CS_UserEventFlagging = "UserEventFlagging";
|
|
|
|
const QString STR_CS_UserFlowRestriction = "UserFlowRestriction";
|
|
|
|
const QString STR_CS_UserEventDuration = "UserEventDuration";
|
|
|
|
const QString STR_CS_UserEventDuplicates = "UserEventDuplicates";
|
|
|
|
const QString STR_CS_AHIWindow = "AHIWindow";
|
|
|
|
const QString STR_CS_AHIReset = "AHIReset";
|
|
|
|
const QString STR_CS_ClockDrift = "ClockDrift";
|
2012-01-12 22:46:06 +00:00
|
|
|
|
|
|
|
// ImportSettings Strings
|
2014-04-17 05:58:57 +00:00
|
|
|
const QString STR_IS_DaySplitTime = "DaySplitTime";
|
|
|
|
const QString STR_IS_CacheSessions = "MemoryHog";
|
|
|
|
const QString STR_IS_CombineCloseSessions = "CombineCloserSessions";
|
|
|
|
const QString STR_IS_IgnoreShorterSessions = "IgnoreShorterSessions";
|
|
|
|
const QString STR_IS_Multithreading = "EnableMultithreading";
|
|
|
|
const QString STR_IS_BackupCardData = "BackupCardData";
|
|
|
|
const QString STR_IS_CompressBackupData = "CompressBackupData";
|
|
|
|
const QString STR_IS_CompressSessionData = "CompressSessionData";
|
2012-01-12 22:46:06 +00:00
|
|
|
|
|
|
|
// AppearanceSettings Strings
|
2014-04-17 05:58:57 +00:00
|
|
|
const QString STR_AS_GraphHeight = "GraphHeight";
|
|
|
|
const QString STR_AS_AntiAliasing = "UseAntiAliasing";
|
|
|
|
const QString STR_AS_GraphSnapshots = "EnableGraphSnapshots";
|
|
|
|
const QString STR_AS_Animations = "AnimationsAndTransitions";
|
|
|
|
const QString STR_AS_SquareWave = "SquareWavePlots";
|
|
|
|
const QString STR_AS_OverlayType = "OverlayType";
|
|
|
|
const QString STR_AS_OverviewLinechartMode = "OverviewLinechartMode";
|
|
|
|
const QString STR_AS_UsePixmapCaching = "UsePixmapCaching";
|
|
|
|
const QString STR_AS_AllowYAxisScaling = "AllowYAxisScaling";
|
|
|
|
const QString STR_AS_GraphTooltips = "GraphTooltips";
|
2012-01-12 22:46:06 +00:00
|
|
|
|
|
|
|
// UserSettings Strings
|
2014-04-17 05:58:57 +00:00
|
|
|
const QString STR_US_UnitSystem = "UnitSystem";
|
|
|
|
const QString STR_US_EventWindowSize = "EventWindowSize";
|
|
|
|
const QString STR_US_SkipEmptyDays = "SkipEmptyDays";
|
|
|
|
const QString STR_US_RebuildCache = "RebuildCache";
|
|
|
|
const QString STR_US_ShowDebug = "ShowDebug";
|
|
|
|
const QString STR_US_LinkGroups = "LinkGroups";
|
|
|
|
const QString STR_US_CalculateRDI = "CalculateRDI";
|
|
|
|
const QString STR_US_ShowSerialNumbers = "ShowSerialNumbers";
|
|
|
|
const QString STR_US_PrefCalcMiddle = "PrefCalcMiddle";
|
|
|
|
const QString STR_US_PrefCalcPercentile = "PrefCalcPercentile";
|
|
|
|
const QString STR_US_PrefCalcMax = "PrefCalcMax";
|
|
|
|
const QString STR_US_TooltipTimeout = "TooltipTimeout";
|
|
|
|
const QString STR_US_ScrollDampening = "ScrollDampening";
|
2012-01-12 22:46:06 +00:00
|
|
|
|
2011-12-21 11:09:50 +00:00
|
|
|
|
|
|
|
class DoctorInfo
|
|
|
|
{
|
2014-04-17 05:58:57 +00:00
|
|
|
public:
|
|
|
|
DoctorInfo(Profile *p) : m_profile(p) {
|
|
|
|
if (!m_profile->contains(STR_DI_Name)) { (*m_profile)[STR_DI_Name] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_DI_Phone)) { (*m_profile)[STR_DI_Phone] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_DI_Email)) { (*m_profile)[STR_DI_Email] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_DI_Practice)) { (*m_profile)[STR_DI_Practice] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_DI_Address)) { (*m_profile)[STR_DI_Address] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_DI_PatientID)) { (*m_profile)[STR_DI_PatientID] = QString(); }
|
2011-12-21 11:09:50 +00:00
|
|
|
}
|
|
|
|
~DoctorInfo() {}
|
2014-04-17 05:58:57 +00:00
|
|
|
void setProfile(Profile *p) { m_profile = p; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
2012-01-05 04:37:22 +00:00
|
|
|
const QString name() { return (*m_profile)[STR_DI_Name].toString(); }
|
|
|
|
const QString phone() { return (*m_profile)[STR_DI_Phone].toString(); }
|
|
|
|
const QString email() { return (*m_profile)[STR_DI_Email].toString(); }
|
|
|
|
const QString practiceName() { return (*m_profile)[STR_DI_Practice].toString(); }
|
|
|
|
const QString address() { return (*m_profile)[STR_DI_Address].toString(); }
|
|
|
|
const QString patientID() { return (*m_profile)[STR_DI_PatientID].toString(); }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
void setName(QString name) { (*m_profile)[STR_DI_Name] = name; }
|
|
|
|
void setPhone(QString phone) { (*m_profile)[STR_DI_Phone] = phone; }
|
|
|
|
void setEmail(QString phone) { (*m_profile)[STR_DI_Email] = phone; }
|
|
|
|
void setPracticeName(QString practice) { (*m_profile)[STR_DI_Practice] = practice; }
|
|
|
|
void setAddress(QString address) { (*m_profile)[STR_DI_Address] = address; }
|
|
|
|
void setPatientID(QString pid) { (*m_profile)[STR_DI_PatientID] = pid; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
|
|
|
Profile *m_profile;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*! \class UserInfo
|
|
|
|
\brief Profile Options relating to the User Information
|
|
|
|
*/
|
|
|
|
class UserInfo
|
|
|
|
{
|
2014-04-17 05:58:57 +00:00
|
|
|
public:
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Create UserInfo object given Profile *p, and initialize the defaults
|
2014-04-17 05:58:57 +00:00
|
|
|
UserInfo(Profile *p) : m_profile(p) {
|
|
|
|
if (!m_profile->contains(STR_UI_DOB)) { (*m_profile)[STR_UI_DOB] = QDate(1970, 1, 1); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_UI_FirstName)) { (*m_profile)[STR_UI_FirstName] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_UI_LastName)) { (*m_profile)[STR_UI_LastName] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_UI_UserName)) { (*m_profile)[STR_UI_UserName] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_UI_Password)) { (*m_profile)[STR_UI_Password] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_UI_Address)) { (*m_profile)[STR_UI_Address] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_UI_Phone)) { (*m_profile)[STR_UI_Phone] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_UI_EmailAddress)) { (*m_profile)[STR_UI_EmailAddress] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_UI_Country)) { (*m_profile)[STR_UI_Country] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_UI_Height)) { (*m_profile)[STR_UI_Height] = 0.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_UI_Gender)) { (*m_profile)[STR_UI_Gender] = (int)GenderNotSpecified; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_UI_TimeZone)) { (*m_profile)[STR_UI_TimeZone] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_UI_DST)) { (*m_profile)[STR_UI_DST] = false; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
~UserInfo() {}
|
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
void setProfile(Profile *p) { m_profile = p; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
2012-01-05 04:37:22 +00:00
|
|
|
QDate DOB() { return (*m_profile)[STR_UI_DOB].toDate(); }
|
|
|
|
const QString firstName() { return (*m_profile)[STR_UI_FirstName].toString(); }
|
|
|
|
const QString lastName() { return (*m_profile)[STR_UI_LastName].toString(); }
|
|
|
|
const QString userName() { return (*m_profile)[STR_UI_UserName].toString(); }
|
|
|
|
const QString address() { return (*m_profile)[STR_UI_Address].toString(); }
|
|
|
|
const QString phone() { return (*m_profile)[STR_UI_Phone].toString(); }
|
|
|
|
const QString email() { return (*m_profile)[STR_UI_EmailAddress].toString(); }
|
|
|
|
double height() { return (*m_profile)[STR_UI_Height].toDouble(); }
|
|
|
|
const QString country() { return (*m_profile)[STR_UI_Country].toString(); }
|
|
|
|
Gender gender() { return (Gender)(*m_profile)[STR_UI_Gender].toInt(); }
|
|
|
|
const QString timeZone() { return (*m_profile)[STR_UI_TimeZone].toString(); }
|
|
|
|
bool daylightSaving() { return (*m_profile)[STR_UI_DST].toBool(); }
|
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
void setDOB(QDate date) { (*m_profile)[STR_UI_DOB] = date; }
|
|
|
|
void setFirstName(QString name) { (*m_profile)[STR_UI_FirstName] = name; }
|
|
|
|
void setLastName(QString name) { (*m_profile)[STR_UI_LastName] = name; }
|
|
|
|
void setUserName(QString username) { (*m_profile)[STR_UI_UserName] = username; }
|
|
|
|
void setAddress(QString address) { (*m_profile)[STR_UI_Address] = address; }
|
|
|
|
void setPhone(QString phone) { (*m_profile)[STR_UI_Phone] = phone; }
|
|
|
|
void setEmail(QString email) { (*m_profile)[STR_UI_EmailAddress] = email; }
|
|
|
|
void setHeight(double height) { (*m_profile)[STR_UI_Height] = height; }
|
|
|
|
void setCountry(QString country) { (*m_profile)[STR_UI_Country] = country; }
|
|
|
|
void setGender(Gender g) { (*m_profile)[STR_UI_Gender] = (int)g; }
|
|
|
|
void setTimeZone(QString tz) { (*m_profile)[STR_UI_TimeZone] = tz; }
|
|
|
|
void setDaylightSaving(bool ds) { (*m_profile)[STR_UI_DST] = ds; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
2011-12-21 14:24:09 +00:00
|
|
|
bool hasPassword() {
|
2012-01-05 04:37:22 +00:00
|
|
|
return !((*m_profile)[STR_UI_Password].toString().isEmpty());
|
2011-12-21 14:24:09 +00:00
|
|
|
}
|
2011-12-21 11:09:50 +00:00
|
|
|
bool checkPassword(QString password) {
|
2014-04-17 05:58:57 +00:00
|
|
|
QByteArray ba = password.toUtf8();
|
|
|
|
return ((*m_profile)[STR_UI_Password].toString() == QString(QCryptographicHash::hash(ba,
|
|
|
|
QCryptographicHash::Sha1).toHex()));
|
2011-12-21 11:09:50 +00:00
|
|
|
}
|
|
|
|
void setPassword(QString password) {
|
2014-04-17 05:58:57 +00:00
|
|
|
QByteArray ba = password.toUtf8();
|
2011-12-21 11:09:50 +00:00
|
|
|
// Hash me.
|
2014-04-17 05:58:57 +00:00
|
|
|
(*m_profile)[STR_UI_Password] = QString(QCryptographicHash::hash(ba,
|
|
|
|
QCryptographicHash::Sha1).toHex());
|
2011-12-21 11:09:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Profile *m_profile;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*! \class OxiSettings
|
|
|
|
\brief Profile Options relating to the Oximetry settings
|
|
|
|
*/
|
|
|
|
class OxiSettings
|
|
|
|
{
|
2014-04-17 05:58:57 +00:00
|
|
|
public:
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Create OxiSettings object given Profile *p, and initialize the defaults
|
2014-04-17 05:58:57 +00:00
|
|
|
OxiSettings(Profile *p) : m_profile(p) {
|
|
|
|
if (!m_profile->contains(STR_OS_EnableOximetry)) { (*m_profile)[STR_OS_EnableOximetry] = false; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_OS_SyncOximetry)) { (*m_profile)[STR_OS_SyncOximetry] = true; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_OS_OximeterType)) { (*m_profile)[STR_OS_OximeterType] = "CMS50"; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_OS_OxiDiscardThreshold)) { (*m_profile)[STR_OS_OxiDiscardThreshold] = 0.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_OS_SPO2DropDuration)) { (*m_profile)[STR_OS_SPO2DropDuration] = 8.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_OS_SPO2DropPercentage)) { (*m_profile)[STR_OS_SPO2DropPercentage] = 3.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_OS_PulseChangeDuration)) { (*m_profile)[STR_OS_PulseChangeDuration] = 8.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_OS_PulseChangeBPM)) { (*m_profile)[STR_OS_PulseChangeBPM] = 5.0; }
|
2011-12-21 11:09:50 +00:00
|
|
|
}
|
|
|
|
~OxiSettings() {}
|
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
void setProfile(Profile *p) { m_profile = p; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
2012-01-05 04:37:22 +00:00
|
|
|
bool oximetryEnabled() { return (*m_profile)[STR_OS_EnableOximetry].toBool(); }
|
|
|
|
bool syncOximetry() { return (*m_profile)[STR_OS_SyncOximetry].toBool(); }
|
|
|
|
QString oximeterType() { return (*m_profile)[STR_OS_OximeterType].toString(); }
|
|
|
|
double oxiDiscardThreshold() { return (*m_profile)[STR_OS_OxiDiscardThreshold].toDouble(); }
|
|
|
|
double spO2DropDuration() { return (*m_profile)[STR_OS_SPO2DropDuration].toDouble(); }
|
|
|
|
double spO2DropPercentage() { return (*m_profile)[STR_OS_SPO2DropPercentage].toDouble(); }
|
|
|
|
double pulseChangeDuration() { return (*m_profile)[STR_OS_PulseChangeDuration].toDouble(); }
|
|
|
|
double pulseChangeBPM() { return (*m_profile)[STR_OS_PulseChangeBPM].toDouble(); }
|
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
void setOximetryEnabled(bool enabled) { (*m_profile)[STR_OS_EnableOximetry] = enabled; }
|
|
|
|
void setSyncOximetry(bool synced) { (*m_profile)[STR_OS_SyncOximetry] = synced; }
|
|
|
|
void setOximeterType(QString oxitype) { (*m_profile)[STR_OS_OximeterType] = oxitype; }
|
|
|
|
void setOxiDiscardThreshold(double thresh) { (*m_profile)[STR_OS_OxiDiscardThreshold] = thresh; }
|
|
|
|
void setSpO2DropDuration(double duration) { (*m_profile)[STR_OS_SPO2DropDuration] = duration; }
|
|
|
|
void setSpO2DropPercentage(double percentage) { (*m_profile)[STR_OS_SPO2DropPercentage] = percentage; }
|
|
|
|
void setPulseChangeDuration(double duration) { (*m_profile)[STR_OS_PulseChangeDuration] = duration; }
|
|
|
|
void setPulseChangeBPM(double bpm) { (*m_profile)[STR_OS_PulseChangeBPM] = bpm; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
|
|
|
Profile *m_profile;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*! \class CPAPSettings
|
|
|
|
\brief Profile Options relating to the CPAP settings
|
|
|
|
*/
|
|
|
|
class CPAPSettings
|
|
|
|
{
|
2014-04-17 05:58:57 +00:00
|
|
|
public:
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Create CPAPSettings object given Profile *p, and initialize the defaults
|
2014-04-17 05:58:57 +00:00
|
|
|
CPAPSettings(Profile *p) : m_profile(p) {
|
|
|
|
if (!m_profile->contains(STR_CS_ComplianceHours)) { (*m_profile)[STR_CS_ComplianceHours] = 4; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_ShowCompliance)) { (*m_profile)[STR_CS_ShowCompliance] = true; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_ShowLeaksMode)) { (*m_profile)[STR_CS_ShowLeaksMode] = 0; }
|
|
|
|
|
2011-12-21 11:09:50 +00:00
|
|
|
// TODO: Check if this date is initiliazed yet
|
2014-04-17 05:58:57 +00:00
|
|
|
if (!m_profile->contains(STR_CS_MaskStartDate)) { (*m_profile)[STR_CS_MaskStartDate] = QDate(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_MaskDescription)) { (*m_profile)[STR_CS_MaskDescription] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_MaskType)) { (*m_profile)[STR_CS_MaskType] = Mask_Unknown; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_PrescribedMode)) { (*m_profile)[STR_CS_PrescribedMode] = MODE_UNKNOWN; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_PrescribedMinPressure)) { (*m_profile)[STR_CS_PrescribedMinPressure] = 0.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_PrescribedMaxPressure)) { (*m_profile)[STR_CS_PrescribedMaxPressure] = 0.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_UntreatedAHI)) { (*m_profile)[STR_CS_UntreatedAHI] = 0.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_Notes)) { (*m_profile)[STR_CS_Notes] = QString(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_DateDiagnosed)) { (*m_profile)[STR_CS_DateDiagnosed] = QDate(); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_UserFlowRestriction)) { (*m_profile)[STR_CS_UserFlowRestriction] = 20.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_UserEventDuration)) { (*m_profile)[STR_CS_UserEventDuration] = 10.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_UserEventDuplicates)) { (*m_profile)[STR_CS_UserEventDuplicates] = false; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_UserEventFlagging)) { (*m_profile)[STR_CS_UserEventFlagging] = false; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_AHIWindow)) { (*m_profile)[STR_CS_AHIWindow] = 60.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_AHIReset)) { (*m_profile)[STR_CS_AHIReset] = false; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_CS_ClockDrift)) { (*m_profile)[STR_CS_ClockDrift] = m_clock_drift = (int)0; }
|
|
|
|
else { m_clock_drift = (*m_profile)[STR_CS_ClockDrift].toInt(); }
|
2011-12-21 11:09:50 +00:00
|
|
|
}
|
|
|
|
|
2013-10-13 10:13:14 +00:00
|
|
|
~CPAPSettings() { }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
void setProfile(Profile *p) { m_profile = p; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
2011-12-22 13:22:40 +00:00
|
|
|
//Getters
|
2012-01-05 04:37:22 +00:00
|
|
|
double complianceHours() { return (*m_profile)[STR_CS_ComplianceHours].toDouble(); }
|
|
|
|
bool showComplianceInfo() { return (*m_profile)[STR_CS_ShowCompliance].toBool(); }
|
|
|
|
int leakMode() { return (*m_profile)[STR_CS_ShowLeaksMode].toInt(); }
|
|
|
|
QDate maskStartDate() { return (*m_profile)[STR_CS_MaskStartDate].toDate(); }
|
|
|
|
QString maskDescription() { return (*m_profile)[STR_CS_MaskDescription].toString(); }
|
|
|
|
MaskType maskType() { return (MaskType)(*m_profile)[STR_CS_MaskType].toInt(); }
|
|
|
|
CPAPMode mode() { return CPAPMode((*m_profile)[STR_CS_PrescribedMode].toInt()); }
|
|
|
|
double minPressure() { return (*m_profile)[STR_CS_PrescribedMinPressure].toDouble(); }
|
|
|
|
double maxPressure() { return (*m_profile)[STR_CS_PrescribedMaxPressure].toDouble(); }
|
|
|
|
double untreatedAHI() { return (*m_profile)[STR_CS_UntreatedAHI].toDouble(); }
|
|
|
|
const QString notes() { return (*m_profile)[STR_CS_Notes].toString(); }
|
|
|
|
QDate dateDiagnosed() { return (*m_profile)[STR_CS_DateDiagnosed].toDate(); }
|
2012-01-06 16:07:54 +00:00
|
|
|
double userFlowRestriction() { return (*m_profile)[STR_CS_UserFlowRestriction].toDouble(); }
|
|
|
|
double userEventDuration() { return (*m_profile)[STR_CS_UserEventDuration].toDouble(); }
|
2012-01-10 23:28:29 +00:00
|
|
|
bool userEventDuplicates() { return (*m_profile)[STR_CS_UserEventDuplicates].toBool(); }
|
2012-01-06 16:07:54 +00:00
|
|
|
double AHIWindow() { return (*m_profile)[STR_CS_AHIWindow].toDouble(); }
|
|
|
|
bool AHIReset() { return (*m_profile)[STR_CS_AHIReset].toBool(); }
|
|
|
|
bool userEventFlagging() { return (*m_profile)[STR_CS_UserEventFlagging].toBool(); }
|
2013-10-13 10:13:14 +00:00
|
|
|
int clockDrift() { return m_clock_drift; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
2011-12-22 13:22:40 +00:00
|
|
|
//Setters
|
2014-04-17 05:58:57 +00:00
|
|
|
void setMode(CPAPMode mode) { (*m_profile)[STR_CS_PrescribedMode] = (int)mode; }
|
|
|
|
void setMinPressure(double pressure) { (*m_profile)[STR_CS_PrescribedMinPressure] = pressure; }
|
|
|
|
void setMaxPressure(double pressure) { (*m_profile)[STR_CS_PrescribedMaxPressure] = pressure; }
|
|
|
|
void setUntreatedAHI(double ahi) { (*m_profile)[STR_CS_UntreatedAHI] = ahi; }
|
|
|
|
void setNotes(QString notes) { (*m_profile)[STR_CS_Notes] = notes; }
|
|
|
|
void setDateDiagnosed(QDate date) { (*m_profile)[STR_CS_DateDiagnosed] = date; }
|
|
|
|
void setComplianceHours(double hours) { (*m_profile)[STR_CS_ComplianceHours] = hours; }
|
|
|
|
void setShowComplianceInfo(bool b) { (*m_profile)[STR_CS_ShowCompliance] = b; }
|
|
|
|
void setLeakMode(int leakmode) { (*m_profile)[STR_CS_ShowLeaksMode] = (int)leakmode; }
|
|
|
|
void setMaskStartDate(QDate date) { (*m_profile)[STR_CS_MaskStartDate] = date; }
|
|
|
|
void setMaskDescription(QString description) { (*m_profile)[STR_CS_MaskDescription] = description; }
|
|
|
|
void setMaskType(MaskType masktype) { (*m_profile)[STR_CS_MaskType] = (int)masktype; }
|
|
|
|
void setUserFlowRestriction(double flow) { (*m_profile)[STR_CS_UserFlowRestriction] = flow; }
|
|
|
|
void setUserEventDuration(double duration) { (*m_profile)[STR_CS_UserEventDuration] = duration; }
|
|
|
|
void setAHIWindow(double window) { (*m_profile)[STR_CS_AHIWindow] = window; }
|
|
|
|
void setAHIReset(bool reset) { (*m_profile)[STR_CS_AHIReset] = reset; }
|
|
|
|
void setUserEventFlagging(bool flagging) { (*m_profile)[STR_CS_UserEventFlagging] = flagging; }
|
|
|
|
void setUserEventDuplicates(bool dup) { (*m_profile)[STR_CS_UserEventDuplicates] = dup; }
|
|
|
|
void setClockDrift(int seconds) { (*m_profile)[STR_CS_ClockDrift] = m_clock_drift = (int)seconds; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
|
|
|
Profile *m_profile;
|
2013-10-13 10:13:14 +00:00
|
|
|
|
|
|
|
int m_clock_drift;
|
2011-12-21 11:09:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*! \class ImportSettings
|
|
|
|
\brief Profile Options relating to the Import process
|
|
|
|
*/
|
2011-12-21 12:47:47 +00:00
|
|
|
class SessionSettings
|
2011-12-21 11:09:50 +00:00
|
|
|
{
|
2014-04-17 05:58:57 +00:00
|
|
|
public:
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Create ImportSettings object given Profile *p, and initialize the defaults
|
2014-04-17 05:58:57 +00:00
|
|
|
SessionSettings(Profile *p) : m_profile(p) {
|
|
|
|
if (!m_profile->contains(STR_IS_DaySplitTime)) { (*m_profile)[STR_IS_DaySplitTime] = QTime(12, 0, 0); }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_IS_CacheSessions)) { (*m_profile)[STR_IS_CacheSessions] = false; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_IS_CombineCloseSessions)) { (*m_profile)[STR_IS_CombineCloseSessions] = 240; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_IS_IgnoreShorterSessions)) { (*m_profile)[STR_IS_IgnoreShorterSessions] = 5; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_IS_Multithreading)) { (*m_profile)[STR_IS_Multithreading] = QThread::idealThreadCount() > 1; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_IS_BackupCardData)) { (*m_profile)[STR_IS_BackupCardData] = true; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_IS_CompressBackupData)) { (*m_profile)[STR_IS_CompressBackupData] = false; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_IS_CompressSessionData)) { (*m_profile)[STR_IS_CompressSessionData] = false; }
|
2011-12-21 11:09:50 +00:00
|
|
|
}
|
2011-12-21 12:47:47 +00:00
|
|
|
~SessionSettings() {}
|
2011-12-21 11:09:50 +00:00
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
void setProfile(Profile *p) { m_profile = p; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
2012-01-05 04:37:22 +00:00
|
|
|
QTime daySplitTime() { return (*m_profile)[STR_IS_DaySplitTime].toTime(); }
|
|
|
|
bool cacheSessions() { return (*m_profile)[STR_IS_CacheSessions].toBool(); }
|
|
|
|
double combineCloseSessions() { return (*m_profile)[STR_IS_CombineCloseSessions].toDouble(); }
|
|
|
|
double ignoreShortSessions() { return (*m_profile)[STR_IS_IgnoreShorterSessions].toDouble(); }
|
|
|
|
bool multithreading() { return (*m_profile)[STR_IS_Multithreading].toBool(); }
|
|
|
|
bool compressSessionData() { return (*m_profile)[STR_IS_CompressSessionData].toBool(); }
|
|
|
|
bool compressBackupData() { return (*m_profile)[STR_IS_CompressBackupData].toBool(); }
|
|
|
|
bool backupCardData() { return (*m_profile)[STR_IS_BackupCardData].toBool(); }
|
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
void setDaySplitTime(QTime time) { (*m_profile)[STR_IS_DaySplitTime] = time; }
|
|
|
|
void setCacheSessions(bool c) { (*m_profile)[STR_IS_CacheSessions] = c; }
|
|
|
|
void setCombineCloseSessions(double val) { (*m_profile)[STR_IS_CombineCloseSessions] = val; }
|
|
|
|
void setIgnoreShortSessions(double val) { (*m_profile)[STR_IS_IgnoreShorterSessions] = val; }
|
|
|
|
void setMultithreading(bool enabled) { (*m_profile)[STR_IS_Multithreading] = enabled; }
|
|
|
|
void setBackupCardData(bool enabled) { (*m_profile)[STR_IS_BackupCardData] = enabled; }
|
|
|
|
void setCompressBackupData(bool enabled) { (*m_profile)[STR_IS_CompressBackupData] = enabled; }
|
|
|
|
void setCompressSessionData(bool enabled) { (*m_profile)[STR_IS_CompressSessionData] = enabled; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
|
|
|
Profile *m_profile;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*! \class AppearanceSettings
|
|
|
|
\brief Profile Options relating to Visual Appearance
|
|
|
|
*/
|
|
|
|
class AppearanceSettings
|
|
|
|
{
|
2014-04-17 05:58:57 +00:00
|
|
|
public:
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Create AppearanceSettings object given Profile *p, and initialize the defaults
|
2014-04-17 05:58:57 +00:00
|
|
|
AppearanceSettings(Profile *p) : m_profile(p) {
|
|
|
|
if (!m_profile->contains(STR_AS_GraphHeight)) { (*m_profile)[STR_AS_GraphHeight] = 180.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_AS_AntiAliasing)) { (*m_profile)[STR_AS_AntiAliasing] = false; } // i think it's ugly
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_AS_GraphSnapshots)) { (*m_profile)[STR_AS_GraphSnapshots] = true; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_AS_Animations)) { (*m_profile)[STR_AS_Animations] = true; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_AS_SquareWave)) { (*m_profile)[STR_AS_SquareWave] = false; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_AS_AllowYAxisScaling)) { (*m_profile)[STR_AS_AllowYAxisScaling] = true; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_AS_GraphTooltips)) { (*m_profile)[STR_AS_GraphTooltips] = true; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_AS_UsePixmapCaching)) { (*m_profile)[STR_AS_UsePixmapCaching] = true; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_AS_OverlayType)) { (*m_profile)[STR_AS_OverlayType] = ODT_Bars; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_AS_OverviewLinechartMode)) { (*m_profile)[STR_AS_OverviewLinechartMode] = OLC_Bartop; }
|
2011-12-21 11:09:50 +00:00
|
|
|
}
|
|
|
|
~AppearanceSettings() {}
|
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
void setProfile(Profile *p) { m_profile = p; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
|
|
|
//! \brief Returns the normal (unscaled) height of a graph
|
2012-01-05 04:37:22 +00:00
|
|
|
int graphHeight() { return (*m_profile)[STR_AS_GraphHeight].toInt(); }
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Returns true if AntiAliasing (the graphical smoothing method) is enabled
|
2012-01-05 04:37:22 +00:00
|
|
|
bool antiAliasing() { return (*m_profile)[STR_AS_AntiAliasing].toBool(); }
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Returns true if renderPixmap function is in use, which takes snapshots of graphs
|
2012-01-05 04:37:22 +00:00
|
|
|
bool graphSnapshots() { return (*m_profile)[STR_AS_GraphSnapshots].toBool(); }
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Returns true if Graphical animations & Transitions will be drawn
|
2012-01-05 04:37:22 +00:00
|
|
|
bool animations() { return (*m_profile)[STR_AS_Animations].toBool(); }
|
2013-01-18 08:37:17 +00:00
|
|
|
//! \brief Returns true if PixmapCaching acceleration will be used
|
|
|
|
bool usePixmapCaching() { return (*m_profile)[STR_AS_UsePixmapCaching].toBool(); }
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Returns true if Square Wave plots are preferred (where possible)
|
2012-01-05 04:37:22 +00:00
|
|
|
bool squareWavePlots() { return (*m_profile)[STR_AS_SquareWave].toBool(); }
|
2013-10-26 13:59:37 +00:00
|
|
|
//! \brief Whether to allow double clicking on Y-Axis labels to change vertical scaling mode
|
|
|
|
bool allowYAxisScaling() { return (*m_profile)[STR_AS_AllowYAxisScaling].toBool(); }
|
|
|
|
//! \brief Whether to show graph tooltips
|
|
|
|
bool graphTooltips() { return (*m_profile)[STR_AS_GraphTooltips].toBool(); }
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Returns the type of overlay flags (which are displayed over the Flow Waveform)
|
2014-04-17 05:58:57 +00:00
|
|
|
OverlayDisplayType overlayType() { return (OverlayDisplayType)(*m_profile)[STR_AS_OverlayType].toInt(); }
|
2013-11-19 04:42:10 +00:00
|
|
|
//! \brief Returns the display type of Overview pages linechart
|
2014-04-17 05:58:57 +00:00
|
|
|
OverviewLinechartModes overviewLinechartMode() { return (OverviewLinechartModes)(*m_profile)[STR_AS_OverviewLinechartMode].toInt(); }
|
2013-11-19 04:42:10 +00:00
|
|
|
|
2011-12-21 11:09:50 +00:00
|
|
|
|
|
|
|
//! \brief Set the normal (unscaled) height of a graph.
|
2014-04-17 05:58:57 +00:00
|
|
|
void setGraphHeight(int height) { (*m_profile)[STR_AS_GraphHeight] = height; }
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Set to true to turn on AntiAliasing (the graphical smoothing method)
|
2014-04-17 05:58:57 +00:00
|
|
|
void setAntiAliasing(bool aa) { (*m_profile)[STR_AS_AntiAliasing] = aa; }
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Set to true if renderPixmap functions are in use, which takes snapshots of graphs.
|
2014-04-17 05:58:57 +00:00
|
|
|
void setGraphSnapshots(bool gs) { (*m_profile)[STR_AS_GraphSnapshots] = gs; }
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Set to true if Graphical animations & Transitions will be drawn
|
2014-04-17 05:58:57 +00:00
|
|
|
void setAnimations(bool anim) { (*m_profile)[STR_AS_Animations] = anim; }
|
2013-01-18 08:37:17 +00:00
|
|
|
//! \brief Set to true to use Pixmap Caching of Text and other graphics caching speedup techniques
|
2014-04-17 05:58:57 +00:00
|
|
|
void setUsePixmapCaching(bool b) { (*m_profile)[STR_AS_UsePixmapCaching] = b; }
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Set whether or not to useSquare Wave plots (where possible)
|
2014-04-17 05:58:57 +00:00
|
|
|
void setSquareWavePlots(bool sw) { (*m_profile)[STR_AS_SquareWave] = sw; }
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Sets the type of overlay flags (which are displayed over the Flow Waveform)
|
2014-04-17 05:58:57 +00:00
|
|
|
void setOverlayType(OverlayDisplayType od) { (*m_profile)[STR_AS_OverlayType] = (int)od; }
|
2013-11-19 04:42:10 +00:00
|
|
|
//! \brief Sets the type of overlay flags (which are displayed over the Flow Waveform)
|
2014-04-17 05:58:57 +00:00
|
|
|
void setOverviewLinechartMode(OverviewLinechartModes od) { (*m_profile)[STR_AS_OverviewLinechartMode] = (int)od; }
|
2013-10-26 13:59:37 +00:00
|
|
|
//! \brief Sets whether to allow double clicking on Y-Axis labels to change vertical scaling mode
|
2014-04-17 05:58:57 +00:00
|
|
|
void setAllowYAxisScaling(bool b) { (*m_profile)[STR_AS_AllowYAxisScaling] = b; }
|
2013-10-26 13:59:37 +00:00
|
|
|
//! \brief Sets whether to allow double clicking on Y-Axis labels to change vertical scaling mode
|
2014-04-17 05:58:57 +00:00
|
|
|
void setGraphTooltips(bool b) { (*m_profile)[STR_AS_GraphTooltips] = b; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
|
|
|
Profile *m_profile;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*! \class UserSettings
|
|
|
|
\brief Profile Options relating to General User Settings
|
|
|
|
*/
|
|
|
|
class UserSettings
|
|
|
|
{
|
2014-04-17 05:58:57 +00:00
|
|
|
public:
|
2011-12-21 11:09:50 +00:00
|
|
|
//! \brief Create UserSettings object given Profile *p, and initialize the defaults
|
2014-04-17 05:58:57 +00:00
|
|
|
UserSettings(Profile *p) : m_profile(p) {
|
|
|
|
if (!m_profile->contains(STR_US_UnitSystem)) { (*m_profile)[STR_US_UnitSystem] = US_Metric; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_US_EventWindowSize)) { (*m_profile)[STR_US_EventWindowSize] = 4.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_US_SkipEmptyDays)) { (*m_profile)[STR_US_SkipEmptyDays] = true; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_US_RebuildCache)) { (*m_profile)[STR_US_RebuildCache] = false; } // can't remember..
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_US_ShowDebug)) { (*m_profile)[STR_US_ShowDebug] = false; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_US_LinkGroups)) { (*m_profile)[STR_US_LinkGroups] = true; } // can't remember..
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_US_CalculateRDI)) { (*m_profile)[STR_US_CalculateRDI] = false; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_US_ShowSerialNumbers)) { (*m_profile)[STR_US_ShowSerialNumbers] = false; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_US_PrefCalcMiddle)) { (*m_profile)[STR_US_PrefCalcMiddle] = (int)0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_US_PrefCalcPercentile)) { (*m_profile)[STR_US_PrefCalcPercentile] = (double)95.0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_US_PrefCalcMax)) { (*m_profile)[STR_US_PrefCalcMax] = (int)0; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_US_TooltipTimeout)) { (*m_profile)[STR_US_TooltipTimeout] = (int)2500; }
|
|
|
|
|
|
|
|
if (!m_profile->contains(STR_US_ScrollDampening)) { (*m_profile)[STR_US_ScrollDampening] = (int)50; }
|
2011-12-21 11:09:50 +00:00
|
|
|
}
|
|
|
|
~UserSettings() {}
|
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
void setProfile(Profile *p) { m_profile = p; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
2012-01-05 04:37:22 +00:00
|
|
|
UnitSystem unitSystem() { return (UnitSystem)(*m_profile)[STR_US_UnitSystem].toInt(); }
|
|
|
|
double eventWindowSize() { return (*m_profile)[STR_US_EventWindowSize].toDouble(); }
|
|
|
|
bool skipEmptyDays() { return (*m_profile)[STR_US_SkipEmptyDays].toBool(); }
|
|
|
|
bool rebuildCache() { return (*m_profile)[STR_US_RebuildCache].toBool(); }
|
|
|
|
bool showDebug() { return (*m_profile)[STR_US_ShowDebug].toBool(); }
|
|
|
|
bool linkGroups() { return (*m_profile)[STR_US_LinkGroups].toBool(); }
|
|
|
|
bool calculateRDI() { return (*m_profile)[STR_US_CalculateRDI].toBool(); }
|
|
|
|
bool showSerialNumbers() { return (*m_profile)[STR_US_ShowSerialNumbers].toBool(); }
|
2012-01-12 22:46:06 +00:00
|
|
|
int prefCalcMiddle() { return (*m_profile)[STR_US_PrefCalcMiddle].toInt(); }
|
|
|
|
double prefCalcPercentile() { return (*m_profile)[STR_US_PrefCalcPercentile].toDouble(); }
|
|
|
|
int prefCalcMax() { return (*m_profile)[STR_US_PrefCalcMax].toInt(); }
|
2012-05-16 17:04:22 +00:00
|
|
|
int tooltipTimeout() { return (*m_profile)[STR_US_TooltipTimeout].toInt(); }
|
2013-11-09 03:13:15 +00:00
|
|
|
int scrollDampening() { return (*m_profile)[STR_US_ScrollDampening].toInt(); }
|
2012-01-12 22:46:06 +00:00
|
|
|
|
2012-01-05 04:37:22 +00:00
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
void setUnitSystem(UnitSystem us) { (*m_profile)[STR_US_UnitSystem] = (int)us; }
|
|
|
|
void setEventWindowSize(double size) { (*m_profile)[STR_US_EventWindowSize] = size; }
|
|
|
|
void setSkipEmptyDays(bool skip) { (*m_profile)[STR_US_SkipEmptyDays] = skip; }
|
|
|
|
void setRebuildCache(bool rebuild) { (*m_profile)[STR_US_RebuildCache] = rebuild; }
|
|
|
|
void setShowDebug(bool b) { (*m_profile)[STR_US_ShowDebug] = b; }
|
|
|
|
void setLinkGroups(bool link) { (*m_profile)[STR_US_LinkGroups] = link; }
|
|
|
|
void setCalculateRDI(bool rdi) { (*m_profile)[STR_US_CalculateRDI] = rdi; }
|
|
|
|
void setShowSerialNumbers(bool enabled) { (*m_profile)[STR_US_ShowSerialNumbers] = enabled; }
|
|
|
|
void setPrefCalcMiddle(int i) { (*m_profile)[STR_US_PrefCalcMiddle] = i; }
|
|
|
|
void setPrefCalcPercentile(double p) { (*m_profile)[STR_US_PrefCalcPercentile] = p; }
|
|
|
|
void setPrefCalcMax(int i) { (*m_profile)[STR_US_PrefCalcMax] = i; }
|
|
|
|
void setTooltipTimeout(int i) { (*m_profile)[STR_US_TooltipTimeout] = i; }
|
|
|
|
void setScrollDampening(int i) { (*m_profile)[STR_US_ScrollDampening] = i; }
|
2011-12-21 11:09:50 +00:00
|
|
|
|
|
|
|
Profile *m_profile;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
namespace Profiles {
|
2011-06-26 08:30:44 +00:00
|
|
|
|
2014-04-17 05:58:57 +00:00
|
|
|
extern QMap<QString, Profile *> profiles;
|
2011-06-26 08:30:44 +00:00
|
|
|
void Scan(); // Initialize and load Profile
|
|
|
|
void Done(); // Save all Profile objects and clear list
|
|
|
|
|
2011-10-01 12:54:20 +00:00
|
|
|
Profile *Create(QString name);
|
2011-06-26 08:30:44 +00:00
|
|
|
Profile *Get(QString name);
|
|
|
|
Profile *Get();
|
|
|
|
|
2011-12-21 11:09:50 +00:00
|
|
|
}
|
2011-06-26 08:30:44 +00:00
|
|
|
|
|
|
|
#endif //PROFILES_H
|
|
|
|
|