mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-25 17:25:10 +03:00
[Simulator] UI tweaks for last major update. (#4414)
* [Simulator] Debug output: Adjust exclusion filter, help text <kbd> background color, fix help text typos & mark as translatable. * [Simulator] Radio Outputs: Fix wrong FM highlighted (closes #4408) and current FM not highlighted until switched once; Change highlight color role of active LS/FM so it is always shown (fixes #4393); Active LSs now much more obvious (bold font & sunken frame). * [Simulator] Rework some SimulatorMainWindow functionality: * Fix floating dock widgets appearing behind other applications on Linux (https://github.com/opentx/opentx/issues/4403#issuecomment-277510273); * Fix previously-unused floating dock widgets appearing in top-left corner upon subsequent launches of application (https://github.com/opentx/opentx/pull/4385#issuecomment-277315158); * Fix various anomalies due to not using a "central widget" in QMainWindow (extra separators appearing, vertical resize not working in some cases), radio widget is now central by default; * Add (keep) option to float the radio widget separate from main window, though this may cause the minor visual anomalies mentioned above; * Add options to disable radio widget size constraints while docked.
This commit is contained in:
parent
b0eeeb4dbc
commit
ded843b989
7 changed files with 280 additions and 124 deletions
|
@ -67,7 +67,7 @@ DebugOutput::DebugOutput(QWidget * parent, SimulatorInterface *simulator):
|
||||||
QStringList stockFilters;
|
QStringList stockFilters;
|
||||||
stockFilters << "^lua[A-Z].*";
|
stockFilters << "^lua[A-Z].*";
|
||||||
stockFilters << "/(error|warning|-(E|W)-)/i";
|
stockFilters << "/(error|warning|-(E|W)-)/i";
|
||||||
stockFilters << "!^(GC Use|(play|load|write|find(True)?)File|convert(To|From)Simu|\\tfound( in map)?:|eeprom |f_[a-z]+\\(|(push|(p|P)op(up)?|chain)? ?Menu( .+ display)?|RamBackup).+$";
|
stockFilters << "!^(GC Use|(play|load|write|find(True)?)File|convert(To|From)Simu|\\t(not )?found( in map)?:?|eeprom |f_[a-z]+\\(|(push|(p|P)op(up)?|chain)? ?Menu( .+ display)?|RamBackup).+$";
|
||||||
|
|
||||||
foreach (const QString & fltr, stockFilters)
|
foreach (const QString & fltr, stockFilters)
|
||||||
ui->filterText->addItem(fltr, "no_delete");
|
ui->filterText->addItem(fltr, "no_delete");
|
||||||
|
@ -267,9 +267,9 @@ void DebugOutput::on_actionClearScr_triggered()
|
||||||
void DebugOutput::on_actionShowFilterHelp_triggered()
|
void DebugOutput::on_actionShowFilterHelp_triggered()
|
||||||
{
|
{
|
||||||
// TODO : find some place better for this.
|
// TODO : find some place better for this.
|
||||||
QString help = \
|
QString help = tr( \
|
||||||
"<html><head><style>kbd {background-color: ghostwhite; font-size: large; white-space: nowrap;}</style></head><body>"
|
"<html><head><style>kbd {background-color: palette(alternate-base); font-size: large; white-space: nowrap;}</style></head><body>"
|
||||||
"<p>The filter supports two syntax types: basic matching with common wildcards and well as full Perl-style (<code>pcre</code>) Regular Expressions.</p>"
|
"<p>The filter supports two syntax types: basic matching with common wildcards as well as full Perl-style (<code>pcre</code>) Regular Expressions.</p>"
|
||||||
"<p>By default a filter will only show lines which match (<b>inclusive</b>). To make an <b>exclusive</b> filter which removes matching lines, "
|
"<p>By default a filter will only show lines which match (<b>inclusive</b>). To make an <b>exclusive</b> filter which removes matching lines, "
|
||||||
"prefix the filter expression with a <kbd>!</kbd> (exclamation mark).</p>"
|
"prefix the filter expression with a <kbd>!</kbd> (exclamation mark).</p>"
|
||||||
"<p>To use <b>Regular Expressions</b> (RegEx), prefix the filter text with a <kbd>/</kbd> (slash) or <kbd>^</kbd> (up caret). "
|
"<p>To use <b>Regular Expressions</b> (RegEx), prefix the filter text with a <kbd>/</kbd> (slash) or <kbd>^</kbd> (up caret). "
|
||||||
|
@ -280,8 +280,9 @@ void DebugOutput::on_actionShowFilterHelp_triggered()
|
||||||
"<li>If the RegEx is invalid, the filter edit field should show a red border and you will not be able to enable the filter.</li>"
|
"<li>If the RegEx is invalid, the filter edit field should show a red border and you will not be able to enable the filter.</li>"
|
||||||
"<li>A useful resource for testing REs (with a full reference) can be found at <a href=\"http://www.regexr.com/\">http://www.regexr.com/</a></li>"
|
"<li>A useful resource for testing REs (with a full reference) can be found at <a href=\"http://www.regexr.com/\">http://www.regexr.com/</a></li>"
|
||||||
"</ul></p>"
|
"</ul></p>"
|
||||||
"<p>To use <b>basic matching</b> just type any text. Wildcards <kbd>*</kbd> (asterisk) matches any text and <kbd>?</kbd> (question mark) matches any single character."
|
"<p>To use <b>basic matching</b> just type any text."
|
||||||
"<ul>"
|
"<ul>"
|
||||||
|
"<li>Wildcards: <kbd>*</kbd> (asterisk) matches zero or more of any character(s), and <kbd>?</kbd> (question mark) matches any single character.</li>"
|
||||||
"<li>The match is always case-insensitive.</li>"
|
"<li>The match is always case-insensitive.</li>"
|
||||||
"<li>The match always starts from the beginning of a log line. To ignore characters at the start, use a leading <kbd>*</kbd> wildcard.</li>"
|
"<li>The match always starts from the beginning of a log line. To ignore characters at the start, use a leading <kbd>*</kbd> wildcard.</li>"
|
||||||
"<li>A trailing <kbd>*</kbd> is always implied (that is, matches anything to the end of the log line). To avoid this, use a RegEx.</li>"
|
"<li>A trailing <kbd>*</kbd> is always implied (that is, matches anything to the end of the log line). To avoid this, use a RegEx.</li>"
|
||||||
|
@ -291,7 +292,7 @@ void DebugOutput::on_actionShowFilterHelp_triggered()
|
||||||
"<p>To <b>remove an entry</b> from the filter selector list, first choose it, and while in the line editor press <kbd>Shift-Delete</kbd> (or <kbd>Shift-Backspace</kbd>) key combination. "
|
"<p>To <b>remove an entry</b> from the filter selector list, first choose it, and while in the line editor press <kbd>Shift-Delete</kbd> (or <kbd>Shift-Backspace</kbd>) key combination. "
|
||||||
"The default filters cannot be removed. Up to 50 filters are stored.</p>"
|
"The default filters cannot be removed. Up to 50 filters are stored.</p>"
|
||||||
"</body></html>"
|
"</body></html>"
|
||||||
;
|
);
|
||||||
QMessageBox * msgbox = new QMessageBox(QMessageBox::NoIcon, tr("Debug Console Filter Help"), help, QMessageBox::Ok, this);
|
QMessageBox * msgbox = new QMessageBox(QMessageBox::NoIcon, tr("Debug Console Filter Help"), help, QMessageBox::Ok, this);
|
||||||
msgbox->exec();
|
msgbox->exec();
|
||||||
}
|
}
|
||||||
|
@ -341,7 +342,6 @@ QRegularExpression DebugOutput::makeRegEx(const QString & input, bool * isExlusi
|
||||||
reFlags |= QRegularExpression::CaseInsensitiveOption;
|
reFlags |= QRegularExpression::CaseInsensitiveOption;
|
||||||
re.setPattern(output);
|
re.setPattern(output);
|
||||||
}
|
}
|
||||||
// TODO : user option?
|
|
||||||
re.setPatternOptions(reFlags);
|
re.setPatternOptions(reFlags);
|
||||||
return re;
|
return re;
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,8 +234,8 @@ void RadioOutputsWidget::setupGVarsDisplay()
|
||||||
gvarsLayout->addWidget(label, gv+1, 0);
|
gvarsLayout->addWidget(label, gv+1, 0);
|
||||||
for (int fm=0; fm < fmodes; fm++) {
|
for (int fm=0; fm < fmodes; fm++) {
|
||||||
QLabel * value = new QLabel(gvarsWidget);
|
QLabel * value = new QLabel(gvarsWidget);
|
||||||
value->setAutoFillBackground(true);
|
|
||||||
value->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
value->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
|
value->setAutoFillBackground(true);
|
||||||
value->setBackgroundRole(bgrole);
|
value->setBackgroundRole(bgrole);
|
||||||
value->setText("0");
|
value->setText("0");
|
||||||
value->setStyleSheet("padding-right: .06em;");
|
value->setStyleSheet("padding-right: .06em;");
|
||||||
|
@ -272,43 +272,38 @@ void RadioOutputsWidget::setupLsDisplay()
|
||||||
// populate logical switches
|
// populate logical switches
|
||||||
int rows = switches / (switches > 16 ? 4 : 2);
|
int rows = switches / (switches > 16 ? 4 : 2);
|
||||||
for (int i=0; i < switches; i++) {
|
for (int i=0; i < switches; i++) {
|
||||||
QLabel * lsLbl = new QLabel;
|
logicalSwitchesLayout->addWidget(createLogicalSwitch(logicalSwitches, i), i / rows, i % rows, 1, 1);
|
||||||
logicalSwitchesLayout->addWidget(createLogicalSwitch(logicalSwitches, i, lsLbl), i / rows, i % rows, 1, 1);
|
|
||||||
m_logicSwitchMap.insert(i, lsLbl);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget * RadioOutputsWidget::createLogicalSwitch(QWidget * parent, int switchNo, QLabel * label)
|
QWidget * RadioOutputsWidget::createLogicalSwitch(QWidget * parent, int switchNo)
|
||||||
{
|
{
|
||||||
QFrame * swtch = new QFrame(parent);
|
QLabel * swtch = new QLabel(parent);
|
||||||
swtch->setAutoFillBackground(true);
|
swtch->setAutoFillBackground(true);
|
||||||
swtch->setFrameShape(QFrame::Panel);
|
swtch->setFrameStyle(QFrame::Panel | QFrame::Raised);
|
||||||
swtch->setFrameShadow(QFrame::Raised);
|
swtch->setLineWidth(2);
|
||||||
swtch->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
swtch->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
swtch->setMaximumHeight(18);
|
QFont font = swtch->font();
|
||||||
QVBoxLayout * layout = new QVBoxLayout(swtch);
|
font.setBold(true);
|
||||||
layout->setContentsMargins(2, 0, 2, 0);
|
swtch->setFont(font);
|
||||||
if (label) {
|
swtch->setMinimumWidth(swtch->fontMetrics().width("99") + 10);
|
||||||
QFont font;
|
font.setBold(false);
|
||||||
font.setPointSize(8);
|
swtch->setFont(font);
|
||||||
label->setParent(swtch);
|
swtch->setText(QString("%1").arg(RawSwitch(SWITCH_TYPE_VIRTUAL, switchNo+1).toString().remove("L"), 2, QLatin1Char('0')));
|
||||||
label->setFont(font);
|
swtch->setAlignment(Qt::AlignCenter);
|
||||||
label->setText(RawSwitch(SWITCH_TYPE_VIRTUAL, switchNo+1).toString());
|
m_logicSwitchMap.insert(switchNo, swtch);
|
||||||
label->setAlignment(Qt::AlignCenter);
|
|
||||||
label->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
|
||||||
label->setAutoFillBackground(true);
|
|
||||||
layout->addWidget(label);
|
|
||||||
}
|
|
||||||
return swtch;
|
return swtch;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read various values from firmware simulator and populate values in this UI
|
// Read various values from firmware simulator and populate values in this UI
|
||||||
void RadioOutputsWidget::setValues()
|
void RadioOutputsWidget::setValues()
|
||||||
{
|
{
|
||||||
static int lastPhase = 0;
|
static int lastPhase = -1;
|
||||||
static TxOutputs prevOutputs = TxOutputs();
|
static TxOutputs prevOutputs = TxOutputs();
|
||||||
|
static bool firstGvarsRun = true;
|
||||||
int currentPhase;
|
int currentPhase;
|
||||||
TxOutputs outputs;
|
TxOutputs outputs;
|
||||||
|
QFont font;
|
||||||
|
|
||||||
m_simulator->getValues(outputs);
|
m_simulator->getValues(outputs);
|
||||||
currentPhase = m_simulator->getPhase();
|
currentPhase = m_simulator->getPhase();
|
||||||
|
@ -328,13 +323,17 @@ void RadioOutputsWidget::setValues()
|
||||||
for (ls = m_logicSwitchMap.constBegin(); ls != m_logicSwitchMap.constEnd(); ++ls) {
|
for (ls = m_logicSwitchMap.constBegin(); ls != m_logicSwitchMap.constEnd(); ++ls) {
|
||||||
if (ls.key() >= CPN_MAX_CSW || prevOutputs.vsw[ls.key()] == outputs.vsw[ls.key()])
|
if (ls.key() >= CPN_MAX_CSW || prevOutputs.vsw[ls.key()] == outputs.vsw[ls.key()])
|
||||||
continue;
|
continue;
|
||||||
ls.value()->setBackgroundRole(outputs.vsw[ls.key()] ? QPalette::Highlight : QPalette::Background);
|
ls.value()->setBackgroundRole(outputs.vsw[ls.key()] ? QPalette::Dark : QPalette::Background);
|
||||||
|
ls.value()->setForegroundRole(outputs.vsw[ls.key()] ? QPalette::BrightText : QPalette::WindowText);
|
||||||
|
ls.value()->setFrameShadow(outputs.vsw[ls.key()] ? QFrame::Sunken : QFrame::Raised);
|
||||||
|
font = ls.value()->font();
|
||||||
|
font.setBold(outputs.vsw[ls.key()]);
|
||||||
|
ls.value()->setFont(font);
|
||||||
prevOutputs.vsw[ls.key()] = outputs.vsw[ls.key()];
|
prevOutputs.vsw[ls.key()] = outputs.vsw[ls.key()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ui->globalVarsWidget->isVisible()) {
|
if (ui->globalVarsWidget->isVisible()) {
|
||||||
QFont font;
|
|
||||||
QPalette::ColorRole bgrole;
|
QPalette::ColorRole bgrole;
|
||||||
QHash<int, QHash<int, QLabel *> >::const_iterator gv;
|
QHash<int, QHash<int, QLabel *> >::const_iterator gv;
|
||||||
QHash<int, QLabel *>::const_iterator fm;
|
QHash<int, QLabel *>::const_iterator fm;
|
||||||
|
@ -344,22 +343,23 @@ void RadioOutputsWidget::setValues()
|
||||||
for (fm = gv.value().constBegin(); fm != gv.value().constEnd(); ++fm) {
|
for (fm = gv.value().constBegin(); fm != gv.value().constEnd(); ++fm) {
|
||||||
if (fm.key() >= CPN_MAX_FLIGHT_MODES)
|
if (fm.key() >= CPN_MAX_FLIGHT_MODES)
|
||||||
continue;
|
continue;
|
||||||
if (currentPhase != lastPhase || prevOutputs.gvars[fm.key()][gv.key()] != outputs.gvars[fm.key()][gv.key()]) {
|
if (currentPhase != lastPhase || prevOutputs.gvars[fm.key()][gv.key()] != outputs.gvars[fm.key()][gv.key()] || firstGvarsRun) {
|
||||||
font = fm.value()->font();
|
if (fm.key() == currentPhase)
|
||||||
bgrole = ((gv.key() % 2) ? QPalette::Background : QPalette::AlternateBase);
|
bgrole = QPalette::Dark;
|
||||||
if (fm.key() == lastPhase) {
|
else
|
||||||
font.setBold(true);
|
bgrole = ((gv.key() % 2) ? QPalette::Background : QPalette::AlternateBase);
|
||||||
bgrole = QPalette::Highlight;
|
|
||||||
}
|
|
||||||
fm.value()->setText(QString::number(outputs.gvars[fm.key()][gv.key()]));
|
|
||||||
fm.value()->setFont(font);
|
|
||||||
fm.value()->setBackgroundRole(bgrole);
|
fm.value()->setBackgroundRole(bgrole);
|
||||||
|
fm.value()->setForegroundRole(fm.key() == currentPhase ? QPalette::BrightText : QPalette::WindowText);
|
||||||
|
font = fm.value()->font();
|
||||||
|
font.setBold(fm.key() == currentPhase);
|
||||||
|
fm.value()->setFont(font);
|
||||||
|
fm.value()->setText(QString::number(outputs.gvars[fm.key()][gv.key()]));
|
||||||
prevOutputs.gvars[fm.key()][gv.key()] = outputs.gvars[fm.key()][gv.key()];
|
prevOutputs.gvars[fm.key()][gv.key()] = outputs.gvars[fm.key()][gv.key()];
|
||||||
|
firstGvarsRun = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentPhase != lastPhase)
|
lastPhase = currentPhase;
|
||||||
lastPhase = currentPhase;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ class RadioOutputsWidget : public QWidget
|
||||||
void setupChannelsDisplay();
|
void setupChannelsDisplay();
|
||||||
void setupLsDisplay();
|
void setupLsDisplay();
|
||||||
void setupGVarsDisplay();
|
void setupGVarsDisplay();
|
||||||
QWidget * createLogicalSwitch(QWidget * parent, int switchNo, QLabel * label);
|
QWidget * createLogicalSwitch(QWidget * parent, int switchNo);
|
||||||
|
|
||||||
SimulatorInterface * m_simulator;
|
SimulatorInterface * m_simulator;
|
||||||
Firmware * m_firmware;
|
Firmware * m_firmware;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
<string>Companion Simulator</string>
|
<string>Companion Simulator</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset resource="../companion.qrc">
|
<iconset>
|
||||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
|
@ -307,8 +307,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources/>
|
||||||
<include location="../companion.qrc"/>
|
|
||||||
</resources>
|
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
extern AppData g; // ensure what "g" means
|
extern AppData g; // ensure what "g" means
|
||||||
|
|
||||||
const quint16 SimulatorMainWindow::m_savedUiStateVersion = 1;
|
const quint16 SimulatorMainWindow::m_savedUiStateVersion = 2;
|
||||||
|
|
||||||
SimulatorMainWindow::SimulatorMainWindow(QWidget *parent, SimulatorInterface * simulator, quint8 flags, Qt::WindowFlags wflags) :
|
SimulatorMainWindow::SimulatorMainWindow(QWidget *parent, SimulatorInterface * simulator, quint8 flags, Qt::WindowFlags wflags) :
|
||||||
QMainWindow(parent, wflags),
|
QMainWindow(parent, wflags),
|
||||||
|
@ -51,28 +51,21 @@ SimulatorMainWindow::SimulatorMainWindow(QWidget *parent, SimulatorInterface * s
|
||||||
m_trainerDockWidget(NULL),
|
m_trainerDockWidget(NULL),
|
||||||
m_outputsDockWidget(NULL),
|
m_outputsDockWidget(NULL),
|
||||||
m_radioProfileId(g.sessionId()),
|
m_radioProfileId(g.sessionId()),
|
||||||
|
m_radioSizeConstraint(Qt::Horizontal | Qt::Vertical),
|
||||||
m_firstShow(true),
|
m_firstShow(true),
|
||||||
m_showRadioTitlebar(true),
|
m_showRadioDocked(true),
|
||||||
m_showMenubar(true)
|
m_showMenubar(true)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->centralwidget->hide();
|
|
||||||
|
|
||||||
//#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
|
||||||
// setDockOptions(dockOptions() | QMainWindow::GroupedDragging);
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
|
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
|
||||||
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
||||||
|
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
|
||||||
|
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
|
||||||
|
|
||||||
m_simulatorWidget = new SimulatorDialog(this, m_simulator, flags);
|
m_simulatorWidget = new SimulatorDialog(this, m_simulator, flags);
|
||||||
|
|
||||||
m_simulatorDockWidget = new QDockWidget(m_simulatorWidget->windowTitle(), this);
|
toggleRadioDocked(true);
|
||||||
m_simulatorDockWidget->setObjectName("RADIO_SIMULATOR");
|
|
||||||
m_simulatorDockWidget->setWidget(m_simulatorWidget);
|
|
||||||
m_simulatorDockWidget->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
|
|
||||||
addDockWidget(Qt::BottomDockWidgetArea, m_simulatorDockWidget);
|
|
||||||
// setCentralWidget(m_simulatorWidget);
|
|
||||||
|
|
||||||
createDockWidgets();
|
createDockWidgets();
|
||||||
|
|
||||||
ui->actionReloadLua->setIcon(SimulatorIcon("reload_script"));
|
ui->actionReloadLua->setIcon(SimulatorIcon("reload_script"));
|
||||||
|
@ -80,8 +73,10 @@ SimulatorMainWindow::SimulatorMainWindow(QWidget *parent, SimulatorInterface * s
|
||||||
ui->actionJoystickSettings->setIcon(SimulatorIcon("joystick_settings"));
|
ui->actionJoystickSettings->setIcon(SimulatorIcon("joystick_settings"));
|
||||||
ui->actionScreenshot->setIcon(SimulatorIcon("camera"));
|
ui->actionScreenshot->setIcon(SimulatorIcon("camera"));
|
||||||
ui->actionShowKeymap->setIcon(SimulatorIcon("info"));
|
ui->actionShowKeymap->setIcon(SimulatorIcon("info"));
|
||||||
ui->actionToggleRadioTitle->setIcon(ui->toolBar->toggleViewAction()->icon());
|
|
||||||
ui->actionToggleMenuBar->setIcon(ui->toolBar->toggleViewAction()->icon());
|
ui->actionToggleMenuBar->setIcon(ui->toolBar->toggleViewAction()->icon());
|
||||||
|
ui->actionFixedRadioWidth->setIcon(ui->toolBar->toggleViewAction()->icon());
|
||||||
|
ui->actionFixedRadioHeight->setIcon(ui->toolBar->toggleViewAction()->icon());
|
||||||
|
ui->actionDockRadio->setIcon(ui->toolBar->toggleViewAction()->icon());
|
||||||
|
|
||||||
ui->toolBar->toggleViewAction()->setShortcut(tr("Alt+T"));
|
ui->toolBar->toggleViewAction()->setShortcut(tr("Alt+T"));
|
||||||
ui->toolBar->setIconSize(SimulatorIcon::toolbarIconSize(g.iconSize()));
|
ui->toolBar->setIconSize(SimulatorIcon::toolbarIconSize(g.iconSize()));
|
||||||
|
@ -91,10 +86,8 @@ SimulatorMainWindow::SimulatorMainWindow(QWidget *parent, SimulatorInterface * s
|
||||||
addAction(ui->toolBar->toggleViewAction());
|
addAction(ui->toolBar->toggleViewAction());
|
||||||
addAction(ui->actionToggleMenuBar);
|
addAction(ui->actionToggleMenuBar);
|
||||||
|
|
||||||
ui->menuView->addSeparator();
|
ui->menuView->insertSeparator(ui->actionToggleMenuBar);
|
||||||
ui->menuView->addAction(ui->toolBar->toggleViewAction());
|
ui->menuView->insertAction(ui->actionToggleMenuBar, ui->toolBar->toggleViewAction());
|
||||||
ui->menuView->addAction(ui->actionToggleMenuBar);
|
|
||||||
ui->menuView->addAction(ui->actionToggleRadioTitle);
|
|
||||||
|
|
||||||
// Hide some actions based on board capabilities.
|
// Hide some actions based on board capabilities.
|
||||||
Firmware * firmware = getCurrentFirmware();
|
Firmware * firmware = getCurrentFirmware();
|
||||||
|
@ -117,23 +110,16 @@ SimulatorMainWindow::SimulatorMainWindow(QWidget *parent, SimulatorInterface * s
|
||||||
connect(ui->actionShowKeymap, &QAction::triggered, this, &SimulatorMainWindow::showHelp);
|
connect(ui->actionShowKeymap, &QAction::triggered, this, &SimulatorMainWindow::showHelp);
|
||||||
connect(ui->actionJoystickSettings, &QAction::triggered, this, &SimulatorMainWindow::openJoystickDialog);
|
connect(ui->actionJoystickSettings, &QAction::triggered, this, &SimulatorMainWindow::openJoystickDialog);
|
||||||
connect(ui->actionReloadLua, &QAction::triggered, this, &SimulatorMainWindow::luaReload);
|
connect(ui->actionReloadLua, &QAction::triggered, this, &SimulatorMainWindow::luaReload);
|
||||||
connect(ui->actionToggleRadioTitle, &QAction::toggled, this, &SimulatorMainWindow::showRadioTitlebar);
|
connect(ui->actionToggleMenuBar, &QAction::toggled, this, &SimulatorMainWindow::showMenuBar);
|
||||||
connect(ui->actionToggleMenuBar, &QAction::toggled, this, &SimulatorMainWindow::toggleMenuBar);
|
connect(ui->actionFixedRadioWidth, &QAction::toggled, this, &SimulatorMainWindow::showRadioFixedWidth);
|
||||||
|
connect(ui->actionFixedRadioHeight, &QAction::toggled, this, &SimulatorMainWindow::showRadioFixedHeight);
|
||||||
|
connect(ui->actionDockRadio, &QAction::toggled, this, &SimulatorMainWindow::showRadioDocked);
|
||||||
if (m_simulatorWidget) {
|
if (m_simulatorWidget) {
|
||||||
connect(ui->actionScreenshot, &QAction::triggered, m_simulatorWidget, &SimulatorDialog::captureScreenshot);
|
connect(ui->actionScreenshot, &QAction::triggered, m_simulatorWidget, &SimulatorDialog::captureScreenshot);
|
||||||
connect(ui->actionReloadRadioData, &QAction::triggered, m_simulatorWidget, &SimulatorDialog::restart);
|
connect(ui->actionReloadRadioData, &QAction::triggered, m_simulatorWidget, &SimulatorDialog::restart);
|
||||||
}
|
}
|
||||||
if (m_outputsWidget)
|
if (m_outputsWidget)
|
||||||
connect(ui->actionReloadRadioData, &QAction::triggered, m_outputsWidget, &RadioOutputsWidget::restart);
|
connect(ui->actionReloadRadioData, &QAction::triggered, m_outputsWidget, &RadioOutputsWidget::restart);
|
||||||
|
|
||||||
// this sets the radio widget to a fixed width while docked, freeform while floating
|
|
||||||
connect(m_simulatorDockWidget, &QDockWidget::topLevelChanged, [this](bool top) {
|
|
||||||
if (top)
|
|
||||||
m_simulatorWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
|
||||||
else
|
|
||||||
m_simulatorWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulatorMainWindow::~SimulatorMainWindow()
|
SimulatorMainWindow::~SimulatorMainWindow()
|
||||||
|
@ -155,6 +141,20 @@ void SimulatorMainWindow::closeEvent(QCloseEvent *)
|
||||||
delete m_outputsDockWidget;
|
delete m_outputsDockWidget;
|
||||||
if (m_simulatorDockWidget)
|
if (m_simulatorDockWidget)
|
||||||
delete m_simulatorDockWidget;
|
delete m_simulatorDockWidget;
|
||||||
|
else if (m_simulatorWidget)
|
||||||
|
delete m_simulatorWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorMainWindow::show()
|
||||||
|
{
|
||||||
|
QMainWindow::show();
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
// for whatever reason, w/out this workaround any floating docks may appear and get "stuck" behind other windows, eg. Terminal or Companion.
|
||||||
|
if (m_firstShow) {
|
||||||
|
restoreUiState();
|
||||||
|
m_firstShow = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulatorMainWindow::changeEvent(QEvent *e)
|
void SimulatorMainWindow::changeEvent(QEvent *e)
|
||||||
|
@ -169,10 +169,10 @@ void SimulatorMainWindow::changeEvent(QEvent *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu* SimulatorMainWindow::createPopupMenu(){
|
QMenu * SimulatorMainWindow::createPopupMenu(){
|
||||||
QMenu * menu = QMainWindow::createPopupMenu();
|
QMenu * menu = QMainWindow::createPopupMenu();
|
||||||
menu->addAction(ui->actionToggleMenuBar);
|
menu->clear();
|
||||||
menu->addAction(ui->actionToggleRadioTitle);
|
menu->addActions(ui->menuView->actions());
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,8 @@ void SimulatorMainWindow::saveUiState()
|
||||||
{
|
{
|
||||||
QByteArray state;
|
QByteArray state;
|
||||||
QDataStream stream(&state, QIODevice::WriteOnly);
|
QDataStream stream(&state, QIODevice::WriteOnly);
|
||||||
stream << m_savedUiStateVersion << saveState() << m_showMenubar << m_showRadioTitlebar;
|
stream << m_savedUiStateVersion << saveState(m_savedUiStateVersion)
|
||||||
|
<< m_showMenubar << m_showRadioDocked << m_radioSizeConstraint;
|
||||||
|
|
||||||
SimulatorOptions opts = g.profile[m_radioProfileId].simulatorOptions();
|
SimulatorOptions opts = g.profile[m_radioProfileId].simulatorOptions();
|
||||||
opts.windowState = state;
|
opts.windowState = state;
|
||||||
|
@ -196,13 +197,17 @@ void SimulatorMainWindow::restoreUiState()
|
||||||
QDataStream stream(state);
|
QDataStream stream(state);
|
||||||
|
|
||||||
stream >> ver;
|
stream >> ver;
|
||||||
if (ver && ver <= m_savedUiStateVersion)
|
if (ver && ver <= m_savedUiStateVersion) {
|
||||||
stream >> windowState >> m_showMenubar >> m_showRadioTitlebar;
|
stream >> windowState >> m_showMenubar >> m_showRadioDocked;
|
||||||
|
if (ver >= 2)
|
||||||
|
stream >> m_radioSizeConstraint;
|
||||||
|
}
|
||||||
|
|
||||||
restoreState(windowState);
|
toggleRadioDocked(m_showRadioDocked);
|
||||||
restoreGeometry(g.profile[m_radioProfileId].simulatorOptions().windowGeometry);
|
setRadioSizePolicy(m_radioSizeConstraint);
|
||||||
showRadioTitlebar(m_showRadioTitlebar);
|
|
||||||
toggleMenuBar(m_showMenubar);
|
toggleMenuBar(m_showMenubar);
|
||||||
|
restoreGeometry(g.profile[m_radioProfileId].simulatorOptions().windowGeometry);
|
||||||
|
restoreState(windowState, m_savedUiStateVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SimulatorMainWindow::setRadioData(RadioData * radioData)
|
bool SimulatorMainWindow::setRadioData(RadioData * radioData)
|
||||||
|
@ -236,17 +241,15 @@ void SimulatorMainWindow::createDockWidgets()
|
||||||
SimulatorIcon icon("radio_outputs");
|
SimulatorIcon icon("radio_outputs");
|
||||||
m_outputsDockWidget = new QDockWidget(tr("Radio Outputs"), this);
|
m_outputsDockWidget = new QDockWidget(tr("Radio Outputs"), this);
|
||||||
m_outputsWidget = new RadioOutputsWidget(m_simulator, getCurrentFirmware(), this);
|
m_outputsWidget = new RadioOutputsWidget(m_simulator, getCurrentFirmware(), this);
|
||||||
m_outputsWidget->setWindowIcon(icon);
|
|
||||||
m_outputsDockWidget->setWidget(m_outputsWidget);
|
m_outputsDockWidget->setWidget(m_outputsWidget);
|
||||||
m_outputsDockWidget->setObjectName("OUTPUTS");
|
m_outputsDockWidget->setObjectName("OUTPUTS");
|
||||||
addTool(m_outputsDockWidget, Qt::BottomDockWidgetArea, icon, QKeySequence(tr("F2")));
|
addTool(m_outputsDockWidget, Qt::RightDockWidgetArea, icon, QKeySequence(tr("F2")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_telemetryDockWidget) {
|
if (!m_telemetryDockWidget) {
|
||||||
SimulatorIcon icon("telemetry");
|
SimulatorIcon icon("telemetry");
|
||||||
m_telemetryDockWidget = new QDockWidget(tr("Telemetry Simulator"), this);
|
m_telemetryDockWidget = new QDockWidget(tr("Telemetry Simulator"), this);
|
||||||
TelemetrySimulator * telem = new TelemetrySimulator(this, m_simulator);
|
TelemetrySimulator * telem = new TelemetrySimulator(this, m_simulator);
|
||||||
telem->setWindowIcon(icon);
|
|
||||||
m_telemetryDockWidget->setWidget(telem);
|
m_telemetryDockWidget->setWidget(telem);
|
||||||
m_telemetryDockWidget->setObjectName("TELEMETRY_SIMULATOR");
|
m_telemetryDockWidget->setObjectName("TELEMETRY_SIMULATOR");
|
||||||
addTool(m_telemetryDockWidget, Qt::LeftDockWidgetArea, icon, QKeySequence(tr("F4")));
|
addTool(m_telemetryDockWidget, Qt::LeftDockWidgetArea, icon, QKeySequence(tr("F4")));
|
||||||
|
@ -256,7 +259,6 @@ void SimulatorMainWindow::createDockWidgets()
|
||||||
SimulatorIcon icon("trainer");
|
SimulatorIcon icon("trainer");
|
||||||
m_trainerDockWidget = new QDockWidget(tr("Trainer Simulator"), this);
|
m_trainerDockWidget = new QDockWidget(tr("Trainer Simulator"), this);
|
||||||
TrainerSimulator * trainer = new TrainerSimulator(this, m_simulator);
|
TrainerSimulator * trainer = new TrainerSimulator(this, m_simulator);
|
||||||
trainer->setWindowIcon(icon);
|
|
||||||
m_trainerDockWidget->setWidget(trainer);
|
m_trainerDockWidget->setWidget(trainer);
|
||||||
m_trainerDockWidget->setObjectName("TRAINER_SIMULATOR");
|
m_trainerDockWidget->setObjectName("TRAINER_SIMULATOR");
|
||||||
addTool(m_trainerDockWidget, Qt::TopDockWidgetArea, icon, QKeySequence(tr("F5")));
|
addTool(m_trainerDockWidget, Qt::TopDockWidgetArea, icon, QKeySequence(tr("F5")));
|
||||||
|
@ -266,7 +268,6 @@ void SimulatorMainWindow::createDockWidgets()
|
||||||
SimulatorIcon icon("console");
|
SimulatorIcon icon("console");
|
||||||
m_consoleDockWidget = new QDockWidget(tr("Debug Output"), this);
|
m_consoleDockWidget = new QDockWidget(tr("Debug Output"), this);
|
||||||
m_consoleWidget = new DebugOutput(this, m_simulator);
|
m_consoleWidget = new DebugOutput(this, m_simulator);
|
||||||
m_consoleWidget->setWindowIcon(icon);
|
|
||||||
m_consoleDockWidget->setWidget(m_consoleWidget);
|
m_consoleDockWidget->setWidget(m_consoleWidget);
|
||||||
m_consoleDockWidget->setObjectName("CONSOLE");
|
m_consoleDockWidget->setObjectName("CONSOLE");
|
||||||
addTool(m_consoleDockWidget, Qt::RightDockWidgetArea, icon, QKeySequence(tr("F6")));
|
addTool(m_consoleDockWidget, Qt::RightDockWidgetArea, icon, QKeySequence(tr("F6")));
|
||||||
|
@ -278,40 +279,148 @@ void SimulatorMainWindow::addTool(QDockWidget * widget, Qt::DockWidgetArea area,
|
||||||
QAction* tempAction = widget->toggleViewAction();
|
QAction* tempAction = widget->toggleViewAction();
|
||||||
tempAction->setIcon(icon);
|
tempAction->setIcon(icon);
|
||||||
tempAction->setShortcut(shortcut);
|
tempAction->setShortcut(shortcut);
|
||||||
ui->menuView->addAction(tempAction);
|
ui->menuView->insertAction(ui->actionToggleMenuBar, tempAction);
|
||||||
ui->toolBar->insertAction(ui->actionReloadLua, tempAction);
|
ui->toolBar->insertAction(ui->actionReloadLua, tempAction);
|
||||||
widget->setAllowedAreas(Qt::AllDockWidgetAreas);
|
|
||||||
widget->setWindowIcon(icon);
|
widget->setWindowIcon(icon);
|
||||||
|
widget->widget()->setWindowIcon(icon);
|
||||||
addDockWidget(area, widget);
|
addDockWidget(area, widget);
|
||||||
widget->hide();
|
widget->hide();
|
||||||
widget->setFloating(true);
|
widget->setFloating(true);
|
||||||
|
|
||||||
|
// Upon subsequent launches of application, any previously un-shown floating widgets get
|
||||||
|
// positioned at screen location (0,0 - frameGeometry.topLeft) which is awkward at best.
|
||||||
|
// This ensures newly shown floating widgets don't get stuck in top left corner.
|
||||||
|
connect(widget, &QDockWidget::visibilityChanged, [this, widget](bool visible) {
|
||||||
|
if (visible && widget->isFloating() && widget->geometry().topLeft() == QPoint(0,0)) {
|
||||||
|
// position top left corner in middle of this parent window.
|
||||||
|
QPoint newPos(pos() + (geometry().bottomRight() - geometry().topLeft()) / 2);
|
||||||
|
widget->move(newPos);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulatorMainWindow::showRadioTitlebar(bool show)
|
void SimulatorMainWindow::showMenuBar(bool show)
|
||||||
{
|
{
|
||||||
m_showRadioTitlebar = show;
|
if (m_showMenubar != show)
|
||||||
if (show) {
|
toggleMenuBar(show);
|
||||||
QWidget * w = m_simulatorDockWidget->titleBarWidget();
|
|
||||||
if (w)
|
|
||||||
w->deleteLater();
|
|
||||||
m_simulatorDockWidget->setTitleBarWidget(0);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_simulatorDockWidget->setTitleBarWidget(new QWidget());
|
|
||||||
}
|
|
||||||
if (ui->actionToggleRadioTitle->isChecked() != show)
|
|
||||||
ui->actionToggleRadioTitle->setChecked(show);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulatorMainWindow::toggleMenuBar(bool show)
|
void SimulatorMainWindow::toggleMenuBar(bool show)
|
||||||
{
|
{
|
||||||
m_showMenubar = show;
|
|
||||||
ui->menubar->setVisible(show);
|
ui->menubar->setVisible(show);
|
||||||
|
m_showMenubar = show;
|
||||||
if (ui->actionToggleMenuBar->isChecked() != show)
|
if (ui->actionToggleMenuBar->isChecked() != show)
|
||||||
ui->actionToggleMenuBar->setChecked(show);
|
ui->actionToggleMenuBar->setChecked(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SimulatorMainWindow::showRadioFixedSize(Qt::Orientation orientation, bool fixed)
|
||||||
|
{
|
||||||
|
int fix = m_radioSizeConstraint;
|
||||||
|
if (fixed)
|
||||||
|
fix |= orientation;
|
||||||
|
else
|
||||||
|
fix &= ~(orientation);
|
||||||
|
|
||||||
|
if (m_radioSizeConstraint != fix)
|
||||||
|
setRadioSizePolicy(fix);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorMainWindow::showRadioFixedWidth(bool fixed)
|
||||||
|
{
|
||||||
|
showRadioFixedSize(Qt::Horizontal, fixed);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorMainWindow::showRadioFixedHeight(bool fixed)
|
||||||
|
{
|
||||||
|
showRadioFixedSize(Qt::Vertical, fixed);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorMainWindow::setRadioSizePolicy(int fixType)
|
||||||
|
{
|
||||||
|
QSizePolicy sp;
|
||||||
|
sp.setHorizontalPolicy((fixType & Qt::Horizontal) ? QSizePolicy::Maximum : QSizePolicy::Preferred);
|
||||||
|
sp.setVerticalPolicy((fixType & Qt::Vertical) ? QSizePolicy::Maximum : QSizePolicy::Preferred);
|
||||||
|
m_simulatorWidget->setSizePolicy(sp);
|
||||||
|
|
||||||
|
m_radioSizeConstraint = fixType;
|
||||||
|
|
||||||
|
if (ui->actionFixedRadioWidth->isChecked() != (fixType & Qt::Horizontal))
|
||||||
|
ui->actionFixedRadioWidth->setChecked((fixType & Qt::Horizontal));
|
||||||
|
if (ui->actionFixedRadioHeight->isChecked() != (fixType & Qt::Vertical))
|
||||||
|
ui->actionFixedRadioHeight->setChecked((fixType & Qt::Vertical));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorMainWindow::showRadioDocked(bool dock)
|
||||||
|
{
|
||||||
|
if (m_showRadioDocked != dock)
|
||||||
|
toggleRadioDocked(dock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimulatorMainWindow::toggleRadioDocked(bool dock)
|
||||||
|
{
|
||||||
|
if (!m_simulatorWidget)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (dock) {
|
||||||
|
if (m_simulatorDockWidget) {
|
||||||
|
m_simulatorDockWidget->setWidget(0);
|
||||||
|
m_simulatorDockWidget->deleteLater();
|
||||||
|
m_simulatorDockWidget = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget * w = takeCentralWidget();
|
||||||
|
if (w && w != m_simulatorWidget)
|
||||||
|
w->deleteLater();
|
||||||
|
setCentralWidget(m_simulatorWidget);
|
||||||
|
setRadioSizePolicy(m_radioSizeConstraint);
|
||||||
|
ui->actionFixedRadioWidth->setEnabled(true);
|
||||||
|
ui->actionFixedRadioHeight->setEnabled(true);
|
||||||
|
m_simulatorWidget->show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
if (m_simulatorDockWidget) {
|
||||||
|
m_simulatorDockWidget->deleteLater();
|
||||||
|
m_simulatorDockWidget = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
takeCentralWidget();
|
||||||
|
QLabel * dummy = new QLabel("");
|
||||||
|
dummy->setFixedSize(0, 0);
|
||||||
|
dummy->setEnabled(false);
|
||||||
|
setCentralWidget(dummy);
|
||||||
|
|
||||||
|
m_simulatorDockWidget = new QDockWidget(m_simulatorWidget->windowTitle(), this);
|
||||||
|
m_simulatorDockWidget->setObjectName("RADIO_SIMULATOR");
|
||||||
|
m_simulatorDockWidget->setWidget(m_simulatorWidget);
|
||||||
|
m_simulatorDockWidget->setFeatures(QDockWidget::DockWidgetFloatable);
|
||||||
|
m_simulatorDockWidget->setAllowedAreas(Qt::BottomDockWidgetArea);
|
||||||
|
addDockWidget(Qt::BottomDockWidgetArea, m_simulatorDockWidget);
|
||||||
|
m_simulatorDockWidget->setFloating(true);
|
||||||
|
m_simulatorWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||||
|
ui->actionFixedRadioWidth->setDisabled(true);
|
||||||
|
ui->actionFixedRadioHeight->setDisabled(true);
|
||||||
|
restoreDockWidget(m_simulatorDockWidget);
|
||||||
|
if (!m_simulatorDockWidget->isVisible())
|
||||||
|
m_simulatorDockWidget->show();
|
||||||
|
if (m_simulatorDockWidget->geometry().topLeft() == QPoint(0,0) && this->isVisible()) {
|
||||||
|
// default position top left corner in middle of this parent window.
|
||||||
|
QPoint newPos(pos() + (geometry().bottomRight() - geometry().topLeft()) / 2);
|
||||||
|
m_simulatorDockWidget->move(newPos);
|
||||||
|
}
|
||||||
|
|
||||||
|
connect(m_simulatorDockWidget, &QDockWidget::topLevelChanged, [this](bool top) {
|
||||||
|
showRadioDocked(!top);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
m_showRadioDocked = dock;
|
||||||
|
|
||||||
|
if (ui->actionDockRadio->isChecked() != dock)
|
||||||
|
ui->actionDockRadio->setChecked(dock);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void SimulatorMainWindow::luaReload(bool)
|
void SimulatorMainWindow::luaReload(bool)
|
||||||
{
|
{
|
||||||
// force a reload of the lua environment
|
// force a reload of the lua environment
|
||||||
|
|
|
@ -57,15 +57,22 @@ class SimulatorMainWindow : public QMainWindow
|
||||||
QMenu * createPopupMenu();
|
QMenu * createPopupMenu();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
virtual void show();
|
||||||
void start();
|
void start();
|
||||||
void showRadioTitlebar(bool show);
|
void showMenuBar(bool show);
|
||||||
void toggleMenuBar(bool show);
|
void showRadioFixedSize(Qt::Orientation orientation, bool fixed);
|
||||||
|
void showRadioFixedWidth(bool fixed);
|
||||||
|
void showRadioFixedHeight(bool fixed);
|
||||||
|
void showRadioDocked(bool dock);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void closeEvent(QCloseEvent *);
|
virtual void closeEvent(QCloseEvent *);
|
||||||
virtual void changeEvent(QEvent *e);
|
virtual void changeEvent(QEvent *e);
|
||||||
void restoreUiState();
|
void restoreUiState();
|
||||||
void saveUiState();
|
void saveUiState();
|
||||||
|
void toggleMenuBar(bool show);
|
||||||
|
void setRadioSizePolicy(int fixType);
|
||||||
|
void toggleRadioDocked(bool dock);
|
||||||
void luaReload(bool);
|
void luaReload(bool);
|
||||||
void openJoystickDialog(bool);
|
void openJoystickDialog(bool);
|
||||||
void showHelp(bool show);
|
void showHelp(bool show);
|
||||||
|
@ -89,8 +96,9 @@ class SimulatorMainWindow : public QMainWindow
|
||||||
|
|
||||||
QVector<keymapHelp_t> m_keymapHelp;
|
QVector<keymapHelp_t> m_keymapHelp;
|
||||||
int m_radioProfileId;
|
int m_radioProfileId;
|
||||||
|
int m_radioSizeConstraint;
|
||||||
bool m_firstShow;
|
bool m_firstShow;
|
||||||
bool m_showRadioTitlebar;
|
bool m_showRadioDocked;
|
||||||
bool m_showMenubar;
|
bool m_showMenubar;
|
||||||
|
|
||||||
const static quint16 m_savedUiStateVersion;
|
const static quint16 m_savedUiStateVersion;
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<string>OpenTx Simulator</string>
|
<string>OpenTx Simulator</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset>
|
<iconset resource="../companion.qrc">
|
||||||
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
<normaloff>:/icon.png</normaloff>:/icon.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="dockNestingEnabled">
|
<property name="dockNestingEnabled">
|
||||||
|
@ -23,7 +23,14 @@
|
||||||
<property name="dockOptions">
|
<property name="dockOptions">
|
||||||
<set>QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks</set>
|
<set>QMainWindow::AllowNestedDocks|QMainWindow::AllowTabbedDocks|QMainWindow::AnimatedDocks</set>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget"/>
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Ignored" vsizetype="Ignored">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
<widget class="QMenuBar" name="menubar">
|
<widget class="QMenuBar" name="menubar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
|
@ -40,6 +47,16 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>View</string>
|
<string>View</string>
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QMenu" name="menuRadio_Window">
|
||||||
|
<property name="title">
|
||||||
|
<string>Radio Window</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionFixedRadioWidth"/>
|
||||||
|
<addaction name="actionFixedRadioHeight"/>
|
||||||
|
<addaction name="actionDockRadio"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="actionToggleMenuBar"/>
|
||||||
|
<addaction name="menuRadio_Window"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuReload">
|
<widget class="QMenu" name="menuReload">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
@ -79,7 +96,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
<action name="actionReloadLua">
|
<action name="actionReloadLua">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="../companion.qrc">
|
||||||
<normaloff>:/images/simulator/icons/svg/reload_script.svg</normaloff>:/images/simulator/icons/svg/reload_script.svg</iconset>
|
<normaloff>:/images/simulator/icons/svg/reload_script.svg</normaloff>:/images/simulator/icons/svg/reload_script.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -94,7 +111,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionReloadRadioData">
|
<action name="actionReloadRadioData">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="../companion.qrc">
|
||||||
<normaloff>:/images/simulator/icons/svg/restart.svg</normaloff>:/images/simulator/icons/svg/restart.svg</iconset>
|
<normaloff>:/images/simulator/icons/svg/restart.svg</normaloff>:/images/simulator/icons/svg/restart.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -109,7 +126,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionShowKeymap">
|
<action name="actionShowKeymap">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="../companion.qrc">
|
||||||
<normaloff>:/images/simulator/icons/svg/info.svg</normaloff>:/images/simulator/icons/svg/info.svg</iconset>
|
<normaloff>:/images/simulator/icons/svg/info.svg</normaloff>:/images/simulator/icons/svg/info.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -124,7 +141,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionJoystickSettings">
|
<action name="actionJoystickSettings">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="../companion.qrc">
|
||||||
<normaloff>:/images/simulator/icons/svg/joystick_settings.svg</normaloff>:/images/simulator/icons/svg/joystick_settings.svg</iconset>
|
<normaloff>:/images/simulator/icons/svg/joystick_settings.svg</normaloff>:/images/simulator/icons/svg/joystick_settings.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -139,7 +156,7 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionScreenshot">
|
<action name="actionScreenshot">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="../companion.qrc">
|
||||||
<normaloff>:/images/simulator/icons/svg/camera.svg</normaloff>:/images/simulator/icons/svg/camera.svg</iconset>
|
<normaloff>:/images/simulator/icons/svg/camera.svg</normaloff>:/images/simulator/icons/svg/camera.svg</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -152,15 +169,15 @@
|
||||||
<string>F8</string>
|
<string>F8</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionToggleRadioTitle">
|
<action name="actionDockRadio">
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Radio Titlebar</string>
|
<string>Dock In Main Window</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>The title bar on the main radio window allows you to undock it or move it around separately from the other windows. Hiding the title makes a more compact and streamlined appearance.</p></body></html></string>
|
<string>Show the radio in the main window or as a separate "floating" window.</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionToggleMenuBar">
|
<action name="actionToggleMenuBar">
|
||||||
|
@ -177,7 +194,31 @@
|
||||||
<string>Alt+M</string>
|
<string>Alt+M</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionFixedRadioWidth">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Constrain Width</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Set radio widget width to be a fixed size.</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionFixedRadioHeight">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Constrain Height</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Set radio widget height to be a fixed size.</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="../companion.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue