Ticket #9: let the demo application close gracefully when choosing File->Quit or...
[bertos.git] / emul / emulwin.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 6c57349..b5f57cd
@@ -1,9 +1,34 @@
 /**
  * \file
  * <!--
+ * This file is part of BeRTOS.
+ *
+ * Bertos is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction.  Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU General Public License.  This exception does not however
+ * invalidate any other reasons why the executable file might be covered by
+ * the GNU General Public License.
+ *
  * Copyright 2006 Develer S.r.l. (http://www.develer.com/)
  * Copyright 2000, 2001 Bernardo Innocenti <bernie@codewiz.org>
- * This file is part of DevLib - See README.devlib for information.
+ *
  * -->
  *
  * \version $Id$
  * \brief Main Qt window for embedded applications emulator (implementation)
  */
 
-/*#*
- *#* $Log$
- *#* Revision 1.5  2006/05/28 12:17:56  bernie
- *#* Drop almost all the Qt3 cruft.
- *#*
- *#* Revision 1.4  2006/02/20 02:00:39  bernie
- *#* Port to Qt 4.1.
- *#*
- *#* Revision 1.3  2006/02/15 09:11:17  bernie
- *#* Add keyboard emulator.
- *#*
- *#* Revision 1.2  2006/01/16 03:51:51  bernie
- *#* Fix boilerplate.
- *#*
- *#* Revision 1.1  2006/01/16 03:37:12  bernie
- *#* Add emulator skeleton.
- *#*
- *#*/
-
 #include "emulwin.h"
 
 #include <drv/lcd_gfx_qt.h>
@@ -54,20 +60,19 @@ using namespace Qt;
 
 EmulWin::EmulWin(Emulator *e)
 {
-       setWindowTitle(tr("DevLib Emul Demo"));
+       setWindowTitle(tr("BeRTOS Emul Demo"));
        setAttribute(Qt::WA_DeleteOnClose);
 
        // Create the menu bar
-               QMenu *file_menu = menuBar()->addMenu(tr("&File"));
-               file_menu->addAction(tr("&Quit"),
-                               e->emulApp, SLOT(closeAllWindows()), CTRL+Key_Q);
+       QMenu *file_menu = menuBar()->addMenu(tr("&File"));
+       file_menu->addAction(tr("&Quit"),
+               e->emulApp, SLOT(closeAllWindows()), CTRL+Key_Q);
 
-               menuBar()->addSeparator();
-
-               QMenu *help_menu = menuBar()->addMenu(tr("&Help"));
-               help_menu->addAction(tr("&About"),
-                               this, SLOT(about()), Key_F1);
+       menuBar()->addSeparator();
 
+       QMenu *help_menu = menuBar()->addMenu(tr("&Help"));
+       help_menu->addAction(tr("&About"),
+               this, SLOT(about()), Key_F1);
 
        // Make a central widget to contain the other widgets
        QWidget *central = new QWidget(this);
@@ -106,6 +111,7 @@ EmulWin::~EmulWin()
 
 void EmulWin::closeEvent(QCloseEvent *ce)
 {
+       emul->quit();
        ce->accept();
 }
 
@@ -113,9 +119,9 @@ void EmulWin::closeEvent(QCloseEvent *ce)
 void EmulWin::about()
 {
     QMessageBox::about(this,
-               "Embedded Application Emulator",
+               "BeRTOS Embedded Application Emulator",
                "Version 0.1\n"
-               "Copyright 2006 Develer S.r.l. (http://www.develer.com/)\n"
+               "Copyright 2006, 2008 Develer S.r.l. (http://www.develer.com/)\n"
                "Copyright 2001, 2002, 2003, 2005 Bernardo Innocenti <bernie@codewiz.org>\n"
                "All rights reserved."
        );