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

reduce rebug messages during noraml operations

This commit is contained in:
LoudSnorer 2023-12-12 06:44:56 -05:00
parent e99a832a3f
commit 5f7c5650fb
2 changed files with 16 additions and 13 deletions
oscar/SleepLib

View File

@ -116,7 +116,7 @@ QString Session::eventFile() const
}
//const int max_pack_size=128;
bool Session::OpenEvents()
bool Session::OpenEvents(bool debug)
{
if (s_events_loaded) {
return true;
@ -131,12 +131,12 @@ bool Session::OpenEvents()
QString filename = eventFile();
#ifdef DEBUG_EVENTS
qDebug() << "Loading" << s_machine->loaderName().toLocal8Bit().data() << "Events:" << filename.toLocal8Bit().data();
if (debug) qDebug() << "Loading" << s_machine->loaderName().toLocal8Bit().data() << "Events:" << filename.toLocal8Bit().data();
#endif
bool b = LoadEvents(filename);
bool b = LoadEvents(filename,debug);
if ( ! b) {
qWarning() << "Error Loading Events" << filename;
if (debug) qWarning() << "Error Loading Events" << filename;
return false;
}
@ -394,7 +394,7 @@ bool Session::StoreSummary()
}
bool Session::LoadSummary()
bool Session::LoadSummary(bool debug)
{
// static int sumcnt = 0;
@ -402,14 +402,14 @@ bool Session::LoadSummary()
QString filename = s_machine->getSummariesPath() + toHexid(s_session) + ".000";
if (filename.isEmpty()) {
qDebug() << "Empty summary filename";
if (debug) qDebug() << "Empty summary filename";
return false;
}
QFile file(filename);
if (!file.open(QIODevice::ReadOnly)) {
qWarning() << "Could not open summary file" << filename << "for reading, error code" << file.error() << file.errorString();
if (debug) qWarning() << "Could not open summary file" << filename << "for reading, error code" << file.error() << file.errorString();
return false;
}
@ -428,7 +428,7 @@ bool Session::LoadSummary()
in >> t32;
if (t32 != magic) {
qDebug() << "Wrong magic number in " << filename;
if (debug) qDebug() << "Wrong magic number in " << filename;
return false;
}
@ -815,7 +815,7 @@ bool Session::StoreEvents()
return true;
}
bool Session::LoadEvents(QString filename)
bool Session::LoadEvents(QString filename, bool debug)
{
quint32 magicnum, machid, sessid;
quint16 version, type, crc16, machtype, compmethod;
@ -831,7 +831,7 @@ bool Session::LoadEvents(QString filename)
if ( ! file.open(QIODevice::ReadOnly)) {
// qDebug() << "No Event/Waveform data available for" << s_session;
qWarning() << "No Event/Waveform data available for" << s_session << "filename" << filename << "error code" << file.error() << file.errorString();
if (debug) qWarning() << "No Event/Waveform data available for" << s_session << "filename" << filename << "error code" << file.error() << file.errorString();
return false;
}

View File

@ -90,13 +90,16 @@ class Session
// void LoadSummaryData(QDataStream & in);
//! \brief Loads the Sessions Summary Indexes from filename, from SleepLibs custom data format.
bool LoadSummary();
// debug option is set to false because file errors are normal when there is summary but no details data
bool LoadSummary(bool debug=false);
//! \brief Loads the Sessions EventLists from filename, from SleepLibs custom data format.
bool LoadEvents(QString filename);
// debug option is set to false because file errors are normal when there is summary but no details data
bool LoadEvents(QString filename, bool debug=false);
//! \brief Loads the events for this session when requested (only the summaries are loaded at startup)
bool OpenEvents();
// debug option is set to false because file errors are normal when there is summary but no details data
bool OpenEvents(bool debug=false);
//! \brief Put the events away until needed again, freeing memory
void TrashEvents();