From 592b6c271b9a03c1552d233539e74fdc4b6e84ea Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Tue, 5 Aug 2014 07:28:27 +1000 Subject: [PATCH] F9 and F10 hotkeys to hide daily panel sidebar and calendar --- configure | 2 +- sleepyhead/Graphs/gGraphView.cpp | 2 +- sleepyhead/build_number.h | 2 +- sleepyhead/daily.cpp | 17 +++++++++++++++++ sleepyhead/daily.h | 4 ++++ sleepyhead/mainwindow.cpp | 10 ++++++++++ sleepyhead/mainwindow.h | 4 ++++ sleepyhead/mainwindow.ui | 30 ++++++++++++++++++++++++++++++ sleepyhead/scripts/build_number | 2 +- 9 files changed, 69 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 6d96dafe..9c72fe2a 100755 --- a/configure +++ b/configure @@ -23,4 +23,4 @@ if [[ -z ${QMAKE} ]]; then fi # Finally, configure the build. -qmake-qt5 "${DIR}" +${QMAKE} "${DIR}" diff --git a/sleepyhead/Graphs/gGraphView.cpp b/sleepyhead/Graphs/gGraphView.cpp index 373d35eb..4fe270c6 100644 --- a/sleepyhead/Graphs/gGraphView.cpp +++ b/sleepyhead/Graphs/gGraphView.cpp @@ -1876,7 +1876,7 @@ void gGraphView::keyPressEvent(QKeyEvent *event) p_profile->appearance->setLineCursorMode(!p_profile->appearance->lineCursorMode()); timedRedraw(0); } - if (event->key() == Qt::Key_F10) { + if ((event->key() == Qt::Key_F10) && (event->modifiers() == Qt::ShiftModifier)) { dumpInfo(); } diff --git a/sleepyhead/build_number.h b/sleepyhead/build_number.h index 4644d8a1..b7dfdd23 100644 --- a/sleepyhead/build_number.h +++ b/sleepyhead/build_number.h @@ -1 +1 @@ -const int build_number = 7; +const int build_number = 8; diff --git a/sleepyhead/daily.cpp b/sleepyhead/daily.cpp index abf17260..b41d99a4 100644 --- a/sleepyhead/daily.cpp +++ b/sleepyhead/daily.cpp @@ -51,6 +51,23 @@ inline QString channelInfo(ChannelID code) { return schema::channel[code].fullname()+"\n"+schema::channel[code].description()+"\n("+schema::channel[code].units()+")"; } +void Daily::setCalendarVisible(bool visible) +{ + on_calButton_toggled(visible); +} + +void Daily::setSidebarVisible(bool visible) +{ + QList a; + + int panel_width = visible ? 350 : 0; + a.push_back(panel_width); + a.push_back(this->width() - panel_width); + ui->splitter_2->setStretchFactor(1,1); + ui->splitter_2->setSizes(a); + ui->splitter_2->setStretchFactor(1,1); +} + Daily::Daily(QWidget *parent,gGraphView * shared) :QWidget(parent), ui(new Ui::Daily) { diff --git a/sleepyhead/daily.h b/sleepyhead/daily.h index 8b12efe1..10db92b7 100644 --- a/sleepyhead/daily.h +++ b/sleepyhead/daily.h @@ -139,6 +139,10 @@ public: */ void Unload(QDate date=QDate()); + void setSidebarVisible(bool visible); + void setCalendarVisible(bool visible); + + private slots: /*! \fn on_calendar_currentPageChanged(int year, int month); diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index 76320e38..3c86848c 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -2495,3 +2495,13 @@ void MainWindow::on_actionToggle_Line_Cursor_toggled(bool b) getOverview()->graphView()->timedRedraw(0); } } + +void MainWindow::on_actionLeft_Daily_Sidebar_toggled(bool visible) +{ + getDaily()->setSidebarVisible(visible); +} + +void MainWindow::on_actionDaily_Calendar_toggled(bool visible) +{ + getDaily()->setCalendarVisible(visible); +} diff --git a/sleepyhead/mainwindow.h b/sleepyhead/mainwindow.h index 2cbb4c23..5b951e92 100644 --- a/sleepyhead/mainwindow.h +++ b/sleepyhead/mainwindow.h @@ -323,6 +323,10 @@ class MainWindow : public QMainWindow void on_actionToggle_Line_Cursor_toggled(bool arg1); + void on_actionLeft_Daily_Sidebar_toggled(bool arg1); + + void on_actionDaily_Calendar_toggled(bool arg1); + private: void importCPAPBackups(); void finishCPAPImport(); diff --git a/sleepyhead/mainwindow.ui b/sleepyhead/mainwindow.ui index 93824124..9d786bf3 100644 --- a/sleepyhead/mainwindow.ui +++ b/sleepyhead/mainwindow.ui @@ -3163,6 +3163,8 @@ border-radius: 10px; + + @@ -3481,6 +3483,34 @@ border-radius: 10px; + + + true + + + true + + + Daily Sidebar + + + F9 + + + + + true + + + true + + + Daily Calendar + + + F10 + + diff --git a/sleepyhead/scripts/build_number b/sleepyhead/scripts/build_number index 7f8f011e..45a4fb75 100644 --- a/sleepyhead/scripts/build_number +++ b/sleepyhead/scripts/build_number @@ -1 +1 @@ -7 +8