Please enable JavaScript to use RhodeCode Enterprise
##// END OF EJS Templates
Alexandre Leroux
- Mon, 10 Jul 2017 08:09:23
Show More
0
plugins/amda/include/AmdaProvider.h
plugins/amda/include/AmdaProvider.h
created
644
+31
0
@@
-0,0
+1,31
1
#ifndef SCIQLOP_AMDAPROVIDER_H
2
#define SCIQLOP_AMDAPROVIDER_H
3
4
#include "AmdaGlobal.h"
5
6
#include <Common/spimpl.h>
7
8
#include <Data/IDataProvider.h>
9
10
#include <QLoggingCategory>
11
12
13
Q_DECLARE_LOGGING_CATEGORY ( LOG_AmdaProvider )
14
15
/**
16
* @brief The AmdaProvider class is an example of how a data provider can generate data
17
*/
18
class SCIQLOP_AMDA_EXPORT AmdaProvider : public IDataProvider {
19
public :
20
explicit AmdaProvider ();
21
22
void requestDataLoading ( QUuid token , const QVector < SqpDateTime > & dateTimeList ) override ;
23
24
private :
25
void retrieveData ( QUuid token , const DataProviderParameters & parameters ) const ;
26
27
class AmdaProviderPrivate ;
28
spimpl :: unique_impl_ptr < AmdaProviderPrivate > impl ;
29
};
30
31
#endif // SCIQLOP_AMDAPROVIDER_H
0
plugins/amda/src/AmdaProvider.cpp
plugins/amda/src/AmdaProvider.cpp
created
644
+23
0
@@
-0,0
+1,23
1
#include "AmdaProvider.h"
2
3
Q_LOGGING_CATEGORY ( LOG_AmdaProvider , "AmdaProvider" )
4
5
struct AmdaProvider :: AmdaProviderPrivate {
6
};
7
8
AmdaProvider :: AmdaProvider () : impl { spimpl :: make_unique_impl < AmdaProviderPrivate > ()}
9
{
10
}
11
12
void AmdaProvider :: requestDataLoading ( QUuid token , const QVector < SqpDateTime > & dateTimeList )
13
{
14
// NOTE: Try to use multithread if possible
15
for ( const auto & dateTime : dateTimeList ) {
16
retrieveData ( token , DataProviderParameters { dateTime });
17
}
18
}
19
20
void AmdaProvider :: retrieveData ( QUuid token , const DataProviderParameters & parameters ) const
21
{
22
/// @todo ALX
23
}
0
plugins/amda/src/AmdaPlugin.cpp
plugins/amda/src/AmdaPlugin.cpp
+3
0
@@
-1,39
+1,42
1
1
#include "AmdaPlugin.h"
2
2
#include "AmdaParser.h"
3
3
4
4
#include <DataSource/DataSourceController.h>
5
5
#include <DataSource/DataSourceItem.h>
6
6
7
7
#include <SqpApplication.h>
8
8
9
9
Q_LOGGING_CATEGORY ( LOG_AmdaPlugin , "AmdaPlugin" )
10
10
11
11
namespace {
12
12
13
13
/// Name of the data source
14
14
const auto DATA_SOURCE_NAME = QStringLiteral ( "AMDA" );
15
15
16
16
/// Path of the file used to generate the data source item for AMDA
17
17
const auto JSON_FILE_PATH = QStringLiteral ( ":/samples/AmdaSample.json" );
18
18
19
19
} // namespace
20
20
21
21
void AmdaPlugin :: initialize ()
22
22
{
23
23
if ( auto app = sqpApp ) {
24
24
// Registers to the data source controller
25
25
auto & dataSourceController = app -> dataSourceController ();
26
26
auto dataSourceUid = dataSourceController . registerDataSource ( DATA_SOURCE_NAME );
27
27
28
28
// Sets data source tree
29
29
if ( auto dataSourceItem = AmdaParser :: readJson ( JSON_FILE_PATH )) {
30
30
dataSourceController . setDataSourceItem ( dataSourceUid , std :: move ( dataSourceItem ));
31
31
}
32
32
else {
33
33
qCCritical ( LOG_AmdaPlugin ()) << tr ( "No data source item could be generated for AMDA" );
34
34
}
35
36
// Sets data provider
37
dataSourceController . setDataProvider ( dataSourceUid , std :: make_unique < AmdaProvider > ());
35
38
}
36
39
else {
37
40
qCWarning ( LOG_AmdaPlugin ()) << tr ( "Can't access to SciQlop application" );
38
41
}
39
42
}
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