mirror of
https://github.com/86Box/86Box.git
synced 2025-01-23 09:42:47 -05:00
Fix crashes on language settings changes
This commit is contained in:
parent
633ad83bb2
commit
85a11813d6
2 changed files with 51 additions and 18 deletions
|
@ -104,10 +104,12 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
{
|
||||
/* get the percentage and mouse message, TODO: refactor ui_window_title() */
|
||||
auto parts = title.split(" - ");
|
||||
if (parts.size() < 5)
|
||||
toolbar_label->setText(parts[1]);
|
||||
else
|
||||
toolbar_label->setText(QString("%1 - %2").arg(parts[1], parts.last()));
|
||||
if (parts.size() >= 2) {
|
||||
if (parts.size() < 5)
|
||||
toolbar_label->setText(parts[1]);
|
||||
else
|
||||
toolbar_label->setText(QString("%1 - %2").arg(parts[1], parts.last()));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
ui->actionPause->setChecked(dopause);
|
||||
|
@ -346,11 +348,11 @@ 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);
|
||||
ui->actionBegin_trace->setVisible(true);
|
||||
ui->actionEnd_trace->setVisible(true);
|
||||
ui->actionBegin_trace->setShortcut(QKeySequence(Qt::Key_Control + Qt::Key_T));
|
||||
ui->actionEnd_trace->setShortcut(QKeySequence(Qt::Key_Control + Qt::Key_T));
|
||||
ui->actionEnd_trace->setDisabled(true);
|
||||
static auto init_trace = [&]
|
||||
{
|
||||
mtr_init("trace.json");
|
||||
|
@ -362,23 +364,23 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
mtr_shutdown();
|
||||
};
|
||||
#ifdef Q_OS_MACOS
|
||||
actionBegin_trace->setShortcutVisibleInContextMenu(true);
|
||||
actionEnd_trace->setShortcutVisibleInContextMenu(true);
|
||||
ui->actionBegin_trace->setShortcutVisibleInContextMenu(true);
|
||||
ui->actionEnd_trace->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
static bool trace = false;
|
||||
connect(actionBegin_trace, &QAction::triggered, this, [this]
|
||||
connect(ui->actionBegin_trace, &QAction::triggered, this, [this]
|
||||
{
|
||||
if (trace) return;
|
||||
actionBegin_trace->setDisabled(true);
|
||||
actionEnd_trace->setDisabled(false);
|
||||
ui->actionBegin_trace->setDisabled(true);
|
||||
ui->actionEnd_trace->setDisabled(false);
|
||||
init_trace();
|
||||
trace = true;
|
||||
});
|
||||
connect(actionEnd_trace, &QAction::triggered, this, [this]
|
||||
connect(ui->actionEnd_trace, &QAction::triggered, this, [this]
|
||||
{
|
||||
if (!trace) return;
|
||||
actionBegin_trace->setDisabled(false);
|
||||
actionEnd_trace->setDisabled(true);
|
||||
ui->actionBegin_trace->setDisabled(false);
|
||||
ui->actionEnd_trace->setDisabled(true);
|
||||
shutdown_trace();
|
||||
trace = false;
|
||||
});
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>724</width>
|
||||
<height>21</height>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuAction">
|
||||
|
@ -79,6 +79,9 @@
|
|||
<addaction name="actionSound_gain"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPreferences"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionBegin_trace"/>
|
||||
<addaction name="actionEnd_trace"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
|
@ -666,6 +669,34 @@
|
|||
<string>ACPI Shutdown</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionBegin_trace">
|
||||
<property name="text">
|
||||
<string>Begin trace</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+T</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="shortcutVisibleInContextMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEnd_trace">
|
||||
<property name="text">
|
||||
<string>End trace</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+T</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="shortcutVisibleInContextMenu">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
Loading…
Add table
Reference in a new issue