diff --git a/Graphs/gLineChart.cpp b/Graphs/gLineChart.cpp index 5df68bd5..701438b2 100644 --- a/Graphs/gLineChart.cpp +++ b/Graphs/gLineChart.cpp @@ -72,7 +72,7 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry) //TextMarkup... GetTextExtent(msg,x,y,bigfont); //w.renderText(start_px+(width/2.0)-(x/2.0),start_py+(height/2.0)-(y/2.0),msg,*bigfont); - DrawText(w,msg,start_px+(width/2.0)-(x/2.0),scry-w.GetBottomMargin()-height/2.0+y/2.0,0,QColor("dark grey"),bigfont);//-(y/2.0) + DrawText(w,msg,start_px+(width/2.0)-(x/2.0),scry-w.GetBottomMargin()-height/2.0+y/2.0,0,Qt::gray,bigfont);//-(y/2.0) } return; } diff --git a/Graphs/glcommon.cpp b/Graphs/glcommon.cpp index 02b723d2..ff40a8cb 100644 --- a/Graphs/glcommon.cpp +++ b/Graphs/glcommon.cpp @@ -44,7 +44,7 @@ void GetTextExtent(QString text, float & width, float & height, QFont *font) width=fm.width(text); //fm.width(text); height=fm.xHeight()+2; //fm.ascent(); } -void DrawText(gGraphWindow & wid, QString text, float x, float y, float angle, QColor color,QFont *font) +void DrawText(gGraphWindow & wid, QString text, int x, int y, float angle, QColor color,QFont *font) { //QFontMetrics fm(*font); float w,h; @@ -56,22 +56,26 @@ void DrawText(gGraphWindow & wid, QString text, float x, float y, float angle, Q abort(); return; } - glColor4ub(color.red(),color.green(),color.blue(),color.alpha()); - if (angle==0) { - wid.renderText(x,y,text,*font); - // DrawText2(text,x,y,font); - return; - } + +// glEnable(GL_TEXTURE_2D); + glDisable(GL_DEPTH_TEST); + glFlush(); QPainter painter(&wid); + //painter.setFont(*font); + painter.setPen(Qt::black); + painter.setOpacity(1); + // painter.setCompositionMode(QPainter::CompositionMode_); + if (angle==0) { + painter.drawText(x,y,text); + } else { + GetTextExtent(text, w, h, font); + painter.translate(floor(x),floor(y)); + painter.rotate(-90); + painter.drawText(floor(-w/2.0),floor(-h/2.0),text); + painter.translate(floor(-x),floor(-y)); - GetTextExtent(text, w, h, font); + } - painter.translate(floor(x),floor(y)); - painter.rotate(-90); - painter.setFont(*font); - painter.setPen(QPen(color)); - painter.drawText(floor(-w/2.0),floor(-h/2.0),text); - painter.translate(floor(-x),floor(-y)); painter.end(); glDisable(GL_TEXTURE_2D); diff --git a/Graphs/glcommon.h b/Graphs/glcommon.h index 3d4865d7..d9ff3443 100644 --- a/Graphs/glcommon.h +++ b/Graphs/glcommon.h @@ -22,7 +22,7 @@ extern QFont * bigfont; class gGraphWindow; void GetTextExtent(QString text, float & width, float & height, QFont *font=defaultfont); -void DrawText(gGraphWindow & wid, QString text, float x, float y, float angle=0, QColor color=QColor("black"),QFont *font=defaultfont); +void DrawText(gGraphWindow & wid, QString text, int x, int y, float angle=0, QColor color=QColor("black"),QFont *font=defaultfont); void LinedRoundedRectangle(int x,int y,int w,int h,int radius,int lw,QColor color); void RoundedRectangle(int x,int y,int w,int h,int radius,const QColor color); diff --git a/SleepLib/profiles.cpp b/SleepLib/profiles.cpp index 9823081e..2fe915f9 100644 --- a/SleepLib/profiles.cpp +++ b/SleepLib/profiles.cpp @@ -255,7 +255,7 @@ Machine * Profile::GetMachine(MachineType t) } -Profile *profile=NULL; +//Profile *profile=NULL; QString SHA1(QString pass) { return pass; diff --git a/daily.cpp b/daily.cpp index e32df675..a928909f 100644 --- a/daily.cpp +++ b/daily.cpp @@ -100,15 +100,27 @@ Daily::Daily(QWidget *parent,QGLContext *context) : PRD->AddLayer(new gLineChart(pressure_eap,QColor("red"),4096,false,true,true)); PRD->setMinimumHeight(150); + AddCPAPData(leakdata=new EventData(CPAP_Leak,0)); + //leakdata->ForceMinY(0); + //leakdata->ForceMaxY(120); + AddGraph(LEAK=new gGraphWindow(gSplitter,"Leaks",SF)); + LEAK->AddLayer(new gXAxis()); + LEAK->AddLayer(new gYAxis()); + LEAK->AddLayer(new gFooBar()); + LEAK->AddLayer(new gLineChart(leakdata,QColor("purple"),4096,false,false,false)); + + LEAK->setMinimumHeight(150); + AddGraph(FRW=new gGraphWindow(gSplitter,"Flow Rate",SF)); - FRW->AddLayer(new gXAxis()); - FRW->AddLayer(new gYAxis()); FRW->AddLayer(new gFooBar()); + FRW->AddLayer(new gYAxis()); + FRW->AddLayer(new gXAxis()); FRW->AddLayer(new gLineOverlayBar(flags[0],QColor("light green"),"CSR")); gLineChart *g=new gLineChart(frw,QColor("black"),200000,true); g->ReportEmpty(true); + FRW->AddLayer(g); FRW->AddLayer(new gLineOverlayBar(flags[3],QColor("blue"),"H")); FRW->AddLayer(new gLineOverlayBar(flags[7],QColor("red"),"PR",LOT_Dot)); @@ -121,17 +133,6 @@ Daily::Daily(QWidget *parent,QGLContext *context) : FRW->setMinimumHeight(190); - AddCPAPData(leakdata=new EventData(CPAP_Leak,0)); - //leakdata->ForceMinY(0); - //leakdata->ForceMaxY(120); - AddGraph(LEAK=new gGraphWindow(gSplitter,"Leaks",SF)); - LEAK->AddLayer(new gXAxis()); - LEAK->AddLayer(new gYAxis()); - LEAK->AddLayer(new gFooBar()); - LEAK->AddLayer(new gLineChart(leakdata,QColor("purple"),4096,false,false,false)); - - LEAK->setMinimumHeight(150); - AddCPAPData(snore=new EventData(CPAP_SnoreGraph,0)); //snore->ForceMinY(0); //snore->ForceMaxY(15); diff --git a/mainwindow.cpp b/mainwindow.cpp index e097a850..c87f6035 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -79,7 +79,7 @@ void MainWindow::Startup() qstatus->setText("Loading Data"); qprogress->show(); - Profile *profile=Profiles::Get(pref["Profile"].toString()); + profile=Profiles::Get(pref["Profile"].toString()); profile->LoadMachineData(); daily=new Daily(ui->tabWidget,shared_context); diff --git a/mainwindow.h b/mainwindow.h index 028aa153..04163b1f 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -68,6 +68,7 @@ private: Overview * overview; QGLContext *shared_context; bool first_load; + Profile *profile; }; #endif // MAINWINDOW_H diff --git a/mainwindow.ui b/mainwindow.ui index 4571f74e..8e76fd13 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -255,13 +255,13 @@ - 100 + 115 0 - 100 + 115 16777215 @@ -338,188 +338,166 @@ QFrame::Raised - - - - 2 - 194 - 92 - 90 - - - - - 0 - 0 - - - - - 16777215 - 90 - - - - Overview - - - - :/icons/overview.png:/icons/overview.png - - - - 64 - 64 - - - - Qt::ToolButtonTextUnderIcon - - - true - - - - - - 2 - 98 - 92 - 90 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 90 - - - - Daily - - - - :/icons/edit-find.png:/icons/edit-find.png - - - - 64 - 64 - - - - Qt::ToolButtonTextUnderIcon - - - true - - - - - - 2 - 290 - 92 - 90 - - - - - 0 - 0 - - - - - 16777215 - 90 - - - - Preferences - - - - :/icons/preferences.png:/icons/preferences.png - - - - 64 - 64 - - - - Qt::ToolButtonTextUnderIcon - - - true - - - - - - 2 - 2 - 92 - 90 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 90 - - - - Import Data - - - - :/icons/sdcard.png:/icons/sdcard.png - - - - 64 - 64 - - - - false - - - Qt::ToolButtonTextUnderIcon - - - true - - - Qt::NoArrow - - + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 90 + + + + Import + + + + :/icons/sdcard.png:/icons/sdcard.png + + + + 64 + 64 + + + + false + + + Qt::ToolButtonTextUnderIcon + + + true + + + Qt::NoArrow + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 90 + + + + Daily + + + + :/icons/edit-find.png:/icons/edit-find.png + + + + 64 + 64 + + + + Qt::ToolButtonTextUnderIcon + + + true + + + + + + + + 0 + 0 + + + + + 16777215 + 90 + + + + Overview + + + + :/icons/overview.png:/icons/overview.png + + + + 64 + 64 + + + + Qt::ToolButtonTextUnderIcon + + + true + + + + + + + + 0 + 0 + + + + + 16777215 + 90 + + + + Preferences + + + + :/icons/preferences.png:/icons/preferences.png + + + + 64 + 64 + + + + Qt::ToolButtonTextUnderIcon + + + true + + + + @@ -535,7 +513,7 @@ 0 0 1089 - 25 + 29 diff --git a/overview.cpp b/overview.cpp index 38a394f7..8fc420f7 100644 --- a/overview.cpp +++ b/overview.cpp @@ -181,8 +181,7 @@ void UpdateCal(QCalendarWidget *cal) QDate d1=cal->minimumDate(); d1.setYMD(d1.year(),d1.month(),1); QTextCharFormat fmt=cal->weekdayTextFormat(Qt::Monday); - QBrush b(QColor("light grey")); - fmt.setForeground(b); + fmt.setForeground(QBrush(Qt::gray)); for (QDate d=d1;d < cal->minimumDate();d=d.addDays(1)) { cal->setDateTextFormat(d,fmt); }