Implementation of about dialog using MMessageBox.
authorRoman Moravcik <roman.moravcik@gmail.com>
Wed, 29 Jun 2011 08:20:07 +0000 (10:20 +0200)
committerRoman Moravcik <roman.moravcik@gmail.com>
Wed, 29 Jun 2011 08:20:07 +0000 (10:20 +0200)
src/aboutdialog.cpp
src/aboutdialog.h
src/mainwindow.cpp

index e383f5f..99c7c19 100644 (file)
 #include "aboutdialog.h"
 
 #ifdef Q_WS_MAEMO_6
-AboutDialog::AboutDialog(QGraphicsItem *parent) : MApplicationPage(parent)
+AboutDialog::AboutDialog(QGraphicsItem *parent) : MMessageBox("", M::OkButton)
 {
-    setAttribute(Qt::WA_LockPortraitOrientation, true);
-    setWindowTitle(tr("About"));
-    setPannable(false);
-
-    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
-    centralWidget()->setLayout(layout);
+    Q_UNUSED(parent);
 
-    MLabel *application = new MLabel();
-    application->setText("Medard 0.2");
-    application->setStyleName ("CommonHeader");
-    application->setAlignment(Qt::AlignCenter);
-    layout->addItem(application);
+    setObjectName("messageBox");
 
-    MLabel *applicationCopyright = new MLabel();
-    applicationCopyright->setText(tr("Copyright(c) 2011 Roman Moravcik"));
-    applicationCopyright->setAlignment(Qt::AlignCenter);
-    layout->addItem(applicationCopyright);
-
-    MLabel *weatherDataCopyright = new MLabel();
-    weatherDataCopyright->setWordWrap(true);
-    weatherDataCopyright->setText(tr("\n"
-                                  "Weather data:\n"
-                                  "Project MEDARD, Institute of Computer Science,\n"
-                                  "Academy of Sciences of the Czech Republic, Prague\n"
-                                  "\n"
-                                  "Copyright(c) Institute of Computer Science AS CR 2003-2009.\n"
-                                  "MM5: PSU/NCAR, USA (c) CAMx: EVNIRON Corp., USA"));
-    layout->addItem(weatherDataCopyright);
+    setTitle("Medard 0.2\n");
+    setText(tr("Copyright(c) 2011 Roman Moravcik\n"
+               "\n"
+               "Weather data:\n"
+               "Project MEDARD, Institute of Computer Science,\n"
+               "Academy of Sciences of the Czech Republic, Prague\n"
+               "\n"
+               "Copyright(c) Institute of Computer Science AS CR 2003-2009.\n"
+               "MM5: PSU/NCAR, USA (c) CAMx: EVNIRON Corp., USA"));
 }
 #else
 AboutDialog::AboutDialog(QDialog *parent) : QDialog(parent)
index d81f45e..34be26c 100644 (file)
 #define ABOUTDIALOG_H
 
 #ifdef Q_WS_MAEMO_6
-#include <MApplicationPage>
+#include <MMessageBox>
 #else
 #include <QDialog>
 #endif
 
 #ifdef Q_WS_MAEMO_6
-class AboutDialog : public MApplicationPage
+class AboutDialog : public MMessageBox
 #else
 class AboutDialog : public QDialog
 #endif
index 6a41c92..a410ce2 100644 (file)
@@ -408,7 +408,7 @@ void MainWindow::aboutMenuClicked()
 {
     AboutDialog *dialog = new AboutDialog();
 #ifdef Q_WS_MAEMO_6
-    dialog->appear(scene(), MSceneWindow::DestroyWhenDismissed);
+    dialog->appear(MSceneWindow::DestroyWhenDismissed);
 #else
     dialog->exec();
 #endif