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.4 2006/02/20 02:00:39 bernie
21 *#* Revision 1.3 2006/02/15 09:11:17 bernie
22 *#* Add keyboard emulator.
24 *#* Revision 1.2 2006/01/16 03:51:51 bernie
27 *#* Revision 1.1 2006/01/16 03:37:12 bernie
28 *#* Add emulator skeleton.
34 #include <drv/lcd_gfx_qt.h>
35 #include <emul/emul.h>
36 #include <emul/emulkbd.h>
44 #include <qcheckbox.h>
46 #include <qmessagebox.h>
47 #include <qdatetime.h>
49 #include <qapplication.h>
50 #include <qpopupmenu.h>
53 #include <QtGui/QLayout>
54 #include <QtGui/QLabel>
55 #include <QtGui/QSlider>
56 #include <QtGui/QCheckBox>
57 #include <QtGui/QMenuBar>
58 #include <QtGui/QMessageBox>
59 #include <QtCore/QDateTime>
60 #include <QtCore/QTimer>
61 #include <QtGui/QApplication>
62 #include <QtGui/QCloseEvent>
63 //#include <Qt3Support/q3popupmenu.h>
64 //#define QPopupMenu Q3PopupMenu
65 #define QPopupMenu QMenu
69 EmulWin::EmulWin(Emulator *e) : QMainWindow(0, "DevLibEmul",
78 setAttribute(Qt::WA_DeleteOnClose);
82 QPopupMenu * file = new QPopupMenu(this);
83 file->insertItem("&Quit", static_cast<QObject *>(e->emulApp), SLOT(closeAllWindows()), CTRL+Key_Q);
86 QPopupMenu * help = new QPopupMenu(this);
87 help->insertItem("&About", this, SLOT(about()), Key_F1);
90 QMenuBar * menu = new QMenuBar(this);
91 menu->insertItem("&File", file);
92 menu->insertSeparator();
93 menu->insertItem("&Help", help);
95 // Make a central widget to contain the other widgets
96 QWidget *central = new QWidget(this);
97 setCentralWidget(central);
99 // Create a layout to position the widgets
100 QHBoxLayout *box_main = new QHBoxLayout(central, 4);
103 QVBoxLayout *box_right = new QVBoxLayout(box_main, 4);
106 QHBoxLayout *lay_lcd = new QHBoxLayout(box_right, 4);
107 lay_lcd->addWidget(e->emulLCD = new EmulLCD(central));
110 QHBoxLayout *lay_kbd = new QHBoxLayout(box_right, 4);
111 lay_kbd->addWidget(e->emulKbd = new EmulKbd(central));
113 // Setup keyboard: Label Keycode Row Col MRow MCol
114 e->emulKbd->addKey("^", Key_Up, 0, 0, 0, 0);
115 e->emulKbd->addKey("v", Key_Down, 1, 0, 0, 1);
116 e->emulKbd->addKey("OK", Key_Return, 0, 1, 0, 2);
117 e->emulKbd->addKey("ESC", Key_Escape, 1, 1, 0, 3);
127 void EmulWin::closeEvent(QCloseEvent *ce)
133 void EmulWin::about()
135 QMessageBox::about(this,
136 "Embedded Application Emulator",
138 "Copyright 2006 Develer S.r.l. (http://www.develer.com/)\n"
139 "Copyright 2001, 2002, 2003, 2005 Bernardo Innocenti <bernie@codewiz.org>\n"
140 "All rights reserved."
144 #include "emulwin_moc.cpp"