Please enable JavaScript to use RhodeCode Enterprise
##// END OF EJS Templates
Alexandre Leroux
- Wed, 05 Jul 2017 09:39:08
Show More
0
plugins/amda/include/AmdaParser.h
plugins/amda/include/AmdaParser.h
created
644
+23
0
@@
-0,0
+1,23
1
#ifndef SCIQLOP_AMDAPARSER_H
2
#define SCIQLOP_AMDAPARSER_H
3
4
#include "AmdaGlobal.h"
5
6
#include <QLoggingCategory>
7
8
#include <memory>
9
10
Q_DECLARE_LOGGING_CATEGORY ( LOG_AmdaParser )
11
12
class DataSourceItem ;
13
14
struct SCIQLOP_AMDA_EXPORT AmdaParser {
15
/**
16
* Creates a data source tree from a JSON file
17
* @param filePath the path of the JSON file to read
18
* @return the root of the created data source tree, nullptr if the file couldn't be parsed
19
*/
20
static std :: unique_ptr < DataSourceItem > readJson ( const QString & filePath ) noexcept ;
21
};
22
23
#endif // SCIQLOP_AMDAPARSER_H
0
plugins/amda/src/AmdaParser.cpp
plugins/amda/src/AmdaParser.cpp
created
644
+11
0
@@
-0,0
+1,11
1
#include "AmdaParser.h"
2
3
#include <DataSource/DataSourceItem.h>
4
5
Q_LOGGING_CATEGORY ( LOG_AmdaParser , "AmdaParser" )
6
7
std :: unique_ptr < DataSourceItem > AmdaParser :: readJson ( const QString & filePath ) noexcept
8
{
9
/// @todo ALX
10
return nullptr ;
11
}
0
plugins/amda/src/AmdaPlugin.cpp
plugins/amda/src/AmdaPlugin.cpp
+8
-1
@@
-1,32
+1,39
1
1
#include "AmdaPlugin.h"
2
#include "AmdaParser.h"
2
3
3
4
#include <DataSource/DataSourceController.h>
5
#include <DataSource/DataSourceItem.h>
4
6
5
7
#include <SqpApplication.h>
6
8
7
9
Q_LOGGING_CATEGORY ( LOG_AmdaPlugin , "AmdaPlugin" )
8
10
9
11
namespace {
10
12
11
13
/// Name of the data source
12
14
const auto DATA_SOURCE_NAME = QStringLiteral ( "AMDA" );
13
15
14
16
/// Path of the file used to generate the data source item for AMDA
15
17
const auto JSON_FILE_PATH = QStringLiteral ( ":/samples/AmdaSample.json" );
16
18
17
19
} // namespace
18
20
19
21
void AmdaPlugin :: initialize ()
20
22
{
21
23
if ( auto app = sqpApp ) {
22
24
// Registers to the data source controller
23
25
auto & dataSourceController = app -> dataSourceController ();
24
26
auto dataSourceUid = dataSourceController . registerDataSource ( DATA_SOURCE_NAME );
25
27
26
28
// Sets data source tree
27
/// @todo ALX
29
if ( auto dataSourceItem = AmdaParser :: readJson ( JSON_FILE_PATH )) {
30
dataSourceController . setDataSourceItem ( dataSourceUid , std :: move ( dataSourceItem ));
31
}
32
else {
33
qCCritical ( LOG_AmdaPlugin ()) << tr ( "No data source item could be generated for AMDA" );
34
}
28
35
}
29
36
else {
30
37
qCWarning ( LOG_AmdaPlugin ()) << tr ( "Can't access to SciQlop application" );
31
38
}
32
39
}
Site-wide shortcuts
/
Use quick search box
g h
Goto home page
g g
Goto my private gists page
g G
Goto my public gists page
g 0-9
Goto bookmarked items from 0-9
n r
New repository page
n g
New gist page
Repositories
g s
Goto summary page
g c
Goto changelog page
g f
Goto files page
g F
Goto files page with file search activated
g p
Goto pull requests page
g o
Goto repository settings
g O
Goto repository access permissions settings
t s
Toggle sidebar on some pages