diff --git a/oscar/SleepLib/appsettings.cpp b/oscar/SleepLib/appsettings.cpp index b1792b60..101c06cc 100644 --- a/oscar/SleepLib/appsettings.cpp +++ b/oscar/SleepLib/appsettings.cpp @@ -39,6 +39,7 @@ AppWideSetting::AppWideSetting(Preferences *pref) : PrefSettings(pref) initPref(STR_AS_RightSidebarVisible, false); initPref(STR_CS_UserEventPieChart, false); initPref(STR_US_ShowSerialNumbers, false); + initPref(STR_US_ShowPersonalData, true); initPref(STR_US_OpenTabAtStart, 1); initPref(STR_US_OpenTabAfterImport, 0); initPref(STR_US_AutoLaunchImport, false); diff --git a/oscar/SleepLib/appsettings.h b/oscar/SleepLib/appsettings.h index a90eee75..3d9d3373 100644 --- a/oscar/SleepLib/appsettings.h +++ b/oscar/SleepLib/appsettings.h @@ -52,6 +52,7 @@ const QString STR_US_OpenTabAfterImport = "OpenTabAfterImport"; const QString STR_US_AutoLaunchImport = "AutoLaunchImport"; const QString STR_US_RemoveCardReminder = "RemoveCardReminder"; const QString STR_US_DontAskWhenSavingScreenshots = "DontAskWhenSavingScreenshots"; +const QString STR_US_ShowPersonalData = "ShowPersonalData"; const QString STR_IS_CacheSessions = "MemoryHog"; const QString STR_GEN_AutoOpenLastUsed = "AutoOpenLastUsed"; @@ -141,6 +142,7 @@ public: bool dontAskWhenSavingScreenshots() const { return getPref(STR_US_DontAskWhenSavingScreenshots).toBool(); } bool autoOpenLastUsed() const { return getPref(STR_GEN_AutoOpenLastUsed).toBool(); } inline const QString & language() const { return m_language; } + bool showPersonalData() const { return getPref(STR_US_ShowPersonalData).toBool(); } void setProfileName(QString name) { setPref(STR_GEN_Profile, m_profileName=name); } void setAutoLaunchImport(bool b) { setPref(STR_US_AutoLaunchImport, b); } @@ -191,6 +193,7 @@ public: void setOpenTabAfterImport(int idx) { setPref(STR_US_OpenTabAfterImport, idx); } void setRemoveCardReminder(bool b) { setPref(STR_US_RemoveCardReminder, b); } void setDontAskWhenSavingScreenshots(bool b) { setPref(STR_US_DontAskWhenSavingScreenshots, b); } + void setShowPersonalData(bool b) { setPref(STR_US_ShowPersonalData, b); } void setVersionString(QString version) { setPref(STR_PREF_VersionString, version); } #ifndef NO_UPDATER diff --git a/oscar/SleepLib/deviceconnection.cpp b/oscar/SleepLib/deviceconnection.cpp new file mode 100644 index 00000000..23f6c5bb --- /dev/null +++ b/oscar/SleepLib/deviceconnection.cpp @@ -0,0 +1,28 @@ +/* Device Connection Class Implementation + * + * Copyright (c) 2020 The OSCAR Team + * + * 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 source code + * for more details. */ + +#include "deviceconnection.h" + +SerialPortInfo::SerialPortInfo(const QSerialPortInfo & other) + : QSerialPortInfo(other) +{ +} + +SerialPortInfo::SerialPortInfo(const SerialPortInfo & other) + : QSerialPortInfo(dynamic_cast(other)) +{ +} + +QList SerialPortInfo::availablePorts() +{ + QList out; + for (auto & info : QSerialPortInfo::availablePorts()) { + out.append(SerialPortInfo(info)); + } + return out; +} diff --git a/oscar/SleepLib/deviceconnection.h b/oscar/SleepLib/deviceconnection.h new file mode 100644 index 00000000..ce424a56 --- /dev/null +++ b/oscar/SleepLib/deviceconnection.h @@ -0,0 +1,38 @@ +/* Device Connection Class Header + * + * Copyright (c) 2020 The OSCAR Team + * + * 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 source code + * for more details. */ + +#ifndef DEVICECONNECTION_H +#define DEVICECONNECTION_H + +// TODO: This file will eventually abstract serial port or bluetooth (or other) +// connections to devices. For now it just supports serial ports. + +#include +#include + +// TODO: This class may eventually be internal to a DeviceConnection class, +// but for now it is used to provide support for recording and playback of +// serial port connections before refactoring. +class SerialPort : public QSerialPort +{ +}; + +// TODO: This class's functionality will eventually be internal to a +// DeviceConnection class, but for now it is needed to support recording +// and playback of serial port scanning before refactoring. +class SerialPortInfo : public QSerialPortInfo +{ +public: + static QList availablePorts(); + SerialPortInfo(const SerialPortInfo & other); + +protected: + SerialPortInfo(const QSerialPortInfo & other); +}; + +#endif // DEVICECONNECTION_H diff --git a/oscar/SleepLib/serialoximeter.cpp b/oscar/SleepLib/serialoximeter.cpp index 3e98e4d4..0b1acb64 100644 --- a/oscar/SleepLib/serialoximeter.cpp +++ b/oscar/SleepLib/serialoximeter.cpp @@ -1,13 +1,12 @@ /* SleepLib Machine Loader Class Implementation * * Copyright (c) 2011-2018 Mark Watkins + * Copyright (c) 2020 The OSCAR Team * * 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 source code * for more details. */ -#include - #include "serialoximeter.h" // Possibly need to replan this to include oximetry @@ -31,11 +30,11 @@ bool SerialOximeter::scanDevice(QString keyword, quint16 vendor_id, quint16 prod QStringList ports; qDebug() << "seroxi - Scanning for USB Serial devices"; - QList list=QSerialPortInfo::availablePorts(); + QList list=SerialPortInfo::availablePorts(); // How does the mac detect this as a SPO2 device? for (int i=0;iportName(); QString desc = info->description(); diff --git a/oscar/SleepLib/serialoximeter.h b/oscar/SleepLib/serialoximeter.h index 5a018269..e8a8e19c 100644 --- a/oscar/SleepLib/serialoximeter.h +++ b/oscar/SleepLib/serialoximeter.h @@ -1,6 +1,7 @@ -/* SleepLib MachineLoader Base Class Header +/* SleepLib MachineLoader Base Class Header * * Copyright (C) 2011-2018 Mark Watkins + * Copyright (c) 2020 The OSCAR Team * * 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 source code @@ -10,7 +11,7 @@ #define SERIALOXIMETER_H #include -#include +#include "SleepLib/deviceconnection.h" #include "SleepLib/machine_loader.h" @@ -126,7 +127,7 @@ protected: virtual void requestData() {} QString port; - QSerialPort serial; + SerialPort serial; QTimer startTimer; QTimer resetTimer; diff --git a/oscar/mainwindow.cpp b/oscar/mainwindow.cpp index 0762f547..d8f79733 100644 --- a/oscar/mainwindow.cpp +++ b/oscar/mainwindow.cpp @@ -226,6 +226,8 @@ void MainWindow::SetupGUI() ui->action_Sidebar_Toggle->setChecked(b); ui->toolBox->setVisible(b); + ui->actionShowPersonalData->setChecked(AppSetting->showPersonalData()); + ui->actionPie_Chart->setChecked(AppSetting->showPieChart()); ui->actionDaily_Calendar->setChecked(AppSetting->calendarVisible()); @@ -2710,6 +2712,12 @@ void MainWindow::on_actionDaily_Calendar_toggled(bool visible) if (daily) daily->setCalendarVisible(visible); } +void MainWindow::on_actionShowPersonalData_toggled(bool visible) +{ + AppSetting->setShowPersonalData(visible); + GenerateStatistics(); +} + #include "SleepLib/journal.h" void MainWindow::on_actionExport_Journal_triggered() diff --git a/oscar/mainwindow.h b/oscar/mainwindow.h index ee2444ba..8abed614 100644 --- a/oscar/mainwindow.h +++ b/oscar/mainwindow.h @@ -362,6 +362,8 @@ class MainWindow : public QMainWindow void on_statisticsView_anchorClicked(const QUrl &url); + void on_actionShowPersonalData_toggled(bool visible); + private: QString getMainWindowTitle(); diff --git a/oscar/mainwindow.ui b/oscar/mainwindow.ui index e6af849c..fa4933e1 100644 --- a/oscar/mainwindow.ui +++ b/oscar/mainwindow.ui @@ -2851,6 +2851,8 @@ p, li { white-space: pre-wrap; } + + @@ -3286,6 +3288,17 @@ p, li { white-space: pre-wrap; } Advanced graph order, good for ASV, AVAPS + + + true + + + true + + + Show Personal Data + + diff --git a/oscar/oscar.pro b/oscar/oscar.pro index be134f98..c0c6ea9d 100644 --- a/oscar/oscar.pro +++ b/oscar/oscar.pro @@ -302,6 +302,7 @@ SOURCES += \ translation.cpp \ statistics.cpp \ oximeterimport.cpp \ + SleepLib/deviceconnection.cpp \ SleepLib/serialoximeter.cpp \ SleepLib/loader_plugins/md300w1_loader.cpp \ Graphs/gSessionTimesChart.cpp \ @@ -381,6 +382,7 @@ HEADERS += \ translation.h \ statistics.h \ oximeterimport.h \ + SleepLib/deviceconnection.h \ SleepLib/serialoximeter.h \ SleepLib/loader_plugins/md300w1_loader.h \ Graphs/gSessionTimesChart.h \ diff --git a/oscar/reports.cpp b/oscar/reports.cpp index 1449b797..d426596e 100644 --- a/oscar/reports.cpp +++ b/oscar/reports.cpp @@ -141,7 +141,7 @@ void Report::PrintReport(gGraphView *gv, QString name, QDate date) int maxy = 0; - if (!p_profile->user->firstName().isEmpty()) { + if (AppSetting->showPersonalData() && !p_profile->user->firstName().isEmpty()) { QString userinfo = STR_TR_Name + QString(":\t %1, %2\n"). arg(p_profile->user->lastName()). arg(p_profile->user->firstName()); diff --git a/oscar/statistics.cpp b/oscar/statistics.cpp index c7ce28a8..0c4fc67e 100644 --- a/oscar/statistics.cpp +++ b/oscar/statistics.cpp @@ -620,6 +620,10 @@ Statistics::Statistics(QObject *parent) : // Get the user information block for displaying at top of page QString Statistics::getUserInfo () { + bool test = AppSetting->showPersonalData(); + if (!test) + return ""; + QString address = p_profile->user->address(); address.replace("\n", "
");