#include <QDialog>
#include <QMessageBox>
+#include <application.h>
#include "ui_about.h"
#include "eventdialog.h"
#include "tabcontainer.h"
#include "appsettings.h"
-const QString PROXY_USERNAME;
-const QString PROXY_PASSWD;
-
MainWindow::MainWindow(QWidget* parent): QMainWindow(parent) {
setupUi(this);
AppSettings::setDirectConnection(true);
QNetworkProxy proxy(
- AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy,
+ AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : (QNetworkProxy::ProxyType)AppSettings::proxyType(),
AppSettings::proxyAddress(),
AppSettings::proxyPort(),
- PROXY_USERNAME,
- PROXY_PASSWD);
+ AppSettings::proxyUsername(),
+ AppSettings::proxyPassword());
QNetworkProxy::setApplicationProxy(proxy);
// event details have changed
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");
}
// end of optimization
// initTabs();
- } catch (OrmException& e) {
+ } catch (const OrmException& e) {
+ qDebug() << "OrmException:" << e.text();
// cannon set an active conference
unsetConference(); // TODO: as no active conference is now correctly managed this should be handled as a fatal error
return;
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();
clearTabs();
dayNavigator->unsetDates();
setWindowTitle(saved_title);
+ ((Application*) qApp)->unsetActiveConference();
}
if (dialog.exec() == QDialog::Accepted) {
dialog.saveDialogData();
QNetworkProxy proxy(
- AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : QNetworkProxy::HttpProxy,
+ AppSettings::isDirectConnection() ? QNetworkProxy::NoProxy : (QNetworkProxy::ProxyType)AppSettings::proxyType(),
AppSettings::proxyAddress(),
AppSettings::proxyPort(),
- PROXY_USERNAME,
- PROXY_PASSWD);
+ AppSettings::proxyUsername(),
+ AppSettings::proxyPassword());
QNetworkProxy::setApplicationProxy(proxy);
}
}
// optimization, see useConference() code
try {
initTabs();
- } catch (OrmException) {
+ } catch (const OrmException& e) {
+ qDebug() << "OrmException:" << e.text();
clearTabs();
}
}