// Extend startup here AIErr pluginStartup( SPInterfaceMessage *message ) { AIErr error = kNoErr; // store a pointer to basic (needed for use in callbacks) // we will need this later during the ADM initialization and destroy procs g->basic = message->d.basic; // Adds a menu item, defined in menuHandler.c error = addMenu( message ); // Adds all notifiers used in this plug-in, see notifierHandler.c addNotifiers( message ); return error; }
SoundButton::SoundButton(QWidget *parent, SoundFile *soundFile) : QPushButton(parent) { this->soundFile = soundFile; setText(soundFile->getDescription()); addActions(); addMenu(); connect(this, SIGNAL(clicked()), this, SLOT(play())); connect(soundFile, SIGNAL(changed()), this, SLOT(fileChanged())); player = new AudioPlayer(); connect(player, SIGNAL(finished()), this, SIGNAL(playingStopped()), Qt::QueuedConnection); }
bool Home::init() { if (!CCLayer::init()) { return false; } addBackground(this); LabelBuilder::label(Formatter::toString("Rank: %s", Rank::getText()), SANS_SEMIBOLD_FONT)->size(42)->position( ccp(VisibleRect::rightTop().x - 20, VisibleRect::rightTop().y - 20))->anchorPoint( ccp(1.0f, 1.0f))->addTo( this); auto logoBackground = sprite("LogoBackground", VisibleRect::top()); addChild(logoBackground); auto moveToPosition = CCEaseBackOut::create( CCMoveTo::create(1.2f, ccp(VisibleRect::center().x - 40, VisibleRect::center().y + 110))); auto fadeIn = CCFadeIn::create(1.0f); logoBackground->runAction(moveToPosition); logoBackground->runAction(fadeIn); logoBackground->runAction( CCRepeatForever::create( CCSequence::create( CCMoveBy ::create(2.0f, ccp(0, 15)), CCMoveBy::create(2.0f, ccp(0, -15)), NULL))); logoBackground->runAction( CCRepeatForever::create( CCSequence::create(CCDelayTime::create(1.4f), CCRotateBy::create(30.0f, 360), NULL))); auto logoTextIQ = sprite("LogoIQText", ccp(VisibleRect::center().x - 120, VisibleRect::center().y + 75)); logoTextIQ->setOpacity(0.0f); logoTextIQ->runAction(CCFadeIn::create(1.6f)); fadeInAfterDelay(logoTextIQ); addChild(logoTextIQ); auto logoText = sprite("LogoText", ccp(VisibleRect::center().x - 15, VisibleRect::center().y + 160)); fadeInAfterDelay(logoText); addChild(logoText); addMenu(); return true; }
QMenu *MainWindow::addMenu(QString name) { QList<QAction *> actions = _toolBar->actions(); foreach (QAction *action, actions) if (action->text() == name) { QToolButton *toolButton = dynamic_cast<QToolButton *>(_toolBar->widgetForAction(action)); if (toolButton != nullptr) return toolButton->menu(); } QMenu *menu = new QMenu(name); addMenu(menu); return menu; }
bool Inventory::init() { // 1. super init first if (!Layer::init()) { return false; } visibleSize = Director::getInstance()->getVisibleSize(); origin = Director::getInstance()->getVisibleOrigin(); addBackground(); // 添加背景 addMenu(); // 添加菜单 addUI(); // 添加UI // 每分钟更新一次时间 this->schedule(schedule_selector(Inventory::updateTime), 60.0f, kRepeatForever, 0); return true; }
PixEditor::PixEditor(QWidget *parent) : QMainWindow(parent) { barreEtat=statusBar(); addMenu(); addock(); addtoolbar(); QScrollArea *defilement = new QScrollArea(); defilement->setMinimumSize(QSize(500,500)); setCentralWidget(defilement); defilement->setWidget(&widgetcentral); defilement->setWidgetResizable(true); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { drawwidget = new DrawWidget(this); controlpanelwidget = new ControlPanelWidget(this); layout = new QHBoxLayout(this); auto centralWidget = new QWidget(this); setMinimumHeight(400); setMinimumWidth(400); setCentralWidget(centralWidget); resize(1200, 720); this->setMouseTracking(true); drawwidget->setMouseTracking(true); layout->addWidget(drawwidget); layout->addWidget(controlpanelwidget, 0 , Qt::AlignTop); centralWidget->setLayout(layout); auto menu = menuBar(); menu->addMenu(tr("File")); auto actionLoad = new QAction(tr("Load"), menu); auto actionSave = new QAction(tr("Save"), menu); auto actionToPicture = new QAction(tr("png"), menu); menu->addAction(actionSave); menu->addAction(actionLoad); menu->addAction(actionToPicture); connect(actionSave, &QAction::triggered, this, &MainWindow::saveConfig); connect(actionLoad, &QAction::triggered, this, &MainWindow::loadConfig); connect(actionToPicture, &QAction::triggered, this, &MainWindow::saveImage); connect(controlpanelwidget, &ControlPanelWidget::XChanged, drawwidget , &DrawWidget::setX); connect(controlpanelwidget, &ControlPanelWidget::YChanged, drawwidget , &DrawWidget::setY); connect(controlpanelwidget, &ControlPanelWidget::ScaleChanged, drawwidget , &DrawWidget::setScale); connect(controlpanelwidget, &ControlPanelWidget::FilterChanged, drawwidget, &DrawWidget::setFilter); connect(controlpanelwidget, &ControlPanelWidget::XChanged, controlpanelwidget->spinbox , &QSpinBox::setValue); connect(controlpanelwidget, &ControlPanelWidget::YChanged, controlpanelwidget->spinbox1 , &QSpinBox::setValue); connect(controlpanelwidget, &ControlPanelWidget::ScaleChanged, controlpanelwidget->spinbox2 , &QSpinBox::setValue); connect(drawwidget, SIGNAL(glyphShifted(QPoint)), controlpanelwidget, SLOT(shift(QPoint))); }
void MenuBar::AddHelpMenu() { QMenu* help_menu = addMenu(tr("&Help")); QAction* website = help_menu->addAction(tr("&Website")); connect(website, &QAction::triggered, this, []() { QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/"))); }); QAction* documentation = help_menu->addAction(tr("Online &Documentation")); connect(documentation, &QAction::triggered, this, []() { QDesktopServices::openUrl(QUrl(QStringLiteral("https://dolphin-emu.org/docs/guides"))); }); QAction* github = help_menu->addAction(tr("&GitHub Repository")); connect(github, &QAction::triggered, this, []() { QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/dolphin-emu/dolphin"))); }); help_menu->addSeparator(); AddAction(help_menu, tr("&About"), this, &MenuBar::ShowAboutDialog); }
MainWindow::MainWindow() { contents = new QWidget(this); mainImage = new QLabel(this); statistics = new QLabel(this); iteration = 0; QHBoxLayout *layout = new QHBoxLayout(); addMenu(); addToolbar(); drawField(); layout->addWidget(mainImage); layout->addWidget(statistics); contents->setLayout(layout); setCentralWidget(contents); }
void MenuBar::AddEmulationMenu() { QMenu* emu_menu = addMenu(tr("&Emulation")); m_play_action = AddAction(emu_menu, tr("&Play"), this, &MenuBar::Play); m_pause_action = AddAction(emu_menu, tr("&Pause"), this, &MenuBar::Pause); m_stop_action = AddAction(emu_menu, tr("&Stop"), this, &MenuBar::Stop); m_reset_action = AddAction(emu_menu, tr("&Reset"), this, &MenuBar::Reset); m_fullscreen_action = AddAction(emu_menu, tr("Toggle &Fullscreen"), this, &MenuBar::Fullscreen); m_frame_advance_action = AddAction(emu_menu, tr("&Frame Advance"), this, &MenuBar::FrameAdvance); m_screenshot_action = AddAction(emu_menu, tr("Take Screenshot"), this, &MenuBar::Screenshot); emu_menu->addSeparator(); AddStateLoadMenu(emu_menu); AddStateSaveMenu(emu_menu); AddStateSlotMenu(emu_menu); UpdateStateSlotMenu(); }
BookmarksContentsWidget::BookmarksContentsWidget(Window *window) : ContentsWidget(window), m_ui(new Ui::BookmarksContentsWidget) { m_ui->setupUi(this); QMenu *addMenu(new QMenu(m_ui->addButton)); addMenu->addAction(ThemesManager::getIcon(QLatin1String("inode-directory")), tr("Add Folder"), this, SLOT(addFolder())); addMenu->addAction(tr("Add Bookmark"), this, SLOT(addBookmark())); addMenu->addAction(tr("Add Separator"), this, SLOT(addSeparator())); QSet<int> filterRoles; filterRoles << BookmarksModel::UrlRole << BookmarksModel::TitleRole << BookmarksModel::DescriptionRole << BookmarksModel::KeywordRole; QList<QPair<QString, int> > rolesMapping; rolesMapping << qMakePair(tr("Title"), BookmarksModel::TitleRole) << qMakePair(tr("Address"), BookmarksModel::UrlRole) << qMakePair(tr("Description"), BookmarksModel::DescriptionRole) << qMakePair(tr("Keyword"), BookmarksModel::KeywordRole) << qMakePair(tr("Added"), BookmarksModel::TimeAddedRole) << qMakePair(tr("Modified"), BookmarksModel::TimeModifiedRole) << qMakePair(tr("Visited"), BookmarksModel::TimeVisitedRole) << qMakePair(tr("Visits"), BookmarksModel::VisitsRole); ProxyModel *model(new ProxyModel(BookmarksManager::getModel(), rolesMapping, this)); m_ui->addButton->setMenu(addMenu); m_ui->bookmarksViewWidget->setViewMode(ItemViewWidget::TreeViewMode); m_ui->bookmarksViewWidget->setModel(model); m_ui->bookmarksViewWidget->setExpanded(m_ui->bookmarksViewWidget->model()->index(0, 0), true); m_ui->bookmarksViewWidget->setFilterRoles(filterRoles); m_ui->bookmarksViewWidget->installEventFilter(this); m_ui->bookmarksViewWidget->viewport()->installEventFilter(this); m_ui->bookmarksViewWidget->viewport()->setMouseTracking(true); m_ui->filterLineEdit->installEventFilter(this); if (!window) { m_ui->detailsWidget->hide(); } connect(BookmarksManager::getModel(), SIGNAL(modelReset()), this, SLOT(updateActions())); connect(m_ui->propertiesButton, SIGNAL(clicked()), this, SLOT(bookmarkProperties())); connect(m_ui->deleteButton, SIGNAL(clicked()), this, SLOT(removeBookmark())); connect(m_ui->addButton, SIGNAL(clicked()), this, SLOT(addBookmark())); connect(m_ui->filterLineEdit, SIGNAL(textChanged(QString)), m_ui->bookmarksViewWidget, SLOT(setFilterString(QString))); connect(m_ui->bookmarksViewWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openBookmark(QModelIndex))); connect(m_ui->bookmarksViewWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); connect(m_ui->bookmarksViewWidget, SIGNAL(needsActionsUpdate()), this, SLOT(updateActions())); }
void MenuFile::performAction(const ActionAtom *atom) { switch(atom->action) { case ADD_ENTRY: addEntry(atom->arg1, atom->arg2); return; case REMOVE_ENTRY: removeEntry(atom->arg1, atom->arg2); return; case ADD_MENU: addMenu(atom->arg1, atom->arg2); return; case REMOVE_MENU: removeMenu(atom->arg1); return; case MOVE_MENU: moveMenu(atom->arg1, atom->arg2); return; } }
void MainWindow::GUI() { addMenu(); tabWidget = new QTabWidget(); tabWidget->addTab(dialHall, tr("Холл")); tabWidget->addTab(dialBldg, tr("Здание")); tabWidget->addTab(dialMap, tr("Карта здания")); tabWidget->addTab(dialShow, tr("Шоу")); tabWidget->addTab(dialTimes, tr("Время представления")); tabWidget->addTab(dialZone, tr("Зоны представления")); tabWidget->addTab(dialTicket, tr("Билеты")); m_layout = new QGridLayout(); m_widget = new QWidget(); m_layout->addWidget(tabWidget); m_widget->setLayout(m_layout); this->setCentralWidget(m_widget); resize(800,600); }
// on "init" you need to initialize your instance bool Mainpage::init() { ////////////////////////////// // 1. super init first if (!Layer::init()) { return false; } //visibleSize = Director::getInstance()->getVisibleSize(); visibleSize = Global::getVisibleSize(); origin = Director::getInstance()->getVisibleOrigin(); preloadBGM(); // 预载入BGM addBackground(); // 添加背景 addMenu(); // 添加菜单 addUI(); // 添加UI // 播放bgm playBGM(); // 每分钟更新一次时间 this->schedule(schedule_selector(Mainpage::updateTime), 60.0f, kRepeatForever, 0); return true; }
NvTweakVarBase* NvTweakBar::addEnum(const char *name, uint32_t &var, const NvTweakEnum<uint32_t> values[], uint32_t valueCount, uint32_t actionCode/*==0*/) { if (debugForceMenu || (m_compactLayout && valueCount > ENUM_COUNT_THRESH_FOR_COMPACT_MENU)) { return addMenu(name, var, values, valueCount, actionCode); } uint32_t minval = 0xFFFFFFFF, maxval = 0; for (uint32_t i=0; i<valueCount; i++) { if (minval>values[i].m_value) minval = values[i].m_value; if (maxval<values[i].m_value) maxval = values[i].m_value; } // make a NvTweakVar on the fly. this will leak currently. NvTweakEnumVar<uint32_t> *tvar = new NvTweakEnumVar<uint32_t>(values, valueCount, var, name, minval, maxval, 0); tvar->setValLoop(true); // add label addLabel(name, false); // for now, inset AFTER the label. subgroupStart(); // add group, currently as radiobuttons, could do as popup in future. uint32_t code = actionCode==0?++m_lastActionCode:actionCode; // need to stash code so all radios use the same for (uint32_t i=0; i<valueCount; i++) { NvUIButton *btn = MakeStdButton(values[i].m_name, (values[i]==var), NvUIButtonType::RADIO, code, i); AddElement(new NvTweakEnumUI<uint32_t>(*tvar, i, btn, btn->GetActionCode())); } subgroupEnd(); return tvar; }
KoResourceItemChooserContextMenu::KoResourceItemChooserContextMenu(KoResource* resource, const QStringList& resourceTags, const QString& currentlySelectedTag, const QStringList& allTags) { QImage image = resource->image(); QIcon icon(QPixmap::fromImage(image)); QAction * label = new QAction(resource->name(), this); label->setIcon(icon); addAction(label); QMenu * removableTagsMenu; QMenu * assignableTagsMenu; QStringList removables = resourceTags; QStringList assignables = allTags; removables.sort(); assignables.sort(); assignableTagsMenu = addMenu(koIcon("list-add"),i18n("Assign to tag")); if (!removables.isEmpty()) { addSeparator(); QString currentTag = currentlySelectedTag; if (removables.contains(currentTag)) { assignables.removeAll(currentTag); removables.removeAll(currentTag); ContextMenuExistingTagAction * removeTagAction = new ContextMenuExistingTagAction(resource, currentTag, this); removeTagAction->setText(i18n("Remove from this tag")); removeTagAction->setIcon(koIcon("list-remove")); connect(removeTagAction, SIGNAL(triggered(KoResource*,QString)), this, SIGNAL(resourceTagRemovalRequested(KoResource*,QString))); addAction(removeTagAction); }
//----------------------------------------- // getMenu // Auto-breakup a too-wide menu. // NOTE This is a necessary catch-all because X doesn't like too-wide menus, but risky because // some callers might depend on all the items being in one menu (using ::actions or ::addActions). // So try to avoid that. The overwhelming rule of thumb is that too-wide menus are bad design anyway. //------------------------------------------ PopupMenu* PopupMenu::getMenu() { // We want the whole thing if multiple monitors. // Resonable to assume if X can show this desktop, it can show a menu with the same width? int dw = QApplication::desktop()->width(); // If we're still only at one column, not much we can do - some item(s) must have had reeeeally long text. // Not to worry. Hopefully the auto-scroll will handle it! // Use columnCount() + 2 to catch well BEFORE it widens beyond the edge, and leave room for many <More...> // TESTED: Not only does the system not appear to like too-wide menus, but also the column count was observed // rolling over to zero repeatedly after it reached 15, simply when adding actions! The action width was 52 // the number of items when it first rolled over was around 480 = 884, well below my desktop width of 1366. // Apparently there is a limit on the number of columns - whatever, it made the col count limit necessary: if((_cur_col_count > 1 && ((_cur_col_count + 2) * _cur_item_width) >= dw) || _cur_col_count >= 8) { // This menu is too wide. So make a new one... _cur_item_width = 0; _cur_col_count = 1; QString s(tr("<More...> %1").arg(_cur_menu_count)); _cur_menu = cloneMenu(s, this, _stayOpen); ++_cur_menu_count; addMenu(_cur_menu); } return _cur_menu; }
void pActionsMenuBar::model_actionInserted( QAction* action ) { QAction* parent = mModel->parent( action ); if ( !parent && action->menu() ) { addMenu( action->menu() ); } /*QMenu* parentMenu = mMenus.value( node.path().section( '/', 0, -2 ) ); switch ( node.type() ) { case pActionsNode::Action: { parentMenu->addAction( node.action() ); break; } case pActionsNode::Path: { QMenu* menu = new QMenu; menu->setObjectName( node.path() ); mMenus[ node.path() ] = menu; if ( parentMenu ) { parentMenu->addMenu( menu ); } else { QMenuBar::addMenu( menu ); } model_actionChanged( node ); break; } default: break; }*/ }
StartScene::StartScene(){ bg = LoadGraph("data/image/bg/start.jpg"); ChangeFontType(DX_FONTTYPE_ANTIALIASING_EDGE_4X4); SetUseZBuffer3D(true); addMenu(); }
/*ARGSUSED*/ void workshop_toolbar_button( char *label, char *verb, char *senseVerb, char *filepos, char *help, char *sense, char *file, char *left) { char cbuf[BUFSIZ + MAXPATHLEN]; char namebuf[BUFSIZ]; static int tbid = 1; char_u *p; #ifdef WSDEBUG_TRACE if (WSDLEVEL(WS_TRACE_VERBOSE)) wsdebug("workshop_toolbar_button(\"%s\", %s, %s,\n" "\t%s, \"%s\", %s,\n\t\"%s\",\n\t<%s>)\n", label && *label ? label : "<None>", verb && *verb ? verb : "<None>", senseVerb && *senseVerb ? senseVerb : "<None>", filepos && *filepos ? filepos : "<None>", help && *help ? help : "<None>", sense && *sense ? sense : "<None>", file && *file ? file : "<None>", left && *left ? left : "<None>"); else if (WSDLEVEL(WS_TRACE)) wstrace("workshop_toolbar_button(\"%s\", %s)\n", label && *label ? label : "<None>", verb && *verb ? verb : "<None>"); #endif #ifdef WSDEBUG_SENSE if (ws_debug) wsdebug("button: %-21.20s%-21.20s(%s)\n", label, verb, *sense == '1' ? "Sensitive" : "Insensitive"); #endif if (left && *left && atoi(left) > 0) { /* Add a separator (but pass the width passed after the ':') */ sprintf(cbuf, "amenu 1.%d ToolBar.-sep%d:%s- <nul>", tbpri - 5, tbid++, left); coloncmd(cbuf, True); } p = vim_strsave_escaped((char_u *)label, (char_u *)"\\. "); sprintf(namebuf, "ToolBar.%s", p); vim_free(p); STRCPY(cbuf, "amenu <silent> "); if (file != NULL && *file != NUL) { p = vim_strsave_escaped((char_u *)file, (char_u *)" "); sprintf(cbuf + STRLEN(cbuf), "icon=%s ", p); vim_free(p); } sprintf(cbuf + STRLEN(cbuf), "1.%d %s :wsverb %s<CR>", tbpri, namebuf, verb); /* Define the menu item */ coloncmd(cbuf, True); if (*sense == '0') { /* If menu isn't sensitive at startup... */ sprintf(cbuf, "amenu disable %s", namebuf); coloncmd(cbuf, True); } if (help && *help) { /* Do the tooltip */ sprintf(cbuf, "tmenu %s %s", namebuf, help); coloncmd(cbuf, True); } addMenu(namebuf, NULL, verb); tbpri += 10; }
/*ARGSUSED*/ void workshop_menu_item( char *label, char *verb, char *accelerator, char *acceleratorText, char *name, char *filepos, char *sensitive) { char cbuf[BUFSIZ]; char namebuf[BUFSIZ]; char accText[BUFSIZ]; #ifdef WSDEBUG_TRACE if (WSDLEVEL(WS_TRACE_VERBOSE) && strncmp(curMenuName, "ToolBar", 7) != 0) { if (ws_dlevel & WS_TRACE_VERBOSE) wsdebug("workshop_menu_item(\n" "\tlabel = \"%s\",\n" "\tverb = %s,\n" "\taccelerator = %s,\n" "\tacceleratorText = \"%s\",\n" "\tname = %s,\n" "\tfilepos = %s,\n" "\tsensitive = %s)\n", label && *label ? label : "<None>", verb && *verb ? verb : "<None>", accelerator && *accelerator ? accelerator : "<None>", acceleratorText && *acceleratorText ? acceleratorText : "<None>", name && *name ? name : "<None>", filepos && *filepos ? filepos : "<None>", sensitive); else if (ws_dlevel & WS_TRACE) wstrace("workshop_menu_item(\"%s\", %s)\n", label && *label ? label : "<None>", verb && *verb ? verb : "<None>", sensitive); } #endif #ifdef WSDEBUG_SENSE if (ws_debug) wstrace("menu: %-21.20s%-21.20s(%s)\n", label, verb, *sensitive == '1' ? "Sensitive" : "Insensitive"); #endif if (acceleratorText != NULL) sprintf(accText, "<Tab>%s", acceleratorText); else accText[0] = NUL; updatePriority(False); sprintf(namebuf, "%s.%s", curMenuName, fixup(label)); sprintf(cbuf, "amenu %s %s%s\t:wsverb %s<CR>", curMenuPriority, namebuf, accText, verb); coloncmd(cbuf, TRUE); addMenu(namebuf, fixAccelText(acceleratorText), verb); if (*sensitive == '0') { sprintf(cbuf, "amenu disable %s", namebuf); coloncmd(cbuf, TRUE); } }
void KSPopupMenu::initPopupMenu( SkyObject *obj, QString name, QString type, QString info, bool showDetails, bool showObsList, bool showFlags ) { KStarsData* data = KStarsData::Instance(); SkyMap * map = SkyMap::Instance(); clear(); bool showLabel = name != i18n("star") && !name.isEmpty(); if( name.isEmpty() ) name = i18n( "Empty sky" ); addFancyLabel( name ); addFancyLabel( type ); addFancyLabel( info ); addFancyLabel( KStarsData::Instance()->skyComposite()->getConstellationBoundary()->constellationName( obj ) ); //Insert Rise/Set/Transit labels SkyObject* o = obj->clone(); addSeparator(); addFancyLabel( riseSetTimeLabel(o, true), -2 ); addFancyLabel( riseSetTimeLabel(o, false), -2 ); addFancyLabel( transitTimeLabel(o), -2 ); addSeparator(); delete o; // Show 'Select this object' item when in object pointing mode and when obj is not empty sky if(map->isInObjectPointingMode() && obj->type() != 21) { addAction( i18n( "Select this object"), map, SLOT(slotObjectSelected())); } //Insert item for centering on object addAction( i18n( "Center && Track" ), map, SLOT( slotCenter() ) ); if ( showFlags ) { //Insert actions for flag operations initFlagActions( obj ); } //Insert item for measuring distances //FIXME: add key shortcut to menu items properly! addAction( i18n( "Angular Distance To... [" ), map, SLOT(slotBeginAngularDistance()) ); addAction( i18n( "Starhop from here to... " ), map, SLOT(slotBeginStarHop()) ); //Insert item for Showing details dialog if ( showDetails ) addAction( i18nc( "Show Detailed Information Dialog", "Details" ), map, SLOT( slotDetail() ) ); //Insert "Add/Remove Label" item if ( showLabel ) { if ( map->isObjectLabeled( obj ) ) { addAction( i18n( "Remove Label" ), map, SLOT( slotRemoveObjectLabel() ) ); } else { addAction( i18n( "Attach Label" ), map, SLOT( slotAddObjectLabel() ) ); } } // Should show observing list if( showObsList ) { if ( data->observingList()->contains( obj ) ) addAction( i18n("Remove From Observing WishList"), data->observingList(), SLOT( slotRemoveObject() ) ); else addAction( i18n("Add to Observing WishList"), data->observingList(), SLOT( slotAddObject() ) ); } // Should we show trail actions TrailObject* t = dynamic_cast<TrailObject*>( obj ); if( t ) { if( t->hasTrail() ) addAction( i18n( "Remove Trail" ), map, SLOT( slotRemovePlanetTrail() ) ); else addAction( i18n( "Add Trail" ), map, SLOT( slotAddPlanetTrail() ) ); } addAction( i18n("Simulate eyepiece view"), map, SLOT( slotEyepieceView() ) ); addSeparator(); #ifdef HAVE_XPLANET if ( obj->isSolarSystem() && obj->type() != SkyObject::COMET ) { // FIXME: We now have asteroids -- so should this not be isMajorPlanet() || Pluto? QMenu *xplanetSubmenu = new QMenu(); xplanetSubmenu->setTitle( i18n( "Print Xplanet view" ) ); xplanetSubmenu->addAction( i18n( "To screen" ), map, SLOT( slotXplanetToScreen() ) ); xplanetSubmenu->addAction( i18n( "To file..." ), map, SLOT( slotXplanetToFile() ) ); addMenu( xplanetSubmenu ); } #endif addSeparator(); addINDI(); }
PopupMenu::PopupMenu(QWidget * parent) : Inherited(parent) { QAction * a; QMenu * m; QActionGroup * g; addSeparator(); a = new QAction(tr("Lock window position"), this); a->setCheckable(true); addAction(a); lock_pos = a; a = new QAction(tr("Keep window always on top"), this); a->setCheckable(true); addAction(a); window_ontop = a; connect(a, SIGNAL(triggered()), parent, SLOT(menu_ontop())); addSeparator(); m = addMenu("Hours mode"); g = new QActionGroup(this); a = new QAction(tr("12-hours mode (from 1 to 12)"), this); a->setCheckable(true); g->addAction(a); m->addAction(a); hours_mode_actions[0] = a; connect(a, SIGNAL(triggered()), this, SLOT(hours_mode())); a = new QAction(tr("12-hours mode and PM/AM indication"), this); a->setCheckable(true); g->addAction(a); m->addAction(a); hours_mode_actions[1] = a; connect(a, SIGNAL(triggered()), this, SLOT(hours_mode())); a = new QAction(tr("24-hours mode (from 0 to 23)"), this); a->setCheckable(true); g->addAction(a); m->addAction(a); hours_mode_actions[2] = a; connect(a, SIGNAL(triggered()), this, SLOT(hours_mode())); connect(this, SIGNAL(update_hours_mode()), parent, SLOT(menu_hours_mode())); m = addMenu("ToolTip"); a = new QAction(tr("Time"), this); a->setCheckable(true); m->addAction(a); tooltip_time_action = a; a = new QAction(tr("Unix time"), this); a->setCheckable(true); m->addAction(a); tooltip_unixtime_action = a; m->addSeparator(); g = new QActionGroup(this); a = new QAction(tr("Dec"), this); a->setCheckable(true); g->addAction(a); m->addAction(a); tooltip_dec_action = a; a = new QAction(tr("Hex"), this); a->setCheckable(true); g->addAction(a); m->addAction(a); tooltip_hex_action = a; m->addSeparator(); a = new QAction(tr("Set font"), this); m->addAction(a); connect(a, SIGNAL(triggered()), parent, SLOT(menu_tooltip_font())); a = new QAction(tr("Set text color"), this); m->addAction(a); connect(a, SIGNAL(triggered()), parent, SLOT(menu_tooltip_fg())); a = new QAction(tr("Set background color"), this); m->addAction(a); connect(a, SIGNAL(triggered()), parent, SLOT(menu_tooltip_bg())); addSeparator(); a = new QAction(tr("Color of \"0\" indicator"), this); addAction(a); connect(a, SIGNAL(triggered()), this, SLOT(color_0())); a = new QAction(tr("Color of \"1\" indicator"), this); addAction(a); connect(a, SIGNAL(triggered()), this, SLOT(color_1())); a = new QAction(tr("Restore original colors"), this); addAction(a); connect(a, SIGNAL(triggered()), parent, SLOT(menu_oem_colors())); addSeparator(); a = new QAction(tr("Save current settings as default"), this); addAction(a); connect(a, SIGNAL(triggered()), parent, SLOT(menu_save_setings())); addSeparator(); a = new QAction(tr("About"), this); connect(a, SIGNAL(triggered()), parent, SLOT(menu_about())); addAction(a); a = new QAction(tr("About Qt"), this); connect(a, SIGNAL(triggered()), parent, SLOT(menu_about_qt())); addAction(a); addSeparator(); a = new QAction(tr("Quit"), this); addAction(a); connect(a, SIGNAL(triggered()), parent, SIGNAL(menu_quit())); connect(this, SIGNAL(set_color(int)), parent, SLOT(menu_color(int))); }
WMenuItem *WMenu::addMenu(const WString& text, WMenu *menu) { return addMenu(std::string(), text, menu); }
void NotesContentsWidget::showContextMenu(const QPoint &point) { const QModelIndex index(m_ui->notesViewWidget->indexAt(point)); const BookmarksModel::BookmarkType type(static_cast<BookmarksModel::BookmarkType>(index.data(BookmarksModel::TypeRole).toInt())); QMenu menu(this); if (type != BookmarksModel::UrlBookmark && type != BookmarksModel::TrashBookmark) { menu.addAction(getAction(ActionsManager::PasteAction)); menu.addSeparator(); } if (type == BookmarksModel::TrashBookmark) { menu.addAction(ThemesManager::getIcon(QLatin1String("trash-empty")), tr("Empty Trash"), NotesManager::getModel(), SLOT(emptyTrash()))->setEnabled(NotesManager::getModel()->getTrashItem()->rowCount() > 0); } else if (type == BookmarksModel::UnknownBookmark) { menu.addAction(ThemesManager::getIcon(QLatin1String("inode-directory")), tr("Add Folder"), this, SLOT(addFolder())); menu.addAction(tr("Add Bookmark"), this, SLOT(addNote())); menu.addAction(tr("Add Separator"), this, SLOT(addSeparator())); } else { const bool isInTrash(index.data(BookmarksModel::IsTrashedRole).toBool()); if (type == BookmarksModel::UrlBookmark) { menu.addAction(getAction(ActionsManager::CutAction)); menu.addAction(getAction(ActionsManager::CopyAction)); menu.addAction(getAction(ActionsManager::PasteAction)); menu.addSeparator(); } menu.addAction(ThemesManager::getIcon(QLatin1String("document-open")), tr("Open source page"), this, SLOT(openUrl()))->setEnabled(type == BookmarksModel::UrlBookmark && index.data(BookmarksModel::UrlRole).toUrl().isValid()); if (type != BookmarksModel::RootBookmark) { Action *copyLinkAction(getAction(ActionsManager::CopyLinkToClipboardAction)); copyLinkAction->setEnabled(type == BookmarksModel::UrlBookmark && index.data(BookmarksModel::UrlRole).toUrl().isValid()); menu.addAction(copyLinkAction); } if (!isInTrash) { menu.addSeparator(); QMenu *addMenu(menu.addMenu(tr("Add Note"))); addMenu->addAction(ThemesManager::getIcon(QLatin1String("inode-directory")), tr("Add Folder"), this, SLOT(addFolder())); addMenu->addAction(tr("Add Note"), this, SLOT(addNote())); addMenu->addAction(tr("Add Separator"), this, SLOT(addSeparator())); } if (type != BookmarksModel::RootBookmark) { menu.addSeparator(); if (isInTrash) { menu.addAction(tr("Restore Note"), this, SLOT(restoreNote())); } else { menu.addAction(getAction(ActionsManager::DeleteAction)); } } } menu.exec(m_ui->notesViewWidget->mapToGlobal(point)); }
QAction *coreAction; foreach(QString actionName, coreActions) { coreAction = coll->action(actionName); _fileMenu->addAction(coreAction); flagRemoteCoreOnly(coreAction); } flagRemoteCoreOnly(_fileMenu->addSeparator()); _networksMenu = _fileMenu->addMenu(tr("&Networks")); _networksMenu->addAction(coll->action("ConfigureNetworks")); _networksMenu->addSeparator(); _fileMenu->addSeparator(); _fileMenu->addAction(coll->action("Quit")); _viewMenu = menuBar()->addMenu(tr("&View")); _bufferViewsMenu = _viewMenu->addMenu(tr("&Chat Lists")); _bufferViewsMenu->addAction(coll->action("ConfigureBufferViews")); _toolbarMenu = _viewMenu->addMenu(tr("&Toolbars")); _viewMenu->addSeparator(); _viewMenu->addAction(coll->action("ToggleMenuBar")); _viewMenu->addAction(coll->action("ToggleStatusBar")); _viewMenu->addAction(coll->action("ToggleSearchBar")); coreAction = coll->action("ShowAwayLog"); flagRemoteCoreOnly(coreAction); _viewMenu->addAction(coreAction); _viewMenu->addSeparator(); _viewMenu->addAction(coll->action("LockLayout"));
/** * Funcoes para imprimir menu da aplicacao */ void Menu::addMenu(Oficina &oficina){ cout << "1 - Adicionar Funcionário" << endl; // cout << "2 - Adicionar Veiculo a Funcionário" << endl; // cout << "3 - Adicionar Cliente" << endl; // cout << "4 - Adicionar Veiculo a Cliente" << endl; // cout << "5 - Adicionar Serviço a Veículo" << endl; cout << "0 - Sair" << endl; int opcao; cin >> opcao; string nome; switch(opcao){ case 0: menu(oficina); break; case 1:{ string nomeF; cin.sync(); cout << "Nome do funcionário: "; getline(cin,nomeF); Funcionario f(nomeF); try{ oficina.addFuncionario(f); }catch(FuncionarioExistente &e){ cout << e.getNome() << " já é um funcionário.\n"; } } oficina.guardaFuncionarios(); addMenu(oficina); break; case 2:{ string matricula, nome; cin.sync(); cout << "Insira o nome do funcionário: "; getline(cin,nome); try{ oficina.getFuncionarioNome(nome); }catch(FuncionarioInexistente &e){ cout << e.getNome() << " não é um funcionário.\n"; } cout << "Insira a matrícula do veículo: "; cin >> matricula; try{ Veiculo *v = oficina.getVeiculoMatricula(matricula); oficina.addVeiculoFuncionario(v,nome); }catch(VeiculoInexistente &e){ cout << e.getMatricula() << " não existe.\n"; } } oficina.guardaFuncionarios(); addMenu(oficina); break; case 3:{ string nomeC; cin.sync(); cout << "Insira o nome do cliente: "; getline(cin,nomeC); Cliente c(nomeC); try{ oficina.addCliente(c); }catch(ClienteExistente &e){ cout << e.getNome() << " já é um cliente.\n"; } } oficina.guardaClientes(); addMenu(oficina); break; case 4:{ string marca, matricula, tipo, nome; int ano; try{ string nome; cin.sync(); cout << "Insira o nome do cliente: "; getline(cin,nome); cout << "Insira o tipo do veiculo: "; cin >> tipo; cout << "Insira a marca do veiculo: "; cin >> marca; cout << "Insira a matricula do veiculo: "; cin >> matricula; cout << "Insira o ano do veiculo: "; cin >> ano; oficina.getClienteNome(nome); if(tipo == "Motorizada"){ Veiculo *m = new Motorizada(marca,matricula,ano); oficina.addVeiculo(m); oficina.addVeiculoCliente(m,nome); }else if(tipo == "Camião" || tipo == "Camiao"){ Veiculo *c = new Camiao(marca,matricula,ano); oficina.addVeiculo(c); oficina.addVeiculoCliente(c,nome); }else if(tipo == "Autocarro"){ Veiculo *at = new Autocarro(marca,matricula,ano); oficina.addVeiculo(at); oficina.addVeiculoCliente(at,nome); }else if(tipo == "Automóvel" || tipo == "Automovel"){ Veiculo *am = new Automovel(marca,matricula,ano); oficina.addVeiculo(am); oficina.addVeiculoCliente(am,nome); }else{ cout << "Tipo de veículo inválido.\n"; return; } }catch(VeiculoExistente &e){ cout << e.getMatricula() << " já existe.\n"; }catch(ClienteInexistente &e){ cout << e.getNome() << " não é um cliente.\n"; } } oficina.guardaVeiculos(); oficina.guardaClientes(); addMenu(oficina); break; case 5:{ string matricula; string nomeC; cin.sync(); cout << "Insira o nome do cliente: "; getline(cin,nomeC); cout<<"Insira a matricula do Veiculo: "; cin>>matricula; int pos = oficina.posVeiculo(matricula); if(pos==-1){ cout<<"Veiculo não existe na Oficina! \n"; return; } int tiposervico; cout<<"Que tipo de serviço deseja adicionar? \n"<<"1 Standard \n"<<"2 Não Standard\n "<<"Opcção: "; cin>>tiposervico; switch(tiposervico){ case 1: { string nome; cout << "Qual o nome para o Serviço Standard: "; cin >> nome; int i = oficina.isStandard(nome); if(i == -1){ cout << "Serviço Standard não oferecido pela oficina!\n"; break; } try{ oficina.getClienteNome(nomeC); }catch(ClienteInexistente &e){ cout << e.getNome() << "não é um cliente.\n"; addMenu(oficina); } Cliente c = oficina.getClienteNome(nomeC); Servico *s = oficina.getServicosStandard().at(i); vector <Veiculo *> veic = oficina.getVeiculos(); Date d = s->getDate(); try{ oficina.addServico(c,veic[pos],s,d); }catch(ClienteInexistente &e){ cout << e.getNome() << "não é um cliente.\n"; addMenu(oficina); }catch(VeiculoInexistente &e){ cout << e.getMatricula() << " já existe.\n"; addMenu(oficina); } oficina.setVeiculos(veic); cout<<"Serviço adicionado com sucesso! \n"; break; } case 2: { string nome; int duracao; float preco; vector <string> descricao; cout<<"Escolha um nome para o serviço: "; cin>>nome; cout<<"Qual a duração do serviço: "; cin>>duracao; cout<<"Qual o preço do serviço: "; cin>>preco; int ano,mes,dia,hora,minutos; cout << "Data para agendamento" << endl; cout << "Ano: "; cin >> ano; cout << "Mês: "; cin >> mes; cout << "Dia: "; cin >> dia; cout << "Hora: "; cin >> hora; cout << "Minuto: "; cin >> minutos; try{ oficina.getClienteNome(nomeC); }catch(ClienteInexistente &e){ cout << e.getNome() << "não é um cliente.\n"; addMenu(oficina); } Date d(ano,mes,dia,hora,minutos); Cliente c = oficina.getClienteNome(nomeC); Servico *s1 = new naoStandard(nome,preco,duracao,d); vector <Veiculo *> veic = oficina.getVeiculos(); try{ oficina.addServico(c,veic[pos],s1,d); }catch(ClienteInexistente &e){ cout << e.getNome() << "não é um cliente.\n"; addMenu(oficina); }catch(VeiculoInexistente &e){ cout << e.getMatricula() << "não existe.\n"; addMenu(oficina); } oficina.setVeiculos(veic); cout<<"Serviço adicionado com sucesso! \n"; } break; default: break; } } oficina.guardaVeiculos(); oficina.guardaServicos(); addMenu(oficina); break; default: cout << "Opção inválida. Insira outra vez." << endl; addMenu(oficina); break; } }
void MainWindow::setUpApp( const QString& volume ) { this->setLocalizationLanguage() ; m_ui = new Ui::MainWindow ; m_ui->setupUi( this ) ; this->setFixedSize( this->size() ) ; m_ui->tableWidget->setColumnWidth( 0,220 ) ; m_ui->tableWidget->setColumnWidth( 1,320 ) ; m_ui->tableWidget->setColumnWidth( 2,145 ) ; m_ui->tableWidget->setColumnWidth( 4,87 ) ; m_ui->tableWidget->setColumnWidth( 5,87 ) ; m_ui->tableWidget->hideColumn( 3 ) ; #if QT_VERSION < QT_VERSION_CHECK( 5,0,0 ) m_ui->tableWidget->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents ) ; #else m_ui->tableWidget->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents ) ; #endif m_ui->tableWidget->verticalHeader()->setMinimumSectionSize( 30 ) ; this->setAcceptDrops( true ) ; this->setWindowIcon( QIcon( ":/zuluMount.png" ) ) ; m_ui->tableWidget->setMouseTracking( true ) ; connect( m_ui->tableWidget,SIGNAL( itemEntered( QTableWidgetItem * ) ),this,SLOT( itemEntered( QTableWidgetItem * ) ) ) ; connect( m_ui->tableWidget,SIGNAL( currentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ), this,SLOT( slotCurrentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ) ) ; connect( m_ui->pbmount,SIGNAL( clicked() ),this,SLOT( pbMount() ) ) ; connect( m_ui->pbupdate,SIGNAL( clicked()),this,SLOT( pbUpdate() ) ) ; connect( m_ui->pbclose,SIGNAL( clicked() ),this,SLOT( pbClose() ) ) ; connect( m_ui->tableWidget,SIGNAL( itemClicked( QTableWidgetItem * ) ),this,SLOT( itemClicked( QTableWidgetItem * ) ) ) ; connect( m_ui->pbunlockencfs,SIGNAL( clicked() ),this,SLOT( unlockencfs() ) ) ; connect( this,SIGNAL( unlistVolume( QString ) ),this,SLOT( removeVolume( QString ) ) ) ; this->setUpShortCuts() ; this->setUpFont() ; m_trayIcon = new QSystemTrayIcon( this ) ; m_trayIcon->setIcon( QIcon( ":/zuluMount.png" ) ) ; auto trayMenu = new QMenu( this ) ; m_autoMountAction = new QAction( this ) ; m_autoMount = this->autoMount() ; m_autoMountAction->setCheckable( true ) ; m_autoMountAction->setChecked( m_autoMount ) ; m_autoMountAction->setText( tr( "Automount Volumes" ) ) ; connect( m_autoMountAction,SIGNAL( toggled( bool ) ),this,SLOT( autoMountToggled( bool ) ) ) ; trayMenu->addAction( m_autoMountAction ) ; auto autoOpenFolderOnMount = new QAction( this ) ; autoOpenFolderOnMount->setCheckable( true ) ; m_autoOpenFolderOnMount = this->autoOpenFolderOnMount() ; autoOpenFolderOnMount->setChecked( m_autoOpenFolderOnMount ) ; autoOpenFolderOnMount->setText( tr( "Auto Open Mount Point" ) ) ; connect( autoOpenFolderOnMount,SIGNAL( toggled( bool ) ),this,SLOT( autoOpenFolderOnMount( bool ) ) ) ; trayMenu->addAction( autoOpenFolderOnMount ) ; auto ac = new QAction( this ) ; ac->setText( tr( "Show The Interface" ) ) ; connect( ac,SIGNAL( triggered() ),this,SLOT( raiseWindow() ) ) ; trayMenu->addAction( ac ) ; ac = new QAction( this ) ; ac->setText( tr( "Unmount All" ) ) ; connect( ac,SIGNAL( triggered() ),this,SLOT( unMountAll() ) ) ; trayMenu->addAction( ac ) ; m_favorite_menu = trayMenu->addMenu( tr( "Favorites" ) ) ; connect( m_favorite_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( favoriteClicked( QAction * ) ) ) ; connect( m_favorite_menu,SIGNAL( aboutToShow() ),this,SLOT( showFavorites() ) ) ; m_not_hidden_volume_menu = trayMenu->addMenu( tr( "Hide Volume From View" ) ) ; connect( m_not_hidden_volume_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( removeVolumeFromVisibleVolumeList( QAction * ) ) ) ; connect( m_not_hidden_volume_menu,SIGNAL( aboutToShow() ),this,SLOT( showVisibleVolumeList() ) ) ; m_hidden_volume_menu = trayMenu->addMenu( tr( "Unhide Volume From View" ) ) ; connect( m_hidden_volume_menu,SIGNAL( triggered( QAction * ) ),this,SLOT( removeVolumeFromHiddenVolumeList( QAction * ) ) ) ; connect( m_hidden_volume_menu,SIGNAL( aboutToShow() ),this,SLOT( showHiddenVolumeList() ) ) ; ac = new QAction( this ) ; ac->setText( tr( "About" ) ) ; connect( ac,SIGNAL( triggered() ),this,SLOT( licenseInfo() ) ) ; trayMenu->addAction( ac ) ; trayMenu->addAction( tr( "Quit" ),this,SLOT( pbClose() ) ) ; m_trayIcon->setContextMenu( trayMenu ) ; connect( m_trayIcon,SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), this,SLOT( slotTrayClicked( QSystemTrayIcon::ActivationReason ) ) ) ; m_trayIcon->show() ; QString dirPath = utility::homePath() + "/.zuluCrypt/" ; QDir dir( dirPath ) ; if( !dir.exists() ){ dir.mkdir( dirPath ) ; } this->disableAll() ; this->startAutoMonitor() ; this->updateVolumeList( zuluMountTask::updateVolumeList().await() ) ; if( volume.isEmpty() ) { this->enableAll() ; }else{ this->showMoungDialog( volume ) ; } }
MainMenu::MainMenu(bool isIP, bool isPlugin, QWidget *parent) : QMenuBar(parent), m_isPlugin(isPlugin) { m_isIP = isIP; QAction * action = 0; bool isConnected = 0; // File menu m_fileMenu = new QMenu(tr("&File"),this); addMenu(m_fileMenu); // DLM: actions which result in this menu being deleted should be queued action = new QAction(tr("&New"), this); action->setShortcut(QKeySequence(QKeySequence::New)); m_fileMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(newClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); // DLM: actions which result in this menu being deleted should be queued action = new QAction(tr("&Open"), this); action->setShortcut(QKeySequence(QKeySequence::Open)); m_fileMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(loadFileClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); m_fileMenu->addSeparator(); m_revertToSavedAction = new QAction(tr("Revert to Saved"), this); m_revertToSavedAction->setDisabled(true); m_fileMenu->addAction(m_revertToSavedAction); isConnected = connect(m_revertToSavedAction, SIGNAL(triggered()), this, SIGNAL(revertFileClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); action = new QAction(tr("&Save"), this); action->setShortcut(QKeySequence(QKeySequence::Save)); m_fileMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(saveFileClicked())); OS_ASSERT(isConnected); action = new QAction(tr("Save &As"), this); m_fileMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(saveAsFileClicked())); OS_ASSERT(isConnected); m_fileMenu->addSeparator(); //formatMenu = editMenu->addMenu(tr("&Format")) QMenu * importMenu = m_fileMenu->addMenu(tr("Import")); action = new QAction(tr("IDF"), this); importMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(importClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); action = new QAction(tr("gbXML"), this); importMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(importgbXMLClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); action = new QAction(tr("SDD"), this); importMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(importSDDClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); QMenu * exportMenu = m_fileMenu->addMenu(tr("Export")); action = new QAction(tr("IDF"), this); exportMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(exportClicked())); OS_ASSERT(isConnected); action = new QAction(tr("gbXML"), this); exportMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(exportgbXMLClicked())); OS_ASSERT(isConnected); action = new QAction(tr("SDD"), this); exportMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(exportSDDClicked())); OS_ASSERT(isConnected); action = new QAction(tr("&Load Library"), this); m_fileMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(loadLibraryClicked())); OS_ASSERT(isConnected); if (!m_isPlugin){ m_fileMenu->addSeparator(); //m_fileMenu->addAction(action); //isConnected = connect(action, SIGNAL(triggered()), this, SIGNAL(showRubyConsoleClicked())); //OS_ASSERT(isConnected); m_fileMenu->addSeparator(); action = new QAction(tr("E&xit"), this); action->setShortcuts(QKeySequence::Quit); m_fileMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(exitClicked()), Qt::QueuedConnection); OS_ASSERT(isConnected); } // Preferences menu m_preferencesMenu = new QMenu(tr("&Preferences"),this); addMenu(m_preferencesMenu); QMenu * unitsMenu = m_preferencesMenu->addMenu(tr("Units")); m_displaySIUnitsAction = new QAction(tr("Metric (&SI)"),this); unitsMenu->addAction(m_displaySIUnitsAction); isConnected = connect(m_displaySIUnitsAction, SIGNAL(triggered()),this,SLOT(displaySIUnitsClicked())); OS_ASSERT(isConnected); m_displayIPUnitsAction = new QAction(tr("English (&I-P)"),this); unitsMenu->addAction(m_displayIPUnitsAction); isConnected = connect(m_displayIPUnitsAction, SIGNAL(triggered()),this,SLOT(displayIPUnitsClicked())); OS_ASSERT(isConnected); action = new QAction(tr("Change My Measures Directory"),this); m_preferencesMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(changeMyMeasuresDir())); OS_ASSERT(isConnected); action = new QAction(tr("Scan for Tools"),this); m_preferencesMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(scanForToolsClicked())); OS_ASSERT(isConnected); action = new QAction(tr("Show Tools"),this); m_preferencesMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(showRunManagerPreferencesClicked())); OS_ASSERT(isConnected); action = new QAction(tr("Change BCL Login Information"),this); //m_preferencesMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(changeBclLogin())); OS_ASSERT(isConnected); action = new QAction(tr("&Configure Internet Proxy"),this); m_preferencesMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(configureProxyClicked())); OS_ASSERT(isConnected); if(m_isIP){ m_displayIPUnitsAction->trigger(); } else{ m_displaySIUnitsAction->trigger(); } // Measure menu m_measureMenu = new QMenu(tr("Components && Measures"),this); addMenu(m_measureMenu); action = new QAction(tr("Apply Measure Now"),this); action->setShortcut(QKeySequence(QKeySequence(tr("Ctrl+M")))); m_measureMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(applyMeasureClicked())); OS_ASSERT(isConnected); action = new QAction(tr("Find Measures"),this); m_measureMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(downloadMeasuresClicked())); OS_ASSERT(isConnected); action = new QAction(tr("Find Components"),this); m_measureMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(downloadComponentsClicked())); OS_ASSERT(isConnected); // Help menu m_helpMenu = new QMenu(tr("&Help"),this); addMenu(m_helpMenu); action = new QAction(tr("OpenStudio &Help"),this); m_helpMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(helpClicked())); OS_ASSERT(isConnected); action = new QAction(tr("&About"),this); m_helpMenu->addAction(action); isConnected = connect(action, SIGNAL(triggered()),this,SIGNAL(aboutClicked())); OS_ASSERT(isConnected); }
Menu::Menu() { auto dialogsManager = DependencyManager::get<DialogsManager>(); auto accountManager = DependencyManager::get<AccountManager>(); // File/Application menu ---------------------------------- MenuWrapper* fileMenu = addMenu("File"); // File > Login menu items { addActionToQMenuAndActionHash(fileMenu, MenuOption::Login); // connect to the appropriate signal of the AccountManager so that we can change the Login/Logout menu item connect(accountManager.data(), &AccountManager::profileChanged, dialogsManager.data(), &DialogsManager::toggleLoginDialog); connect(accountManager.data(), &AccountManager::logoutComplete, dialogsManager.data(), &DialogsManager::toggleLoginDialog); } // File > Help addActionToQMenuAndActionHash(fileMenu, MenuOption::Help, 0, qApp, SLOT(showHelp())); // File > About addActionToQMenuAndActionHash(fileMenu, MenuOption::AboutApp, 0, qApp, SLOT(aboutApp()), QAction::AboutRole); // File > Quit addActionToQMenuAndActionHash(fileMenu, MenuOption::Quit, Qt::CTRL | Qt::Key_Q, qApp, SLOT(quit()), QAction::QuitRole); // Edit menu ---------------------------------- MenuWrapper* editMenu = addMenu("Edit"); // Edit > Undo QUndoStack* undoStack = qApp->getUndoStack(); QAction* undoAction = undoStack->createUndoAction(editMenu); undoAction->setShortcut(Qt::CTRL | Qt::Key_Z); addActionToQMenuAndActionHash(editMenu, undoAction); // Edit > Redo QAction* redoAction = undoStack->createRedoAction(editMenu); redoAction->setShortcut(Qt::CTRL | Qt::SHIFT | Qt::Key_Z); addActionToQMenuAndActionHash(editMenu, redoAction); // Edit > Running Scripts addActionToQMenuAndActionHash(editMenu, MenuOption::RunningScripts, Qt::CTRL | Qt::Key_J, qApp, SLOT(toggleRunningScriptsWidget())); // Edit > Open and Run Script from File... [advanced] addActionToQMenuAndActionHash(editMenu, MenuOption::LoadScript, Qt::CTRL | Qt::Key_O, qApp, SLOT(loadDialog()), QAction::NoRole, UNSPECIFIED_POSITION, "Advanced"); // Edit > Open and Run Script from Url... [advanced] addActionToQMenuAndActionHash(editMenu, MenuOption::LoadScriptURL, Qt::CTRL | Qt::SHIFT | Qt::Key_O, qApp, SLOT(loadScriptURLDialog()), QAction::NoRole, UNSPECIFIED_POSITION, "Advanced"); auto scriptEngines = DependencyManager::get<ScriptEngines>(); // Edit > Stop All Scripts... [advanced] addActionToQMenuAndActionHash(editMenu, MenuOption::StopAllScripts, 0, scriptEngines.data(), SLOT(stopAllScripts()), QAction::NoRole, UNSPECIFIED_POSITION, "Advanced"); // Edit > Reload All Scripts... [advanced] addActionToQMenuAndActionHash(editMenu, MenuOption::ReloadAllScripts, Qt::CTRL | Qt::Key_R, scriptEngines.data(), SLOT(reloadAllScripts()), QAction::NoRole, UNSPECIFIED_POSITION, "Advanced"); // Edit > Scripts Editor... [advanced] addActionToQMenuAndActionHash(editMenu, MenuOption::ScriptEditor, Qt::ALT | Qt::Key_S, dialogsManager.data(), SLOT(showScriptEditor()), QAction::NoRole, UNSPECIFIED_POSITION, "Advanced"); // Edit > Console... [advanced] addActionToQMenuAndActionHash(editMenu, MenuOption::Console, Qt::CTRL | Qt::ALT | Qt::Key_J, DependencyManager::get<StandAloneJSConsole>().data(), SLOT(toggleConsole()), QAction::NoRole, UNSPECIFIED_POSITION, "Advanced"); editMenu->addSeparator(); // Edit > My Asset Server auto assetServerAction = addActionToQMenuAndActionHash(editMenu, MenuOption::AssetServer, Qt::CTRL | Qt::SHIFT | Qt::Key_A, qApp, SLOT(toggleAssetServerWidget())); auto nodeList = DependencyManager::get<NodeList>(); QObject::connect(nodeList.data(), &NodeList::canWriteAssetsChanged, assetServerAction, &QAction::setEnabled); assetServerAction->setEnabled(nodeList->getThisNodeCanWriteAssets()); // Edit > Package Model... [advanced] addActionToQMenuAndActionHash(editMenu, MenuOption::PackageModel, 0, qApp, SLOT(packageModel()), QAction::NoRole, UNSPECIFIED_POSITION, "Advanced"); // Edit > Reload All Content [advanced] addActionToQMenuAndActionHash(editMenu, MenuOption::ReloadContent, 0, qApp, SLOT(reloadResourceCaches()), QAction::NoRole, UNSPECIFIED_POSITION, "Advanced"); // Audio menu ---------------------------------- MenuWrapper* audioMenu = addMenu("Audio"); auto audioIO = DependencyManager::get<AudioClient>(); // Audio > Mute addCheckableActionToQMenuAndActionHash(audioMenu, MenuOption::MuteAudio, Qt::CTRL | Qt::Key_M, false, audioIO.data(), SLOT(toggleMute())); // Audio > Show Level Meter addCheckableActionToQMenuAndActionHash(audioMenu, MenuOption::AudioTools, 0, true); // Avatar menu ---------------------------------- MenuWrapper* avatarMenu = addMenu("Avatar"); auto avatarManager = DependencyManager::get<AvatarManager>(); QObject* avatar = avatarManager->getMyAvatar(); // Avatar > Attachments... auto action = addActionToQMenuAndActionHash(avatarMenu, MenuOption::Attachments); connect(action, &QAction::triggered, [] { DependencyManager::get<OffscreenUi>()->show(QString("hifi/dialogs/AttachmentsDialog.qml"), "AttachmentsDialog"); }); // Avatar > Size MenuWrapper* avatarSizeMenu = avatarMenu->addMenu("Size"); // Avatar > Size > Increase addActionToQMenuAndActionHash(avatarSizeMenu, MenuOption::IncreaseAvatarSize, 0, // QML Qt::Key_Plus, avatar, SLOT(increaseSize())); // Avatar > Size > Decrease addActionToQMenuAndActionHash(avatarSizeMenu, MenuOption::DecreaseAvatarSize, 0, // QML Qt::Key_Minus, avatar, SLOT(decreaseSize())); // Avatar > Size > Reset addActionToQMenuAndActionHash(avatarSizeMenu, MenuOption::ResetAvatarSize, 0, // QML Qt::Key_Equal, avatar, SLOT(resetSize())); // Avatar > Reset Sensors addActionToQMenuAndActionHash(avatarMenu, MenuOption::ResetSensors, 0, // QML Qt::Key_Apostrophe, qApp, SLOT(resetSensors())); // Display menu ---------------------------------- // FIXME - this is not yet matching Alan's spec because it doesn't have // menus for "2D"/"3D" - we need to add support for detecting the appropriate // default 3D display mode addMenu(DisplayPlugin::MENU_PATH()); MenuWrapper* displayModeMenu = addMenu(MenuOption::OutputMenu); QActionGroup* displayModeGroup = new QActionGroup(displayModeMenu); displayModeGroup->setExclusive(true); // View menu ---------------------------------- MenuWrapper* viewMenu = addMenu("View"); QActionGroup* cameraModeGroup = new QActionGroup(viewMenu); // View > [camera group] cameraModeGroup->setExclusive(true); // View > First Person cameraModeGroup->addAction(addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::FirstPerson, 0, // QML Qt:: Key_P true, qApp, SLOT(cameraMenuChanged()))); // View > Third Person cameraModeGroup->addAction(addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::ThirdPerson, 0, false, qApp, SLOT(cameraMenuChanged()))); // View > Mirror cameraModeGroup->addAction(addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::FullscreenMirror, 0, // QML Qt::Key_H, false, qApp, SLOT(cameraMenuChanged()))); // View > Independent [advanced] cameraModeGroup->addAction(addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::IndependentMode, 0, false, qApp, SLOT(cameraMenuChanged()), UNSPECIFIED_POSITION, "Advanced")); // View > Entity Camera [advanced] cameraModeGroup->addAction(addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::CameraEntityMode, 0, false, qApp, SLOT(cameraMenuChanged()), UNSPECIFIED_POSITION, "Advanced")); viewMenu->addSeparator(); // View > Mini Mirror addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::MiniMirror, 0, false); // View > Center Player In View addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::CenterPlayerInView, 0, true, qApp, SLOT(rotationModeChanged()), UNSPECIFIED_POSITION, "Advanced"); // View > Overlays addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Overlays, 0, true); // Navigate menu ---------------------------------- MenuWrapper* navigateMenu = addMenu("Navigate"); // Navigate > Show Address Bar addActionToQMenuAndActionHash(navigateMenu, MenuOption::AddressBar, Qt::CTRL | Qt::Key_L, dialogsManager.data(), SLOT(toggleAddressBar())); // Navigate > Bookmark related menus -- Note: the Bookmark class adds its own submenus here. qApp->getBookmarks()->setupMenus(this, navigateMenu); // Navigate > Copy Address [advanced] auto addressManager = DependencyManager::get<AddressManager>(); addActionToQMenuAndActionHash(navigateMenu, MenuOption::CopyAddress, 0, addressManager.data(), SLOT(copyAddress()), QAction::NoRole, UNSPECIFIED_POSITION, "Advanced"); // Navigate > Copy Path [advanced] addActionToQMenuAndActionHash(navigateMenu, MenuOption::CopyPath, 0, addressManager.data(), SLOT(copyPath()), QAction::NoRole, UNSPECIFIED_POSITION, "Advanced"); // Settings menu ---------------------------------- MenuWrapper* settingsMenu = addMenu("Settings"); // Settings > Advance Menus addCheckableActionToQMenuAndActionHash(settingsMenu, "Advanced Menus", 0, false, this, SLOT(toggleAdvancedMenus())); // Settings > Developer Menus addCheckableActionToQMenuAndActionHash(settingsMenu, "Developer Menus", 0, false, this, SLOT(toggleDeveloperMenus())); // Settings > General... action = addActionToQMenuAndActionHash(settingsMenu, MenuOption::Preferences, Qt::CTRL | Qt::Key_Comma, nullptr, nullptr, QAction::PreferencesRole); connect(action, &QAction::triggered, [] { DependencyManager::get<OffscreenUi>()->toggle(QString("hifi/dialogs/GeneralPreferencesDialog.qml"), "GeneralPreferencesDialog"); }); // Settings > Avatar... action = addActionToQMenuAndActionHash(settingsMenu, "Avatar..."); connect(action, &QAction::triggered, [] { DependencyManager::get<OffscreenUi>()->toggle(QString("hifi/dialogs/AvatarPreferencesDialog.qml"), "AvatarPreferencesDialog"); }); // Settings > Audio... action = addActionToQMenuAndActionHash(settingsMenu, "Audio..."); connect(action, &QAction::triggered, [] { DependencyManager::get<OffscreenUi>()->toggle(QString("hifi/dialogs/AudioPreferencesDialog.qml"), "AudioPreferencesDialog"); }); // Settings > LOD... action = addActionToQMenuAndActionHash(settingsMenu, "LOD..."); connect(action, &QAction::triggered, [] { DependencyManager::get<OffscreenUi>()->toggle(QString("hifi/dialogs/LodPreferencesDialog.qml"), "LodPreferencesDialog"); }); // Settings > Control with Speech [advanced] #if defined(Q_OS_MAC) || defined(Q_OS_WIN) auto speechRecognizer = DependencyManager::get<SpeechRecognizer>(); QAction* speechRecognizerAction = addCheckableActionToQMenuAndActionHash(settingsMenu, MenuOption::ControlWithSpeech, Qt::CTRL | Qt::SHIFT | Qt::Key_C, speechRecognizer->getEnabled(), speechRecognizer.data(), SLOT(setEnabled(bool)), UNSPECIFIED_POSITION, "Advanced"); connect(speechRecognizer.data(), SIGNAL(enabledUpdated(bool)), speechRecognizerAction, SLOT(setChecked(bool))); #endif // Developer menu ---------------------------------- MenuWrapper* developerMenu = addMenu("Developer", "Developer"); // Developer > Graphics... action = addActionToQMenuAndActionHash(developerMenu, "Graphics..."); connect(action, &QAction::triggered, [] { DependencyManager::get<OffscreenUi>()->toggle(QString("hifi/dialogs/GraphicsPreferencesDialog.qml"), "GraphicsPreferencesDialog"); }); // Developer > Render >>> MenuWrapper* renderOptionsMenu = developerMenu->addMenu("Render"); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::WorldAxes); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::DefaultSkybox, 0, true); // Developer > Render > Throttle FPS If Not Focus addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::ThrottleFPSIfNotFocus, 0, true); // Developer > Render > Resolution MenuWrapper* resolutionMenu = renderOptionsMenu->addMenu(MenuOption::RenderResolution); QActionGroup* resolutionGroup = new QActionGroup(resolutionMenu); resolutionGroup->setExclusive(true); resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionOne, 0, true)); resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionTwoThird, 0, false)); resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionHalf, 0, false)); resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionThird, 0, false)); resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionQuarter, 0, false)); //const QString = "Automatic Texture Memory"; //const QString = "64 MB"; //const QString = "256 MB"; //const QString = "512 MB"; //const QString = "1024 MB"; //const QString = "2048 MB"; // Developer > Render > Resolution MenuWrapper* textureMenu = renderOptionsMenu->addMenu(MenuOption::RenderMaxTextureMemory); QActionGroup* textureGroup = new QActionGroup(textureMenu); textureGroup->setExclusive(true); textureGroup->addAction(addCheckableActionToQMenuAndActionHash(textureMenu, MenuOption::RenderMaxTextureAutomatic, 0, true)); textureGroup->addAction(addCheckableActionToQMenuAndActionHash(textureMenu, MenuOption::RenderMaxTexture64MB, 0, false)); textureGroup->addAction(addCheckableActionToQMenuAndActionHash(textureMenu, MenuOption::RenderMaxTexture256MB, 0, false)); textureGroup->addAction(addCheckableActionToQMenuAndActionHash(textureMenu, MenuOption::RenderMaxTexture512MB, 0, false)); textureGroup->addAction(addCheckableActionToQMenuAndActionHash(textureMenu, MenuOption::RenderMaxTexture1024MB, 0, false)); textureGroup->addAction(addCheckableActionToQMenuAndActionHash(textureMenu, MenuOption::RenderMaxTexture2048MB, 0, false)); connect(textureGroup, &QActionGroup::triggered, [textureGroup] { auto checked = textureGroup->checkedAction(); auto text = checked->text(); gpu::Context::Size newMaxTextureMemory { 0 }; if (MenuOption::RenderMaxTexture64MB == text) { newMaxTextureMemory = MB_TO_BYTES(64); } else if (MenuOption::RenderMaxTexture256MB == text) { newMaxTextureMemory = MB_TO_BYTES(256); } else if (MenuOption::RenderMaxTexture512MB == text) { newMaxTextureMemory = MB_TO_BYTES(512); } else if (MenuOption::RenderMaxTexture1024MB == text) { newMaxTextureMemory = MB_TO_BYTES(1024); } else if (MenuOption::RenderMaxTexture2048MB == text) { newMaxTextureMemory = MB_TO_BYTES(2048); } gpu::Texture::setAllowedGPUMemoryUsage(newMaxTextureMemory); }); // Developer > Render > LOD Tools addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools, 0, dialogsManager.data(), SLOT(lodTools())); // Developer > Assets >>> MenuWrapper* assetDeveloperMenu = developerMenu->addMenu("Assets"); auto& atpMigrator = ATPAssetMigrator::getInstance(); atpMigrator.setDialogParent(this); addActionToQMenuAndActionHash(assetDeveloperMenu, MenuOption::AssetMigration, 0, &atpMigrator, SLOT(loadEntityServerFile())); // Developer > Avatar >>> MenuWrapper* avatarDebugMenu = developerMenu->addMenu("Avatar"); // Developer > Avatar > Face Tracking MenuWrapper* faceTrackingMenu = avatarDebugMenu->addMenu("Face Tracking"); { QActionGroup* faceTrackerGroup = new QActionGroup(avatarDebugMenu); bool defaultNoFaceTracking = true; #ifdef HAVE_DDE defaultNoFaceTracking = false; #endif QAction* noFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::NoFaceTracking, 0, defaultNoFaceTracking, qApp, SLOT(setActiveFaceTracker())); faceTrackerGroup->addAction(noFaceTracker); #ifdef HAVE_FACESHIFT QAction* faceshiftFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::Faceshift, 0, false, qApp, SLOT(setActiveFaceTracker())); faceTrackerGroup->addAction(faceshiftFaceTracker); #endif #ifdef HAVE_DDE QAction* ddeFaceTracker = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::UseCamera, 0, true, qApp, SLOT(setActiveFaceTracker())); faceTrackerGroup->addAction(ddeFaceTracker); #endif } #ifdef HAVE_DDE faceTrackingMenu->addSeparator(); QAction* binaryEyelidControl = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::BinaryEyelidControl, 0, true); binaryEyelidControl->setVisible(true); // DDE face tracking is on by default QAction* coupleEyelids = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::CoupleEyelids, 0, true); coupleEyelids->setVisible(true); // DDE face tracking is on by default QAction* useAudioForMouth = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::UseAudioForMouth, 0, true); useAudioForMouth->setVisible(true); // DDE face tracking is on by default QAction* ddeFiltering = addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::VelocityFilter, 0, true); ddeFiltering->setVisible(true); // DDE face tracking is on by default QAction* ddeCalibrate = addActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::CalibrateCamera, 0, DependencyManager::get<DdeFaceTracker>().data(), SLOT(calibrate())); ddeCalibrate->setVisible(true); // DDE face tracking is on by default #endif #if defined(HAVE_FACESHIFT) || defined(HAVE_DDE) faceTrackingMenu->addSeparator(); addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::MuteFaceTracking, Qt::CTRL | Qt::SHIFT | Qt::Key_F, true); // DDE face tracking is on by default addCheckableActionToQMenuAndActionHash(faceTrackingMenu, MenuOption::AutoMuteAudio, 0, false); #endif #ifdef HAVE_IVIEWHMD // Developer > Avatar > Eye Tracking MenuWrapper* eyeTrackingMenu = avatarDebugMenu->addMenu("Eye Tracking"); addCheckableActionToQMenuAndActionHash(eyeTrackingMenu, MenuOption::SMIEyeTracking, 0, false, qApp, SLOT(setActiveEyeTracker())); { MenuWrapper* calibrateEyeTrackingMenu = eyeTrackingMenu->addMenu("Calibrate"); addActionToQMenuAndActionHash(calibrateEyeTrackingMenu, MenuOption::OnePointCalibration, 0, qApp, SLOT(calibrateEyeTracker1Point())); addActionToQMenuAndActionHash(calibrateEyeTrackingMenu, MenuOption::ThreePointCalibration, 0, qApp, SLOT(calibrateEyeTracker3Points())); addActionToQMenuAndActionHash(calibrateEyeTrackingMenu, MenuOption::FivePointCalibration, 0, qApp, SLOT(calibrateEyeTracker5Points())); } addCheckableActionToQMenuAndActionHash(eyeTrackingMenu, MenuOption::SimulateEyeTracking, 0, false, qApp, SLOT(setActiveEyeTracker())); #endif addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::AvatarReceiveStats, 0, false, avatarManager.data(), SLOT(setShouldShowReceiveStats(bool))); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderBoundingCollisionShapes); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderMyLookAtVectors, 0, false); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderOtherLookAtVectors, 0, false); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::FixGaze, 0, false); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::AnimDebugDrawDefaultPose, 0, false, avatar, SLOT(setEnableDebugDrawDefaultPose(bool))); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::AnimDebugDrawAnimPose, 0, false, avatar, SLOT(setEnableDebugDrawAnimPose(bool))); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::AnimDebugDrawPosition, 0, false, avatar, SLOT(setEnableDebugDrawPosition(bool))); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::MeshVisible, 0, true, avatar, SLOT(setEnableMeshVisible(bool))); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::DisableEyelidAdjustment, 0, false); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::TurnWithHead, 0, false); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::UseAnimPreAndPostRotations, 0, true, avatar, SLOT(setUseAnimPreAndPostRotations(bool))); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::EnableInverseKinematics, 0, true, avatar, SLOT(setEnableInverseKinematics(bool))); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderSensorToWorldMatrix, 0, false, avatar, SLOT(setEnableDebugDrawSensorToWorldMatrix(bool))); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::ActionMotorControl, Qt::CTRL | Qt::SHIFT | Qt::Key_K, true, avatar, SLOT(updateMotionBehaviorFromMenu()), UNSPECIFIED_POSITION, "Developer"); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::ScriptedMotorControl, 0, true, avatar, SLOT(updateMotionBehaviorFromMenu()), UNSPECIFIED_POSITION, "Developer"); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::EnableCharacterController, 0, true, avatar, SLOT(updateMotionBehaviorFromMenu()), UNSPECIFIED_POSITION, "Developer"); // Developer > Hands >>> MenuWrapper* handOptionsMenu = developerMenu->addMenu("Hands"); addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::DisplayHandTargets, 0, false, avatar, SLOT(setEnableDebugDrawHandControllers(bool))); addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::LowVelocityFilter, 0, true, qApp, SLOT(setLowVelocityFilter(bool))); MenuWrapper* leapOptionsMenu = handOptionsMenu->addMenu("Leap Motion"); addCheckableActionToQMenuAndActionHash(leapOptionsMenu, MenuOption::LeapMotionOnHMD, 0, false); // Developer > Entities >>> MenuWrapper* entitiesOptionsMenu = developerMenu->addMenu("Entities"); addActionToQMenuAndActionHash(entitiesOptionsMenu, MenuOption::OctreeStats, 0, dialogsManager.data(), SLOT(octreeStatsDetails())); addCheckableActionToQMenuAndActionHash(entitiesOptionsMenu, MenuOption::ShowRealtimeEntityStats); // Developer > Network >>> MenuWrapper* networkMenu = developerMenu->addMenu("Network"); addActionToQMenuAndActionHash(networkMenu, MenuOption::ReloadContent, 0, qApp, SLOT(reloadResourceCaches())); addCheckableActionToQMenuAndActionHash(networkMenu, MenuOption::DisableActivityLogger, 0, false, &UserActivityLogger::getInstance(), SLOT(disable(bool))); addActionToQMenuAndActionHash(networkMenu, MenuOption::CachesSize, 0, dialogsManager.data(), SLOT(cachesSizeDialog())); addActionToQMenuAndActionHash(networkMenu, MenuOption::DiskCacheEditor, 0, dialogsManager.data(), SLOT(toggleDiskCacheEditor())); addActionToQMenuAndActionHash(networkMenu, MenuOption::ShowDSConnectTable, 0, dialogsManager.data(), SLOT(showDomainConnectionDialog())); addActionToQMenuAndActionHash(networkMenu, MenuOption::BandwidthDetails, 0, dialogsManager.data(), SLOT(bandwidthDetails())); #if (PR_BUILD || DEV_BUILD) addCheckableActionToQMenuAndActionHash(networkMenu, MenuOption::SendWrongProtocolVersion, 0, false, qApp, SLOT(sendWrongProtocolVersionsSignature(bool))); addCheckableActionToQMenuAndActionHash(networkMenu, MenuOption::SendWrongDSConnectVersion, 0, false, nodeList.data(), SLOT(toggleSendNewerDSConnectVersion(bool))); #endif // Developer > Timing >>> MenuWrapper* timingMenu = developerMenu->addMenu("Timing"); MenuWrapper* perfTimerMenu = timingMenu->addMenu("Performance Timer"); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::DisplayDebugTimingDetails, 0, false); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::OnlyDisplayTopTen, 0, true); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandUpdateTiming, 0, false); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandMyAvatarTiming, 0, false); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandMyAvatarSimulateTiming, 0, false); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandOtherAvatarTiming, 0, false); addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandPaintGLTiming, 0, false); addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::FrameTimer); addActionToQMenuAndActionHash(timingMenu, MenuOption::RunTimingTests, 0, qApp, SLOT(runTests())); addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::PipelineWarnings); addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::LogExtraTimings); addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::SuppressShortTimings); // Developer > Audio >>> MenuWrapper* audioDebugMenu = developerMenu->addMenu("Audio"); addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::AudioNoiseReduction, 0, true, audioIO.data(), SLOT(toggleAudioNoiseReduction())); addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::EchoServerAudio, 0, false, audioIO.data(), SLOT(toggleServerEcho())); addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::EchoLocalAudio, 0, false, audioIO.data(), SLOT(toggleLocalEcho())); addActionToQMenuAndActionHash(audioDebugMenu, MenuOption::MuteEnvironment, 0, audioIO.data(), SLOT(sendMuteEnvironmentPacket())); auto scope = DependencyManager::get<AudioScope>(); MenuWrapper* audioScopeMenu = audioDebugMenu->addMenu("Audio Scope"); addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScope, Qt::CTRL | Qt::Key_P, false, scope.data(), SLOT(toggle())); addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScopePause, Qt::CTRL | Qt::SHIFT | Qt::Key_P, false, scope.data(), SLOT(togglePause())); addDisabledActionAndSeparator(audioScopeMenu, "Display Frames"); { QAction* fiveFrames = addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScopeFiveFrames, 0, true, scope.data(), SLOT(selectAudioScopeFiveFrames())); QAction* twentyFrames = addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScopeTwentyFrames, 0, false, scope.data(), SLOT(selectAudioScopeTwentyFrames())); QAction* fiftyFrames = addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScopeFiftyFrames, 0, false, scope.data(), SLOT(selectAudioScopeFiftyFrames())); QActionGroup* audioScopeFramesGroup = new QActionGroup(audioScopeMenu); audioScopeFramesGroup->addAction(fiveFrames); audioScopeFramesGroup->addAction(twentyFrames); audioScopeFramesGroup->addAction(fiftyFrames); } // Developer > Audio > Audio Network Stats... addActionToQMenuAndActionHash(audioDebugMenu, MenuOption::AudioNetworkStats, 0, dialogsManager.data(), SLOT(audioStatsDetails())); // Developer > Physics >>> MenuWrapper* physicsOptionsMenu = developerMenu->addMenu("Physics"); { auto drawStatusConfig = qApp->getRenderEngine()->getConfiguration()->getConfig<render::DrawStatus>(); addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowOwned, 0, false, drawStatusConfig, SLOT(setShowNetwork(bool))); } addCheckableActionToQMenuAndActionHash(physicsOptionsMenu, MenuOption::PhysicsShowHulls); // Developer > Ask to Reset Settings addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::AskToResetSettings, 0, false); // Developer > Display Crash Options addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::DisplayCrashOptions, 0, true); // Developer > Crash >>> MenuWrapper* crashMenu = developerMenu->addMenu("Crash"); addActionToQMenuAndActionHash(crashMenu, MenuOption::DeadlockInterface, 0, qApp, SLOT(deadlockApplication())); action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashPureVirtualFunction); connect(action, &QAction::triggered, qApp, []() { crash::pureVirtualCall(); }); action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashPureVirtualFunctionThreaded); connect(action, &QAction::triggered, qApp, []() { std::thread([]() { crash::pureVirtualCall(); }); }); action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashDoubleFree); connect(action, &QAction::triggered, qApp, []() { crash::doubleFree(); }); action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashDoubleFreeThreaded); connect(action, &QAction::triggered, qApp, []() { std::thread([]() { crash::doubleFree(); }); }); action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashAbort); connect(action, &QAction::triggered, qApp, []() { crash::doAbort(); }); action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashAbortThreaded); connect(action, &QAction::triggered, qApp, []() { std::thread([]() { crash::doAbort(); }); }); action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashNullDereference); connect(action, &QAction::triggered, qApp, []() { crash::nullDeref(); }); action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashNullDereferenceThreaded); connect(action, &QAction::triggered, qApp, []() { std::thread([]() { crash::nullDeref(); }); }); action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashOutOfBoundsVectorAccess); connect(action, &QAction::triggered, qApp, []() { crash::outOfBoundsVectorCrash(); }); action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashOutOfBoundsVectorAccessThreaded); connect(action, &QAction::triggered, qApp, []() { std::thread([]() { crash::outOfBoundsVectorCrash(); }); }); action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashNewFault); connect(action, &QAction::triggered, qApp, []() { crash::newFault(); }); action = addActionToQMenuAndActionHash(crashMenu, MenuOption::CrashNewFaultThreaded); connect(action, &QAction::triggered, qApp, []() { std::thread([]() { crash::newFault(); }); }); // Developer > Log... addActionToQMenuAndActionHash(developerMenu, MenuOption::Log, Qt::CTRL | Qt::SHIFT | Qt::Key_L, qApp, SLOT(toggleLogDialog())); // Developer > Stats addCheckableActionToQMenuAndActionHash(developerMenu, MenuOption::Stats); #if 0 /// -------------- REMOVED FOR NOW -------------- addDisabledActionAndSeparator(navigateMenu, "History"); QAction* backAction = addActionToQMenuAndActionHash(navigateMenu, MenuOption::Back, 0, addressManager.data(), SLOT(goBack())); QAction* forwardAction = addActionToQMenuAndActionHash(navigateMenu, MenuOption::Forward, 0, addressManager.data(), SLOT(goForward())); // connect to the AddressManager signal to enable and disable the back and forward menu items connect(addressManager.data(), &AddressManager::goBackPossible, backAction, &QAction::setEnabled); connect(addressManager.data(), &AddressManager::goForwardPossible, forwardAction, &QAction::setEnabled); // set the two actions to start disabled since the stacks are clear on startup backAction->setDisabled(true); forwardAction->setDisabled(true); MenuWrapper* toolsMenu = addMenu("Tools"); addActionToQMenuAndActionHash(toolsMenu, MenuOption::ToolWindow, Qt::CTRL | Qt::ALT | Qt::Key_T, dialogsManager.data(), SLOT(toggleToolWindow()), QAction::NoRole, UNSPECIFIED_POSITION, "Advanced"); addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::NamesAboveHeads, 0, true, NULL, NULL, UNSPECIFIED_POSITION, "Advanced"); #endif }