Chris@49: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@0: Chris@0: /* Chris@52: Sonic Visualiser Chris@52: An audio file viewer and annotation editor. Chris@52: Centre for Digital Music, Queen Mary, University of London. Chris@0: Chris@52: This program is free software; you can redistribute it and/or Chris@52: modify it under the terms of the GNU General Public License as Chris@52: published by the Free Software Foundation; either version 2 of the Chris@52: License, or (at your option) any later version. See the file Chris@52: COPYING included with this distribution for more information. Chris@0: */ Chris@0: Chris@0: /* Chris@0: This is a modified version of a source file from the Chris@0: Rosegarden MIDI and audio sequencer and notation editor. Chris@202: This file copyright 2000-2006 Chris Cannam and QMUL. Chris@0: */ Chris@0: Chris@0: #include "PluginIdentifier.h" Chris@0: #include Chris@82: #include Chris@0: Chris@0: QString Chris@0: PluginIdentifier::createIdentifier(QString type, Chris@0: QString soName, Chris@0: QString label) Chris@0: { Chris@82: QString identifier = type + ":" + QFileInfo(soName).baseName() + ":" + label; Chris@0: return identifier; Chris@0: } Chris@0: Chris@165: QString Chris@165: PluginIdentifier::canonicalise(QString identifier) Chris@165: { Chris@165: QString type, soName, label; Chris@165: parseIdentifier(identifier, type, soName, label); Chris@165: return createIdentifier(type, soName, label); Chris@165: } Chris@165: Chris@0: void Chris@0: PluginIdentifier::parseIdentifier(QString identifier, Chris@0: QString &type, Chris@0: QString &soName, Chris@0: QString &label) Chris@0: { Chris@0: type = identifier.section(':', 0, 0); Chris@0: soName = identifier.section(':', 1, 1); Chris@0: label = identifier.section(':', 2); Chris@0: } Chris@0: Chris@0: bool Chris@0: PluginIdentifier::areIdentifiersSimilar(QString id1, QString id2) Chris@0: { Chris@0: QString type1, type2, soName1, soName2, label1, label2; Chris@0: Chris@0: parseIdentifier(id1, type1, soName1, label1); Chris@0: parseIdentifier(id2, type2, soName2, label2); Chris@0: Chris@0: if (type1 != type2 || label1 != label2) return false; Chris@0: Chris@0: bool similar = (soName1.section('/', -1).section('.', 0, 0) == Chris@0: soName2.section('/', -1).section('.', 0, 0)); Chris@0: Chris@0: return similar; Chris@0: } Chris@0: Chris@0: QString Chris@0: PluginIdentifier::BUILTIN_PLUGIN_SONAME = "_builtin"; Chris@0: Chris@0: QString Chris@0: PluginIdentifier::RESERVED_PROJECT_DIRECTORY_KEY = "__QMUL__:__RESERVED__:ProjectDirectoryKey"; Chris@0: