void WatchWidget::CreateWidgets() { m_toolbar = new QToolBar; m_toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); m_table = new QTableWidget; m_table->setColumnCount(5); m_table->verticalHeader()->setHidden(true); m_table->setContextMenuPolicy(Qt::CustomContextMenu); m_table->setSelectionMode(QAbstractItemView::SingleSelection); m_load = AddAction(m_toolbar, tr("Load"), this, &WatchWidget::OnLoad); m_save = AddAction(m_toolbar, tr("Save"), this, &WatchWidget::OnSave); m_load->setEnabled(false); m_save->setEnabled(false); auto* layout = new QVBoxLayout; layout->addWidget(m_toolbar); layout->addWidget(m_table); QWidget* widget = new QWidget; widget->setLayout(layout); setWidget(widget); }
void kexInputKey::InitActions(void) { kexStr actionDef; kexKeyMap *keys; kexArray<kexHashKey> *list; kexStr name; int value; if( !gameManager.GameDef() || !gameManager.GameDef()->GetString("actionDef", actionDef) || !(keys = defManager.FindDefEntry(actionDef))) { common.Warning("kexInputKey::InitActions: No input action definition found\n"); return; } list = keys->GetHashList(); for(int i = 0; i < keys->GetHashSize(); i++) { for(unsigned int j = 0; j < list[i].Length(); j++) { name = list[i][j].GetName(); if(!keys->GetInt(name, value)) { common.Warning("kexInputKey::InitActions: entry %s contains non-integer value (%s)\n", name.c_str(), list[i][j].GetString()); continue; } AddAction((byte)value, (kexStr("+") + name).c_str()); AddAction((byte)value, (kexStr("-") + name).c_str()); } } }
void WatchWidget::ShowContextMenu() { QMenu* menu = new QMenu(this); if (m_table->selectedItems().size()) { auto row_variant = m_table->selectedItems()[0]->data(Qt::UserRole); if (!row_variant.isNull()) { int row = row_variant.toInt(); if (row >= 0) { // i18n: This kind of "watch" is used for watching emulated memory. // It's not related to timekeeping devices. AddAction(menu, tr("&Delete Watch"), this, [this, row] { DeleteWatch(row); }); AddAction(menu, tr("&Add Memory Breakpoint"), this, [this, row] { AddWatchBreakpoint(row); }); } } } menu->addSeparator(); AddAction(menu, tr("Update"), this, &WatchWidget::Update); menu->exec(QCursor::pos()); }
IcecastFilterWidget::IcecastFilterWidget(QWidget* parent) : QWidget(parent), ui_(new Ui_IcecastFilterWidget), menu_(new QMenu(tr("Display options"), this)), sort_mode_mapper_(new QSignalMapper(this)) { ui_->setupUi(this); // Icons ui_->options->setIcon(IconLoader::Load("configure")); // Options actions QActionGroup* group = new QActionGroup(this); AddAction(group, ui_->action_sort_genre_popularity, IcecastModel::SortMode_GenreByPopularity); AddAction(group, ui_->action_sort_genre_alphabetically, IcecastModel::SortMode_GenreAlphabetical); AddAction(group, ui_->action_sort_station, IcecastModel::SortMode_StationAlphabetical); // Options menu menu_->setIcon(ui_->options->icon()); menu_->addActions(group->actions()); ui_->options->setMenu(menu_); connect(sort_mode_mapper_, SIGNAL(mapped(int)), SLOT(SortModeChanged(int))); }
IcecastFilterWidget::IcecastFilterWidget(QWidget *parent) : QWidget(parent), ui_(new Ui_IcecastFilterWidget), sort_mode_mapper_(new QSignalMapper(this)) { ui_->setupUi(this); // Icons ui_->options->setIcon(IconLoader::Load("configure")); // Options actions QActionGroup* group = new QActionGroup(this); AddAction(group, ui_->action_sort_genre_popularity, IcecastModel::SortMode_GenreByPopularity); AddAction(group, ui_->action_sort_genre_alphabetically, IcecastModel::SortMode_GenreAlphabetical); AddAction(group, ui_->action_sort_station, IcecastModel::SortMode_StationAlphabetical); // Options menu QMenu* options_menu = new QMenu(this); options_menu->addActions(group->actions()); ui_->options->setMenu(options_menu); connect(sort_mode_mapper_, SIGNAL(mapped(int)), SLOT(SortModeChanged(int))); #ifdef Q_OS_DARWIN delete ui_->filter; MacLineEdit* lineedit = new MacLineEdit(this); ui_->horizontalLayout->insertWidget(1, lineedit); filter_ = lineedit; #else filter_ = ui_->filter; #endif }
void MenuBar::AddFileMenu() { QMenu* file_menu = addMenu(tr("&File")); m_open_action = AddAction(file_menu, tr("&Open..."), this, &MenuBar::Open, QKeySequence(QStringLiteral("Ctrl+O"))); m_exit_action = AddAction(file_menu, tr("E&xit"), this, &MenuBar::Exit, QKeySequence(QStringLiteral("Alt+F4"))); }
//----------------------------------------------------------------------------- //! Create menu from common actions //----------------------------------------------------------------------------- tVesselsSettingsMenuLowrance::tVesselsSettingsMenuLowrance( QWidget* parent ) : tVesselsSettingsMenuCommon( parent ) { SetTitle( tr( "Vessels", "TITLE" ) ); tDistanceUnits distanceUnits = (tDistanceUnits)tUnitsSettings::Instance()->Units( UNITS_DISTANCE ); // Must match tVesselsSettings.cpp QStringList lengthOptions; lengthOptions << tr( "Off" ); if ( distanceUnits == UNITS_DISTANCE_NAUTICAL_MILES ) { lengthOptions << tr( "1 NM", "nautical miles" ); lengthOptions << tr( "10 NM", "nautical miles" ); lengthOptions << tr( "100 NM", "nautical miles" ); } else if ( distanceUnits == UNITS_DISTANCE_KILOMETERS ) { lengthOptions << tr( "1 km", "kilometers" ); lengthOptions << tr( "10 km", "kilometers" ); lengthOptions << tr( "100 km", "kilometers" ); } else if ( distanceUnits == UNITS_DISTANCE_MILES ) { lengthOptions << tr( "1 mile", "miles" ); lengthOptions << tr( "10 miles", "miles" ); lengthOptions << tr( "100 miles", "miles" ); } lengthOptions << tr( "1 min", "minutes" ) << tr( "2 min", "minutes" ) << tr( "10 min", "minutes" ) << tr( "30 min", "minutes" ) << tr( "60 min", "minutes" ) << tr( "120 min", "minutes" ); int initialIndex = 0; if ( m_VesselsSettings.ExtensionLines() && m_VesselsSettings.CourseExtensionConfig() != tVesselsSettings::Extension_Infinite ) { initialIndex = static_cast<int>( m_VesselsSettings.CourseExtensionConfig() ) + 1; //Plus one to step over "Off" } m_pCourseExtensionAct = new tListAction( tr( "Course extension" ), lengthOptions, initialIndex ); Connect( m_pCourseExtensionAct, SIGNAL( ValueFinalised( int ) ), this, SLOT( OnCourseExtensionFinalised( int ) ) ); // HDS 5x (sonar-only) doesn't fully expose AIS, but does have MARPA // MARPA only really needs the course extension and dangerous vessels menu items if( tProductSettings::Instance().AISAllowed() ) { AddAction( m_pSetMMSIAct ); AddAction( m_pHideIconsAct ); } AddAction( m_pCourseExtensionAct ); AddAction( m_pDangerousVesselsAct ); }
void __fastcall TReconcileErrorForm::InitReconcileActions() { AddAction(raSkip); AddAction(raCancel); AddAction(raCorrect); if (FCurColIdx > 0) { AddAction(raRefresh); AddAction(raMerge); } ActionGroup->ItemIndex = 0; }
void MenuBar::AddOptionsMenu() { QMenu* options_menu = addMenu(tr("&Options")); AddAction(options_menu, tr("Co&nfiguration"), this, &MenuBar::Configure); options_menu->addSeparator(); AddAction(options_menu, tr("&Graphics Settings"), this, &MenuBar::ConfigureGraphics); AddAction(options_menu, tr("&Audio Settings"), this, &MenuBar::ConfigureAudio); AddAction(options_menu, tr("&Controller Settings"), this, &MenuBar::ConfigureControllers); AddAction(options_menu, tr("&Hotkey Settings"), this, &MenuBar::ConfigureHotkeys); }
DemoOcclusion::DemoOcclusion() { SetTitle("Occlusion Demo"); AddAction('1', "Increase Occlusion", std::bind(&DemoOcclusion::OcclusionInc, this)); AddAction('2', "Decrease Occlusion", std::bind(&DemoOcclusion::OcclusionDec, this)); OccludeValue = 0; YSE::System().occlusionCallback(OcclusionFunction); sound.create("..\\TestResources\\pulse1.ogg", nullptr, true); sound.occlusion(true); sound.play(); }
//----------------------------------------------------------------------------- //! Create menu from common actions //----------------------------------------------------------------------------- tCZoneSettingsMenuSimrad::tCZoneSettingsMenuSimrad( QWidget* parent ) : tCZoneSettingsMenuCommon( parent ) { SetTitle( "CZone" ); // don't need to translate brand name AddAction( m_pSetBatteryFullAction ); AddAction( m_pShowOnStartupAction ); AddAction( m_pBacklightAction ); AddSeparator(); AddAction( m_pSetDipswitchAction ); // AddAction( m_pReclaimAction ); }
void MenuBar::AddStateLoadMenu(QMenu* emu_menu) { m_state_load_menu = emu_menu->addMenu(tr("&Load State")); AddAction(m_state_load_menu, tr("Load State from File"), this, &MenuBar::StateLoad); AddAction(m_state_load_menu, tr("Load State from Selected Slot"), this, &MenuBar::StateLoadSlot); m_state_load_slots_menu = m_state_load_menu->addMenu(tr("Load State from Slot")); AddAction(m_state_load_menu, tr("Undo Load State"), this, &MenuBar::StateLoadUndo); for (int i = 1; i <= 10; i++) { QAction* action = m_state_load_slots_menu->addAction(QStringLiteral("")); connect(action, &QAction::triggered, this, [=]() { emit StateLoadSlotAt(i); }); } }
bool CCharShape::RotateNode (size_t node_name, int axis, ETR_DOUBLE angle) { TCharNode *node = GetNode (node_name); if (node == NULL) return false; if (axis > 3) return false; TMatrix<4, 4> rotMatrix; char caxis = '0'; switch (axis) { case 1: caxis = 'x'; break; case 2: caxis = 'y'; break; case 3: caxis = 'z'; break; } rotMatrix.SetRotationMatrix(angle, caxis); node->trans = node->trans * rotMatrix; rotMatrix.SetRotationMatrix(-angle, caxis); node->invtrans = rotMatrix * node->invtrans; if (newActions && useActions) AddAction (node_name, axis, NullVec3, angle); return true; }
/* Handles startup. */ static AIErr StartupPlugin ( SPInterfaceMessage* message ) { AIErr error = kNoErr; error = AcquireSuites( message->d.basic ); if (!error) { // Allocate our globals - Illustrator will keep track of these. error = message->d.basic->AllocateBlock( sizeof(Globals), (void **) &g ); if ( !error ) { message->d.globals = g; } } if (!error) { error = AddMenu(message); } if (!error) { error = AddFilter(message); } if (!error) { error = AddTool(message); } if (!error) { error = AddAction(message); } ReleaseSuites( message->d.basic ); return error; }
QAction* NodeInstanceWidget::AddActionDelete() { return AddAction( tr("Delete"), [this](){ deleteLater(); emit DeleteNodeInstance(mNodeInstance); }); }
void MenuBar::AddStateSaveMenu(QMenu* emu_menu) { m_state_save_menu = emu_menu->addMenu(tr("Sa&ve State")); AddAction(m_state_save_menu, tr("Save State to File"), this, &MenuBar::StateSave); AddAction(m_state_save_menu, tr("Save State to Selected Slot"), this, &MenuBar::StateSaveSlot); AddAction(m_state_save_menu, tr("Save State to Oldest Slot"), this, &MenuBar::StateSaveOldest); m_state_save_slots_menu = m_state_save_menu->addMenu(tr("Save State to Slot")); AddAction(m_state_save_menu, tr("Undo Save State"), this, &MenuBar::StateSaveUndo); for (int i = 1; i <= 10; i++) { QAction* action = m_state_save_slots_menu->addAction(QStringLiteral("")); connect(action, &QAction::triggered, this, [=]() { emit StateSaveSlotAt(i); }); } }
bool CCharShape::RotateNode (size_t node_name, int axis, double angle) { TCharNode *node = GetNode (node_name); if (node == NULL) return false; if (axis > 3) return false; TMatrix rotMatrix; char caxis = '0'; switch (axis) { case 1: caxis = 'x'; break; case 2: caxis = 'y'; break; case 3: caxis = 'z'; break; } MakeRotationMatrix (rotMatrix, angle, caxis); MultiplyMatrices (node->trans, node->trans, rotMatrix); MakeRotationMatrix (rotMatrix, -angle, caxis); MultiplyMatrices (node->invtrans, rotMatrix, node->invtrans); if (newActions && useActions) AddAction (node_name, axis, NullVec, angle); return true; }
void OMenu :: AddAction (OEHAction *action ) { if ( action ) AddAction(action->get_qaction()); }
logical OMenu :: SetupActions (OEHAction *action ) { QAction *before_action = NULL; OEHAction *oeh_action = NULL; OPopupMenu *sub_menu = NULL; int count = 0; int indx0 = 0; logical term = NO; BEGINSEQ if( !qwidget ) ERROR if( !action || !action->get_childs() ) ERROR if ( !qwidget->actions().isEmpty() ) before_action = qwidget->actions().first(); count = action->get_childs()->size(); menu_action = action; qwidget->setObjectName(action->GetName()); while ( indx0 < count ) { oeh_action = action->get_childs()->at(indx0++); if ( oeh_action->IsSeparated() ) AddSeparator(before_action); if ( !oeh_action->get_childs() || oeh_action->get_childs()->size() <= 0 ) AddAction(oeh_action->get_qaction(),before_action); else if ( oeh_action->IsGrouped() ) AddActions(&oeh_action->get_group()->actions(),before_action); else AddMenu(oeh_action,before_action); } RECOVER term = YES; ENDSEQ return(term); }
STDMETHODIMP CPropertyChoice::AddActionsByCLSID (CALPCLSID *pcaClsIds) { HRESULT hr = E_FAIL; if (!m_fIsInitialized) { hr = InitNew(); if (FAILED(hr)) return hr; } // hinzufügen der einzelnen Aktionen for (ULONG i = 0; i < pcaClsIds -> cElems; i++) { try { WPropertyAction WAct (*(pcaClsIds -> ppElems[i])); // throws hr { WPersistStreamInit Init = WAct; // throws hr hr = Init -> InitNew(); if (FAILED(hr)) _com_issue_error(hr); } hr = AddAction (WAct); if (FAILED(hr)) _com_issue_error(hr); } catch (_com_error& hr) { return _COM_ERROR(hr); } } return NOERROR; }
/// \brief serialize current object state for redo action /// \param size - sizeof(IHashString*) /// \param param - pointer to IHashString with name of object to serialize DWORD CUndoRedoComponent::OnRedoSaveObject(DWORD size, void *param) { ASSERT(m_pCurrentCommandData != NULL); VERIFY_MESSAGE_SIZE(size, sizeof(IHashString*)); IHashString *pObjectName = GetName(param); if (pObjectName == NULL) { return MSG_ERROR; } DWORD res = m_DependantProcessors.ProcessObject(pObjectName, false); if (MSG_HANDLED != res) { return res; } IUndoRedoAction *pAction = new CObjectSerializeAction(pObjectName); res = AddAction(pAction, false); if (res != MSG_HANDLED) { delete pAction; } return res; }
nsresult nsEudoraFilters::AddMailboxAction(const char* pMailboxPath, bool isTransfer) { nsresult rv; nsCString nameHierarchy; #if defined(XP_WIN) nsCString filePath; m_pLocation->GetNativePath(filePath); int32_t index = filePath.RFindChar('\\'); if (index >= 0) filePath.SetLength(index); if (!nsEudoraWin32::GetMailboxNameHierarchy(filePath, pMailboxPath, nameHierarchy)) return NS_ERROR_INVALID_ARG; #endif #ifdef XP_MACOSX nameHierarchy = pMailboxPath; #endif nsCOMPtr<nsIMsgFolder> folder; rv = GetMailboxFolder(nameHierarchy.get(), getter_AddRefs(folder)); nsAutoCString folderURI; if (NS_SUCCEEDED(rv)) rv = folder->GetURI(folderURI); if (NS_FAILED(rv)) return NS_ERROR_INVALID_ARG; rv = AddAction(isTransfer? (nsMsgRuleActionType)nsMsgFilterAction::MoveToFolder : (nsMsgRuleActionType)nsMsgFilterAction::CopyToFolder, 0, 0, 0, nullptr, folderURI.get()); if (NS_SUCCEEDED(rv) && isTransfer) m_hasTransfer = true; return rv; }
/** Add a action to a tray button. */ void AddTrayButtonAction(TrayComponentType *cp, const char *action, int mask) { TrayButtonType *bp = (TrayButtonType*)cp->object; AddAction(&bp->actions, action, mask); }
/** Add an action to a clock. */ void AddClockAction(TrayComponentType *cp, const char *action, int mask) { ClockType *clock = (ClockType*)cp->object; AddAction(&clock->actions, action, mask); }
void AttentionMessage::AddDontShowAgain() { auto id = m_id; AddAction( MSW_OR_OTHER(_("Don't show again"), _("Don't Show Again")), [id]{ AddToBlacklist(id); }); }
void CRollbackInfo::AddActionUnregister(CString sFile) { // Set up information CRollbackActionBase * pAction = new CRollbackActionUnregister(sFile); // Add to array AddAction(pAction); }
void CRollbackInfo::AddActionCopy(CString sOldLocation, CString sNewLocation) { // Set up information CRollbackActionBase * pAction = new CRollbackActionCopy(sOldLocation, sNewLocation); // Add to array AddAction(pAction); }
void State::MeltWith(State *s) { // copy actions of s to state Action *a; for (Action *action = s->firstAction; action != NULL; action = action->next) { a = new Action(action->typ, action->sym, action->tc); a->AddTargets(action); AddAction(a); } }
QAction* NodeInstanceWidget::AddActionEditEnvVars() { return AddAction( tr("Edit Env. Vars."), [this](){ EnvVarEditor* envVarEditor = new EnvVarEditor( mNodeInstance->GetVars(), this ); envVarEditor->setWindowTitle( tr("Variables: %1").arg( mNodeInstance->GetScriptPath() ) ); envVarEditor->show(); }); }
QAction* NodeInstanceWidget::AddActionLog() { return AddAction( tr("Log"), [this]() { NodeLogWindow* logWindow = new NodeLogWindow( mNodeInstance, this ); logWindow->setWindowTitle( tr("Log: %1").arg( mNodeInstance->GetScriptPath() ) ); logWindow->show(); }); }