4 * Copyright 2006 Develer S.r.l. (http://www.develer.com/)
5 * Copyright 2000, 2001 Bernardo Innocenti <bernie@codewiz.org>
6 * This file is part of DevLib - See README.devlib for information.
11 * \author Bernardo Innocenti <bernie@develer.com>
13 * \brief Main Qt window for embedded applications emulator (implementation)
18 *#* Revision 1.5 2006/05/28 12:17:56 bernie
19 *#* Drop almost all the Qt3 cruft.
21 *#* Revision 1.4 2006/02/20 02:00:39 bernie
24 *#* Revision 1.3 2006/02/15 09:11:17 bernie
25 *#* Add keyboard emulator.
27 *#* Revision 1.2 2006/01/16 03:51:51 bernie
30 *#* Revision 1.1 2006/01/16 03:37:12 bernie
31 *#* Add emulator skeleton.
37 #include <drv/lcd_gfx_qt.h>
38 #include <emul/emul.h>
39 #include <emul/emulkbd.h>
43 #include <QtGui/QLayout>
44 #include <QtGui/QLabel>
45 #include <QtGui/QSlider>
46 #include <QtGui/QCheckBox>
47 #include <QtGui/QMenuBar>
48 #include <QtGui/QMessageBox>
49 #include <QtCore/QDateTime>
50 #include <QtCore/QTimer>
51 #include <QtGui/QApplication>
52 #include <QtGui/QCloseEvent>
55 EmulWin::EmulWin(Emulator *e)
57 setWindowTitle(tr("DevLib Emul Demo"));
58 setAttribute(Qt::WA_DeleteOnClose);
60 // Create the menu bar
61 QMenu *file_menu = menuBar()->addMenu(tr("&File"));
62 file_menu->addAction(tr("&Quit"),
63 e->emulApp, SLOT(closeAllWindows()), CTRL+Key_Q);
65 menuBar()->addSeparator();
67 QMenu *help_menu = menuBar()->addMenu(tr("&Help"));
68 help_menu->addAction(tr("&About"),
69 this, SLOT(about()), Key_F1);
72 // Make a central widget to contain the other widgets
73 QWidget *central = new QWidget(this);
74 setCentralWidget(central);
76 // Create a layout to position the widgets
77 QHBoxLayout *box_main = new QHBoxLayout(central);
80 QVBoxLayout *box_right = new QVBoxLayout();
81 box_main->addLayout(box_right);
84 QHBoxLayout *lay_lcd = new QHBoxLayout();
85 box_right->addLayout(lay_lcd);
86 lay_lcd->addStretch();
87 lay_lcd->addWidget(e->emulLCD = new EmulLCD(central));
88 lay_lcd->addStretch();
91 box_right->addWidget(e->emulKbd = new EmulKbd(central));
93 // Setup keyboard: Label Keycode Row Col MRow MCol
94 e->emulKbd->addKey("^", Key_Up, 0, 0, 0, 0);
95 e->emulKbd->addKey("v", Key_Down, 1, 0, 0, 1);
96 e->emulKbd->addKey("OK", Key_Return, 0, 1, 0, 2);
97 e->emulKbd->addKey("ESC", Key_Escape, 1, 1, 0, 3);
107 void EmulWin::closeEvent(QCloseEvent *ce)
113 void EmulWin::about()
115 QMessageBox::about(this,
116 "Embedded Application Emulator",
118 "Copyright 2006 Develer S.r.l. (http://www.develer.com/)\n"
119 "Copyright 2001, 2002, 2003, 2005 Bernardo Innocenti <bernie@codewiz.org>\n"
120 "All rights reserved."
124 #include "emulwin_moc.cpp"