X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=emul%2Femulwin.cpp;h=b5b516a6cd70bb7c984315aa5c9f53f0110b5b48;hb=6ac6b17a873cc424f8a9d63c56116c1d94276017;hp=9f9ff5e86f59853336fafa24bf01d0ab9b1382a8;hpb=70ef586aed3922433460eaf19125378f8c996743;p=bertos.git diff --git a/emul/emulwin.cpp b/emul/emulwin.cpp old mode 100755 new mode 100644 index 9f9ff5e8..b5b516a6 --- a/emul/emulwin.cpp +++ b/emul/emulwin.cpp @@ -1,9 +1,34 @@ /** * \file * * * \version $Id$ @@ -13,59 +38,68 @@ * \brief Main Qt window for embedded applications emulator (implementation) */ -/*#* - *#* $Log$ - *#* Revision 1.1 2006/01/16 03:37:12 bernie - *#* Add emulator skeleton. - *#* - *#*/ - #include "emulwin.h" #include #include +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -EmulWin::EmulWin(Emulator *e) : QMainWindow(0, "SarfEmul", WDestructiveClose) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace Qt; + +EmulWin::EmulWin(Emulator *e) { - // "File" menu - QPopupMenu * file = new QPopupMenu(this); - file->insertItem("&Quit", static_cast(e->emulApp), SLOT(closeAllWindows()), CTRL+Key_Q); + 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); - // "Help" menu - QPopupMenu * help = new QPopupMenu(this); - help->insertItem("&About", this, SLOT(about()), Key_F1); + menuBar()->addSeparator(); - // Menu bar - QMenuBar * menu = new QMenuBar(this); - menu->insertItem("&File", file); - menu->insertSeparator(); - menu->insertItem("&Help", help); + 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); setCentralWidget(central); // Create a layout to position the widgets - QHBoxLayout *box_main = new QHBoxLayout(central, 4); + QHBoxLayout *box_main = new QHBoxLayout(central); // Main layout - QVBoxLayout *box_right = new QVBoxLayout(box_main, 4); + QVBoxLayout *box_right = new QVBoxLayout(); + box_main->addLayout(box_right); // LCD - QHBoxLayout *lay_lcd = new QHBoxLayout(box_right, 4); - lay_lcd->addWidget(e->emulLCD = new EmulLCD(central)); + QHBoxLayout *lay_lcd = new QHBoxLayout(); + box_right->addLayout(lay_lcd); + lay_lcd->addStretch(); + lay_lcd->addWidget(e->emulLCD = new EmulLCD(central)); + lay_lcd->addStretch(); + + // Keyboard + box_right->addWidget(e->emulKbd = new EmulKbd(central)); + + // Setup keyboard: Label Keycode Row Col MRow MCol + e->emulKbd->addKey("^", Key_Up, 0, 0, 0, 0); + e->emulKbd->addKey("v", Key_Down, 1, 0, 0, 1); + e->emulKbd->addKey("OK", Key_Return, 0, 1, 0, 2); + e->emulKbd->addKey("ESC", Key_Escape, 1, 1, 0, 3); } @@ -84,9 +118,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 \n" "All rights reserved." );