Potential fix to compile on Linux
[clinton/Virtual-Jaguar-Rx.git] / src / gui / emustatus.cpp
1 //
2 // emustatus.cpp - Jaguar emulator status
3 //
4 // by Jean-Paul Mari
5 //
6 // JPM = Jean-Paul Mari <djipi.mari@gmail.com>
7 //
8 // Who When What
9 // --- ---------- -----------------------------------------------------------
10 // JPM 02/02/2017 Created this file
11 //
12
13 // STILL TO DO:
14 //
15
16 #include "emustatus.h"
17 #include "memory.h"
18 #include "gpu.h"
19 #include "m68000/m68kinterface.h"
20 #include "jaguar.h"
21 #include "settings.h"
22
23
24 //
25 EmuStatusWindow::EmuStatusWindow(QWidget * parent/*= 0*/): QWidget(parent, Qt::Dialog),
26 layout(new QVBoxLayout),
27 text(new QLabel),
28 GPURunning(GPUIsRunning())
29 {
30 setWindowTitle(tr("Emulator status"));
31
32 QFont fixedFont("Lucida Console", 8, QFont::Normal);
33 fixedFont.setStyleHint(QFont::TypeWriter);
34 text->setFont(fixedFont);
35 setLayout(layout);
36
37 layout->addWidget(text);
38 }
39
40
41 //
42 void EmuStatusWindow::RefreshContents(void)
43 {
44 char string[1024];
45 QString emuStatusDump;
46
47 if (isVisible())
48 {
49 text->clear();
50
51 GPURunning = GPUIsRunning();
52 sprintf(string, " GPU active | %s\n", (GPURunning ? "Yes" : "No"));
53 emuStatusDump += QString(string);
54 M68000DebugHaltStatus = M68KDebugHaltStatus();
55 sprintf(string, "M68K debugger status | %s\n", (M68000DebugHaltStatus ? "Halt" : "Run"));
56 emuStatusDump += QString(string);
57 sprintf(string, " M68K tracing | %s\n", (startM68KTracing ? "On" : "Off"));
58 emuStatusDump += QString(string);
59 sprintf(string, " DRAM | %i KB", (vjs.DRAM_size / 1024));
60 emuStatusDump += QString(string);
61
62 text->setText(emuStatusDump);
63 }
64 }
65
66
67 //
68 void EmuStatusWindow::keyPressEvent(QKeyEvent * e)
69 {
70 if (e->key() == Qt::Key_Escape)
71 {
72 hide();
73 }
74 }