Added Reset Graph Layout in View Menu

This commit is contained in:
Mark Watkins 2011-07-29 00:20:59 +10:00
parent 54af28ae61
commit 9b93c8f6ea
7 changed files with 28 additions and 73 deletions

View File

@ -4,7 +4,7 @@
License: GPL
*********************************************************************/
#ifndef GRAPHDATA_CUSTOM_H
/*#ifndef GRAPHDATA_CUSTOM_H
#define GRAPHDATA_CUSTOM_H
#include <QDateTime>
@ -13,7 +13,7 @@
#include "SleepLib/machine_common.h"
#include "graphdata.h"
/*
class FlagData:public gPointData
{
public:
@ -128,5 +128,6 @@ protected:
T_UHD uhd;
};
*/
#endif // GRAPHDATA_CUSTOM_H
*/

View File

@ -89,8 +89,6 @@ HEADERS += \
SleepLib/day.h \
Graphs/graphwindow.h \
Graphs/graphlayer.h \
Graphs/graphdata.h \
Graphs/graphdata_custom.h \
Graphs/gLineChart.h \
Graphs/gLineOverlay.h \
Graphs/gFooBar.h \

View File

@ -264,6 +264,7 @@ Daily::Daily(QWidget *parent,QGLWidget * shared) :
i=gSplitter->indexOf(FRW);
gSplitter->setStretchFactor(i,15);
//gSplitter->refresh();
gSplitter->setChildrenCollapsible(false); // We set this per widget..
@ -272,6 +273,8 @@ Daily::Daily(QWidget *parent,QGLWidget * shared) :
gSplitter->layout();
splitter_sizes=gSplitter->sizes();
QTextCharFormat format = ui->calendar->weekdayTextFormat(Qt::Saturday);
format.setForeground(QBrush(Qt::black, Qt::SolidPattern));
ui->calendar->setWeekdayTextFormat(Qt::Saturday, format);
@ -427,6 +430,11 @@ void Daily::on_calendar_selectionChanged()
Load(ui->calendar->selectedDate());
}
void Daily::ResetGraphLayout()
{
gSplitter->setSizes(splitter_sizes);
}
void Daily::Load(QDate date)
{
static Day * lastcpapday=NULL;
@ -451,14 +459,6 @@ void Daily::Load(QDate date)
const int gwwidth=240;
const int gwheight=25;
UpdateOXIGraphs(oxi);
//gSplitter->blockSignals(true);
//ui->scrollArea->blockSignals(true);
//ui->scrollArea->setUpdatesEnabled(false);
//gSplitter->setUpdatesEnabled(false);
//for (unsigned i=0;i<Graphs.size();i++) {
// Graphs[i]->setUpdatesEnabled(false);
//}
UpdateCPAPGraphs(cpap);
UpdateEventsTree(ui->treeWidget,cpap);
@ -470,7 +470,6 @@ void Daily::Load(QDate date)
Graphs[i]->hide();
}
spacer->hide();
//if (SF->isVisible()) SF->hide();
} else {
NoData->hide();
@ -486,20 +485,10 @@ void Daily::Load(QDate date)
gSplitter->setMinimumHeight(vis*default_height);
spacer->show();
//if (!SF->isVisible()) SF->show();
}
/*for (unsigned i=0;i<Graphs.size();i++) {
} */
//gSplitter->layout();
//for (unsigned i=0;i<Graphs.size();i++) {
// Graphs[i]->setUpdatesEnabled(true);
//}
//gSplitter->layout();
//ui->scrollArea->update();
gSplitter->update();
RedrawGraphs();
//ui->scrollArea->update();
QString epr,modestr;
float iap90,eap90;
@ -913,51 +902,3 @@ void Daily::on_JournalNotesUnderline_clicked()
cursor.mergeCharFormat(format);
//ui->JournalNotes->mergeCurrentCharFormat(format);
}
/*AHIGraph::AHIGraph(QObject * parent)
{
}
AHIGraph::~AHIGraph()
{
}
QObject * AHIGraph::create(const QString & mimeType, const QUrl & url, const QStringList & argumentNames, const QStringList & argumentValues) const
{
gGraphWindow * ahi;
ahi=new gGraphWindow(NULL,"",(QGLWidget *)NULL);
ahi->SetMargins(0,0,0,0);
gPointData *g_ahi=new AHIData();
//gCandleStick *l=new gCandleStick(g_ahi);
gPieChart *l=new gPieChart(g_ahi);
l->AddName(tr("H"));
l->AddName(tr("OA"));
l->AddName(tr("CA"));
l->AddName(tr("RE"));
l->AddName(tr("FL"));
l->AddName(tr("CSR"));
l->color.clear();
l->color.push_back(QColor("blue"));
l->color.push_back(QColor(0x40,0xaf,0xbf,0xff)); //#40afbf
l->color.push_back(QColor(0xb2,0x54,0xcd,0xff)); //b254cd; //wxPURPLE);
l->color.push_back(QColor("yellow"));
l->color.push_back(QColor(0x40,0x40,0x40,255));
l->color.push_back(QColor(0x60,0xff,0x60,0xff)); //80ff80
return ahi;
}
QList<QWebPluginFactory::Plugin> AHIGraph::plugins() const
{
QWebPluginFactory::MimeType mimeType;
mimeType.name = "text/csv";
mimeType.description = "Comma-separated values";
mimeType.fileExtensions = QStringList() << "csv";
QWebPluginFactory::Plugin plugin;
plugin.name = "Pie Chart";
plugin.description = "A Pie Chart Web plugin.";
plugin.mimeTypes = QList<MimeType>() << mimeType;
return QList<QWebPluginFactory::Plugin>() << plugin;
}
*/

