Overview page import refresh, plus other fixes

This commit is contained in:
Mark Watkins 2011-09-07 18:44:04 +10:00
parent 5d41068a79
commit f0ab45c5a4
4 changed files with 18 additions and 18 deletions

View File

@ -240,7 +240,6 @@ void UsageChart::SetDay(Day * day)
Layer::SetDay(day); Layer::SetDay(day);
//m_empty=true; //m_empty=true;
// if (!day) return; // if (!day) return;
m_empty=false;
m_values.clear(); m_values.clear();
m_miny=9999999; m_miny=9999999;
@ -255,6 +254,7 @@ void UsageChart::SetDay(Day * day)
m_fday=0; m_fday=0;
qint64 tt; qint64 tt;
int days=0;
for (QMap<QDate,QVector<Day *> >::iterator d=m_profile->daylist.begin();d!=m_profile->daylist.end();d++) { for (QMap<QDate,QVector<Day *> >::iterator d=m_profile->daylist.begin();d!=m_profile->daylist.end();d++) {
tt=QDateTime(d.key(),QTime(0,0,0),Qt::UTC).toTime_t(); tt=QDateTime(d.key(),QTime(0,0,0),Qt::UTC).toTime_t();
dn=tt/86400; dn=tt/86400;
@ -271,8 +271,10 @@ void UsageChart::SetDay(Day * day)
m_values[dn][1]=total; m_values[dn][1]=total;
if (total<m_miny) m_miny=total; if (total<m_miny) m_miny=total;
if (total>m_maxy) m_maxy=total; if (total>m_maxy) m_maxy=total;
days++;
} }
} }
if (!days) m_empty=true; else m_empty=false;
//m_maxy=ceil(m_maxy); //m_maxy=ceil(m_maxy);
//m_miny=floor(m_miny); //m_miny=floor(m_miny);
m_miny=0; m_miny=0;

View File

@ -185,11 +185,9 @@ void MainWindow::Startup()
if (daily) daily->ReloadGraphs(); if (daily) daily->ReloadGraphs();
/*if (overview) { if (overview) {
overview->ReloadGraphs(); overview->ReloadGraphs();
overview->UpdateGraphs(); }
}*/
qprogress->hide(); qprogress->hide();
qstatus->setText(""); qstatus->setText("");
@ -229,11 +227,9 @@ void MainWindow::on_action_Import_Data_triggered()
profile->Save(); profile->Save();
if (daily) daily->ReloadGraphs(); if (daily) daily->ReloadGraphs();
/*if (overview) { if (overview) {
overview->ReloadGraphs(); overview->ReloadGraphs();
overview->UpdateGraphs(); }
} */
//qDebug() << "overview->ReloadGraphs();"; //qDebug() << "overview->ReloadGraphs();";
} }
qstatus->setText(""); qstatus->setText("");

View File

@ -55,7 +55,7 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
const int default_height=180; const int default_height=180;
AHI=new gGraph(GraphView,"AHI Chart",default_height,2); AHI=new gGraph(GraphView,"AHI Chart",default_height,2);
UC=new gGraph(GraphView,"Usage Chart",default_height,2); UC=new gGraph(GraphView,"Usage Chart",default_height,2);
Layer *uc=new UsageChart(profile); uc=new UsageChart(profile);
UC->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin); UC->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);
gXAxis *gx=new gXAxis(); gXAxis *gx=new gXAxis();
gx->setUtcFix(true); gx->setUtcFix(true);
@ -77,7 +77,16 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
AHI->AddLayer(bc); AHI->AddLayer(bc);
AHI->AddLayer(new gXGrid()); AHI->AddLayer(new gXGrid());
//ReloadGraphs();
}
Overview::~Overview()
{
//delete day;
delete ui;
}
void Overview::ReloadGraphs()
{
bc->SetDay(NULL); bc->SetDay(NULL);
AHI->MinX(); AHI->MinX();
AHI->MaxX(); AHI->MaxX();
@ -87,14 +96,7 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
UC->MaxX(); UC->MaxX();
GraphView->ResetBounds(); GraphView->ResetBounds();
} }
Overview::~Overview()
{
//delete day;
delete ui;
}
/* /*
ui->setupUi(this); ui->setupUi(this);
profile=Profiles::Get(pref["Profile"].toString()); profile=Profiles::Get(pref["Profile"].toString());

View File

@ -27,7 +27,7 @@ public:
explicit Overview(QWidget *parent,gGraphView *shared=NULL); explicit Overview(QWidget *parent,gGraphView *shared=NULL);
~Overview(); ~Overview();
//void ReloadGraphs(); void ReloadGraphs();
//void UpdateGraphs(); //void UpdateGraphs();