Add the ability to use the DB48X keyboard mapping

This makes it possible to check on simulator what things would look like.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit is contained in:
Christophe de Dinechin 2023-06-22 16:42:22 +02:00
parent f0538467f1
commit 1d58abd64c
6 changed files with 32 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 425 KiB

After

Width:  |  Height:  |  Size: 367 KiB

BIN
sim/keyboard-db48x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

View file

@ -37,6 +37,7 @@
RECORDER(options, 32, "Information about command line options");
bool run_tests = false;
bool db48x_keyboard = false;
int main(int argc, char *argv[])
// ----------------------------------------------------------------------------
@ -53,10 +54,21 @@ int main(int argc, char *argv[])
for (int a = 1; a < argc; a++)
{
record(options, " %u: %+s", a, argv[a]);
if (argv[a][0] == '-' && argv[a][1] == 't')
recorder_trace_set(argv[a]+2);
if (argv[a][0] == '-' && argv[a][1] == 'T')
run_tests = true;
if (argv[a][0] == '-')
{
switch(argv[a][1])
{
case 't':
recorder_trace_set(argv[a]+2);
break;
case 'T':
run_tests = true;
break;
case 'd':
db48x_keyboard = true;
break;
}
}
}
#if QT_VERSION < 0x060000

View file

@ -48,6 +48,7 @@
RECORDER(sim_keys, 16, "Recorder keys from the simulator");
extern bool run_tests;
extern bool db48x_keyboard;
MainWindow *MainWindow::mainWindow = nullptr;
MainWindow::MainWindow(QWidget *parent)
@ -67,6 +68,10 @@ MainWindow::MainWindow(QWidget *parent)
ui.keyboard->installEventFilter(this);
ui.screen->setAttribute(Qt::WA_AcceptTouchEvents);
ui.screen->installEventFilter(this);
if (db48x_keyboard)
ui.keyboard->setStyleSheet("border-image: url(:/bitmap/keyboard-db48x.png) 0 0 0 0 stretch stretch;");
else
ui.keyboard->setStyleSheet("border-image: url(:/bitmap/keyboard.png) 0 0 0 0 stretch stretch;");
highlight = new Highlight(ui.keyboard);
highlight->setGeometry(0,0,0,0);
@ -348,6 +353,15 @@ void MainWindow::keyPressEvent(QKeyEvent * ev)
}
}
if (k == Qt::Key_F10)
{
db48x_keyboard = !db48x_keyboard;
if (db48x_keyboard)
ui.keyboard->setStyleSheet("border-image: url(:/bitmap/keyboard-db48x.png) 0 0 0 0 stretch stretch;");
else
ui.keyboard->setStyleSheet("border-image: url(:/bitmap/keyboard.png) 0 0 0 0 stretch stretch;");
}
for (int i = 0; keyMap[i] != 0; i += 2)
{
if (k == keyMap[i])

View file

@ -118,7 +118,7 @@
border-width: 0px;</string>
</property>
<property name="text">
<string>My Button</string>
<string></string>
</property>
<property name="flat">
<bool>true</bool>

View file

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/bitmap">
<file alias="keyboard.png">keyboard-dm42.png</file>
<file alias="keyboard-db48x.png">keyboard-db48x.png</file>
</qresource>
</RCC>