#include <QEvent>
#include <QDialog>
+#include <QMenuBar>
#include "ViewBase.h"
+#include "PopUpMessageBox.h"
#include <QtDebug>
-const int IDLE_TIME_MULTIPLIER = 60000; // Multiplies milliseconds to minutes
-
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()
// Make the new view visible and handle connections
iCurrentView = view;
connect( iCurrentView, SIGNAL( eventDetected() ), this, SLOT( viewEventDetected() ) );
- connect( this, SIGNAL( viewResized(const QSize &) ), iCurrentView, SLOT( viewResized( const QSize & ) ) );
- view->resize( this->size() );
-
+ connect( this, SIGNAL( viewResized(const QSize &, const QSize &) ), iCurrentView, SLOT( viewResized( const QSize &, const QSize & ) ) );
+ if (((QWidget*)view) != this)
+ {
+ this->adjustSize();
+ }
+ view->resize(this->size());
+ //view->adjustSize();
view->show();
// Disconnect old connections and hide the view
if ( oldView != 0 )
{
disconnect( oldView, SIGNAL( eventDetected() ), this, SLOT( viewEventDetected() ) );
- disconnect( this, SIGNAL( viewResized(const QSize &) ), oldView, SLOT( viewResized(const QSize &) ) );
+ disconnect( this, SIGNAL( viewResized(const QSize &, const QSize &) ), oldView, SLOT( viewResized(const QSize &, const QSize &) ) );
oldView->hide();
}
}
-void WindowManager::showDialog(QDialog *dialog)
+void WindowManager::showDialog(QDialog *aDialog, bool blocking, bool aSendSignal)
{
// Handle dialog displaying
- emit dialogActivated();
- dialog->exec();
- emit dialogDeactivated();
+ if ( aSendSignal ) emit dialogActivated();
+ if ( blocking )
+ {
+ aDialog->exec();
+ }
+ else
+ {
+ aDialog->show();
+ }
+ if ( aSendSignal ) emit dialogDeactivated();
}
void WindowManager::viewEventDetected()
{
if ( iCurrentView != 0 )
{
+ QSize currentSize = iCurrentView->size();
iCurrentView->setFixedSize( this->size() );
- emit viewResized( this->size() );
+ emit viewResized( this->size(), currentSize );
}
}
return QWidget::event( event );
}
+void WindowManager::error( const QString &aErrorMessage )
+{
+ qDebug() << "WindowManager::error ";
+
+ PopUpMessageBox *popup = PopUpMessageBox::error( 0, aErrorMessage );
+ if ( popup != 0 )
+ {
+ showDialog( static_cast<QDialog *>( popup ), false );
+ }
+}
+
void WindowManager::setFullscreen()
{
this->setWindowState( Qt::WindowFullScreen );