Merge branch 'master' into vAuto-Settings
@ -3513,13 +3513,20 @@ void gGraphView::SaveDefaultSettings() {
|
|||||||
m_default_graphs = m_graphs;
|
m_default_graphs = m_graphs;
|
||||||
}
|
}
|
||||||
|
|
||||||
const quint32 gvmagic = 0x41756728;
|
const quint32 gvmagic = 0x41756728; //'Aug('
|
||||||
const quint16 gvversion = 4;
|
const quint16 gvversion = 4;
|
||||||
|
|
||||||
void gGraphView::SaveSettings(QString title)
|
QString gGraphView::settingsFilename (QString title,QString folderName, QString ext) {
|
||||||
|
if (folderName.size()==0) {
|
||||||
|
folderName = p_profile->Get("{DataFolder}/");
|
||||||
|
}
|
||||||
|
return folderName+title.toLower()+ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gGraphView::SaveSettings(QString title,QString folderName)
|
||||||
{
|
{
|
||||||
qDebug() << "Saving" << title << "settings";
|
qDebug() << "Saving" << title << "settings";
|
||||||
QString filename = p_profile->Get("{DataFolder}/") + title.toLower() + ".shg";
|
QString filename=settingsFilename(title,folderName) ;
|
||||||
QFile f(filename);
|
QFile f(filename);
|
||||||
f.open(QFile::WriteOnly);
|
f.open(QFile::WriteOnly);
|
||||||
QDataStream out(&f);
|
QDataStream out(&f);
|
||||||
@ -3571,9 +3578,10 @@ template <class T> inline void hashMerge(T & a, const T & b)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool gGraphView::LoadSettings(QString title)
|
bool gGraphView::LoadSettings(QString title,QString folderName)
|
||||||
{
|
{
|
||||||
QString filename = p_profile->Get("{DataFolder}/") + title.toLower() + ".shg";
|
//qDebug() << "Loading" << title << "settings";
|
||||||
|
QString filename=settingsFilename (title,folderName) ;
|
||||||
QFile f(filename);
|
QFile f(filename);
|
||||||
|
|
||||||
if (!f.exists()) {
|
if (!f.exists()) {
|
||||||
|
@ -396,11 +396,13 @@ class gGraphView
|
|||||||
//! \brief Supplies time range to all graph objects in linked group, refreshing if requested
|
//! \brief Supplies time range to all graph objects in linked group, refreshing if requested
|
||||||
void SetXBounds(qint64 minx, qint64 maxx, short group = 0, bool refresh = true);
|
void SetXBounds(qint64 minx, qint64 maxx, short group = 0, bool refresh = true);
|
||||||
|
|
||||||
|
QString settingsFilename (QString title,QString folderName="" ,QString ext=".shg");
|
||||||
|
|
||||||
//! \brief Saves the current graph order, heights, min & Max Y values to disk
|
//! \brief Saves the current graph order, heights, min & Max Y values to disk
|
||||||
void SaveSettings(QString title);
|
void SaveSettings(QString title,QString folderName="");
|
||||||
|
|
||||||
//! \brief Loads the current graph order, heights, min & max Y values from disk
|
//! \brief Loads the current graph order, heights, min & max Y values from disk
|
||||||
bool LoadSettings(QString title);
|
bool LoadSettings(QString title,QString folderName="");
|
||||||
|
|
||||||
//! \brief Saves the current (initial) graph order, heights, min & Max Y values for future recovery
|
//! \brief Saves the current (initial) graph order, heights, min & Max Y values for future recovery
|
||||||
void SaveDefaultSettings();
|
void SaveDefaultSettings();
|
||||||
|
@ -1086,8 +1086,12 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion ®ion)
|
|||||||
double sum = 0;
|
double sum = 0;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
||||||
// Draw the linechart overlays
|
//Draw the linechart overlays (Event flags) independant of line Cursor mode
|
||||||
if (m_day && (AppSetting->lineCursorMode() || (m_codes[0]==CPAP_FlowRate))) {
|
//The problem was that turning lineCUrsor mode off (or Control L) also stopped flag event on most daily graphs.
|
||||||
|
// The user didn't know what trigger the problem. Best quess is that Control L was typed by mistable.
|
||||||
|
// this fix allows flag events to be normally displayed when the line Cursor mode is off.
|
||||||
|
//was if (m_day /*&& (AppSetting->lineCursorMode() || (m_codes[0]==CPAP_FlowRate))*/)
|
||||||
|
if (m_day) {
|
||||||
bool blockhover = false;
|
bool blockhover = false;
|
||||||
for (auto fit=flags.begin(), end=flags.end(); fit != end; ++fit) {
|
for (auto fit=flags.begin(), end=flags.end(); fit != end; ++fit) {
|
||||||
code = fit.key();
|
code = fit.key();
|
||||||
|
@ -58,5 +58,14 @@
|
|||||||
<file>icons/fp_icon.png</file>
|
<file>icons/fp_icon.png</file>
|
||||||
<file>icons/up-down.png</file>
|
<file>icons/up-down.png</file>
|
||||||
<file>icons/warning.png</file>
|
<file>icons/warning.png</file>
|
||||||
|
<file>icons/exit.png</file>
|
||||||
|
<file>icons/plus.png</file>
|
||||||
|
<file>icons/rename.png</file>
|
||||||
|
<file>icons/restore.png</file>
|
||||||
|
<file>icons/trash_can.png</file>
|
||||||
|
<file>icons/update.png</file>
|
||||||
|
<file>icons/cog.png</file>
|
||||||
|
<file>icons/question_mark.png</file>
|
||||||
|
<file>icons/return.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -239,8 +239,8 @@ QStringList ViatomLoader::getNameFilter()
|
|||||||
// Sometimes the files have a SleepU_ or O2Ring_ prefix.
|
// Sometimes the files have a SleepU_ or O2Ring_ prefix.
|
||||||
// Sometimes they have punctuation in the timestamp.
|
// Sometimes they have punctuation in the timestamp.
|
||||||
// Note that ":" is not allowed on macOS, so Mac users will need to rename their files in order to select and import them.
|
// Note that ":" is not allowed on macOS, so Mac users will need to rename their files in order to select and import them.
|
||||||
return QStringList({"*20[0-5][0-9][01][0-9][0-3][0-9][012][0-9][0-5][0-9][0-5][0-9]",
|
return QStringList({"*20[0-5][0-9][01][0-9][0-3][0-9][012][0-9][0-5][0-9][0-5][0-9]*",
|
||||||
"*20[0-5][0-9]-[01][0-9]-[0-3][0-9] [012][0-9]:[0-5][0-9]:[0-5][0-9]"
|
"*20[0-5][0-9]-[01][0-9]-[0-3][0-9] [012][0-9]:[0-5][0-9]:[0-5][0-9]*"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
* License. See the file COPYING in the main directory of the source code
|
* License. See the file COPYING in the main directory of the source code
|
||||||
* for more details. */
|
* for more details. */
|
||||||
|
|
||||||
|
#define TEST_MACROS_ENABLEDoff
|
||||||
|
#include <test_macros.h>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@ -2101,7 +2104,7 @@ void Profile::loadChannels()
|
|||||||
|
|
||||||
if (chan->isNull()) {
|
if (chan->isNull()) {
|
||||||
qDebug() << "loadChannels has no idea about channel" << name;
|
qDebug() << "loadChannels has no idea about channel" << name;
|
||||||
if (in.atEnd()) return;
|
if (in.atEnd()) break;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
chan->setEnabled(enabled);
|
chan->setEnabled(enabled);
|
||||||
@ -2122,8 +2125,14 @@ void Profile::loadChannels()
|
|||||||
chan->setUpperThresholdColor(upperThresholdColor);
|
chan->setUpperThresholdColor(upperThresholdColor);
|
||||||
|
|
||||||
chan->setShowInOverview(showOverview);
|
chan->setShowInOverview(showOverview);
|
||||||
if (in.atEnd()) return;
|
if (in.atEnd()) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
f.close();
|
f.close();
|
||||||
|
refrehOxiChannelsPref();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Profile::refrehOxiChannelsPref() {
|
||||||
|
schema::channel[OXI_Pulse].setLowerThreshold(oxi->flagPulseBelow());
|
||||||
|
schema::channel[OXI_Pulse].setUpperThreshold(oxi->flagPulseAbove());
|
||||||
|
schema::channel[OXI_SPO2].setLowerThreshold(oxi->oxiDesaturationThreshold());
|
||||||
|
};
|
||||||
|
@ -216,6 +216,7 @@ class Profile : public Preferences
|
|||||||
|
|
||||||
void loadChannels();
|
void loadChannels();
|
||||||
void saveChannels();
|
void saveChannels();
|
||||||
|
void refrehOxiChannelsPref();
|
||||||
|
|
||||||
|
|
||||||
bool is_first_day;
|
bool is_first_day;
|
||||||
@ -299,7 +300,11 @@ const QString STR_OS_SPO2DropDuration = "SPO2DropDuration";
|
|||||||
const QString STR_OS_SPO2DropPercentage = "SPO2DropPercentage";
|
const QString STR_OS_SPO2DropPercentage = "SPO2DropPercentage";
|
||||||
const QString STR_OS_PulseChangeDuration = "PulseChangeDuration";
|
const QString STR_OS_PulseChangeDuration = "PulseChangeDuration";
|
||||||
const QString STR_OS_PulseChangeBPM = "PulseChangeBPM";
|
const QString STR_OS_PulseChangeBPM = "PulseChangeBPM";
|
||||||
|
|
||||||
const QString STR_OS_SkipOxiIntroScreen = "SkipOxiIntroScreen";
|
const QString STR_OS_SkipOxiIntroScreen = "SkipOxiIntroScreen";
|
||||||
|
const QString STR_OS_oxiDesaturationThreshold = "oxiDesaturationThreshold";
|
||||||
|
const QString STR_OS_flagPulseAbove = "flagPulseAbove";
|
||||||
|
const QString STR_OS_flagPulseBelow = "flagPulseBelow";
|
||||||
|
|
||||||
|
|
||||||
// CPAPSettings Strings
|
// CPAPSettings Strings
|
||||||
@ -489,6 +494,10 @@ class OxiSettings : public PrefSettings
|
|||||||
initPref(STR_OS_PulseChangeDuration, 8.0);
|
initPref(STR_OS_PulseChangeDuration, 8.0);
|
||||||
initPref(STR_OS_PulseChangeBPM, 5.0);
|
initPref(STR_OS_PulseChangeBPM, 5.0);
|
||||||
initPref(STR_OS_SkipOxiIntroScreen, false);
|
initPref(STR_OS_SkipOxiIntroScreen, false);
|
||||||
|
|
||||||
|
initPref(STR_OS_oxiDesaturationThreshold, 88);
|
||||||
|
initPref(STR_OS_flagPulseAbove, 130);
|
||||||
|
initPref(STR_OS_flagPulseBelow, 40);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool oximetryEnabled() const { return getPref(STR_OS_EnableOximetry).toBool(); }
|
bool oximetryEnabled() const { return getPref(STR_OS_EnableOximetry).toBool(); }
|
||||||
@ -502,6 +511,10 @@ class OxiSettings : public PrefSettings
|
|||||||
double pulseChangeBPM() const { return getPref(STR_OS_PulseChangeBPM).toDouble(); }
|
double pulseChangeBPM() const { return getPref(STR_OS_PulseChangeBPM).toDouble(); }
|
||||||
bool skipOxiIntroScreen() const { return getPref(STR_OS_SkipOxiIntroScreen).toBool(); }
|
bool skipOxiIntroScreen() const { return getPref(STR_OS_SkipOxiIntroScreen).toBool(); }
|
||||||
|
|
||||||
|
double oxiDesaturationThreshold() const { return getPref(STR_OS_oxiDesaturationThreshold).toDouble(); }
|
||||||
|
double flagPulseAbove() const { return getPref(STR_OS_flagPulseAbove).toDouble(); }
|
||||||
|
double flagPulseBelow() const { return getPref(STR_OS_flagPulseBelow).toDouble(); }
|
||||||
|
|
||||||
|
|
||||||
void setOximetryEnabled(bool enabled) { setPref(STR_OS_EnableOximetry, enabled); }
|
void setOximetryEnabled(bool enabled) { setPref(STR_OS_EnableOximetry, enabled); }
|
||||||
void setDefaultDevice(QString name) { setPref(STR_OS_DefaultDevice, name); }
|
void setDefaultDevice(QString name) { setPref(STR_OS_DefaultDevice, name); }
|
||||||
@ -517,6 +530,9 @@ class OxiSettings : public PrefSettings
|
|||||||
void setPulseChangeDuration(double duration) {
|
void setPulseChangeDuration(double duration) {
|
||||||
setPref(STR_OS_PulseChangeDuration, duration);
|
setPref(STR_OS_PulseChangeDuration, duration);
|
||||||
}
|
}
|
||||||
|
void setOxiDesaturationThreshold(double value) { setPref(STR_OS_oxiDesaturationThreshold, value); }
|
||||||
|
void setFlagPulseAbove(double value) { setPref(STR_OS_flagPulseAbove, value); }
|
||||||
|
void setFlagPulseBelow(double value) { setPref(STR_OS_flagPulseBelow, value); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \class CPAPSettings
|
/*! \class CPAPSettings
|
||||||
|
@ -203,12 +203,9 @@ void init()
|
|||||||
// Oximetry
|
// Oximetry
|
||||||
schema::channel.add(GRP_OXI, new Channel(OXI_Pulse = 0x1800, WAVEFORM, MT_OXIMETER, SESSION, STR_GRAPH_Oxi_Pulse,
|
schema::channel.add(GRP_OXI, new Channel(OXI_Pulse = 0x1800, WAVEFORM, MT_OXIMETER, SESSION, STR_GRAPH_Oxi_Pulse,
|
||||||
QObject::tr("Pulse Rate"), QObject::tr("Heart rate in beats per minute"), QObject::tr("Pulse Rate"), STR_UNIT_BPM, DEFAULT, QColor("red")));
|
QObject::tr("Pulse Rate"), QObject::tr("Heart rate in beats per minute"), QObject::tr("Pulse Rate"), STR_UNIT_BPM, DEFAULT, QColor("red")));
|
||||||
schema::channel[OXI_Pulse].setLowerThreshold(40);
|
|
||||||
schema::channel[OXI_Pulse].setUpperThreshold(130);
|
|
||||||
|
|
||||||
schema::channel.add(GRP_OXI, new Channel(OXI_SPO2 = 0x1801, WAVEFORM, MT_OXIMETER, SESSION, STR_GRAPH_Oxi_SPO2,
|
schema::channel.add(GRP_OXI, new Channel(OXI_SPO2 = 0x1801, WAVEFORM, MT_OXIMETER, SESSION, STR_GRAPH_Oxi_SPO2,
|
||||||
QString("SpO2 %"), QObject::tr("Blood-oxygen saturation percentage"), QString("SpO2"), STR_UNIT_Percentage, DEFAULT, QColor("blue")));
|
QString("SpO2 %"), QObject::tr("Blood-oxygen saturation percentage"), QString("SpO2"), STR_UNIT_Percentage, DEFAULT, QColor("blue")));
|
||||||
schema::channel[OXI_SPO2].setLowerThreshold(88);
|
|
||||||
|
|
||||||
schema::channel.add(GRP_OXI, new Channel(OXI_Plethy = 0x1802, WAVEFORM, MT_OXIMETER, SESSION, STR_GRAPH_Oxi_Plethy,
|
schema::channel.add(GRP_OXI, new Channel(OXI_Plethy = 0x1802, WAVEFORM, MT_OXIMETER, SESSION, STR_GRAPH_Oxi_Plethy,
|
||||||
QObject::tr("Plethysomogram"), QObject::tr("An optical Photo-plethysomogram showing heart rhythm"), QObject::tr("Plethy"), STR_UNIT_Hz, DEFAULT, QColor("#404040")));
|
QObject::tr("Plethysomogram"), QObject::tr("An optical Photo-plethysomogram showing heart rhythm"), QObject::tr("Plethy"), STR_UNIT_Hz, DEFAULT, QColor("#404040")));
|
||||||
@ -396,6 +393,12 @@ void done()
|
|||||||
schema::channel.channels.clear();
|
schema::channel.channels.clear();
|
||||||
schema::channel.groups.clear();
|
schema::channel.groups.clear();
|
||||||
|
|
||||||
|
// ahiChannels did not get cleared since day1 OSCAR when a reset was required.
|
||||||
|
// when reset occured then the Overview AHI graph would should an addtional set of channels.
|
||||||
|
// this fix just clears the variable that stores ahi data.
|
||||||
|
// probelm #59 https://gitlab.com/pholy/OSCAR-code/-/issues/59
|
||||||
|
ahiChannels.clear();
|
||||||
|
|
||||||
schema_initialized = false;
|
schema_initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,6 +541,7 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
|
|||||||
ui->JournalNotes->installEventFilter(this);
|
ui->JournalNotes->installEventFilter(this);
|
||||||
// qDebug() << "Finished making new Daily object";
|
// qDebug() << "Finished making new Daily object";
|
||||||
// sleep(3);
|
// sleep(3);
|
||||||
|
saveGraphLayoutSettings=nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Daily::~Daily()
|
Daily::~Daily()
|
||||||
@ -563,6 +564,7 @@ Daily::~Daily()
|
|||||||
delete ui;
|
delete ui;
|
||||||
delete icon_on;
|
delete icon_on;
|
||||||
delete icon_off;
|
delete icon_off;
|
||||||
|
if (saveGraphLayoutSettings!=nullptr) delete saveGraphLayoutSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Daily::showEvent(QShowEvent *)
|
void Daily::showEvent(QShowEvent *)
|
||||||
@ -600,6 +602,7 @@ void Daily::Link_clicked(const QUrl &url)
|
|||||||
|
|
||||||
// Reload day
|
// Reload day
|
||||||
LoadDate(previous_date);
|
LoadDate(previous_date);
|
||||||
|
mainwin->getOverview()->graphView()->dataChanged();
|
||||||
// webView->page()->mainFrame()->setScrollBarValue(Qt::Vertical, webView->page()->mainFrame()->scrollBarMaximum(Qt::Vertical)-i);
|
// webView->page()->mainFrame()->setScrollBarValue(Qt::Vertical, webView->page()->mainFrame()->scrollBarMaximum(Qt::Vertical)-i);
|
||||||
} else if (code=="toggleoxisession") { // Enable/Disable Oximetry session
|
} else if (code=="toggleoxisession") { // Enable/Disable Oximetry session
|
||||||
day=p_profile->GetDay(previous_date,MT_OXIMETER);
|
day=p_profile->GetDay(previous_date,MT_OXIMETER);
|
||||||
@ -612,6 +615,7 @@ void Daily::Link_clicked(const QUrl &url)
|
|||||||
|
|
||||||
// Reload day
|
// Reload day
|
||||||
LoadDate(previous_date);
|
LoadDate(previous_date);
|
||||||
|
mainwin->getOverview()->graphView()->dataChanged();
|
||||||
// webView->page()->mainFrame()->setScrollBarValue(Qt::Vertical, webView->page()->mainFrame()->scrollBarMaximum(Qt::Vertical)-i);
|
// webView->page()->mainFrame()->setScrollBarValue(Qt::Vertical, webView->page()->mainFrame()->scrollBarMaximum(Qt::Vertical)-i);
|
||||||
} else if (code=="togglestagesession") { // Enable/Disable Sleep Stage session
|
} else if (code=="togglestagesession") { // Enable/Disable Sleep Stage session
|
||||||
day=p_profile->GetDay(previous_date,MT_SLEEPSTAGE);
|
day=p_profile->GetDay(previous_date,MT_SLEEPSTAGE);
|
||||||
@ -620,6 +624,7 @@ void Daily::Link_clicked(const QUrl &url)
|
|||||||
if (!sess) return;
|
if (!sess) return;
|
||||||
sess->setEnabled(!sess->enabled());
|
sess->setEnabled(!sess->enabled());
|
||||||
LoadDate(previous_date);
|
LoadDate(previous_date);
|
||||||
|
mainwin->getOverview()->graphView()->dataChanged();
|
||||||
} else if (code=="togglepositionsession") { // Enable/Disable Position session
|
} else if (code=="togglepositionsession") { // Enable/Disable Position session
|
||||||
day=p_profile->GetDay(previous_date,MT_POSITION);
|
day=p_profile->GetDay(previous_date,MT_POSITION);
|
||||||
if (!day) return;
|
if (!day) return;
|
||||||
@ -627,6 +632,7 @@ void Daily::Link_clicked(const QUrl &url)
|
|||||||
if (!sess) return;
|
if (!sess) return;
|
||||||
sess->setEnabled(!sess->enabled());
|
sess->setEnabled(!sess->enabled());
|
||||||
LoadDate(previous_date);
|
LoadDate(previous_date);
|
||||||
|
mainwin->getOverview()->graphView()->dataChanged();
|
||||||
} else if (code=="cpap") {
|
} else if (code=="cpap") {
|
||||||
day=p_profile->GetDay(previous_date,MT_CPAP);
|
day=p_profile->GetDay(previous_date,MT_CPAP);
|
||||||
if (day) {
|
if (day) {
|
||||||
@ -1681,9 +1687,10 @@ void Daily::Load(QDate date)
|
|||||||
ui->eventsCombo->addItem(*icon_up_down, tr("10 of 10 Event Types"), 0); // Translation used only for spacing
|
ui->eventsCombo->addItem(*icon_up_down, tr("10 of 10 Event Types"), 0); // Translation used only for spacing
|
||||||
for (int i=0; i < available.size(); ++i) {
|
for (int i=0; i < available.size(); ++i) {
|
||||||
ChannelID code = available.at(i);
|
ChannelID code = available.at(i);
|
||||||
|
int comboxBoxIndex = i+1;
|
||||||
schema::Channel & chan = schema::channel[code];
|
schema::Channel & chan = schema::channel[code];
|
||||||
ui->eventsCombo->addItem(chan.enabled() ? *icon_on : * icon_off, chan.label(), code);
|
ui->eventsCombo->addItem(chan.enabled() ? *icon_on : * icon_off, chan.label(), code);
|
||||||
ui->eventsCombo->setItemData(i, chan.fullname(), Qt::ToolTipRole);
|
ui->eventsCombo->setItemData(comboxBoxIndex, chan.fullname(), Qt::ToolTipRole);
|
||||||
}
|
}
|
||||||
setFlagText();
|
setFlagText();
|
||||||
|
|
||||||
@ -2849,3 +2856,13 @@ void Daily::on_splitter_2_splitterMoved(int, int)
|
|||||||
// qDebug() << "Left Panel width set to " << size;
|
// qDebug() << "Left Panel width set to " << size;
|
||||||
AppSetting->setDailyPanelWidth(size);
|
AppSetting->setDailyPanelWidth(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Daily::on_layout_clicked() {
|
||||||
|
if (!saveGraphLayoutSettings) {
|
||||||
|
saveGraphLayoutSettings= new SaveGraphLayoutSettings("daily",this);
|
||||||
|
}
|
||||||
|
if (saveGraphLayoutSettings) {
|
||||||
|
saveGraphLayoutSettings->menu(GraphView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "Graphs/gLineChart.h"
|
#include "Graphs/gLineChart.h"
|
||||||
#include "sessionbar.h"
|
#include "sessionbar.h"
|
||||||
#include "mytextbrowser.h"
|
#include "mytextbrowser.h"
|
||||||
|
#include "saveGraphLayoutSettings.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -272,6 +273,8 @@ private slots:
|
|||||||
|
|
||||||
void on_splitter_2_splitterMoved(int pos, int index);
|
void on_splitter_2_splitterMoved(int pos, int index);
|
||||||
|
|
||||||
|
void on_layout_clicked();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *);
|
virtual void showEvent(QShowEvent *);
|
||||||
|
|
||||||
@ -360,6 +363,7 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
bool BookmarksChanged;
|
bool BookmarksChanged;
|
||||||
|
|
||||||
|
SaveGraphLayoutSettings* saveGraphLayoutSettings=nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DAILY_H
|
#endif // DAILY_H
|
||||||
|
@ -1557,6 +1557,20 @@ QToolButton:pressed {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="layout">
|
||||||
|
<property name="text">
|
||||||
|
<string>Layout</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="Resources.qrc">
|
||||||
|
<normaloff>:/icons/cog.png</normaloff>:/icons/cog.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Save and Restore Graph Layout Settings</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="graphCombo">
|
<widget class="QComboBox" name="graphCombo">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
BIN
oscar/icons/cog.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
oscar/icons/exit.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
oscar/icons/plus.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
oscar/icons/question_mark.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
oscar/icons/rename.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
oscar/icons/restore.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
oscar/icons/return.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
oscar/icons/trash_can.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
oscar/icons/update.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
@ -7,6 +7,10 @@
|
|||||||
* License. See the file COPYING in the main directory of the source code
|
* License. See the file COPYING in the main directory of the source code
|
||||||
* for more details. */
|
* for more details. */
|
||||||
|
|
||||||
|
#define TEST_MACROS_ENABLED
|
||||||
|
#include <test_macros.h>
|
||||||
|
|
||||||
|
|
||||||
#include <QHostInfo>
|
#include <QHostInfo>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
@ -132,6 +136,7 @@ QString MainWindow::getMainWindowTitle()
|
|||||||
void MainWindow::SetupGUI()
|
void MainWindow::SetupGUI()
|
||||||
{
|
{
|
||||||
setupRunning = true;
|
setupRunning = true;
|
||||||
|
|
||||||
setWindowTitle(getMainWindowTitle());
|
setWindowTitle(getMainWindowTitle());
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
@ -233,11 +238,17 @@ void MainWindow::SetupGUI()
|
|||||||
ui->action_Sidebar_Toggle->setChecked(b);
|
ui->action_Sidebar_Toggle->setChecked(b);
|
||||||
ui->toolBox->setVisible(b);
|
ui->toolBox->setVisible(b);
|
||||||
|
|
||||||
|
bool oldState = ui->actionShowPersonalData->blockSignals(true);
|
||||||
ui->actionShowPersonalData->setChecked(AppSetting->showPersonalData());
|
ui->actionShowPersonalData->setChecked(AppSetting->showPersonalData());
|
||||||
|
ui->actionShowPersonalData->blockSignals(oldState);
|
||||||
|
|
||||||
|
oldState = ui->actionPie_Chart->blockSignals(true);
|
||||||
ui->actionPie_Chart->setChecked(AppSetting->showPieChart());
|
ui->actionPie_Chart->setChecked(AppSetting->showPieChart());
|
||||||
|
ui->actionPie_Chart->blockSignals(oldState);
|
||||||
|
|
||||||
|
oldState = ui->actionDaily_Calendar->blockSignals(true);
|
||||||
ui->actionDaily_Calendar->setChecked(AppSetting->calendarVisible());
|
ui->actionDaily_Calendar->setChecked(AppSetting->calendarVisible());
|
||||||
|
ui->actionDaily_Calendar->blockSignals(oldState);
|
||||||
|
|
||||||
on_tabWidget_currentChanged(0);
|
on_tabWidget_currentChanged(0);
|
||||||
|
|
||||||
|
@ -255,6 +255,8 @@ lessThan(QT_MAJOR_VERSION,5)|lessThan(QT_MINOR_VERSION,12) {
|
|||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
checkupdates.cpp \
|
checkupdates.cpp \
|
||||||
|
saveGraphLayoutSettings.cpp \
|
||||||
|
overview.cpp \
|
||||||
common_gui.cpp \
|
common_gui.cpp \
|
||||||
cprogressbar.cpp \
|
cprogressbar.cpp \
|
||||||
daily.cpp \
|
daily.cpp \
|
||||||
@ -262,7 +264,6 @@ SOURCES += \
|
|||||||
main.cpp \
|
main.cpp \
|
||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
newprofile.cpp \
|
newprofile.cpp \
|
||||||
overview.cpp \
|
|
||||||
preferencesdialog.cpp \
|
preferencesdialog.cpp \
|
||||||
# psettings.cpp \
|
# psettings.cpp \
|
||||||
reports.cpp \
|
reports.cpp \
|
||||||
@ -361,13 +362,14 @@ QMAKE_EXTRA_COMPILERS += optimize
|
|||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
checkupdates.h \
|
checkupdates.h \
|
||||||
|
saveGraphLayoutSettings.h \
|
||||||
|
overview.h \
|
||||||
common_gui.h \
|
common_gui.h \
|
||||||
cprogressbar.h \
|
cprogressbar.h \
|
||||||
daily.h \
|
daily.h \
|
||||||
exportcsv.h \
|
exportcsv.h \
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
newprofile.h \
|
newprofile.h \
|
||||||
overview.h \
|
|
||||||
preferencesdialog.h \
|
preferencesdialog.h \
|
||||||
# psettings.h \
|
# psettings.h \
|
||||||
reports.h \
|
reports.h \
|
||||||
|
@ -171,6 +171,7 @@ Overview::Overview(QWidget *parent, gGraphView *shared) :
|
|||||||
connect(GraphView, SIGNAL(updateRange(double,double)), this, SLOT(on_RangeUpdate(double,double)));
|
connect(GraphView, SIGNAL(updateRange(double,double)), this, SLOT(on_RangeUpdate(double,double)));
|
||||||
connect(GraphView, SIGNAL(GraphsChanged()), this, SLOT(updateGraphCombo()));
|
connect(GraphView, SIGNAL(GraphsChanged()), this, SLOT(updateGraphCombo()));
|
||||||
connect(GraphView, SIGNAL(XBoundsChanged(qint64 ,qint64)), this, SLOT(on_XBoundsChanged(qint64 ,qint64)));
|
connect(GraphView, SIGNAL(XBoundsChanged(qint64 ,qint64)), this, SLOT(on_XBoundsChanged(qint64 ,qint64)));
|
||||||
|
saveGraphLayoutSettings=nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Overview::~Overview()
|
Overview::~Overview()
|
||||||
@ -192,6 +193,7 @@ Overview::~Overview()
|
|||||||
delete icon_off ;
|
delete icon_off ;
|
||||||
delete icon_up_down ;
|
delete icon_up_down ;
|
||||||
delete icon_warning ;
|
delete icon_warning ;
|
||||||
|
if (saveGraphLayoutSettings!=nullptr) delete saveGraphLayoutSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overview::ResetFont()
|
void Overview::ResetFont()
|
||||||
@ -308,6 +310,11 @@ void Overview::CreateAllGraphs() {
|
|||||||
G->AddLayer(sc);
|
G->AddLayer(sc);
|
||||||
chartsToBeMonitored.insert(sc,G);
|
chartsToBeMonitored.insert(sc,G);
|
||||||
} else if (chan->type() == schema::WAVEFORM) {
|
} else if (chan->type() == schema::WAVEFORM) {
|
||||||
|
if ((code==CPAP_AHI)||(code==CPAP_Pressure) ) {
|
||||||
|
DEBUGF O("SKIPPING") NAME(code) Q(code);
|
||||||
|
//skip if channel is for AHI.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
sc= new gSummaryChart(code, chan->machtype());
|
sc= new gSummaryChart(code, chan->machtype());
|
||||||
G->AddLayer(sc);
|
G->AddLayer(sc);
|
||||||
chartsToBeMonitored.insert(sc,G);
|
chartsToBeMonitored.insert(sc,G);
|
||||||
@ -933,3 +940,14 @@ void Overview::on_toggleVisibility_clicked(bool checked)
|
|||||||
GraphView->redraw();
|
GraphView->redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Overview::on_layout_clicked() {
|
||||||
|
if (!saveGraphLayoutSettings) {
|
||||||
|
saveGraphLayoutSettings= new SaveGraphLayoutSettings("overview",this);
|
||||||
|
}
|
||||||
|
if (saveGraphLayoutSettings) {
|
||||||
|
saveGraphLayoutSettings->menu(GraphView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +23,11 @@
|
|||||||
#include "Graphs/gOverviewGraph.h"
|
#include "Graphs/gOverviewGraph.h"
|
||||||
#endif
|
#endif
|
||||||
#include "Graphs/gSummaryChart.h"
|
#include "Graphs/gSummaryChart.h"
|
||||||
|
#include "saveGraphLayoutSettings.h"
|
||||||
|
|
||||||
|
#include <QRegularExpression>
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QListWidgetItem>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Overview;
|
class Overview;
|
||||||
@ -140,6 +145,8 @@ class Overview : public QWidget
|
|||||||
void on_RangeUpdate(double minx, double maxx);
|
void on_RangeUpdate(double minx, double maxx);
|
||||||
void setGraphText ();
|
void setGraphText ();
|
||||||
|
|
||||||
|
void on_layout_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CreateAllGraphs();
|
void CreateAllGraphs();
|
||||||
void timedUpdateOverview(int ms=0);
|
void timedUpdateOverview(int ms=0);
|
||||||
@ -193,6 +200,7 @@ class Overview : public QWidget
|
|||||||
// Are start and end widgets displaying the same month.
|
// Are start and end widgets displaying the same month.
|
||||||
bool samePage;
|
bool samePage;
|
||||||
|
|
||||||
|
SaveGraphLayoutSettings* saveGraphLayoutSettings=nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -259,6 +259,20 @@ QToolButton:pressed {
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="layout">
|
||||||
|
<property name="text">
|
||||||
|
<string>Layout</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="Resources.qrc">
|
||||||
|
<normaloff>:/icons/cog.png</normaloff>:/icons/cog.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Save and Restore Graph Layout Settings</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="graphCombo">
|
<widget class="QComboBox" name="graphCombo">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
@ -130,9 +130,10 @@ PreferencesDialog::PreferencesDialog(QWidget *parent, Profile *_profile) :
|
|||||||
ui->showLeakRedline->setChecked(profile->cpap->showLeakRedline());
|
ui->showLeakRedline->setChecked(profile->cpap->showLeakRedline());
|
||||||
ui->leakRedlineSpinbox->setValue(profile->cpap->leakRedline());
|
ui->leakRedlineSpinbox->setValue(profile->cpap->leakRedline());
|
||||||
|
|
||||||
ui->oxiDesaturationThreshold->setValue(schema::channel[OXI_SPO2].lowerThreshold());
|
//change initialization from hard coded in schema to profile data.
|
||||||
ui->flagPulseAbove->setValue(schema::channel[OXI_Pulse].upperThreshold());
|
ui->oxiDesaturationThreshold->setValue(profile->oxi->oxiDesaturationThreshold());
|
||||||
ui->flagPulseBelow->setValue(schema::channel[OXI_Pulse].lowerThreshold());
|
ui->flagPulseAbove->setValue(profile->oxi->flagPulseAbove());
|
||||||
|
ui->flagPulseBelow->setValue(profile->oxi->flagPulseBelow());
|
||||||
|
|
||||||
ui->spo2Drop->setValue(profile->oxi->spO2DropPercentage());
|
ui->spo2Drop->setValue(profile->oxi->spO2DropPercentage());
|
||||||
ui->spo2DropTime->setValue(profile->oxi->spO2DropDuration());
|
ui->spo2DropTime->setValue(profile->oxi->spO2DropDuration());
|
||||||
@ -819,11 +820,6 @@ bool PreferencesDialog::Save()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
schema::channel[OXI_SPO2].setLowerThreshold(ui->oxiDesaturationThreshold->value());
|
|
||||||
schema::channel[OXI_Pulse].setLowerThreshold(ui->flagPulseBelow->value());
|
|
||||||
schema::channel[OXI_Pulse].setUpperThreshold(ui->flagPulseAbove->value());
|
|
||||||
|
|
||||||
|
|
||||||
AppSetting->setUserEventPieChart(ui->showUserFlagsInPie->isChecked());
|
AppSetting->setUserEventPieChart(ui->showUserFlagsInPie->isChecked());
|
||||||
profile->session->setLockSummarySessions(ui->LockSummarySessionSplitting->isChecked());
|
profile->session->setLockSummarySessions(ui->LockSummarySessionSplitting->isChecked());
|
||||||
profile->session->setWarnOnUntestedMachine(ui->warnOnUntestedMachine->isChecked());
|
profile->session->setWarnOnUntestedMachine(ui->warnOnUntestedMachine->isChecked());
|
||||||
@ -898,6 +894,10 @@ bool PreferencesDialog::Save()
|
|||||||
profile->oxi->setPulseChangeDuration(ui->pulseChangeTime->value());
|
profile->oxi->setPulseChangeDuration(ui->pulseChangeTime->value());
|
||||||
profile->oxi->setOxiDiscardThreshold(ui->oxiDiscardThreshold->value());
|
profile->oxi->setOxiDiscardThreshold(ui->oxiDiscardThreshold->value());
|
||||||
|
|
||||||
|
profile->oxi->setOxiDesaturationThreshold(ui->oxiDesaturationThreshold->value());
|
||||||
|
profile->oxi->setFlagPulseAbove(ui->flagPulseAbove->value());
|
||||||
|
profile->oxi->setFlagPulseBelow(ui->flagPulseBelow->value());
|
||||||
|
|
||||||
profile->cpap->setAHIWindow(ui->ahiGraphWindowSize->value());
|
profile->cpap->setAHIWindow(ui->ahiGraphWindowSize->value());
|
||||||
profile->cpap->setAHIReset(ui->ahiGraphZeroReset->isChecked());
|
profile->cpap->setAHIReset(ui->ahiGraphZeroReset->isChecked());
|
||||||
|
|
||||||
@ -981,6 +981,7 @@ bool PreferencesDialog::Save()
|
|||||||
|
|
||||||
p_pref->Save();
|
p_pref->Save();
|
||||||
profile->Save();
|
profile->Save();
|
||||||
|
profile->refrehOxiChannelsPref();
|
||||||
|
|
||||||
if (recompress_events) {
|
if (recompress_events) {
|
||||||
mainwin->recompressEvents();
|
mainwin->recompressEvents();
|
||||||
|
916
oscar/saveGraphLayoutSettings.cpp
Normal file
@ -0,0 +1,916 @@
|
|||||||
|
/* user graph settings Implementation
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019-2022 The OSCAR Team
|
||||||
|
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.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 source code
|
||||||
|
* for more details. */
|
||||||
|
|
||||||
|
#define TEST_MACROS_ENABLED
|
||||||
|
#include <test_macros.h>
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QAbstractButton>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QSize>
|
||||||
|
#include <QChar>
|
||||||
|
#include "SleepLib/profiles.h"
|
||||||
|
#include "saveGraphLayoutSettings.h"
|
||||||
|
|
||||||
|
#define USE_FRAMELESS_WINDOW
|
||||||
|
#define USE_PROFILE_SPECIFIC_FOLDERoff // off implies saved layouts worked for all profiles.
|
||||||
|
|
||||||
|
SaveGraphLayoutSettings::SaveGraphLayoutSettings(QString title,QWidget* parent) : parent(parent),title(title)
|
||||||
|
{
|
||||||
|
fontSizeIncrease = 1;
|
||||||
|
helpFontSizeIncrease = 1;
|
||||||
|
createSaveFolder();
|
||||||
|
if (dir==nullptr) return;
|
||||||
|
dir->setFilter(QDir::Files | QDir::Readable | QDir::Writable | QDir::NoSymLinks);
|
||||||
|
|
||||||
|
QString descFileName = dirName+title.toLower()+".descriptions.txt";
|
||||||
|
descriptionMap = new DescriptionMap (dir,descFileName);
|
||||||
|
|
||||||
|
createMenu() ;
|
||||||
|
|
||||||
|
menuDialog->connect(menuAddFullBtn, SIGNAL(clicked()), this, SLOT (addFull_feature() ));
|
||||||
|
menuDialog->connect(menuAddBtn, SIGNAL(clicked()), this, SLOT (add_feature() ));
|
||||||
|
menuDialog->connect(menuRestoreBtn, SIGNAL(clicked()), this, SLOT (restore_feature() ));
|
||||||
|
menuDialog->connect(menuUpdateBtn, SIGNAL(clicked()), this, SLOT (update_feature() ));
|
||||||
|
menuDialog->connect(menuRenameBtn, SIGNAL(clicked()), this, SLOT (rename_feature() ));
|
||||||
|
menuDialog->connect(menuDeleteBtn, SIGNAL(clicked()), this, SLOT (delete_feature() ));
|
||||||
|
menuDialog->connect(menuHelpBtn, SIGNAL(clicked()), this, SLOT (help_feature() ));
|
||||||
|
menuDialog->connect(menuExitBtn, SIGNAL(clicked()), this, SLOT (exit() ));
|
||||||
|
menuDialog->connect(menuList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*) ));
|
||||||
|
menuDialog->connect(menuList, SIGNAL(itemSelectionChanged()), this, SLOT(itemSelectionChanged() ));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
singleLineRe = new QRegularExpression( QString("^\\s*([^\\r\\n]{0,%1})").arg(1+maxDescriptionLen) );
|
||||||
|
fileNumRe = new QRegularExpression( QString("%1(\\d+)(.shg)?$").arg(fileBaseName) );
|
||||||
|
parseFilenameRe = new QRegularExpression(QString("^(%1[.](%2(\\d*)))[.]shg$").arg(title).arg(fileBaseName));
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveGraphLayoutSettings::~SaveGraphLayoutSettings()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (dir==nullptr) {return;}
|
||||||
|
menuDialog->disconnect(menuAddFullBtn, SIGNAL(clicked()), this, SLOT (addFull_feature() ));
|
||||||
|
menuDialog->disconnect(menuAddBtn, SIGNAL(clicked()), this, SLOT (add_feature() ));
|
||||||
|
menuDialog->disconnect(menuRestoreBtn, SIGNAL(clicked()), this, SLOT (restore_feature() ));
|
||||||
|
menuDialog->disconnect(menuUpdateBtn, SIGNAL(clicked()), this, SLOT (update_feature() ));
|
||||||
|
menuDialog->disconnect(menuRenameBtn, SIGNAL(clicked()), this, SLOT (rename_feature() ));
|
||||||
|
menuDialog->disconnect(menuDeleteBtn, SIGNAL(clicked()), this, SLOT (delete_feature() ));
|
||||||
|
menuDialog->disconnect(menuExitBtn, SIGNAL(clicked()), this, SLOT (exit() ));
|
||||||
|
menuDialog->disconnect(menuHelpBtn, SIGNAL(clicked()), this, SLOT (help_feature() ));
|
||||||
|
menuDialog->disconnect(menuList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*) ));
|
||||||
|
menuDialog->disconnect(menuList, SIGNAL(itemSelectionChanged()), this, SLOT(itemSelectionChanged() ));
|
||||||
|
helpDestructor();
|
||||||
|
|
||||||
|
|
||||||
|
delete descriptionMap;
|
||||||
|
delete singleLineRe;
|
||||||
|
delete fileNumRe;
|
||||||
|
delete parseFilenameRe;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::createSaveFolder() {
|
||||||
|
// Insure that the save folder exists
|
||||||
|
// Get the directory name for the save files
|
||||||
|
//QString layoutFileFolder = "savedGraphLayoutSettings/";
|
||||||
|
QString layoutFileFolder = "layoutSettings/";
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// home directory for the current profile.
|
||||||
|
QString baseName = p_profile->Get("{DataFolder}/");
|
||||||
|
|
||||||
|
#else
|
||||||
|
// home directory for all profiles.
|
||||||
|
// allows settings to be shared accross profiles.
|
||||||
|
QString baseName = p_pref->Get("{home}/");
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
dirName = baseName+layoutFileFolder;
|
||||||
|
|
||||||
|
// Check if the save folder exists
|
||||||
|
QDir* tmpDir = new QDir(dirName);
|
||||||
|
if (!tmpDir->exists()) {
|
||||||
|
QDir* baseDir=new QDir(baseName);
|
||||||
|
if (!baseDir->exists()) {
|
||||||
|
// Base folder does not exist - terminate
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
// saved Setting folder does not exist. make it
|
||||||
|
if (!baseDir->mkdir(dirName)) {
|
||||||
|
// Did not create the folder.
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
tmpDir = new QDir(dirName);
|
||||||
|
// double check if save folder exists or not.
|
||||||
|
if (!tmpDir->exists()) {
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dir=tmpDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton* SaveGraphLayoutSettings::menuBtn(QString name, QIcon* icon, QString style,QSizePolicy::Policy hPolicy,QString tooltip) {
|
||||||
|
return newBtnRtn(menuLayoutButtons, name, icon, style, hPolicy,tooltip) ;
|
||||||
|
}
|
||||||
|
QPushButton* SaveGraphLayoutSettings::helpBtn(QString name, QIcon* icon, QString style,QSizePolicy::Policy hPolicy,QString tooltip) {
|
||||||
|
return newBtnRtn(helpLayoutButtons, name, icon, style, hPolicy,tooltip) ;
|
||||||
|
}
|
||||||
|
QPushButton* SaveGraphLayoutSettings::newBtnRtn(QHBoxLayout* layout,QString name, QIcon* icon, QString style,QSizePolicy::Policy hPolicy,QString tooltip) {
|
||||||
|
QPushButton* button = new QPushButton(name, menuDialog);
|
||||||
|
button->setIcon(*icon);
|
||||||
|
button->setStyleSheet(style);
|
||||||
|
button->setSizePolicy(hPolicy,QSizePolicy::Fixed);
|
||||||
|
button->setToolTip(tooltip);
|
||||||
|
button->setToolTipDuration(AppSetting->tooltipTimeout());
|
||||||
|
button->setFont(*mediumfont);
|
||||||
|
layout->addWidget(button);
|
||||||
|
return button;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::createStyleSheets() {
|
||||||
|
styleOn= calculateButtonStyle(true,false);
|
||||||
|
styleOff= calculateButtonStyle(false,false);
|
||||||
|
styleExit= calculateButtonStyle(true,true);
|
||||||
|
styleMessageBox=
|
||||||
|
"QMessageBox { "
|
||||||
|
"background-color:yellow;"
|
||||||
|
//"color:black;"
|
||||||
|
"color:red;"
|
||||||
|
"border: 2px solid black;"
|
||||||
|
"text-align: right;"
|
||||||
|
"font-size: 16px;"
|
||||||
|
"}"
|
||||||
|
"QTextEdit {"
|
||||||
|
"background-color:lightblue;"
|
||||||
|
//"color:black;"
|
||||||
|
"color:red;"
|
||||||
|
"border: 9px solid black;"
|
||||||
|
"text-align: center;"
|
||||||
|
"vertical-align:top;"
|
||||||
|
"}"
|
||||||
|
;
|
||||||
|
styleDialog=
|
||||||
|
"QDialog { "
|
||||||
|
"border: 3px solid black;"
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::createMenu() {
|
||||||
|
|
||||||
|
menuListFont =*defaultfont;
|
||||||
|
menuListFont.setPointSize(fontSizeIncrease+menuListFont.pointSize());
|
||||||
|
|
||||||
|
|
||||||
|
createStyleSheets();
|
||||||
|
|
||||||
|
#ifdef USE_FRAMELESS_WINDOW
|
||||||
|
menuDialog= new QDialog(parent, Qt::FramelessWindowHint);
|
||||||
|
menuDialog->setSizeGripEnabled(true); // allows lower right hand corner to resize dialog
|
||||||
|
#else
|
||||||
|
menuDialog= new QDialog(parent, Qt::WindowTitleHint | Qt::WindowCloseButtonHint|Qt::WindowSystemMenuHint);
|
||||||
|
menuDialog->setWindowTitle(tr("Manage Save Layout Settings")) ;
|
||||||
|
#endif
|
||||||
|
menuDialog->setStyleSheet(styleDialog);
|
||||||
|
|
||||||
|
menuLayout = new QVBoxLayout(menuDialog);
|
||||||
|
menuLayoutButtons = new QHBoxLayout();
|
||||||
|
|
||||||
|
menuAddFullBtn = menuBtn(tr("Add" ),m_icon_add , styleOff ,QSizePolicy::Minimum, tr("Add Feature inhibited. The maximum number of Items has been exceeded.") );
|
||||||
|
menuAddBtn = menuBtn(tr("Add" ),m_icon_add , styleOn ,QSizePolicy::Minimum, tr("creates new copy of current settings."));
|
||||||
|
menuRestoreBtn = menuBtn(tr("Restore"),m_icon_restore , styleOn ,QSizePolicy::Minimum, tr("Restores saved settings from selection."));
|
||||||
|
menuRenameBtn = menuBtn(tr("Rename" ),m_icon_rename , styleOn ,QSizePolicy::Minimum, tr("Renames the selection. Must edit existing name then press enter."));
|
||||||
|
menuUpdateBtn = menuBtn(tr("Update" ),m_icon_update , styleOn ,QSizePolicy::Minimum, tr("Updates the selection with current settings."));
|
||||||
|
menuDeleteBtn = menuBtn(tr("Delete" ),m_icon_delete , styleOn ,QSizePolicy::Minimum, tr("Deletes the selection."));
|
||||||
|
menuHelpBtn = menuBtn("" ,m_icon_help , styleOn ,QSizePolicy::Fixed , tr("Expanded Help menu."));
|
||||||
|
menuExitBtn = menuBtn("" ,m_icon_exit , styleExit,QSizePolicy::Fixed , tr("Exits the Layout menu."));
|
||||||
|
|
||||||
|
#ifndef USE_FRAMELESS_WINDOW
|
||||||
|
menuExitBtn->hide();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
menuList = new QListWidget(menuDialog);
|
||||||
|
menuList->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
|
menuList->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
|
||||||
|
menuList->setFont(menuListFont);
|
||||||
|
|
||||||
|
|
||||||
|
menuLayout->addLayout(menuLayoutButtons);
|
||||||
|
menuLayout->addWidget(menuList, 1);
|
||||||
|
|
||||||
|
//menuList->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred);
|
||||||
|
menuList->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::createHelp() {
|
||||||
|
if(helpDialog) return;
|
||||||
|
|
||||||
|
helpDialog= new QDialog(parent, Qt::FramelessWindowHint);
|
||||||
|
helpDialog->setStyleSheet(styleDialog);
|
||||||
|
menuDialog->setSizeGripEnabled(true); // allows lower right hand corner to resize dialog
|
||||||
|
|
||||||
|
QFont helpInfoFont = menuListFont;
|
||||||
|
helpInfoFont.setPointSize(helpFontSizeIncrease+helpInfoFont.pointSize());
|
||||||
|
|
||||||
|
QFont helpInfoLabelFont = helpInfoFont;
|
||||||
|
helpInfoLabelFont.setPointSize(fontSizeIncrease+ helpInfoFont.pointSize());
|
||||||
|
|
||||||
|
QLabel* helpInfoHeaderLabel = new QLabel("helpInfoHeaderLabel",parent);
|
||||||
|
helpInfoHeaderLabel->setText(QString( tr("<h4>Help Menu - Manage Layout Settings</h4>")));
|
||||||
|
helpInfoHeaderLabel->setFont(helpInfoLabelFont);
|
||||||
|
|
||||||
|
QLabel* helpInfoLabel = new QLabel("helpInfo",parent);
|
||||||
|
helpInfoLabel->setFont(helpInfoFont);
|
||||||
|
helpInfoLabel->setText(helpInfo()) ;
|
||||||
|
|
||||||
|
helpLayoutButtons = new QHBoxLayout();
|
||||||
|
helpLayoutButtons->addWidget(helpInfoHeaderLabel);
|
||||||
|
helpInfoExitBtn= helpBtn("" ,m_icon_return , styleOn ,QSizePolicy::Fixed , tr("Exits the help menu."));
|
||||||
|
helpExitBtn = helpBtn("" ,m_icon_exit , styleExit,QSizePolicy::Fixed , tr("Exits the dialog menu."));
|
||||||
|
|
||||||
|
QVBoxLayout* helpLayout = new QVBoxLayout(helpDialog);
|
||||||
|
helpLayout->addLayout(helpLayoutButtons);
|
||||||
|
helpLayout->addWidget(helpInfoLabel, 1);
|
||||||
|
|
||||||
|
helpDialog->connect(helpInfoExitBtn,SIGNAL(clicked()), this, SLOT (help_off_feature() ));
|
||||||
|
helpDialog->connect(helpExitBtn, SIGNAL(clicked()), this, SLOT (help_exit_feature() ));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::helpDestructor() {
|
||||||
|
if(!helpDialog) return;
|
||||||
|
helpDialog->disconnect(helpInfoExitBtn,SIGNAL(clicked()), this, SLOT (help_off_feature() ));
|
||||||
|
helpDialog->disconnect(helpExitBtn, SIGNAL(clicked()), this, SLOT (help_exit_feature() ));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString SaveGraphLayoutSettings::helpInfo() {
|
||||||
|
return QString( tr("\
|
||||||
|
<p style=\"color:black;\"> \
|
||||||
|
This feature manages the saving and restoring of Layout Settings.\
|
||||||
|
<br>\
|
||||||
|
Layout Settings control the layout of a graph or chart.\
|
||||||
|
<br>\
|
||||||
|
Different Layouts Settings can be saved and later restored.\
|
||||||
|
<br>\
|
||||||
|
</p>\
|
||||||
|
<table width=\"100%\"> \
|
||||||
|
<tr><td><b>Button</b></td> \
|
||||||
|
<td><b>Description</b></td></tr> \
|
||||||
|
<tr><td valign=\"top\">Add</td> \
|
||||||
|
<td>Creates a copy of the current Layout Settings. <br> \
|
||||||
|
The default description is the current date. <br> \
|
||||||
|
The description may be changed. <br> \
|
||||||
|
The Add button will be greyed out when maximum number is reached.</td></tr> \
|
||||||
|
<br> \
|
||||||
|
<tr><td><i><u>Other Buttons</u> </i></td> \
|
||||||
|
<td>Greyed out when there are no selections</td></tr> \
|
||||||
|
<tr><td>Restore</td> \
|
||||||
|
<td>Loads the Layout Settings from the selection. Automatically exits. </td></tr> \
|
||||||
|
<tr><td>Rename </td> \
|
||||||
|
<td>Modify the description of the selection. Same as a double click.</td></tr> \
|
||||||
|
<tr><td valign=\"top\">Update</td><td> Saves the current Layout Settings to the selection.<br> \
|
||||||
|
Prompts for confirmation.</td></tr> \
|
||||||
|
<tr><td valign=\"top\">Delete</td> \
|
||||||
|
<td>Deletes the selecton. <br> \
|
||||||
|
Prompts for confirmation.</td></tr> \
|
||||||
|
<tr><td><i><u>Control</u> </i></td> \
|
||||||
|
<td></td></tr> \
|
||||||
|
<tr><td>Exit </td> \
|
||||||
|
<td>(Red circle with a white \"X\".) Returns to OSCAR menu.</td></tr> \
|
||||||
|
<tr><td>Return</td> \
|
||||||
|
<td>Next to Exit icon. Only in Help Menu. Returns to Layout menu.</td></tr> \
|
||||||
|
<tr><td>Escape Key</td> \
|
||||||
|
<td>Exit the Help or Layout menu.</td></tr> \
|
||||||
|
</table> \
|
||||||
|
<p><b>Layout Settings</b></p> \
|
||||||
|
<table width=\"100%\"> \
|
||||||
|
<tr> \
|
||||||
|
<td>* Name</td> \
|
||||||
|
<td>* Pinning</td> \
|
||||||
|
<td>* Plots Enabled </td> \
|
||||||
|
<td>* Height</td> \
|
||||||
|
</tr> \
|
||||||
|
<tr> \
|
||||||
|
<td>* Order</td> \
|
||||||
|
<td>* Event Flags</td> \
|
||||||
|
<td>* Dotted Lines</td> \
|
||||||
|
<td>* Height Options</td> \
|
||||||
|
</tr> \
|
||||||
|
</table> \
|
||||||
|
<p><b>General Information</b></p> \
|
||||||
|
<ul style=margin-left=\"20\"; > \
|
||||||
|
<li> Maximum description size = 80 characters. </li> \
|
||||||
|
<li> Maximum Saved Layout Settings = 30. </li> \
|
||||||
|
<li> Saved Layout Settings can be accessed by all profiles. \
|
||||||
|
<li> Layout Settings only control the layout of a graph or chart. <br> \
|
||||||
|
They do not contain any other data. <br> \
|
||||||
|
They do not control if a graph is displayed or not. </li> \
|
||||||
|
<li> Layout Settings for daily and overview are managed independantly. </li>\
|
||||||
|
</ul> \
|
||||||
|
"));
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString SaveGraphLayoutSettings::calculateStyleMessageBox(QFont* font , QString& s1, QString& s2) {
|
||||||
|
QFontMetrics fm = QFontMetrics(*font);
|
||||||
|
int width = fm.boundingRect(s1).size().width();
|
||||||
|
int width2 = fm.boundingRect(s2).size().width();
|
||||||
|
width = qMax(width,width2) + iconWidthMessageBox;
|
||||||
|
|
||||||
|
QString style = QString("%1 QLabel{%2 min-width: %3px;}" ).
|
||||||
|
arg(styleMessageBox).
|
||||||
|
arg("text-align: center;" "color:black;").
|
||||||
|
arg(width);
|
||||||
|
|
||||||
|
return style;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SaveGraphLayoutSettings::verifyItem(QListWidgetItem* item,QString text,QIcon* icon) {
|
||||||
|
//if (verifyhelp() ) return false;
|
||||||
|
if (item) return true;
|
||||||
|
initminMenuListSize();
|
||||||
|
confirmAction( text ,"" , icon);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
bool SaveGraphLayoutSettings::confirmAction(QString top ,QString bottom,QIcon* icon,QMessageBox::StandardButtons flags , QMessageBox::StandardButton adefault, QMessageBox::StandardButton success) {
|
||||||
|
//QString topText=QString("<Center>%1</Center>").arg(top);
|
||||||
|
//QString bottomText=QString("<Center>%1</Center>").arg(bottom);
|
||||||
|
QString topText=QString("<p style=""text-align:center"">%1</p>").arg(top);
|
||||||
|
QString bottomText=QString("<p style=""text-align:center"">%1</p>").arg(bottom);
|
||||||
|
|
||||||
|
QMessageBox msgBox(menuDialog);
|
||||||
|
msgBox.setText(topText);
|
||||||
|
msgBox.setInformativeText(bottomText);
|
||||||
|
if (icon!=nullptr) {
|
||||||
|
msgBox.setIconPixmap(icon->pixmap(QSize(iconWidthMessageBox,iconWidthMessageBox)));
|
||||||
|
}
|
||||||
|
// may be good for help menu. a pull down box with box of data. msgBox.setDetailedText("some detailed string");
|
||||||
|
msgBox.setStandardButtons(flags);
|
||||||
|
msgBox.setDefaultButton(adefault);
|
||||||
|
msgBox.setWindowFlag(Qt::FramelessWindowHint,true);
|
||||||
|
|
||||||
|
msgBox.setStyleSheet(calculateStyleMessageBox(&menuListFont,top,bottom));
|
||||||
|
|
||||||
|
// displaywidgets((QWidget*)&msgBox);
|
||||||
|
bool ret= msgBox.exec()==success;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
bool SaveGraphLayoutSettings::confirmAction(QString name ,QString question,QIcon* icon,QMessageBox::StandardButtons flags , QMessageBox::StandardButton adefault, QMessageBox::StandardButton success) {
|
||||||
|
//bool SaveGraphLayoutSettings::confirmAction(QString name,QString question,QIcon* icon)
|
||||||
|
Q_UNUSED(flags);
|
||||||
|
Q_UNUSED(adefault);
|
||||||
|
Q_UNUSED(success);
|
||||||
|
QMessageBox msgBox(menuDialog);
|
||||||
|
msgBox.setText(question);
|
||||||
|
if (icon!=nullptr) {
|
||||||
|
msgBox.setIconPixmap(icon->pixmap(QSize(50,50)));
|
||||||
|
}
|
||||||
|
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Cancel | QMessageBox::Yes );
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Cancel);
|
||||||
|
msgBox.setStyleSheet(styleMessageBox);
|
||||||
|
msgBox.setWindowFlag(Qt::FramelessWindowHint,true);
|
||||||
|
|
||||||
|
return (msgBox.exec()==QMessageBox::Yes);
|
||||||
|
Q_UNUSED(name);
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QString SaveGraphLayoutSettings::calculateButtonStyle(bool on,bool exitBtn){
|
||||||
|
QString btnStyle=QString("QPushButton{%1%2}").arg(on
|
||||||
|
?"color: black;background-color:white;"
|
||||||
|
:"color: darkgray;background-color:#e8e8e8 ;"
|
||||||
|
).arg(!exitBtn ?
|
||||||
|
""
|
||||||
|
:
|
||||||
|
"background: transparent;"
|
||||||
|
"border-radius: 8px;"
|
||||||
|
"border: 2px solid transparent;"
|
||||||
|
"max-width:1em;"
|
||||||
|
"border:none;"
|
||||||
|
);
|
||||||
|
|
||||||
|
QString toolTipStyle=" QToolTip { "
|
||||||
|
"border: 1px solid black;"
|
||||||
|
"border-width: 1px;"
|
||||||
|
"padding: 4px;"
|
||||||
|
"font: 14px ; color:black; background-color:yellow;"
|
||||||
|
"}";
|
||||||
|
btnStyle.append(toolTipStyle);
|
||||||
|
return btnStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::looksOn(QPushButton* button,bool on){
|
||||||
|
//button->setEnabled(on);
|
||||||
|
button->setStyleSheet(on?styleOn:styleOff);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::manageButtonApperance() {
|
||||||
|
|
||||||
|
bool enable = menuList->currentItem();
|
||||||
|
looksOn(menuUpdateBtn,enable);
|
||||||
|
looksOn(menuRestoreBtn,enable);
|
||||||
|
looksOn(menuDeleteBtn,enable);
|
||||||
|
looksOn(menuRenameBtn,enable);
|
||||||
|
|
||||||
|
if (nextNumToUse<0) { // check if at Maximum limit
|
||||||
|
// must always hide first
|
||||||
|
menuAddBtn->hide();
|
||||||
|
menuAddFullBtn->show();
|
||||||
|
} else {
|
||||||
|
// must always hide first
|
||||||
|
menuAddFullBtn->hide();
|
||||||
|
menuAddBtn->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::add_feature() {
|
||||||
|
if(!graphView) return;
|
||||||
|
QString fileName = QString("%1%2").arg(fileBaseName).arg(nextNumToUse,fileNumMaxLength,10,QLatin1Char('0'));
|
||||||
|
writeSettings(fileName);
|
||||||
|
// create a default description - use formatted datetime.
|
||||||
|
QString desc=QDateTime::currentDateTime().toString();
|
||||||
|
descriptionMap->add(fileName,desc);
|
||||||
|
descriptionMap->save();
|
||||||
|
QListWidgetItem* item = updateFileList( fileName);
|
||||||
|
if (item!=nullptr) {
|
||||||
|
menuList->setCurrentItem(item,QItemSelectionModel::ClearAndSelect);
|
||||||
|
menuList->editItem(item);
|
||||||
|
}
|
||||||
|
menuList->sortItems();
|
||||||
|
resizeMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::addFull_feature() {
|
||||||
|
verifyItem( nullptr,tr("Maximum number of Items exceeded.") , m_icon_add);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::update_feature() {
|
||||||
|
if(!graphView) return;
|
||||||
|
QListWidgetItem * item=menuList->currentItem();
|
||||||
|
if (!verifyItem(item, tr("No Item Selected") , m_icon_update)) return ;
|
||||||
|
if(!confirmAction( item->text(), tr("Ok to Update?") , m_icon_update) ) return;
|
||||||
|
QString fileName = item->data(fileNameRole).toString();
|
||||||
|
writeSettings(fileName);
|
||||||
|
};
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::restore_feature() {
|
||||||
|
if(!graphView) return;
|
||||||
|
QListWidgetItem * item=menuList->currentItem();
|
||||||
|
if (!verifyItem(item, tr("No Item Selected") , m_icon_restore)) return ;
|
||||||
|
QString fileName = item->data(fileNameRole).toString();
|
||||||
|
loadSettings(fileName);
|
||||||
|
exit();
|
||||||
|
};
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::rename_feature() {
|
||||||
|
if(!graphView) return;
|
||||||
|
QListWidgetItem * item=menuList->currentItem();
|
||||||
|
if (!verifyItem(item, tr("No Item Selected") , m_icon_rename)) return ;
|
||||||
|
menuList->editItem(item);
|
||||||
|
// SaveGraphLayoutSettings::itemChanged(QListWidgetItem *item) is called when edit changes the entry.
|
||||||
|
// itemChanged will update the description map
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::help_exit_feature() {
|
||||||
|
helpDialog->close();
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::help_off_feature() {
|
||||||
|
helpDialog->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::help_feature() {
|
||||||
|
initminMenuListSize();
|
||||||
|
createHelp();
|
||||||
|
if(!helpDialog) return;
|
||||||
|
helpDialog->raise();
|
||||||
|
helpDialog->exec();
|
||||||
|
manageButtonApperance();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::delete_feature() {
|
||||||
|
if(!graphView) return;
|
||||||
|
QListWidgetItem * item=menuList->currentItem();
|
||||||
|
if (!verifyItem(item, tr("No Item Selected") , m_icon_delete)) return ;
|
||||||
|
if(!confirmAction(item->text(), tr("Ok To Delete?") ,m_icon_delete) ) return;
|
||||||
|
|
||||||
|
QString fileName = item->data(fileNameRole).toString();
|
||||||
|
descriptionMap->remove(fileName);
|
||||||
|
descriptionMap->save();
|
||||||
|
deleteSettings(fileName);
|
||||||
|
delete item;
|
||||||
|
if (nextNumToUse<0) {
|
||||||
|
nextNumToUse=fileNum(fileName);
|
||||||
|
}
|
||||||
|
manageButtonApperance();
|
||||||
|
resizeMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::itemChanged(QListWidgetItem *item)
|
||||||
|
{
|
||||||
|
QString fileName=item->data(fileNameRole).toString();
|
||||||
|
QString desc= item->text();
|
||||||
|
|
||||||
|
// use only the first line in a multiline string. Can be set using cut and paste
|
||||||
|
QRegularExpressionMatch match = singleLineRe->match(desc);
|
||||||
|
if (match.hasMatch()) {
|
||||||
|
// captured match is the first line and has been truncated
|
||||||
|
desc=match.captured(1).trimmed(); // reoves spaces at end.
|
||||||
|
} else {
|
||||||
|
// no match.
|
||||||
|
// an invalid name was entered. too much white space or empty
|
||||||
|
desc="";
|
||||||
|
}
|
||||||
|
if (desc.length()>maxDescriptionLen) {
|
||||||
|
desc.append("...");
|
||||||
|
}
|
||||||
|
if (desc.length() <=0) {
|
||||||
|
// returns name back to previous saved name
|
||||||
|
desc=descriptionMap->get(fileName);
|
||||||
|
} else {
|
||||||
|
descriptionMap->add(fileName,desc);
|
||||||
|
descriptionMap->save();
|
||||||
|
}
|
||||||
|
item->setText(desc);
|
||||||
|
menuList->sortItems();
|
||||||
|
menuList->setCurrentItem(item);
|
||||||
|
resizeMenu();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::itemSelectionChanged()
|
||||||
|
{
|
||||||
|
initminMenuListSize();
|
||||||
|
manageButtonApperance();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::initminMenuListSize() {
|
||||||
|
if (minMenuDialogSize.width()==0) {
|
||||||
|
menuDialogSize = menuDialog->size();
|
||||||
|
minMenuDialogSize = menuDialogSize;
|
||||||
|
|
||||||
|
menuListSize = menuList->size();
|
||||||
|
minMenuListSize = menuListSize;
|
||||||
|
|
||||||
|
dialogListDiff = menuDialogSize - menuListSize;
|
||||||
|
|
||||||
|
dialogListDiff.setWidth (horizontalWidthAdjustment + dialogListDiff.width());
|
||||||
|
|
||||||
|
resizeMenu();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::writeSettings(QString filename) {
|
||||||
|
graphView->SaveSettings(title+"."+filename,dirName);
|
||||||
|
};
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::loadSettings(QString filename) {
|
||||||
|
graphView->LoadSettings(title+"."+filename,dirName);
|
||||||
|
};
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::deleteSettings(QString filename) {
|
||||||
|
QString fileName=graphView->settingsFilename (title+"."+filename,dirName) ;
|
||||||
|
dir->remove(fileName);
|
||||||
|
};
|
||||||
|
|
||||||
|
int SaveGraphLayoutSettings::fileNum(QString fileName) {
|
||||||
|
QRegularExpressionMatch match = fileNumRe->match(fileName);
|
||||||
|
int value=-1;
|
||||||
|
if (match.hasMatch()) {
|
||||||
|
value=match.captured(1).toInt();
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QSize SaveGraphLayoutSettings::maxSize(const QSize AA , const QSize BB ) {
|
||||||
|
return QSize ( qMax(AA.width(),BB.width()) , qMax(AA.height(),BB.height() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SaveGraphLayoutSettings::sizeEqual(const QSize AA , const QSize BB ) {
|
||||||
|
return (AA.width()==BB.width()) && ( AA.height()==BB.height()) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::resizeMenu() {
|
||||||
|
if (minMenuDialogSize.width()==0) return;
|
||||||
|
|
||||||
|
QSize newSize = calculateMenuDialogSize();
|
||||||
|
newSize.setWidth ( newSize.width());
|
||||||
|
|
||||||
|
menuDialogSize = menuDialog->size();
|
||||||
|
|
||||||
|
if ( sizeEqual(newSize , menuDialogSize)) {
|
||||||
|
// no work to do
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ( menuDialogSize.width() < newSize.width() ) {
|
||||||
|
menuDialog->setMinimumWidth(newSize.width());
|
||||||
|
menuDialog->setMaximumWidth(QWIDGETSIZE_MAX);
|
||||||
|
} else if ( menuDialogSize.width() > newSize.width() ) {
|
||||||
|
menuDialog->setMaximumWidth(newSize.width());
|
||||||
|
menuDialog->setMinimumWidth(newSize.width());
|
||||||
|
}
|
||||||
|
if ( menuDialogSize.height() < newSize.height() ) {
|
||||||
|
menuDialog->setMinimumHeight(newSize.height());
|
||||||
|
menuDialog->setMaximumHeight(QWIDGETSIZE_MAX);
|
||||||
|
} else if ( menuDialogSize.height() > newSize.height() ) {
|
||||||
|
menuDialog->setMaximumHeight(newSize.height());
|
||||||
|
menuDialog->setMinimumHeight(newSize.height());
|
||||||
|
}
|
||||||
|
menuDialogSize = newSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize SaveGraphLayoutSettings::calculateMenuDialogSize() {
|
||||||
|
if (menuDialogSize.width()==0) return QSize(0,0);
|
||||||
|
QListWidgetItem* item;
|
||||||
|
widestItem=nullptr;
|
||||||
|
QFontMetrics fm = QFontMetrics(menuListFont);
|
||||||
|
|
||||||
|
// account for scrollbars.
|
||||||
|
QSize returnValue = QSize( 0 , fm.height() ); // add an extra space at the bottom. width didn't work
|
||||||
|
|
||||||
|
// Account for dialog Size
|
||||||
|
returnValue += dialogListDiff;
|
||||||
|
QSize size;
|
||||||
|
|
||||||
|
for (int index = 0; index < menuList->count(); ++index) {
|
||||||
|
item = menuList->item(index);
|
||||||
|
if (!item) continue;
|
||||||
|
size = fm.boundingRect(item->text()).size();
|
||||||
|
if (returnValue.width() < size.width()) {
|
||||||
|
returnValue.setWidth( qMax( returnValue.width(),size.width()));
|
||||||
|
widestItem=item;
|
||||||
|
}
|
||||||
|
returnValue.setHeight( returnValue.height()+size.height());
|
||||||
|
}
|
||||||
|
returnValue.setWidth( horizontalWidthAdjustment + returnValue.width() ) ;
|
||||||
|
|
||||||
|
returnValue = maxSize(returnValue, minMenuDialogSize);
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QListWidgetItem* SaveGraphLayoutSettings::updateFileList(QString find) {
|
||||||
|
QListWidgetItem* ret=nullptr;
|
||||||
|
manageButtonApperance();
|
||||||
|
dir->refresh();
|
||||||
|
QFileInfoList filelist = dir->entryInfoList( QDir::Files | QDir::Readable | QDir::Writable | QDir::NoSymLinks,QDir::Name);
|
||||||
|
|
||||||
|
// Restrict number of files. easy to find availble unused entry for add function.
|
||||||
|
|
||||||
|
int row=0;
|
||||||
|
int count=0;
|
||||||
|
menuList->clear();
|
||||||
|
nextNumToUse=-1;
|
||||||
|
descriptionMap->load();
|
||||||
|
for (int i = 0; i < filelist.size(); ++i) {
|
||||||
|
QFileInfo fileInfo = filelist.at(i);
|
||||||
|
QString fileName = fileInfo.fileName();
|
||||||
|
QRegularExpressionMatch match = parseFilenameRe->match(fileName);
|
||||||
|
if (match.hasMatch()) {
|
||||||
|
if (match.lastCapturedIndex()==3) {
|
||||||
|
QString fileName=match.captured(2);
|
||||||
|
if (nextNumToUse<0) {
|
||||||
|
// check if an entry is availavle to use
|
||||||
|
int fileNum=match.captured(3).toInt();
|
||||||
|
// find an available file name(number);
|
||||||
|
if (fileNum!=count) {
|
||||||
|
nextNumToUse=count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(descriptionMap->get(fileName));
|
||||||
|
item->setData(fileNameRole,fileName);
|
||||||
|
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||||
|
menuList->insertItem(row,item);
|
||||||
|
row++;
|
||||||
|
if (find!=nullptr && fileName==find) {
|
||||||
|
ret=item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nextNumToUse<0) { // check if there is an existing empty slot
|
||||||
|
// if not then the next available slot is at the end. CHeck if at max files.
|
||||||
|
if (count<maxFiles) {
|
||||||
|
// a slot is available
|
||||||
|
nextNumToUse=count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
manageButtonApperance();
|
||||||
|
menuList->sortItems();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::exit() {
|
||||||
|
menuDialog->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::menu(gGraphView* graphView) {
|
||||||
|
if (dir==nullptr) {
|
||||||
|
//const char* err=qPrintable(QString("Cannot find directory %1").arg(dirName));
|
||||||
|
//qWarning(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this->graphView=graphView;
|
||||||
|
updateFileList();
|
||||||
|
manageButtonApperance();
|
||||||
|
menuDialog->raise();
|
||||||
|
menuDialog->exec();
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
//====================================================================================================
|
||||||
|
//====================================================================================================
|
||||||
|
// Descriptions map class with file storage
|
||||||
|
|
||||||
|
DescriptionMap::DescriptionMap(QDir* dir, QString _filename)
|
||||||
|
{
|
||||||
|
filename = dir->absoluteFilePath(_filename);
|
||||||
|
parseDescriptionsRe = new QRegularExpression(QString("^\\s*(\\w+)%1(.*)$").arg(delimiter) );
|
||||||
|
};
|
||||||
|
|
||||||
|
DescriptionMap::~DescriptionMap() {
|
||||||
|
delete parseDescriptionsRe;
|
||||||
|
};
|
||||||
|
|
||||||
|
void DescriptionMap::add(QString key,QString desc) {
|
||||||
|
descriptions.insert(key,desc);
|
||||||
|
};
|
||||||
|
|
||||||
|
void DescriptionMap::remove(QString key) {
|
||||||
|
descriptions.remove(key);
|
||||||
|
}
|
||||||
|
QString DescriptionMap::get(QString key) {
|
||||||
|
QString ret =descriptions.value(key,key);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DescriptionMap::save() {
|
||||||
|
QFile file(filename);
|
||||||
|
file.open(QFile::WriteOnly);
|
||||||
|
QTextStream out(&file);
|
||||||
|
QMapIterator<QString, QString>it(descriptions);
|
||||||
|
while (it.hasNext()) {
|
||||||
|
it.next();
|
||||||
|
QString line=QString("%1%2%3\n").arg(it.key()).arg(delimiter).arg(it.value());
|
||||||
|
out <<line;
|
||||||
|
}
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DescriptionMap::load() {
|
||||||
|
QString line;
|
||||||
|
QFile file(filename);
|
||||||
|
descriptions.clear();
|
||||||
|
if (!file.exists()) return;
|
||||||
|
file.open(QFile::ReadOnly);
|
||||||
|
QTextStream instr(&file);
|
||||||
|
while (instr.readLineInto(&line)) {
|
||||||
|
QRegularExpressionMatch match = parseDescriptionsRe->match(line);
|
||||||
|
if (match.hasMatch()) {
|
||||||
|
QString fileName = match.captured(1);
|
||||||
|
QString desc = match.captured(2);
|
||||||
|
add(fileName,desc);
|
||||||
|
} else {
|
||||||
|
DEBUGF QQ("MATCH ERROR",line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//====================================================================================================
|
||||||
|
//====================================================================================================
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
Are you <b>absolutely sure</b> you want to proceed?
|
||||||
|
|
||||||
|
QMessageBox msgBox; msgBox.setText(tr("Confirm?"));
|
||||||
|
QAbstractButton* pButtonYes = msgBox.addButton(tr("Yeah!"), QMessageBox::YesRole);
|
||||||
|
pButtonNo=msgBox.addButton(tr("Nope"), QMessageBox::NoRole);
|
||||||
|
btn.setIcon(const QIcon &icon);
|
||||||
|
|
||||||
|
msgBox.exec();
|
||||||
|
|
||||||
|
if (msgBox.clickedButton()==pButtonYes) {
|
||||||
|
|
||||||
|
|
||||||
|
QIcon groupIcon( style()->standardIcon( QStyle::SP_DirClosedIcon ) )
|
||||||
|
https://www.pythonguis.com/faq/built-in-qicons-pyqt/
|
||||||
|
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setText("The document has been modified.");
|
||||||
|
msgBox.setInformativeText("Do you want to save your changes?");
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::Save);
|
||||||
|
int ret = msgBox.exec();
|
||||||
|
switch (ret) {
|
||||||
|
case QMessageBox::Save:
|
||||||
|
// Save was clicked
|
||||||
|
break;
|
||||||
|
case QMessageBox::Discard:
|
||||||
|
// Don't Save was clicked
|
||||||
|
break;
|
||||||
|
case QMessageBox::Cancel:
|
||||||
|
// Cancel was clicked
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// should never be reached
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Reminders For testing
|
||||||
|
|
||||||
|
Different languages unicodes to test. optained from translation files
|
||||||
|
|
||||||
|
도움주신분들
|
||||||
|
已成功删除
|
||||||
|
删除
|
||||||
|
הצג את מחיצת הנתונים
|
||||||
|
|
||||||
|
הצג את מחיצת הנתונים 已成功删除 عذرا ، لا يمكن تحديد موقع ملف.
|
||||||
|
已成功删除 عذرا ، لا يمكن تحديد موقع ملف. 删除
|
||||||
|
Toon gegevensmap
|
||||||
|
عذرا ، لا يمكن تحديد موقع ملف.
|
||||||
|
|
||||||
|
|
||||||
|
menuDialog->connect(menuList, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(itemActivated(QListWidgetItem*) ));
|
||||||
|
menuDialog->connect(menuList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(itemDoubleClicked(QListWidgetItem*) ));
|
||||||
|
menuDialog->connect(menuList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(itemClicked(QListWidgetItem*) ));
|
||||||
|
menuDialog->connect(menuList, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(itemEntered(QListWidgetItem*) ));
|
||||||
|
menuDialog->connect(menuList, SIGNAL(itemPressed(QListWidgetItem*)), this, SLOT(itemEntered(QListWidgetItem*) ));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
menuDialog->disconnect(menuList, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(itemActivated(QListWidgetItem*) ));
|
||||||
|
menuDialog->disconnect(menuList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(itemDoubleClicked(QListWidgetItem*) ));
|
||||||
|
menuDialog->disconnect(menuList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(itemClicked(QListWidgetItem*) ));
|
||||||
|
menuDialog->disconnect(menuList, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(itemEntered(QListWidgetItem*) ));
|
||||||
|
menuDialog->disconnect(menuList, SIGNAL(itemPressed(QListWidgetItem*)), this, SLOT(itemEntered(QListWidgetItem*) ));
|
||||||
|
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::itemActivated(QListWidgetItem *item)
|
||||||
|
{
|
||||||
|
Q_UNUSED( item );
|
||||||
|
DEBUGF Q( item->text() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::itemDoubleClicked(QListWidgetItem *item)
|
||||||
|
{
|
||||||
|
Q_UNUSED( item );
|
||||||
|
DEBUGF Q( item->text() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::itemClicked(QListWidgetItem *item)
|
||||||
|
{
|
||||||
|
Q_UNUSED( item );
|
||||||
|
DEBUGF Q( item->text() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::itemEntered(QListWidgetItem *item)
|
||||||
|
{
|
||||||
|
Q_UNUSED( item );
|
||||||
|
DEBUGF Q( item->text() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveGraphLayoutSettings::itemPressed(QListWidgetItem *item)
|
||||||
|
{
|
||||||
|
Q_UNUSED( item );
|
||||||
|
DEBUGF Q( item->text() );
|
||||||
|
}
|
||||||
|
|
||||||
|
//private_slots:
|
||||||
|
void itemActivated(QListWidgetItem *item);
|
||||||
|
void itemDoubleClicked(QListWidgetItem *item);
|
||||||
|
void itemClicked(QListWidgetItem *item);
|
||||||
|
void itemEntered(QListWidgetItem *item);
|
||||||
|
void itemPressed(QListWidgetItem *item);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
178
oscar/saveGraphLayoutSettings.h
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
/* Overview GUI Headers
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019-2022 The OSCAR Team
|
||||||
|
* Copyright (C) 2011-2018 Mark Watkins <mark@jedimark.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 source code
|
||||||
|
* for more details. */
|
||||||
|
|
||||||
|
#ifndef SAVEGRAPHLAYOUTSETTINGS_H
|
||||||
|
#define SAVEGRAPHLAYOUTSETTINGS_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QListWidgetItem>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
|
#include "Graphs/gGraphView.h"
|
||||||
|
|
||||||
|
class DescriptionMap
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DescriptionMap(QDir* dir, QString filename) ;
|
||||||
|
virtual ~DescriptionMap();
|
||||||
|
void add(QString key,QString desc);
|
||||||
|
void remove(QString key);
|
||||||
|
QString get(QString key);
|
||||||
|
void load();
|
||||||
|
void save();
|
||||||
|
private:
|
||||||
|
QString filename;
|
||||||
|
QMap <QString,QString> descriptions;
|
||||||
|
const QRegularExpression* parseDescriptionsRe;
|
||||||
|
const QChar delimiter = QChar(':');
|
||||||
|
};
|
||||||
|
|
||||||
|
class SaveGraphLayoutSettings : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
SaveGraphLayoutSettings(QString title, QWidget* parent) ;
|
||||||
|
~SaveGraphLayoutSettings();
|
||||||
|
void menu(gGraphView* graphView);
|
||||||
|
protected:
|
||||||
|
QIcon* m_icon_return = new QIcon(":/icons/return.png");
|
||||||
|
QIcon* m_icon_help = new QIcon(":/icons/question_mark.png");
|
||||||
|
QIcon* m_icon_exit = new QIcon(":/icons/exit.png");
|
||||||
|
QIcon* m_icon_delete = new QIcon(":/icons/trash_can.png");
|
||||||
|
QIcon* m_icon_update = new QIcon(":/icons/update.png");
|
||||||
|
QIcon* m_icon_restore = new QIcon(":/icons/restore.png");
|
||||||
|
QIcon* m_icon_rename = new QIcon(":/icons/rename.png");
|
||||||
|
QIcon* m_icon_add = new QIcon(":/icons/plus.png");
|
||||||
|
|
||||||
|
private:
|
||||||
|
const static int fileNumMaxLength = 3;
|
||||||
|
const static int maxFiles = 30; // Max supported design limited is 1000 10**fileNumMaxLength(3).
|
||||||
|
const static int iconWidthMessageBox = 50;
|
||||||
|
const static int maxDescriptionLen = 80;
|
||||||
|
const QString fileBaseName = QString("layout");
|
||||||
|
const int fileNameRole = Qt::UserRole;
|
||||||
|
int fontSizeIncrease = 0;
|
||||||
|
int horizontalWidthAdjustment=60; // this seem to make menu size changes work. Testing says it is 60 but what causes it is unknown.
|
||||||
|
|
||||||
|
QSize minMenuListSize = QSize(0,0);
|
||||||
|
QSize minMenuDialogSize = QSize(0,0);
|
||||||
|
|
||||||
|
QSize dialogListDiff = QSize(0,0);
|
||||||
|
QSize menuDialogSize = QSize(0,0);
|
||||||
|
QSize menuListSize = QSize(0,0);
|
||||||
|
void initminMenuListSize();
|
||||||
|
QSize calculateMenuDialogSize();
|
||||||
|
QSize maxSize(const QSize AA , const QSize BB ) ;
|
||||||
|
bool sizeEqual(const QSize AA , const QSize BB ) ;
|
||||||
|
|
||||||
|
const QRegularExpression* singleLineRe;
|
||||||
|
const QRegularExpression* fileNumRe;
|
||||||
|
const QRegularExpression* parseFilenameRe;
|
||||||
|
|
||||||
|
|
||||||
|
QWidget* parent;
|
||||||
|
const QString title;
|
||||||
|
gGraphView* graphView = nullptr;
|
||||||
|
QFont menuListFont;
|
||||||
|
|
||||||
|
QDialog* menuDialog;
|
||||||
|
QListWidget* menuList;
|
||||||
|
|
||||||
|
QPushButton* menuAddFullBtn; // Must be first item for workaround.
|
||||||
|
QPushButton* menuAddBtn;
|
||||||
|
QPushButton* menuDeleteBtn;
|
||||||
|
QPushButton* menuRestoreBtn;
|
||||||
|
QPushButton* menuUpdateBtn;
|
||||||
|
QPushButton* menuRenameBtn;
|
||||||
|
QPushButton* menuExitBtn;
|
||||||
|
QPushButton* menuHelpBtn;
|
||||||
|
|
||||||
|
|
||||||
|
QVBoxLayout* menuLayout;
|
||||||
|
QHBoxLayout* menuLayoutButtons;
|
||||||
|
|
||||||
|
void createHelp();
|
||||||
|
void helpDestructor();
|
||||||
|
QString helpInfo();
|
||||||
|
QDialog* helpDialog=nullptr;
|
||||||
|
QPushButton* helpInfoExitBtn=nullptr;
|
||||||
|
QPushButton* helpExitBtn=nullptr;
|
||||||
|
int helpFontSizeIncrease = 0;
|
||||||
|
QHBoxLayout* helpLayoutButtons = nullptr;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
QDir* dir = nullptr;
|
||||||
|
QString dirName;
|
||||||
|
int nextNumToUse;
|
||||||
|
QListWidgetItem* updateFileList(QString find = QString());
|
||||||
|
QListWidgetItem* widestItem=nullptr;
|
||||||
|
QString styleOn;
|
||||||
|
QString styleOff;
|
||||||
|
QString styleExit;
|
||||||
|
QString styleMessageBox;
|
||||||
|
QString styleDialog;
|
||||||
|
|
||||||
|
QString calculateButtonStyle(bool on,bool border);
|
||||||
|
void looksOn(QPushButton* button,bool on);
|
||||||
|
DescriptionMap* descriptionMap;
|
||||||
|
bool confirmAction(QString name,QString question,QIcon* icon,
|
||||||
|
QMessageBox::StandardButtons flags = (QMessageBox::Cancel|QMessageBox::Yes) ,
|
||||||
|
QMessageBox::StandardButton adefault = QMessageBox::Cancel,
|
||||||
|
QMessageBox::StandardButton success = QMessageBox::Yes
|
||||||
|
);
|
||||||
|
bool verifyItem(QListWidgetItem* item,QString name,QIcon* icon) ;
|
||||||
|
|
||||||
|
const QString calculateStyleMessageBox( QFont* font, QString& s1, QString& s2);
|
||||||
|
|
||||||
|
void displaywidgets(QWidget* widget);
|
||||||
|
QSize calculateParagraphSize(QString& text,QFont& font, QString& );
|
||||||
|
|
||||||
|
void createMenu();
|
||||||
|
void createStyleSheets();
|
||||||
|
void createSaveFolder();
|
||||||
|
QPushButton* newBtnRtn(QHBoxLayout*, QString name, QIcon* icon, QString style,QSizePolicy::Policy hPolicy,QString tooltip);
|
||||||
|
QPushButton* menuBtn( QString name, QIcon* icon, QString style,QSizePolicy::Policy hPolicy,QString tooltip);
|
||||||
|
QPushButton* helpBtn( QString name, QIcon* icon, QString style,QSizePolicy::Policy hPolicy,QString tooltip);
|
||||||
|
|
||||||
|
void manageButtonApperance();
|
||||||
|
void resizeMenu();
|
||||||
|
|
||||||
|
int fileNum(QString fileName);
|
||||||
|
void writeSettings(QString filename);
|
||||||
|
void loadSettings(QString filename);
|
||||||
|
void deleteSettings(QString filename);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
private slots:
|
||||||
|
void add_feature();
|
||||||
|
void addFull_feature();
|
||||||
|
void restore_feature();
|
||||||
|
void rename_feature();
|
||||||
|
void update_feature();
|
||||||
|
void help_feature();
|
||||||
|
void help_off_feature();
|
||||||
|
void help_exit_feature();
|
||||||
|
void delete_feature();
|
||||||
|
void exit();
|
||||||
|
|
||||||
|
void itemChanged(QListWidgetItem *item);
|
||||||
|
void itemSelectionChanged();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // SAVEGRAPHLAYOUTSETTINGS_H
|
||||||
|
|
@ -38,11 +38,13 @@ To turn off the the test macros.
|
|||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
#define DEBUGQ qDebug().noquote()
|
#define DEBUGQ qDebug().noquote()
|
||||||
#define DEBUGL DEBUGQ <<QString("%1[%2]").arg(QFileInfo( __FILE__).baseName()).arg(__LINE__)
|
#define DEBUGW qWarning().noquote()
|
||||||
#define DEBUGF DEBUGQ <<QString("%1[%2]%3").arg(QFileInfo( __FILE__).baseName()).arg(__LINE__).arg(__func__)
|
#define DEBUGL DEBUGQ <<QString("%1[%2]").arg(QFileInfo( __FILE__).baseName()).arg(__LINE__)
|
||||||
#define DEBUGT DEBUGQ <<QString("%1 %2[%3]%4").arg(QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz")).arg(QFileInfo( __FILE__).baseName()).arg(__LINE__)
|
#define DEBUGF DEBUGQ <<QString("%1[%2]%3").arg(QFileInfo( __FILE__).baseName()).arg(__LINE__).arg(__func__)
|
||||||
#define DEBUGTF DEBUGQ <<QString("%1 %2[%3]%4").arg(QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz")).arg(QFileInfo( __FILE__).baseName()).arg(__LINE__).arg(__func__)
|
#define DEBUGFW DEBUGW <<QString("%1[%2]%3").arg(QFileInfo( __FILE__).baseName()).arg(__LINE__).arg(__func__)
|
||||||
|
#define DEBUGT DEBUGQ <<QString("%1 %2[%3]%4").arg(QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz")).arg(QFileInfo( __FILE__).baseName()).arg(__LINE__)
|
||||||
|
#define DEBUGTF DEBUGQ <<QString("%1 %2[%3]%4").arg(QDateTime::currentDateTime().time().toString("hh:mm:ss.zzz")).arg(QFileInfo( __FILE__).baseName()).arg(__LINE__).arg(__func__)
|
||||||
|
|
||||||
// Do nothing
|
// Do nothing
|
||||||
#define Z( EXPRESSION ) /* comment out display of variable */
|
#define Z( EXPRESSION ) /* comment out display of variable */
|
||||||
@ -100,8 +102,10 @@ To turn off the the test macros.
|
|||||||
// Turn debugging off. macros expands to white space
|
// Turn debugging off. macros expands to white space
|
||||||
|
|
||||||
#define DEBUGQ
|
#define DEBUGQ
|
||||||
|
#define DEBUGW
|
||||||
#define DEBUGL
|
#define DEBUGL
|
||||||
#define DEBUGF
|
#define DEBUGF
|
||||||
|
#define DEBUGFW
|
||||||
#define DEBUGT
|
#define DEBUGT
|
||||||
#define DEBUGTF
|
#define DEBUGTF
|
||||||
|
|
||||||
|