void DlgWorkbenchesImp::save_workbenches() { QString enabled_wbs; QString disabled_wbs; ParameterGrp::handle hGrp; hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Workbenches"); hGrp->Clear(); if (lw_enabled_workbenches->count() == 0) { enabled_wbs.append(QString::fromLatin1("NoneWorkbench")); } else { for (int i = 0; i < lw_enabled_workbenches->count(); i++) { QVariant item_data = lw_enabled_workbenches->item(i)->data(Qt::UserRole); QString name = item_data.toString(); enabled_wbs.append(name + QString::fromLatin1(",")); } } hGrp->SetASCII("Enabled", enabled_wbs.toLatin1()); for (int i = 0; i < lw_disabled_workbenches->count(); i++) { QVariant item_data = lw_disabled_workbenches->item(i)->data(Qt::UserRole); QString name = item_data.toString(); disabled_wbs.append(name + QString::fromLatin1(",")); } hGrp->SetASCII("Disabled", disabled_wbs.toLatin1()); }
void MacroCommand::save() { ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Macro")->GetGroup("Macros"); hGrp->Clear(); std::vector<Command*> macros = Application::Instance->commandManager().getGroupCommands("Macros"); if ( macros.size() > 0 ) { for (std::vector<Command*>::iterator it = macros.begin(); it!=macros.end(); ++it ) { MacroCommand* macro = (MacroCommand*)(*it); ParameterGrp::handle hMacro = hGrp->GetGroup(macro->getName()); hMacro->SetASCII( "Script", macro->getScriptName () ); hMacro->SetASCII( "Menu", macro->getMenuText () ); hMacro->SetASCII( "Tooltip", macro->getToolTipText() ); hMacro->SetASCII( "WhatsThis", macro->getWhatsThis () ); hMacro->SetASCII( "Statustip", macro->getStatusTip () ); hMacro->SetASCII( "Pixmap", macro->getPixmap () ); hMacro->SetASCII( "Accel", macro->getAccel () ); } } }
void DlgCustomToolbars::exportCustomToolbars(const QByteArray& workbench) { ParameterGrp::handle hGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp")->GetGroup("Workbench"); const char* subgroup = (type == Toolbar ? "Toolbar" : "Toolboxbar"); hGrp = hGrp->GetGroup(workbench.constData())->GetGroup(subgroup); hGrp->Clear(); CommandManager& rMgr = Application::Instance->commandManager(); for (int i=0; i<toolbarTreeWidget->topLevelItemCount(); i++) { QTreeWidgetItem* toplevel = toolbarTreeWidget->topLevelItem(i); QString groupName = QString::fromLatin1("Custom_%1").arg(i+1); QByteArray toolbarName = toplevel->text(0).toUtf8(); ParameterGrp::handle hToolGrp = hGrp->GetGroup(groupName.toLatin1()); hToolGrp->SetASCII("Name", toolbarName.constData()); hToolGrp->SetBool("Active", toplevel->checkState(0) == Qt::Checked); // since we store the separators to the user parameters as (key, pair) we must // make sure to use a unique key because otherwise we cannot store more than // one. int suffixSeparator = 1; for (int j=0; j<toplevel->childCount(); j++) { QTreeWidgetItem* child = toplevel->child(j); QByteArray commandName = child->data(0, Qt::UserRole).toByteArray(); if (commandName == "Separator") { QByteArray key = commandName + QByteArray::number(suffixSeparator); suffixSeparator++; hToolGrp->SetASCII(key, commandName); } else { Command* pCmd = rMgr.getCommandByName(commandName); if (pCmd) { hToolGrp->SetASCII(pCmd->getName(), pCmd->getAppModuleName()); } } } } }