Enable minitrace support
This commit is contained in:
@@ -17,6 +17,10 @@ extern "C" {
|
||||
#include <86box/video.h>
|
||||
#include <86box/vid_ega.h>
|
||||
#include <86box/version.h>
|
||||
|
||||
#ifdef MTR_ENABLED
|
||||
#include <minitrace/minitrace.h>
|
||||
#endif
|
||||
};
|
||||
|
||||
#include <QGuiApplication>
|
||||
@@ -338,6 +342,63 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
#ifdef MTR_ENABLED
|
||||
{
|
||||
ui->menuTools->addSeparator();
|
||||
static auto actionBegin_trace = ui->menuTools->addAction(tr("Begin trace"));
|
||||
static auto actionEnd_trace = ui->menuTools->addAction(tr("End trace"));
|
||||
actionBegin_trace->setShortcut(QKeySequence(Qt::Key_Control + Qt::Key_T));
|
||||
actionEnd_trace->setShortcut(QKeySequence(Qt::Key_Control + Qt::Key_T));
|
||||
actionEnd_trace->setDisabled(true);
|
||||
static auto init_trace = [&]
|
||||
{
|
||||
mtr_init("trace.json");
|
||||
mtr_start();
|
||||
};
|
||||
static auto shutdown_trace = [&]
|
||||
{
|
||||
mtr_stop();
|
||||
mtr_shutdown();
|
||||
};
|
||||
#ifdef Q_OS_MACOS
|
||||
actionBegin_trace->setShortcutVisibleInContextMenu(true);
|
||||
actionEnd_trace->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
static bool trace = false;
|
||||
connect(actionBegin_trace, &QAction::triggered, this, [this]
|
||||
{
|
||||
if (trace) return;
|
||||
actionBegin_trace->setDisabled(true);
|
||||
actionEnd_trace->setDisabled(false);
|
||||
init_trace();
|
||||
trace = true;
|
||||
});
|
||||
connect(actionEnd_trace, &QAction::triggered, this, [this]
|
||||
{
|
||||
if (!trace) return;
|
||||
actionBegin_trace->setDisabled(false);
|
||||
actionEnd_trace->setDisabled(true);
|
||||
shutdown_trace();
|
||||
trace = false;
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_VRAM_DUMP
|
||||
{
|
||||
#ifndef MTR_ENABLED
|
||||
ui->menuTools->addSeparator();
|
||||
#endif
|
||||
auto actionDump_video_RAM = ui->menuTools->addAction(tr("Dump &video RAM"));
|
||||
actionDump_video_RAM->setShortcut(QKeySequence(Qt::Key_Control + Qt::Key_F1));
|
||||
#ifdef Q_OS_MACOS
|
||||
actionDump_video_RAM->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
connect(actionDump_video_RAM, &QAction::triggered, this, [this]
|
||||
{ svga_dump_vram(); });
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event) {
|
||||
@@ -1068,6 +1129,12 @@ bool MainWindow::eventFilter(QObject* receiver, QEvent* event)
|
||||
}
|
||||
}
|
||||
|
||||
if (receiver == this)
|
||||
{
|
||||
static auto curdopause = dopause;
|
||||
if (event->type() == QEvent::WindowBlocked) { curdopause = dopause; plat_pause(1); }
|
||||
else if (event->type() == QEvent::WindowUnblocked) { plat_pause(curdopause); }
|
||||
}
|
||||
return QMainWindow::eventFilter(receiver, event);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,11 +13,38 @@
|
||||
<property name="windowTitle">
|
||||
<string>New Image</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="1">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>File name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="FileField" name="fileField" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Disk size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBoxSize"/>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelRpm">
|
||||
<property name="text">
|
||||
<string>RPM mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboBoxRpm"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -30,7 +57,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -40,33 +67,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>File name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Disk size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="FileField" name="fileField" native="true"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelRpm">
|
||||
<property name="text">
|
||||
<string>RPM mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="comboBoxRpm"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
||||
@@ -30,6 +30,9 @@ public:
|
||||
if (strcmp(sourceText, "&Fullscreen") == 0) sourceText = "&Fullscreen\tCtrl+Alt+PageUP";
|
||||
if (strcmp(sourceText, "&Ctrl+Alt+Del") == 0) sourceText = "&Ctrl+Alt+Del\tCtrl+F12";
|
||||
if (strcmp(sourceText, "Take s&creenshot") == 0) sourceText = "Take s&creenshot\tCtrl+F11";
|
||||
if (strcmp(sourceText, "Begin trace") == 0) sourceText = "Begin trace\tCtrl+T";
|
||||
if (strcmp(sourceText, "End trace") == 0) sourceText = "End trace\tCtrl+T";
|
||||
if (strcmp(sourceText, "Dump &video RAM") == 0) sourceText = "Dump &video RAM\tCtrl+F1";
|
||||
if (strcmp(sourceText, "&Qt (Software)") == 0)
|
||||
{
|
||||
QString finalstr = QTranslator::translate("", "&SDL (Software)", disambiguation, n);
|
||||
|
||||
Reference in New Issue
Block a user