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);
//m_empty=true;
// if (!day) return;
m_empty=false;
m_values.clear();
m_miny=9999999;
@ -255,6 +254,7 @@ void UsageChart::SetDay(Day * day)
m_fday=0;
qint64 tt;
int days=0;
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();
dn=tt/86400;
@ -271,8 +271,10 @@ void UsageChart::SetDay(Day * day)
m_values[dn][1]=total;
if (total<m_miny) m_miny=total;
if (total>m_maxy) m_maxy=total;
days++;
}
}
if (!days) m_empty=true; else m_empty=false;
//m_maxy=ceil(m_maxy);
//m_miny=floor(m_miny);
m_miny=0;

View File

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

View File

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

View File

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