View File

@ -17,7 +17,7 @@
#include <QWebPluginFactory>
#include <SleepLib/profiles.h>
#include <Graphs/graphwindow.h>
#include <Graphs/graphdata.h>
//#include <Graphs/graphdata.h>
#include "Graphs/gLineChart.h"
#include <Graphs/gFlagsLine.h>
namespace Ui {
@ -33,6 +33,7 @@ public:
~Daily();
void ReloadGraphs();
void RedrawGraphs();
void ResetGraphLayout();
QGLWidget *SharedWidget() { return SF; }
private slots:
@ -72,6 +73,7 @@ private:
vector<gGraphWindow *> Graphs;
QGLContext *offscreen_context;
QList<int> splitter_sizes;
gLayer * AddCPAP(gLayer *d) { CPAPData.push_back(d); return d; }
gLayer * AddOXI(gLayer *d) { OXIData.push_back(d); return d; }
void AddGraph(gGraphWindow *w);

View File

@ -343,3 +343,8 @@ void MainWindow::on_action_Memory_Hog_toggled(bool checked)
{
pref["MemoryHog"]=checked;
}
void MainWindow::on_action_Reset_Graph_Layout_triggered()
{
if (daily) daily->ResetGraphLayout();
}

View File

@ -76,6 +76,8 @@ private slots:
void on_action_Memory_Hog_toggled(bool arg1);
void on_action_Reset_Graph_Layout_triggered();
private:
Ui::MainWindow *ui;
Daily * daily;

View File

@ -597,6 +597,7 @@
<addaction name="action_Memory_Hog"/>
<addaction name="separator"/>
<addaction name="action_Fullscreen"/>
<addaction name="action_Reset_Graph_Layout"/>
</widget>
<widget class="QMenu" name="menu_Help">
<property name="title">
@ -727,6 +728,11 @@
<string>&amp;Memory Hog</string>
</property>
</action>
<action name="action_Reset_Graph_Layout">
<property name="text">
<string>&amp;Reset Graph Layout</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>