From 5ae43e8ab8ba112e974baa5d174e2c501b974584 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Mon, 18 Aug 2014 03:03:50 +1000 Subject: [PATCH] Remove bottom duration in statusbar --- sleepyhead/Graphs/gGraph.cpp | 5 -- sleepyhead/Graphs/gGraphView.cpp | 66 -------------------------- sleepyhead/Graphs/gGraphView.h | 3 -- sleepyhead/Graphs/gSummaryChart.cpp | 1 - sleepyhead/SleepLib/journal.h | 3 ++ sleepyhead/SleepLib/progressdialog.cpp | 8 +++- sleepyhead/SleepLib/progressdialog.h | 2 + sleepyhead/mainwindow.cpp | 26 ++-------- 8 files changed, 15 insertions(+), 99 deletions(-) diff --git a/sleepyhead/Graphs/gGraph.cpp b/sleepyhead/Graphs/gGraph.cpp index f1760320..9561c7d9 100644 --- a/sleepyhead/Graphs/gGraph.cpp +++ b/sleepyhead/Graphs/gGraph.cpp @@ -18,7 +18,6 @@ #include "Graphs/layer.h" #include "SleepLib/profiles.h" -extern QLabel *qstatus2; extern MainWindow *mainwin; // Graph globals. @@ -757,10 +756,6 @@ void gGraph::mouseMoveEvent(QMouseEvent *event) int offset = (x >= x2) ? 20 : - 20; ToolTip(m_selDurString, m_rect.left() + x + offset, m_rect.top() + y + 20, align); - if (qstatus2) { - qstatus2->setText(m_selDurString); - } - doredraw = true; } else if (event->buttons() & Qt::RightButton) { // Right Mouse button dragging m_graphview->setPointClicked(event->pos()); diff --git a/sleepyhead/Graphs/gGraphView.cpp b/sleepyhead/Graphs/gGraphView.cpp index 316347f7..547298e1 100644 --- a/sleepyhead/Graphs/gGraphView.cpp +++ b/sleepyhead/Graphs/gGraphView.cpp @@ -34,7 +34,6 @@ #include "SleepLib/profiles.h" extern MainWindow *mainwin; -extern QLabel *qstatus2; #include @@ -882,31 +881,6 @@ void gGraphView::scrollbarValueChanged(int val) } } -void gGraphView::updateSelectionTime() -{ - qint64 xx = m_maxx - m_minx; - double d = xx / 86400000L; - int h = xx / 3600000L; - int m = (xx / 60000) % 60; - int s = (xx / 1000) % 60; - int ms(xx % 1000); - QString str; - - if (d > 1) { - /*QDate d1=QDateTime::fromTime_t(m_minx/1000).toUTC().date(); - QDate d2=QDateTime::fromTime_t(m_maxx/1000).toUTC().date(); - d=p_profile->countDays(MT_CPAP,d1,d2); */ - - str.sprintf("%1.0f days", ceil(d)); - } else { - str.sprintf("%02i:%02i:%02i:%03i", h, m, s, ms); - } - - if (qstatus2) { - qstatus2->setText(str); - } - -} void gGraphView::GetRXBounds(qint64 &st, qint64 &et) { //qint64 m1=0,m2=0; @@ -954,28 +928,6 @@ void gGraphView::ResetBounds(bool refresh) //short group) m_minx = g->min_x; m_maxx = g->max_x; - qint64 xx = g->max_x - g->min_x; - double d = xx / 86400000L; - int h = xx / 3600000L; - int m = (xx / 60000) % 60; - int s = (xx / 1000) % 60; - int ms(xx % 1000); - QString str; - - if (d > 1) { - /*QDate d1=QDateTime::fromTime_t(m_minx/1000).toUTC().date(); - QDate d2=QDateTime::fromTime_t(m_maxx/1000).toUTC().date(); - d=p_profile->countDays(MT_CPAP,d1,d2); */ - - str.sprintf("%1.0f days", ceil(d)); - } else { - str.sprintf("%02i:%02i:%02i:%03i", h, m, s, ms); - } - - if (qstatus2) { - qstatus2->setText(str); - } - updateScale(); } @@ -996,24 +948,6 @@ void gGraphView::SetXBounds(qint64 minx, qint64 maxx, short group, bool refresh) m_minx = minx; m_maxx = maxx; - qint64 xx = maxx - minx; - double d = xx / 86400000L; - int h = xx / 3600000L; - int m = (xx / 60000) % 60; - int s = (xx / 1000) % 60; - int ms(xx % 1000); - QString str = ""; - - if (d > 1) { - str.sprintf("%1.0f days", ceil(xx / 86400000.0)); - } else { - str.sprintf("%02i:%02i:%02i:%03i", h, m, s, ms); - } - - if (qstatus2) { - qstatus2->setText(str); - } - if (refresh) { redraw(); } } diff --git a/sleepyhead/Graphs/gGraphView.h b/sleepyhead/Graphs/gGraphView.h index d8ba102e..b0c9e847 100644 --- a/sleepyhead/Graphs/gGraphView.h +++ b/sleepyhead/Graphs/gGraphView.h @@ -342,9 +342,6 @@ class gGraphView gToolTip *m_tooltip; QTimer *timer; - //! \brief Updates the current selection time in the statusbar area - void updateSelectionTime(); - //! \brief Add the Text information to the Text Drawing Queue (called by gGraphs renderText method) void AddTextQue(const QString &text, QRectF rect, quint32 flags, float angle = 0.0, QColor color = Qt::black, QFont *font = defaultfont, bool antialias = true); diff --git a/sleepyhead/Graphs/gSummaryChart.cpp b/sleepyhead/Graphs/gSummaryChart.cpp index d81027ea..b1baa211 100644 --- a/sleepyhead/Graphs/gSummaryChart.cpp +++ b/sleepyhead/Graphs/gSummaryChart.cpp @@ -12,7 +12,6 @@ #include "gYAxis.h" #include "gSummaryChart.h" -extern QLabel *qstatus2; SummaryChart::SummaryChart(QString label, GraphType type) : Layer(NoChannel), m_label(label), m_graphtype(type) { diff --git a/sleepyhead/SleepLib/journal.h b/sleepyhead/SleepLib/journal.h index edbf1d64..9bbcfd6d 100644 --- a/sleepyhead/SleepLib/journal.h +++ b/sleepyhead/SleepLib/journal.h @@ -60,6 +60,9 @@ protected: bool newsession; }; +void BackupJournal(QString filename); + + class DayController { DayController(); diff --git a/sleepyhead/SleepLib/progressdialog.cpp b/sleepyhead/SleepLib/progressdialog.cpp index 39cc0e49..e3f2bb14 100644 --- a/sleepyhead/SleepLib/progressdialog.cpp +++ b/sleepyhead/SleepLib/progressdialog.cpp @@ -24,11 +24,15 @@ ProgressDialog::ProgressDialog(QWidget * parent): hlayout->addWidget(waitmsg,1,Qt::AlignCenter); vlayout->addWidget(progress,1); progress->setMaximum(100); - - } ProgressDialog::~ProgressDialog() { } +void ProgressDialog::doUpdateProgress(int cnt, int total) +{ + progress->setMaximum(total); + progress->setValue(cnt); +} + diff --git a/sleepyhead/SleepLib/progressdialog.h b/sleepyhead/SleepLib/progressdialog.h index 24b813f0..fd5c7cca 100644 --- a/sleepyhead/SleepLib/progressdialog.h +++ b/sleepyhead/SleepLib/progressdialog.h @@ -23,6 +23,8 @@ public: void setMessage(QString msg) { waitmsg->setText(msg); } void setPixmap(QPixmap &pixmap) { imglabel->setPixmap(pixmap); } QProgressBar * progress; +public slots: + void doUpdateProgress(int cnt, int total); protected: QLabel * waitmsg; diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index 52fa26cc..3f4c674d 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -62,7 +62,6 @@ QProgressBar *qprogress; QLabel *qstatus; -QLabel *qstatus2; QStatusBar *qstatusbar; extern Profile *profile; @@ -198,19 +197,11 @@ MainWindow::MainWindow(QWidget *parent) : qstatusbar = ui->statusbar; qprogress = new QProgressBar(this); qprogress->setMaximum(100); - qstatus2 = new QLabel(tr("Welcome"), this); - qstatus2->setFrameStyle(QFrame::Raised); - qstatus2->setFrameShadow(QFrame::Sunken); - qstatus2->setFrameShape(QFrame::Box); - //qstatus2->setMinimumWidth(100); - qstatus2->setMaximumWidth(100); - qstatus2->setAlignment(Qt::AlignRight | Qt::AlignVCenter); qstatus = new QLabel("", this); qprogress->hide(); ui->statusbar->setMinimumWidth(200); ui->statusbar->addPermanentWidget(qstatus, 0); ui->statusbar->addPermanentWidget(qprogress, 1); - ui->statusbar->addPermanentWidget(qstatus2, 0); ui->actionDebug->setChecked(p_profile->general->showDebug()); @@ -1257,7 +1248,6 @@ void MainWindow::on_dailyButton_clicked() { ui->tabWidget->setCurrentWidget(daily); daily->RedrawGraphs(); - qstatus2->setText(STR_TR_Daily); } void MainWindow::JumpDaily() { @@ -1267,7 +1257,6 @@ void MainWindow::JumpDaily() void MainWindow::on_overviewButton_clicked() { ui->tabWidget->setCurrentWidget(overview); - qstatus2->setText(STR_TR_Overview); } void MainWindow::on_webView_loadFinished(bool arg1) @@ -2232,17 +2221,7 @@ void MainWindow::LinkHovered(const QString &link, const QString &title, const QS void MainWindow::on_tabWidget_currentChanged(int index) { Q_UNUSED(index); - QWidget *widget = ui->tabWidget->currentWidget(); - - if ((widget == ui->statisticsTab) || (widget == ui->helpTab)) { - qstatus2->setVisible(false); - } else if (widget == daily) { - qstatus2->setVisible(true); - daily->graphView()->updateSelectionTime(); - } else if (widget == overview) { - qstatus2->setVisible(true); - overview->graphView()->updateSelectionTime(); - } + // QWidget *widget = ui->tabWidget->currentWidget(); } @@ -2654,6 +2633,8 @@ void MainWindow::on_actionDaily_Calendar_toggled(bool visible) getDaily()->setCalendarVisible(visible); } +#include "SleepLib/journal.h" + void MainWindow::on_actionExport_Journal_triggered() { QString folder; @@ -2666,4 +2647,5 @@ void MainWindow::on_actionExport_Journal_triggered() QString filename = QFileDialog::getSaveFileName(this, tr("Choose where to save journal"), folder, tr("XML Files (*.xml)")); + BackupJournal(filename); }