示例#1
0
		ShortcutDialog::ShortcutDialog(QWidget* parent, const char* name, Qt::WFlags)
			: QWidget(parent),
				Ui_ShortcutDialogData(),
				ModularWidget(name),
				PreferencesEntry()
		{
			// apply the dialogs layout
			setupUi(this);

			// define the dialogs section name in the INIFile
			setINIFileSectionName("BALLVIEWSHORTCUTS");

			setObjectName(name);

			// defines the dialogs Entry name
			setWidgetStackName(String(tr("Shortcuts")));

			registerWidgets_();

			//The shortcut registry has should be saved along with the other options for shortcuts
			registerObject_(ShortcutRegistry::getInstance(0));

			//The search should not be stored from session to session
			unregisterObject_(searchEdit);

			//TODO
			//registerWidgetForHelpSystem_(widget_stack->widget(0), "shortcuts.html#shortcuts");
			hide();

			connect(browse_export_button, SIGNAL(clicked()), this, SLOT(browseExportFile_()));
			connect(browse_import_button, SIGNAL(clicked()), this, SLOT(browseImportFile_()));
			connect(tableView, SIGNAL(shortcutChanged()), this, SLOT(shortcutChanged_()));
		}
示例#2
0
void* PluginManager::createObject(const std::string& type)
{
    if (type == "*")
        return nullptr;

    SFLPluginObjectParams op;
    op.type = (const int8_t*)type.c_str();
    op.pluginApi = &pluginApi_;

    // Try to find an exact match
    if (exactMatchMap_.find(type) != exactMatchMap_.end()) {
        SFLPluginRegisterParams &rp = exactMatchMap_[type];
        void *object = rp.create(&op);
        if (object)
            return object;
    }

    // Try to find a wildcard match
    for (size_t i = 0; i < wildCardVec_.size(); ++i)
    {
        SFLPluginRegisterParams &rp = wildCardVec_[i];
        void *object = rp.create(&op);
        if (object) {
            // promote registration to exactMatch_
            // (but keep also the wild card registration for other object types)
            int32_t res = registerObject_(op.type, &rp);
            if (res < 0) {
                ERROR("failed to register object %s", op.type);
                rp.destroy(object);
                return nullptr;
            }

            return object;
        }
    }

    return nullptr;
}