From b478cef04b6e545bccb947e00f30ad94d468b7e4 Mon Sep 17 00:00:00 2001 From: elecpower <elecpower@users.noreply.github.com> Date: Thu, 16 Jan 2025 20:57:38 +1100 Subject: [PATCH] More menu tweaks and fixes --- companion/src/mainwindow.cpp | 3 +-- companion/src/mdichild.cpp | 24 +++++++++++++++--------- companion/src/mdichild.h | 1 + 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index f048d81e4dc..d1972d559ee 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -682,7 +682,7 @@ void MainWindow::updateMenus() readSettingsSDPathAct->setEnabled(isSDPathValid()); writeBUToRadioAct->setEnabled(false); readBUToFileAct->setEnabled(false); - editSplashAct->setDisabled(IS_FAMILY_HORUS_OR_T16(getCurrentBoard())); + editSplashAct->setDisabled(Boards::getBoardCapability(getCurrentBoard(), Board::HasColorLcd)); foreach (QAction * act, fileWindowActions) { if (!act) @@ -1003,7 +1003,6 @@ void MainWindow::createMenus() radioMenu->addAction(readFlashAct); radioMenu->addSeparator(); radioMenu->addAction(burnConfigAct); - radioMenu->addSeparator(); radioMenu->addAction(editSplashAct); settingsMenu = menuBar()->addMenu(""); diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index ad19d33098c..ab13be5d3e0 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -408,13 +408,11 @@ void MdiChild::retranslateUi() QList<QAction *> MdiChild::getGeneralActions() { QList<QAction *> actGrp; + actGrp.append(getAction(ACT_GEN_SIM)); + actGrp.append(actionsSeparator()); actGrp.append(getAction(ACT_GEN_EDT)); actGrp.append(getAction(ACT_GEN_CPY)); actGrp.append(getAction(ACT_GEN_PST)); - QAction * sep = new QAction(this); - sep->setSeparator(true); - actGrp.append(sep); - actGrp.append(getAction(ACT_GEN_SIM)); return actGrp; } @@ -422,9 +420,7 @@ QList<QAction *> MdiChild::getEditActions() { QList<QAction *> actGrp; actGrp.append(action[ACT_MDL_ADD]); - QAction * sep2 = new QAction(this); - sep2->setSeparator(true); - actGrp.append(sep2); + actGrp.append(actionsSeparator()); actGrp.append(getAction(ACT_MDL_EDT)); actGrp.append(getAction(ACT_MDL_DEL)); actGrp.append(getAction(ACT_MDL_CUT)); @@ -432,17 +428,20 @@ QList<QAction *> MdiChild::getEditActions() actGrp.append(getAction(ACT_MDL_PST)); actGrp.append(getAction(ACT_MDL_INS)); actGrp.append(getAction(ACT_MDL_DUP)); - actGrp.append(getAction(ACT_MDL_MOV)); actGrp.append(getAction(ACT_MDL_EXP)); + actGrp.append(getAction(ACT_MDL_MOV)); return actGrp; } QList<QAction *> MdiChild::getModelActions() { QList<QAction *> actGrp; - actGrp.append(getAction(ACT_MDL_RTR)); actGrp.append(getAction(ACT_MDL_WIZ)); actGrp.append(getAction(ACT_MDL_DFT)); + // TODO remove + // the function has been hobbled as expects eeprom binary backup so do not list + // can just open another etx so use case doubtful + //actGrp.append(getAction(ACT_MDL_RTR)); actGrp.append(getAction(ACT_MDL_PRT)); actGrp.append(getAction(ACT_MDL_SIM)); return actGrp; @@ -1848,3 +1847,10 @@ void MdiChild::setModelModified(const int modelIndex, bool cascade) setModified(); } } + +QAction * MdiChild::actionsSeparator() +{ + QAction * act = new QAction(this); + act->setSeparator(true); + return act; +} diff --git a/companion/src/mdichild.h b/companion/src/mdichild.h index ccaa7f82897..49f4cbc346c 100644 --- a/companion/src/mdichild.h +++ b/companion/src/mdichild.h @@ -231,6 +231,7 @@ class MdiChild : public QWidget AbstractStaticItemModel* modelSortOrderItemModel; QComboBox* cboModelSortOrder; void setModelModified(const int modelIndex, bool cascade = true); + QAction * actionsSeparator(); }; // This will draw the drop indicator across all columns of a model View (vs. in just one column), and lets us make the indicator more obvious.