MCPcopy Create free account
hub / github.com/clementgallet/libTAS / updateMenu

Method updateMenu

src/program/ui/InputEditorView.cpp:322–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322void InputEditorView::updateMenu()
323{
324 /* Sanity check if this slot is called too early */
325 if (!insertAct)
326 return;
327
328 /* Get the lowest selected row and count markers */
329 int min_row = 1 << 30;
330 const QModelIndexList indexes = selectionModel()->selectedRows();
331
332 int markers_count = 0;
333 for (const QModelIndex index : indexes) {
334 if (inputEditorModel->hasMarker(index.row())) {
335 markers_count++;
336 currentMarkerText = inputEditorModel->getMarkerText(index.row());
337 }
338 if (index.row() < min_row)
339 min_row = index.row();
340 }
341
342 markAct->setText(markers_count ? tr("Edit marker") : tr("Add marker"));
343 unmarkAct->setText((markers_count > 1) ? tr("Remove markers") : tr("Remove marker"));
344 unmarkAct->setEnabled(markers_count);
345
346 if (static_cast<uint32_t>(min_row) < context->framecount) {
347 eventAct->setEnabled(false);
348 }
349 else {
350 eventAct->setEnabled(true);
351 }
352
353 undoAct->setEnabled(movie->changelog->canUndo());
354 redoAct->setEnabled(movie->changelog->canRedo());
355}
356
357void InputEditorView::mousePressEvent(QMouseEvent *event)
358{

Callers

nothing calls this directly

Calls 4

hasMarkerMethod · 0.80
getMarkerTextMethod · 0.45
canUndoMethod · 0.45
canRedoMethod · 0.45

Tested by

no test coverage detected