<configuration password="admin" >
<connection>
- <!-- TEST SERVER DATA-->
- <!--<serverurl>192.168.0.35</serverurl>
- <username>maemo</username>
- <password>P@ssw0rd</password>-->
- <serverurl>jklexch01.ixonos.com</serverurl>
+ <serverurl></serverurl>
<username></username>
<password></password>
<!-- interval is interpreted in seconds -->
</connection>
<startup>
- <powersaving enabled="true" on="08:00" off="17:00" />
+ <powersaving enabled="true" on="08:00" off="16:00" />
</startup>
<display>
src/UserInterface/Components/ \
src/UserInterface/Utils/ \
src/UserInterface/Views/
-HEADERS += src/BusinessLogic/UIManager.h \
+HEADERS += src/UserInterface/Components/BorderedBarWidget.h \
+ src/BusinessLogic/UIManager.h \
src/IO/DeviceControl/OperationModeToggler.h \
src/UserInterface/Utils/ProgressBar.h \
src/Domain/Room.h \
src/UserInterface/Views/SettingsView.h \
src/UserInterface/WindowManager.h \
src/UserInterface/Views/ViewBase.h
-SOURCES += src/BusinessLogic/UIManager.cpp \
+SOURCES += src/UserInterface/Components/BorderedBarWidget.cpp \
+ src/BusinessLogic/UIManager.cpp \
src/IO/DeviceControl/OperationModeToggler.cpp \
src/UserInterface/Utils/ProgressBar.cpp \
src/Domain/Room.cpp \
+qtmeetings (1.0.6-1) unstable; urgency=low
+
+ * Improved user interface
+ * Fix for settings read and write
+
+ -- Risto Lintinen <risto.lintinen@ixonos.com> Mon, 24 May 2009 12:30:00 +0300
+
qtmeetings (1.0.5-1) unstable; urgency=low
* Improved communication module for getting a meeting secondary id and detailed information
--- /dev/null
+qtmeetings_1.0.6-1_armel.deb user/other optional
+QtMeetings.conf etc
+QtMeetings.desktop usr/share/applications/hildon
iWindowManager( 0 ), iUIManager( 0 )
{
qDebug() << "Engine::Engine()";
- iCommunicationFailed = false;
- iCurrentWeekFetched = false;
+ iCommunicationFailed = true;
initConfiguration();
initDevice();
// Create auto refresh timer
iAutoRefresh = new QTimer;
- iAutoRefresh->setInterval(iConfiguration->connectionSettings()->refreshInterval() * 1000);
+
+ iAutoRefresh->setInterval(Configuration::instance()->getRefreshinterval() * 1000);
+
iAutoRefresh->start();
connect( iAutoRefresh, SIGNAL( timeout() ), iAutoRefresh, SLOT( start() ) );
+ connect( iAutoRefresh, SIGNAL( timeout() ), this, SLOT( updateRoomInfo() ) );
+
+ connect(iWindowManager, SIGNAL(closeClicked()), this, SLOT(closeApplication()));
+
// connect( iAutoRefresh, SIGNAL( timeout() ), this, SLOT( fetchMeetings() ) );
if( iDevice->currentOperationMode() == DeviceManager::KioskMode )
}
connectSignals();
-
+ connect( Configuration::instance(), SIGNAL( configurationChanged() ), this, SLOT( configurationChanged() ) );
// QTimer::singleShot( 0, this, SLOT( fetchMeetings() ) );
// TODO: continue implementation
void Engine::checkStatusOfAllRooms()
{
// TODO: Check if date has changed
- // qDebug() << "Engine::checkStatusOfAllRooms()";
// iterate trough on the rooms
for (int i = 0; i < iConfiguration->rooms().count(); i++)
{
void Engine::meetingsFetched( const QList<Meeting*> &aMeetings )
{
qDebug() << "Engine::meetingsFetched( const QList<Meeting*> & )";
- // TODO: should check if this week's meetings were fetched
- if( iCommunicationFailed || !iCurrentWeekFetched )
+ QTime c = QTime::currentTime();
+ iLastCommunication.setHMS( c.hour(), c.minute(), c.second() );
+
+ qDebug() << "Error length: "<< iCommunicationError.length();
+ qDebug() << "Error: "<< iCommunicationError;
+
+ if( iCommunicationError.length() == 0 )
{
- iCurrentWeekFetched = true;
iCommunicationFailed = false;
iUIManager->connectionEstablished();
}
void Engine::errorHandler( int aCode, const QString &aAddInfo )
{
+ iCommunicationFailed = true;
+
if( aCode >= 100 && aCode < 150 )
{
- iCommunicationFailed = true;
- if ( iUIManager != 0 ) iUIManager->connectionLost();
+ if ( iUIManager != 0 )
+ {
+ iUIManager->connectionLost();
+ }
}
if ( iWindowManager != 0 )
{
- iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) );
+ iCommunicationError = ErrorMapper::codeToString( aCode, aAddInfo );
+ //iWindowManager->error( ErrorMapper::codeToString( aCode, aAddInfo ) );
}
}
+bool Engine::connected()
+{
+ return !iCommunicationFailed;
+}
+
+QTime Engine::lastUpdated()
+{
+ return iLastCommunication;
+}
+
+QString Engine::errorMessage()
+{
+ return iCommunicationError;
+}
+
void Engine::fetchMeetings( const int aWeek, const int aYear, const Room *aIn )
{
qDebug()
<< "Engine::fetchMeetings( const int aWeek, const int aYear, const Room * )";
+ iCommunicationError = "";
iCommunication->fetchMeetings(aWeek, aYear, *aIn);
}
void Engine::shownWeekChanged( QDate aFrom )
{
qDebug() << "[Engine::shownWeekChanged] <Invoked>";
+ iCommunicationError = "";
iCommunication->fetchMeetings( aFrom.weekNumber(), aFrom.year(), *iCurrentRoom/*defaultRoom()*/ );
}
void Engine::initCommunication()
{
// initialize communication
- iCommunication = new CommunicationManager( *(iConfiguration->connectionSettings()) );
+ iCommunication = new CommunicationManager(/* *(iConfiguration->connectionSettings()) */);
connect( iCommunication, SIGNAL( error( int, CommunicationManager::CommunicationType ) ),
this, SLOT( errorHandler( int ) ) );
connect( iCommunication, SIGNAL( meetingsFetched( const QList<Meeting*>& ) ),
}
}
iCurrentDate = aCurrentDateTime.date();
-}
\ No newline at end of file
+}
+
+
+void Engine::updateRoomInfo()
+{
+ qDebug() << "ENGINE::: updateMeetings";
+ iUIManager->currentRoomChanged( iCurrentRoom );
+}
+
+void Engine::configurationChanged()
+{
+ iAutoRefresh->setInterval(Configuration::instance()->getRefreshinterval() * 1000);
+}
*/
Room* defaultRoom();
+ bool connected();
+ QTime lastUpdated();
+ QString errorMessage();
+
signals:
void roomStatusChanged( Room::Status aStatus, QTime aUntil );
void tick( QDateTime aCurrentDateTime );
+ /**
+ * Updates the current rooms info.
+ */
+ void updateRoomInfo();
+ /**
+ *
+ */
+ void configurationChanged();
+
private:
// Make the UIManager as friendly class so it can connect to private slots.
friend class UIManager;
private:
static QTime endOfTheDay;
-
- WindowManager *iWindowManager;
QTimer *iIdleTimeCounter;
Clock *iClock;
QDate iCurrentDate;
Configuration *iConfiguration;
CommunicationManager *iCommunication;
+ WindowManager *iWindowManager;
DeviceManager *iDevice;
UIManager *iUIManager;
Room *iCurrentRoom;
bool iCommunicationFailed;
- bool iCurrentWeekFetched;
+ QString iCommunicationError;
+ QTime iLastCommunication;
};
#endif /*ENGINE_H_*/
if ( iEngine == 0 ) return;
if ( iWindowManager == 0 ) return;
+ connect(iWindowManager, SIGNAL(showSettingsClicked()), this, SLOT(settingsViewRequest()));
+
createWeeklyView();
- createSettingsView();
createRoomStatusIndicator();
createPasswordDialog();
createProgressBar();
connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), this, SLOT( currentRoomChanged( Room * ) ) );
connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), this, SLOT( showMeetingProgressBar( Meeting * ) ) );
// Connect signals to engine
+ connect( iWeeklyView, SIGNAL( refreshButtonClicked() ), iEngine, SLOT( updateRoomInfo() ) );
connect( iWeeklyView, SIGNAL( meetingActivated( Meeting * ) ), iEngine, SLOT( fetchMeetingDetails( Meeting * ) ) );
connect( iWeeklyView, SIGNAL( shownWeekChanged( QDate ) ), iEngine, SLOT( shownWeekChanged( QDate ) ) );
connect( iWeeklyView, SIGNAL( currentRoomChanged( Room * ) ), iEngine, SLOT( currentRoomChanged( Room * ) ) );
// UIMANAGER SLOTS
void UIManager::settingsViewRequest()
{
+ createSettingsView();
+
// Show the settings view and stop the idle timer
- if ( iSettingsView != 0 )
- {
- iWindowManager->showView( static_cast<ViewBase *>( iSettingsView ) );
- iEngine->stopIdleTimeCounter();
- }
+ iWindowManager->showView( static_cast<ViewBase *>( iSettingsView ) );
+ iEngine->stopIdleTimeCounter();
}
void UIManager::settingsOkClicked()
if ( iWeeklyView != 0 )
{
iWindowManager->showView( static_cast<ViewBase *>( iWeeklyView ) );
+ QT_DELETE(iSettingsView);
iEngine->startIdleTimeCounter();
+ currentRoomChanged(iWeeklyView->currentRoom());
}
}
}
}
-void UIManager::showMeetingProgressBar( Meeting *aMeeting )
+void UIManager::showMeetingProgressBar( Meeting */*aMeeting*/ )
{
if ( iProgressBar != 0 )
{
{
qDebug() << "UIManager::connectionLost()";
iWeeklyView->connectionLost();
- iSettingsView->connectionLost();
iRoomStatusIndicator->connectionLost();
}
{
qDebug() << "UIManager::connectionEstablished()";
iWeeklyView->connectionEstablished();
- iSettingsView->connectionEstablished();
iRoomStatusIndicator->connectionEstablished();
}
{
if ( iWeeklyView != 0 )
{
- iWeeklyView->setCurrentDateTime( aDateTime );
+ iWeeklyView->setConnectionStatus( aDateTime, iEngine->connected(), iEngine->lastUpdated(), iEngine->errorMessage() );
}
if ( iRoomStatusIndicator != 0 )
{
- iRoomStatusIndicator->setCurrentTime( aDateTime.time() );
+ iRoomStatusIndicator->setConnectionStatus( aDateTime, iEngine->connected(), iEngine->lastUpdated(), iEngine->errorMessage() );
}
}
if ( iWeeklyView != 0 )
{
iWindowManager->showView( static_cast<ViewBase *>( iWeeklyView ) );
+ QT_DELETE(iSettingsView);
iEngine->startIdleTimeCounter();
}
-}
\ No newline at end of file
+}
#include <QCryptographicHash>
#include <QtDebug>
+#include <QString>
+#include <QUrl>
Configuration * Configuration::sInstance = 0;
QString Configuration::sConfigurationPath = "/etc/QtMeetings.conf";
Configuration::Configuration() :
- iConnectionSettings( 0 ),
- iStartupSettings( 0 ),
- iDisplaySettings( 0 ),
- iDateTimeSettings( 0 )
+ iConnectionSettings(0), iStartupSettings(0), iDisplaySettings(0),
+ iDateTimeSettings(0),
+ iShowConfidentialMeetingDetails(false)
{
}
-Configuration::~Configuration()
-{
+Configuration::~Configuration() {
delete iConnectionSettings;
delete iStartupSettings;
delete iDisplaySettings;
delete iDateTimeSettings;
- while ( !iRooms.isEmpty() )
- {
+ while (!iRooms.isEmpty()) {
delete iRooms.takeFirst();
}
}
-Configuration* Configuration::instance()
-{
- if ( sInstance == 0 )
- {
- sInstance = readFromXML( sConfigurationPath );
- if( !sInstance )
- {
- qDebug() << "FATAL: Configuration cannot be read from:" << Configuration::sConfigurationPath;
- }
- }
+Configuration* Configuration::instance() {
+ if (sInstance == 0) {
+ qDebug() << "HERE";
+ sInstance = new Configuration();
+ sInstance->readFromXML(sConfigurationPath);
+ if (!sInstance) {
+ qDebug() << "FATAL: Configuration cannot be read from:"
+ << Configuration::sConfigurationPath;
+ }
+ }
return sInstance;
}
-ConnectionSettings* Configuration::connectionSettings()
-{
- return iConnectionSettings;
-}
+/*ConnectionSettings* Configuration::connectionSettings()
+ {
+ return iConnectionSettings;
+ }*/
-StartupSettings * Configuration::startupSettings()
-{
+StartupSettings * Configuration::startupSettings() {
return iStartupSettings;
}
-DisplaySettings * Configuration::displaySettings()
-{
+DisplaySettings * Configuration::displaySettings() {
return iDisplaySettings;
}
-DateTimeSettings * Configuration::dateTimeSettings()
-{
+DateTimeSettings * Configuration::dateTimeSettings() {
return iDateTimeSettings;
}
-Room* Configuration::defaultRoom()
-{
+Room* Configuration::defaultRoom() {
// default room is stored as the first element of the list
- return ( iRooms.count() == 0 ) ? 0 : iRooms.at( 0 );
+ return (iRooms.count() == 0) ? 0 : iRooms.at(0);
}
-QString Configuration::languageCode()
-{
+QString Configuration::languageCode() {
return iLanguageCode;
}
-QList<Room*> Configuration::rooms()
-{
+QList<Room*> Configuration::rooms() {
return iRooms;
}
-QByteArray Configuration::adminPassword()
-{
+QByteArray Configuration::adminPassword() {
return iAdminPassword;
}
+QUrl Configuration::getServerUrl() {
+ return iConnectionSettings->serverUrl();
+}
-void Configuration::save()
-{
- QDomDocument doc;
- QFile file( sConfigurationPath );
+QString Configuration::getUsername() {
+ return iConnectionSettings->username();
+}
+QString Configuration::getPassword() {
+ return iConnectionSettings->password();
+}
- if ( !file.open( QIODevice::ReadWrite ) )
- {
+unsigned int Configuration::getRefreshinterval() {
+ return iConnectionSettings->refreshInterval();
+}
+
+void Configuration::setServerUrl(QUrl serverUrl) {
+ iConnectionSettings->setServerUrl(serverUrl);
+}
+void Configuration::setUsername(QString username) {
+ iConnectionSettings->setUsername(username);
+}
+void Configuration::setPassword(QString password) {
+ iConnectionSettings->setPassword(password);
+}
+void Configuration::setRefreshinterval(unsigned int refreshinterval) {
+ iConnectionSettings->setRefreshInterval(refreshinterval);
+}
+
+void Configuration::save() {
+ QDomDocument doc;
+ QFile file(sConfigurationPath);
+ if (!file.open(QIODevice::ReadWrite)) {
return;
}
- if ( !doc.setContent( &file ) )
- {
+ if (!doc.setContent(&file)) {
file.close();
return;
}
QDomElement root = doc.documentElement();
// Save all attributes to document
- saveAdminPassword( root );
+ saveAdminPassword(root);
- for ( QDomNode node = root.firstChild(); !node.isNull(); node = node.nextSibling() )
- {
+ bool confidentialMeetingDetailsElementMissing = true;
+
+ for (QDomNode node = root.firstChild(); !node.isNull(); node
+ = node.nextSibling()) {
QDomElement e = node.toElement();
QString tagName = e.tagName().toLower();
+ if (tagName == QString("connection")) {
+ saveConnectionSettings(node);
+ } else if (tagName == QString("rooms")) {
+ saveRooms(node);
+ } else if (tagName == QString("language")) {
+ saveLanguageCode(node);
+ } else if (tagName == QString("startup")) {
+ saveStartupSettings(node);
+ } else if (tagName == QString("display")) {
+ saveDisplaySettings(node);
+ } else if (tagName == QString("daylight_saving_time")) {
+ saveDateTimeSettings(node);
+ } else if (tagName == QString("privacy")) {
+ confidentialMeetingDetailsElementMissing = false;
+ savePrivacySettings(node);
+ }
+ }
- if ( tagName == QString( "connection" ) )
- {
- saveConnectionSettings( node );
- }
- else if ( tagName == QString( "rooms" ) )
- {
- saveRooms( node );
- }
- else if ( tagName == QString( "language" ) )
- {
- saveLanguageCode( node );
- }
- else if ( tagName == QString( "startup" ) )
- {
- saveStartupSettings( node );
- }
- else if ( tagName == QString( "display" ) )
- {
- saveDisplaySettings( node );
- }
- else if (tagName == QString( "daylight_saving_time" ) )
- {
- saveDateTimeSettings( node );
- }
+ if( confidentialMeetingDetailsElementMissing )
+ {
+ QDomElement e = root.ownerDocument().createElement("privacy");
+ savePrivacySettings(e);
+ root.appendChild(e);
}
//! Empty the file from previous content and write again with new one
- file.resize( 0 );
- file.write( doc.toByteArray( 4 ) ); //! 4 as intent
+ file.resize(0);
+ file.write(doc.toByteArray(4)); //! 4 as intent
file.close();
-
+ emit configurationChanged();
}
-void Configuration::saveConnectionSettings( const QDomNode &aXML )
-{
- for ( QDomNode node = aXML.firstChild(); !node.isNull(); node = node.nextSibling() )
- {
+void Configuration::saveConnectionSettings(const QDomNode &aXML) {
+ QDomElement e = aXML.firstChild().toElement();
+ QString tagName = e.tagName().toLower();
+ qDebug() << tagName;
+ for (QDomNode node = aXML.firstChild(); !node.isNull(); node
+ = node.nextSibling()) {
QDomElement e = node.toElement();
QString tagName = e.tagName().toLower();
- if ( tagName == QString( "serverurl" ) )
- {
- QDomText t = node.ownerDocument().createTextNode( iConnectionSettings->serverUrl().toString() );
- if ( e.hasChildNodes() )
- {
- e.replaceChild( t, e.firstChild() );
- }
- else
- {
- e.appendChild( e.firstChild() );
+ qDebug() << tagName;
+ if (tagName == QString("serverurl")) {
+ QDomText t = node.ownerDocument().createTextNode(
+ iConnectionSettings->serverUrl().toString());
+ if (e.hasChildNodes()) {
+ e.replaceChild(t, e.firstChild());
+ } else {
+ e.appendChild(t);
}
- }
- else if ( tagName == QString( "username" ) )
- {
- QDomText t = node.ownerDocument().createTextNode( iConnectionSettings->username() );
- if ( e.hasChildNodes() )
- {
- e.replaceChild( t, e.firstChild() );
- }
- else
- {
- e.appendChild( e.firstChild() );
+ } else if (tagName == QString("username")) {
+ QDomText t = node.ownerDocument().createTextNode(
+ iConnectionSettings->username());
+ if (e.hasChildNodes()) {
+ e.replaceChild(t, e.firstChild());
+ } else {
+ e.appendChild(t);
}
- }
- else if ( tagName == QString( "password" ) )
- {
- QDomText t = node.ownerDocument().createTextNode( iConnectionSettings->password() );
- if ( e.hasChildNodes() )
- {
- e.replaceChild( t, e.firstChild() );
- }
- else
- {
- e.appendChild( e.firstChild() );
+
+ } else if (tagName == QString("password")) {
+ QDomText t = node.ownerDocument().createTextNode(
+ iConnectionSettings->password());
+ if (e.hasChildNodes()) {
+ e.replaceChild(t, e.firstChild());
+ } else {
+ e.appendChild(t);
}
- }
- else if ( tagName == QString( "refreshinterval" ) )
- {
- QString s = QString( "%1" ).arg( iConnectionSettings->refreshInterval() );
- QDomText t = node.ownerDocument().createTextNode( s );
- e.replaceChild( t, e.firstChild() );
+ } else if (tagName == QString("refreshinterval")) {
+ QString s = QString("%1").arg(
+ iConnectionSettings->refreshInterval());
+ QDomText t = node.ownerDocument().createTextNode(s);
+ e.replaceChild(t, e.firstChild());
}
}
}
-void Configuration::saveRooms( const QDomNode &aXML )
-{
+void Configuration::saveRooms(const QDomNode &aXML) {
//! List of rooms must be cleared and rewritten again
QDomDocument doc = aXML.ownerDocument();
- QDomNode root = aXML;
+ QDomNode root = aXML;
// Remove child nodes...
int count = root.childNodes().count();
QDomNode node = root.firstChild();
QDomNode next;
- for (int i = 0; i < count; i++)
- {
+ for (int i = 0; i < count; i++) {
qDebug() << "remove " << node.toElement().text();
next = node.nextSibling();
node = root.removeChild(node);
node = aXML;
QList<Room*>::iterator i;
- for ( i = iRooms.begin(); i != iRooms.end(); ++i )
- {
- QDomElement tag = doc.createElement( "room" );
- node.appendChild( tag );
+ for (i = iRooms.begin(); i != iRooms.end(); ++i) {
+ QDomElement tag = doc.createElement("room");
+ node.appendChild(tag);
// First room in the list is a dafault room
- if ( i == iRooms.begin() )
- {
- tag.setAttribute( "default", "true" );
+ if (i == iRooms.begin()) {
+ tag.setAttribute("default", "true");
}
- QDomElement ename = doc.createElement( "name" );
- QDomText tname = node.ownerDocument().createTextNode(( *i )->name() );
- ename.appendChild( tname );
- tag.appendChild( ename );
+ QDomElement ename = doc.createElement("name");
+ QDomText tname = node.ownerDocument().createTextNode((*i)->name());
+ ename.appendChild(tname);
+ tag.appendChild(ename);
- QDomElement eaddress = doc.createElement( "address" );
- QDomText taddress = node.ownerDocument().createTextNode(( *i )->address() );
- eaddress.appendChild( taddress );
- tag.appendChild( eaddress );
+ QDomElement eaddress = doc.createElement("address");
+ QDomText taddress =
+ node.ownerDocument().createTextNode((*i)->address());
+ eaddress.appendChild(taddress);
+ tag.appendChild(eaddress);
}
}
-void Configuration::saveLanguageCode( const QDomNode &aXML )
-{
+void Configuration::saveLanguageCode(const QDomNode &aXML) {
QDomElement e = aXML.toElement();
- e.setAttribute( "code", languageCode() );
+ e.setAttribute("code", languageCode());
}
-void Configuration::saveStartupSettings( const QDomNode &aXML )
-{
+void Configuration::saveStartupSettings(const QDomNode &aXML) {
QDomElement e = aXML.toElement();
- for ( QDomNode node = aXML.firstChild(); !node.isNull(); node = node.nextSibling() )
- {
+ for (QDomNode node = aXML.firstChild(); !node.isNull(); node
+ = node.nextSibling()) {
e = node.toElement();
QString tagName = e.tagName().toLower();
- if ( tagName == QString( "powersaving" ) )
- {
- ( iStartupSettings->isPowersavingEnabled() ?
- e.setAttribute( "enabled", "true" ) :
- e.setAttribute( "enabled", "false" ) );
+ if (tagName == QString("powersaving")) {
+ (iStartupSettings->isPowersavingEnabled() ? e.setAttribute(
+ "enabled", "true") : e.setAttribute("enabled", "false"));
- e.setAttribute( "on", iStartupSettings->turnOnAt().toString( "hh:mm" ) );
- e.setAttribute( "off", iStartupSettings->turnOffAt().toString( "hh:mm" ) );
+ e.setAttribute("on", iStartupSettings->turnOnAt().toString("hh:mm"));
+ e.setAttribute("off", iStartupSettings->turnOffAt().toString(
+ "hh:mm"));
}
}
}
-void Configuration::saveDisplaySettings( const QDomNode &aXML )
-{
- for ( QDomNode node = aXML.firstChild(); !node.isNull(); node = node.nextSibling() )
- {
+void Configuration::saveDisplaySettings(const QDomNode &aXML) {
+ for (QDomNode node = aXML.firstChild(); !node.isNull(); node
+ = node.nextSibling()) {
QDomElement e = node.toElement();
QString tagName = e.tagName().toLower();
- if ( tagName == QString( "schedule" ) )
- {
- for ( QDomNode scheduleNode = node.firstChild(); !scheduleNode.isNull(); scheduleNode = scheduleNode.nextSibling() )
- {
+ if (tagName == QString("schedule")) {
+ for (QDomNode scheduleNode = node.firstChild(); !scheduleNode.isNull(); scheduleNode
+ = scheduleNode.nextSibling()) {
QDomElement scheduleElem = scheduleNode.toElement();
tagName = scheduleElem.tagName().toLower();
- if ( tagName == QString( "week" ) )
- {
- scheduleElem.setAttribute( "days", iDisplaySettings->daysInSchedule() );
+ if (tagName == QString("week")) {
+ scheduleElem.setAttribute("days",
+ iDisplaySettings->daysInSchedule());
+ } else if (tagName == QString("day")) {
+ scheduleElem.setAttribute("startsat",
+ iDisplaySettings->dayStartsAt().toString("hh:mm"));
+ scheduleElem.setAttribute("endsat",
+ iDisplaySettings->dayEndsAt().toString("hh:mm"));
}
- else if ( tagName == QString( "day" ) )
- {
- scheduleElem.setAttribute( "startsat", iDisplaySettings->dayStartsAt().toString( "hh:mm" ) );
- scheduleElem.setAttribute( "endsat", iDisplaySettings->dayEndsAt().toString( "hh:mm" ) );
- }
- } // end of for
- } // end of schedule
- else if ( tagName == QString( "dateformat" ) )
- {
- QDomText t = node.ownerDocument().createTextNode( iDisplaySettings->dateFormat() );
- e.replaceChild( t, e.firstChild() );
- }
- else if ( tagName == QString( "timeformat" ) )
- {
- QDomText t = node.ownerDocument().createTextNode( iDisplaySettings->timeFormat() );
- e.replaceChild( t, e.firstChild() );
- }
- else if ( tagName == QString( "screensaver" ) )
- {
- QString s = QString( "%1" ).arg( iDisplaySettings->screensaver() );
- QDomText t = node.ownerDocument().createTextNode( s );
- e.replaceChild( t, e.firstChild() );
+ } // end of for
+ } // end of schedule
+ else if (tagName == QString("dateformat")) {
+ QDomText t = node.ownerDocument().createTextNode(
+ iDisplaySettings->dateFormat());
+ e.replaceChild(t, e.firstChild());
+ } else if (tagName == QString("timeformat")) {
+ QDomText t = node.ownerDocument().createTextNode(
+ iDisplaySettings->timeFormat());
+ e.replaceChild(t, e.firstChild());
+ } else if (tagName == QString("screensaver")) {
+ QString s = QString("%1").arg(iDisplaySettings->screensaver());
+ QDomText t = node.ownerDocument().createTextNode(s);
+ e.replaceChild(t, e.firstChild());
}
}
}
-void Configuration::saveDateTimeSettings( const QDomNode &aXML )
-{
- for ( QDomNode node = aXML.firstChild(); !node.isNull(); node = node.nextSibling() )
- {
+void Configuration::saveDateTimeSettings(const QDomNode &aXML) {
+ for (QDomNode node = aXML.firstChild(); !node.isNull(); node
+ = node.nextSibling()) {
QDomElement e = node.toElement();
QString tagName = e.tagName().toLower();
- if ( tagName == QString( "dayofweek" ) )
- {
- QDomText t = node.ownerDocument().createTextNode( iDateTimeSettings->switchDay() );
- e.replaceChild( t, e.firstChild() );
- }
- else if( tagName == QString( "StandardTimeChangeMoment" ) )
- {
- QDomText t = node.ownerDocument().createTextNode( iDateTimeSettings->STDDateTime().toString("ddMMyyyyhhmmss"));
- e.replaceChild( t, e.firstChild() );
- }
- else if( tagName == QString( "DaylightSaveTimeChangeMoment" ) )
- {
- QDomText t = node.ownerDocument().createTextNode( iDateTimeSettings->DSTDateTime().toString("ddMMyyyyhhmmss"));
- e.replaceChild( t, e.firstChild() );
+ if (tagName == QString("dayofweek")) {
+ QDomText t = node.ownerDocument().createTextNode(
+ iDateTimeSettings->switchDay());
+ e.replaceChild(t, e.firstChild());
+ } else if (tagName == QString("StandardTimeChangeMoment")) {
+ QDomText t =
+ node.ownerDocument().createTextNode(
+ iDateTimeSettings->STDDateTime().toString(
+ "ddMMyyyyhhmmss"));
+ e.replaceChild(t, e.firstChild());
+ } else if (tagName == QString("DaylightSaveTimeChangeMoment")) {
+ QDomText t =
+ node.ownerDocument().createTextNode(
+ iDateTimeSettings->DSTDateTime().toString(
+ "ddMMyyyyhhmmss"));
+ e.replaceChild(t, e.firstChild());
}
}
}
-void Configuration::saveAdminPassword( const QDomNode &aXML )
-{
+void Configuration::saveAdminPassword(const QDomNode &aXML) {
QDomElement e = aXML.toElement();
- e.setAttribute( "password", QString( adminPassword() ) );
+ e.setAttribute("password", QString(adminPassword()));
}
-
-Configuration* Configuration::readFromXML( const QString &aPath )
-{
+void Configuration::readFromXML(const QString &aPath) {
QDomDocument doc;
- QFile file( aPath );
+ QFile file(aPath);
- if ( !file.open( QIODevice::ReadOnly ) )
- {
- return 0;
+ if (!file.open(QIODevice::ReadOnly)) {
+ return;
}
- if ( !doc.setContent( &file ) )
- {
+ if (!doc.setContent(&file)) {
file.close();
- return 0;
+ return;
}
file.close();
QDomElement root = doc.documentElement();
// check if the file is the one we need
- if ( root.tagName().toLower() != QString( "configuration" ) )
- {
- return 0;
+ if (root.tagName().toLower() != QString("configuration")) {
+ return;
}
- Configuration* conf = new Configuration();
+ iAdminPassword = /*Configuration::*/readAdminPassword(root);
- conf->iAdminPassword = Configuration::readAdminPassword( root );
-
- for ( QDomNode node = root.firstChild(); !node.isNull(); node = node.nextSibling() )
- {
+ for (QDomNode node = root.firstChild(); !node.isNull(); node
+ = node.nextSibling()) {
QDomElement e = node.toElement();
QString tagName = e.tagName().toLower();
- if ( tagName == QString( "connection" ) )
- {
- conf->iConnectionSettings = Configuration::readConnectionSettings( node );
- }
- else if ( tagName == QString( "rooms" ) )
- {
- conf->iRooms = Configuration::readRooms( node );
- }
- else if ( tagName == QString( "language" ) )
- {
- conf->iLanguageCode = Configuration::readLanguageCode( node );
- }
- else if ( tagName == QString( "startup" ) )
- {
- conf->iStartupSettings = Configuration::readStartupSettings( node );
- }
- else if ( tagName == QString( "display" ) )
- {
- conf->iDisplaySettings = Configuration::readDisplaySettings( node );
- }
- else if ( tagName == QString( "daylight_saving_time" ) )
- {
- conf->iDateTimeSettings = Configuration::readDateTimeSettings(node);
+ if (tagName == QString("connection")) {
+ iConnectionSettings = readConnectionSettings(node);
+ } else if (tagName == QString("rooms")) {
+ iRooms = readRooms(node);
+ } else if (tagName == QString("language")) {
+ iLanguageCode = readLanguageCode(node);
+ } else if (tagName == QString("startup")) {
+ iStartupSettings = readStartupSettings(node);
+ } else if (tagName == QString("display")) {
+ iDisplaySettings = readDisplaySettings(node);
+ } else if (tagName == QString("daylight_saving_time")) {
+ iDateTimeSettings = readDateTimeSettings(node);
+ } else if (tagName == QString("privacy")) {
+ readPrivacySettings(node);
}
}
-
- return conf;
}
-ConnectionSettings* Configuration::readConnectionSettings( const QDomNode &aXML )
-{
+ConnectionSettings* Configuration::readConnectionSettings(const QDomNode &aXML) {
QString server, username, password;
unsigned int interval = Configuration::sDefaultInterval;
- for ( QDomNode node = aXML.firstChild(); !node.isNull(); node = node.nextSibling() )
- {
+ for (QDomNode node = aXML.firstChild(); !node.isNull(); node
+ = node.nextSibling()) {
QDomElement e = node.toElement();
QString tagName = e.tagName().toLower();
- if ( tagName == QString( "serverurl" ) )
- {
+ if (tagName == QString("serverurl")) {
server = e.text();
- }
- else if ( tagName == QString( "username" ) )
- {
+ } else if (tagName == QString("username")) {
username = e.text();
- }
- else if ( tagName == QString( "password" ) )
- {
+ } else if (tagName == QString("password")) {
password = e.text();
- }
- else if ( tagName == QString( "refreshinterval" ) )
- {
+ } else if (tagName == QString("refreshinterval")) {
bool success = false;
- unsigned int intervalTMP = e.text().toUInt( &success );
- if ( success )
- {
+ unsigned int intervalTMP = e.text().toUInt(&success);
+ if (success) {
interval = intervalTMP;
}
}
}
- return new ConnectionSettings( server, username, password, interval );
+ return new ConnectionSettings(server, username, password, interval);
}
-QList<Room*> Configuration::readRooms( const QDomNode &aXML )
-{
+QList<Room*> Configuration::readRooms(const QDomNode &aXML) {
QList<Room*> rooms;
- for ( QDomNode node = aXML.firstChild(); !node.isNull(); node = node.nextSibling() )
- {
+ for (QDomNode node = aXML.firstChild(); !node.isNull(); node
+ = node.nextSibling()) {
QDomElement e = node.toElement();
QString tagName = e.tagName().toLower();
- if ( tagName == QString( "room" ) )
- {
+ if (tagName == QString("room")) {
QString name, address;
- for ( QDomNode roomNode = node.firstChild(); !roomNode.isNull(); roomNode = roomNode.nextSibling() )
- {
+ for (QDomNode roomNode = node.firstChild(); !roomNode.isNull(); roomNode
+ = roomNode.nextSibling()) {
QDomElement roomElem = roomNode.toElement();
tagName = roomElem.tagName().toLower();
- if ( tagName == QString( "name" ) )
- {
+ if (tagName == QString("name")) {
name = roomElem.text();
- }
- else if ( tagName == QString( "address" ) )
- {
+ } else if (tagName == QString("address")) {
address = roomElem.text();
}
}
- Room* room = new Room( name, address );
- QString defaultAttr = e.attribute( "default" ).toLower();
- if ( defaultAttr == QString( "true" ) )
- {
- rooms.insert( 0, room );
- }
- else
- {
- rooms.append( room );
+ Room* room = new Room(name, address);
+ QString defaultAttr = e.attribute("default").toLower();
+ if (defaultAttr == QString("true")) {
+ rooms.insert(0, room);
+ } else {
+ rooms.append(room);
}
}
}
return rooms;
}
-QString Configuration::readLanguageCode( const QDomNode &aXML )
-{
+QString Configuration::readLanguageCode(const QDomNode &aXML) {
QDomElement e = aXML.toElement();
QString tagName = e.tagName().toLower();
- if ( e.hasAttribute( "code" ) )
- {
- return e.attribute( "code" );
- }
- else
- {
+ if (e.hasAttribute("code")) {
+ return e.attribute("code");
+ } else {
// default language is English
return "EN";
}
}
-StartupSettings * Configuration::readStartupSettings( const QDomNode &aXML )
-{
+StartupSettings * Configuration::readStartupSettings(const QDomNode &aXML) {
QDomElement e = aXML.toElement();
bool isPowersavingEnabled = false;
QTime turnOnAt, turnOffAt;
- for ( QDomNode node = aXML.firstChild(); !node.isNull(); node = node.nextSibling() )
- {
+ for (QDomNode node = aXML.firstChild(); !node.isNull(); node
+ = node.nextSibling()) {
e = node.toElement();
QString tagName = e.tagName().toLower();
- if ( tagName == QString( "powersaving" ) )
- {
- if ( e.hasAttribute( "enabled" ) &&
- e.attribute( "enabled" ) == QString( "true" ) )
- {
+ if (tagName == QString("powersaving")) {
+ if (e.hasAttribute("enabled") && e.attribute("enabled") == QString(
+ "true")) {
isPowersavingEnabled = true;
}
- if ( e.hasAttribute( "on" ) )
- {
- QString on = e.attribute( "on" );
- turnOnAt = QTime::fromString( on, "hh:mm" );
+ if (e.hasAttribute("on")) {
+ QString on = e.attribute("on");
+ turnOnAt = QTime::fromString(on, "hh:mm");
}
- if ( e.hasAttribute( "off" ) )
- {
- QString off = e.attribute( "off" );
- turnOffAt = QTime::fromString( off, "hh:mm" );
+ if (e.hasAttribute("off")) {
+ QString off = e.attribute("off");
+ turnOffAt = QTime::fromString(off, "hh:mm");
}
}
}
- return new StartupSettings( isPowersavingEnabled, turnOnAt, turnOffAt );
+ return new StartupSettings(isPowersavingEnabled, turnOnAt, turnOffAt);
}
-DisplaySettings * Configuration::readDisplaySettings( const QDomNode &aXML )
-{
- DisplaySettings::DaysInSchedule daysInSchedule = DisplaySettings::WeekdaysInSchedule;
+DisplaySettings * Configuration::readDisplaySettings(const QDomNode &aXML) {
+ DisplaySettings::DaysInSchedule daysInSchedule =
+ DisplaySettings::WeekdaysInSchedule;
QTime dayStartsAt, dayEndsAt;
DisplaySettings::DateFormat dateformat = DisplaySettings::ShortDateFormat;
- DisplaySettings::TimeFormat timeformat = DisplaySettings::TwentyFourHoursTimeFormat;
- int screensaver = 1; //! Default value for screensaver wait time
+ DisplaySettings::TimeFormat timeformat =
+ DisplaySettings::TwentyFourHoursTimeFormat;
+ int screensaver = 1; //! Default value for screensaver wait time
- for ( QDomNode node = aXML.firstChild(); !node.isNull(); node = node.nextSibling() )
- {
+ for (QDomNode node = aXML.firstChild(); !node.isNull(); node
+ = node.nextSibling()) {
QDomElement e = node.toElement();
QString tagName = e.tagName().toLower();
- if ( tagName == QString( "schedule" ) )
- {
- for ( QDomNode scheduleNode = node.firstChild(); !scheduleNode.isNull(); scheduleNode = scheduleNode.nextSibling() )
- {
+ if (tagName == QString("schedule")) {
+ for (QDomNode scheduleNode = node.firstChild(); !scheduleNode.isNull(); scheduleNode
+ = scheduleNode.nextSibling()) {
QDomElement scheduleElem = scheduleNode.toElement();
tagName = scheduleElem.tagName().toLower();
- if ( tagName == QString( "week" ) )
- {
- if ( scheduleElem.hasAttribute( "days" ) )
- {
+ if (tagName == QString("week")) {
+ if (scheduleElem.hasAttribute("days")) {
// default value is 5, only other supported possibility is 7
bool success = false;
- unsigned int days = scheduleElem.attribute( "days" ).toUInt( &success );
- daysInSchedule = ( success && days == 7 ) ? DisplaySettings::WholeWeekInSchedule : DisplaySettings::WeekdaysInSchedule;
+ unsigned int days =
+ scheduleElem.attribute("days").toUInt(&success);
+ daysInSchedule
+ = (success && days == 7) ? DisplaySettings::WholeWeekInSchedule
+ : DisplaySettings::WeekdaysInSchedule;
}
- }
- else if ( tagName == QString( "day" ) )
- {
- if ( scheduleElem.hasAttribute( "startsat" ) )
- {
- QString time = scheduleElem.attribute( "startsat" );
- dayStartsAt = QTime::fromString( time, "hh:mm" );
+ } else if (tagName == QString("day")) {
+ if (scheduleElem.hasAttribute("startsat")) {
+ QString time = scheduleElem.attribute("startsat");
+ dayStartsAt = QTime::fromString(time, "hh:mm");
}
- if ( scheduleElem.hasAttribute( "endsat" ) )
- {
- QString time = scheduleElem.attribute( "endsat" );
- dayEndsAt = QTime::fromString( time, "hh:mm" );
+ if (scheduleElem.hasAttribute("endsat")) {
+ QString time = scheduleElem.attribute("endsat");
+ dayEndsAt = QTime::fromString(time, "hh:mm");
}
}
- } // end of for
- } // end of schedule
- else if ( tagName == QString( "dateformat" ) )
- {
+ } // end of for
+ } // end of schedule
+ else if (tagName == QString("dateformat")) {
//! Not able to display long format anyway at the moment
/*
- if ( e.text() == QObject::tr( "dddd d MMMM yyyy" ) )
- dateformat = DisplaySettings::LongDateFormat;
- else
- dateformat = DisplaySettings::ShortDateFormat;
- */
+ if ( e.text() == QObject::tr( "dddd d MMMM yyyy" ) )
+ dateformat = DisplaySettings::LongDateFormat;
+ else
+ dateformat = DisplaySettings::ShortDateFormat;
+ */
dateformat = DisplaySettings::ShortDateFormat;
- }
- else if ( tagName == QString( "timeformat" ) )
- {
+ } else if (tagName == QString("timeformat")) {
//! Not able to display "TwelveHoursTimeFormat" anyway at the moment
/*
- if ( e.text() == QObject::tr( "hh:mm ap" ) )
- timeformat = DisplaySettings::TwelveHoursTimeFormat;
- else
- timeformat = DisplaySettings::TwentyFourHoursTimeFormat;
- */
+ if ( e.text() == QObject::tr( "hh:mm ap" ) )
+ timeformat = DisplaySettings::TwelveHoursTimeFormat;
+ else
+ timeformat = DisplaySettings::TwentyFourHoursTimeFormat;
+ */
timeformat = DisplaySettings::TwentyFourHoursTimeFormat;
- }
- else if ( tagName == QString( "screensaver" ) )
- {
+ } else if (tagName == QString("screensaver")) {
bool success = false;
- unsigned int screensaverTMP = e.text().toUInt( &success );
- if ( success )
- {
+ unsigned int screensaverTMP = e.text().toUInt(&success);
+ if (success) {
screensaver = screensaverTMP;
}
}
}
- return new DisplaySettings( dateformat, timeformat, daysInSchedule, dayStartsAt, dayEndsAt, screensaver );
+ return new DisplaySettings(dateformat, timeformat, daysInSchedule,
+ dayStartsAt, dayEndsAt, screensaver);
}
-DateTimeSettings * Configuration::readDateTimeSettings( const QDomNode &aXML )
-{
+DateTimeSettings * Configuration::readDateTimeSettings(const QDomNode &aXML) {
// Set defaults..
- QDateTime standardTimeChangeMoment = QDateTime::fromString("05.10.2009 04:00:00", "dd'.'MM'.'yyyy' 'hh:mm:ss");
- QDateTime daylightSaveTimeChangeMoment = QDateTime::fromString("01.04.2010 03:00:00", "dd'.'MM'.'yyyy' 'hh:mm:ss");
+ QDateTime standardTimeChangeMoment = QDateTime::fromString(
+ "05.10.2009 04:00:00", "dd'.'MM'.'yyyy' 'hh:mm:ss");
+ QDateTime daylightSaveTimeChangeMoment = QDateTime::fromString(
+ "01.04.2010 03:00:00", "dd'.'MM'.'yyyy' 'hh:mm:ss");
DateTimeSettings::weekDay dayOfWeek = DateTimeSettings::Sunday;
-
- for ( QDomNode node = aXML.firstChild(); !node.isNull(); node = node.nextSibling() )
- {
+
+ for (QDomNode node = aXML.firstChild(); !node.isNull(); node
+ = node.nextSibling()) {
QDomElement e = node.toElement();
QString tagName = e.tagName().toLower();
- if ( tagName == QString( "dayofweek" ) )
- {
- qDebug() << "Configuration::readDateTimeSettings: " +e.text();
-
+ if (tagName == QString("dayofweek")) {
+ qDebug() << "Configuration::readDateTimeSettings: " + e.text();
+
bool success = false;
- unsigned int weekDayTmp = e.text().toUInt( &success );
- if( success && weekDayTmp < 7 )
- {
- dayOfWeek = (DateTimeSettings::weekDay)weekDayTmp;
+ unsigned int weekDayTmp = e.text().toUInt(&success);
+ if (success && weekDayTmp < 7) {
+ dayOfWeek = (DateTimeSettings::weekDay) weekDayTmp;
}
- }
- else if( tagName == QString( "standardtimechangemoment" ) )
- {
- standardTimeChangeMoment = QDateTime::fromString(e.text(), "dd'.'MM'.'yyyy' 'hh:mm:ss");
- qDebug() << "Configuration::readDateTimeSettings: " +standardTimeChangeMoment.toString("dd.MM.yyyy hh:mm:ss");
- }
- else if( tagName == QString( "daylightsavetimechangemoment" ) )
- {
- daylightSaveTimeChangeMoment = QDateTime::fromString(e.text(), "dd'.'MM'.'yyyy' 'hh:mm:ss");
- qDebug() << "Configuration::readDateTimeSettings: " +daylightSaveTimeChangeMoment.toString("dd.MM.yyyy hh:mm:ss");
+ } else if (tagName == QString("standardtimechangemoment")) {
+ standardTimeChangeMoment = QDateTime::fromString(e.text(),
+ "dd'.'MM'.'yyyy' 'hh:mm:ss");
+ qDebug() << "Configuration::readDateTimeSettings: "
+ + standardTimeChangeMoment.toString("dd.MM.yyyy hh:mm:ss");
+ } else if (tagName == QString("daylightsavetimechangemoment")) {
+ daylightSaveTimeChangeMoment = QDateTime::fromString(e.text(),
+ "dd'.'MM'.'yyyy' 'hh:mm:ss");
+ qDebug() << "Configuration::readDateTimeSettings: "
+ + daylightSaveTimeChangeMoment.toString(
+ "dd.MM.yyyy hh:mm:ss");
}
}
-
- return new DateTimeSettings(standardTimeChangeMoment, daylightSaveTimeChangeMoment, dayOfWeek);
+
+ return new DateTimeSettings(standardTimeChangeMoment,
+ daylightSaveTimeChangeMoment, dayOfWeek);
}
-QByteArray Configuration::readAdminPassword( const QDomNode &aXML )
-{
+QByteArray Configuration::readAdminPassword(const QDomNode &aXML) {
QDomElement e = aXML.toElement();
QString tagName = e.tagName().toLower();
- if ( e.hasAttribute( "password" ) )
- {
- QString pw = e.attribute( "password" );
+ if (e.hasAttribute("password")) {
+ QString pw = e.attribute("password");
// Check if the password is default uncrypted "admin"
- if ( pw == QString( "admin" ) )
- {
+
+ int x = QString::compare(pw, "admin", Qt::CaseInsensitive); // x == 0
+
+ if (x == 0) {
// uncrypted password needs to be encoded
- QCryptographicHash *hash = new QCryptographicHash( QCryptographicHash::Md5 );
- hash->addData( pw.toUtf8() );
- pw = QString( hash->result() );
+ QCryptographicHash *hash = new QCryptographicHash(
+ QCryptographicHash::Md5);
+ hash->addData(pw.toUtf8());
+ pw = QString(hash->result());
delete hash;
+ return (pw.toAscii()).toHex();
}
- return ( pw.toAscii() ).toHex();
-
+
+ return (pw.toAscii());
+
+ } else {
+ return 0;
+ }
+}
+
+void Configuration::setRooms(const QList<Room*> aRooms) {
+ iRooms = aRooms;
+}
+
+void Configuration::readPrivacySettings(const QDomNode &aXML) {
+ QString s = QString("show_confidential_meeting_details");
+
+ QDomElement e = aXML.firstChildElement(s);
+
+ if (e.hasAttribute("enabled") &&
+ e.attribute("enabled") == QString("true")) {
+ iShowConfidentialMeetingDetails = true;
}
else
{
- return 0;
+ iShowConfidentialMeetingDetails = false;
}
}
-void Configuration::setRooms( const QList<Room*> aRooms )
-{
- iRooms = aRooms;
+void Configuration::savePrivacySettings(QDomNode &aXML) {
+ QString s = QString("show_confidential_meeting_details");
+
+ QDomElement e = aXML.firstChildElement(s);
+
+ if (e.isNull()) {
+ e = aXML.ownerDocument().createElement(s);
+ aXML.appendChild(e);
+ }
+
+ if( showConfidentialMeetingDetails() )
+ e.setAttribute("enabled", "true");
+ else
+ e.setAttribute("enabled", "false");
}
-QString Configuration::hashPassword( const QString aPassword )
-{
- QCryptographicHash *hash = new QCryptographicHash( QCryptographicHash::Md5 );
- hash->addData( aPassword.toUtf8() );
+bool Configuration::setShowConfidentialMeetingDetails(
+ bool showconfidentialmeetingdetails) {
+ iShowConfidentialMeetingDetails = showconfidentialmeetingdetails;
+}
+
+bool Configuration::showConfidentialMeetingDetails() {
+ return iShowConfidentialMeetingDetails;
+}
+
+QString Configuration::hashPassword(const QString aPassword) {
+ QCryptographicHash *hash = new QCryptographicHash(QCryptographicHash::Md5);
+ hash->addData(aPassword.toUtf8());
QByteArray password = hash->result();
delete hash;
- return QString( password );
+ return QString(password);
}
#include <QString>
#include <QList>
#include <QTime>
+#include <QUrl>
class ConnectionSettings;
class StartupSettings;
* file at initialization time. Since there is one appliation per device normally running, therefore
* there is only one instance of this class, which is accessible by using a statis getter method.
*/
-class Configuration : public QObject
-{
+class Configuration: public QObject {
Q_OBJECT
private:
* Gets the connection settings.
* \return Pointer to ConnectionSettings instance.
*/
- ConnectionSettings* connectionSettings();
+ //ConnectionSettings* connectionSettings();
+ /**
+ * Returns the current server URL
+ */
+ QUrl getServerUrl();
+ /**
+ * Returns the current username
+ */
+ QString getUsername();
+ /**
+ * Returns the current users password
+ */
+ QString getPassword();
+ /**
+ * Returns the refresh interval
+ */
+ unsigned int getRefreshinterval();
+ /**
+ * Sets the current server URL
+ */
+ void setServerUrl(QUrl serverUrl);
+ /**
+ * Sets the current username
+ */
+ void setUsername(QString username);
+ /**
+ * Sets the current users password
+ */
+ void setPassword(QString password);
+ /**
+ * Sets the refresh interval
+ */
+ void setRefreshinterval(unsigned int refreshinterval);
+
+ //! Sets the confidential meeting details showing setting.
+ /*!
+ * Sets the confidential meeting details showing setting.
+ * \param confidential meeting details showing setting.
+ */
+ bool setShowConfidentialMeetingDetails(bool showconfidentialmeetingdetails);
+
//! Gets the detault room.
/*!
* Gets the default meeting room.
QByteArray adminPassword();
//! Sets room list.
/*!
- * Sets room list.
+ * Sets room list.
* \param aRooms List of rooms
*/
void setRooms(const QList<Room*> aRooms);
+ //! Gets the confidential meeting details showing setting.
+ /*!
+ * Gets the confidential meeting details showing setting.
+ * \return confidential meeting details showing setting.
+ */
+ bool showConfidentialMeetingDetails();
+
+signals:
+ void configurationChanged();
+
public slots:
//! Saves setting values to file.
* \param aPath path and name of configuration file
* \return Configuration object.
*/
- static Configuration* readFromXML(const QString &aPath);
+ void readFromXML(const QString &aPath);
//! Static. Reads settings of connection from and XML node.
/*!
* Static. Reads settings of connection from an XML node.
* \param aXml QDomNode containing connection parameters.
* \return Pointer to ConnectionSettings object.
*/
- static ConnectionSettings* readConnectionSettings(const QDomNode &aXML);
+ ConnectionSettings* readConnectionSettings(const QDomNode &aXML);
//! Static. Reads rooms from an XML node.
/*!
* Static. Reads rooms from an XML node.
* \param aXml QDomNode containing meeting room parameters
* \return List of meetingrooms.
*/
- static QList<Room*> readRooms(const QDomNode &aXML);
+ QList<Room*> readRooms(const QDomNode &aXML);
//! Static. Reads language code from an XML node.
/*!
* Static. Reads rooms from an XML node.
* \param aXml QDomNode containing language code
* \return Language code.
*/
- static QString readLanguageCode(const QDomNode &aXML);
+ QString readLanguageCode(const QDomNode &aXML);
//! Static. Reads settings of startup from an XML node.
/*!
* Static. Reads settings of startup from an XML node.
* \param aXml QDomNode containing startup parameters
* \return Pointer to the read StartupSettings object.
*/
- static StartupSettings* readStartupSettings(const QDomNode &aXML);
+ StartupSettings* readStartupSettings(const QDomNode &aXML);
/*!
* Static function to load and store display settings from xml node.
* \param aXml QDomNode containing display parameters
* \return Pointer to the read DisplaySettings object.
*/
- static DisplaySettings* readDisplaySettings(const QDomNode &aXML);
+ DisplaySettings* readDisplaySettings(const QDomNode &aXML);
//! Static. Reads the date/time settings from an XML node.
/*!
* Static. Reads the date/time settings from an XML node.
* \param aXml QDomNode containing the date/time settings
* \return The date/time settings.
*/
- static DateTimeSettings* readDateTimeSettings(const QDomNode &aXML);
+ DateTimeSettings* readDateTimeSettings(const QDomNode &aXML);
//! Static. Reads adminstrator's password from an XML node.
/*!
* \param aXml QDomNode containing admin password
* \return Admin password.
*/
- static QByteArray readAdminPassword(const QDomNode &aXML);
+ QByteArray readAdminPassword(const QDomNode &aXML);
+ //! Static. Reads confidential meeting details setting from an XML node.
+ /*!
+ * Static. Reads confidential meeting details setting from an XML node.
+ * \param aXml QDomNode containing confidential meeting details setting
+ * \return Confidential meeting details setting.
+ */
+ void readPrivacySettings(const QDomNode &aXML);
+
//! Saves connection data to the document.
/*!
* Reads data from iConnectionSettings and saves it to the aXML document.
*/
void saveAdminPassword(const QDomNode &aXML);
+ //! Saves confidential meeting details setting to the document.
+ /*!
+ * Reads data from iShowConfidentialMeetingDetails and saves it to the aXML document.
+ * \param aXml QDomNode confidential meeting details setting
+ */
+ void savePrivacySettings(QDomNode &aXML);
+
//! Hash password with md5 method.
/*!
* Hash password with md5 method.
//! Stores language code
QString iLanguageCode;
+ bool iShowConfidentialMeetingDetails;
};
#endif /*CONFIGURATION_H_*/
#include "Communication.h"
#include "ConnectionSettings.h"
#include <QAuthenticator>
+#include "Configuration.h"
+#include <QDebug>
-Communication::Communication( const ConnectionSettings &aConnection ) :
+
+Communication::Communication() :
iCurrentRequest(0),
iAuthFailCount(0)
{
- iConnectionSettings = new ConnectionSettings( aConnection );
+ iHttp = new QHttp(Configuration::instance()->getServerUrl().toString()/*Configuration::instance()->getServerUrl().toString()*/, QHttp::ConnectionModeHttps );
- iHttp = new QHttp( iConnectionSettings->serverUrl().toString(), QHttp::ConnectionModeHttps );
connect( iHttp,
SIGNAL( readyRead( const QHttpResponseHeader& ) ),
iHttp,
SLOT( ignoreSslErrors() )/*this, SLOT( notifySsl( const QList<QSslError>& ) )*/
);
+ connect(Configuration::instance(),SIGNAL(configrationChanged()), SLOT(configurationChanged()));
}
Communication::~Communication()
{
- delete iConnectionSettings;
+ //delete iConnectionSettings;
delete iHttp;
QList<QByteArray*> responses = iResponses.values();
while(!responses.isEmpty())
void Communication::handleAuthentication( const QString& /*aHost*/, quint16 /*aPort*/, QAuthenticator* aAuthenticator )
{
- aAuthenticator->setPassword( iConnectionSettings->password() );
- aAuthenticator->setUser( iConnectionSettings->username() );
+
+ aAuthenticator->setPassword( Configuration::instance()->getPassword() );
+ aAuthenticator->setUser( Configuration::instance()->getUsername() );
iAuthFailCount++;
if( iAuthFailCount > 1 )
{
{
if( iAuthFailCount > 1 )
return 0;
-
+
+ iHttp->setHost(Configuration::instance()->getServerUrl().toString(),QHttp::ConnectionModeHttps);
QHttpRequestHeader header( QString( "POST" ), QString( "/ews/exchange.asmx" ) );
- header.setValue( "Host", iConnectionSettings->serverUrl().toString() );
+
+ header.setValue( "Host",Configuration::instance()->getServerUrl().toString() );
+
QString command = aCommand;
header.setContentType( command );
{
emit readProgress( iCurrentRequest, aDone, aTotal );
}
+
+void Communication::configurationChanged()
+{
+ iHttp->setHost(Configuration::instance()->getServerUrl().toString(),QHttp::ConnectionModeHttps );
+}
* \param aConnection Reference to ConnectionSettings which holds
* the server to connect to and authentication information.
*/
- Communication( const ConnectionSettings &aConnection );
+ Communication(/* const ConnectionSettings &aConnection*/ );
virtual ~Communication();
//! Returns the response of a request identified by aRequestId.
*/
int request( const QString &aCommand, const QByteArray &aContent );
+
+
signals:
//! Emitted when a request ongoing. Reports the bytes read from the server.
/*!
void handleRequestStarted( int aRequestId );
//! Connected to QHttp::dataReadProgress
void handleReadProgress( int aDone, int aTotal );
+ //!Called when the settings are changed by the user
+ void configurationChanged();
+
private:
/*!
* Instance of Connection settings of the communication
*/
- ConnectionSettings *iConnectionSettings;
+ //ConnectionSettings *iConnectionSettings;
/*!
* Instance of QHttp
*/
#include <QDateTime>
#include <QDomDocument>
#include <QDebug>
+#include "../../Domain/Configuration/Configuration.h"
static const int ERROR_BASE=100;
-CommunicationManager::CommunicationManager( const ConnectionSettings &aConnection )
+
+CommunicationManager::CommunicationManager()
{
- iConnectionSettings = new ConnectionSettings( aConnection );
+
iModifyingCommunication = NULL;
- iFetchingCommunication = new Communication( aConnection );
+
+ iFetchingCommunication = new Communication();
if ( iFetchingCommunication )
{
SLOT( requestFinished( int, int ) )
);
}
+
}
CommunicationManager::~CommunicationManager()
{
- delete iConnectionSettings;
+ //delete iConnectionSettings;
delete iModifyingCommunication;
delete iFetchingCommunication;
while ( !iMeetings.isEmpty() )
err = 10;
delete rd;
emit error( ERROR_BASE+(int)err, CommunicationManager::FetchingCommunication );
+ while ( !iMeetings.isEmpty() )
+ delete iMeetings.takeFirst();
+ emit meetingsFetched( iMeetings );
return;
}
int err = msg.getMeetingsFromResponse( iMeetings, *(rd->room) );
if( err )
+ {
emit error( ERROR_BASE+8, CommunicationManager::FetchingCommunication );
+ while ( !iMeetings.isEmpty() )
+ delete iMeetings.takeFirst();
+ emit meetingsFetched( iMeetings );
+ }
else
+ {
+ qDebug("*** COMMUNICATIONMANAGER ::: Meetings fetched!");
emit meetingsFetched( iMeetings );
+ }
break;
}
case ConvertId:
ResMsgGetCalendarItem msg( *response );
int err = msg.getMeetingDetailsFromResponse( *(rd->meeting) );
if( err )
+ {
emit error( ERROR_BASE+9, CommunicationManager::FetchingCommunication );
+ while ( !iMeetings.isEmpty() )
+ delete iMeetings.takeFirst();
+ emit meetingsFetched( iMeetings );
+ }
+
else
emit meetingDetailsFetched( *(rd->meeting) );
break;
}
return NULL;
}
+
/*!
* \param aConnection Reference to the fetching ConnectionSettings.
*/
- CommunicationManager( const ConnectionSettings &aConnection );
+ CommunicationManager( /*const ConnectionSettings &aConnection*/ );
virtual ~CommunicationManager();
//! Starts fetching meetings. Meetings are returned by the meetingsFetched signal.
/*!
private:
//! Instance of Connection settings of the fetching communication
- ConnectionSettings *iConnectionSettings;
+ //ConnectionSettings *iConnectionSettings;
//! Instance of the fetching communication
Communication* iFetchingCommunication;
//! Instance of the modifying communication
--- /dev/null
+#include <QPainter>
+#include "BorderedBarWidget.h"
+
+BorderedBarWidget::BorderedBarWidget( QWidget *aParent ) :
+ QWidget( aParent ){
+ iCenterLabel = new QLabel(this);
+ iCenterLabel->setAlignment( Qt::AlignCenter );
+ iLeftLabel = new QLabel(this);
+ iLeftLabel->setAlignment( Qt::AlignLeading | Qt::AlignVCenter);
+ iRightLabel = new QLabel(this);
+ iRightLabel->setAlignment( Qt::AlignTrailing | Qt::AlignVCenter);
+}
+
+BorderedBarWidget::~BorderedBarWidget() {
+ delete iCenterLabel;
+ delete iLeftLabel;
+ delete iRightLabel;
+}
+
+QColor BorderedBarWidget::backgroundColor()
+{
+ return iPalette.color( QPalette::Window );;
+}
+
+QColor BorderedBarWidget::faceColor()
+{
+ return iPalette.color( QPalette::WindowText );;
+}
+
+int BorderedBarWidget::borderWidth()
+{
+ return iBorderWidth;
+}
+
+QString BorderedBarWidget::text( TextPosition aPos )
+{
+ if ( aPos == CenterAlign )
+ return iCenterLabel->text();
+ else if ( aPos == LeftAlign )
+ return iLeftLabel->text();
+ else if ( aPos == RightAlign )
+ return iRightLabel->text();
+ return "";
+}
+
+void BorderedBarWidget::setBackgroundColor( QColor aColor )
+{
+ iPalette.setColor( QPalette::Window, aColor );
+ iCenterLabel->setPalette( iPalette );
+ iLeftLabel->setPalette( iPalette );
+ iRightLabel->setPalette( iPalette );
+}
+
+void BorderedBarWidget::setFaceColor( QColor aColor )
+{
+ iPalette.setColor( QPalette::WindowText, aColor );
+ iCenterLabel->setPalette( iPalette );
+ iLeftLabel->setPalette( iPalette );
+ iRightLabel->setPalette( iPalette );
+}
+
+void BorderedBarWidget::setBorderWidth( int aWidth )
+{
+ iBorderWidth = aWidth;
+ iRightLabel->setMargin( 2*iBorderWidth );
+ iLeftLabel->setMargin( 2*iBorderWidth );
+}
+
+void BorderedBarWidget::setText( QString aText, TextPosition aPos )
+{
+ if ( aPos == CenterAlign )
+ iCenterLabel->setText( aText );
+ else if ( aPos == LeftAlign )
+ iLeftLabel->setText( aText );
+ else if ( aPos == RightAlign )
+ iRightLabel->setText( aText );
+}
+
+void BorderedBarWidget::setPixmap( QPixmap aPixmap, TextPosition aPos )
+{
+ if ( aPos == CenterAlign )
+ iCenterLabel->setPixmap( aPixmap );
+ else if ( aPos == LeftAlign )
+ iLeftLabel->setPixmap( aPixmap );
+ else if ( aPos == RightAlign )
+ iRightLabel->setPixmap( aPixmap );
+}
+
+void BorderedBarWidget::paintEvent(QPaintEvent *)
+{
+ drawBorder();
+ iCenterLabel->setGeometry( rect() );
+ iLeftLabel->setGeometry( rect() );
+ iRightLabel->setGeometry( rect() );
+}
+
+void BorderedBarWidget::mousePressEvent( QMouseEvent * )
+{
+ emit ( clicked() );
+}
+
+
+void BorderedBarWidget::drawCorner( QPainter &aPainter, QPoint &aCenter )
+{
+ QRadialGradient radialGrad(QPointF(aCenter), iBorderWidth);
+ radialGrad.setColorAt(0, iPalette.color( QPalette::WindowText));
+ radialGrad.setColorAt(1, iPalette.color( QPalette::Window));
+ aPainter.setBrush(radialGrad);
+ aPainter.drawEllipse(QPoint(aCenter), iBorderWidth, iBorderWidth);
+}
+
+void BorderedBarWidget::drawSide( QPainter &aPainter, QPoint aStartPoint, QPoint aEndPoint )
+{
+ QPoint d = aEndPoint - aStartPoint;
+ QPoint gradEnd = aStartPoint;
+ if ( abs( d.x() ) < abs( d.y() ) )
+ gradEnd.setX( aEndPoint.x()+1 );
+ else
+ gradEnd.setY( aEndPoint.y()+1 );
+
+ QLinearGradient linearGradTop(aStartPoint, gradEnd);
+ linearGradTop.setColorAt(0, iPalette.color( QPalette::Window));
+ linearGradTop.setColorAt(1, iPalette.color( QPalette::WindowText));
+ aPainter.setBrush(linearGradTop);
+ aPainter.drawRect( QRect(aStartPoint,aEndPoint) );
+}
+
+void BorderedBarWidget::drawBorder()
+{
+ QPainter painter(this);
+ painter.setPen(Qt::NoPen);
+ painter.setRenderHint(QPainter::Antialiasing, true);
+
+ /*top left corner*/
+ QPoint center(iBorderWidth,iBorderWidth);
+ drawCorner( painter, center );
+
+ /*top right corner*/
+ center.setX( this->rect().right()-iBorderWidth );
+ center.setY( iBorderWidth );
+ drawCorner( painter, center );
+
+ /*bottom left corner*/
+ center.setX( iBorderWidth );
+ center.setY( this->rect().bottom()-iBorderWidth );
+ drawCorner( painter, center );
+
+ /*bottom right corner*/
+ center.setX( this->rect().right()-iBorderWidth );
+ center.setY( this->rect().bottom()-iBorderWidth );
+ drawCorner( painter, center );
+
+ /*top*/
+ drawSide( painter, QPoint(iBorderWidth,0), QPoint(this->rect().right()-(iBorderWidth+1),(iBorderWidth-1)) );
+
+ /*right*/
+ drawSide( painter, QPoint(this->rect().right(),this->rect().bottom()-iBorderWidth), QPoint(this->rect().right()-(iBorderWidth+1),iBorderWidth-1) );
+
+ /*bottom*/
+ drawSide( painter, QPoint(this->rect().right()-iBorderWidth, this->rect().bottom()), QPoint((iBorderWidth-1),this->rect().bottom()-(iBorderWidth+1)) );
+
+ /*left*/
+ drawSide( painter, QPoint(0,iBorderWidth), QPoint((iBorderWidth-1), this->rect().bottom()-(iBorderWidth+1)) );
+
+ /*inside*/
+ QBrush brush( iPalette.color( QPalette::Window ) );
+ painter.setBrush(brush);
+ QRect inside(iBorderWidth,iBorderWidth,this->rect().right()-2*iBorderWidth,this->rect().bottom()-2*iBorderWidth);
+ painter.drawRoundRect(inside,iBorderWidth,iBorderWidth);
+
+}
--- /dev/null
+#ifndef BORDEREDBARWIDGET_H_
+#define BORDEREDBARWIDGET_H_
+
+#include <QtGui/QWidget>
+#include <QtGui/QLabel>
+
+//! Userinterface class. Displays text or images with a gradient border.
+/*!
+ * Userinterface class. Displays text or images with a gradient border. Inherits QWidget and
+ * diplays content in QLabel.
+ */
+class BorderedBarWidget : public QWidget {
+
+ Q_OBJECT;
+
+public:
+ enum TextPosition
+ {
+ LeftAlign, /*!< Indicates that the item inserted should be aligned to the left. */
+ CenterAlign, /*!< Indicates that the item inserted should be aligned to the center. */
+ RightAlign /*!< Indicates that the item inserted should be aligned to the right. */
+ };
+
+public:
+ //! Constructor.
+ /*!
+ * Constructor to initialize a BorderedBarWidget instance.
+ * \param aParent Parent widget. Optional.
+ */
+ BorderedBarWidget( QWidget *aParent = 0 );
+ //! Destructor.
+ virtual ~BorderedBarWidget();
+
+ //! Returns background color.
+ /*!
+ * \return The background color of the widget.
+ */
+ QColor backgroundColor();
+ //! Returns face color.
+ /*!
+ * \return The text and border color.
+ */
+ QColor faceColor();
+ //! Returns border width.
+ /*!
+ * \return The border width.
+ */
+ int borderWidth();
+ //! Returns text.
+ /*!
+ * \param aPos Text position. Optional.
+ * \return The text at a position.
+ */
+ QString text( TextPosition aPos = CenterAlign );
+
+ //! Sets background color.
+ /*!
+ * Sets the background color of the widget.
+ * \param aColor The new color.
+ */
+ void setBackgroundColor( QColor aColor);
+ //! Sets face color.
+ /*!
+ * Sets the text and border color of the widget.
+ * \param aColor The new color.
+ */
+ void setFaceColor( QColor aColor );
+ //! Sets border width.
+ /*!
+ * Sets the width of the border.
+ * \param aWidth The new width in pixels.
+ */
+ void setBorderWidth( int aWidth );
+ //! Sets text.
+ /*!
+ * Sets text to a certain position in a bar.
+ * \param aText The new text.
+ * \param aPos The position of the text. Optional.
+ */
+ void setText( QString aText, TextPosition aPos = CenterAlign );
+ //! Sets pixmap.
+ /*!
+ * Sets pixmap to a certain position in a bar.
+ * \param aPixmap The new pixmap.
+ * \param aPos The position of the pixmap. Optional.
+ */
+ void setPixmap( QPixmap aPixmap, TextPosition aPos = RightAlign );
+
+signals:
+
+ void clicked();
+
+private:
+ //! Draws the borders.
+ /*!
+ * Handles drawing of the borders.
+ */
+ void drawBorder();
+ //! Draws corner.
+ /*!
+ * Handles drawing of a corner.
+ * \param aPainter Painter used for drawing.
+ * \param aCenter Inner corner of the widget.
+ */
+ void drawCorner( QPainter &aPainter, QPoint &aCenter );
+ //! Draws side.
+ /*!
+ * Handles drawing of a single side.
+ * \param aPainter Painter used for drawing.
+ * \param aStartPoint Start point of drawing area.
+ * \param aEndPoint End point of drawing area.
+ */
+ void drawSide( QPainter &aPainter, QPoint aStartPoint, QPoint aEndPoint );
+
+protected:
+ //! Handles drawing of the widget.
+ /*!
+ * Handles drawing of the widget.
+ */
+ virtual void paintEvent(QPaintEvent *);
+
+ void mousePressEvent( QMouseEvent * );
+
+private:
+ //! Palette for storing colors.
+ QPalette iPalette;
+ //! Border width.
+ int iBorderWidth;
+ //! Label for left aligned content.
+ QLabel *iLeftLabel;
+ //! Label for center aligned content.
+ QLabel *iCenterLabel;
+ //! Label for right aligned content.
+ QLabel *iRightLabel;
+};
+
+#endif /* BORDEREDBARWIDGET_H_ */
qSort( iRooms.begin(), iRooms.end(), Room::caseInsensitiveLessThan );
QFont regularTextFont;
- regularTextFont.setBold( false );
- regularTextFont.setPointSize( 12 );
+ regularTextFont.setStyleHint( QFont::Helvetica );
+ regularTextFont.setBold( true );
+ regularTextFont.setPixelSize( 18 );
iRoomCombo = new QComboBox( this );
for ( int i = 0; i < iRooms.count(); i++ )
iRoomCombo->addItem( iRooms.at( i )->name() );
}
iRoomCombo->setFont( regularTextFont );
+ iRoomCombo->setFixedHeight( 46 );
connect( iRoomCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( setCurrentIndex( int ) ) );
connect( iRoomCombo, SIGNAL( currentIndexChanged( const QString & ) ), this, SLOT( setCurrentRoomBy( const QString & ) ) );
#include <QPainter>
#include "Meeting.h"
-const QColor ScheduleWidget::sFreeBackground = QColor( 192, 238, 189 );
+const QColor ScheduleWidget::sFreeBackground = QColor( Qt::white );
const QColor ScheduleWidget::sBusyBackground = QColor( 238, 147, 17 );
+const QColor ScheduleWidget::sBusyBackgroundStart = QColor( 254, 193, 104 );
+const QColor ScheduleWidget::sCurrentBackgroundStart = QColor( 237, 124, 125 );
+const QColor ScheduleWidget::sCurrentBackground = QColor( 161, 1, 1 );
const QColor ScheduleWidget::sHeaderBackground = QColor( Qt::white );
const QColor ScheduleWidget::sDayHighlightColor = QColor( 255, 235, 160 );
-const QColor ScheduleWidget::sTimeHighlightColor = QColor( Qt::blue );
+const QColor ScheduleWidget::sTimeHighlightColor = QColor( Qt::black );
const QColor ScheduleWidget::sMainGridColor = QColor( 140, 140, 140 );
const QColor ScheduleWidget::sHalfGridColor = QColor( 195, 195, 195 );
const QColor ScheduleWidget::sFrameColor = QColor( Qt::black );
}
// draw meetings
- QBrush brush( ScheduleWidget::sBusyBackground );
- painter.setBrush( brush );
painter.setRenderHint( QPainter::Antialiasing );
painter.setPen( ScheduleWidget::sFrameColor );
populateMeetingList();
{
for ( int i = 0; i < iMeetingsByDay[day].size(); ++i )
{
+ QLinearGradient linearGrad( QPoint(iMeetingsByDay[day][i].rect.x(),iMeetingsByDay[day][i].rect.y()) , QPoint(iMeetingsByDay[day][i].rect.x(),iMeetingsByDay[day][i].rect.bottom()) );
+ // draw meeting with red if it is ongoing
+ if ( iMeetingsByDay[day][i].meeting->startsAt() <= QDateTime::currentDateTime() &&
+ iMeetingsByDay[day][i].meeting->endsAt() >= QDateTime::currentDateTime() )
+ {
+ linearGrad.setColorAt(0, ScheduleWidget::sCurrentBackgroundStart);
+ linearGrad.setColorAt(1, ScheduleWidget::sCurrentBackground);
+ }
+ else
+ {
+ linearGrad.setColorAt(0, ScheduleWidget::sBusyBackgroundStart);
+ linearGrad.setColorAt(1, ScheduleWidget::sBusyBackground);
+ }
+ painter.setBrush(linearGrad);
+
painter.drawRoundRect( iMeetingsByDay[day][i].rect, 20, 20 );
}
}
iScheduleTable->setShowGrid( false );
QFont font;
- font.setPointSize( 10 );
+ font.setStyleHint( QFont::Helvetica );
+ font.setBold( true );
+ font.setPixelSize( 20 );
// add empty item to top-left corner, this will be updated in refresh()
QTableWidgetItem *weekItem = new QTableWidgetItem();
ScheduleWidget::~ScheduleWidget()
{
- delete iScheduleTable;
+ if ( iScheduleTable )
+ {
+ delete iScheduleTable;
+ iScheduleTable = 0;
+ }
}
QDate ScheduleWidget::beginningOfShownWeek()
item->setText( tr( "Wk %1" ).arg( iShownDate.weekNumber() ) );
continue;
}
- item->setText( iShownDate.addDays( i - 1 ).toString( tr( "ddd d MMM" ) ) );
+ item->setText( iShownDate.addDays( i - 1 ).toString( tr( "ddd d/M" ) ) );
if ( iCurrentDateTime.date() == iShownDate.addDays( i - 1 ) )
{
void ScheduleWidget::resizeEvent( QResizeEvent* /* aEvent */ )
{
QRect rect = iScheduleTable->contentsRect();
- int rowHeight = ( int )( rect.height() / ( float )iScheduleTable->rowCount() );
- int headerRowHeight = rowHeight;
- int columnWidth = ( int )( rect.width() / ( iScheduleTable->columnCount() - 0.5f ) );
- int headerColumnWidth = columnWidth / 2;
+ int rowHeight = ( int )( rect.height() / ( float )( iScheduleTable->rowCount() + 1 ) );
+ int headerRowHeight = ( int )rowHeight*2;
+ int headerColumnWidth = rect.width() * 0.15f;
+ int columnWidth = ( rect.width() - headerColumnWidth ) / ( iScheduleTable->columnCount() - 1 );
iScheduleTable->setRowHeight( 0, headerRowHeight );
for ( int i = 1; i < iScheduleTable->rowCount(); ++i )
// resize table so that frame size matches exactly
int leftMargin = 0, topMargin = 0, rightMargin = 0, bottomMargin = 0;
iScheduleTable->getContentsMargins( &leftMargin, &topMargin, &rightMargin, &bottomMargin );
- iScheduleTable->resize( columnWidth * iScheduleTable->columnCount() - headerColumnWidth + leftMargin + rightMargin,
- rowHeight * iScheduleTable->rowCount() + topMargin + bottomMargin );
+ iScheduleTable->resize( columnWidth * ( iScheduleTable->columnCount() - 1 ) +
+ headerColumnWidth + leftMargin + rightMargin,
+ rowHeight * ( iScheduleTable->rowCount() + 1 ) + topMargin + bottomMargin );
}
static const QColor sFreeBackground;
//! Color for a busy cell.
+ static const QColor sBusyBackgroundStart;
+
+ //! Color for a busy cell.
static const QColor sBusyBackground;
+ //! Color for a busy cell.
+ static const QColor sCurrentBackgroundStart;
+
+ //! Color for a busy cell.
+ static const QColor sCurrentBackground;
+
//! Color for headers.
static const QColor sHeaderBackground;
#include "MeetingInfoDialog.h"
+
#include "ToolBox.h"
#include "Meeting.h"
#include "Room.h"
+#include "Configuration.h"
+
#include <QLabel>
#include <QVBoxLayout>
#include <QPushButton>
boldFont.setBold( true );
QLabel *subjectLabel = ToolBox::createLabel( tr( "Subject:" ), boldFont );
- QLabel *subjectContent = ToolBox::createLabel( aMeeting->subject(), normalFont );
+ QLabel *subjectContent = new QLabel();
+ subjectContent->setFont( normalFont );
QLabel *descriptionLabel = ToolBox::createLabel( tr( "Description:" ), boldFont );
QTextEdit *descriptionContent = new QTextEdit( "" );
- descriptionContent->setHtml( aMeeting->description() );
+
+ if( Configuration::instance()->showConfidentialMeetingDetails() )
+ {
+ subjectContent->setText( aMeeting->subject() );
+ descriptionContent->setHtml( aMeeting->description() );
+ }
+
+ if( subjectContent->text().isEmpty() )
+ {
+ subjectContent->setText( tr( "Room reserved", "Meeting Info Subject" ) ); // default subject text
+ }
+
+ qDebug() << "############ Desc: " << descriptionContent->toPlainText().trimmed();
+
+ if( descriptionContent->toPlainText().trimmed().isEmpty() )
+ {
+ descriptionContent->setPlainText( tr( "Room reserved", "Meeting Info Description" ) ); // default description text
+ }
+
descriptionContent->setReadOnly( true );
descriptionContent->setFont( normalFont );
#include <QLabel>
#include <QFont>
#include <QVBoxLayout>
-#include "DigitalTimeDisplayWidget.h"
+#include "BorderedBarWidget.h"
+
#include "ToolBox.h"
#include <QEvent>
RoomStatusIndicatorWidget::RoomStatusIndicatorWidget(Room *aDefaultRoom, Room::Status aStatus, QTime aUntil, QString aTimeFormat, QWidget *aParent) :
ViewBase(ViewBase::ObservedView, aParent), iTimeFormat(aTimeFormat)
{
- QFont importantTextFont;
- //importantTextFont.setBold( true );
- importantTextFont.setPointSize( 20);
+ QFont clockFont;
+ clockFont.setStyleHint( QFont::Helvetica );
+ clockFont.setBold( true );
+ clockFont.setPixelSize( 36 );
+
+ QFont textFont;
+ textFont.setStyleHint( QFont::Helvetica );
+ textFont.setBold( true );
+ textFont.setPixelSize( 48 );
- QFont regularTextFont;
- //regularTextFont.setBold( true );
- regularTextFont.setPointSize( 12);
+ QFont statusBarFont;
+ statusBarFont.setStyleHint( QFont::Helvetica );
+ statusBarFont.setPixelSize( 18 );
// display for current time
// Note: the time display receives current time info from Engine::clock()
- iTimeDisplay = new DigitalTimeDisplayWidget( QTime::currentTime(), iTimeFormat, this );
- iTimeDisplay->setFrameVisible( false);
- iTimeDisplay->setSize( 250, 120);
+ iTimeDisplay = new BorderedBarWidget( this );
+ iTimeDisplay->setFaceColor( Qt::darkGray );
+ iTimeDisplay->setBackgroundColor( Qt::white );
+ iTimeDisplay->setBorderWidth( 6 );
+ iTimeDisplay->setFixedWidth( 170 );
+ iTimeDisplay->setFixedHeight( 50 );
+ iTimeDisplay->setFont( clockFont );
+
+ iStatusBar = new BorderedBarWidget( this );
+ iStatusBar->setFaceColor( Qt::darkGray );
+ iStatusBar->setBackgroundColor( Qt::white );
+ iStatusBar->setBorderWidth( 4 );
+ iStatusBar->setFont(statusBarFont);
+ iStatusBar->setFixedHeight( 36 );
+ iStatusBar->setText( tr("Disconnected"), BorderedBarWidget::LeftAlign );
// Pegasus
iDefaultRoomLabel
- = ToolBox::createLabel(aDefaultRoom->name(), importantTextFont);
- iDefaultRoomLabel->setAlignment(Qt::AlignHCenter);
- iDefaultRoomLabel->setHidden( true);
+ = ToolBox::createLabel(aDefaultRoom->name(), textFont);
+ iDefaultRoomLabel->setAlignment( Qt::AlignHCenter );
+ iDefaultRoomLabel->setHidden( true );
// is busy
- iStatusLabel = ToolBox::createLabel(tr( "is %1" ).arg(statusToText(aStatus) ), importantTextFont);
- iStatusLabel->setAlignment(Qt::AlignHCenter);
- iStatusLabel->setStyleSheet("background-color: transparent");
- iStatusLabel->setHidden( true);
+ iStatusLabel = ToolBox::createLabel(tr( "is %1" ).arg(statusToText(aStatus) ), textFont);
+ iStatusLabel->setAlignment( Qt::AlignHCenter );
+ iStatusLabel->setHidden( true );
// until 13:22
iUntilTextLabel
- = ToolBox::createLabel(tr( "until %1" ).arg(aUntil.toString(iTimeFormat) ), importantTextFont);
- iUntilTextLabel->setAlignment(Qt::AlignHCenter);
- iUntilTextLabel->setStyleSheet("background-color: transparent");
- iUntilTextLabel->setHidden( true);
-
- // No connection to server note
- qDebug()
- << "RoomStatusIndicatorWidget::RoomStatusIndicatorWidget() creating connection label";
- QFrame* connectionLabelFrame = new QFrame( this );
- iConnectionLabel = new QLabel( tr( "No connection to server" ), connectionLabelFrame );
- iConnectionLabel->setFont(importantTextFont);
- iConnectionLabel->setAlignment(Qt::AlignHCenter);
- iConnectionLabel->setWordWrap( true);
- iConnectionLabel->setStyleSheet("background-color: transparent; color: red; text-decoration:blink; max-width: 250px");
- connectionLabelFrame->setFixedSize(iConnectionLabel->sizeHint() );
- if (connectedOnce && !connectionError)
- iConnectionLabel->setHidden( true);
-
- QVBoxLayout *topLayout = new QVBoxLayout;
- topLayout->addStretch();
+ = ToolBox::createLabel(tr( "until %1" ).arg(aUntil.toString(iTimeFormat) ), textFont);
+ iUntilTextLabel->setAlignment( Qt::AlignHCenter );
+ iUntilTextLabel->setHidden( true );
+
+ QHBoxLayout *topLayout = new QHBoxLayout;
topLayout->addWidget(iTimeDisplay);
- topLayout->addSpacing( 28);
- topLayout->addWidget(iDefaultRoomLabel);
- topLayout->addWidget(iStatusLabel);
- topLayout->addWidget(iUntilTextLabel);
- topLayout->addSpacing( 28);
- topLayout->addWidget(connectionLabelFrame);
- topLayout->addStretch();
-
- QHBoxLayout *mainLayout = new QHBoxLayout;
- mainLayout->addLayout(topLayout);
- mainLayout->addStretch();
- //mainLayout->setMargin( 65 );
- mainLayout->setContentsMargins( 65, 65, 65, 0);
+
+ QVBoxLayout *textLayout = new QVBoxLayout;
+ textLayout->addWidget(iDefaultRoomLabel);
+ textLayout->addWidget(iStatusLabel);
+ textLayout->addWidget(iUntilTextLabel);
+ textLayout->addSpacing( 250 );
+
+ QHBoxLayout *centerLayout = new QHBoxLayout;
+ centerLayout->addLayout( textLayout );
+ centerLayout->addSpacing( 250 );
+
+ QHBoxLayout *bottomLayout = new QHBoxLayout;
+ bottomLayout->addSpacing( 56 );
+ bottomLayout->addWidget( iStatusBar );
+ bottomLayout->addSpacing( 56 );
+
+ QVBoxLayout *mainLayout = new QVBoxLayout;
+ mainLayout->addLayout( topLayout );
+ mainLayout->addSpacing( 50 );
+ mainLayout->addLayout( centerLayout );
+ mainLayout->addLayout( bottomLayout );
setLayout(mainLayout);
statusChanged(aStatus, aUntil);
{
delete iTimeDisplay;
iTimeDisplay = 0;
+
+ delete iStatusBar;
+ iStatusBar = 0;
}
QString RoomStatusIndicatorWidget::statusToText(const Room::Status aStatus)
int cropheight(pixmap.height() - yoffset);
QBrush brush;
- if (windowState() == Qt::WindowFullScreen)
+ if ( (pixmap.width() == rect().width()) && (pixmap.height() == rect().height()) )
{
// Use the full image in full screen mode
brush.setTexture(pixmap);
QPalette palette;
palette.setColor( QPalette::Window, Qt::white );
- palette.setColor( QPalette::WindowText, Qt::darkGray );
+ palette.setColor( QPalette::WindowText, Qt::black );
palette.setBrush( QPalette::Window, brush );
return palette;
}
-void RoomStatusIndicatorWidget::setCurrentTime(QTime aCurrentTime)
+void RoomStatusIndicatorWidget::setConnectionStatus( QDateTime aCurrentTime, bool aConnected,
+ QTime aLastUpdated, QString aError )
{
- iTimeDisplay->setTime(aCurrentTime);
+ iTimeDisplay->setText( aCurrentTime.toString( iTimeFormat ) );
+ if ( aLastUpdated.isNull() )
+ iStatusBar->setText( tr("Disconnected") , BorderedBarWidget::LeftAlign );
+ else
+ {
+ iDefaultRoomLabel->setHidden( false );
+ iUntilTextLabel->setHidden( false );
+ iStatusLabel->setHidden( false );
+
+ if (!aConnected)
+ {
+ iStatusBar->setText( tr("Disconnected"), BorderedBarWidget::LeftAlign );
+ }
+ else
+ {
+ iStatusBar->setText( tr("Connected - Last update %1").arg(aLastUpdated.toString(iTimeFormat)) ,
+ BorderedBarWidget::LeftAlign );
+ }
+ }
+ showError( aError );
}
+void RoomStatusIndicatorWidget::showError( QString aError )
+{
+ iStatusBar->setText( aError );
+}
+
+
void RoomStatusIndicatorWidget::statusChanged(const Room::Status aStatus, const QTime aUntil)
{
iStatusLabel->setText(tr( "is %1" ).arg(statusToText(aStatus) ) );
switch (event->type())
{
case QEvent::Paint:
- qDebug() << "[RoomStatusIndicatorWidget::event] <Paint event>";
+ //qDebug() << "[RoomStatusIndicatorWidget::event] <Paint event>";
break;
case QEvent::PaletteChange:
- qDebug()
- << "[RoomStatusIndicatorWidget::event] <Palette change event>";
+ //qDebug()
+ // << "[RoomStatusIndicatorWidget::event] <Palette change event>";
break;
default:
break;
void RoomStatusIndicatorWidget::connectionEstablished()
{
- if ( !connectedOnce)
- {
- // Just got the required meetings for the first time
- qDebug() << "RoomStatusIndicatorWidget::connectionEstablished() first call";
- iDefaultRoomLabel->setHidden( false);
- iUntilTextLabel->setHidden( false);
- iStatusLabel->setHidden( false);
- }
- else
- {
- qDebug() << "RoomStatusIndicatorWidget::connectionEstablished()";
- }
ViewBase::connectionEstablished();
- iConnectionLabel->setHidden( true);
}
void RoomStatusIndicatorWidget::connectionLost()
{
ViewBase::connectionLost();
- iConnectionLabel->setHidden( false);
}
\r
class QLabel;\r
class QVBoxLayout;\r
-class TimeDisplayWidget;\r
+class BorderedBarWidget;\r
\r
class QEvent;\r
\r
bool event(QEvent *event);\r
\r
public slots:\r
- //! Slot. Sets current time.\r
+ //! Slot. Sets the connection status\r
/*!\r
- * Slots. Sets current time on the widget. It is used to provide up-to-date time for the widget's\r
- * TimeDisplayWidget.\r
- * \param aCurrentTime The current time.\r
+ * Sets the current time, and connection status\r
+ * \param aCurrentTime Time to be displayed.\r
+ * \param aConnected connection status to be displayed.\r
+ * \param aLastUpdated Time of last successful connection to be displayed.\r
*/\r
- void setCurrentTime( QTime aCurrentTime );\r
+ void setConnectionStatus( QDateTime aCurrentTime, bool aConnected, QTime aLastUpdated = QTime(), QString aError = "");\r
//! Slot. Used to indicate changes in the status of the default room.\r
/*!\r
* Slot. Used to indicate changes in the status of the default room. If the specified until time equals\r
*/\r
void statusChanged( const Room::Status aStatus, const QTime aUntil );\r
\r
+ void showError( QString aError );\r
+\r
void currentRoomChanged( Room *aRoom );\r
\r
- void viewResized(const QSize &newSize, const QSize &oldSize) { }\r
+ void viewResized(const QSize &/*newSize*/, const QSize &/*oldSize*/) { }\r
\r
void connectionEstablished();\r
\r
QLabel *iDefaultRoomLabel;\r
QLabel *iStatusLabel;\r
QLabel *iUntilTextLabel;\r
- QLabel *iConnectionLabel;\r
- TimeDisplayWidget *iTimeDisplay;\r
+ BorderedBarWidget *iTimeDisplay;\r
+ BorderedBarWidget *iStatusBar;\r
+\r
QString iTimeFormat;\r
\r
static QTime endOfTheDay;\r
#include "DisplaySettings.h"
#include "ConnectionSettings.h"
#include "StartupSettings.h"
+#include <QScrollArea>
#include <QtDebug>
+#define QT_DELETE(X) \
+ if ( X != 0 ) \
+ { \
+ qDebug() << "delete " << X; \
+ delete X; \
+ X = 0; \
+ }
+
SettingsView::SettingsView( QWidget *aParent ) :
ViewBase( ViewBase::NormalView, aParent )
{
SettingsView::~SettingsView()
{
- if ( iTabWidget != 0 )
- {
- delete iTabWidget;
- iTabWidget = 0;
- }
- if ( iOkButton != 0 )
- {
- delete iOkButton;
- iOkButton = 0;
- }
- if ( iCancelButton != 0 )
- {
- delete iCancelButton;
- iCancelButton = 0;
- }
- if ( iSettingsTab != 0 )
- {
- delete iSettingsTab;
- iSettingsTab = 0;
- }
- if ( iWeekViewTab != 0 )
- {
- delete iWeekViewTab;
- iWeekViewTab = 0;
- }
- if ( iResourcesTab != 0 )
- {
- delete iResourcesTab;
- iResourcesTab = 0;
- }
- if ( iKioskModeTab != 0 )
- {
- delete iKioskModeTab;
- iKioskModeTab = 0;
- }
- if ( iUserName != 0 )
- {
- delete iUserName;
- iUserName = 0;
- }
- if ( iPassword != 0 )
- {
- delete iPassword;
- iPassword = 0;
- }
- if ( iServerAddress != 0 )
- {
- delete iServerAddress;
- iServerAddress = 0;
- }
- if ( iDayStartTime != 0 )
- {
- delete iDayStartTime;
- iDayStartTime = 0;
- }
- if ( iDayEndTime != 0 )
- {
- delete iDayEndTime;
- iDayEndTime = 0;
- }
- if ( iFiveDays != 0 )
- {
- delete iFiveDays;
- iFiveDays = 0;
- }
- if ( iSevenDays != 0 )
- {
- delete iSevenDays;
- iSevenDays = 0;
- }
- if ( iRefreshInterval != 0 )
- {
- delete iRefreshInterval;
- iRefreshInterval = 0;
- }
- if ( iPowerSaveEnabled != 0 )
- {
- delete iPowerSaveEnabled;
- iPowerSaveEnabled = 0;
- }
- if ( iPowerSaveStartTime != 0 )
- {
- delete iPowerSaveStartTime;
- iPowerSaveStartTime = 0;
- }
- if ( iPowerSaveEndTime != 0 )
- {
- delete iPowerSaveEndTime;
- iPowerSaveEndTime = 0;
- }
+ qDebug() << "[SettingsView::~SettingsView]";
+ /*QT_DELETE(iOkButton);
+ QT_DELETE(iCancelButton);
+ QT_DELETE(iUserName);
+ QT_DELETE(iPassword);
+ QT_DELETE(iServerAddress);
+ QT_DELETE(iDayStartTime);
+ QT_DELETE(iDayEndTime);
+ QT_DELETE(iFiveDays);
+ QT_DELETE(iSevenDays);
+ QT_DELETE(iRefreshInterval);
+ QT_DELETE(iPowerSaveEnabled);
+ QT_DELETE(iPowerSaveStartTime);
+ QT_DELETE(iPowerSaveEndTime);
+ QT_DELETE(iShowConfidentialMeetingDetails);
+ QT_DELETE(iSettingsTab);
+ QT_DELETE(iWeekViewTab);
+ QT_DELETE(iResourcesTab);
+ QT_DELETE(iKioskModeTab);
+ QT_DELETE(iTabWidget);*/
}
QWidget *SettingsView::initSettingsTab()
// Create the group boxes
QGroupBox *userInformationGroup = new QGroupBox( tr( "User Information" ) );
QGroupBox *serverInformationGroup = new QGroupBox( tr( "Server Information" ) );
+ QGroupBox *privacySettingsGroup = new QGroupBox( tr( "Privacy Settings" ) );
// Prepare the user infromation group box
QGridLayout *ugl = new QGridLayout;
serverInformationGroup->setLayout( sgl );
+ // Prepare meeting info setting box
+ QGridLayout *pgl = new QGridLayout;
+ iShowConfidentialMeetingDetails = new QCheckBox( tr( "Show confidential meeting details" ) );
+
+ pgl->addWidget( iShowConfidentialMeetingDetails, 0, 0 );
+
+ privacySettingsGroup->setLayout( pgl );
+
// Prepare and set the main layout
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget( userInformationGroup );
mainLayout->addWidget( serverInformationGroup );
+ mainLayout->addWidget( privacySettingsGroup );
widget->setLayout( mainLayout );
- return widget;
+ QScrollArea *scroll = new QScrollArea;
+ scroll->setWidget(widget);
+ return scroll;
}
QWidget *SettingsView::initWeekViewTab()
widget->setLayout( mainLayout );
- return widget;
+ QScrollArea *scroll = new QScrollArea;
+ scroll->setWidget(widget);
+ return scroll;
}
QWidget *SettingsView::initResourcesTab()
widget->setLayout( mainLayout );
- return widget;
+ QScrollArea *scroll = new QScrollArea;
+ scroll->setWidget(widget);
+ return scroll;
}
QWidget *SettingsView::initKioskModeTab()
}
iPowerSaveStartTime->setTime( Configuration::instance()->startupSettings()->turnOnAt() );
iPowerSaveEndTime->setTime( Configuration::instance()->startupSettings()->turnOffAt() );
-
+
// Prepare the admin password box
QGroupBox *adminPasswordGroup = new QGroupBox( tr( "Admin Password" ) );
QLabel *oldPwdLabel = new QLabel( tr( "Old password:" ) );
widget->setLayout( mainLayout );
- return widget;
+ QScrollArea *scroll = new QScrollArea;
+ scroll->setWidget(widget);
+ return scroll;
}
void SettingsView::handleOkClicked()
bool sevenDays = iSevenDays->isChecked();
bool powerSaveEnabled = iPowerSaveEnabled->isChecked();
+ bool showConfidentialMeetingDetails = iShowConfidentialMeetingDetails->isChecked();
+
// set values to Configuration
// set user information
- Configuration::instance()->connectionSettings()->setUsername( userName );
- Configuration::instance()->connectionSettings()->setPassword( password );
+ Configuration::instance()->setUsername(userName);//connectionSettings()->setUsername( userName );
+ Configuration::instance()->setPassword(password);//connectionSettings()->setPassword( password );
// set server information
- Configuration::instance()->connectionSettings()->setServerUrl( serverAddress );
+ Configuration::instance()->setServerUrl(serverAddress);//connectionSettings()->setServerUrl( serverAddress );
if ( ok )
{
- Configuration::instance()->connectionSettings()->setRefreshInterval( refreshInterval );
+ Configuration::instance()->setRefreshinterval(refreshInterval);//connectionSettings()->setRefreshInterval( refreshInterval );
}
// set weekly view settings
Configuration::instance()->startupSettings()->setTurnOnAt( powerSaveStart );
Configuration::instance()->startupSettings()->setTurnOffAt( powerSaveEnd );
+ // set privacy settings
+ Configuration::instance()->setShowConfidentialMeetingDetails( showConfidentialMeetingDetails );
+
+ qDebug() << "[SettingsView::okClicked] save()";
+
// save configuration
Configuration::instance()->save();
+
+ qDebug() << "[SettingsView::okClicked] setValues()";
// Emit the signal to notify that ok is pressed and data is saved.
setValues();
void SettingsView::setValues()
{
// set user information
- iUserName->setText( Configuration::instance()->connectionSettings()->username() );
- iPassword->setText( Configuration::instance()->connectionSettings()->password() );
+ iUserName->setText( Configuration::instance()->getUsername() );
+ iPassword->setText( Configuration::instance()->getPassword());//connectionSettings()->password() );
// set server information
- iServerAddress->setText( Configuration::instance()->connectionSettings()->serverUrl().toString() );
+ iServerAddress->setText( Configuration::instance()->getServerUrl().toString());//connectionSettings()->serverUrl().toString() );
QString refreshIntervalStr;
- refreshIntervalStr.setNum( Configuration::instance()->connectionSettings()->refreshInterval() );
+ refreshIntervalStr.setNum( Configuration::instance()->getRefreshinterval());//connectionSettings()->refreshInterval() );
iRefreshInterval->setText( refreshIntervalStr );
// set weekly view display settings
if ( Configuration::instance()->displaySettings()->daysInSchedule() == DisplaySettings::WeekdaysInSchedule )
}
iPowerSaveStartTime->setTime( Configuration::instance()->startupSettings()->turnOnAt() );
iPowerSaveEndTime->setTime( Configuration::instance()->startupSettings()->turnOffAt() );
+
+ // set privacy settings
+ iShowConfidentialMeetingDetails->setChecked( Configuration::instance()->showConfidentialMeetingDetails() );
}
QTimeEdit *iPowerSaveStartTime;
//! End time for deactivating power save.
QTimeEdit *iPowerSaveEndTime;
+
+ //! Show confidential meeting details.
+ QCheckBox *iShowConfidentialMeetingDetails;
};
#endif /*SETTINGSVIEW_H_*/
#include "ScheduleWidget.h"\r
#include "ToolBox.h"\r
#include "MeetingInfoDialog.h"\r
+#include "BorderedBarWidget.h"\r
\r
#include <QtDebug>\r
\r
regularTextFont.setBold( true );\r
regularTextFont.setPointSize( 12 );\r
\r
+ QFont clockFont;\r
+ clockFont.setStyleHint( QFont::Helvetica );\r
+ clockFont.setBold( true );\r
+ clockFont.setPixelSize( 36 );\r
+\r
+ QFont statusBarFont;\r
+ statusBarFont.setStyleHint( QFont::Helvetica );\r
+ statusBarFont.setPixelSize( 18 );\r
+\r
+ QFont buttonFont;\r
+ buttonFont.setStyleHint( QFont::Helvetica );\r
+ buttonFont.setBold( true );\r
+ buttonFont.setPixelSize( 18 );\r
+\r
iSettingsButton = new QPushButton;\r
iSettingsButton->setIcon( QPixmap( ":button_settings" ) );\r
iSettingsButton->setFixedWidth( 36 );\r
iCurrentDayLabel = ToolBox::createLabel( aCurrentDateTime.toString( iConfiguration->displaySettings()->dateFormat() ), regularTextFont );\r
iCurrentWeekLabel = ToolBox::createLabel( tr( "Wk %1" ).arg( aCurrentDateTime.date().weekNumber() ), regularTextFont );\r
\r
+ iTimeDisplay = new BorderedBarWidget( this );\r
+ iTimeDisplay->setFaceColor( Qt::darkGray );\r
+ iTimeDisplay->setBackgroundColor( Qt::white);\r
+ iTimeDisplay->setBorderWidth( 6 );\r
+ iTimeDisplay->setFixedWidth( 170 );\r
+ iTimeDisplay->setFixedHeight( 50 );\r
+ iTimeDisplay->setFont( clockFont );\r
+\r
iRoomsCombo = new MeetingRoomCombo( iConfiguration->rooms(), this );\r
iRoomsCombo->setCurrentRoom( iConfiguration->defaultRoom() );\r
connect( iRoomsCombo, SIGNAL( currentRoomChanged( Room * ) ), this, SIGNAL( currentRoomChanged( Room * ) ) );\r
\r
- iTimeDisplay = new DigitalTimeDisplayWidget( aCurrentDateTime.time(), iConfiguration->displaySettings()->timeFormat(), this );\r
- iTimeDisplay->setFrameVisible( false );\r
- iTimeDisplay->setFont( regularTextFont );\r
+ iStatusBar = new BorderedBarWidget( this );\r
+ iStatusBar->setFaceColor( Qt::darkGray );\r
+ iStatusBar->setBackgroundColor( Qt::white );\r
+ iStatusBar->setBorderWidth( 4 );\r
+ iStatusBar->setFont(statusBarFont);\r
+ iStatusBar->setFixedHeight( 36 );\r
+ iStatusBar->setText( tr("Disconnected"), BorderedBarWidget::LeftAlign );\r
+\r
+ connect( iStatusBar, SIGNAL( clicked() ), this, SIGNAL( refreshButtonClicked() ) );\r
\r
iSchedule = new ScheduleWidget( aCurrentDateTime, iConfiguration->displaySettings(), this );\r
connect( iSchedule, SIGNAL( shownWeekChanged( QDate ) ), this, SIGNAL( shownWeekChanged( QDate ) ) );\r
connect( iSchedule, SIGNAL( meetingActivated( Meeting* ) ), this, SIGNAL( meetingActivated( Meeting* ) ) );\r
\r
iPreviousWeekButton = new QPushButton( this );\r
- iPreviousWeekButton->setText( tr( "<<" ) );\r
- iPreviousWeekButton->setFixedWidth( 60 );\r
+ iPreviousWeekButton->setText( tr( "<" ) );\r
+ iPreviousWeekButton->setFixedWidth( 50 );\r
+ iPreviousWeekButton->setFixedHeight( 100 );\r
+ iPreviousWeekButton->setFont( buttonFont );\r
connect( iPreviousWeekButton, SIGNAL( clicked() ), iSchedule, SLOT( showPreviousWeek() ) );\r
\r
iCurrentWeekButton = new QPushButton( this );\r
iCurrentWeekButton->setFixedWidth( 100 );\r
- iCurrentWeekButton->setText( tr( "Current" ) );\r
+ iCurrentWeekButton->setFixedHeight( 46 );\r
+ iCurrentWeekButton->setText( tr( "Today" ) );\r
+ iCurrentWeekButton->setFont( buttonFont );\r
+\r
connect( iCurrentWeekButton, SIGNAL( clicked() ), iSchedule, SLOT( showCurrentWeek() ) );\r
\r
iNextWeekButton = new QPushButton( this );\r
- iNextWeekButton->setFixedWidth( 60 );\r
- iNextWeekButton->setText( tr( ">>" ) );\r
+ iNextWeekButton->setFixedWidth( 50 );\r
+ iNextWeekButton->setFixedHeight( 100 );\r
+ iNextWeekButton->setText( tr( ">" ) );\r
+ iNextWeekButton->setFont( buttonFont );\r
connect( iNextWeekButton, SIGNAL( clicked() ), iSchedule, SLOT( showNextWeek() ) );\r
\r
// **********************************\r
// Create the view's layout\r
+ QVBoxLayout *leftLayout = new QVBoxLayout;\r
+ QVBoxLayout *centerLayout = new QVBoxLayout;\r
+ QVBoxLayout *rightLayout = new QVBoxLayout;\r
+\r
+ leftLayout->addWidget( iPreviousWeekButton );\r
+ rightLayout->addWidget( iNextWeekButton );\r
+\r
QHBoxLayout *tableLayout = new QHBoxLayout;\r
tableLayout->addWidget( iSchedule );\r
\r
- QHBoxLayout *bottomLayout = new QHBoxLayout;\r
- bottomLayout->addWidget( iRoomsCombo );\r
- bottomLayout->addWidget( iTimeDisplay );\r
- QVBoxLayout *dateLayout = new QVBoxLayout;\r
- dateLayout->addWidget( iCurrentDayLabel );\r
- dateLayout->addWidget( iCurrentWeekLabel );\r
- bottomLayout->addLayout( dateLayout );\r
- bottomLayout->addWidget( iPreviousWeekButton );\r
- bottomLayout->addWidget( iCurrentWeekButton );\r
- bottomLayout->addWidget( iNextWeekButton );\r
- bottomLayout->addWidget( iSettingsButton );\r
-\r
- QVBoxLayout *mainLayout = new QVBoxLayout;\r
- mainLayout->addLayout( tableLayout );\r
- mainLayout->addLayout( bottomLayout );\r
+ QGridLayout *naviLayout = new QGridLayout;\r
+ naviLayout->addWidget( iCurrentWeekButton, 0, 0, Qt::AlignLeft );\r
+ naviLayout->addWidget( iTimeDisplay, 0, 1, Qt::AlignCenter );\r
+ naviLayout->addWidget( iRoomsCombo, 0, 2, Qt::AlignRight );\r
+\r
+// QVBoxLayout *dateLayout = new QVBoxLayout;\r
+// dateLayout->addWidget( iCurrentDayLabel );\r
+// dateLayout->addWidget( iCurrentWeekLabel );\r
+// bottomLayout->addLayout( dateLayout );\r
+// bottomLayout->addWidget( iSettingsButton );\r
+\r
+ centerLayout->addLayout( naviLayout );\r
+ centerLayout->addLayout( tableLayout );\r
+ centerLayout->addWidget( iStatusBar );\r
+\r
+ QHBoxLayout *mainLayout = new QHBoxLayout;\r
+ mainLayout->addLayout( leftLayout );\r
+ mainLayout->addLayout( centerLayout );\r
+ mainLayout->addLayout( rightLayout );\r
setLayout( mainLayout );\r
\r
// Set child observing\r
observeChild( iRoomsCombo );\r
+ observeChild( iStatusBar );\r
observeChild( iTimeDisplay );\r
observeChild( iCurrentDayLabel );\r
observeChild( iCurrentWeekLabel );\r
\r
QPalette palette;\r
palette.setColor( QPalette::Window, Qt::white );\r
- palette.setColor( QPalette::WindowText, Qt::darkGray );\r
+ palette.setColor( QPalette::Foreground, Qt::darkGray );\r
setPalette( palette );\r
\r
setAutoFillBackground( true );\r
delete iTimeDisplay;\r
iTimeDisplay = 0;\r
}\r
+ if ( iStatusBar )\r
+ {\r
+ delete iStatusBar;\r
+ iStatusBar = 0;\r
+ }\r
+\r
if ( iSchedule )\r
{\r
delete iSchedule;\r
return iRoomsCombo->currentRoom();\r
}\r
\r
-void WeeklyViewWidget::setCurrentDateTime( QDateTime aCurrentDateTime )\r
+void WeeklyViewWidget::setConnectionStatus( QDateTime aCurrentTime, bool aConnected,\r
+ QTime aLastUpdated, QString aError )\r
{\r
- iCurrentDayLabel->setText( aCurrentDateTime.date().toString( iConfiguration->displaySettings()->dateFormat() ) );\r
+ iCurrentDayLabel->setText( aCurrentTime.date().toString( iConfiguration->displaySettings()->dateFormat() ) );\r
+ iCurrentWeekLabel->setText( tr( "Wk %1" ).arg( aCurrentTime.date().weekNumber() ) );\r
+ iSchedule->setCurrentDateTime( aCurrentTime );\r
\r
- iCurrentWeekLabel->setText( tr( "Wk %1" ).arg( aCurrentDateTime.date().weekNumber() ) );\r
-\r
- iTimeDisplay->setTime( aCurrentDateTime.time() );\r
+ iTimeDisplay->setText( aCurrentTime.toString( iConfiguration->displaySettings()->timeFormat() ) );\r
+ if ( aLastUpdated.isNull() )\r
+ iStatusBar->setText( tr("Disconnected") , BorderedBarWidget::LeftAlign );\r
+ else if ( !aConnected )\r
+ {\r
+ iStatusBar->setText( tr("Disconnected"), BorderedBarWidget::LeftAlign );\r
+ }\r
+ else\r
+ {\r
+ iStatusBar->setText( tr("Connected - Last update %1")\r
+ .arg(aLastUpdated.toString(iConfiguration->displaySettings()->timeFormat())) ,\r
+ BorderedBarWidget::LeftAlign );\r
+ }\r
+ showError( aError );\r
+ }\r
\r
- iSchedule->setCurrentDateTime( aCurrentDateTime );\r
+void WeeklyViewWidget::showError( QString aError )\r
+{\r
+ iStatusBar->setText( aError );\r
}\r
\r
QDate WeeklyViewWidget::beginnigOfShownWeek()\r
{\r
iRoomsCombo->setCurrentRoom( iConfiguration->defaultRoom() );\r
}\r
+\r
+void WeeklyViewWidget::connectionEstablished()\r
+{\r
+ ViewBase::connectionEstablished();\r
+}\r
+\r
+void WeeklyViewWidget::connectionLost()\r
+{\r
+ ViewBase::connectionLost();\r
+}\r
-#ifndef WEEKLYVIEWWIDGET_H_\r
-#define WEEKLYVIEWWIDGET_H_\r
-\r
-#include "ViewBase.h"\r
-#include <QDateTime>\r
-\r
-class QLabel;\r
-class QPushButton;\r
-class MeetingRoomCombo;\r
-class TimeDisplayWidget;\r
-class ScheduleWidget;\r
-class Configuration;\r
-class Meeting;\r
-class Room;\r
-\r
-//! Userinterface class. Shows a weekly calendar for the selected room, provides date and time information.\r
-/*!\r
- * UserInterface class. Shows the current date and time and selected week's calendar for\r
- * selected meeting room. User can select meeting room, browse weeks back and forth, and can navigate\r
- * back to the current week.\r
- */\r
-class WeeklyViewWidget : public ViewBase\r
-{\r
- Q_OBJECT\r
-\r
-public:\r
- //! Constructor.\r
- /*!\r
- * Constructor to initialize an WeeklyViewWidget instance.\r
- * \param aCurrentDateTime\r
- * \param aConfiguration Pointer to the configuration object. Not owned.\r
- * \param aParent Pointer to the parent widget.\r
- */\r
- WeeklyViewWidget( QDateTime aCurrentDateTime, Configuration *aConfiguration, QWidget *aParent = 0 );\r
- //! Destructor.\r
- virtual ~WeeklyViewWidget();\r
-\r
- //! Current room\r
- /*!\r
- * Returns the currently selected meeting room.\r
- * \return Selected meeting room.\r
- */\r
- Room* currentRoom();\r
-\r
- //! First day of week currently displayd\r
- /*!\r
- * Returns the first day of week currently displayd.\r
- * \return First day of week.\r
- */\r
- QDate beginnigOfShownWeek();\r
- //! Sends the refresh command to schedule widget.\r
- /*!\r
- * Sends the refresh command to schedule widget.\r
- * \param aMeetings The list of meetings.\r
- */\r
- void refreshMeetings( const QList<Meeting*> &aMeetings );\r
- \r
- void showCurrentWeek();\r
- \r
- void setDefaultRoom();\r
- \r
-signals:\r
- //! Signals change of the meeting room.\r
- /*!\r
- * Signal is emited when meeting room is changed.\r
- * \param aNewRoom Selected meeting room.\r
- */\r
- void currentRoomChanged( Room *aNewRoom );\r
- //! Meeting activated.\r
- /*!\r
- * Signal is emitted when a meeting is clicked by the user.\r
- * \param aMeeting actived meeting.\r
- */\r
- void meetingActivated( Meeting *aMeeting );\r
- //! Signals creation of new meeting.\r
- /*!\r
- * Signal is emited when new meeting is created.\r
- * \param aMeeting Meeting that has been created.\r
- * \param aUsername User who created the meeting.\r
- * \param aPassword Password of the "aUsername"\r
- */\r
- void meetingToCreate( Meeting *aMeeting, const QString &aUsername, const QString &aPassword );\r
- //! Signals deletion of a meeting.\r
- /*!\r
- * Signal is emited when meeting is deleted.\r
- * \param aMeeting Deleted meeting.\r
- * \param aUsername User who deleted the meeting.\r
- * \param aPassword Password of the "aUsername"\r
- */\r
- void meetingToDelete( Meeting *aMeeting, const QString &aUsername, const QString &aPassword );\r
- //! Signals modifications of a meeting.\r
- /*!\r
- * Signal is emited when meeting is modified.\r
- * \param aMeeting Modified meeting.\r
- * \param aUsername User who modified the meeting.\r
- * \param aPassword Password of the "aUsername"\r
- */\r
- void meetingToUpdate( Meeting *aMeeting, const QString &aUsername, const QString &aPassword );\r
-\r
- //! Signals\r
- /*!\r
- * Signal is emited when settings button is clicked.\r
- */\r
- void settingsButtonClicked();\r
- \r
- //! Signal. Emitted if the shown week has been changed.\r
- /*!\r
+#ifndef WEEKLYVIEWWIDGET_H_
+#define WEEKLYVIEWWIDGET_H_
+
+#include "ViewBase.h"
+#include <QDateTime>
+
+class QLabel;
+class QPushButton;
+class MeetingRoomCombo;
+class TimeDisplayWidget;
+class ScheduleWidget;
+class Configuration;
+class Meeting;
+class Room;
+class BorderedBarWidget;
+
+//! Userinterface class. Shows a weekly calendar for the selected room, provides date and time information.
+/*!
+ * UserInterface class. Shows the current date and time and selected week's calendar for
+ * selected meeting room. User can select meeting room, browse weeks back and forth, and can navigate
+ * back to the current week.
+ */
+class WeeklyViewWidget : public ViewBase
+{
+ Q_OBJECT
+
+public:
+ //! Constructor.
+ /*!
+ * Constructor to initialize an WeeklyViewWidget instance.
+ * \param aCurrentDateTime
+ * \param aConfiguration Pointer to the configuration object. Not owned.
+ * \param aParent Pointer to the parent widget.
+ */
+ WeeklyViewWidget( QDateTime aCurrentDateTime, Configuration *aConfiguration, QWidget *aParent = 0 );
+ //! Destructor.
+ virtual ~WeeklyViewWidget();
+
+ //! Current room
+ /*!
+ * Returns the currently selected meeting room.
+ * \return Selected meeting room.
+ */
+ Room* currentRoom();
+
+ //! First day of week currently displayd
+ /*!
+ * Returns the first day of week currently displayd.
+ * \return First day of week.
+ */
+ QDate beginnigOfShownWeek();
+ //! Sends the refresh command to schedule widget.
+ /*!
+ * Sends the refresh command to schedule widget.
+ * \param aMeetings The list of meetings.
+ */
+ void refreshMeetings( const QList<Meeting*> &aMeetings );
+
+ void showCurrentWeek();
+
+ void setDefaultRoom();
+
+signals:
+ //! Signals change of the meeting room.
+ /*!
+ * Signal is emited when meeting room is changed.
+ * \param aNewRoom Selected meeting room.
+ */
+ void currentRoomChanged( Room *aNewRoom );
+ //! Meeting activated.
+ /*!
+ * Signal is emitted when a meeting is clicked by the user.
+ * \param aMeeting actived meeting.
+ */
+ void meetingActivated( Meeting *aMeeting );
+ //! Signals creation of new meeting.
+ /*!
+ * Signal is emited when new meeting is created.
+ * \param aMeeting Meeting that has been created.
+ * \param aUsername User who created the meeting.
+ * \param aPassword Password of the "aUsername"
+ */
+ void meetingToCreate( Meeting *aMeeting, const QString &aUsername, const QString &aPassword );
+ //! Signals deletion of a meeting.
+ /*!
+ * Signal is emited when meeting is deleted.
+ * \param aMeeting Deleted meeting.
+ * \param aUsername User who deleted the meeting.
+ * \param aPassword Password of the "aUsername"
+ */
+ void meetingToDelete( Meeting *aMeeting, const QString &aUsername, const QString &aPassword );
+ //! Signals modifications of a meeting.
+ /*!
+ * Signal is emited when meeting is modified.
+ * \param aMeeting Modified meeting.
+ * \param aUsername User who modified the meeting.
+ * \param aPassword Password of the "aUsername"
+ */
+ void meetingToUpdate( Meeting *aMeeting, const QString &aUsername, const QString &aPassword );
+
+ //! Signals
+ /*!
+ * Signal is emited when settings button is clicked.
+ */
+ void settingsButtonClicked();
+
+ //! Signals
+ /*!
+ * Signal is emited when refresh button is clicked.
+ */
+ void refreshButtonClicked();
+
+
+ //! Signal. Emitted if the shown week has been changed.
+ /*!
* Signal. Emitted if the shown week has been changed.
* \param aDate The first date of the shown week.
*/
- void shownWeekChanged( QDate aDate );\r
-\r
-public slots:\r
- //! Sets the date and time\r
- /*!\r
- * Sets the current date and time\r
- * \param aCurrentDateTime Date and time to be displayd.\r
- */\r
- void setCurrentDateTime( QDateTime aCurrentDateTime );\r
- //! Handle resizing\r
- /*!\r
- * Handle possible resize changes after the view is resized\r
- * to match the window managers client area.\r
- */\r
- void viewResized(const QSize &newSize, const QSize &oldSize) { }\r
-\r
-private:\r
- //! Displays the selectable meeting rooms.\r
- MeetingRoomCombo *iRoomsCombo;\r
- //! Displays the time.\r
- TimeDisplayWidget *iTimeDisplay;\r
- //! Displays the calendar.\r
- ScheduleWidget *iSchedule;\r
- //! Displays the date.\r
- QLabel *iCurrentDayLabel;\r
- //! Displays the week number.\r
- QLabel *iCurrentWeekLabel;\r
- //! Button used to display previous week's calendar.\r
- QPushButton *iPreviousWeekButton;\r
- //! Button used to display current week's calendar.\r
- QPushButton *iCurrentWeekButton;\r
- //! Button used to display next week's calendar.\r
- QPushButton *iNextWeekButton;\r
- //! Settings button. TODO : Correct widget is needed!!\r
- QPushButton *iSettingsButton;\r
- //! About button. TODO : Correct widget is needed!!\r
- QPushButton *iAboutButton;\r
- /* !\r
- * Pointer to configuration object.\r
- * Contains configurable data and IS NOT OWNED by the widget.\r
- */\r
- Configuration *iConfiguration;\r
-};\r
-\r
-#endif /*WEEKLYVIEWWIDGET_H_*/\r
+ void shownWeekChanged( QDate aDate );
+
+public slots:
+ //! Slot. Sets the connection status
+ /*!
+ * Sets the current time, and connection status
+ * \param aCurrentTime Time to be displayed.
+ * \param aConnected connection status to be displayed.
+ * \param aLastUpdated Time of last successful connection to be displayed.
+ */
+ void setConnectionStatus( QDateTime aCurrentTime, bool aConnected, QTime aLastUpdated = QTime(), QString aError = "" );
+ //! Handle resizing
+ /*!
+ * Handle possible resize changes after the view is resized
+ * to match the window managers client area.
+ */
+ void viewResized(const QSize &/*newSize*/, const QSize &/*oldSize*/) { }
+
+ void showError( QString aError );
+
+ void connectionEstablished();
+
+ void connectionLost();
+
+private:
+ //! Displays the selectable meeting rooms.
+ MeetingRoomCombo *iRoomsCombo;
+ //! Displays the time.
+ BorderedBarWidget *iTimeDisplay;
+ //! Displays the status.
+ BorderedBarWidget *iStatusBar;
+ //! Displays the calendar.
+ ScheduleWidget *iSchedule;
+ //! Displays the date.
+ QLabel *iCurrentDayLabel;
+ //! Displays the week number.
+ QLabel *iCurrentWeekLabel;
+ //! Button used to display previous week's calendar.
+ QPushButton *iPreviousWeekButton;
+ //! Button used to display current week's calendar.
+ QPushButton *iCurrentWeekButton;
+ //! Button used to display next week's calendar.
+ QPushButton *iNextWeekButton;
+ //! Settings button. TODO : Correct widget is needed!!
+ QPushButton *iSettingsButton;
+ //! About button. TODO : Correct widget is needed!!
+ QPushButton *iAboutButton;
+ /* !
+ * Pointer to configuration object.
+ * Contains configurable data and IS NOT OWNED by the widget.
+ */
+ Configuration *iConfiguration;
+};
+
+#endif /*WEEKLYVIEWWIDGET_H_*/
#include <QEvent>
#include <QDialog>
+#include <QMenuBar>
#include "ViewBase.h"
#include "PopUpMessageBox.h"
#include <QtDebug>
WindowManager::WindowManager( QWidget *aParent ) :
- QWidget( aParent ),
+ QMainWindow( aParent ),
iApplicationName( tr( "Qt Meetings" ) ),
iCurrentView( 0 )
{
this->setWindowTitle( iApplicationName );
+ settingsAction = new QAction(tr("&Settings"), this);
+ closeAction = new QAction(tr("&Close"), this);
+ connect(settingsAction, SIGNAL(triggered()), this, SIGNAL(showSettingsClicked()));
+ connect(closeAction, SIGNAL(triggered()), this, SIGNAL(closeClicked()));
+ editMenu = menuBar()->addMenu(tr("&Edit"));
+ editMenu->addAction(settingsAction);
+ menuBar()->addMenu(editMenu);
+ menuBar()->addAction(closeAction);
}
WindowManager::~WindowManager()
iCurrentView = view;
connect( iCurrentView, SIGNAL( eventDetected() ), this, SLOT( viewEventDetected() ) );
connect( this, SIGNAL( viewResized(const QSize &, const QSize &) ), iCurrentView, SLOT( viewResized( const QSize &, const QSize & ) ) );
- view->resize( this->size() );
-
+ if (((QWidget*)view) != this)
+ {
+ this->adjustSize();
+ }
+ view->resize(this->size());
+ //view->adjustSize();
view->show();
// Disconnect old connections and hide the view
#ifndef WINDOWMANAGER_H_
#define WINDOWMANAGER_H_
-#include <QWidget>
+#include <QMainWindow>
#include <QStack>
// Forward declarations
* can track the views events and restore previous view if the current on is ObservedView. This
* is a handy mechanism for screensaver etc.
*/
-class WindowManager : public QWidget
+class WindowManager : public QMainWindow
{
Q_OBJECT
*/
void previousViewRestored();
+ void showSettingsClicked();
+
+ void closeClicked();
+
void dialogActivated();
void dialogDeactivated();
//! Stack of views previously displayed.
QStack<ViewBase *> iViewList;
+ //! Menu settings
+ QAction *settingsAction;
+ //! Menu close application
+ QAction *closeAction;
+ //! Edit menu
+ QMenu *editMenu;
};
#endif /*WINDOWMANAGER_H_*/