Index: sources/model/dg/adjustment/MAdjustDGDateTimeResponse.cpp =================================================================== diff -u -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd -re92ad4dc0e95b4e4cc1408146fb48a6e33169d52 --- sources/model/dg/adjustment/MAdjustDGDateTimeResponse.cpp (.../MAdjustDGDateTimeResponse.cpp) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) +++ sources/model/dg/adjustment/MAdjustDGDateTimeResponse.cpp (.../MAdjustDGDateTimeResponse.cpp) (revision e92ad4dc0e95b4e4cc1408146fb48a6e33169d52) @@ -1,3 +1,17 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file MAdjustDGDateTimeResponse.cpp + * \author (last) Peter Lucia + * \date (last) 15-Mar-2021 + * \author (original) Peter Lucia + * \date (original) 15-Mar-2021 + * + */ #include "MAdjustDGDateTimeResponse.h" using namespace Model; Index: sources/model/dg/adjustment/MAdjustDGDateTimeResponse.h =================================================================== diff -u -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd -re92ad4dc0e95b4e4cc1408146fb48a6e33169d52 --- sources/model/dg/adjustment/MAdjustDGDateTimeResponse.h (.../MAdjustDGDateTimeResponse.h) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) +++ sources/model/dg/adjustment/MAdjustDGDateTimeResponse.h (.../MAdjustDGDateTimeResponse.h) (revision e92ad4dc0e95b4e4cc1408146fb48a6e33169d52) @@ -1,3 +1,17 @@ +/*! + * + * Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file MAdjustDGDateTimeResponse.h + * \author (last) Peter Lucia + * \date (last) 15-Mar-2021 + * \author (original) Peter Lucia + * \date (original) 15-Mar-2021 + * + */ #pragma once // Qt Index: sources/model/hd/adjustment/MAdjustHDDateTimeResponse.cpp =================================================================== diff -u -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd -re92ad4dc0e95b4e4cc1408146fb48a6e33169d52 --- sources/model/hd/adjustment/MAdjustHDDateTimeResponse.cpp (.../MAdjustHDDateTimeResponse.cpp) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) +++ sources/model/hd/adjustment/MAdjustHDDateTimeResponse.cpp (.../MAdjustHDDateTimeResponse.cpp) (revision e92ad4dc0e95b4e4cc1408146fb48a6e33169d52) @@ -5,11 +5,11 @@ * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * - * \file MTreatmentAdjustSalineResponse.cpp - * \author (last) Behrouz NematiPour - * \date (last) 08-Sep-2020 - * \author (original) Behrouz NematiPour - * \date (original) 10-Aug-2020 + * \file MAdjustHDDateTimeResponse.cpp + * \author (last) Peter Lucia + * \date (last) 15-Mar-2021 + * \author (original) Peter Lucia + * \date (original) 15-Mar-2021 * */ #include "MAdjustHDDateTimeResponse.h" Index: sources/model/hd/adjustment/MAdjustHDDateTimeResponse.h =================================================================== diff -u -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd -re92ad4dc0e95b4e4cc1408146fb48a6e33169d52 --- sources/model/hd/adjustment/MAdjustHDDateTimeResponse.h (.../MAdjustHDDateTimeResponse.h) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) +++ sources/model/hd/adjustment/MAdjustHDDateTimeResponse.h (.../MAdjustHDDateTimeResponse.h) (revision e92ad4dc0e95b4e4cc1408146fb48a6e33169d52) @@ -5,11 +5,11 @@ * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * - * \file MTreatmentAdjustSalineResponse.h - * \author (last) Behrouz NematiPour - * \date (last) 25-Sep-2020 - * \author (original) Behrouz NematiPour - * \date (original) 10-Aug-2020 + * \file MAdjustHDDateTimeResponse.h + * \author (last) Peter Lucia + * \date (last) 15-Mar-2021 + * \author (original) Peter Lucia + * \date (original) 15-Mar-2021 * */ #pragma once Index: sources/view/VAlert.cpp =================================================================== diff -u -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd -re92ad4dc0e95b4e4cc1408146fb48a6e33169d52 --- sources/view/VAlert.cpp (.../VAlert.cpp) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) +++ sources/view/VAlert.cpp (.../VAlert.cpp) (revision e92ad4dc0e95b4e4cc1408146fb48a6e33169d52) @@ -24,18 +24,52 @@ connect(&_GuiController, SIGNAL(didAlertRequest(GuiAlertRequestData)), this, SLOT(onActionReceive(GuiAlertRequestData))); + connect(this, SIGNAL(didRequestShowAlert()), + this, SLOT(onUpdateAlertVisible())); + + connect(this, SIGNAL(didRequestShowAlert()), + this, SLOT(onUpdateAlertVisible())); + // outgoing connect(this, SIGNAL(didAlertResponse(GuiAlertResponseData)), &_GuiController, SLOT(doAlertResponse(GuiAlertResponseData))); + + startTimer(_timerInterval); } /*! + * \brief VAlert::onUpdateAlertVisible + * Updates the alert visible status + */ +void VAlert::onUpdateAlertVisible() +{ + _alertVisible = true; +} + +/*! + * \brief VAlert::timerEvent + * Repeatedly checks the queue for any new alerts to display + * Displays the next alert in the queue if no alert is visible + * \param event (QTimerEvent) - the timer event + */ +void VAlert::timerEvent(QTimerEvent *event) +{ + Q_UNUSED(event) + if (!_alertVisible && !_queue.isEmpty()) + { + showAlert(_queue.dequeue()); + } +} + +/*! * \brief VAlert::doUserAlertRequest - * Called when the user makes a request through an alert dialog + * Called when an alert is closed as the user has made a request through + * the alert dialog * \param confirmed - (bool) true if user confirms, false if they cancel */ void VAlert::doAlertResponse(const bool &confirmed) { + _alertVisible = false; GuiAlertResponseData data; data.id = alertID(); data.confirmed = confirmed; @@ -49,6 +83,19 @@ */ void VAlert::onActionReceive(const GuiAlertRequestData &request) { + if (_queue.size() > _maxQueueSize) + return; + + _queue.enqueue(request); +} + +/*! + * \brief VAlert::showAlert + * Updates the alert with the specified information + * \param request (GuiAlertRequestData) - the alert information + */ +void VAlert::showAlert(const GuiAlertRequestData &request) +{ alertID(request.id); title(request.title); description(request.description); Index: sources/view/VAlert.h =================================================================== diff -u -rb5a7852d2637f7969680fbd3d2c821a6a74a8ccd -re92ad4dc0e95b4e4cc1408146fb48a6e33169d52 --- sources/view/VAlert.h (.../VAlert.h) (revision b5a7852d2637f7969680fbd3d2c821a6a74a8ccd) +++ sources/view/VAlert.h (.../VAlert.h) (revision e92ad4dc0e95b4e4cc1408146fb48a6e33169d52) @@ -16,6 +16,7 @@ // Qt #include +#include // Project #include "main.h" @@ -51,12 +52,21 @@ PROPERTY(GuiAlertID , alertID, GuiAlertID::ID_Alert_None) // coco end + QQueue _queue; + const int _timerInterval = 1000; // ms + const int _maxQueueSize = 1000; + bool _alertVisible = false; + + void timerEvent(QTimerEvent* event); + void showAlert(const GuiAlertRequestData &request); + signals: void didRequestShowAlert(); void didAlertResponse(GuiAlertResponseData); public slots: void doAlertResponse(const bool &confirmed); + void onUpdateAlertVisible(); private slots: void onActionReceive(const GuiAlertRequestData &request);