Skip to content

Commit

Permalink
More menu tweaks and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
elecpower committed Jan 16, 2025
1 parent e70b793 commit b478cef
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
3 changes: 1 addition & 2 deletions companion/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -1003,7 +1003,6 @@ void MainWindow::createMenus()
radioMenu->addAction(readFlashAct);
radioMenu->addSeparator();
radioMenu->addAction(burnConfigAct);
radioMenu->addSeparator();
radioMenu->addAction(editSplashAct);

settingsMenu = menuBar()->addMenu("");
Expand Down
24 changes: 15 additions & 9 deletions companion/src/mdichild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,41 +408,40 @@ 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;
}

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));
actGrp.append(getAction(ACT_MDL_CPY));
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;
Expand Down Expand Up @@ -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;
}
1 change: 1 addition & 0 deletions companion/src/mdichild.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b478cef

Please sign in to comment.