@@ -1,118 +1,128 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the SciQLop Software |
|
3 | 3 | -- Copyright (C) 2017, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "MainWindow.h" |
|
23 | 23 | #include "ui_MainWindow.h" |
|
24 | ||
|
25 | #include <DataSource/DataSourceController.h> | |
|
26 | #include <DataSource/DataSourceWidget.h> | |
|
27 | #include <SqpApplication.h> | |
|
28 | ||
|
24 | 29 | #include <QAction> |
|
25 | 30 | #include <QDate> |
|
26 | 31 | #include <QDateTime> |
|
27 | 32 | #include <QDir> |
|
28 | 33 | #include <QFileDialog> |
|
29 | 34 | //#include <omp.h> |
|
30 | 35 | //#include <network/filedownloader.h> |
|
31 | 36 | //#include <qlopdatabase.h> |
|
32 | 37 | //#include <qlopsettings.h> |
|
33 | 38 | //#include <qlopgui.h> |
|
34 | 39 | //#include <spacedata.h> |
|
35 | 40 | //#include "qlopcore.h" |
|
36 | 41 | //#include "qlopcodecmanager.h" |
|
37 | 42 | //#include "cdfcodec.h" |
|
38 | 43 | //#include "amdatxtcodec.h" |
|
39 | 44 | //#include <qlopplotmanager.h> |
|
40 | 45 | #include <QAction> |
|
41 | 46 | #include <QToolBar> |
|
42 | 47 | #include <memory.h> |
|
43 | 48 | MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_Ui(new Ui::MainWindow) |
|
44 | 49 | { |
|
45 | 50 | m_Ui->setupUi(this); |
|
46 | 51 | |
|
47 | 52 | auto leftSidePane = m_Ui->leftInspectorSidePane->sidePane(); |
|
48 | 53 | leftSidePane->addAction("ACTION L1"); |
|
49 | 54 | leftSidePane->addAction("ACTION L2"); |
|
50 | 55 | leftSidePane->addAction("ACTION L3"); |
|
51 | 56 | |
|
52 | 57 | auto rightSidePane = m_Ui->rightInspectorSidePane->sidePane(); |
|
53 | 58 | rightSidePane->addAction("ACTION R1"); |
|
54 | 59 | rightSidePane->addAction("ACTION R2"); |
|
55 | 60 | rightSidePane->addAction("ACTION R3"); |
|
56 | 61 | |
|
57 | 62 | this->menuBar()->addAction("File"); |
|
58 | 63 | auto mainToolBar = this->addToolBar("MainToolBar"); |
|
59 | 64 | mainToolBar->addAction("A1"); |
|
65 | ||
|
66 | // Widgets / controllers connections | |
|
67 | connect(&sqpApp->dataSourceController(), SIGNAL(dataSourceItemSet(DataSourceItem &)), | |
|
68 | m_Ui->dataSourceWidget, SLOT(addDataSource(DataSourceItem &))); | |
|
69 | ||
|
60 | 70 | /* QLopGUI::registerMenuBar(menuBar()); |
|
61 | 71 | this->setWindowIcon(QIcon(":/sciqlopLOGO.svg")); |
|
62 | 72 | this->m_progressWidget = new QWidget(); |
|
63 | 73 | this->m_progressLayout = new QVBoxLayout(this->m_progressWidget); |
|
64 | 74 | this->m_progressWidget->setLayout(this->m_progressLayout); |
|
65 | 75 | this->m_progressWidget->setWindowModality(Qt::WindowModal); |
|
66 | 76 | m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int)); |
|
67 | 77 | for(int i=0;i<OMP_THREADS;i++) |
|
68 | 78 | { |
|
69 | 79 | this->m_progress.append(new QProgressBar(this->m_progressWidget)); |
|
70 | 80 | this->m_progress.last()->setMinimum(0); |
|
71 | 81 | this->m_progress.last()->setMaximum(100); |
|
72 | 82 | this->m_progressLayout->addWidget(this->m_progress.last()); |
|
73 | 83 | this->m_progressWidget->hide(); |
|
74 | 84 | this->m_progressThreadIds[i] = -1; |
|
75 | 85 | } |
|
76 | 86 | this->m_progressWidget->setWindowTitle("Loading File"); |
|
77 | 87 | const QList<QLopService*>ServicesToLoad=QList<QLopService*>() |
|
78 | 88 | << QLopCore::self() |
|
79 | 89 | << QLopPlotManager::self() |
|
80 | 90 | << QLopCodecManager::self() |
|
81 | 91 | << FileDownloader::self() |
|
82 | 92 | << QLopDataBase::self() |
|
83 | 93 | << SpaceData::self(); |
|
84 | 94 | |
|
85 | 95 | CDFCodec::registerToManager(); |
|
86 | 96 | AMDATXTCodec::registerToManager(); |
|
87 | 97 | |
|
88 | 98 | |
|
89 | 99 | for(int i=0;i<ServicesToLoad.count();i++) |
|
90 | 100 | { |
|
91 | 101 | qDebug()<<ServicesToLoad.at(i)->serviceName(); |
|
92 | 102 | ServicesToLoad.at(i)->initialize(); //must be called before getGUI |
|
93 | 103 | QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI(); |
|
94 | 104 | if(wdgt) |
|
95 | 105 | { |
|
96 | 106 | wdgt->setAllowedAreas(Qt::AllDockWidgetAreas); |
|
97 | 107 | this->addDockWidget(Qt::TopDockWidgetArea,wdgt); |
|
98 | 108 | } |
|
99 | 109 | PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i)); |
|
100 | 110 | }*/ |
|
101 | 111 | } |
|
102 | 112 | |
|
103 | 113 | MainWindow::~MainWindow() |
|
104 | 114 | { |
|
105 | 115 | } |
|
106 | 116 | |
|
107 | 117 | |
|
108 | 118 | void MainWindow::changeEvent(QEvent *e) |
|
109 | 119 | { |
|
110 | 120 | QMainWindow::changeEvent(e); |
|
111 | 121 | switch (e->type()) { |
|
112 | 122 | case QEvent::LanguageChange: |
|
113 | 123 | m_Ui->retranslateUi(this); |
|
114 | 124 | break; |
|
115 | 125 | default: |
|
116 | 126 | break; |
|
117 | 127 | } |
|
118 | 128 | } |
@@ -1,61 +1,61 | |||
|
1 | 1 | #ifndef SCIQLOP_DATASOURCECONTROLLER_H |
|
2 | 2 | #define SCIQLOP_DATASOURCECONTROLLER_H |
|
3 | 3 | |
|
4 | 4 | #include <QLoggingCategory> |
|
5 | 5 | #include <QObject> |
|
6 | 6 | #include <QUuid> |
|
7 | 7 | |
|
8 | 8 | #include <Common/spimpl.h> |
|
9 | 9 | |
|
10 | 10 | Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceController) |
|
11 | 11 | |
|
12 | 12 | class DataSourceItem; |
|
13 | 13 | |
|
14 | 14 | /** |
|
15 | 15 | * @brief The DataSourceController class aims to make the link between SciQlop and its plugins. This |
|
16 | 16 | * is the intermediate class that SciQlop has to use in the way to connect a data source. Please |
|
17 | 17 | * first use register method to initialize a plugin specified by its metadata name (JSON plugin |
|
18 | 18 | * source) then others specifics method will be able to access it. You can load a data source driver |
|
19 | 19 | * plugin then create a data source. |
|
20 | 20 | */ |
|
21 | 21 | class DataSourceController : public QObject { |
|
22 | 22 | Q_OBJECT |
|
23 | 23 | public: |
|
24 | 24 | explicit DataSourceController(QObject *parent = 0); |
|
25 | 25 | virtual ~DataSourceController(); |
|
26 | 26 | |
|
27 | 27 | /** |
|
28 | 28 | * Registers a data source. The method delivers a unique id that can be used afterwards to |
|
29 | 29 | * access to the data source properties (structure, connection parameters, data provider, etc.) |
|
30 | 30 | * @param dataSourceName the name of the data source |
|
31 | 31 | * @return the unique id with which the data source has been registered |
|
32 | 32 | */ |
|
33 | 33 | QUuid registerDataSource(const QString &dataSourceName) noexcept; |
|
34 | 34 | |
|
35 | 35 | /** |
|
36 | 36 | * Sets the structure of a data source. The controller takes ownership of the structure. |
|
37 | 37 | * @param dataSourceUid the unique id with which the data source has been registered into the |
|
38 | 38 | * controller. If it is invalid, the method has no effect. |
|
39 | 39 | * @param dataSourceItem the structure of the data source |
|
40 | 40 | * @sa registerDataSource() |
|
41 | 41 | */ |
|
42 | 42 | void setDataSourceItem(const QUuid &dataSourceUid, |
|
43 | 43 | std::unique_ptr<DataSourceItem> dataSourceItem) noexcept; |
|
44 | 44 | |
|
45 | 45 | public slots: |
|
46 | 46 | /// Manage init/end of the controller |
|
47 | 47 | void initialize(); |
|
48 | 48 | void finalize(); |
|
49 | 49 | |
|
50 | 50 | signals: |
|
51 | 51 | /// Signal emitted when a structure has been set for a data source |
|
52 |
void dataSourceItemSet( |
|
|
52 | void dataSourceItemSet(DataSourceItem &dataSourceItem); | |
|
53 | 53 | |
|
54 | 54 | private: |
|
55 | 55 | void waitForFinish(); |
|
56 | 56 | |
|
57 | 57 | class DataSourceControllerPrivate; |
|
58 | 58 | spimpl::unique_impl_ptr<DataSourceControllerPrivate> impl; |
|
59 | 59 | }; |
|
60 | 60 | |
|
61 | 61 | #endif // SCIQLOP_DATASOURCECONTROLLER_H |
General Comments 0
You need to be logged in to leave comments.
Login now