51 QStringList selectedTools = config.
mTools;
54 TRACKING_SYSTEM selectedTracker = string2enum<TRACKING_SYSTEM>(config.
mTrackingSystem);
60 foreach(QString absoluteToolPath, selectedTools)
65 tool.first = absoluteToolPath;
66 tool.second = (absoluteToolPath == referencePath);
67 toolfilesAndRefVector.push_back(tool);
81 retval.
mName = QFileInfo(uid).completeBaseName();
85 std::vector<ToolFileParser::TrackerInternalStructure> trackers = parser.
getTrackers();
86 for (
unsigned i = 0; i < trackers.size(); ++i)
93 for (
unsigned i = 0; i < tools.size(); ++i)
104 QStringList trackingsystemsFilter)
107 QStringList filteredTools = this->filter(allTools, applicationsFilter, trackingsystemsFilter);
108 return filteredTools;
116 QString absoluteFilePath = uid;
117 QFile file(absoluteFilePath);
118 QFileInfo info(file);
119 retval.
mName = info.dir().dirName();
136 foreach(QString path, allTools)
140 for (
unsigned i=0; i<
internal.mClinicalApplications.size(); ++i)
141 retval <<
internal.mClinicalApplications[i];
144 retval.removeDuplicates();
148 QStringList TrackerConfigurationImpl::filter(QStringList toolsToFilter, QStringList applicationsFilter,
149 QStringList trackingsystemsFilter)
153 foreach(QString toolFilePath, toolsToFilter)
159 QString trackerName =
enum2string(
internal.mTrackerType);
160 if(!trackingsystemsFilter.contains(trackerName, Qt::CaseInsensitive))
164 bool passedApplicationFilter =
false;
165 std::vector<QString>::iterator it =
internal.mClinicalApplications.begin();
166 while(it !=
internal.mClinicalApplications.end() && !passedApplicationFilter)
168 QString applicationName = *it;
169 if(applicationsFilter.contains(applicationName, Qt::CaseInsensitive))
171 passedApplicationFilter =
true;
173 if(applicationsFilter.contains(
"all", Qt::CaseInsensitive))
175 passedApplicationFilter =
true;
177 if(applicationsFilter.contains(
"default", Qt::CaseInsensitive))
179 passedApplicationFilter =
true;
183 if(!passedApplicationFilter)
187 retval << toolFilePath;
193 ToolFileParser::ToolInternalStructure TrackerConfigurationImpl::getToolInternal(QString toolAbsoluteFilePath)
195 ToolFileParser::ToolInternalStructure retval;
197 ToolFileParser parser(toolAbsoluteFilePath);
198 retval = parser.getTool();
206 return internal.verify();
211 return profile()->getPath() +
"/tool";
236 for (
int i=0; i< rootPaths.size(); ++i)
238 QString configFilePath = rootPaths[i] +
"/profiles";
239 foreach(QFileInfo dir,
cx::getDirs(configFilePath))
249 QStringList root =
profile()->getAllRootConfigPaths();
250 QString suffix(
"/tool/Tools/");
252 bool includeSubDirs =
true;
253 for (
int i=0; i<root.size(); ++i)
255 QString toolPath = root[i]+suffix;
TrackersAndToolsMap mTrackersAndTools
the trackers and tools (relative path) that should be used in the config
cxResource_EXPORT ProfilePtr profile()
virtual Configuration getConfiguration(QString uid)
virtual QStringList getConfigurationsGivenApplication()
std::vector< ToolFileAndReference > ToolFilesAndReferenceVector
virtual QString getConfigurationApplicationsPath()
virtual QStringList getAllTools()
QString getApplicationapplication()
static QStringList getSupportedTrackingSystems()
static QStringList getRootConfigPaths()
QString mFileName
absolute path and filename for the new config file
virtual QStringList getAllConfigurations()
QString getAbsoluteReferenceFilePath()
static void saveConfiguration(Configuration &config)
virtual QStringList getSupportedTrackingSystems()
QFileInfoList getDirs(QString path)
virtual QStringList getToolsGivenFilter(QStringList applicationsFilter, QStringList trackingsystemsFilter)
virtual QStringList getAllApplications()
Class for reading the files defining a CustusX tool.
virtual void saveConfiguration(const Configuration &config)
QStringList getAbsolutePathToXmlFiles(QString path, bool includeSubDirs)
QString mUid
absolute path and filename for the new config file
QString mClinicalApplication
std::pair< QString, bool > ToolFileAndReference
std::vector< QString > getAbsoluteToolFilePaths()
QString mClinical_app
the clinical application this config is made for
std::vector< ToolFileParser::TrackerInternalStructure > getTrackers()
virtual bool verifyTool(QString uid)
QString enum2string(const ENUM &val)
virtual Tool getTool(QString uid)