void djvViewWindowActions::update() { const QVector<djvShortcut> & shortcuts = djvViewShortcutPrefs::global()->shortcuts(); // Update the actions. _actions[NEW]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_WINDOW_NEW].value); _actions[NEW]->setToolTip(tr("Create a new window\n\nShortcut: %1"). arg(shortcuts[djvViewUtil::SHORTCUT_WINDOW_NEW].value.toString())); _actions[COPY]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_WINDOW_COPY].value); _actions[COPY]->setToolTip(tr("Copy the current window\n\nShortcut: %1"). arg(shortcuts[djvViewUtil::SHORTCUT_WINDOW_COPY].value.toString())); _actions[CLOSE]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_WINDOW_CLOSE].value); _actions[CLOSE]->setToolTip(tr("Close the current window\n\nShortcut: %1"). arg(shortcuts[djvViewUtil::SHORTCUT_WINDOW_CLOSE].value.toString())); _actions[FIT]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_WINDOW_FIT].value); _actions[FIT]->setToolTip( tr("Resize the window to fit the image\n\nShortcut: %1"). arg(shortcuts[djvViewUtil::SHORTCUT_WINDOW_FIT].value.toString())); _actions[FULL_SCREEN]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_WINDOW_FULL_SCREEN].value); _actions[FULL_SCREEN]->setToolTip( tr("Show the window full screen\n\nShortcut: %1"). arg(shortcuts[djvViewUtil::SHORTCUT_WINDOW_FULL_SCREEN].value.toString())); _actions[CONTROLS_VISIBLE]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_WINDOW_CONTROLS_VISIBLE].value); _actions[CONTROLS_VISIBLE]->setToolTip( tr("Toggle the user interface controls visbility\n\nShortcut: %1"). arg(shortcuts[djvViewUtil::SHORTCUT_WINDOW_CONTROLS_VISIBLE].value.toString())); const djvViewUtil::SHORTCUT toolBarShortcuts[] = { djvViewUtil::SHORTCUT_WINDOW_TOOL_BARS_VISIBLE, djvViewUtil::SHORTCUT_WINDOW_PLAYBACK_VISIBLE, djvViewUtil::SHORTCUT_WINDOW_INFO_VISIBLE }; const int toolBarShortcutsCount = sizeof(toolBarShortcuts) / sizeof(toolBarShortcuts[0]); for (int i = 0; i < toolBarShortcutsCount; ++i) { _groups[TOOL_BAR_VISIBLE_GROUP]->actions()[i]->setShortcut( shortcuts[toolBarShortcuts[i]].value); } // Fix up the actions. osxMenuHack(); }
void djvViewToolActions::update() { const QVector<djvShortcut> & shortcuts = djvViewShortcutPrefs::global()->shortcuts(); // Update the action groups. const QVector<QKeySequence> toolShortcuts = QVector<QKeySequence>() << shortcuts[djvViewUtil::SHORTCUT_TOOL_MAGNIFY].value << shortcuts[djvViewUtil::SHORTCUT_TOOL_COLOR_PICKER].value << shortcuts[djvViewUtil::SHORTCUT_TOOL_HISTOGRAM].value << shortcuts[djvViewUtil::SHORTCUT_TOOL_INFO].value; const QStringList toolToolTips = QStringList() << tr("Toggle the magnify tool\n\nShortcut: %1") << tr("Toggle the color picker tool\n\nShortcut: %1") << tr("Toggle the histogram tool\n\nShortcut: %1") << tr("Toggle the information tool\n\nShortcut: %1"); for (int i = 0; i < djvViewUtil::TOOL_COUNT; ++i) { _groups[TOOL_GROUP]->actions()[i]->setShortcut(toolShortcuts[i]); _groups[TOOL_GROUP]->actions()[i]->setToolTip( toolToolTips[i].arg(toolShortcuts[i].toString())); } // Fix up the actions. osxMenuHack(); // Emit changed signal. Q_EMIT changed(); }
void djvViewFileActions::update() { const QVector<djvShortcut> & shortcuts = context()->shortcutPrefs()->shortcuts(); // Update the actions. _actions[OPEN]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_FILE_OPEN].value); _actions[OPEN]->setToolTip( qApp->translate("djvViewFileActions", "Open a new file\n\nShortcut: %1"). arg(shortcuts[djvViewUtil::SHORTCUT_FILE_OPEN].value.toString())); _actions[RELOAD]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_FILE_RELOAD].value); _actions[RELOAD]->setToolTip( qApp->translate("djvViewFileActions", "Reload the current file\n\nShortcut: %1"). arg(shortcuts[djvViewUtil::SHORTCUT_FILE_RELOAD].value.toString())); _actions[RELOAD_FRAME]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_FILE_RELOAD_FRAME].value); _actions[RELOAD_FRAME]->setToolTip( qApp->translate("djvViewFileActions", "Reload the current frame\n\nShortcut: %1"). arg(shortcuts[djvViewUtil::SHORTCUT_FILE_RELOAD_FRAME].value.toString())); _actions[CLOSE]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_FILE_CLOSE].value); _actions[CLOSE]->setToolTip( qApp->translate("djvViewFileActions", "Close the current file\n\nShortcut: %1"). arg(shortcuts[djvViewUtil::SHORTCUT_FILE_CLOSE].value.toString())); _actions[SAVE]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_FILE_SAVE].value); _actions[SAVE_FRAME]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_FILE_SAVE_FRAME].value); _actions[LAYER_PREV]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_FILE_LAYER_PREV].value); _actions[LAYER_NEXT]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_FILE_LAYER_NEXT].value); _actions[EXIT]->setShortcut( shortcuts[djvViewUtil::SHORTCUT_EXIT].value); // Update the action groups. Q_FOREACH(QAction * action, _groups[RECENT_GROUP]->actions()) delete action; const djvFileInfoList & recent = context()->filePrefs()->recentFiles(); for (int i = 0; i < recent.count(); ++i) { QAction * action = new QAction(this); action->setText(QDir::toNativeSeparators(recent[i])); action->setData(i); _groups[RECENT_GROUP]->addAction(action); } Q_FOREACH(QAction * action, _groups[LAYER_GROUP]->actions()) delete action; const QVector<QKeySequence> layerShortcuts = QVector<QKeySequence>() << shortcuts[djvViewUtil::SHORTCUT_FILE_LAYER_DEFAULT].value << shortcuts[djvViewUtil::SHORTCUT_FILE_LAYER_1].value << shortcuts[djvViewUtil::SHORTCUT_FILE_LAYER_2].value << shortcuts[djvViewUtil::SHORTCUT_FILE_LAYER_3].value << shortcuts[djvViewUtil::SHORTCUT_FILE_LAYER_4].value << shortcuts[djvViewUtil::SHORTCUT_FILE_LAYER_5].value << shortcuts[djvViewUtil::SHORTCUT_FILE_LAYER_6].value << shortcuts[djvViewUtil::SHORTCUT_FILE_LAYER_7].value << shortcuts[djvViewUtil::SHORTCUT_FILE_LAYER_8].value << shortcuts[djvViewUtil::SHORTCUT_FILE_LAYER_9].value << shortcuts[djvViewUtil::SHORTCUT_FILE_LAYER_10].value; for (int i = 0; i < _p->layers.count(); ++i) { QAction * action = new QAction(this); action->setText(_p->layers[i]); action->setCheckable(true); action->setChecked(i == _p->layer); action->setShortcut( i < layerShortcuts.count() ? layerShortcuts[i] : QKeySequence()); action->setData(i); _groups[LAYER_GROUP]->addAction(action); } const QVector<QKeySequence> proxyShortcuts = QVector<QKeySequence>() << shortcuts[djvViewUtil::SHORTCUT_FILE_PROXY_NONE].value << shortcuts[djvViewUtil::SHORTCUT_FILE_PROXY_1_2].value << shortcuts[djvViewUtil::SHORTCUT_FILE_PROXY_1_4].value << shortcuts[djvViewUtil::SHORTCUT_FILE_PROXY_1_8].value; for (int i = 0; i < _groups[PROXY_GROUP]->actions().count(); ++i) { _groups[PROXY_GROUP]->actions()[i]->setShortcut(proxyShortcuts[i]); } // Fix up the actions. osxMenuHack(); // Emit changed signal. Q_EMIT changed(); }