diff --git a/Graphs/gGraphView.cpp b/Graphs/gGraphView.cpp index 66de99d7..4fe74694 100644 --- a/Graphs/gGraphView.cpp +++ b/Graphs/gGraphView.cpp @@ -2614,8 +2614,6 @@ void gGraphView::paintGL() redrawtimer->setInterval(20); redrawtimer->setSingleShot(true); redrawtimer->start(); - } else { - int i=5; } } } diff --git a/daily.cpp b/daily.cpp index d2ea0a0b..04842db2 100644 --- a/daily.cpp +++ b/daily.cpp @@ -533,7 +533,7 @@ void Daily::UpdateCalendarDay(QDate date) void Daily::LoadDate(QDate date) { ui->calendar->setSelectedDate(date); - on_calendar_selectionChanged(); + // on_calendar_selectionChanged(); } void Daily::on_calendar_selectionChanged() @@ -1429,6 +1429,7 @@ void Daily::on_addBookmarkButton_clicked() ui->bookmarkTable->blockSignals(false); update_Bookmarks(); + mainwin->updateFavourites(); //ui->bookmarkTable->setItem(row,2,new QTableWidgetItem(QString::number(st))); //ui->bookmarkTable->setItem(row,3,new QTableWidgetItem(QString::number(et))); @@ -1456,6 +1457,7 @@ void Daily::update_Bookmarks() journal->settings[Bookmark_Notes]=notes; journal->SetChanged(true); BookmarksChanged=true; + mainwin->updateFavourites(); } void Daily::on_removeBookmarkButton_clicked() @@ -1467,6 +1469,7 @@ void Daily::on_removeBookmarkButton_clicked() ui->bookmarkTable->blockSignals(false); update_Bookmarks(); } + mainwin->updateFavourites(); } void Daily::on_ZombieMeter_valueChanged(int action) { diff --git a/mainwindow.cpp b/mainwindow.cpp index 2ed932de..4a5bf1c9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -750,6 +750,7 @@ void MainWindow::on_summaryButton_clicked() lastchanged=false; if (day) { + EventDataType hours=day->hours(); if (hours>PROFILE.cpap->complianceHours()) { @@ -1012,12 +1013,40 @@ void MainWindow::on_summaryButton_clicked() html+=""; html+=""; } + updateFavourites(); html+=htmlFooter(); ui->summaryView->setHtml(html); // QString file="qrc:/docs/index.html"; // QUrl url(file); // ui->webView->setUrl(url); } +void MainWindow::updateFavourites() +{ + ui->favouritesList->clear(); + + QDate date=PROFILE.LastDay(); + + do { + Day * journal=PROFILE.GetDay(date,MT_JOURNAL); + if (journal) { + if (journal->size()>0) { + Session *sess=(*journal)[0]; + if (sess->settings.contains(Bookmark_Start)) { + QVariantList start=sess->settings[Bookmark_Start].toList(); + QVariantList end=sess->settings[Bookmark_End].toList(); + QStringList notes=sess->settings[Bookmark_Notes].toStringList(); + if (notes.size()>0) { + QListWidgetItem *item=new QListWidgetItem(date.toString()); + item->setData(Qt::UserRole,date); + ui->favouritesList->addItem(item); + } + } + } + } + + date=date.addDays(-1); + } while (date>=PROFILE.FirstDay()); +} void MainWindow::on_backButton_clicked() { @@ -2042,3 +2071,14 @@ void MainWindow::on_webView_linkClicked(const QUrl &url) ui->webView->setUrl(url); } } + +void MainWindow::on_favouritesList_itemSelectionChanged() +{ + QListWidgetItem *item=ui->favouritesList->currentItem(); + if (!item) return; + QDate date=item->data(Qt::UserRole).toDate(); + if (date.isValid()) { + daily->LoadDate(date); + ui->tabWidget->setCurrentWidget(daily); + } +} diff --git a/mainwindow.h b/mainwindow.h index b47668fb..373679c3 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -76,6 +76,8 @@ public: //! \brief Log message s to Application Debug log void Log(QString s); + //! \brief Update the list of Favourites (Bookmarks) in the right sidebar. + void updateFavourites(); //! \brief Create a new menu object in the main menubar. QMenu * CreateMenu(QString title); @@ -253,6 +255,8 @@ private slots: void on_webView_linkClicked(const QUrl &arg1); + void on_favouritesList_itemSelectionChanged(); + private: Ui::MainWindow *ui;