本文整理汇总了C++中core::ActionContainer::setTranslations方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionContainer::setTranslations方法的具体用法?C++ ActionContainer::setTranslations怎么用?C++ ActionContainer::setTranslations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::ActionContainer
的用法示例。
在下文中一共展示了ActionContainer::setTranslations方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: editContext
/////////////////////////////////////////////////////////////////////////// Action Handler
TemplatesViewActionHandler::TemplatesViewActionHandler(QObject *parent) :
QObject(parent),
aAdd(0),
aRemove(0),
aEdit(0),
aPrint(0),
aSave(0),
aLocker(0),
aDatabaseInfos(0),
m_CurrentView(0),
m_IsLocked(settings()->value(Constants::S_LOCKCATEGORYVIEW).toBool())
{
if (!actionManager())
return;
Core::Context editContext(::C_BASIC_EDIT);
Core::Context lockContext(::C_BASIC_LOCK);
Core::Context addContext(::C_BASIC_ADD);
Core::Context removeContext(::C_BASIC_REMOVE);
Core::Context saveContext(::C_BASIC_SAVE);
Core::Context printContext(::C_BASIC_PRINT);
// Edit Menu and Contextual Menu
Core::ActionContainer *editMenu = actionManager()->actionContainer(Core::Constants::M_EDIT);
Core::ActionContainer *cmenu = actionManager()->actionContainer(Core::Constants::M_EDIT_TEMPLATES);
if (!cmenu) {
cmenu = actionManager()->createMenu(Core::Constants::M_EDIT_TEMPLATES);
cmenu->appendGroup(Core::Id(Core::Constants::G_EDIT_TEMPLATES));
cmenu->appendGroup(Core::Id(Core::Constants::G_EDIT_CATEGORIES));
cmenu->setTranslations(Trans::Constants::M_EDIT_TEMPLATES_TEXT);
if (editMenu)
editMenu->addMenu(cmenu, Core::Constants::G_EDIT_TEMPLATES);
}
// Add
aAdd = registerAction("TemplatesView.aAdd", cmenu, Core::Constants::ICONADD,
Core::Constants::A_TEMPLATE_ADD, Core::Constants::G_EDIT_TEMPLATES,
Trans::Constants::ADDCATEGORY_TEXT, addContext, this);
connect(aAdd, SIGNAL(triggered()), this, SLOT(addCategory()));
// Remove
aRemove = registerAction("TemplatesView.aRemove", cmenu, Core::Constants::ICONREMOVE,
Core::Constants::A_TEMPLATE_REMOVE, Core::Constants::G_EDIT_TEMPLATES,
Trans::Constants::REMOVE_TEXT, removeContext, this);
connect(aRemove, SIGNAL(triggered()), this, SLOT(removeItem()));
// Edit
aEdit = registerAction("TemplatesView.aEdit", cmenu, Core::Constants::ICONEDIT,
Core::Constants::A_TEMPLATE_EDIT, Core::Constants::G_EDIT_TEMPLATES,
Trans::Constants::M_EDIT_TEXT, editContext, this);
connect(aEdit, SIGNAL(triggered()), this, SLOT(editCurrentItem()));
// Edit
aPrint = registerAction("TemplatesView.aPrint", cmenu, Core::Constants::ICONPRINT,
Core::Constants::A_TEMPLATE_PRINT, Core::Constants::G_EDIT_TEMPLATES,
Trans::Constants::FILEPRINT_TEXT, printContext, this);
connect(aPrint, SIGNAL(triggered()), this, SLOT(print()));
// Save
aSave = registerAction("TemplatesView.aSave", cmenu, Core::Constants::ICONSAVE,
Core::Constants::A_TEMPLATE_SAVE, Core::Constants::G_EDIT_TEMPLATES,
Trans::Constants::FILESAVE_TEXT, saveContext, this);
connect(aSave, SIGNAL(triggered()), this, SLOT(saveModel()));
// Locker
aLocker = registerAction("TemplatesView.aLocker", cmenu, Core::Constants::ICONUNLOCK,
Core::Constants::A_TEMPLATE_LOCK, Core::Constants::G_EDIT_TEMPLATES,
Trans::Constants::UNLOCKED_TEXT, lockContext, this);
connect(aLocker, SIGNAL(triggered()), this, SLOT(lock()));
// Database information
Core::ActionContainer *hmenu = actionManager()->actionContainer(Core::Constants::M_HELP_DATABASES);
if (hmenu) {
aDatabaseInfos = registerAction("TemplatesView.aDbInfos", hmenu, Core::Constants::ICONABOUT,
Core::Constants::A_TEMPLATE_DATABASEINFORMATION,
Core::Constants::G_HELP_DATABASES,
Trans::Constants::TEMPLATES_DATABASE_INFORMATION_TEXT,
Core::Context(Core::Constants::C_GLOBAL), this);
connect(aDatabaseInfos, SIGNAL(triggered()), this, SLOT(databaseInformation()));
// contextManager()->updateContext();
}
updateActions();
}
示例2: ctx
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////// ACTION HANDLER ///////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
FormActionHandler::FormActionHandler(QObject *parent) :
QObject(parent),
aClear(0),
aShowDatabaseInformation(0),
aCreateEpisode(0), aValidateEpisode(0), aRenewEpisode(0), aRemoveEpisode(0), aSaveEpisode(0),
aTakeScreenshot(0),
aAddForm(0),
aRemoveSubForm(0),
aPrintForm(0),
m_CurrentView(0)
{
setObjectName("FormActionHandler");
QAction *a = 0;
Core::Command *cmd = 0;
Core::Context ctx(Form::Constants::C_FORM_PLUGINS);
// Create the plugin specific menu
Core::ActionContainer *menu = actionManager()->actionContainer(Core::Id(Form::Constants::M_PLUGIN_FORM));
if (!menu) {
menu = actionManager()->createMenu(Form::Constants::M_PLUGIN_FORM);
// menu->appendGroup(Core::Id(Form::Constants::G_PLUGINS_VIEWS));
// menu->appendGroup(Core::Id(Form::Constants::G_PLUGINS_MODES));
// menu->appendGroup(Core::Id(Form::Constants::G_PLUGINS_SEARCH));
// menu->appendGroup(Core::Id(Form::Constants::G_PLUGINS_DRUGS));
// menu->appendGroup(Core::Id(Form::Constants::G_PLUGINS_INTERACTIONS));
menu->setTranslations(Form::Constants::M_FORM_TEXT);
// Add the menu to the menubar or to the plugin menu
#ifdef FREEMEDFORMS
actionManager()->actionContainer(Core::Id(Core::Constants::M_PLUGINS))->addMenu(menu, Core::Constants::G_PLUGINS_FORM);
#else
actionManager()->actionContainer(Core::Id(Core::Constants::MENUBAR))->addMenu(menu, Core::Constants::G_PLUGINS);
#endif
}
Q_ASSERT(menu);
// Create local actions
// Example: register existing Core actions
aClear = registerAction(Core::Constants::A_LIST_CLEAR, ctx, this);
connect(aClear, SIGNAL(triggered()), this, SLOT(onClearRequested()));
aSaveEpisode = registerAction(Core::Constants::A_FILE_SAVE, ctx, this);
connect(aSaveEpisode, SIGNAL(triggered()), this, SLOT(onSaveEpisodeRequested()));
aCreateEpisode = createAction(this, "aCreateEpisode", Core::Constants::ICONADD,
Constants::A_ADDEPISODE,
ctx,
Constants::ADDEPISODE_TEXT, Constants::FORM_TR_CONTEXT,
cmd,
0, "",
QKeySequence::UnknownKey, false);
connect(aCreateEpisode, SIGNAL(triggered()), this, SLOT(onCreateEpisodeRequested()));
a = aValidateEpisode = new QAction(this);
a->setObjectName("aValidateEpisode");
a->setIcon(theme()->icon(Core::Constants::ICONVALIDATEDARK));
cmd = actionManager()->registerAction(a, Constants::A_VALIDATEEPISODE, ctx);
cmd->setTranslations(Constants::VALIDATEEPISODE_TEXT, Constants::VALIDATEEPISODE_TEXT, Constants::FORM_TR_CONTEXT);
// cmenu->addAction(cmd, Core::Constants::G_EDIT_LIST);
connect(aValidateEpisode, SIGNAL(triggered()), this, SLOT(onValidateEpisodeRequested()));
aRenewEpisode = createAction(this, "aRenewEpisode", Core::Constants::ICONRENEW,
Constants::A_RENEWEPISODE,
ctx,
Trans::Constants::RENEW_EPISODE, "",
cmd,
0, "",
QKeySequence::UnknownKey, false);
connect(aRenewEpisode, SIGNAL(triggered()), this, SLOT(onRenewEpisodeRequested()));
#ifdef WITH_EPISODE_REMOVAL
aRemoveEpisode = createAction(this, "aRemoveEpisode", Core::Constants::ICONREMOVE,
Constants::A_REMOVEEPISODE,
ctx,
Trans::Constants::REMOVE_EPISODE, "",
cmd,
0, "",
QKeySequence::UnknownKey, false);
connect(aRemoveEpisode, SIGNAL(triggered()), this, SLOT(onRemoveEpisodeRequested()));
#endif
aTakeScreenshot = createAction(this, "aTakeScreenshot", Core::Constants::ICONTAKESCREENSHOT,
Constants::A_TAKESCREENSHOT,
ctx,
Trans::Constants::TAKE_SCREENSHOT, "",
cmd,
0, "",
QKeySequence::UnknownKey, false);
connect(aTakeScreenshot, SIGNAL(triggered()), this, SLOT(onTakeScreenshotRequested()));
a = aAddForm = new QAction(this);
a->setObjectName("aAddForm");
a->setIcon(theme()->icon(Core::Constants::ICONADD));
cmd = actionManager()->registerAction(a, Constants::A_ADDFORM, ctx);
cmd->setTranslations(Constants::ADDFORM_TEXT, Constants::ADDFORM_TEXT, Constants::FORM_TR_CONTEXT);
// cmenu->addAction(cmd, Core::Constants::G_EDIT_LIST);
//.........这里部分代码省略.........
示例3: ctx
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////// ACTION HANDLER ///////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Actions :
// Toggle search patient view
// Search method ?
// Limit database usage ?
// View patients information
// Patient selection history
PatientActionHandler::PatientActionHandler(QObject *parent) :
QObject(parent),
m_RecentPatients(0),
aSearchName(0),
aSearchFirstname(0),
aSearchNameFirstname(0),
aSearchDob(0),
aViewPatientInformation(0),
aPrintPatientInformation(0),
aShowPatientDatabaseInformation(0),
aViewCurrentPatientData(0),
aExportPatientFile(0),
gSearchMethod(0)
{
setObjectName("PatientActionHandler");
m_RecentPatients = new Core::FileManager(this);
Core::ITheme *th = Core::ICore::instance()->theme();
QAction *a = 0;
Core::Command *cmd = 0;
Core::Context ctx(Patients::Constants::C_PATIENTS);
Core::Context searchcontext(Patients::Constants::C_PATIENTS_SEARCH, Core::Constants::C_GLOBAL);
Core::Context globalcontext(Core::Constants::C_GLOBAL);
Core::ActionContainer *menu = actionManager()->actionContainer(Core::Id(Core::Constants::M_PATIENTS));
if (!menu) {
Utils::warningMessageBox(tr("Fatal Error"), tr("%1: Unable to retrieve patients menu.").arg(objectName()));
return;
}
Q_ASSERT(menu);
if (!menu)
return;
menu->appendGroup(Core::Id(Constants::G_PATIENTS));
menu->appendGroup(Core::Id(Constants::G_PATIENTS_NEW));
menu->appendGroup(Core::Id(Constants::G_PATIENTS_SEARCH));
menu->appendGroup(Core::Id(Constants::G_PATIENTS_HISTORY));
menu->appendGroup(Core::Id(Constants::G_PATIENTS_INFORMATION));
// actionManager()->actionContainer(Core::Constants::M_PATIENTS)->addMenu(menu, Core::Constants::G_PATIENTS);
connect(actionManager()->command(Core::Constants::A_PATIENT_REMOVE)->action(), SIGNAL(triggered()), this, SLOT(removePatient()));
// Search method menu
Core::ActionContainer *searchmenu = actionManager()->actionContainer(Core::Id(Constants::M_PATIENTS_SEARCH));
if (!searchmenu) {
searchmenu = actionManager()->createMenu(Constants::M_PATIENTS_SEARCH);
searchmenu->appendGroup(Core::Id(Constants::G_PATIENTS_SEARCH));
searchmenu->setTranslations(Trans::Constants::SEARCHMENU_TEXT);
menu->addMenu(searchmenu, Core::Id(Constants::G_PATIENTS_SEARCH));
}
Q_ASSERT(searchmenu);
// TODO: create search icons
gSearchMethod = new QActionGroup(this);
a = aSearchName = new QAction(this);
a->setObjectName("aSearchName");
a->setCheckable(true);
a->setChecked(false);
a->setIcon(th->icon(Core::Constants::ICONSEARCH));
cmd = actionManager()->registerAction(a, Core::Id(Constants::A_SEARCH_PATIENTS_BY_NAME), searchcontext);
cmd->setTranslations(Constants::SEARCHBYNAME_TEXT, Constants::SEARCHBYNAME_TOOLTIP, Constants::TRANS_CONTEXT);
searchmenu->addAction(cmd, Core::Id(Constants::G_PATIENTS_SEARCH));
gSearchMethod->addAction(a);
a = aSearchFirstname = new QAction(this);
a->setObjectName("aSearchFirstname");
a->setCheckable(true);
a->setChecked(false);
a->setIcon(th->icon(Core::Constants::ICONSEARCH));
cmd = actionManager()->registerAction(a, Core::Id(Constants::A_SEARCH_PATIENTS_BY_FIRSTNAME), searchcontext);
cmd->setTranslations(Constants::SEARCHBYFIRSTNAME_TEXT, Constants::SEARCHBYFIRSTNAME_TOOLTIP, Constants::TRANS_CONTEXT);
searchmenu->addAction(cmd, Core::Id(Constants::G_PATIENTS_SEARCH));
gSearchMethod->addAction(a);
a = aSearchNameFirstname = new QAction(this);
a->setObjectName("aSearchNameFirstname");
a->setCheckable(true);
a->setChecked(false);
a->setIcon(th->icon(Core::Constants::ICONSEARCH));
cmd = actionManager()->registerAction(a, Core::Id(Constants::A_SEARCH_PATIENTS_BY_NAMEFIRSTNAME), searchcontext);
cmd->setTranslations(Constants::SEARCHBYNAMEFIRSTNAME_TEXT, Constants::SEARCHBYNAMEFIRSTNAME_TOOLTIP, Constants::TRANS_CONTEXT);
searchmenu->addAction(cmd, Core::Id(Constants::G_PATIENTS_SEARCH));
gSearchMethod->addAction(a);
a = aSearchDob = new QAction(this);
a->setObjectName("aSearchDob");
a->setCheckable(true);
a->setChecked(false);
a->setIcon(th->icon(Core::Constants::ICONSEARCH));
cmd = actionManager()->registerAction(a, Core::Id(Constants::A_SEARCH_PATIENTS_BY_DOB), searchcontext);
//.........这里部分代码省略.........
示例4: ctx
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////// ACTION HANDLER ///////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
PmhActionHandler::PmhActionHandler(QObject *parent) :
QObject(parent),
aAddPmh(0),aRemovePmh(0),
aAddCat(0),
aCategoryManager(0),
aPmhDatabaseInformation(0),
m_CurrentView(0)
{
setObjectName("PmhActionHandler");
Core::ITheme *th = Core::ICore::instance()->theme();
QAction *a = 0;
Core::Command *cmd = 0;
Core::Context ctx(Constants::C_PMH_PLUGINS);
Core::Context globalcontext(Core::Constants::C_GLOBAL);
Core::ActionContainer *menu = actionManager()->actionContainer(Core::Id(Core::Constants::M_PATIENTS));
Core::ActionContainer *newmenu = actionManager()->actionContainer(Core::Id(Core::Constants::M_GENERAL_NEW));
Core::ActionContainer *pmhMenu = actionManager()->createMenu(Constants::M_PMH);
Q_ASSERT(menu);
if (!menu) {
LOG_ERROR("Menu Patient not created");
return;
} else {
// menu->appendGroup(Core::Constants::G_PATIENTS_NAVIGATION);
pmhMenu->appendGroup(Core::Id(Constants::G_PMH_NEW));
pmhMenu->appendGroup(Core::Id(Constants::G_PMH_EDITION));
pmhMenu->setTranslations(Trans::Constants::PMHMENU_TEXT);
menu->addMenu(pmhMenu, Core::Id(Core::Constants::G_PATIENTS));
}
// Create local actions
a = aAddPmh = new QAction(this);
aAddPmh->setEnabled(false);
a->setObjectName("aAddPmh");
a->setIcon(th->icon(Core::Constants::ICONADD));
cmd = actionManager()->registerAction(a, Core::Id(Constants::A_PMH_NEW), globalcontext);
cmd->setTranslations(Constants::CREATEPMH_TEXT, Constants::CREATEPMH_TEXT, Constants::PMHCONSTANTS_TR_CONTEXT);
pmhMenu->addAction(cmd, Core::Id(Constants::G_PMH_NEW));
if (newmenu)
newmenu->addAction(cmd, Core::Id(Core::Constants::G_GENERAL_NEW));
// connect(a, SIGNAL(triggered()), this, SLOT(createPmh()));
a = aRemovePmh= new QAction(this);
a->setObjectName("aRemovePmh");
a->setIcon(th->icon(Core::Constants::ICONREMOVE));
cmd = actionManager()->registerAction(a, Core::Id(Constants::A_PMH_REMOVE), ctx);
cmd->setTranslations(Constants::REMOVEPMH_TEXT, Constants::REMOVEPMH_TEXT, Constants::PMHCONSTANTS_TR_CONTEXT);
pmhMenu->addAction(cmd, Core::Id(Constants::G_PMH_NEW));
// connect(a, SIGNAL(triggered()), this, SLOT(createPmh()));
a = aAddCat = new QAction(this);
a->setObjectName("aAddCat");
a->setIcon(th->icon(Core::Constants::ICONCATEGORY_ADD));
cmd = actionManager()->registerAction(a, Core::Id(Constants::A_PMH_NEWCATEGORY), ctx);
cmd->setTranslations(Constants::CREATECATEGORY_TEXT, Constants::CREATECATEGORY_TEXT, Constants::PMHCONSTANTS_TR_CONTEXT);
pmhMenu->addAction(cmd, Core::Id(Constants::G_PMH_NEW));
// connect(a, SIGNAL(triggered()), this, SLOT(createPmh()));
a = aCategoryManager= new QAction(this);
a->setObjectName("aCategoryManager");
a->setIcon(th->icon(Core::Constants::ICONCATEGORY_MANAGER));
cmd = actionManager()->registerAction(a, Core::Id(Constants::A_PMH_CATEGORYMANAGER), globalcontext);
cmd->setTranslations(Constants::CATEGORYMANAGER_TEXT, Constants::CATEGORYMANAGER_TEXT, Constants::PMHCONSTANTS_TR_CONTEXT);
pmhMenu->addAction(cmd, Core::Id(Constants::G_PMH_EDITION));
connect(a, SIGNAL(triggered()), this, SLOT(categoryManager()));
Core::ActionContainer *hmenu = actionManager()->actionContainer(Core::Id(Core::Constants::M_HELP_DATABASES));
a = aPmhDatabaseInformation = new QAction(this);
a->setObjectName("aPmhDatabaseInformation");
a->setIcon(th->icon(Core::Constants::ICONHELP));
cmd = actionManager()->registerAction(a, Core::Id(Constants::A_PMH_SHOWDBINFOS), globalcontext);
cmd->setTranslations(Trans::Constants::PMH_DATABASE_INFORMATION);
cmd->retranslate();
if (hmenu) {
hmenu->addAction(cmd, Core::Id(Core::Constants::G_HELP_DATABASES));
}
connect(aPmhDatabaseInformation, SIGNAL(triggered()), this, SLOT(showPmhDatabaseInformation()));
contextManager()->updateContext();
actionManager()->retranslateMenusAndActions();
connect(patient(), SIGNAL(currentPatientChanged()), this, SLOT(onCurrentPatientChanged()));
}