mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-06 11:10:44 +00:00
Activate Hide sessions switches
This commit is contained in:
parent
c659706f2d
commit
0faf09a151
@ -140,6 +140,8 @@ void gFlagsLine::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
qint64 X,Y;
|
qint64 X,Y;
|
||||||
m_flag_color=schema::channel[m_code].defaultColor();
|
m_flag_color=schema::channel[m_code].defaultColor();
|
||||||
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end(); s++) {
|
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end(); s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
if ((*s)->eventlist.find(m_code)==(*s)->eventlist.end()) continue;
|
if ((*s)->eventlist.find(m_code)==(*s)->eventlist.end()) continue;
|
||||||
|
|
||||||
EventList & el=*((*s)->eventlist[m_code][0]);
|
EventList & el=*((*s)->eventlist[m_code][0]);
|
||||||
|
@ -189,10 +189,12 @@ void gLineChart::paint(gGraph & w,int left, int top, int width, int height)
|
|||||||
|
|
||||||
codepoints=0;
|
codepoints=0;
|
||||||
for (int svi=0;svi<m_day->size();svi++) {
|
for (int svi=0;svi<m_day->size();svi++) {
|
||||||
if (!(*m_day)[svi]) {
|
Session *sess=(*m_day)[svi];
|
||||||
|
if (!sess) {
|
||||||
qWarning() << "gLineChart::Plot() NULL Session Record.. This should not happen";
|
qWarning() << "gLineChart::Plot() NULL Session Record.. This should not happen";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!sess->enabled()) continue;
|
||||||
schema::Channel ch=schema::channel[code];
|
schema::Channel ch=schema::channel[code];
|
||||||
bool fndbetter=false;
|
bool fndbetter=false;
|
||||||
for (QList<schema::Channel *>::iterator l=ch.m_links.begin();l!=ch.m_links.end();l++) {
|
for (QList<schema::Channel *>::iterator l=ch.m_links.begin();l!=ch.m_links.end();l++) {
|
||||||
|
@ -61,6 +61,7 @@ void gLineOverlayBar::paint(gGraph & w, int left, int topp, int width, int heigh
|
|||||||
}
|
}
|
||||||
EventStoreType raw;
|
EventStoreType raw;
|
||||||
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end(); s++) {
|
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end(); s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
cei=(*s)->eventlist.find(m_code);
|
cei=(*s)->eventlist.find(m_code);
|
||||||
if (cei==(*s)->eventlist.end()) continue;
|
if (cei==(*s)->eventlist.end()) continue;
|
||||||
if (cei.value().size()==0) continue;
|
if (cei.value().size()==0) continue;
|
||||||
@ -166,6 +167,7 @@ void gLineOverlaySummary::paint(gGraph & w,int left, int top, int width, int hei
|
|||||||
|
|
||||||
// Calculate the session time.
|
// Calculate the session time.
|
||||||
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end(); s++) {
|
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end(); s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
first=(*s)->first();
|
first=(*s)->first();
|
||||||
last=(*s)->last();
|
last=(*s)->last();
|
||||||
if (last < w.min_x) continue;
|
if (last < w.min_x) continue;
|
||||||
|
@ -38,6 +38,8 @@ void gSegmentChart::SetDay(Day *d)
|
|||||||
for (int c=0;c<m_codes.size();c++) {
|
for (int c=0;c<m_codes.size();c++) {
|
||||||
m_values[c]=0;
|
m_values[c]=0;
|
||||||
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end();s++) {
|
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
int cnt=(*s)->count(m_codes[c]);
|
int cnt=(*s)->count(m_codes[c]);
|
||||||
m_values[c]+=cnt;
|
m_values[c]+=cnt;
|
||||||
m_total+=cnt;
|
m_total+=cnt;
|
||||||
@ -211,6 +213,8 @@ void gTAPGraph::SetDay(Day *d)
|
|||||||
//bool changed;
|
//bool changed;
|
||||||
EventDataType gain=1,offset=0;
|
EventDataType gain=1,offset=0;
|
||||||
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end();s++) {
|
for (QVector<Session *>::iterator s=m_day->begin();s!=m_day->end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
if ((*s)->eventlist.find(m_code)==(*s)->eventlist.end()) continue;
|
if ((*s)->eventlist.find(m_code)==(*s)->eventlist.end()) continue;
|
||||||
for (int q=0;q<(*s)->eventlist[m_code].size();q++) {
|
for (int q=0;q<(*s)->eventlist[m_code].size();q++) {
|
||||||
EventList &el=*(*s)->eventlist[m_code][q];
|
EventList &el=*(*s)->eventlist[m_code][q];
|
||||||
|
@ -93,10 +93,13 @@ void SummaryChart::SetDay(Day * nullday)
|
|||||||
dz2*=86400; // ft = first sessions time, rounded back to midnight..
|
dz2*=86400; // ft = first sessions time, rounded back to midnight..
|
||||||
|
|
||||||
for (int s=0;s<day->size();s++) {
|
for (int s=0;s<day->size();s++) {
|
||||||
tmp=(*day)[s]->hours();
|
Session *sess=(*day)[s];
|
||||||
|
if (!sess->enabled()) continue;
|
||||||
|
|
||||||
|
tmp=sess->hours();
|
||||||
m_values[dn][s]=tmp;
|
m_values[dn][s]=tmp;
|
||||||
total+=tmp;
|
total+=tmp;
|
||||||
zt=qint64((*day)[s]->first())/1000L;
|
zt=qint64(sess->first())/1000L;
|
||||||
zt+=tz_offset;
|
zt+=tz_offset;
|
||||||
tmp2=zt-dn*86400;
|
tmp2=zt-dn*86400;
|
||||||
|
|
||||||
|
@ -54,6 +54,8 @@ EventDataType Day::settings_sum(ChannelID code)
|
|||||||
EventDataType val=0;
|
EventDataType val=0;
|
||||||
QVector<Session *>::iterator s;
|
QVector<Session *>::iterator s;
|
||||||
for (s=sessions.begin();s!=sessions.end();s++) {
|
for (s=sessions.begin();s!=sessions.end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
QHash<ChannelID,QVariant>::iterator i=sess.settings.find(code);
|
QHash<ChannelID,QVariant>::iterator i=sess.settings.find(code);
|
||||||
if (i!=sess.settings.end()) {
|
if (i!=sess.settings.end()) {
|
||||||
@ -69,6 +71,8 @@ EventDataType Day::settings_max(ChannelID code)
|
|||||||
|
|
||||||
QVector<Session *>::iterator s;
|
QVector<Session *>::iterator s;
|
||||||
for (s=sessions.begin();s!=sessions.end();s++) {
|
for (s=sessions.begin();s!=sessions.end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
QHash<ChannelID,QVariant>::iterator i=sess.settings.find(code);
|
QHash<ChannelID,QVariant>::iterator i=sess.settings.find(code);
|
||||||
if (i!=sess.settings.end()) {
|
if (i!=sess.settings.end()) {
|
||||||
@ -86,6 +90,8 @@ EventDataType Day::settings_min(ChannelID code)
|
|||||||
|
|
||||||
QVector<Session *>::iterator s;
|
QVector<Session *>::iterator s;
|
||||||
for (s=sessions.begin();s!=sessions.end();s++) {
|
for (s=sessions.begin();s!=sessions.end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
QHash<ChannelID,QVariant>::iterator i=sess.settings.find(code);
|
QHash<ChannelID,QVariant>::iterator i=sess.settings.find(code);
|
||||||
if (i!=sess.settings.end()) {
|
if (i!=sess.settings.end()) {
|
||||||
@ -108,6 +114,8 @@ EventDataType Day::settings_avg(ChannelID code)
|
|||||||
int cnt=0;
|
int cnt=0;
|
||||||
QVector<Session *>::iterator s;
|
QVector<Session *>::iterator s;
|
||||||
for (s=sessions.begin();s!=sessions.end();s++) {
|
for (s=sessions.begin();s!=sessions.end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
QHash<ChannelID,QVariant>::iterator i=sess.settings.find(code);
|
QHash<ChannelID,QVariant>::iterator i=sess.settings.find(code);
|
||||||
if (i!=sess.settings.end()) {
|
if (i!=sess.settings.end()) {
|
||||||
@ -122,6 +130,8 @@ EventDataType Day::settings_wavg(ChannelID code)
|
|||||||
{
|
{
|
||||||
double s0=0,s1=0,s2=0,tmp;
|
double s0=0,s1=0,s2=0,tmp;
|
||||||
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
|
|
||||||
QHash<ChannelID,QVariant>::iterator i=sess.settings.find(code);
|
QHash<ChannelID,QVariant>::iterator i=sess.settings.find(code);
|
||||||
@ -148,6 +158,8 @@ EventDataType Day::percentile(ChannelID code,EventDataType percentile)
|
|||||||
// Don't assume sessions are in order.
|
// Don't assume sessions are in order.
|
||||||
QVector<EventDataType> ar;
|
QVector<EventDataType> ar;
|
||||||
for (s=sessions.begin();s!=sessions.end();s++) {
|
for (s=sessions.begin();s!=sessions.end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
QHash<ChannelID,QHash<EventStoreType, EventStoreType> > ::iterator ei=sess.m_valuesummary.find(code);
|
QHash<ChannelID,QHash<EventStoreType, EventStoreType> > ::iterator ei=sess.m_valuesummary.find(code);
|
||||||
if (ei==sess.m_valuesummary.end()) continue;
|
if (ei==sess.m_valuesummary.end()) continue;
|
||||||
@ -195,6 +207,8 @@ EventDataType Day::avg(ChannelID code)
|
|||||||
|
|
||||||
// Don't assume sessions are in order.
|
// Don't assume sessions are in order.
|
||||||
for (s=sessions.begin();s!=sessions.end();s++) {
|
for (s=sessions.begin();s!=sessions.end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
if (sess.m_avg.contains(code)) {
|
if (sess.m_avg.contains(code)) {
|
||||||
val+=sess.avg(code);
|
val+=sess.avg(code);
|
||||||
@ -212,6 +226,8 @@ EventDataType Day::sum(ChannelID code)
|
|||||||
QVector<Session *>::iterator s;
|
QVector<Session *>::iterator s;
|
||||||
|
|
||||||
for (s=sessions.begin();s!=sessions.end();s++) {
|
for (s=sessions.begin();s!=sessions.end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
if (sess.m_sum.contains(code)) {
|
if (sess.m_sum.contains(code)) {
|
||||||
val+=sess.sum(code);
|
val+=sess.sum(code);
|
||||||
@ -225,7 +241,10 @@ EventDataType Day::wavg(ChannelID code)
|
|||||||
double s0=0,s1=0,s2=0;
|
double s0=0,s1=0,s2=0;
|
||||||
qint64 d;
|
qint64 d;
|
||||||
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
|
|
||||||
if (sess.m_wavg.contains(code)) {
|
if (sess.m_wavg.contains(code)) {
|
||||||
d=sess.length();//.last(code)-sess.first(code);
|
d=sess.length();//.last(code)-sess.first(code);
|
||||||
s0=double(d)/3600000.0;
|
s0=double(d)/3600000.0;
|
||||||
@ -245,6 +264,8 @@ qint64 Day::total_time()
|
|||||||
{
|
{
|
||||||
qint64 d_totaltime=0;
|
qint64 d_totaltime=0;
|
||||||
for (QVector<Session *>::iterator s=begin();s!=end();s++) {
|
for (QVector<Session *>::iterator s=begin();s!=end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
Session & sess=*(*s);
|
Session & sess=*(*s);
|
||||||
d_totaltime+=sess.length();
|
d_totaltime+=sess.length();
|
||||||
}
|
}
|
||||||
@ -273,6 +294,7 @@ qint64 Day::first(ChannelID code)
|
|||||||
qint64 tmp;
|
qint64 tmp;
|
||||||
|
|
||||||
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
tmp=(*s)->first(code);
|
tmp=(*s)->first(code);
|
||||||
if (!tmp) continue;
|
if (!tmp) continue;
|
||||||
if (!date) {
|
if (!date) {
|
||||||
@ -290,6 +312,7 @@ qint64 Day::last(ChannelID code)
|
|||||||
qint64 tmp;
|
qint64 tmp;
|
||||||
|
|
||||||
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
tmp=(*s)->last(code);
|
tmp=(*s)->last(code);
|
||||||
if (!tmp) continue;
|
if (!tmp) continue;
|
||||||
if (!date) {
|
if (!date) {
|
||||||
@ -306,9 +329,9 @@ EventDataType Day::Min(ChannelID code)
|
|||||||
EventDataType tmp;
|
EventDataType tmp;
|
||||||
bool first=true;
|
bool first=true;
|
||||||
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
||||||
if (!(*s)->m_min.contains(code))
|
|
||||||
|
if ((!(*s)->m_min.contains(code)) || (!(*s)->enabled()))
|
||||||
continue;
|
continue;
|
||||||
//if ((*s)->eventlist.find(code)==(*s)->eventlist.end()) continue;
|
|
||||||
tmp=(*s)->Min(code);
|
tmp=(*s)->Min(code);
|
||||||
if (first) {
|
if (first) {
|
||||||
min=tmp;
|
min=tmp;
|
||||||
@ -324,6 +347,7 @@ bool Day::hasData(ChannelID code, SummaryType type)
|
|||||||
{
|
{
|
||||||
bool has=false;
|
bool has=false;
|
||||||
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
Session *sess=*s;
|
Session *sess=*s;
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case ST_90P:
|
case ST_90P:
|
||||||
@ -377,6 +401,8 @@ EventDataType Day::Max(ChannelID code)
|
|||||||
EventDataType tmp;
|
EventDataType tmp;
|
||||||
bool first=true;
|
bool first=true;
|
||||||
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
for (QVector<Session *>::iterator s=sessions.begin();s!=sessions.end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
if (!(*s)->m_max.contains(code)) continue;
|
if (!(*s)->m_max.contains(code)) continue;
|
||||||
// if ((*s)->eventlist.find(code)==(*s)->eventlist.end()) continue;
|
// if ((*s)->eventlist.find(code)==(*s)->eventlist.end()) continue;
|
||||||
tmp=(*s)->Max(code);
|
tmp=(*s)->Max(code);
|
||||||
@ -394,6 +420,7 @@ EventDataType Day::cph(ChannelID code)
|
|||||||
EventDataType sum=0;
|
EventDataType sum=0;
|
||||||
//EventDataType h=0;
|
//EventDataType h=0;
|
||||||
for (int i=0;i<sessions.size();i++) {
|
for (int i=0;i<sessions.size();i++) {
|
||||||
|
if (!sessions[i]->enabled()) continue;
|
||||||
if (!sessions[i]->m_cph.contains(code)) continue;
|
if (!sessions[i]->m_cph.contains(code)) continue;
|
||||||
sum+=sessions[i]->cph(code)*sessions[i]->hours();
|
sum+=sessions[i]->cph(code)*sessions[i]->hours();
|
||||||
//h+=sessions[i]->hours();
|
//h+=sessions[i]->hours();
|
||||||
@ -407,6 +434,7 @@ EventDataType Day::sph(ChannelID code)
|
|||||||
EventDataType sum=0;
|
EventDataType sum=0;
|
||||||
EventDataType h=0;
|
EventDataType h=0;
|
||||||
for (int i=0;i<sessions.size();i++) {
|
for (int i=0;i<sessions.size();i++) {
|
||||||
|
if (!sessions[i]->enabled()) continue;
|
||||||
if (!sessions[i]->m_sum.contains(code)) continue;
|
if (!sessions[i]->m_sum.contains(code)) continue;
|
||||||
sum+=sessions[i]->sum(code)/3600.0;//*sessions[i]->hours();
|
sum+=sessions[i]->sum(code)/3600.0;//*sessions[i]->hours();
|
||||||
//h+=sessions[i]->hours();
|
//h+=sessions[i]->hours();
|
||||||
@ -420,6 +448,7 @@ int Day::count(ChannelID code)
|
|||||||
{
|
{
|
||||||
int sum=0;
|
int sum=0;
|
||||||
for (int i=0;i<sessions.size();i++) {
|
for (int i=0;i<sessions.size();i++) {
|
||||||
|
if (!sessions[i]->enabled()) continue;
|
||||||
sum+=sessions[i]->count(code);
|
sum+=sessions[i]->count(code);
|
||||||
}
|
}
|
||||||
return sum;
|
return sum;
|
||||||
@ -427,6 +456,7 @@ int Day::count(ChannelID code)
|
|||||||
bool Day::settingExists(ChannelID id)
|
bool Day::settingExists(ChannelID id)
|
||||||
{
|
{
|
||||||
for (int j=0;j<sessions.size();j++) {
|
for (int j=0;j<sessions.size();j++) {
|
||||||
|
if (!sessions[j]->enabled()) continue;
|
||||||
QHash<ChannelID,QVariant>::iterator i=sessions[j]->settings.find(id);
|
QHash<ChannelID,QVariant>::iterator i=sessions[j]->settings.find(id);
|
||||||
if (i!=sessions[j]->settings.end()) {
|
if (i!=sessions[j]->settings.end()) {
|
||||||
return true;
|
return true;
|
||||||
@ -450,6 +480,8 @@ bool Day::channelExists(ChannelID id)
|
|||||||
{
|
{
|
||||||
bool r=false;
|
bool r=false;
|
||||||
for (int i=0;i<sessions.size();i++) {
|
for (int i=0;i<sessions.size();i++) {
|
||||||
|
if (!sessions[i]->enabled()) continue;
|
||||||
|
|
||||||
if (sessions[i]->eventlist.contains(id)) {
|
if (sessions[i]->eventlist.contains(id)) {
|
||||||
r=true;
|
r=true;
|
||||||
break;
|
break;
|
||||||
@ -464,6 +496,8 @@ bool Day::channelHasData(ChannelID id)
|
|||||||
{
|
{
|
||||||
bool r=false;
|
bool r=false;
|
||||||
for (int i=0;i<sessions.size();i++) {
|
for (int i=0;i<sessions.size();i++) {
|
||||||
|
if (!sessions[i]->enabled()) continue;
|
||||||
|
|
||||||
if (sessions[i]->channelExists(id)) {
|
if (sessions[i]->channelExists(id)) {
|
||||||
r=true;
|
r=true;
|
||||||
break;
|
break;
|
||||||
|
@ -758,6 +758,8 @@ EventDataType Profile::calcPercentile(ChannelID code, EventDataType percent, Mac
|
|||||||
if (day) {
|
if (day) {
|
||||||
for (int i=0;i<day->size();i++) {
|
for (int i=0;i<day->size();i++) {
|
||||||
for (QVector<Session *>::iterator s=day->begin();s!=day->end();s++) {
|
for (QVector<Session *>::iterator s=day->begin();s!=day->end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
Session *sess=*s;
|
Session *sess=*s;
|
||||||
gain=sess->m_gain[code];
|
gain=sess->m_gain[code];
|
||||||
if (!gain) gain=1;
|
if (!gain) gain=1;
|
||||||
|
@ -35,6 +35,7 @@ Session::Session(Machine * m,SessionID session)
|
|||||||
s_changed=false;
|
s_changed=false;
|
||||||
s_events_loaded=false;
|
s_events_loaded=false;
|
||||||
_first_session=true;
|
_first_session=true;
|
||||||
|
s_enabled=-1;
|
||||||
|
|
||||||
s_first=s_last=0;
|
s_first=s_last=0;
|
||||||
s_eventfile="";
|
s_eventfile="";
|
||||||
@ -649,6 +650,25 @@ bool Session::SearchEvent(ChannelID code, qint64 time, qint64 dist)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Session::enabled()
|
||||||
|
{
|
||||||
|
if (s_enabled>=0) {
|
||||||
|
return s_enabled;
|
||||||
|
}
|
||||||
|
if (!settings.contains(SESSION_ENABLED)) {
|
||||||
|
settings[SESSION_ENABLED]=s_enabled=true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
s_enabled=settings[SESSION_ENABLED].toBool();
|
||||||
|
return s_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Session::setEnabled(bool b)
|
||||||
|
{
|
||||||
|
settings[SESSION_ENABLED]=s_enabled=b;
|
||||||
|
SetChanged(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
EventDataType Session::Min(ChannelID id)
|
EventDataType Session::Min(ChannelID id)
|
||||||
{
|
{
|
||||||
@ -762,6 +782,7 @@ qint64 Session::last(ChannelID id)
|
|||||||
}
|
}
|
||||||
bool Session::channelExists(ChannelID id)
|
bool Session::channelExists(ChannelID id)
|
||||||
{
|
{
|
||||||
|
if (!enabled()) return false;
|
||||||
if (s_events_loaded) {
|
if (s_events_loaded) {
|
||||||
QHash<ChannelID,QVector<EventList *> >::iterator j=eventlist.find(id);
|
QHash<ChannelID,QVector<EventList *> >::iterator j=eventlist.find(id);
|
||||||
if (j==eventlist.end()) // eventlist not loaded.
|
if (j==eventlist.end()) // eventlist not loaded.
|
||||||
|
@ -64,6 +64,12 @@ public:
|
|||||||
return s_session;
|
return s_session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! \brief Returns whether or not session is being used.
|
||||||
|
bool enabled();
|
||||||
|
|
||||||
|
//! \brief Sets whether or not session is being used.
|
||||||
|
void setEnabled(bool b);
|
||||||
|
|
||||||
//! \brief Return the start of this sessions time range (in milliseconds since epoch)
|
//! \brief Return the start of this sessions time range (in milliseconds since epoch)
|
||||||
qint64 first() {
|
qint64 first() {
|
||||||
return s_first;
|
return s_first;
|
||||||
@ -245,6 +251,7 @@ protected:
|
|||||||
bool _first_session;
|
bool _first_session;
|
||||||
|
|
||||||
bool s_events_loaded;
|
bool s_events_loaded;
|
||||||
|
char s_enabled;
|
||||||
QString s_eventfile;
|
QString s_eventfile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
29
daily.cpp
29
daily.cpp
@ -350,20 +350,30 @@ void Daily::Link_clicked(const QUrl &url)
|
|||||||
QString data=url.toString().section("=",1);
|
QString data=url.toString().section("=",1);
|
||||||
int sid=data.toInt();
|
int sid=data.toInt();
|
||||||
Day *day=NULL;
|
Day *day=NULL;
|
||||||
if (code=="togglecpapsession") {
|
if (code=="togglecpapsession") { // Enable/Disable CPAP session
|
||||||
day=PROFILE.GetDay(previous_date,MT_CPAP);
|
day=PROFILE.GetDay(previous_date,MT_CPAP);
|
||||||
Session *sess=day->find(sid);
|
Session *sess=day->find(sid);
|
||||||
if (!sess)
|
if (!sess)
|
||||||
return;
|
return;
|
||||||
bool b;
|
sess->setEnabled(!sess->enabled());
|
||||||
if (sess->settings.contains(SESSION_ENABLED)) b=false;
|
|
||||||
else b=!sess->settings[SESSION_ENABLED].toBool();
|
|
||||||
sess->settings[SESSION_ENABLED]=b;
|
|
||||||
sess->SetChanged(true);
|
|
||||||
day->machine->Save();
|
|
||||||
GraphView->ResetBounds();
|
|
||||||
|
|
||||||
// reload day
|
// Messy, this rewrites both summary & events.. TODO: Write just the session summary file
|
||||||
|
day->machine->Save();
|
||||||
|
|
||||||
|
// Reload day
|
||||||
|
this->LoadDate(previous_date);
|
||||||
|
return;
|
||||||
|
} else if (code=="toggleoxisession") { // Enable/Disable Oximetry session
|
||||||
|
day=PROFILE.GetDay(previous_date,MT_OXIMETER);
|
||||||
|
Session *sess=day->find(sid);
|
||||||
|
if (!sess)
|
||||||
|
return;
|
||||||
|
sess->setEnabled(!sess->enabled());
|
||||||
|
// Messy, this rewrites both summary & events.. TODO: Write just the session summary file
|
||||||
|
day->machine->Save();
|
||||||
|
|
||||||
|
// Reload day
|
||||||
|
this->LoadDate(previous_date);
|
||||||
return;
|
return;
|
||||||
} else if (code=="cpap") {
|
} else if (code=="cpap") {
|
||||||
day=PROFILE.GetDay(previous_date,MT_CPAP);
|
day=PROFILE.GetDay(previous_date,MT_CPAP);
|
||||||
@ -438,6 +448,7 @@ void Daily::UpdateEventsTree(QTreeWidget *tree,Day *day)
|
|||||||
QHash<ChannelID,int> mccnt;
|
QHash<ChannelID,int> mccnt;
|
||||||
int total_events=0;
|
int total_events=0;
|
||||||
for (QVector<Session *>::iterator s=day->begin();s!=day->end();s++) {
|
for (QVector<Session *>::iterator s=day->begin();s!=day->end();s++) {
|
||||||
|
if (!(*s)->enabled()) continue;
|
||||||
|
|
||||||
QHash<ChannelID,QVector<EventList *> >::iterator m;
|
QHash<ChannelID,QVector<EventList *> >::iterator m;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user