LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
AbstractResourceBase.cpp
Go to the documentation of this file.
1// Copyright 2017 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
7
10
11#include <QFileInfo>
12
13namespace Lima {
14namespace LinguisticProcessing {
15
17{
19
22 AbstractResourceBasePrivate(const AbstractResourceBasePrivate&) {}
23
24 LimaFileSystemWatcher m_resourceFileWatcher;
25};
26
28 QObject( parent ),
30{
31 connect(&m_d->m_resourceFileWatcher, &LimaFileSystemWatcher::fileChanged,
33}
34
39
41 QObject(r.parent()),
42 m_d(new AbstractResourceBasePrivate(*r.m_d))
43{
44 connect(&m_d->m_resourceFileWatcher, &LimaFileSystemWatcher::fileChanged,
46}
47
48QString AbstractResourceBase::getResourceFileName(const QString& paramName)
49{
50 QString file;
51 QStringList resourcesPaths = QString::fromUtf8(Common::MediaticData::MediaticData::single().getResourcesPath().c_str()).split(LIMA_PATH_SEPARATOR);
52 for(QString resPath : resourcesPaths)
53 {
54 file = resPath + "/" + paramName;
55 if (QFileInfo::exists(file))
56 {
58 break;
59 }
60 }
61 return file;
62}
63
64
66{
67 return m_d->m_resourceFileWatcher;
68}
69// void AbstractResourceBase::resourceFileChanged ( const QString & path )
70// {
71// std::cerr << "AbstractResourceBase::resourceFileChanged" << path.toUtf8().constData();
72// // configure(path);
73// }
74
75
76} // LinguisticProcessing
77} // Lima
78
#define LIMA_PATH_SEPARATOR
Definition FileUtils.h:25
LimaFileSystemWatcher extends QFileSystemWatcher to work on replaced files
void addPath(const QString &path)
void fileChanged(const QString &path)
This signal is emited whenever path change, either modified, suppressed or recreated.
LimaFileSystemWatcher & resourceFileWatcher()
Accessor to the file watcher used to register resource files to be watched for changes.
void resourceFileChanged(const QString &path)
Signal triggered whenever one of the registered files changes on disk.
QString getResourceFileName(const QString &paramName)
static const MediaticData & single()
const singleton accessor
Definition Singleton.h:51
NAUTITIA.