]> ToastFreeware Gitweb - toast/confclerk.git/blobdiff - src/gui/mainwindow.cpp
Clean up #includes.
[toast/confclerk.git] / src / gui / mainwindow.cpp
index 918134382b7caaaa0661c9c3c9c49f2aed5d23f1..6d74823fed3ed8068de66706fcff4994fce4051a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2010 Ixonos Plc.
- * Copyright (C) 2011-2017 Philipp Spitzer, gregor herrmann, Stefan Stahl
+ * Copyright (C) 2011-2021 Philipp Spitzer, gregor herrmann, Stefan Stahl
  *
  * This file is part of ConfClerk.
  *
 #include <QNetworkAccessManager>
 #include <QNetworkReply>
 #include <QSslConfiguration>
+#include <QDialog>
+#include <QMessageBox>
 
 #include "sqlengine.h"
-
 #include "track.h"
 #include "eventmodel.h"
 #include "delegate.h"
 #include "room.h"
-
 #include "conference.h"
-
-#include <QDialog>
-#include <QMessageBox>
-
 #include "ui_about.h"
 #include "eventdialog.h"
 #include "daynavigatorwidget.h"
@@ -45,9 +41,9 @@
 #include "conferenceeditor.h"
 #include "schedulexmlparser.h"
 #include "errormessage.h"
-
 #include "tabcontainer.h"
 #include "appsettings.h"
+#include "application.h"
 
 MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) {
     setupUi(this);
@@ -238,22 +234,24 @@ void MainWindow::onSystemTrayMessageClicked() {
 
 void MainWindow::onAlarmTimerTimeout() {
     // determine if an alarm is set on an event that's starting soon
-    QList<Event> events = Event::getImminentAlarmEvents(AppSettings::preEventAlarmSec(), Conference::activeConference());
+    int conferenceId = Conference::activeConference();
+    QList<Event> events = Event::getImminentAlarmEvents(AppSettings::preEventAlarmSec(), conferenceId);
     if (events.empty()) return;
 
     // build a message string
+    const Conference conference = Conference::getById(conferenceId);
     Event event;
     QString title;
     QString message;
     if (events.size() == 1) {
         event = events.first();
-        title = tr("Next event at %1").arg(event.start().toString("HH:mm"));
+        title = tr("Next event at %1").arg(conference.shiftTime(event.start().time()).toString("HH:mm"));
         message = tr("\"%1\"\n(%2)").arg(event.title()).arg(event.room()->name());
     } else {
         title = tr("%1 upcoming events").arg(events.size());
         QStringList messages;
         foreach (event, events) {
-            messages += tr("%1: \"%2\" (%3)").arg(event.start().toString("HH:mm")).arg(event.title()).arg(event.room()->name());
+            messages += tr("%1: \"%2\" (%3)").arg(conference.shiftTime(event.start().time()).toString("HH:mm")).arg(event.title()).arg(event.room()->name());
         }
         message = messages.join("\n");
     }
@@ -322,6 +320,7 @@ void MainWindow::initTabs()
     if (confId != -1)   // only init tabs if a conference is active
     {
         Conference active = Conference::getById(confId);
+        ((Application*) qApp)->setActiveConference(active);
         QDate startDate = active.start();
         QDate endDate = active.end();
 
@@ -345,6 +344,7 @@ void MainWindow::unsetConference()
     clearTabs();
     dayNavigator->unsetDates();
     setWindowTitle(saved_title);
+    ((Application*) qApp)->unsetActiveConference();
 }