Changeset 5b7fa79
- Timestamp:
- 07/28/21 23:41:39 (18 months ago)
- Branches:
- master
- Children:
- e4dcafe
- Parents:
- 280f29b
- git-author:
- Philipp Spitzer <philipp@…> (07/28/21 23:41:14)
- git-committer:
- Philipp Spitzer <philipp@…> (07/28/21 23:41:39)
- Location:
- src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/daynavigatorwidget.cpp
r280f29b r5b7fa79 22 22 #include <QPainter> 23 23 #include <QLabel> 24 #include <conference.h> 25 #include <application.h> 24 26 25 27 … … 108 110 void DayNavigatorWidget::paintEvent(QPaintEvent *aEvent) { 109 111 Q_UNUSED(aEvent); 110 111 QString selectedDateStr = mCurDate.isValid() ? mCurDate.toString("dddd\nyyyy-MM-dd") : tr("No date"); 112 QString selectedDateStr; 113 if (mCurDate.isValid()) { 114 selectedDateStr = mCurDate.toString("dddd\nyyyy-MM-dd"); 115 bool hasConference = ((Application*) qApp)->hasActiveConference(); 116 if (hasConference) { 117 Conference& conference = ((Application*) qApp)->activeConference(); 118 if (conference.hasDisplayTimeShift() && conference.displayTimeShift() != 0) { 119 QTime shift(0, 0); 120 bool minus = conference.displayTimeShift() < 0; 121 shift = shift.addSecs(conference.displayTimeShift() * 60 * (minus ? -1 : 1)); 122 selectedDateStr += " (" + (minus ? QString("-") : "+") + shift.toString("HH:mm") + ")"; 123 } 124 } 125 } else { 126 selectedDateStr = tr("No date"); 127 } 112 128 QPainter painter(this); 113 129 painter.save(); -
src/gui/mainwindow.cpp
r280f29b r5b7fa79 38 38 #include <QDialog> 39 39 #include <QMessageBox> 40 #include <application.h> 40 41 41 42 #include "ui_about.h" … … 239 240 void MainWindow::onAlarmTimerTimeout() { 240 241 // determine if an alarm is set on an event that's starting soon 241 QList<Event> events = Event::getImminentAlarmEvents(AppSettings::preEventAlarmSec(), Conference::activeConference()); 242 int conferenceId = Conference::activeConference(); 243 QList<Event> events = Event::getImminentAlarmEvents(AppSettings::preEventAlarmSec(), conferenceId); 242 244 if (events.empty()) return; 243 245 244 246 // build a message string 247 const Conference conference = Conference::getById(conferenceId); 245 248 Event event; 246 249 QString title; … … 248 251 if (events.size() == 1) { 249 252 event = events.first(); 250 title = tr("Next event at %1").arg( event.start().toString("HH:mm"));253 title = tr("Next event at %1").arg(conference.shiftTime(event.start().time()).toString("HH:mm")); 251 254 message = tr("\"%1\"\n(%2)").arg(event.title()).arg(event.room()->name()); 252 255 } else { … … 254 257 QStringList messages; 255 258 foreach (event, events) { 256 messages += tr("%1: \"%2\" (%3)").arg( event.start().toString("HH:mm")).arg(event.title()).arg(event.room()->name());259 messages += tr("%1: \"%2\" (%3)").arg(conference.shiftTime(event.start().time()).toString("HH:mm")).arg(event.title()).arg(event.room()->name()); 257 260 } 258 261 message = messages.join("\n"); … … 323 326 { 324 327 Conference active = Conference::getById(confId); 328 ((Application*) qApp)->setActiveConference(active); 325 329 QDate startDate = active.start(); 326 330 QDate endDate = active.end(); … … 346 350 dayNavigator->unsetDates(); 347 351 setWindowTitle(saved_title); 352 ((Application*) qApp)->unsetActiveConference(); 348 353 } 349 354 -
src/mvc/conference.cpp
r280f29b r5b7fa79 61 61 62 62 63 QTime Conference::shiftTime(const QTime& value) const { 64 return value.addSecs(displayTimeShift() * 60); 65 } -
src/mvc/conference.h
r280f29b r5b7fa79 56 56 bool hasDisplayTimeShift() const {return !value("display_time_shift").isNull();} 57 57 int displayTimeShift() const {return value("display_time_shift").toInt();} 58 void setDisplayTimeShift(int newValue) {setValue("display_time_shift", newValue); update("display_time_shift");} 59 58 60 bool isActive() const { return value("active").toBool(); } 59 61 QString url() const { return stringFromNullable(value("url")); } … … 64 66 update("url"); 65 67 } 68 69 /// Returns a QTime that is shifted by displayTimeShift minutes 70 QTime shiftTime(const QTime& value) const; 66 71 67 72 private: -
src/mvc/conferencemodel.cpp
r280f29b r5b7fa79 40 40 return QVariant(); 41 41 } 42 43 42 return conferences[index.row()].title(); 44 45 try {46 const Conference& c = conferenceFromIndex(index);47 return c.title();48 } catch (OrmNoObjectException&) {49 return QVariant();50 }51 52 43 } 53 44 54 45 const Conference& ConferenceModel::conferenceFromIndex(const QModelIndex& index) const 46 { 47 if (index.parent().isValid() 48 or index.column() != 0 49 or index.row() >= conferences.size()) 50 { 51 throw OrmNoObjectException(); 52 } 53 return conferences[index.row()]; 54 } 55 56 Conference& ConferenceModel::conferenceFromIndex(const QModelIndex& index) 55 57 { 56 58 if (index.parent().isValid() -
src/mvc/conferencemodel.h
r280f29b r5b7fa79 30 30 It also provides typed access to the conferences from ConferenceEditor. 31 31 32 It does not actually modify anything in DB, this is performed by other classes. 32 It does not actually modify anything in DB (unless methods changing the conference instance returned by conferenceFromIndex are used), 33 this is performed by other classes. 33 34 34 35 \see ConferenceEditor, MainWindow::showConferences() … … 44 45 45 46 const Conference& conferenceFromIndex(const QModelIndex&) const; 47 Conference& conferenceFromIndex(const QModelIndex&); 46 48 QModelIndex indexFromId(int id) const; 47 49 public slots: -
src/mvc/delegate.cpp
r280f29b r5b7fa79 24 24 #include <QDebug> 25 25 #include <QPainter> 26 26 #include <application.h> 27 28 #include "conference.h" 27 29 #include "room.h" 28 30 … … 148 150 QPointF titlePointF(option.rect.x() + SPACER, 149 151 option.rect.y() + SPACER + mControls[FavouriteControlStrong]->image()->height()); 150 QTime start = event->start().time(); 152 Conference& conference = ((Application*) qApp)->activeConference(); 153 QTime start = conference.shiftTime(event->start().time()); 151 154 painter->setFont(fontBig); 152 155 painter->drawText(titlePointF,start.toString("hh:mm") + "-" + start.addSecs(event->duration()).toString("hh:mm") + ", " + event->roomName()); -
src/mvc/eventmodel.cpp
r280f29b r5b7fa79 23 23 #include "room.h" 24 24 25 #include <application.h> 26 25 27 const QString EventModel::COMMA_SEPARATOR = ", "; 26 28 … … 35 37 endTime = qMax(mEvents.at(i).start().addSecs(mEvents.at(i).duration()), endTime); 36 38 } 37 mTitle = QString("%1 - %2").arg(startTime.toString("HH:mm")).arg(endTime.toString("HH:mm")); 39 Conference& conference = ((Application*) qApp)->activeConference(); 40 QTime s = conference.shiftTime(startTime.time()); 41 QTime e = conference.shiftTime(endTime.time()); 42 mTitle = QString("%1 - %2").arg(s.toString("HH:mm")).arg(e.toString("HH:mm")); 38 43 } 39 44
Note: See TracChangeset
for help on using the changeset viewer.