@@ -0,0 +1,100 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the QLop Software | |||
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
|
22 | ||||
|
23 | #include "exptimetabledownloader.h" | |||
|
24 | #include <QFile> | |||
|
25 | #include <QString> | |||
|
26 | #include <QStringList> | |||
|
27 | #include <QDate> | |||
|
28 | #include <QDateTime> | |||
|
29 | #include <QDebug> | |||
|
30 | ||||
|
31 | ExpTimeTableDownLoader::ExpTimeTableDownLoader(QObject *parent) : QObject(parent) | |||
|
32 | { | |||
|
33 | ||||
|
34 | } | |||
|
35 | ||||
|
36 | ExpTimeTableDownLoader::~ExpTimeTableDownLoader() | |||
|
37 | { | |||
|
38 | ||||
|
39 | } | |||
|
40 | ||||
|
41 | bool ExpTimeTableDownLoader::parseFile(const QString &fileName) | |||
|
42 | { | |||
|
43 | QFile file(fileName); | |||
|
44 | if (!file.open(QIODevice::ReadOnly)) | |||
|
45 | return false; | |||
|
46 | m_intervals.clear(); | |||
|
47 | while (!file.atEnd()) | |||
|
48 | { | |||
|
49 | QString line = file.readLine(); | |||
|
50 | ExpXmlDownLoaderIntervals interval; | |||
|
51 | line = line.trimmed(); | |||
|
52 | if(!line.contains("AMDA Search:") && (line[0]!='#') && (line.count()>0)) | |||
|
53 | { | |||
|
54 | QStringList lineST = line.split(" "); | |||
|
55 | interval.start = lineST.at(0); | |||
|
56 | interval.stop = lineST.at(1); | |||
|
57 | m_intervals.append(interval); | |||
|
58 | } | |||
|
59 | } | |||
|
60 | makeDownloadList(); | |||
|
61 | return true; | |||
|
62 | } | |||
|
63 | ||||
|
64 | void ExpTimeTableDownLoader::addDaysToDownload(QList<QDate> days) | |||
|
65 | { | |||
|
66 | for(int i=0;i<days.count();i++) | |||
|
67 | { | |||
|
68 | if(!m_FilesToDownload.contains(days.at(i))) | |||
|
69 | { | |||
|
70 | m_FilesToDownload.append(days.at(i)); | |||
|
71 | } | |||
|
72 | } | |||
|
73 | } | |||
|
74 | ||||
|
75 | const QList<QDate> &ExpTimeTableDownLoader::daysToDownload() | |||
|
76 | { | |||
|
77 | return m_FilesToDownload; | |||
|
78 | } | |||
|
79 | ||||
|
80 | void ExpTimeTableDownLoader::makeDownloadList() | |||
|
81 | { | |||
|
82 | for(int i=0;i<m_intervals.count();i++) | |||
|
83 | { | |||
|
84 | QList<QDate> daysToDl; | |||
|
85 | QDateTime start,stop; | |||
|
86 | start=start.fromString(m_intervals[i].start,Qt::ISODate); | |||
|
87 | stop=stop.fromString(m_intervals[i].stop,Qt::ISODate); | |||
|
88 | int days=start.daysTo(stop); | |||
|
89 | daysToDl.append(start.date()); | |||
|
90 | if(days) | |||
|
91 | { | |||
|
92 | for(int j=0;j<days;j++) | |||
|
93 | { | |||
|
94 | daysToDl.append(start.addDays(j+1).date()); | |||
|
95 | } | |||
|
96 | } | |||
|
97 | addDaysToDownload(daysToDl); | |||
|
98 | } | |||
|
99 | qDebug()<<m_FilesToDownload.count(); | |||
|
100 | } |
@@ -0,0 +1,47 | |||||
|
1 | /*------------------------------------------------------------------------------ | |||
|
2 | -- This file is a part of the QLop Software | |||
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |||
|
4 | -- | |||
|
5 | -- This program is free software; you can redistribute it and/or modify | |||
|
6 | -- it under the terms of the GNU General Public License as published by | |||
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |||
|
8 | -- (at your option) any later version. | |||
|
9 | -- | |||
|
10 | -- This program is distributed in the hope that it will be useful, | |||
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
|
13 | -- GNU General Public License for more details. | |||
|
14 | -- | |||
|
15 | -- You should have received a copy of the GNU General Public License | |||
|
16 | -- along with this program; if not, write to the Free Software | |||
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
|
18 | -------------------------------------------------------------------------------*/ | |||
|
19 | /*-- Author : Alexis Jeandet | |||
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |||
|
21 | ----------------------------------------------------------------------------*/ | |||
|
22 | #ifndef EXPTIMETABLEDOWNLOADER_H | |||
|
23 | #define EXPTIMETABLEDOWNLOADER_H | |||
|
24 | ||||
|
25 | #include <QObject> | |||
|
26 | #include "expxmldownloader.h" | |||
|
27 | ||||
|
28 | class ExpTimeTableDownLoader : public QObject | |||
|
29 | { | |||
|
30 | Q_OBJECT | |||
|
31 | public: | |||
|
32 | explicit ExpTimeTableDownLoader(QObject *parent = 0); | |||
|
33 | ~ExpTimeTableDownLoader(); | |||
|
34 | bool parseFile(const QString &fileName); | |||
|
35 | const QList<QDate>& daysToDownload(); | |||
|
36 | signals: | |||
|
37 | ||||
|
38 | public slots: | |||
|
39 | private: | |||
|
40 | ||||
|
41 | QList<ExpXmlDownLoaderIntervals> m_intervals; | |||
|
42 | QList<QDate> m_FilesToDownload; | |||
|
43 | void makeDownloadList(); | |||
|
44 | void addDaysToDownload(QList<QDate> days); | |||
|
45 | }; | |||
|
46 | ||||
|
47 | #endif // EXPTIMETABLEDOWNLOADER_H |
@@ -1,139 +1,143 | |||||
1 | #------------------------------------------------- |
|
1 | #------------------------------------------------- | |
2 | # |
|
2 | # | |
3 | # Project created by QtCreator 2015-01-07T02:41:29 |
|
3 | # Project created by QtCreator 2015-01-07T02:41:29 | |
4 | # |
|
4 | # | |
5 | #------------------------------------------------- |
|
5 | #------------------------------------------------- | |
6 |
|
6 | |||
7 | QT += core gui network xml svg |
|
7 | QT += core gui network xml svg | |
8 | CONFIG += pythonqt |
|
8 | CONFIG += pythonqt | |
9 |
|
9 | |||
10 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport |
|
10 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport | |
11 |
|
11 | |||
12 | MOC_DIR = moc |
|
12 | MOC_DIR = moc | |
13 | UI_DIR = ui |
|
13 | UI_DIR = ui | |
14 | OBJECTS_DIR = obj |
|
14 | OBJECTS_DIR = obj | |
15 |
|
15 | |||
16 | DESTDIR =./bin |
|
16 | DESTDIR =./bin | |
17 |
|
17 | |||
18 | TARGET = QLop |
|
18 | TARGET = QLop | |
19 | TEMPLATE = app |
|
19 | TEMPLATE = app | |
20 |
|
20 | |||
21 | LIBS+=-lfftw3_threads -lfftw3 |
|
21 | LIBS+=-lfftw3_threads -lfftw3 | |
22 |
|
22 | |||
23 | INCLUDEPATH += src/QCustomPlot \ |
|
23 | INCLUDEPATH += src/QCustomPlot \ | |
24 | src src/Cassini \ |
|
24 | src src/Cassini \ | |
25 | src/Core src/Core/Widgets \ |
|
25 | src/Core src/Core/Widgets \ | |
26 | src/Core/Widgets/PyWdgt |
|
26 | src/Core/Widgets/PyWdgt | |
27 |
|
27 | |||
28 | QMAKE_CXXFLAGS += -O5 -fopenmp |
|
28 | QMAKE_CXXFLAGS += -O5 -fopenmp | |
29 | QMAKE_LFLAGS += -O5 -fopenmp |
|
29 | QMAKE_LFLAGS += -O5 -fopenmp | |
|
30 | #QMAKE_CXXFLAGS += -O0 -fopenmp | |||
|
31 | #QMAKE_LFLAGS += -O0 -fopenmp | |||
30 |
|
32 | |||
31 | SOURCES += src/main.cpp\ |
|
33 | SOURCES += src/main.cpp\ | |
32 | src/mainwindow.cpp \ |
|
34 | src/mainwindow.cpp \ | |
33 | src/SocExplorerPlot.cpp \ |
|
35 | src/SocExplorerPlot.cpp \ | |
34 | src/QCustomPlot/qcustomplot.cpp \ |
|
36 | src/QCustomPlot/qcustomplot.cpp \ | |
35 | src/toolbarcontainer.cpp \ |
|
37 | src/toolbarcontainer.cpp \ | |
36 | src/Core/abstractfileloader.cpp \ |
|
38 | src/Core/abstractfileloader.cpp \ | |
37 | src/Core/filedownloader.cpp \ |
|
39 | src/Core/filedownloader.cpp \ | |
38 | src/Core/filedownloadertask.cpp \ |
|
40 | src/Core/filedownloadertask.cpp \ | |
39 | src/Core/Widgets/downloadhistory.cpp \ |
|
41 | src/Core/Widgets/downloadhistory.cpp \ | |
40 | src/Core/Widgets/downloadhistoryelement.cpp \ |
|
42 | src/Core/Widgets/downloadhistoryelement.cpp \ | |
41 | src/Core/qlopservice.cpp \ |
|
43 | src/Core/qlopservice.cpp \ | |
42 | src/Cassini/expxmldownloader.cpp \ |
|
44 | src/Cassini/expxmldownloader.cpp \ | |
43 | src/Cassini/cassinidatadownloader.cpp \ |
|
45 | src/Cassini/cassinidatadownloader.cpp \ | |
44 | src/Cassini/cassinidatafile.cpp \ |
|
46 | src/Cassini/cassinidatafile.cpp \ | |
45 | src/Cassini/cassiniindexfile.cpp \ |
|
47 | src/Cassini/cassiniindexfile.cpp \ | |
46 | src/Cassini/cassiniindexfileviewer.cpp \ |
|
48 | src/Cassini/cassiniindexfileviewer.cpp \ | |
47 | src/Cassini/cassinitools.cpp \ |
|
49 | src/Cassini/cassinitools.cpp \ | |
48 | src/Cassini/cassinitoolsgui.cpp \ |
|
50 | src/Cassini/cassinitoolsgui.cpp \ | |
49 | src/Core/Widgets/qlopplots.cpp \ |
|
51 | src/Core/Widgets/qlopplots.cpp \ | |
50 | src/Core/qlopdata.cpp \ |
|
52 | src/Core/qlopdata.cpp \ | |
51 | src/Core/Widgets/PyWdgt/pythonconsole.cpp \ |
|
53 | src/Core/Widgets/PyWdgt/pythonconsole.cpp \ | |
52 | src/Core/Widgets/PyWdgt/pythonqtscriptingconsoledandd.cpp \ |
|
54 | src/Core/Widgets/PyWdgt/pythonqtscriptingconsoledandd.cpp \ | |
53 | src/QCustomPlot/qcpdocumentobject.cpp \ |
|
55 | src/QCustomPlot/qcpdocumentobject.cpp \ | |
54 | src/Core/Widgets/filebrowser.cpp \ |
|
56 | src/Core/Widgets/filebrowser.cpp \ | |
55 | src/Core/Widgets/filesystemmodel.cpp \ |
|
57 | src/Core/Widgets/filesystemmodel.cpp \ | |
56 | src/Core/Widgets/qcustomplotvect.cpp \ |
|
58 | src/Core/Widgets/qcustomplotvect.cpp \ | |
57 | src/Core/qlopdatabase.cpp \ |
|
59 | src/Core/qlopdatabase.cpp \ | |
58 | src/Core/Widgets/qlopdatabaseviewer.cpp \ |
|
60 | src/Core/Widgets/qlopdatabaseviewer.cpp \ | |
59 | src/Core/Widgets/qlopdatabaseviewermodel.cpp |
|
61 | src/Core/Widgets/qlopdatabaseviewermodel.cpp \ | |
|
62 | src/Cassini/exptimetabledownloader.cpp | |||
60 |
|
63 | |||
61 | HEADERS += src/mainwindow.h \ |
|
64 | HEADERS += src/mainwindow.h \ | |
62 | src/SocExplorerPlot.h \ |
|
65 | src/SocExplorerPlot.h \ | |
63 | src/QCustomPlot/qcustomplot.h \ |
|
66 | src/QCustomPlot/qcustomplot.h \ | |
64 | src/toolbarcontainer.h \ |
|
67 | src/toolbarcontainer.h \ | |
65 | src/Core/abstractfileloader.h \ |
|
68 | src/Core/abstractfileloader.h \ | |
66 | src/Core/filedownloader.h \ |
|
69 | src/Core/filedownloader.h \ | |
67 | src/Core/filedownloadertask.h \ |
|
70 | src/Core/filedownloadertask.h \ | |
68 | src/Core/Widgets/downloadhistory.h \ |
|
71 | src/Core/Widgets/downloadhistory.h \ | |
69 | src/Core/Widgets/downloadhistoryelement.h \ |
|
72 | src/Core/Widgets/downloadhistoryelement.h \ | |
70 | src/Core/qlopservice.h \ |
|
73 | src/Core/qlopservice.h \ | |
71 | src/Cassini/expxmldownloader.h \ |
|
74 | src/Cassini/expxmldownloader.h \ | |
72 | src/Cassini/cassinidatadownloader.h \ |
|
75 | src/Cassini/cassinidatadownloader.h \ | |
73 | src/Cassini/cassinidatafile.h \ |
|
76 | src/Cassini/cassinidatafile.h \ | |
74 | src/Cassini/cassiniindexfile.h \ |
|
77 | src/Cassini/cassiniindexfile.h \ | |
75 | src/Cassini/cassiniindexfileviewer.h \ |
|
78 | src/Cassini/cassiniindexfileviewer.h \ | |
76 | src/Cassini/cassinitools.h \ |
|
79 | src/Cassini/cassinitools.h \ | |
77 | src/Cassini/cassinitoolsgui.h \ |
|
80 | src/Cassini/cassinitoolsgui.h \ | |
78 | src/Core/Widgets/qlopplots.h \ |
|
81 | src/Core/Widgets/qlopplots.h \ | |
79 | src/Core/qlopdata.h \ |
|
82 | src/Core/qlopdata.h \ | |
80 | src/Core/Widgets/PyWdgt/pythonconsole.h \ |
|
83 | src/Core/Widgets/PyWdgt/pythonconsole.h \ | |
81 | src/Core/Widgets/PyWdgt/pythonqtscriptingconsoledandd.h \ |
|
84 | src/Core/Widgets/PyWdgt/pythonqtscriptingconsoledandd.h \ | |
82 | src/Core/qlop.h \ |
|
85 | src/Core/qlop.h \ | |
83 | src/Core/pyqlop.h \ |
|
86 | src/Core/pyqlop.h \ | |
84 | src/QCustomPlot/qcpdocumentobject.h \ |
|
87 | src/QCustomPlot/qcpdocumentobject.h \ | |
85 | src/Core/Widgets/filebrowser.h \ |
|
88 | src/Core/Widgets/filebrowser.h \ | |
86 | src/Core/Widgets/filesystemmodel.h \ |
|
89 | src/Core/Widgets/filesystemmodel.h \ | |
87 | src/Core/Widgets/qcustomplotvect.h \ |
|
90 | src/Core/Widgets/qcustomplotvect.h \ | |
88 | src/Core/qlopdatabase.h \ |
|
91 | src/Core/qlopdatabase.h \ | |
89 | src/Core/Widgets/qlopdatabaseviewer.h \ |
|
92 | src/Core/Widgets/qlopdatabaseviewer.h \ | |
90 | src/Core/Widgets/qlopdatabaseviewermodel.h |
|
93 | src/Core/Widgets/qlopdatabaseviewermodel.h \ | |
|
94 | src/Cassini/exptimetabledownloader.h | |||
91 |
|
95 | |||
92 | FORMS += src/mainwindow.ui \ |
|
96 | FORMS += src/mainwindow.ui \ | |
93 | src/Core/Widgets/downloadhistory.ui \ |
|
97 | src/Core/Widgets/downloadhistory.ui \ | |
94 | src/Core/Widgets/downloadhistoryelement.ui \ |
|
98 | src/Core/Widgets/downloadhistoryelement.ui \ | |
95 | src/Cassini/cassinidatadownloader.ui \ |
|
99 | src/Cassini/cassinidatadownloader.ui \ | |
96 | src/Cassini/cassiniindexfileviewer.ui \ |
|
100 | src/Cassini/cassiniindexfileviewer.ui \ | |
97 | src/Cassini/cassinitoolsgui.ui \ |
|
101 | src/Cassini/cassinitoolsgui.ui \ | |
98 | src/Core/Widgets/filebrowser.ui \ |
|
102 | src/Core/Widgets/filebrowser.ui \ | |
99 | src/Core/Widgets/qlopdatabaseviewer.ui |
|
103 | src/Core/Widgets/qlopdatabaseviewer.ui | |
100 |
|
104 | |||
101 | RESOURCES += \ |
|
105 | RESOURCES += \ | |
102 | resources/qlop.qrc |
|
106 | resources/qlop.qrc | |
103 |
|
107 | |||
104 | include(src/Core/Widgets/NicePyConsole/NicePyConsole.pri) |
|
108 | include(src/Core/Widgets/NicePyConsole/NicePyConsole.pri) | |
105 | include(src/Core/pythonQtOut/generated_cpp/PyQLop/PyQLop.pri) |
|
109 | include(src/Core/pythonQtOut/generated_cpp/PyQLop/PyQLop.pri) | |
106 |
|
110 | |||
107 | win32 { |
|
111 | win32 { | |
108 | DEFINES += WIN32 |
|
112 | DEFINES += WIN32 | |
109 | } |
|
113 | } | |
110 |
|
114 | |||
111 | unix { |
|
115 | unix { | |
112 | DEFINES += UNIX |
|
116 | DEFINES += UNIX | |
113 | } |
|
117 | } | |
114 |
|
118 | |||
115 | unix{ |
|
119 | unix{ | |
116 | target.path = /usr/bin |
|
120 | target.path = /usr/bin | |
117 | INSTALLS += target |
|
121 | INSTALLS += target | |
118 | } |
|
122 | } | |
119 |
|
123 | |||
120 |
|
124 | |||
121 | unix{ |
|
125 | unix{ | |
122 | QLopLauncher.path = /usr/share/applications/ |
|
126 | QLopLauncher.path = /usr/share/applications/ | |
123 | QLopLauncher.files = linux/QLop.desktop |
|
127 | QLopLauncher.files = linux/QLop.desktop | |
124 | QLopAppData.path = /usr/share/appdata/ |
|
128 | QLopAppData.path = /usr/share/appdata/ | |
125 | QLopAppData.files = linux/QLop.appdata.xml |
|
129 | QLopAppData.files = linux/QLop.appdata.xml | |
126 | share.path = /usr/share/QLop |
|
130 | share.path = /usr/share/QLop | |
127 | share.files = resources/QLop.svg \ |
|
131 | share.files = resources/QLop.svg \ | |
128 | resources/QLop.png |
|
132 | resources/QLop.png | |
129 |
|
133 | |||
130 | INSTALLS+= QLopLauncher share QLopAppData |
|
134 | INSTALLS+= QLopLauncher share QLopAppData | |
131 | } |
|
135 | } | |
132 |
|
136 | |||
133 | DISTFILES += \ |
|
137 | DISTFILES += \ | |
134 | src/Core/pythongenerator.sh \ |
|
138 | src/Core/pythongenerator.sh \ | |
135 | src/Core/pythonQtgeneratorCfg.txt \ |
|
139 | src/Core/pythonQtgeneratorCfg.txt \ | |
136 | linux/QLop.spec \ |
|
140 | linux/QLop.spec \ | |
137 | linux/QLop.desktop \ |
|
141 | linux/QLop.desktop \ | |
138 | linux/QLop.appdata.xml |
|
142 | linux/QLop.appdata.xml | |
139 |
|
143 |
@@ -1,286 +1,289 | |||||
1 |
%global upstream_name qlop-0. |
|
1 | %global upstream_name qlop-0.2-1 | |
2 |
|
2 | |||
3 | Name: qlop |
|
3 | Name: qlop | |
4 |
Version: 0. |
|
4 | Version: 0.2 | |
5 | Release: 1%{?dist} |
|
5 | Release: 1%{?dist} | |
6 | Summary: QLop is an interactive plotting software, this is an early development preview of what this software will be. |
|
6 | Summary: QLop is an interactive plotting software, this is an early development preview of what this software will be. | |
7 | Group: Development/Tools |
|
7 | Group: Development/Tools | |
8 | License: GPLv2+ |
|
8 | License: GPLv2+ | |
9 | URL: https://hephaistos.lpp.polytechnique.fr/redmine/projects/qlop |
|
9 | URL: https://hephaistos.lpp.polytechnique.fr/redmine/projects/qlop | |
10 | Source0: https://hephaistos.lpp.polytechnique.fr/redmine/attachments/download/376/%{upstream_name}.zip |
|
10 | Source0: https://hephaistos.lpp.polytechnique.fr/redmine/attachments/download/376/%{upstream_name}.zip | |
11 |
|
11 | |||
12 | BuildRequires: python2-devel |
|
12 | BuildRequires: python2-devel | |
13 | BuildRequires: qt5-qtbase-devel |
|
13 | BuildRequires: qt5-qtbase-devel | |
14 | BuildRequires: qt5-qtwebkit-devel |
|
14 | BuildRequires: qt5-qtwebkit-devel | |
15 | BuildRequires: qt5-qttools-static |
|
15 | BuildRequires: qt5-qttools-static | |
16 | BuildRequires: qt5-qttools-devel |
|
16 | BuildRequires: qt5-qttools-devel | |
17 | BuildRequires: qt5-qtsvg-devel |
|
17 | BuildRequires: qt5-qtsvg-devel | |
18 | BuildRequires: qt5-qtxmlpatterns-devel |
|
18 | BuildRequires: qt5-qtxmlpatterns-devel | |
19 | BuildRequires: qt5-qtmultimedia-devel |
|
19 | BuildRequires: qt5-qtmultimedia-devel | |
20 | BuildRequires: qt5-pythonqt-devel |
|
20 | BuildRequires: qt5-pythonqt-devel | |
21 | BuildRequires: appdata-tools |
|
21 | BuildRequires: appdata-tools | |
22 | BuildRequires: desktop-file-utils |
|
22 | BuildRequires: desktop-file-utils | |
23 | BuildRequires: fftw-devel |
|
23 | BuildRequires: fftw-devel | |
24 |
|
24 | |||
25 | Requires(post): python2 |
|
25 | Requires(post): python2 | |
26 | Requires(post): qt5-qtbase |
|
26 | Requires(post): qt5-qtbase | |
27 | Requires(post): qt5-qtwebkit |
|
27 | Requires(post): qt5-qtwebkit | |
28 | Requires(post): qt5-qtsvg |
|
28 | Requires(post): qt5-qtsvg | |
29 | Requires(post): qt5-qtxmlpatterns |
|
29 | Requires(post): qt5-qtxmlpatterns | |
30 | Requires(post): qt5-pythonqt |
|
30 | Requires(post): qt5-pythonqt | |
31 | Requires(post): fftw |
|
31 | Requires(post): fftw | |
32 |
|
32 | |||
33 |
Provides: qlop = 0. |
|
33 | Provides: qlop = 0.2-1 | |
34 |
|
34 | |||
35 | %description |
|
35 | %description | |
36 | QLop is an interactive plotting software, this is an early development preview of what this software will be. |
|
36 | QLop is an interactive plotting software, this is an early development preview of what this software will be. | |
37 |
|
37 | |||
38 | %prep |
|
38 | %prep | |
39 | %setup -q -n %{upstream_name} |
|
39 | %setup -q -n %{upstream_name} | |
40 |
|
40 | |||
41 |
|
41 | |||
42 |
|
42 | |||
43 | %build |
|
43 | %build | |
44 | %{_qt5_qmake} |
|
44 | %{_qt5_qmake} | |
45 |
|
45 | |||
46 | make %{?_smp_mflags} |
|
46 | make %{?_smp_mflags} | |
47 |
|
47 | |||
48 | %install |
|
48 | %install | |
49 | make install INSTALL_ROOT=%{buildroot} |
|
49 | make install INSTALL_ROOT=%{buildroot} | |
50 | #appdata-validate --nonet %{buildroot}/%{_datadir}/appdata/QLop.appdata.xml |
|
50 | #appdata-validate --nonet %{buildroot}/%{_datadir}/appdata/QLop.appdata.xml | |
51 | #desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/QLop.desktop |
|
51 | #desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/QLop.desktop | |
52 |
|
52 | |||
53 | %post -p /sbin/ldconfig |
|
53 | %post -p /sbin/ldconfig | |
54 |
|
54 | |||
55 | %postun -p /sbin/ldconfig |
|
55 | %postun -p /sbin/ldconfig | |
56 |
|
56 | |||
57 | %files |
|
57 | %files | |
58 | /etc/QLop/python/PygmentsHighlighter.py |
|
58 | /etc/QLop/python/PygmentsHighlighter.py | |
59 | /etc/QLop/python/PygmentsHighlighter.pyc |
|
59 | /etc/QLop/python/PygmentsHighlighter.pyc | |
60 | /etc/QLop/python/PygmentsHighlighter.pyo |
|
60 | /etc/QLop/python/PygmentsHighlighter.pyo | |
61 | /etc/QLop/python/PythonCompleter.py |
|
61 | /etc/QLop/python/PythonCompleter.py | |
62 | /etc/QLop/python/PythonCompleter.pyc |
|
62 | /etc/QLop/python/PythonCompleter.pyc | |
63 | /etc/QLop/python/PythonCompleter.pyo |
|
63 | /etc/QLop/python/PythonCompleter.pyo | |
64 | /etc/QLop/python/module_completion.py |
|
64 | /etc/QLop/python/module_completion.py | |
65 | /etc/QLop/python/module_completion.pyc |
|
65 | /etc/QLop/python/module_completion.pyc | |
66 | /etc/QLop/python/module_completion.pyo |
|
66 | /etc/QLop/python/module_completion.pyo | |
67 | /etc/QLop/python/pygments/__init__.py |
|
67 | /etc/QLop/python/pygments/__init__.py | |
68 | /etc/QLop/python/pygments/__init__.pyc |
|
68 | /etc/QLop/python/pygments/__init__.pyc | |
69 | /etc/QLop/python/pygments/__init__.pyo |
|
69 | /etc/QLop/python/pygments/__init__.pyo | |
70 | /etc/QLop/python/pygments/cmdline.py |
|
70 | /etc/QLop/python/pygments/cmdline.py | |
71 | /etc/QLop/python/pygments/cmdline.pyc |
|
71 | /etc/QLop/python/pygments/cmdline.pyc | |
72 | /etc/QLop/python/pygments/cmdline.pyo |
|
72 | /etc/QLop/python/pygments/cmdline.pyo | |
73 | /etc/QLop/python/pygments/console.py |
|
73 | /etc/QLop/python/pygments/console.py | |
74 | /etc/QLop/python/pygments/console.pyc |
|
74 | /etc/QLop/python/pygments/console.pyc | |
75 | /etc/QLop/python/pygments/console.pyo |
|
75 | /etc/QLop/python/pygments/console.pyo | |
76 | /etc/QLop/python/pygments/filter.py |
|
76 | /etc/QLop/python/pygments/filter.py | |
77 | /etc/QLop/python/pygments/filter.pyc |
|
77 | /etc/QLop/python/pygments/filter.pyc | |
78 | /etc/QLop/python/pygments/filter.pyo |
|
78 | /etc/QLop/python/pygments/filter.pyo | |
79 | /etc/QLop/python/pygments/filters/__init__.py |
|
79 | /etc/QLop/python/pygments/filters/__init__.py | |
80 | /etc/QLop/python/pygments/filters/__init__.pyc |
|
80 | /etc/QLop/python/pygments/filters/__init__.pyc | |
81 | /etc/QLop/python/pygments/filters/__init__.pyo |
|
81 | /etc/QLop/python/pygments/filters/__init__.pyo | |
82 | /etc/QLop/python/pygments/formatter.py |
|
82 | /etc/QLop/python/pygments/formatter.py | |
83 | /etc/QLop/python/pygments/formatter.pyc |
|
83 | /etc/QLop/python/pygments/formatter.pyc | |
84 | /etc/QLop/python/pygments/formatter.pyo |
|
84 | /etc/QLop/python/pygments/formatter.pyo | |
85 | /etc/QLop/python/pygments/formatters/__init__.py |
|
85 | /etc/QLop/python/pygments/formatters/__init__.py | |
86 | /etc/QLop/python/pygments/formatters/__init__.pyc |
|
86 | /etc/QLop/python/pygments/formatters/__init__.pyc | |
87 | /etc/QLop/python/pygments/formatters/__init__.pyo |
|
87 | /etc/QLop/python/pygments/formatters/__init__.pyo | |
88 | /etc/QLop/python/pygments/formatters/_mapping.py |
|
88 | /etc/QLop/python/pygments/formatters/_mapping.py | |
89 | /etc/QLop/python/pygments/formatters/_mapping.pyc |
|
89 | /etc/QLop/python/pygments/formatters/_mapping.pyc | |
90 | /etc/QLop/python/pygments/formatters/_mapping.pyo |
|
90 | /etc/QLop/python/pygments/formatters/_mapping.pyo | |
91 | /etc/QLop/python/pygments/formatters/bbcode.py |
|
91 | /etc/QLop/python/pygments/formatters/bbcode.py | |
92 | /etc/QLop/python/pygments/formatters/bbcode.pyc |
|
92 | /etc/QLop/python/pygments/formatters/bbcode.pyc | |
93 | /etc/QLop/python/pygments/formatters/bbcode.pyo |
|
93 | /etc/QLop/python/pygments/formatters/bbcode.pyo | |
94 | /etc/QLop/python/pygments/formatters/html.py |
|
94 | /etc/QLop/python/pygments/formatters/html.py | |
95 | /etc/QLop/python/pygments/formatters/html.pyc |
|
95 | /etc/QLop/python/pygments/formatters/html.pyc | |
96 | /etc/QLop/python/pygments/formatters/html.pyo |
|
96 | /etc/QLop/python/pygments/formatters/html.pyo | |
97 | /etc/QLop/python/pygments/formatters/img.py |
|
97 | /etc/QLop/python/pygments/formatters/img.py | |
98 | /etc/QLop/python/pygments/formatters/img.pyc |
|
98 | /etc/QLop/python/pygments/formatters/img.pyc | |
99 | /etc/QLop/python/pygments/formatters/img.pyo |
|
99 | /etc/QLop/python/pygments/formatters/img.pyo | |
100 | /etc/QLop/python/pygments/formatters/latex.py |
|
100 | /etc/QLop/python/pygments/formatters/latex.py | |
101 | /etc/QLop/python/pygments/formatters/latex.pyc |
|
101 | /etc/QLop/python/pygments/formatters/latex.pyc | |
102 | /etc/QLop/python/pygments/formatters/latex.pyo |
|
102 | /etc/QLop/python/pygments/formatters/latex.pyo | |
103 | /etc/QLop/python/pygments/formatters/other.py |
|
103 | /etc/QLop/python/pygments/formatters/other.py | |
104 | /etc/QLop/python/pygments/formatters/other.pyc |
|
104 | /etc/QLop/python/pygments/formatters/other.pyc | |
105 | /etc/QLop/python/pygments/formatters/other.pyo |
|
105 | /etc/QLop/python/pygments/formatters/other.pyo | |
106 | /etc/QLop/python/pygments/formatters/rtf.py |
|
106 | /etc/QLop/python/pygments/formatters/rtf.py | |
107 | /etc/QLop/python/pygments/formatters/rtf.pyc |
|
107 | /etc/QLop/python/pygments/formatters/rtf.pyc | |
108 | /etc/QLop/python/pygments/formatters/rtf.pyo |
|
108 | /etc/QLop/python/pygments/formatters/rtf.pyo | |
109 | /etc/QLop/python/pygments/formatters/svg.py |
|
109 | /etc/QLop/python/pygments/formatters/svg.py | |
110 | /etc/QLop/python/pygments/formatters/svg.pyc |
|
110 | /etc/QLop/python/pygments/formatters/svg.pyc | |
111 | /etc/QLop/python/pygments/formatters/svg.pyo |
|
111 | /etc/QLop/python/pygments/formatters/svg.pyo | |
112 | /etc/QLop/python/pygments/formatters/terminal.py |
|
112 | /etc/QLop/python/pygments/formatters/terminal.py | |
113 | /etc/QLop/python/pygments/formatters/terminal.pyc |
|
113 | /etc/QLop/python/pygments/formatters/terminal.pyc | |
114 | /etc/QLop/python/pygments/formatters/terminal.pyo |
|
114 | /etc/QLop/python/pygments/formatters/terminal.pyo | |
115 | /etc/QLop/python/pygments/formatters/terminal256.py |
|
115 | /etc/QLop/python/pygments/formatters/terminal256.py | |
116 | /etc/QLop/python/pygments/formatters/terminal256.pyc |
|
116 | /etc/QLop/python/pygments/formatters/terminal256.pyc | |
117 | /etc/QLop/python/pygments/formatters/terminal256.pyo |
|
117 | /etc/QLop/python/pygments/formatters/terminal256.pyo | |
118 | /etc/QLop/python/pygments/lexer.py |
|
118 | /etc/QLop/python/pygments/lexer.py | |
119 | /etc/QLop/python/pygments/lexer.pyc |
|
119 | /etc/QLop/python/pygments/lexer.pyc | |
120 | /etc/QLop/python/pygments/lexer.pyo |
|
120 | /etc/QLop/python/pygments/lexer.pyo | |
121 | /etc/QLop/python/pygments/lexers/__init__.py |
|
121 | /etc/QLop/python/pygments/lexers/__init__.py | |
122 | /etc/QLop/python/pygments/lexers/__init__.pyc |
|
122 | /etc/QLop/python/pygments/lexers/__init__.pyc | |
123 | /etc/QLop/python/pygments/lexers/__init__.pyo |
|
123 | /etc/QLop/python/pygments/lexers/__init__.pyo | |
124 | /etc/QLop/python/pygments/lexers/_asybuiltins.py |
|
124 | /etc/QLop/python/pygments/lexers/_asybuiltins.py | |
125 | /etc/QLop/python/pygments/lexers/_asybuiltins.pyc |
|
125 | /etc/QLop/python/pygments/lexers/_asybuiltins.pyc | |
126 | /etc/QLop/python/pygments/lexers/_asybuiltins.pyo |
|
126 | /etc/QLop/python/pygments/lexers/_asybuiltins.pyo | |
127 | /etc/QLop/python/pygments/lexers/_clbuiltins.py |
|
127 | /etc/QLop/python/pygments/lexers/_clbuiltins.py | |
128 | /etc/QLop/python/pygments/lexers/_clbuiltins.pyc |
|
128 | /etc/QLop/python/pygments/lexers/_clbuiltins.pyc | |
129 | /etc/QLop/python/pygments/lexers/_clbuiltins.pyo |
|
129 | /etc/QLop/python/pygments/lexers/_clbuiltins.pyo | |
130 | /etc/QLop/python/pygments/lexers/_luabuiltins.py |
|
130 | /etc/QLop/python/pygments/lexers/_luabuiltins.py | |
131 | /etc/QLop/python/pygments/lexers/_luabuiltins.pyc |
|
131 | /etc/QLop/python/pygments/lexers/_luabuiltins.pyc | |
132 | /etc/QLop/python/pygments/lexers/_luabuiltins.pyo |
|
132 | /etc/QLop/python/pygments/lexers/_luabuiltins.pyo | |
133 | /etc/QLop/python/pygments/lexers/_mapping.py |
|
133 | /etc/QLop/python/pygments/lexers/_mapping.py | |
134 | /etc/QLop/python/pygments/lexers/_mapping.pyc |
|
134 | /etc/QLop/python/pygments/lexers/_mapping.pyc | |
135 | /etc/QLop/python/pygments/lexers/_mapping.pyo |
|
135 | /etc/QLop/python/pygments/lexers/_mapping.pyo | |
136 | /etc/QLop/python/pygments/lexers/_phpbuiltins.py |
|
136 | /etc/QLop/python/pygments/lexers/_phpbuiltins.py | |
137 | /etc/QLop/python/pygments/lexers/_phpbuiltins.pyc |
|
137 | /etc/QLop/python/pygments/lexers/_phpbuiltins.pyc | |
138 | /etc/QLop/python/pygments/lexers/_phpbuiltins.pyo |
|
138 | /etc/QLop/python/pygments/lexers/_phpbuiltins.pyo | |
139 | /etc/QLop/python/pygments/lexers/_postgres_builtins.py |
|
139 | /etc/QLop/python/pygments/lexers/_postgres_builtins.py | |
140 | /etc/QLop/python/pygments/lexers/_postgres_builtins.pyc |
|
140 | /etc/QLop/python/pygments/lexers/_postgres_builtins.pyc | |
141 | /etc/QLop/python/pygments/lexers/_postgres_builtins.pyo |
|
141 | /etc/QLop/python/pygments/lexers/_postgres_builtins.pyo | |
142 | /etc/QLop/python/pygments/lexers/_scilab_builtins.py |
|
142 | /etc/QLop/python/pygments/lexers/_scilab_builtins.py | |
143 | /etc/QLop/python/pygments/lexers/_scilab_builtins.pyc |
|
143 | /etc/QLop/python/pygments/lexers/_scilab_builtins.pyc | |
144 | /etc/QLop/python/pygments/lexers/_scilab_builtins.pyo |
|
144 | /etc/QLop/python/pygments/lexers/_scilab_builtins.pyo | |
145 | /etc/QLop/python/pygments/lexers/_vimbuiltins.py |
|
145 | /etc/QLop/python/pygments/lexers/_vimbuiltins.py | |
146 | /etc/QLop/python/pygments/lexers/_vimbuiltins.pyc |
|
146 | /etc/QLop/python/pygments/lexers/_vimbuiltins.pyc | |
147 | /etc/QLop/python/pygments/lexers/_vimbuiltins.pyo |
|
147 | /etc/QLop/python/pygments/lexers/_vimbuiltins.pyo | |
148 | /etc/QLop/python/pygments/lexers/agile.py |
|
148 | /etc/QLop/python/pygments/lexers/agile.py | |
149 | /etc/QLop/python/pygments/lexers/agile.pyc |
|
149 | /etc/QLop/python/pygments/lexers/agile.pyc | |
150 | /etc/QLop/python/pygments/lexers/agile.pyo |
|
150 | /etc/QLop/python/pygments/lexers/agile.pyo | |
151 | /etc/QLop/python/pygments/lexers/asm.py |
|
151 | /etc/QLop/python/pygments/lexers/asm.py | |
152 | /etc/QLop/python/pygments/lexers/asm.pyc |
|
152 | /etc/QLop/python/pygments/lexers/asm.pyc | |
153 | /etc/QLop/python/pygments/lexers/asm.pyo |
|
153 | /etc/QLop/python/pygments/lexers/asm.pyo | |
154 | /etc/QLop/python/pygments/lexers/compiled.py |
|
154 | /etc/QLop/python/pygments/lexers/compiled.py | |
155 | /etc/QLop/python/pygments/lexers/compiled.pyc |
|
155 | /etc/QLop/python/pygments/lexers/compiled.pyc | |
156 | /etc/QLop/python/pygments/lexers/compiled.pyo |
|
156 | /etc/QLop/python/pygments/lexers/compiled.pyo | |
157 | /etc/QLop/python/pygments/lexers/dotnet.py |
|
157 | /etc/QLop/python/pygments/lexers/dotnet.py | |
158 | /etc/QLop/python/pygments/lexers/dotnet.pyc |
|
158 | /etc/QLop/python/pygments/lexers/dotnet.pyc | |
159 | /etc/QLop/python/pygments/lexers/dotnet.pyo |
|
159 | /etc/QLop/python/pygments/lexers/dotnet.pyo | |
160 | /etc/QLop/python/pygments/lexers/functional.py |
|
160 | /etc/QLop/python/pygments/lexers/functional.py | |
161 | /etc/QLop/python/pygments/lexers/functional.pyc |
|
161 | /etc/QLop/python/pygments/lexers/functional.pyc | |
162 | /etc/QLop/python/pygments/lexers/functional.pyo |
|
162 | /etc/QLop/python/pygments/lexers/functional.pyo | |
163 | /etc/QLop/python/pygments/lexers/hdl.py |
|
163 | /etc/QLop/python/pygments/lexers/hdl.py | |
164 | /etc/QLop/python/pygments/lexers/hdl.pyc |
|
164 | /etc/QLop/python/pygments/lexers/hdl.pyc | |
165 | /etc/QLop/python/pygments/lexers/hdl.pyo |
|
165 | /etc/QLop/python/pygments/lexers/hdl.pyo | |
166 | /etc/QLop/python/pygments/lexers/jvm.py |
|
166 | /etc/QLop/python/pygments/lexers/jvm.py | |
167 | /etc/QLop/python/pygments/lexers/jvm.pyc |
|
167 | /etc/QLop/python/pygments/lexers/jvm.pyc | |
168 | /etc/QLop/python/pygments/lexers/jvm.pyo |
|
168 | /etc/QLop/python/pygments/lexers/jvm.pyo | |
169 | /etc/QLop/python/pygments/lexers/math.py |
|
169 | /etc/QLop/python/pygments/lexers/math.py | |
170 | /etc/QLop/python/pygments/lexers/math.pyc |
|
170 | /etc/QLop/python/pygments/lexers/math.pyc | |
171 | /etc/QLop/python/pygments/lexers/math.pyo |
|
171 | /etc/QLop/python/pygments/lexers/math.pyo | |
172 | /etc/QLop/python/pygments/lexers/other.py |
|
172 | /etc/QLop/python/pygments/lexers/other.py | |
173 | /etc/QLop/python/pygments/lexers/other.pyc |
|
173 | /etc/QLop/python/pygments/lexers/other.pyc | |
174 | /etc/QLop/python/pygments/lexers/other.pyo |
|
174 | /etc/QLop/python/pygments/lexers/other.pyo | |
175 | /etc/QLop/python/pygments/lexers/parsers.py |
|
175 | /etc/QLop/python/pygments/lexers/parsers.py | |
176 | /etc/QLop/python/pygments/lexers/parsers.pyc |
|
176 | /etc/QLop/python/pygments/lexers/parsers.pyc | |
177 | /etc/QLop/python/pygments/lexers/parsers.pyo |
|
177 | /etc/QLop/python/pygments/lexers/parsers.pyo | |
178 | /etc/QLop/python/pygments/lexers/shell.py |
|
178 | /etc/QLop/python/pygments/lexers/shell.py | |
179 | /etc/QLop/python/pygments/lexers/shell.pyc |
|
179 | /etc/QLop/python/pygments/lexers/shell.pyc | |
180 | /etc/QLop/python/pygments/lexers/shell.pyo |
|
180 | /etc/QLop/python/pygments/lexers/shell.pyo | |
181 | /etc/QLop/python/pygments/lexers/special.py |
|
181 | /etc/QLop/python/pygments/lexers/special.py | |
182 | /etc/QLop/python/pygments/lexers/special.pyc |
|
182 | /etc/QLop/python/pygments/lexers/special.pyc | |
183 | /etc/QLop/python/pygments/lexers/special.pyo |
|
183 | /etc/QLop/python/pygments/lexers/special.pyo | |
184 | /etc/QLop/python/pygments/lexers/sql.py |
|
184 | /etc/QLop/python/pygments/lexers/sql.py | |
185 | /etc/QLop/python/pygments/lexers/sql.pyc |
|
185 | /etc/QLop/python/pygments/lexers/sql.pyc | |
186 | /etc/QLop/python/pygments/lexers/sql.pyo |
|
186 | /etc/QLop/python/pygments/lexers/sql.pyo | |
187 | /etc/QLop/python/pygments/lexers/templates.py |
|
187 | /etc/QLop/python/pygments/lexers/templates.py | |
188 | /etc/QLop/python/pygments/lexers/templates.pyc |
|
188 | /etc/QLop/python/pygments/lexers/templates.pyc | |
189 | /etc/QLop/python/pygments/lexers/templates.pyo |
|
189 | /etc/QLop/python/pygments/lexers/templates.pyo | |
190 | /etc/QLop/python/pygments/lexers/text.py |
|
190 | /etc/QLop/python/pygments/lexers/text.py | |
191 | /etc/QLop/python/pygments/lexers/text.pyc |
|
191 | /etc/QLop/python/pygments/lexers/text.pyc | |
192 | /etc/QLop/python/pygments/lexers/text.pyo |
|
192 | /etc/QLop/python/pygments/lexers/text.pyo | |
193 | /etc/QLop/python/pygments/lexers/web.py |
|
193 | /etc/QLop/python/pygments/lexers/web.py | |
194 | /etc/QLop/python/pygments/lexers/web.pyc |
|
194 | /etc/QLop/python/pygments/lexers/web.pyc | |
195 | /etc/QLop/python/pygments/lexers/web.pyo |
|
195 | /etc/QLop/python/pygments/lexers/web.pyo | |
196 | /etc/QLop/python/pygments/plugin.py |
|
196 | /etc/QLop/python/pygments/plugin.py | |
197 | /etc/QLop/python/pygments/plugin.pyc |
|
197 | /etc/QLop/python/pygments/plugin.pyc | |
198 | /etc/QLop/python/pygments/plugin.pyo |
|
198 | /etc/QLop/python/pygments/plugin.pyo | |
199 | /etc/QLop/python/pygments/scanner.py |
|
199 | /etc/QLop/python/pygments/scanner.py | |
200 | /etc/QLop/python/pygments/scanner.pyc |
|
200 | /etc/QLop/python/pygments/scanner.pyc | |
201 | /etc/QLop/python/pygments/scanner.pyo |
|
201 | /etc/QLop/python/pygments/scanner.pyo | |
202 | /etc/QLop/python/pygments/style.py |
|
202 | /etc/QLop/python/pygments/style.py | |
203 | /etc/QLop/python/pygments/style.pyc |
|
203 | /etc/QLop/python/pygments/style.pyc | |
204 | /etc/QLop/python/pygments/style.pyo |
|
204 | /etc/QLop/python/pygments/style.pyo | |
205 | /etc/QLop/python/pygments/styles/__init__.py |
|
205 | /etc/QLop/python/pygments/styles/__init__.py | |
206 | /etc/QLop/python/pygments/styles/__init__.pyc |
|
206 | /etc/QLop/python/pygments/styles/__init__.pyc | |
207 | /etc/QLop/python/pygments/styles/__init__.pyo |
|
207 | /etc/QLop/python/pygments/styles/__init__.pyo | |
208 | /etc/QLop/python/pygments/styles/autumn.py |
|
208 | /etc/QLop/python/pygments/styles/autumn.py | |
209 | /etc/QLop/python/pygments/styles/autumn.pyc |
|
209 | /etc/QLop/python/pygments/styles/autumn.pyc | |
210 | /etc/QLop/python/pygments/styles/autumn.pyo |
|
210 | /etc/QLop/python/pygments/styles/autumn.pyo | |
211 | /etc/QLop/python/pygments/styles/borland.py |
|
211 | /etc/QLop/python/pygments/styles/borland.py | |
212 | /etc/QLop/python/pygments/styles/borland.pyc |
|
212 | /etc/QLop/python/pygments/styles/borland.pyc | |
213 | /etc/QLop/python/pygments/styles/borland.pyo |
|
213 | /etc/QLop/python/pygments/styles/borland.pyo | |
214 | /etc/QLop/python/pygments/styles/bw.py |
|
214 | /etc/QLop/python/pygments/styles/bw.py | |
215 | /etc/QLop/python/pygments/styles/bw.pyc |
|
215 | /etc/QLop/python/pygments/styles/bw.pyc | |
216 | /etc/QLop/python/pygments/styles/bw.pyo |
|
216 | /etc/QLop/python/pygments/styles/bw.pyo | |
217 | /etc/QLop/python/pygments/styles/colorful.py |
|
217 | /etc/QLop/python/pygments/styles/colorful.py | |
218 | /etc/QLop/python/pygments/styles/colorful.pyc |
|
218 | /etc/QLop/python/pygments/styles/colorful.pyc | |
219 | /etc/QLop/python/pygments/styles/colorful.pyo |
|
219 | /etc/QLop/python/pygments/styles/colorful.pyo | |
220 | /etc/QLop/python/pygments/styles/default.py |
|
220 | /etc/QLop/python/pygments/styles/default.py | |
221 | /etc/QLop/python/pygments/styles/default.pyc |
|
221 | /etc/QLop/python/pygments/styles/default.pyc | |
222 | /etc/QLop/python/pygments/styles/default.pyo |
|
222 | /etc/QLop/python/pygments/styles/default.pyo | |
223 | /etc/QLop/python/pygments/styles/emacs.py |
|
223 | /etc/QLop/python/pygments/styles/emacs.py | |
224 | /etc/QLop/python/pygments/styles/emacs.pyc |
|
224 | /etc/QLop/python/pygments/styles/emacs.pyc | |
225 | /etc/QLop/python/pygments/styles/emacs.pyo |
|
225 | /etc/QLop/python/pygments/styles/emacs.pyo | |
226 | /etc/QLop/python/pygments/styles/friendly.py |
|
226 | /etc/QLop/python/pygments/styles/friendly.py | |
227 | /etc/QLop/python/pygments/styles/friendly.pyc |
|
227 | /etc/QLop/python/pygments/styles/friendly.pyc | |
228 | /etc/QLop/python/pygments/styles/friendly.pyo |
|
228 | /etc/QLop/python/pygments/styles/friendly.pyo | |
229 | /etc/QLop/python/pygments/styles/fruity.py |
|
229 | /etc/QLop/python/pygments/styles/fruity.py | |
230 | /etc/QLop/python/pygments/styles/fruity.pyc |
|
230 | /etc/QLop/python/pygments/styles/fruity.pyc | |
231 | /etc/QLop/python/pygments/styles/fruity.pyo |
|
231 | /etc/QLop/python/pygments/styles/fruity.pyo | |
232 | /etc/QLop/python/pygments/styles/manni.py |
|
232 | /etc/QLop/python/pygments/styles/manni.py | |
233 | /etc/QLop/python/pygments/styles/manni.pyc |
|
233 | /etc/QLop/python/pygments/styles/manni.pyc | |
234 | /etc/QLop/python/pygments/styles/manni.pyo |
|
234 | /etc/QLop/python/pygments/styles/manni.pyo | |
235 | /etc/QLop/python/pygments/styles/monokai.py |
|
235 | /etc/QLop/python/pygments/styles/monokai.py | |
236 | /etc/QLop/python/pygments/styles/monokai.pyc |
|
236 | /etc/QLop/python/pygments/styles/monokai.pyc | |
237 | /etc/QLop/python/pygments/styles/monokai.pyo |
|
237 | /etc/QLop/python/pygments/styles/monokai.pyo | |
238 | /etc/QLop/python/pygments/styles/murphy.py |
|
238 | /etc/QLop/python/pygments/styles/murphy.py | |
239 | /etc/QLop/python/pygments/styles/murphy.pyc |
|
239 | /etc/QLop/python/pygments/styles/murphy.pyc | |
240 | /etc/QLop/python/pygments/styles/murphy.pyo |
|
240 | /etc/QLop/python/pygments/styles/murphy.pyo | |
241 | /etc/QLop/python/pygments/styles/native.py |
|
241 | /etc/QLop/python/pygments/styles/native.py | |
242 | /etc/QLop/python/pygments/styles/native.pyc |
|
242 | /etc/QLop/python/pygments/styles/native.pyc | |
243 | /etc/QLop/python/pygments/styles/native.pyo |
|
243 | /etc/QLop/python/pygments/styles/native.pyo | |
244 | /etc/QLop/python/pygments/styles/pastie.py |
|
244 | /etc/QLop/python/pygments/styles/pastie.py | |
245 | /etc/QLop/python/pygments/styles/pastie.pyc |
|
245 | /etc/QLop/python/pygments/styles/pastie.pyc | |
246 | /etc/QLop/python/pygments/styles/pastie.pyo |
|
246 | /etc/QLop/python/pygments/styles/pastie.pyo | |
247 | /etc/QLop/python/pygments/styles/perldoc.py |
|
247 | /etc/QLop/python/pygments/styles/perldoc.py | |
248 | /etc/QLop/python/pygments/styles/perldoc.pyc |
|
248 | /etc/QLop/python/pygments/styles/perldoc.pyc | |
249 | /etc/QLop/python/pygments/styles/perldoc.pyo |
|
249 | /etc/QLop/python/pygments/styles/perldoc.pyo | |
250 | /etc/QLop/python/pygments/styles/rrt.py |
|
250 | /etc/QLop/python/pygments/styles/rrt.py | |
251 | /etc/QLop/python/pygments/styles/rrt.pyc |
|
251 | /etc/QLop/python/pygments/styles/rrt.pyc | |
252 | /etc/QLop/python/pygments/styles/rrt.pyo |
|
252 | /etc/QLop/python/pygments/styles/rrt.pyo | |
253 | /etc/QLop/python/pygments/styles/tango.py |
|
253 | /etc/QLop/python/pygments/styles/tango.py | |
254 | /etc/QLop/python/pygments/styles/tango.pyc |
|
254 | /etc/QLop/python/pygments/styles/tango.pyc | |
255 | /etc/QLop/python/pygments/styles/tango.pyo |
|
255 | /etc/QLop/python/pygments/styles/tango.pyo | |
256 | /etc/QLop/python/pygments/styles/trac.py |
|
256 | /etc/QLop/python/pygments/styles/trac.py | |
257 | /etc/QLop/python/pygments/styles/trac.pyc |
|
257 | /etc/QLop/python/pygments/styles/trac.pyc | |
258 | /etc/QLop/python/pygments/styles/trac.pyo |
|
258 | /etc/QLop/python/pygments/styles/trac.pyo | |
259 | /etc/QLop/python/pygments/styles/vim.py |
|
259 | /etc/QLop/python/pygments/styles/vim.py | |
260 | /etc/QLop/python/pygments/styles/vim.pyc |
|
260 | /etc/QLop/python/pygments/styles/vim.pyc | |
261 | /etc/QLop/python/pygments/styles/vim.pyo |
|
261 | /etc/QLop/python/pygments/styles/vim.pyo | |
262 | /etc/QLop/python/pygments/styles/vs.py |
|
262 | /etc/QLop/python/pygments/styles/vs.py | |
263 | /etc/QLop/python/pygments/styles/vs.pyc |
|
263 | /etc/QLop/python/pygments/styles/vs.pyc | |
264 | /etc/QLop/python/pygments/styles/vs.pyo |
|
264 | /etc/QLop/python/pygments/styles/vs.pyo | |
265 | /etc/QLop/python/pygments/token.py |
|
265 | /etc/QLop/python/pygments/token.py | |
266 | /etc/QLop/python/pygments/token.pyc |
|
266 | /etc/QLop/python/pygments/token.pyc | |
267 | /etc/QLop/python/pygments/token.pyo |
|
267 | /etc/QLop/python/pygments/token.pyo | |
268 | /etc/QLop/python/pygments/unistring.py |
|
268 | /etc/QLop/python/pygments/unistring.py | |
269 | /etc/QLop/python/pygments/unistring.pyc |
|
269 | /etc/QLop/python/pygments/unistring.pyc | |
270 | /etc/QLop/python/pygments/unistring.pyo |
|
270 | /etc/QLop/python/pygments/unistring.pyo | |
271 | /etc/QLop/python/pygments/util.py |
|
271 | /etc/QLop/python/pygments/util.py | |
272 | /etc/QLop/python/pygments/util.pyc |
|
272 | /etc/QLop/python/pygments/util.pyc | |
273 | /etc/QLop/python/pygments/util.pyo |
|
273 | /etc/QLop/python/pygments/util.pyo | |
274 | /usr/bin/QLop |
|
274 | /usr/bin/QLop | |
275 | /usr/share/QLop/QLop.png |
|
275 | /usr/share/QLop/QLop.png | |
276 | /usr/share/QLop/QLop.svg |
|
276 | /usr/share/QLop/QLop.svg | |
277 | /usr/share/appdata/QLop.appdata.xml |
|
277 | /usr/share/appdata/QLop.appdata.xml | |
278 | /usr/share/applications/QLop.desktop |
|
278 | /usr/share/applications/QLop.desktop | |
279 |
|
279 | |||
280 |
|
280 | |||
281 | %changelog |
|
281 | %changelog | |
|
282 | * Wed Apr 29 2015 Alexis Jeandet <alexis.jeandet@member.fsf.org> - 0.2 | |||
|
283 | - Update source to r14 | |||
|
284 | ||||
282 | * Wed Apr 8 2015 Alexis Jeandet <alexis.jeandet@member.fsf.org> - 0.1 |
|
285 | * Wed Apr 8 2015 Alexis Jeandet <alexis.jeandet@member.fsf.org> - 0.1 | |
283 | - Initial Fedora packaging |
|
286 | - Initial Fedora packaging | |
284 |
|
287 | |||
285 | * Fri Apr 3 2015 Alexis Jeandet <alexis.jeandet@member.fsf.org> - 0.1 |
|
288 | * Fri Apr 3 2015 Alexis Jeandet <alexis.jeandet@member.fsf.org> - 0.1 | |
286 | - Initial Fedora packaging |
|
289 | - Initial Fedora packaging |
@@ -1,91 +1,109 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the QLop Software |
|
2 | -- This file is a part of the QLop Software | |
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 |
|
22 | |||
23 | #include "cassinidatadownloader.h" |
|
23 | #include "cassinidatadownloader.h" | |
24 | #include "ui_cassinidatadownloader.h" |
|
24 | #include "ui_cassinidatadownloader.h" | |
25 | #include <filedownloader.h> |
|
25 | #include <filedownloader.h> | |
26 | #include <QDir> |
|
26 | #include <QDir> | |
27 | #include <QFileDialog> |
|
27 | #include <QFileDialog> | |
28 | #include <QFile> |
|
28 | #include <QFile> | |
29 |
|
29 | |||
30 | CassiniDataDownloader::CassiniDataDownloader(QWidget *parent) : |
|
30 | CassiniDataDownloader::CassiniDataDownloader(QWidget *parent) : | |
31 | QWidget(parent), |
|
31 | QWidget(parent), | |
32 | ui(new Ui::CassiniDataDownloader) |
|
32 | ui(new Ui::CassiniDataDownloader) | |
33 | { |
|
33 | { | |
34 | ui->setupUi(this); |
|
34 | ui->setupUi(this); | |
35 | m_xmlLoader = new ExpXmlDownLoader(); |
|
35 | m_xmlLoader = new ExpXmlDownLoader(); | |
|
36 | m_TTDownLoader = new ExpTimeTableDownLoader(); | |||
36 | connect(this->ui->calendar,SIGNAL(activated(QDate)),this,SLOT(downloadData(QDate))); |
|
37 | connect(this->ui->calendar,SIGNAL(activated(QDate)),this,SLOT(downloadData(QDate))); | |
37 | connect(this->ui->LoadXmlFileQpb,SIGNAL(clicked()),this,SLOT(loadXmlFile())); |
|
38 | connect(this->ui->LoadXmlFileQpb,SIGNAL(clicked()),this,SLOT(loadXmlFile())); | |
|
39 | connect(this->ui->LoadTimeTableQpb,SIGNAL(clicked()),this,SLOT(loadTimeTableFile())); | |||
38 | } |
|
40 | } | |
39 |
|
41 | |||
40 | CassiniDataDownloader::~CassiniDataDownloader() |
|
42 | CassiniDataDownloader::~CassiniDataDownloader() | |
41 | { |
|
43 | { | |
42 | delete ui; |
|
44 | delete ui; | |
43 | delete m_xmlLoader; |
|
45 | delete m_xmlLoader; | |
44 | } |
|
46 | } | |
45 |
|
47 | |||
46 | void CassiniDataDownloader::changeEvent(QEvent *e) |
|
48 | void CassiniDataDownloader::changeEvent(QEvent *e) | |
47 | { |
|
49 | { | |
48 | QWidget::changeEvent(e); |
|
50 | QWidget::changeEvent(e); | |
49 | switch (e->type()) { |
|
51 | switch (e->type()) { | |
50 | case QEvent::LanguageChange: |
|
52 | case QEvent::LanguageChange: | |
51 | ui->retranslateUi(this); |
|
53 | ui->retranslateUi(this); | |
52 | break; |
|
54 | break; | |
53 | default: |
|
55 | default: | |
54 | break; |
|
56 | break; | |
55 | } |
|
57 | } | |
56 | } |
|
58 | } | |
57 |
|
59 | |||
58 | void CassiniDataDownloader::downloadData(const QDate &date) |
|
60 | void CassiniDataDownloader::downloadData(const QDate &date) | |
59 | { |
|
61 | { | |
60 | QDate tmpDate; |
|
62 | QDate tmpDate; | |
61 | QStringList months=QStringList()<< "JAN" << "FEB" << "MAR" << "APR" << "MAY" << "JUN" << "JUI" << "AUG" << "SEP" << "OCT" << "NOV" << "DEC"; |
|
63 | QStringList months=QStringList()<< "JAN" << "FEB" << "MAR" << "APR" << "MAY" << "JUN" << "JUI" << "AUG" << "SEP" << "OCT" << "NOV" << "DEC"; | |
62 | tmpDate.setDate(date.year(),date.month(),1); |
|
64 | tmpDate.setDate(date.year(),date.month(),1); | |
63 | int firstDayOfMonth=tmpDate.dayOfYear(); |
|
65 | int firstDayOfMonth=tmpDate.dayOfYear(); | |
64 | tmpDate.setDate(tmpDate.year(),tmpDate.month(),tmpDate.daysInMonth()); |
|
66 | tmpDate.setDate(tmpDate.year(),tmpDate.month(),tmpDate.daysInMonth()); | |
65 | int lastDayOfMonth=tmpDate.dayOfYear(); |
|
67 | int lastDayOfMonth=tmpDate.dayOfYear(); | |
66 | QString link="http://ppi.pds.nasa.gov/ditdos/download?id=pds://PPI/CO-E_SW_J_S-MAG-3-RDR-FULL-RES-V1.0/DATA/" \ |
|
68 | QString link="http://ppi.pds.nasa.gov/ditdos/download?id=pds://PPI/CO-E_SW_J_S-MAG-3-RDR-FULL-RES-V1.0/DATA/" \ | |
67 | + QString("%1").arg(date.year()) +"/" + QString("%1_%2_").arg(firstDayOfMonth,3).arg(lastDayOfMonth,3).replace(' ','0') \ |
|
69 | + QString("%1").arg(date.year()) +"/" + QString("%1_%2_").arg(firstDayOfMonth,3).arg(lastDayOfMonth,3).replace(' ','0') \ | |
68 | + months.at(date.month()-1) + "/" ; |
|
70 | + months.at(date.month()-1) + "/" ; | |
69 | qDebug()<<link; |
|
71 | qDebug()<<link; | |
70 | QString dataFileName= QString("%1%2").arg(date.year()-2000,2).arg(date.dayOfYear(),3).replace(' ','0') + "_FGM_KRTP.TAB"; |
|
72 | QString dataFileName= QString("%1%2").arg(date.year()-2000,2).arg(date.dayOfYear(),3).replace(' ','0') + "_FGM_KRTP.TAB"; | |
71 | QString headerFileName= QString("%1%2").arg(date.year()-2000,2).arg(date.dayOfYear(),3).replace(' ','0') + "_FGM_KRTP.LBL"; |
|
73 | QString headerFileName= QString("%1%2").arg(date.year()-2000,2).arg(date.dayOfYear(),3).replace(' ','0') + "_FGM_KRTP.LBL"; | |
72 | // "_FGM_KRTP.TAB" |
|
74 | // "_FGM_KRTP.TAB" | |
73 | FileDownloader::downloadFile(link+dataFileName,QDir::homePath() +"/TΓ©lΓ©chargements/"+dataFileName); |
|
75 | FileDownloader::downloadFile(link+dataFileName,QDir::homePath() +"/TΓ©lΓ©chargements/"+dataFileName); | |
74 | FileDownloader::downloadFile(link+headerFileName,QDir::homePath() +"/TΓ©lΓ©chargements/"+headerFileName); |
|
76 | FileDownloader::downloadFile(link+headerFileName,QDir::homePath() +"/TΓ©lΓ©chargements/"+headerFileName); | |
75 | } |
|
77 | } | |
76 |
|
78 | |||
77 | void CassiniDataDownloader::loadXmlFile() |
|
79 | void CassiniDataDownloader::loadXmlFile() | |
78 | { |
|
80 | { | |
79 | QString file=QFileDialog::getOpenFileName(); |
|
81 | QString file=QFileDialog::getOpenFileName(); | |
80 | if(QFile::exists(file)) |
|
82 | if(QFile::exists(file)) | |
81 | { |
|
83 | { | |
82 | if(m_xmlLoader->parseXml(file)) |
|
84 | if(m_xmlLoader->parseXml(file)) | |
83 | { |
|
85 | { | |
84 | QList<QDate> daysToDl = m_xmlLoader->daysToDownload(); |
|
86 | QList<QDate> daysToDl = m_xmlLoader->daysToDownload(); | |
85 | for(int i=0;i<daysToDl.count();i++) |
|
87 | for(int i=0;i<daysToDl.count();i++) | |
86 | { |
|
88 | { | |
87 | downloadData(daysToDl.at(i)); |
|
89 | downloadData(daysToDl.at(i)); | |
88 | } |
|
90 | } | |
89 | } |
|
91 | } | |
90 | } |
|
92 | } | |
91 | } |
|
93 | } | |
|
94 | ||||
|
95 | void CassiniDataDownloader::loadTimeTableFile() | |||
|
96 | { | |||
|
97 | QString file=QFileDialog::getOpenFileName(); | |||
|
98 | if(QFile::exists(file)) | |||
|
99 | { | |||
|
100 | if(m_TTDownLoader->parseFile(file)) | |||
|
101 | { | |||
|
102 | QList<QDate> daysToDl = m_TTDownLoader->daysToDownload(); | |||
|
103 | for(int i=0;i<daysToDl.count();i++) | |||
|
104 | { | |||
|
105 | downloadData(daysToDl.at(i)); | |||
|
106 | } | |||
|
107 | } | |||
|
108 | } | |||
|
109 | } |
@@ -1,52 +1,56 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the QLop Software |
|
2 | -- This file is a part of the QLop Software | |
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 |
|
22 | |||
23 | #ifndef CASSINIDATADOWNLOADER_H |
|
23 | #ifndef CASSINIDATADOWNLOADER_H | |
24 | #define CASSINIDATADOWNLOADER_H |
|
24 | #define CASSINIDATADOWNLOADER_H | |
25 |
|
25 | |||
26 | #include <QWidget> |
|
26 | #include <QWidget> | |
27 | #include <QDate> |
|
27 | #include <QDate> | |
28 | #include <expxmldownloader.h> |
|
28 | #include <expxmldownloader.h> | |
|
29 | #include "exptimetabledownloader.h" | |||
29 |
|
30 | |||
30 | namespace Ui { |
|
31 | namespace Ui { | |
31 | class CassiniDataDownloader; |
|
32 | class CassiniDataDownloader; | |
32 | } |
|
33 | } | |
33 |
|
34 | |||
34 | class CassiniDataDownloader : public QWidget |
|
35 | class CassiniDataDownloader : public QWidget | |
35 | { |
|
36 | { | |
36 | Q_OBJECT |
|
37 | Q_OBJECT | |
37 |
|
38 | |||
38 | public: |
|
39 | public: | |
39 | explicit CassiniDataDownloader(QWidget *parent = 0); |
|
40 | explicit CassiniDataDownloader(QWidget *parent = 0); | |
40 | ~CassiniDataDownloader(); |
|
41 | ~CassiniDataDownloader(); | |
41 |
|
42 | |||
|
43 | public slots: | |||
42 | protected: |
|
44 | protected: | |
43 | void changeEvent(QEvent *e); |
|
45 | void changeEvent(QEvent *e); | |
44 | private slots: |
|
46 | private slots: | |
45 | void downloadData(const QDate & date ); |
|
47 | void downloadData(const QDate & date ); | |
|
48 | void loadTimeTableFile(); | |||
46 | void loadXmlFile(); |
|
49 | void loadXmlFile(); | |
47 | private: |
|
50 | private: | |
48 | Ui::CassiniDataDownloader *ui; |
|
51 | Ui::CassiniDataDownloader *ui; | |
49 | ExpXmlDownLoader* m_xmlLoader; |
|
52 | ExpXmlDownLoader* m_xmlLoader; | |
|
53 | ExpTimeTableDownLoader* m_TTDownLoader; | |||
50 | }; |
|
54 | }; | |
51 |
|
55 | |||
52 | #endif // CASSINIDATADOWNLOADER_H |
|
56 | #endif // CASSINIDATADOWNLOADER_H |
@@ -1,95 +1,102 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <ui version="4.0"> |
|
2 | <ui version="4.0"> | |
3 | <class>CassiniDataDownloader</class> |
|
3 | <class>CassiniDataDownloader</class> | |
4 | <widget class="QWidget" name="CassiniDataDownloader"> |
|
4 | <widget class="QWidget" name="CassiniDataDownloader"> | |
5 | <property name="geometry"> |
|
5 | <property name="geometry"> | |
6 | <rect> |
|
6 | <rect> | |
7 | <x>0</x> |
|
7 | <x>0</x> | |
8 | <y>0</y> |
|
8 | <y>0</y> | |
9 | <width>1032</width> |
|
9 | <width>1032</width> | |
10 | <height>648</height> |
|
10 | <height>648</height> | |
11 | </rect> |
|
11 | </rect> | |
12 | </property> |
|
12 | </property> | |
13 | <property name="windowTitle"> |
|
13 | <property name="windowTitle"> | |
14 | <string>Form</string> |
|
14 | <string>Form</string> | |
15 | </property> |
|
15 | </property> | |
16 | <layout class="QGridLayout" name="gridLayout_2"> |
|
16 | <layout class="QGridLayout" name="gridLayout_2"> | |
17 | <item row="0" column="0"> |
|
17 | <item row="0" column="0"> | |
18 | <layout class="QGridLayout" name="gridLayout_3"> |
|
18 | <layout class="QGridLayout" name="gridLayout_3"> | |
19 | <item row="0" column="0"> |
|
19 | <item row="0" column="0"> | |
20 | <widget class="QCalendarWidget" name="calendar"> |
|
20 | <widget class="QCalendarWidget" name="calendar"> | |
21 | <property name="acceptDrops"> |
|
21 | <property name="acceptDrops"> | |
22 | <bool>true</bool> |
|
22 | <bool>true</bool> | |
23 | </property> |
|
23 | </property> | |
24 | <property name="gridVisible"> |
|
24 | <property name="gridVisible"> | |
25 | <bool>false</bool> |
|
25 | <bool>false</bool> | |
26 | </property> |
|
26 | </property> | |
27 | </widget> |
|
27 | </widget> | |
28 | </item> |
|
28 | </item> | |
29 | <item row="0" column="1"> |
|
29 | <item row="0" column="1"> | |
30 | <widget class="QScrollArea" name="DownloadList"> |
|
30 | <widget class="QScrollArea" name="DownloadList"> | |
31 | <property name="widgetResizable"> |
|
31 | <property name="widgetResizable"> | |
32 | <bool>true</bool> |
|
32 | <bool>true</bool> | |
33 | </property> |
|
33 | </property> | |
34 | <widget class="QWidget" name="Content"> |
|
34 | <widget class="QWidget" name="Content"> | |
35 | <property name="geometry"> |
|
35 | <property name="geometry"> | |
36 | <rect> |
|
36 | <rect> | |
37 | <x>0</x> |
|
37 | <x>0</x> | |
38 | <y>0</y> |
|
38 | <y>0</y> | |
39 | <width>501</width> |
|
39 | <width>501</width> | |
40 | <height>626</height> |
|
40 | <height>626</height> | |
41 | </rect> |
|
41 | </rect> | |
42 | </property> |
|
42 | </property> | |
43 | <layout class="QGridLayout" name="gridLayout"> |
|
43 | <layout class="QGridLayout" name="gridLayout"> | |
44 | <item row="0" column="0"> |
|
44 | <item row="0" column="0"> | |
45 | <widget class="QPushButton" name="LoadXmlFileQpb"> |
|
45 | <widget class="QPushButton" name="LoadXmlFileQpb"> | |
46 | <property name="sizePolicy"> |
|
46 | <property name="sizePolicy"> | |
47 | <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> |
|
47 | <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> | |
48 | <horstretch>0</horstretch> |
|
48 | <horstretch>0</horstretch> | |
49 | <verstretch>0</verstretch> |
|
49 | <verstretch>0</verstretch> | |
50 | </sizepolicy> |
|
50 | </sizepolicy> | |
51 | </property> |
|
51 | </property> | |
52 | <property name="text"> |
|
52 | <property name="text"> | |
53 | <string>Load Xml File</string> |
|
53 | <string>Load Xml File</string> | |
54 | </property> |
|
54 | </property> | |
55 | </widget> |
|
55 | </widget> | |
56 | </item> |
|
56 | </item> | |
57 |
<item row=" |
|
57 | <item row="2" column="0"> | |
58 | <widget class="QGroupBox" name="groupBox"> |
|
58 | <widget class="QGroupBox" name="groupBox"> | |
59 | <property name="styleSheet"> |
|
59 | <property name="styleSheet"> | |
60 | <string notr="true">QGroupBox { |
|
60 | <string notr="true">QGroupBox { | |
61 | border: 1px solid gray; |
|
61 | border: 1px solid gray; | |
62 | border-radius: 9px; |
|
62 | border-radius: 9px; | |
63 | margin-top: 0.5em; |
|
63 | margin-top: 0.5em; | |
64 | } |
|
64 | } | |
65 | QGroupBox::title { |
|
65 | QGroupBox::title { | |
66 | subcontrol-origin: margin; |
|
66 | subcontrol-origin: margin; | |
67 | left: 10px; |
|
67 | left: 10px; | |
68 | padding: 0 3px 0 3px; |
|
68 | padding: 0 3px 0 3px; | |
69 | } |
|
69 | } | |
70 | </string> |
|
70 | </string> | |
71 | </property> |
|
71 | </property> | |
72 | <property name="title"> |
|
72 | <property name="title"> | |
73 | <string>Download list</string> |
|
73 | <string>Download list</string> | |
74 | </property> |
|
74 | </property> | |
75 | <layout class="QVBoxLayout" name="verticalLayout"/> |
|
75 | <layout class="QVBoxLayout" name="verticalLayout"/> | |
76 | </widget> |
|
76 | </widget> | |
77 | </item> |
|
77 | </item> | |
78 |
<item row=" |
|
78 | <item row="3" column="0"> | |
79 | <widget class="QPushButton" name="startDownloadQpb"> |
|
79 | <widget class="QPushButton" name="startDownloadQpb"> | |
80 | <property name="text"> |
|
80 | <property name="text"> | |
81 | <string>Start Download</string> |
|
81 | <string>Start Download</string> | |
82 | </property> |
|
82 | </property> | |
83 | </widget> |
|
83 | </widget> | |
84 | </item> |
|
84 | </item> | |
|
85 | <item row="1" column="0"> | |||
|
86 | <widget class="QPushButton" name="LoadTimeTableQpb"> | |||
|
87 | <property name="text"> | |||
|
88 | <string>Load a Time Table</string> | |||
|
89 | </property> | |||
|
90 | </widget> | |||
|
91 | </item> | |||
85 | </layout> |
|
92 | </layout> | |
86 | </widget> |
|
93 | </widget> | |
87 | </widget> |
|
94 | </widget> | |
88 | </item> |
|
95 | </item> | |
89 | </layout> |
|
96 | </layout> | |
90 | </item> |
|
97 | </item> | |
91 | </layout> |
|
98 | </layout> | |
92 | </widget> |
|
99 | </widget> | |
93 | <resources/> |
|
100 | <resources/> | |
94 | <connections/> |
|
101 | <connections/> | |
95 | </ui> |
|
102 | </ui> |
@@ -1,306 +1,310 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the QLop Software |
|
2 | -- This file is a part of the QLop Software | |
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "cassinidatafile.h" |
|
22 | #include "cassinidatafile.h" | |
23 | #include <QFile> |
|
23 | #include <QFile> | |
24 | #include <stdio.h> |
|
24 | #include <stdio.h> | |
25 | #include <QDateTime> |
|
25 | #include <QDateTime> | |
26 | #include <QVector> |
|
26 | #include <QVector> | |
27 | #include <QProgressDialog> |
|
27 | #include <QProgressDialog> | |
28 | #include <omp.h> |
|
28 | #include <omp.h> | |
29 | #include <QTimer> |
|
29 | #include <QTimer> | |
30 | #include <QElapsedTimer> |
|
30 | #include <QElapsedTimer> | |
31 | #include <sys/time.h> |
|
31 | #include <sys/time.h> | |
32 |
|
32 | |||
33 | CassiniDataFile::CassiniDataFile(QObject *parent) : AbstractFileLoader(parent) |
|
33 | CassiniDataFile::CassiniDataFile(QObject *parent) : AbstractFileLoader(parent) | |
34 | { |
|
34 | { | |
35 |
|
35 | |||
36 | } |
|
36 | } | |
37 |
|
37 | |||
38 | CassiniDataFile::~CassiniDataFile() |
|
38 | CassiniDataFile::~CassiniDataFile() | |
39 | { |
|
39 | { | |
40 |
|
40 | |||
41 | } |
|
41 | } | |
42 |
|
42 | |||
43 | void CassiniDataFile::parseFile(const QString &fileName) |
|
43 | void CassiniDataFile::parseFile(const QString &fileName) | |
44 | { |
|
44 | { | |
45 | this->fileName = fileName; |
|
45 | this->fileName = fileName; | |
46 | m_Write = false; |
|
46 | m_Write = false; | |
47 | this->start(); |
|
47 | this->start(); | |
48 | } |
|
48 | } | |
49 |
|
49 | |||
50 | void CassiniDataFile::saveFile(const QString &fileName, QLopDataList data) |
|
50 | void CassiniDataFile::saveFile(const QString &fileName, QLopDataList data) | |
51 | { |
|
51 | { | |
52 | this->fileName = fileName; |
|
52 | this->fileName = fileName; | |
53 | m_Write = true; |
|
53 | m_Write = true; | |
54 | m_data = data; |
|
54 | m_data = data; | |
55 | this->start(); |
|
55 | this->start(); | |
56 | } |
|
56 | } | |
57 |
|
57 | |||
58 | inline double __decodeVal(int ofset,unsigned char* data) |
|
58 | inline double __decodeVal(int ofset,unsigned char* data) | |
59 | { |
|
59 | { | |
60 | if(data[ofset]=='-') |
|
60 | if(data[ofset]=='-') | |
61 | return -0.001 * (double)( |
|
61 | return -0.001 * (double)( | |
62 | (10000 * (int)(data[ofset+1] & 0x0F)) |
|
62 | (10000 * (int)(data[ofset+1] & 0x0F)) | |
63 | + (1000 * (int)(data[ofset+2] & 0x0F)) |
|
63 | + (1000 * (int)(data[ofset+2] & 0x0F)) | |
64 | + (100 * (int)(data[ofset+4] & 0x0F)) |
|
64 | + (100 * (int)(data[ofset+4] & 0x0F)) | |
65 | + (10 * (int)(data[ofset+5] & 0x0F)) |
|
65 | + (10 * (int)(data[ofset+5] & 0x0F)) | |
66 | + ( (int)(data[ofset+6] & 0x0F)) |
|
66 | + ( (int)(data[ofset+6] & 0x0F)) | |
67 | ); |
|
67 | ); | |
68 | else |
|
68 | else | |
69 | { |
|
69 | { | |
70 | if(data[ofset+1]=='-') |
|
70 | if(data[ofset+1]=='-') | |
71 | { |
|
71 | { | |
72 | return -0.001 * (double)( |
|
72 | return -0.001 * (double)( | |
73 | (1000 * (int)(data[ofset+2] & 0x0F)) |
|
73 | (1000 * (int)(data[ofset+2] & 0x0F)) | |
74 | + (100 * (int)(data[ofset+4] & 0x0F)) |
|
74 | + (100 * (int)(data[ofset+4] & 0x0F)) | |
75 | + (10 * (int)(data[ofset+5] & 0x0F)) |
|
75 | + (10 * (int)(data[ofset+5] & 0x0F)) | |
76 | + ( (int)(data[ofset+6] & 0x0F)) |
|
76 | + ( (int)(data[ofset+6] & 0x0F)) | |
77 | ); |
|
77 | ); | |
78 | } |
|
78 | } | |
79 | else |
|
79 | else | |
80 | { |
|
80 | { | |
81 | return 0.001 * (double)( |
|
81 | return 0.001 * (double)( | |
82 | (10000 * (int)(data[ofset+1] & 0x0F)) |
|
82 | (10000 * (int)(data[ofset+1] & 0x0F)) | |
83 | + (1000 * (int)(data[ofset+2] & 0x0F)) |
|
83 | + (1000 * (int)(data[ofset+2] & 0x0F)) | |
84 | + (100 * (int)(data[ofset+4] & 0x0F)) |
|
84 | + (100 * (int)(data[ofset+4] & 0x0F)) | |
85 | + (10 * (int)(data[ofset+5] & 0x0F)) |
|
85 | + (10 * (int)(data[ofset+5] & 0x0F)) | |
86 | + ( (int)(data[ofset+6] & 0x0F)) |
|
86 | + ( (int)(data[ofset+6] & 0x0F)) | |
87 | ); |
|
87 | ); | |
88 | } |
|
88 | } | |
89 | } |
|
89 | } | |
90 | } |
|
90 | } | |
91 |
|
91 | |||
92 | inline QDate __decodeDate(int ofset,unsigned char* data) |
|
92 | inline QDate __decodeDate(int ofset,unsigned char* data) | |
93 | { |
|
93 | { | |
94 | int y=(1000*(data[ofset] & 0x0F)) + (100*(data[ofset+1] & 0x0F)) + (10*(data[ofset+2] & 0x0F)) + (1*(data[ofset+3] & 0x0F)); |
|
94 | int y=(1000*(data[ofset] & 0x0F)) + (100*(data[ofset+1] & 0x0F)) + (10*(data[ofset+2] & 0x0F)) + (1*(data[ofset+3] & 0x0F)); | |
95 | int m=(10*(data[ofset+5] & 0x0F)) + (1*(data[ofset+6] & 0x0F)); |
|
95 | int m=(10*(data[ofset+5] & 0x0F)) + (1*(data[ofset+6] & 0x0F)); | |
96 | int d=(10*(data[ofset+8] & 0x0F)) + (1*(data[ofset+9] & 0x0F)); |
|
96 | int d=(10*(data[ofset+8] & 0x0F)) + (1*(data[ofset+9] & 0x0F)); | |
97 | return QDate(y,m,d); |
|
97 | return QDate(y,m,d); | |
98 | } |
|
98 | } | |
99 |
|
99 | |||
100 | inline QTime __decodeTime(int ofset,unsigned char* data) |
|
100 | inline QTime __decodeTime(int ofset,unsigned char* data) | |
101 | { |
|
101 | { | |
102 | int h=(10*(data[ofset] & 0x0F)) + (1*(data[ofset+1] & 0x0F)); |
|
102 | int h=(10*(data[ofset] & 0x0F)) + (1*(data[ofset+1] & 0x0F)); | |
103 | int m=(10*(data[ofset+3] & 0x0F)) + (1*(data[ofset+4] & 0x0F)); |
|
103 | int m=(10*(data[ofset+3] & 0x0F)) + (1*(data[ofset+4] & 0x0F)); | |
104 | int s=(10*(data[ofset+6] & 0x0F)) + (1*(data[ofset+7] & 0x0F)); |
|
104 | int s=(10*(data[ofset+6] & 0x0F)) + (1*(data[ofset+7] & 0x0F)); | |
105 | int ms=(100*(data[ofset+9] & 0x0F)) + (10*(data[ofset+10] & 0x0F)) + (1*(data[ofset+11] & 0x0F)); |
|
105 | int ms=(100*(data[ofset+9] & 0x0F)) + (10*(data[ofset+10] & 0x0F)) + (1*(data[ofset+11] & 0x0F)); | |
106 | return QTime(h,m,s,ms); |
|
106 | return QTime(h,m,s,ms); | |
107 | } |
|
107 | } | |
108 |
|
108 | |||
109 | double __decodeTimeFromEpochMs(int ofset,unsigned char* data) |
|
109 | double __decodeTimeFromEpochMs(int ofset,unsigned char* data) | |
110 | { |
|
110 | { | |
111 | struct tm t; |
|
111 | struct tm t; | |
112 | time_t t_of_day; |
|
112 | time_t t_of_day; | |
113 | t.tm_year=(1000*(data[ofset] & 0x0F)) + (100*(data[ofset+1] & 0x0F)) + (10*(data[ofset+2] & 0x0F)) + ((data[ofset+3] & 0x0F)) -1900; |
|
113 | t.tm_year=(1000*(data[ofset] & 0x0F)) + (100*(data[ofset+1] & 0x0F)) + (10*(data[ofset+2] & 0x0F)) + ((data[ofset+3] & 0x0F)) -1900; | |
114 | t.tm_mon=(10*(data[ofset+5] & 0x0F)) + ((data[ofset+6] & 0x0F)); |
|
114 | t.tm_mon=(10*(data[ofset+5] & 0x0F)) + ((data[ofset+6] & 0x0F)); | |
115 | t.tm_mday=(10*(data[ofset+8] & 0x0F)) + ((data[ofset+9] & 0x0F)); |
|
115 | t.tm_mday=(10*(data[ofset+8] & 0x0F)) + ((data[ofset+9] & 0x0F)); | |
116 | t.tm_hour=(10*(data[ofset+11] & 0x0F)) + ((data[ofset+12] & 0x0F)); |
|
116 | t.tm_hour=(10*(data[ofset+11] & 0x0F)) + ((data[ofset+12] & 0x0F)); | |
117 | t.tm_min=(10*(data[ofset+14] & 0x0F)) + ((data[ofset+15] & 0x0F)); |
|
117 | t.tm_min=(10*(data[ofset+14] & 0x0F)) + ((data[ofset+15] & 0x0F)); | |
118 | t.tm_sec=(10*(data[ofset+17] & 0x0F)) + ((data[ofset+18] & 0x0F)); |
|
118 | t.tm_sec=(10*(data[ofset+17] & 0x0F)) + ((data[ofset+18] & 0x0F)); | |
119 | int ms=(100*(data[ofset+20] & 0x0F)) + (10*(data[ofset+21] & 0x0F)) + ((data[ofset+22] & 0x0F)); |
|
119 | int ms=(100*(data[ofset+20] & 0x0F)) + (10*(data[ofset+21] & 0x0F)) + ((data[ofset+22] & 0x0F)); | |
120 | t_of_day = mktime(&t); |
|
120 | t_of_day = mktime(&t); | |
121 | return (t_of_day*1000.0)+ms; |
|
121 | return (t_of_day*1000.0)+ms; | |
122 | } |
|
122 | } | |
123 |
|
123 | |||
124 | double __decodeTimeFromEpoch(int ofset,unsigned char* data) |
|
124 | double __decodeTimeFromEpoch(int ofset,unsigned char* data) | |
125 | { |
|
125 | { | |
126 | struct tm t; |
|
126 | struct tm t; | |
127 | time_t t_of_day; |
|
127 | time_t t_of_day; | |
128 | t.tm_year=(1000*(data[ofset] & 0x0F)) + (100*(data[ofset+1] & 0x0F)) + (10*(data[ofset+2] & 0x0F)) + ((data[ofset+3] & 0x0F)) -1900; |
|
128 | t.tm_year=(1000*(data[ofset] & 0x0F)) + (100*(data[ofset+1] & 0x0F)) + (10*(data[ofset+2] & 0x0F)) + ((data[ofset+3] & 0x0F)) -1900; | |
129 | t.tm_mon=(10*(data[ofset+5] & 0x0F)) + ((data[ofset+6] & 0x0F)); |
|
129 | t.tm_mon=(10*(data[ofset+5] & 0x0F)) + ((data[ofset+6] & 0x0F)); | |
130 | t.tm_mday=(10*(data[ofset+8] & 0x0F)) + ((data[ofset+9] & 0x0F)); |
|
130 | t.tm_mday=(10*(data[ofset+8] & 0x0F)) + ((data[ofset+9] & 0x0F)); | |
131 | t.tm_hour=(10*(data[ofset+11] & 0x0F)) + ((data[ofset+12] & 0x0F)); |
|
131 | t.tm_hour=(10*(data[ofset+11] & 0x0F)) + ((data[ofset+12] & 0x0F)); | |
132 | t.tm_min=(10*(data[ofset+14] & 0x0F)) + ((data[ofset+15] & 0x0F)); |
|
132 | t.tm_min=(10*(data[ofset+14] & 0x0F)) + ((data[ofset+15] & 0x0F)); | |
133 | t.tm_sec=(10*(data[ofset+17] & 0x0F)) + ((data[ofset+18] & 0x0F)); |
|
133 | t.tm_sec=(10*(data[ofset+17] & 0x0F)) + ((data[ofset+18] & 0x0F)); | |
134 | double ms=(100*(data[ofset+20] & 0x0F)) + (10*(data[ofset+21] & 0x0F)) + ((data[ofset+22] & 0x0F)); |
|
134 | double ms=(100*(data[ofset+20] & 0x0F)) + (10*(data[ofset+21] & 0x0F)) + ((data[ofset+22] & 0x0F)); | |
135 | t_of_day = mktime(&t); |
|
135 | t_of_day = mktime(&t); | |
136 | return (double)t_of_day+((double)ms*(double)0.001); |
|
136 | return (double)t_of_day+((double)ms*(double)0.001); | |
137 | } |
|
137 | } | |
138 |
|
138 | |||
139 | double __decodeTimeHMSmS(int ofset,unsigned char* data) |
|
139 | double __decodeTimeHMSmS(int ofset,unsigned char* data) | |
140 | { |
|
140 | { | |
141 | int h,m,s; |
|
141 | int h,m,s; | |
142 | h=(10*(data[ofset+11] & 0x0F)) + ((data[ofset+12] & 0x0F)); |
|
142 | h=(10*(data[ofset+11] & 0x0F)) + ((data[ofset+12] & 0x0F)); | |
143 | m=(10*(data[ofset+14] & 0x0F)) + ((data[ofset+15] & 0x0F)); |
|
143 | m=(10*(data[ofset+14] & 0x0F)) + ((data[ofset+15] & 0x0F)); | |
144 | s=(10*(data[ofset+17] & 0x0F)) + ((data[ofset+18] & 0x0F)); |
|
144 | s=(10*(data[ofset+17] & 0x0F)) + ((data[ofset+18] & 0x0F)); | |
145 | double ms=(100*(data[ofset+20] & 0x0F)) + (10*(data[ofset+21] & 0x0F)) + ((data[ofset+22] & 0x0F)); |
|
145 | double ms=(100*(data[ofset+20] & 0x0F)) + (10*(data[ofset+21] & 0x0F)) + ((data[ofset+22] & 0x0F)); | |
146 | return (double)((h*3600)+(m*60)+s) + (ms*0.001); |
|
146 | return (double)((h*3600)+(m*60)+s) + (ms*0.001); | |
147 | } |
|
147 | } | |
148 |
|
148 | |||
149 | double __decodeTimeDHMSmS(int ofset,unsigned char* data) |
|
149 | double __decodeTimeDHMSmS(int ofset,unsigned char* data) | |
150 | { |
|
150 | { | |
151 | int d,h,m,s; |
|
151 | int d,h,m,s; | |
152 | d=(10*(data[ofset+8] & 0x0F)) + ((data[ofset+9] & 0x0F)); |
|
152 | d=(10*(data[ofset+8] & 0x0F)) + ((data[ofset+9] & 0x0F)); | |
153 | h=(10*(data[ofset+11] & 0x0F)) + ((data[ofset+12] & 0x0F)); |
|
153 | h=(10*(data[ofset+11] & 0x0F)) + ((data[ofset+12] & 0x0F)); | |
154 | m=(10*(data[ofset+14] & 0x0F)) + ((data[ofset+15] & 0x0F)); |
|
154 | m=(10*(data[ofset+14] & 0x0F)) + ((data[ofset+15] & 0x0F)); | |
155 | s=(10*(data[ofset+17] & 0x0F)) + ((data[ofset+18] & 0x0F)); |
|
155 | s=(10*(data[ofset+17] & 0x0F)) + ((data[ofset+18] & 0x0F)); | |
156 | double ms=(100*(data[ofset+20] & 0x0F)) + (10*(data[ofset+21] & 0x0F)) + ((data[ofset+22] & 0x0F)); |
|
156 | double ms=(100*(data[ofset+20] & 0x0F)) + (10*(data[ofset+21] & 0x0F)) + ((data[ofset+22] & 0x0F)); | |
157 | return (double)((d*3600*24)+(h*3600)+(m*60)+s) + (ms*0.001); |
|
157 | return (double)((d*3600*24)+(h*3600)+(m*60)+s) + (ms*0.001); | |
158 | } |
|
158 | } | |
159 |
|
159 | |||
160 | double __decodeTimeFromEpochDayOnly(int ofset,unsigned char* data) |
|
160 | double __decodeTimeFromEpochDayOnly(int ofset,unsigned char* data) | |
161 | { |
|
161 | { | |
162 | struct tm t; |
|
162 | struct tm t; | |
163 | time_t t_of_day; |
|
163 | time_t t_of_day; | |
164 | // t.tm_year=(1000*(data[ofset] & 0x0F)) + (100*(data[ofset+1] & 0x0F)) + (10*(data[ofset+2] & 0x0F)) + ((data[ofset+3] & 0x0F)) -1900; |
|
164 | // t.tm_year=(1000*(data[ofset] & 0x0F)) + (100*(data[ofset+1] & 0x0F)) + (10*(data[ofset+2] & 0x0F)) + ((data[ofset+3] & 0x0F)) -1900; | |
165 | t.tm_year=(1000*(data[ofset] & 0x0F)) + (100*(data[ofset+1] & 0x0F)) + (10*(data[ofset+2] & 0x0F)) + ((data[ofset+3] & 0x0F)); |
|
165 | t.tm_year=(1000*(data[ofset] & 0x0F)) + (100*(data[ofset+1] & 0x0F)) + (10*(data[ofset+2] & 0x0F)) + ((data[ofset+3] & 0x0F)); | |
166 | t.tm_mon=(10*(data[ofset+5] & 0x0F)) + ((data[ofset+6] & 0x0F)); |
|
166 | t.tm_mon=(10*(data[ofset+5] & 0x0F)) + ((data[ofset+6] & 0x0F)); | |
167 | t.tm_mday=(10*(data[ofset+8] & 0x0F)) + ((data[ofset+9] & 0x0F)); |
|
167 | t.tm_mday=(10*(data[ofset+8] & 0x0F)) + ((data[ofset+9] & 0x0F)); | |
168 | t.tm_hour=0; |
|
168 | t.tm_hour=0; | |
169 | t.tm_min=0; |
|
169 | t.tm_min=0; | |
170 | t.tm_sec=0; |
|
170 | t.tm_sec=0; | |
171 | // t_of_day = mktime(&t); |
|
171 | // t_of_day = mktime(&t); | |
172 | // return (double)t_of_day; |
|
172 | // return (double)t_of_day; | |
173 | QDateTime date(QDate(t.tm_year,t.tm_mon,1),QTime(0,0)); |
|
173 | QDateTime date(QDate(t.tm_year,t.tm_mon,1),QTime(0,0)); | |
174 | // date.setDate(); |
|
174 | // date.setDate(); | |
175 | return (double)((date.toMSecsSinceEpoch()/1000.0)-(24*3600)); |
|
175 | return (double)((date.toMSecsSinceEpoch()/1000.0)-(24*3600)); | |
176 | } |
|
176 | } | |
177 |
|
177 | |||
178 | void CassiniDataFile::run() |
|
178 | void CassiniDataFile::run() | |
179 | { |
|
179 | { | |
180 | if(!m_Write) |
|
180 | if(!m_Write) | |
181 | { |
|
181 | { | |
182 | readFile(); |
|
182 | readFile(); | |
183 | } |
|
183 | } | |
184 | else |
|
184 | else | |
185 | { |
|
185 | { | |
186 | writeFile(); |
|
186 | writeFile(); | |
187 | } |
|
187 | } | |
188 | } |
|
188 | } | |
189 |
|
189 | |||
190 | void CassiniDataFile::readFile() |
|
190 | void CassiniDataFile::readFile() | |
191 | { |
|
191 | { | |
192 | FILE* dataFile; |
|
192 | FILE* dataFile; | |
193 | dataFile = fopen(fileName.toStdString().c_str(),"r"); |
|
193 | dataFile = fopen(fileName.toStdString().c_str(),"r"); | |
194 |
|
194 | |||
195 | if(dataFile != NULL) |
|
195 | if(dataFile != NULL) | |
196 | { |
|
196 | { | |
197 | fseek(dataFile, 0L, SEEK_END); |
|
197 | fseek(dataFile, 0L, SEEK_END); | |
198 | int FileSize=ftell(dataFile); |
|
198 | int FileSize=ftell(dataFile); | |
199 | int lineCnt = FileSize/58; |
|
199 | int lineCnt = FileSize/58; | |
200 | int curLine=0; |
|
200 | int curLine=0; | |
201 | int lastLineUpdate=0; |
|
201 | int lastLineUpdate=0; | |
202 | QVector<QCPData> *ch1=new QVector<QCPData>(lineCnt); |
|
202 | QVector<QCPData> *ch1=new QVector<QCPData>(lineCnt); | |
203 | QVector<QCPData> *ch2=new QVector<QCPData>(lineCnt); |
|
203 | QVector<QCPData> *ch2=new QVector<QCPData>(lineCnt); | |
204 | QVector<QCPData> *ch3=new QVector<QCPData>(lineCnt); |
|
204 | QVector<QCPData> *ch3=new QVector<QCPData>(lineCnt); | |
205 | QLopDataList data; |
|
205 | QLopDataList data; | |
206 | QLopQCPDataVector* ch1V=new QLopQCPDataVector(); |
|
206 | QLopQCPDataVector* ch1V=new QLopQCPDataVector(); | |
207 | QLopQCPDataVector* ch2V=new QLopQCPDataVector(); |
|
207 | QLopQCPDataVector* ch2V=new QLopQCPDataVector(); | |
208 | QLopQCPDataVector* ch3V=new QLopQCPDataVector(); |
|
208 | QLopQCPDataVector* ch3V=new QLopQCPDataVector(); | |
209 | ch1V->data=ch1; |
|
209 | ch1V->data=ch1; | |
210 | ch2V->data=ch2; |
|
210 | ch2V->data=ch2; | |
211 | ch3V->data=ch3; |
|
211 | ch3V->data=ch3; | |
212 | ch1V->name="r"; |
|
212 | ch1V->name="r"; | |
213 | ch2V->name="theta"; |
|
213 | ch2V->name="theta"; | |
214 | ch3V->name="phi"; |
|
214 | ch3V->name="phi"; | |
215 | ch1V->unit="nT"; |
|
215 | ch1V->unit="nT"; | |
216 | ch2V->unit="nT"; |
|
216 | ch2V->unit="nT"; | |
217 | ch3V->unit="nT"; |
|
217 | ch3V->unit="nT"; | |
|
218 | ch1V->source=fileName; | |||
|
219 | ch2V->source=fileName; | |||
|
220 | ch3V->source=fileName; | |||
218 | data.append(ch1V); |
|
221 | data.append(ch1V); | |
219 | data.append(ch2V); |
|
222 | data.append(ch2V); | |
220 | data.append(ch3V); |
|
223 | data.append(ch3V); | |
221 | QElapsedTimer timr; |
|
224 | QElapsedTimer timr; | |
222 |
|
225 | |||
223 | double _x=0.0,day=0.0; |
|
226 | double _x=0.0,day=0.0; | |
224 | char* line; |
|
227 | char* line; | |
225 | QCPData data1,data2,data3; |
|
228 | QCPData data1,data2,data3; | |
226 | char* fileContent=(char*)malloc(FileSize); |
|
229 | char* fileContent=(char*)malloc(FileSize); | |
227 | if(Q_UNLIKELY(fileContent==NULL))return; |
|
230 | if(Q_UNLIKELY(fileContent==NULL))return; | |
228 | int threadIndex,numThreads=omp_get_num_threads(); |
|
231 | int threadIndex,numThreads=omp_get_num_threads(); | |
229 | int updateTriger=(lineCnt/100)/numThreads; |
|
232 | int updateTriger=(lineCnt/100)/numThreads; | |
230 | fseek(dataFile, 0L, SEEK_SET); |
|
233 | fseek(dataFile, 0L, SEEK_SET); | |
231 | char* svglocale=NULL; |
|
234 | char* svglocale=NULL; | |
232 | setlocale(LC_NUMERIC,svglocale); |
|
235 | setlocale(LC_NUMERIC,svglocale); | |
233 | setlocale(LC_NUMERIC, "en_US"); |
|
236 | setlocale(LC_NUMERIC, "en_US"); | |
234 | if(fread(fileContent,1,FileSize,dataFile)) |
|
237 | if(fread(fileContent,1,FileSize,dataFile)) | |
235 | { |
|
238 | { | |
236 | line = fileContent; |
|
239 | line = fileContent; | |
237 | QDateTime date; |
|
240 | QDateTime date; | |
238 | timr.start(); |
|
241 | timr.start(); | |
239 | day=__decodeTimeFromEpochDayOnly(0,(unsigned char*)line); |
|
242 | day=__decodeTimeFromEpochDayOnly(0,(unsigned char*)line); | |
240 | //#pragma omp parallel if ((FileSize > 10000000)) private(date,data1,data2,data3,_x,threadIndex,lastLineUpdate) shared(ch1,ch2,ch3,lineCnt) |
|
243 | //#pragma omp parallel if ((FileSize > 10000000)) private(date,data1,data2,data3,_x,threadIndex,lastLineUpdate) shared(ch1,ch2,ch3,lineCnt) | |
241 | // { |
|
244 | // { | |
242 | #pragma omp parallel for if ((FileSize > 1024*1024*10)) private(date,data1,data2,data3,_x,threadIndex,lastLineUpdate,curLine) shared(ch1,ch2,ch3,lineCnt,updateTriger) |
|
245 | #pragma omp parallel for if ((FileSize > 1024*1024*10)) private(date,data1,data2,data3,_x,threadIndex,lastLineUpdate,curLine) shared(ch1,ch2,ch3,lineCnt,updateTriger) | |
243 | for(int i=0;i<lineCnt;i++) |
|
246 | for(int i=0;i<lineCnt;i++) | |
244 | { |
|
247 | { | |
245 | // _x= i; |
|
248 | // _x= i; | |
246 | _x= day + __decodeTimeDHMSmS((i*58),(unsigned char*)line); |
|
249 | _x= day + __decodeTimeDHMSmS((i*58),(unsigned char*)line); | |
247 | // _x=__decodeTimeFromEpoch((i*58),(unsigned char*)line); |
|
250 | // _x=__decodeTimeFromEpoch((i*58),(unsigned char*)line); | |
248 | data1.key=_x; |
|
251 | data1.key=_x; | |
249 | data2.key=_x; |
|
252 | data2.key=_x; | |
250 | data3.key=_x; |
|
253 | data3.key=_x; | |
251 | data1.value=__decodeVal(((i*58)+27),(unsigned char*)line); |
|
254 | data1.value=__decodeVal(((i*58)+27),(unsigned char*)line); | |
252 | data2.value=__decodeVal(((i*58)+38),(unsigned char*)line); |
|
255 | data2.value=__decodeVal(((i*58)+38),(unsigned char*)line); | |
253 | data3.value=__decodeVal(((i*58)+49),(unsigned char*)line); |
|
256 | data3.value=__decodeVal(((i*58)+49),(unsigned char*)line); | |
254 | (*ch1)[i]=data1; |
|
257 | (*ch1)[i]=data1; | |
255 | (*ch2)[i]=data2; |
|
258 | (*ch2)[i]=data2; | |
256 | (*ch3)[i]=data3; |
|
259 | (*ch3)[i]=data3; | |
257 | curLine++; |
|
260 | curLine++; | |
258 | if(Q_UNLIKELY(lastLineUpdate++>updateTriger)) |
|
261 | if(Q_UNLIKELY(lastLineUpdate++>updateTriger)) | |
259 | { |
|
262 | { | |
260 | lastLineUpdate=0; |
|
263 | lastLineUpdate=0; | |
261 | int test=((curLine*numThreads *100)/ (lineCnt)); |
|
264 | int test=((curLine*numThreads *100)/ (lineCnt)); | |
262 | emit updateProgress(omp_get_thread_num(),test); |
|
265 | emit updateProgress(omp_get_thread_num(),test); | |
263 | } |
|
266 | } | |
264 | } |
|
267 | } | |
265 | } |
|
268 | } | |
266 | //#pragma omp barrier |
|
269 | //#pragma omp barrier | |
267 | free(fileContent); |
|
270 | free(fileContent); | |
268 | // } |
|
271 | // } | |
269 | qDebug()<< lineCnt <<" Points loaded in "<< timr.elapsed()<<"ms"; |
|
272 | qDebug()<< lineCnt <<" Points loaded in "<< timr.elapsed()<<"ms"; | |
270 | setlocale(LC_NUMERIC,svglocale); |
|
273 | setlocale(LC_NUMERIC,svglocale); | |
271 | emit dataReady(data); |
|
274 | emit dataReady(data); | |
272 | } |
|
275 | } | |
273 | } |
|
276 | } | |
274 |
|
277 | |||
275 | void CassiniDataFile::writeFile() |
|
278 | void CassiniDataFile::writeFile() | |
276 | { |
|
279 | { | |
277 | QFile dataFile(fileName); |
|
280 | QFile dataFile(fileName); | |
278 | dataFile.open(QIODevice::WriteOnly); |
|
281 | dataFile.open(QIODevice::WriteOnly); | |
279 | QTextStream out(&dataFile); |
|
282 | QTextStream out(&dataFile); | |
280 | if(dataFile.isOpen()) |
|
283 | if(dataFile.isOpen()) | |
281 | { |
|
284 | { | |
282 | if(m_data.count()==3) |
|
285 | if(m_data.count()==3) | |
283 | { |
|
286 | { | |
284 | QLopQCPDataVector* ch1V=(QLopQCPDataVector*)m_data.at(0); |
|
287 | QLopQCPDataVector* ch1V=(QLopQCPDataVector*)m_data.at(0); | |
285 | QLopQCPDataVector* ch2V=(QLopQCPDataVector*)m_data.at(1); |
|
288 | QLopQCPDataVector* ch2V=(QLopQCPDataVector*)m_data.at(1); | |
286 | QLopQCPDataVector* ch3V=(QLopQCPDataVector*)m_data.at(2); |
|
289 | QLopQCPDataVector* ch3V=(QLopQCPDataVector*)m_data.at(2); | |
287 | if(ch1V->data->count()==ch2V->data->count() && ch1V->data->count()==ch3V->data->count()) |
|
290 | if(ch1V->data->count()==ch2V->data->count() && ch1V->data->count()==ch3V->data->count()) | |
288 | { |
|
291 | { | |
289 | for(int i=0;i<ch1V->data->count();i++) |
|
292 | for(int i=0;i<ch1V->data->count();i++) | |
290 | { |
|
293 | { | |
291 | double key = ch1V->data->at(i).key; |
|
294 | double key = ch1V->data->at(i).key; | |
292 | QDateTime date = QDateTime::fromMSecsSinceEpoch(key*1000); |
|
295 | QDateTime date = QDateTime::fromMSecsSinceEpoch(key*1000); | |
293 | out << date.toString(Qt::ISODate)+QString(".%1").arg(date.time().msec(),3); |
|
296 | out << date.toString(Qt::ISODate)+(QString(".%1").arg(date.time().msec(),3)).replace(" ","0"); | |
294 | out << QString("%1%2%3").arg(ch1V->data->at(i).value, 11, 'f', 3).arg(ch2V->data->at(i).value, 11, 'f', 3).arg(ch3V->data->at(i).value, 11, 'f', 3); |
|
297 | out << QString("%1%2%3").arg(ch1V->data->at(i).value, 11, 'f', 3).arg(ch2V->data->at(i).value, 11, 'f', 3).arg(ch3V->data->at(i).value, 11, 'f', 3); | |
295 | out << "\r\n"; |
|
298 | out << "\r\n"; | |
296 | } |
|
299 | } | |
297 | } |
|
300 | } | |
298 | dataFile.flush(); |
|
301 | dataFile.flush(); | |
299 | m_data.clear(); |
|
302 | m_data.clear(); | |
300 | delete ch1V; |
|
303 | delete ch1V; | |
301 | delete ch2V; |
|
304 | delete ch2V; | |
302 | delete ch3V; |
|
305 | delete ch3V; | |
|
306 | emit fileWritten(); | |||
303 | } |
|
307 | } | |
304 | } |
|
308 | } | |
305 | } |
|
309 | } | |
306 |
|
310 |
@@ -1,50 +1,51 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the QLop Software |
|
2 | -- This file is a part of the QLop Software | |
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef CASSINIDATAFILE_H |
|
22 | #ifndef CASSINIDATAFILE_H | |
23 | #define CASSINIDATAFILE_H |
|
23 | #define CASSINIDATAFILE_H | |
24 |
|
24 | |||
25 | #include <QObject> |
|
25 | #include <QObject> | |
26 | #include <QThread> |
|
26 | #include <QThread> | |
27 | #include <qcustomplot.h> |
|
27 | #include <qcustomplot.h> | |
28 | #include "abstractfileloader.h" |
|
28 | #include "abstractfileloader.h" | |
29 | class CassiniDataFile : public AbstractFileLoader |
|
29 | class CassiniDataFile : public AbstractFileLoader | |
30 | { |
|
30 | { | |
31 | Q_OBJECT |
|
31 | Q_OBJECT | |
32 | public: |
|
32 | public: | |
33 | explicit CassiniDataFile(QObject *parent = 0); |
|
33 | explicit CassiniDataFile(QObject *parent = 0); | |
34 | ~CassiniDataFile(); |
|
34 | ~CassiniDataFile(); | |
35 | void parseFile(const QString& fileName); |
|
35 | void parseFile(const QString& fileName); | |
36 | void saveFile(const QString& fileName,QLopDataList data); |
|
36 | void saveFile(const QString& fileName,QLopDataList data); | |
37 | void run(); |
|
37 | void run(); | |
38 | signals: |
|
38 | signals: | |
|
39 | void fileWritten(); | |||
39 | public slots: |
|
40 | public slots: | |
40 |
|
41 | |||
41 | private : |
|
42 | private : | |
42 | void readFile(); |
|
43 | void readFile(); | |
43 | void writeFile(); |
|
44 | void writeFile(); | |
44 | bool m_Write; |
|
45 | bool m_Write; | |
45 | QString fileName; |
|
46 | QString fileName; | |
46 | QLopDataList m_data; |
|
47 | QLopDataList m_data; | |
47 | }; |
|
48 | }; | |
48 |
|
49 | |||
49 |
|
50 | |||
50 | #endif // CASSINIDATAFILE_H |
|
51 | #endif // CASSINIDATAFILE_H |
@@ -1,322 +1,346 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the QLop Software |
|
2 | -- This file is a part of the QLop Software | |
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 |
|
22 | |||
23 | #include "cassinitools.h" |
|
23 | #include "cassinitools.h" | |
24 | #include <qlopplots.h> |
|
24 | #include <qlopplots.h> | |
25 | #include <QPen> |
|
25 | #include <QPen> | |
26 | #include <QAction> |
|
26 | #include <QAction> | |
27 | #include <fftw3.h> |
|
27 | #include <fftw3.h> | |
28 | #include <omp.h> |
|
28 | #include <omp.h> | |
|
29 | #include <qlopdatabase.h> | |||
29 |
|
30 | |||
30 | CassiniTools* CassiniTools::_self=NULL; |
|
31 | CassiniTools* CassiniTools::_self=NULL; | |
31 | QDockWidget* CassiniTools::m_gui=NULL; |
|
32 | QDockWidget* CassiniTools::m_gui=NULL; | |
32 | CassiniToolsGUI* CassiniTools::m_CassiniToolsGUI=NULL; |
|
33 | CassiniToolsGUI* CassiniTools::m_CassiniToolsGUI=NULL; | |
33 | CassiniDataFile* CassiniTools::m_dataFile=NULL; |
|
34 | CassiniDataFile* CassiniTools::m_dataFile=NULL; | |
34 | int CassiniTools::m_defaultPlot=-1; |
|
35 | int CassiniTools::m_defaultPlot=-1; | |
35 | int CassiniTools::m_fftPlot=-1; |
|
36 | int CassiniTools::m_fftPlot=-1; | |
36 | SocExplorerPlotActions* CassiniTools::ExportAction=NULL; |
|
37 | SocExplorerPlotActions* CassiniTools::ExportAction=NULL; | |
37 |
|
38 | |||
|
39 | ||||
38 | Qt::GlobalColor QLopColours[]= {Qt::black, |
|
40 | Qt::GlobalColor QLopColours[]= {Qt::black, | |
39 | Qt::red, |
|
41 | Qt::red, | |
40 | Qt::blue, |
|
42 | Qt::blue, | |
41 | Qt::green, |
|
43 | Qt::green, | |
42 | Qt::darkGreen, |
|
44 | Qt::darkGreen, | |
43 | Qt::cyan, |
|
45 | Qt::cyan, | |
44 | Qt::darkRed, |
|
46 | Qt::darkRed, | |
45 | Qt::gray, |
|
47 | Qt::gray, | |
46 | Qt::yellow, |
|
48 | Qt::yellow, | |
47 | Qt::darkBlue, |
|
49 | Qt::darkBlue, | |
48 | Qt::darkCyan, |
|
50 | Qt::darkCyan, | |
49 | Qt::magenta, |
|
51 | Qt::magenta, | |
50 | Qt::darkMagenta, |
|
52 | Qt::darkMagenta, | |
51 | Qt::darkYellow, |
|
53 | Qt::darkYellow, | |
52 | Qt::darkGray, |
|
54 | Qt::darkGray, | |
53 | Qt::lightGray}; |
|
55 | Qt::lightGray}; | |
54 |
|
56 | |||
55 | int QLopColoursCount=16; |
|
57 | int QLopColoursCount=16; | |
56 |
|
58 | |||
57 | #define _INIT() if(Q_UNLIKELY(_self==NULL)){init();} |
|
59 | #define _INIT() if(Q_UNLIKELY(_self==NULL)){init();} | |
58 |
|
60 | |||
59 | CassiniTools::CassiniTools(bool noGUI,QObject *parent) : QLopService(parent) |
|
61 | CassiniTools::CassiniTools(bool noGUI,QObject *parent) : QLopService(parent) | |
60 | { |
|
62 | { | |
61 | m_dataFile = new CassiniDataFile(); |
|
63 | m_dataFile = new CassiniDataFile(); | |
62 | connect(m_dataFile,SIGNAL(dataReady(QLopDataList)),this,SLOT(dataReady(QLopDataList))); |
|
64 | connect(m_dataFile,SIGNAL(dataReady(QLopDataList)),this,SLOT(dataReady(QLopDataList))); | |
|
65 | connect(m_dataFile,SIGNAL(fileWritten()),this,SLOT(fileWritten())); | |||
63 | m_serviceName="CassiniTools"; |
|
66 | m_serviceName="CassiniTools"; | |
64 | m_noGui=noGUI; |
|
67 | m_noGui=noGUI; | |
65 | fftw_init_threads(); |
|
68 | fftw_init_threads(); | |
66 | } |
|
69 | } | |
67 |
|
70 | |||
68 | CassiniTools::~CassiniTools() |
|
71 | CassiniTools::~CassiniTools() | |
69 | { |
|
72 | { | |
70 | delete m_dataFile; |
|
73 | delete m_dataFile; | |
71 | delete m_CassiniToolsGUI; |
|
74 | delete m_CassiniToolsGUI; | |
72 | delete m_gui; |
|
75 | delete m_gui; | |
73 | } |
|
76 | } | |
74 |
|
77 | |||
75 | void CassiniTools::makePlot() |
|
78 | void CassiniTools::makePlot() | |
76 | { |
|
79 | { | |
77 | m_defaultPlot = QLopPlots::addPlot(); |
|
80 | m_defaultPlot = QLopPlots::addPlot(); | |
78 | m_fftPlot = QLopPlots::addPlot(); |
|
81 | m_fftPlot = QLopPlots::addPlot(); | |
79 | SocExplorerPlot* plot=QLopPlots::getPlot(m_defaultPlot); |
|
82 | SocExplorerPlot* plot=QLopPlots::getPlot(m_defaultPlot); | |
80 | if(plot) |
|
83 | if(plot) | |
81 | { |
|
84 | { | |
82 | plot->setTitle(_self->m_serviceName + " plot"); |
|
85 | plot->setTitle(_self->m_serviceName + " plot"); | |
83 | plot->setXaxisTickLabelType(QCPAxis::ltDateTime); |
|
86 | plot->setXaxisTickLabelType(QCPAxis::ltDateTime); | |
84 | plot->setXaxisDateTimeFormat("hh:mm:ss.zzz"); |
|
87 | plot->setXaxisDateTimeFormat("hh:mm:ss.zzz"); | |
85 | plot->setContextMenuPolicy(Qt::ActionsContextMenu); |
|
88 | plot->setContextMenuPolicy(Qt::ActionsContextMenu); | |
86 | SocExplorerPlotActions* action=new SocExplorerPlotActions("export view",plot->PID(),_self); |
|
89 | SocExplorerPlotActions* action=new SocExplorerPlotActions("export view",plot->PID(),_self); | |
87 | plot->addAction(action); |
|
90 | plot->addAction(action); | |
88 | QObject::connect(action,SIGNAL(triggered(int)),_self,SLOT(export_view(int))); |
|
91 | QObject::connect(action,SIGNAL(triggered(int)),_self,SLOT(export_view(int))); | |
89 | QString fileName = QString(plot->title()).replace(".TAB",""); |
|
92 | QString fileName = QString(plot->title()).replace(".TAB",""); | |
90 | fileName = generateFileName(fileName,".TAB"); |
|
93 | fileName = generateFileName(fileName,".TAB"); | |
91 | ExportAction=new SocExplorerPlotActions("export view to "+fileName,plot->PID(),_self); |
|
94 | ExportAction=new SocExplorerPlotActions("export view to "+fileName,plot->PID(),_self); | |
92 | plot->addAction(ExportAction); |
|
95 | plot->addAction(ExportAction); | |
93 | QObject::connect(ExportAction,SIGNAL(triggered(int)),_self,SLOT(export_view_Predefined_FileName(int))); |
|
96 | QObject::connect(ExportAction,SIGNAL(triggered(int)),_self,SLOT(export_view_Predefined_FileName(int))); | |
94 | action=new SocExplorerPlotActions("FFT of the current view",plot->PID(),_self); |
|
97 | action=new SocExplorerPlotActions("FFT of the current view",plot->PID(),_self); | |
95 | plot->addAction(action); |
|
98 | plot->addAction(action); | |
96 | QObject::connect(action,SIGNAL(triggered(int)),_self,SLOT(compute_fft_on_view(int))); |
|
99 | QObject::connect(action,SIGNAL(triggered(int)),_self,SLOT(compute_fft_on_view(int))); | |
97 | } |
|
100 | } | |
98 | } |
|
101 | } | |
99 |
|
102 | |||
100 | void CassiniTools::init(bool noGUI, QObject *parent) |
|
103 | void CassiniTools::init(bool noGUI, QObject *parent) | |
101 | { |
|
104 | { | |
102 | if(Q_UNLIKELY(_self==NULL)) |
|
105 | if(Q_UNLIKELY(_self==NULL)) | |
103 | { |
|
106 | { | |
104 | _self=new CassiniTools(noGUI,parent); |
|
107 | _self=new CassiniTools(noGUI,parent); | |
105 | } |
|
108 | } | |
106 | } |
|
109 | } | |
107 |
|
110 | |||
108 | CassiniTools *CassiniTools::self() |
|
111 | CassiniTools *CassiniTools::self() | |
109 | { |
|
112 | { | |
110 | _INIT(); |
|
113 | _INIT(); | |
111 | return _self; |
|
114 | return _self; | |
112 | } |
|
115 | } | |
113 |
|
116 | |||
114 | void CassiniTools::decodeFGMData(const QString &file) |
|
117 | void CassiniTools::decodeFGMData(const QString &file) | |
115 | { |
|
118 | { | |
116 | _INIT(); |
|
119 | _INIT(); | |
117 | m_dataFile->parseFile(file); |
|
120 | m_dataFile->parseFile(file); | |
118 | } |
|
121 | } | |
119 |
|
122 | |||
120 | void CassiniTools::plotFile(const QString &File) |
|
123 | void CassiniTools::plotFile(const QString &File) | |
121 | { |
|
124 | { | |
122 | if(!m_dataFile->isRunning()) |
|
125 | if(!m_dataFile->isRunning()) | |
123 | { |
|
126 | { | |
124 | m_dataFile->parseFile(File); |
|
127 | m_dataFile->parseFile(File); | |
125 | // TODO fixme |
|
128 | // TODO fixme | |
126 | SocExplorerPlot* plot = QLopPlots::getPlot(m_defaultPlot); |
|
129 | SocExplorerPlot* plot = QLopPlots::getPlot(m_defaultPlot); | |
127 | if(plot==NULL) |
|
130 | if(plot==NULL) | |
128 | { |
|
131 | { | |
129 | makePlot(); |
|
132 | makePlot(); | |
130 | plot = QLopPlots::getPlot(m_defaultPlot); |
|
133 | plot = QLopPlots::getPlot(m_defaultPlot); | |
131 | } |
|
134 | } | |
132 | if(plot) |
|
135 | if(plot) | |
133 | { |
|
136 | { | |
134 | plot->setTitle(File); |
|
137 | plot->setTitle(File); | |
135 | QString fileName = QString(File).replace(".TAB","-part"); |
|
138 | QString fileName = QString(File).replace(".TAB","-part"); | |
136 | fileName = generateFileName(fileName,".TAB"); |
|
139 | fileName = generateFileName(fileName,".TAB"); | |
137 | ExportAction->setText("export view to "+fileName); |
|
140 | ExportAction->setText("export view to "+fileName); | |
138 | } |
|
141 | } | |
139 | } |
|
142 | } | |
140 | } |
|
143 | } | |
141 |
|
144 | |||
142 | void CassiniTools::plot_TAB_File(const QString &fileName) |
|
145 | void CassiniTools::plot_TAB_File(const QString &fileName) | |
143 | { |
|
146 | { | |
144 | //TODO fix: accent not accepted |
|
147 | //TODO fix: accent not accepted | |
145 | plotFile(fileName); |
|
148 | plotFile(fileName); | |
146 | } |
|
149 | } | |
147 |
|
150 | |||
148 | void CassiniTools::export_view(int PID) |
|
151 | void CassiniTools::export_view(int PID) | |
149 | { |
|
152 | { | |
150 | SocExplorerPlot* plot = QLopPlots::getPlot(PID); |
|
153 | SocExplorerPlot* plot = QLopPlots::getPlot(PID); | |
151 | if(plot==NULL) |
|
154 | if(plot==NULL) | |
152 | return; |
|
155 | return; | |
153 | { |
|
156 | { | |
154 | QString fileName = plot->title(); |
|
157 | QString fileName = plot->title(); | |
155 | fileName = QFileDialog::getSaveFileName(0,tr("Set filename"),fileName.replace(".TAB","-part.TAB")); |
|
158 | fileName = QFileDialog::getSaveFileName(0,tr("Set filename"),fileName.replace(".TAB","-part.TAB")); | |
156 | if(fileName!="") |
|
159 | if(fileName!="") | |
157 | { |
|
160 | { | |
158 | QLopDataList vectors; |
|
161 | QLopDataList vectors; | |
159 | for(int i=0;i<plot->graphCount();i++) |
|
162 | for(int i=0;i<plot->graphCount();i++) | |
160 | { |
|
163 | { | |
161 | QLopQCPDataVector* vect = new QLopQCPDataVector(); |
|
164 | QLopQCPDataVector* vect = new QLopQCPDataVector(); | |
162 | vect->data = plot->getVisibleData(i); |
|
165 | vect->data = plot->getVisibleData(i); | |
163 | vectors.append(vect); |
|
166 | vectors.append(vect); | |
164 | } |
|
167 | } | |
165 | m_dataFile->saveFile(fileName,vectors); |
|
168 | m_dataFile->saveFile(fileName,vectors); | |
166 | } |
|
169 | } | |
167 | } |
|
170 | } | |
168 | } |
|
171 | } | |
169 |
|
172 | |||
170 | void CassiniTools::export_view_Predefined_FileName(int PID) |
|
173 | void CassiniTools::export_view_Predefined_FileName(int PID) | |
171 | { |
|
174 | { | |
172 | SocExplorerPlot* plot = QLopPlots::getPlot(PID); |
|
175 | SocExplorerPlot* plot = QLopPlots::getPlot(PID); | |
173 | if(plot==NULL) |
|
176 | if(plot==NULL) | |
174 | return; |
|
177 | return; | |
175 | { |
|
178 | { | |
176 | QString fileName = QString(plot->title()).replace(".TAB","-part"); |
|
179 | QString fileName = QString(plot->title()).replace(".TAB","-part"); | |
177 | fileName = generateFileName(fileName,".TAB"); |
|
180 | fileName = generateFileName(fileName,".TAB"); | |
178 | if(fileName!="") |
|
181 | if(fileName!="") | |
179 | { |
|
182 | { | |
180 | QLopDataList vectors; |
|
183 | QLopDataList vectors; | |
181 | for(int i=0;i<plot->graphCount();i++) |
|
184 | for(int i=0;i<plot->graphCount();i++) | |
182 | { |
|
185 | { | |
183 | QLopQCPDataVector* vect = new QLopQCPDataVector(); |
|
186 | QLopQCPDataVector* vect = new QLopQCPDataVector(); | |
184 | vect->data = plot->getVisibleData(i); |
|
187 | vect->data = plot->getVisibleData(i); | |
185 | vectors.append(vect); |
|
188 | vectors.append(vect); | |
186 | } |
|
189 | } | |
187 | m_dataFile->saveFile(fileName,vectors); |
|
190 | m_dataFile->saveFile(fileName,vectors); | |
188 | } |
|
191 | } | |
189 | } |
|
192 | } | |
190 | } |
|
193 | } | |
191 |
|
194 | |||
192 | void CassiniTools::compute_fft_on_view(int PID) |
|
195 | void CassiniTools::compute_fft_on_view(int PID) | |
193 | { |
|
196 | { | |
194 |
|
197 | |||
195 | QElapsedTimer timr; |
|
198 | QElapsedTimer timr; | |
196 | SocExplorerPlot* plot = QLopPlots::getPlot(PID); |
|
199 | SocExplorerPlot* plot = QLopPlots::getPlot(PID); | |
197 | if(plot==NULL) |
|
200 | if(plot==NULL) | |
198 | return; |
|
201 | return; | |
199 | { |
|
202 | { | |
200 | timr.start(); |
|
203 | timr.start(); | |
201 | QLopDataList vectors; |
|
204 | QLopDataList vectors; | |
202 | for(int i=0;i<plot->graphCount();i++) |
|
205 | for(int i=0;i<plot->graphCount();i++) | |
203 | { |
|
206 | { | |
204 | QLopQCPDataVector* vect = new QLopQCPDataVector(); |
|
207 | QLopQCPDataVector* vect = new QLopQCPDataVector(); | |
205 | vect->data = plot->getVisibleData(i); |
|
208 | vect->data = plot->getVisibleData(i); | |
206 | vectors.append(vect); |
|
209 | vectors.append(vect); | |
207 | } |
|
210 | } | |
208 | if(vectors.count()==3) |
|
211 | if(vectors.count()==3) | |
209 | { |
|
212 | { | |
210 | QLopQCPDataVector* ch1V=(QLopQCPDataVector*)vectors.at(0); |
|
213 | QLopQCPDataVector* ch1V=(QLopQCPDataVector*)vectors.at(0); | |
211 | QLopQCPDataVector* ch2V=(QLopQCPDataVector*)vectors.at(1); |
|
214 | QLopQCPDataVector* ch2V=(QLopQCPDataVector*)vectors.at(1); | |
212 | QLopQCPDataVector* ch3V=(QLopQCPDataVector*)vectors.at(2); |
|
215 | QLopQCPDataVector* ch3V=(QLopQCPDataVector*)vectors.at(2); | |
213 | QLopQCPDataVector* FFTout=new QLopQCPDataVector(); |
|
216 | QLopQCPDataVector* FFTout=new QLopQCPDataVector(); | |
214 | if(ch1V->data->count()==ch2V->data->count() && ch1V->data->count()==ch3V->data->count()) |
|
217 | if(ch1V->data->count()==ch2V->data->count() && ch1V->data->count()==ch3V->data->count()) | |
215 | { |
|
218 | { | |
216 |
|
219 | |||
217 | double* in; |
|
220 | double* in; | |
218 | fftw_complex *out; |
|
221 | fftw_complex *out; | |
219 | fftw_plan p; |
|
222 | fftw_plan p; | |
220 | FFTout->data = new QVector<QCPData>(ch1V->data->count()/2); |
|
223 | FFTout->data = new QVector<QCPData>(ch1V->data->count()/2); | |
221 | in = (double*) fftw_malloc(sizeof(double) * ch1V->data->count()); |
|
224 | in = (double*) fftw_malloc(sizeof(double) * ch1V->data->count()); | |
222 | out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * ch1V->data->count()); |
|
225 | out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * ch1V->data->count()); | |
223 | double av=0; |
|
226 | double av=0; | |
224 | for(int i=0;i<ch1V->data->count();i++) |
|
227 | for(int i=0;i<ch1V->data->count();i++) | |
225 | { |
|
228 | { | |
226 | in[i]=sqrt((ch1V->data->at(i).value*ch1V->data->at(i).value) + (ch2V->data->at(i).value*ch2V->data->at(i).value) + (ch3V->data->at(i).value*ch3V->data->at(i).value)); |
|
229 | in[i]=sqrt((ch1V->data->at(i).value*ch1V->data->at(i).value) + (ch2V->data->at(i).value*ch2V->data->at(i).value) + (ch3V->data->at(i).value*ch3V->data->at(i).value)); | |
227 | av = av+in[i]; |
|
230 | av = av+in[i]; | |
228 | } |
|
231 | } | |
229 | av/=ch1V->data->count(); |
|
232 | av/=ch1V->data->count(); | |
230 | for(int i=0;i<ch1V->data->count();i++) |
|
233 | for(int i=0;i<ch1V->data->count();i++) | |
231 | { |
|
234 | { | |
232 | in[i]=in[i]-av; |
|
235 | in[i]=in[i]-av; | |
233 | } |
|
236 | } | |
234 | fftw_plan_with_nthreads(4); |
|
237 | fftw_plan_with_nthreads(4); | |
235 | p = fftw_plan_dft_r2c_1d(ch1V->data->count(),in, out,FFTW_ESTIMATE); |
|
238 | p = fftw_plan_dft_r2c_1d(ch1V->data->count(),in, out,FFTW_ESTIMATE); | |
236 | fftw_execute(p); /* repeat as needed */ |
|
239 | fftw_execute(p); /* repeat as needed */ | |
237 | fftw_destroy_plan(p); |
|
240 | fftw_destroy_plan(p); | |
238 | fftw_free(in); |
|
241 | fftw_free(in); | |
239 | for(int i=0;i<ch1V->data->count()/2;i++) |
|
242 | for(int i=0;i<ch1V->data->count()/2;i++) | |
240 | { |
|
243 | { | |
241 | // (*FFTout->data)[i].value=sqrt((out[i][0] * out[i][0]) + (out[i][1] * out[i][1]))/ch1V->data->count(); |
|
244 | // (*FFTout->data)[i].value=sqrt((out[i][0] * out[i][0]) + (out[i][1] * out[i][1]))/ch1V->data->count(); | |
242 | (*FFTout->data)[i].value=((out[i][0] * out[i][0]) + (out[i][1] * out[i][1]))/(ch1V->data->count()); |
|
245 | (*FFTout->data)[i].value=((out[i][0] * out[i][0]) + (out[i][1] * out[i][1]))/(ch1V->data->count()); | |
243 | (*FFTout->data)[i].key = i; |
|
246 | (*FFTout->data)[i].key = i; | |
244 | } |
|
247 | } | |
245 | fftw_free(out); |
|
248 | fftw_free(out); | |
246 | SocExplorerPlot* plot = QLopPlots::getPlot(m_fftPlot); |
|
249 | SocExplorerPlot* plot = QLopPlots::getPlot(m_fftPlot); | |
247 | if(plot==NULL) |
|
250 | if(plot==NULL) | |
248 | return; |
|
251 | return; | |
249 | plot->removeAllGraphs(); |
|
252 | plot->removeAllGraphs(); | |
250 | plot->addGraph(); |
|
253 | plot->addGraph(); | |
251 | plot->setXaxisLog(); |
|
254 | plot->setXaxisLog(); | |
252 | plot->setYaxisLog(); |
|
255 | plot->setYaxisLog(); | |
253 | plot->setAdaptativeSampling(0,true); |
|
256 | plot->setAdaptativeSampling(0,true); | |
254 | QPen pen = plot->getGraphPen(0); |
|
257 | QPen pen = plot->getGraphPen(0); | |
255 | pen.setColor(QLopColours[0%QLopColoursCount]); |
|
258 | pen.setColor(QLopColours[0%QLopColoursCount]); | |
256 | plot->setGraphPen(0,pen); |
|
259 | plot->setGraphPen(0,pen); | |
257 | plot->setGraphData(0,FFTout->data,false); |
|
260 | plot->setGraphData(0,FFTout->data,false); | |
258 | plot->rescaleAxis(); |
|
261 | plot->rescaleAxis(); | |
259 | plot->replot(); |
|
262 | plot->replot(); | |
260 |
|
263 | |||
261 | qDebug()<< ch1V->data->count() <<" Points loaded in "<< timr.elapsed()<<"ms"; |
|
264 | qDebug()<< ch1V->data->count() <<" Points loaded in "<< timr.elapsed()<<"ms"; | |
262 | } |
|
265 | } | |
263 | } |
|
266 | } | |
264 | } |
|
267 | } | |
265 | } |
|
268 | } | |
266 |
|
269 | |||
267 | QString CassiniTools::generateFileName(const QString &baseName, const QString &extension) |
|
270 | QString CassiniTools::generateFileName(const QString &baseName, const QString &extension) | |
268 | { |
|
271 | { | |
269 | QString fileName = baseName+extension; |
|
272 | QString fileName = baseName+extension; | |
270 | int i=0; |
|
273 | int i=0; | |
271 | while(QFile::exists(fileName)) |
|
274 | while(QFile::exists(fileName)) | |
272 | { |
|
275 | { | |
273 | fileName = baseName+QString::number(i++)+extension; |
|
276 | fileName = baseName+QString::number(i++)+extension; | |
274 | } |
|
277 | } | |
275 | return fileName; |
|
278 | return fileName; | |
276 | } |
|
279 | } | |
277 |
|
280 | |||
278 | QDockWidget *CassiniTools::getGUI() |
|
281 | QDockWidget *CassiniTools::getGUI() | |
279 | { |
|
282 | { | |
280 | if(!m_noGui && (m_gui==NULL)) |
|
283 | if(!m_noGui && (m_gui==NULL)) | |
281 | { |
|
284 | { | |
282 | m_gui=new QDockWidget("Cassini Tools"); |
|
285 | m_gui=new QDockWidget("Cassini Tools"); | |
283 | m_CassiniToolsGUI = new CassiniToolsGUI(); |
|
286 | m_CassiniToolsGUI = new CassiniToolsGUI(); | |
284 | m_gui->setWidget(m_CassiniToolsGUI); |
|
287 | m_gui->setWidget(m_CassiniToolsGUI); | |
285 | m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); |
|
288 | m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); | |
286 | } |
|
289 | } | |
287 | return m_gui; |
|
290 | return m_gui; | |
288 | } |
|
291 | } | |
289 |
|
292 | |||
290 | const QString &CassiniTools::serviceName() |
|
293 | const QString &CassiniTools::serviceName() | |
291 | { |
|
294 | { | |
292 | _INIT(); |
|
295 | _INIT(); | |
293 | return m_serviceName; |
|
296 | return m_serviceName; | |
294 | } |
|
297 | } | |
295 |
|
298 | |||
296 | void CassiniTools::dataReady(QLopDataList data) |
|
299 | void CassiniTools::dataReady(QLopDataList data) | |
297 | { |
|
300 | { | |
|
301 | static QLopDataList prevData=QLopDataList(); | |||
298 | SocExplorerPlot* plot = QLopPlots::getPlot(m_defaultPlot); |
|
302 | SocExplorerPlot* plot = QLopPlots::getPlot(m_defaultPlot); | |
299 | if(plot==NULL) |
|
303 | if(plot==NULL) | |
300 | { |
|
304 | { | |
301 | makePlot(); |
|
305 | makePlot(); | |
302 | plot = QLopPlots::getPlot(m_defaultPlot); |
|
306 | plot = QLopPlots::getPlot(m_defaultPlot); | |
303 | } |
|
307 | } | |
304 | if(plot) |
|
308 | if(plot) | |
305 | { |
|
309 | { | |
|
310 | QLopDataBase::removeData(prevData); | |||
306 | plot->removeAllGraphs(); |
|
311 | plot->removeAllGraphs(); | |
|
312 | // QLopDataBase::re | |||
307 | for(int i=0;i<data.count();i++) |
|
313 | for(int i=0;i<data.count();i++) | |
308 | { |
|
314 | { | |
309 | plot->addGraph(); |
|
315 | plot->addGraph(); | |
310 | plot->setAdaptativeSampling(i,true); |
|
316 | plot->setAdaptativeSampling(i,true); | |
311 | plot->setUseFastVector(i,true); |
|
317 | plot->setUseFastVector(i,true); | |
312 | QPen pen = plot->getGraphPen(i); |
|
318 | QPen pen = plot->getGraphPen(i); | |
313 | pen.setColor(QLopColours[i%QLopColoursCount]); |
|
319 | pen.setColor(QLopColours[i%QLopColoursCount]); | |
314 | plot->setGraphPen(i,pen); |
|
320 | plot->setGraphPen(i,pen); | |
315 | plot->setGraphName(i,data.at(i)->name+"("+data.at(i)->unit+")"); |
|
321 | plot->setGraphName(i,data.at(i)->name+"("+data.at(i)->unit+")"); | |
316 | plot->setGraphData(i,((QLopQCPDataVector*)data.at(i))->data,false); |
|
322 | plot->setGraphData(i,((QLopQCPDataVector*)data.at(i))->data,false); | |
317 | } |
|
323 | } | |
318 | plot->rescaleAxis(); |
|
324 | plot->rescaleAxis(); | |
319 | plot->replot(); |
|
325 | plot->replot(); | |
|
326 | prevData = data; | |||
|
327 | QLopDataBase::addData(data); | |||
320 | } |
|
328 | } | |
321 | } |
|
329 | } | |
322 |
|
330 | |||
|
331 | void CassiniTools::fileWritten() | |||
|
332 | { | |||
|
333 | SocExplorerPlot* plot = QLopPlots::getPlot(m_defaultPlot); | |||
|
334 | if(plot==NULL) | |||
|
335 | { | |||
|
336 | makePlot(); | |||
|
337 | plot = QLopPlots::getPlot(m_defaultPlot); | |||
|
338 | } | |||
|
339 | if(plot) | |||
|
340 | { | |||
|
341 | QString fileName = QString(plot->title()).replace(".TAB","-part"); | |||
|
342 | fileName = generateFileName(fileName,".TAB"); | |||
|
343 | ExportAction->setText("export view to "+fileName); | |||
|
344 | } | |||
|
345 | } | |||
|
346 |
@@ -1,65 +1,66 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the QLop Software |
|
2 | -- This file is a part of the QLop Software | |
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #ifndef CASSINITOOLS_H |
|
22 | #ifndef CASSINITOOLS_H | |
23 | #define CASSINITOOLS_H |
|
23 | #define CASSINITOOLS_H | |
24 |
|
24 | |||
25 | #include <QObject> |
|
25 | #include <QObject> | |
26 | #include <QWidget> |
|
26 | #include <QWidget> | |
27 | #include <qlopservice.h> |
|
27 | #include <qlopservice.h> | |
28 | #include <cassinitoolsgui.h> |
|
28 | #include <cassinitoolsgui.h> | |
29 | #include <cassinidatafile.h> |
|
29 | #include <cassinidatafile.h> | |
30 | #include <qlopdata.h> |
|
30 | #include <qlopdata.h> | |
31 | #include <SocExplorerPlot.h> |
|
31 | #include <SocExplorerPlot.h> | |
32 |
|
32 | |||
33 | class CassiniTools: public QLopService |
|
33 | class CassiniTools: public QLopService | |
34 | { |
|
34 | { | |
35 | Q_OBJECT |
|
35 | Q_OBJECT | |
36 | private: |
|
36 | private: | |
37 | static CassiniTools* _self; |
|
37 | static CassiniTools* _self; | |
38 | static QDockWidget* m_gui; |
|
38 | static QDockWidget* m_gui; | |
39 | static CassiniToolsGUI* m_CassiniToolsGUI; |
|
39 | static CassiniToolsGUI* m_CassiniToolsGUI; | |
40 | static CassiniDataFile* m_dataFile; |
|
40 | static CassiniDataFile* m_dataFile; | |
41 | static int m_defaultPlot,m_fftPlot; |
|
41 | static int m_defaultPlot,m_fftPlot; | |
42 | static SocExplorerPlotActions* ExportAction; |
|
42 | static SocExplorerPlotActions* ExportAction; | |
43 | CassiniTools(bool noGUI=false, QObject *parent=0); |
|
43 | CassiniTools(bool noGUI=false, QObject *parent=0); | |
44 | ~CassiniTools(); |
|
44 | ~CassiniTools(); | |
45 | static void makePlot(); |
|
45 | static void makePlot(); | |
46 | public: |
|
46 | public: | |
47 | static void init(bool noGUI=false,QObject *parent = 0); |
|
47 | static void init(bool noGUI=false,QObject *parent = 0); | |
48 | static CassiniTools *self(); |
|
48 | static CassiniTools *self(); | |
49 | static void decodeFGMData(const QString& file); |
|
49 | static void decodeFGMData(const QString& file); | |
50 | // QLopService methodes |
|
50 | // QLopService methodes | |
51 | QDockWidget* getGUI(); |
|
51 | QDockWidget* getGUI(); | |
52 | const QString& serviceName(); |
|
52 | const QString& serviceName(); | |
53 | static void plotFile(const QString &File); |
|
53 | static void plotFile(const QString &File); | |
54 | public slots: |
|
54 | public slots: | |
55 | void plot_TAB_File(const QString& fileName); |
|
55 | void plot_TAB_File(const QString& fileName); | |
56 | void export_view(int PID); |
|
56 | void export_view(int PID); | |
57 | void export_view_Predefined_FileName(int PID); |
|
57 | void export_view_Predefined_FileName(int PID); | |
58 | void compute_fft_on_view(int PID); |
|
58 | void compute_fft_on_view(int PID); | |
59 | private slots: |
|
59 | private slots: | |
60 | static QString generateFileName(const QString& baseName,const QString& extension); |
|
60 | static QString generateFileName(const QString& baseName,const QString& extension); | |
61 | void dataReady(QLopDataList data); |
|
61 | void dataReady(QLopDataList data); | |
|
62 | void fileWritten(); | |||
62 | }; |
|
63 | }; | |
63 |
|
64 | |||
64 | #endif // CASSINITOOLS_H |
|
65 | #endif // CASSINITOOLS_H | |
65 |
|
66 |
@@ -1,29 +1,31 | |||||
1 | #include "qlopdatabaseviewer.h" |
|
1 | #include "qlopdatabaseviewer.h" | |
2 | #include "ui_qlopdatabaseviewer.h" |
|
2 | #include "ui_qlopdatabaseviewer.h" | |
3 |
|
3 | |||
4 | QLopDataBaseViewer::QLopDataBaseViewer(QWidget *parent) : |
|
4 | QLopDataBaseViewer::QLopDataBaseViewer(QWidget *parent) : | |
5 | QDockWidget(parent), |
|
5 | QDockWidget(parent), | |
6 | ui(new Ui::QLopDataBaseViewer) |
|
6 | ui(new Ui::QLopDataBaseViewer) | |
7 | { |
|
7 | { | |
8 | ui->setupUi(this); |
|
8 | ui->setupUi(this); | |
9 | this->model = new QLopDataBaseViewerModel(); |
|
9 | this->model = new QLopDataBaseViewerModel(); | |
10 | this->ui->dataBaseTbleView->setModel(model); |
|
10 | this->ui->dataBaseTbleView->setModel(model); | |
|
11 | connect(QLopDataBase::self(),SIGNAL(DBChanged()),this->model,SLOT(DBChanged())); | |||
11 | } |
|
12 | } | |
12 |
|
13 | |||
13 | QLopDataBaseViewer::~QLopDataBaseViewer() |
|
14 | QLopDataBaseViewer::~QLopDataBaseViewer() | |
14 | { |
|
15 | { | |
15 | delete ui; |
|
16 | delete ui; | |
16 | delete model; |
|
17 | delete model; | |
17 | } |
|
18 | } | |
18 |
|
19 | |||
19 | void QLopDataBaseViewer::changeEvent(QEvent *e) |
|
20 | void QLopDataBaseViewer::changeEvent(QEvent *e) | |
20 | { |
|
21 | { | |
21 | QDockWidget::changeEvent(e); |
|
22 | QDockWidget::changeEvent(e); | |
22 | switch (e->type()) { |
|
23 | switch (e->type()) { | |
23 | case QEvent::LanguageChange: |
|
24 | case QEvent::LanguageChange: | |
24 | ui->retranslateUi(this); |
|
25 | ui->retranslateUi(this); | |
25 | break; |
|
26 | break; | |
26 | default: |
|
27 | default: | |
27 | break; |
|
28 | break; | |
28 | } |
|
29 | } | |
29 | } |
|
30 | } | |
|
31 |
@@ -1,26 +1,30 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <ui version="4.0"> |
|
2 | <ui version="4.0"> | |
3 | <class>QLopDataBaseViewer</class> |
|
3 | <class>QLopDataBaseViewer</class> | |
4 | <widget class="QDockWidget" name="QLopDataBaseViewer"> |
|
4 | <widget class="QDockWidget" name="QLopDataBaseViewer"> | |
5 | <property name="geometry"> |
|
5 | <property name="geometry"> | |
6 | <rect> |
|
6 | <rect> | |
7 | <x>0</x> |
|
7 | <x>0</x> | |
8 | <y>0</y> |
|
8 | <y>0</y> | |
9 | <width>825</width> |
|
9 | <width>825</width> | |
10 | <height>427</height> |
|
10 | <height>427</height> | |
11 | </rect> |
|
11 | </rect> | |
12 | </property> |
|
12 | </property> | |
13 | <property name="windowTitle"> |
|
13 | <property name="windowTitle"> | |
14 | <string>DockWidget</string> |
|
14 | <string>DockWidget</string> | |
15 | </property> |
|
15 | </property> | |
16 | <widget class="QWidget" name="dockWidgetContents"> |
|
16 | <widget class="QWidget" name="dockWidgetContents"> | |
17 | <layout class="QGridLayout" name="gridLayout"> |
|
17 | <layout class="QGridLayout" name="gridLayout"> | |
18 | <item row="0" column="0"> |
|
18 | <item row="0" column="0"> | |
19 |
<widget class="QTableView" name="dataBaseTbleView" |
|
19 | <widget class="QTableView" name="dataBaseTbleView"> | |
|
20 | <attribute name="horizontalHeaderShowSortIndicator" stdset="0"> | |||
|
21 | <bool>false</bool> | |||
|
22 | </attribute> | |||
|
23 | </widget> | |||
20 | </item> |
|
24 | </item> | |
21 | </layout> |
|
25 | </layout> | |
22 | </widget> |
|
26 | </widget> | |
23 | </widget> |
|
27 | </widget> | |
24 | <resources/> |
|
28 | <resources/> | |
25 | <connections/> |
|
29 | <connections/> | |
26 | </ui> |
|
30 | </ui> |
@@ -1,41 +1,90 | |||||
1 | #include "qlopdatabaseviewermodel.h" |
|
1 | #include "qlopdatabaseviewermodel.h" | |
2 |
|
2 | |||
3 | QLopDataBaseViewerModel::QLopDataBaseViewerModel(QObject *parent) |
|
3 | QLopDataBaseViewerModel::QLopDataBaseViewerModel(QObject *parent) | |
4 | : QAbstractTableModel(parent) |
|
4 | : QAbstractTableModel(parent) | |
5 | { |
|
5 | { | |
6 | beginResetModel(); |
|
6 | beginResetModel(); | |
7 | endResetModel(); |
|
7 | endResetModel(); | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
10 | QLopDataBaseViewerModel::~QLopDataBaseViewerModel() |
|
10 | QLopDataBaseViewerModel::~QLopDataBaseViewerModel() | |
11 | { |
|
11 | { | |
12 |
|
12 | |||
13 | } |
|
13 | } | |
14 |
|
14 | |||
15 | int QLopDataBaseViewerModel::rowCount(const QModelIndex &parent) const |
|
15 | int QLopDataBaseViewerModel::rowCount(const QModelIndex &parent) const | |
16 | { |
|
16 | { | |
17 | return QLopDataBase::count(); |
|
17 | return QLopDataBase::count(); | |
18 | } |
|
18 | } | |
19 |
|
19 | |||
20 | int QLopDataBaseViewerModel::columnCount(const QModelIndex &parent) const |
|
20 | int QLopDataBaseViewerModel::columnCount(const QModelIndex &parent) const | |
21 | { |
|
21 | { | |
22 |
return |
|
22 | return 5; | |
23 | } |
|
23 | } | |
24 |
|
24 | |||
25 | QVariant QLopDataBaseViewerModel::data(const QModelIndex &index, int role) const |
|
25 | QVariant QLopDataBaseViewerModel::data(const QModelIndex &index, int role) const | |
26 | { |
|
26 | { | |
27 | if (!index.isValid() || role != Qt::DisplayRole) |
|
27 | if (!index.isValid() || role != Qt::DisplayRole) | |
28 | return QVariant(); |
|
28 | return QVariant(); | |
29 | QLopData* data=QLopDataBase::self()->getDataFromIdex(index.row()); |
|
29 | QLopData* data=QLopDataBase::self()->getDataFromIdex(index.row()); | |
30 | if(data) |
|
30 | if(data) | |
31 | return data->name; |
|
31 | { | |
|
32 | switch (index.column()) { | |||
|
33 | case 0: | |||
|
34 | return data->name; | |||
|
35 | break; | |||
|
36 | case 1: | |||
|
37 | return data->source; | |||
|
38 | break; | |||
|
39 | case 2: | |||
|
40 | return data->typeStr(); | |||
|
41 | break; | |||
|
42 | case 3: | |||
|
43 | return data->unit; | |||
|
44 | break; | |||
|
45 | case 4: | |||
|
46 | return data->size(); | |||
|
47 | break; | |||
|
48 | default: | |||
|
49 | return data->name; | |||
|
50 | break; | |||
|
51 | } | |||
|
52 | } | |||
32 | else QVariant(); |
|
53 | else QVariant(); | |
33 | } |
|
54 | } | |
34 |
|
55 | |||
35 | QVariant QLopDataBaseViewerModel::headerData(int section, Qt::Orientation orientation, int role) const |
|
56 | QVariant QLopDataBaseViewerModel::headerData(int section, Qt::Orientation orientation, int role) const | |
36 | { |
|
57 | { | |
37 | if (role == Qt::SizeHintRole) |
|
58 | //if (role == Qt::SizeHintRole) | |
38 | return QSize(1, 1); |
|
59 | // return QSize(1, 1); | |
|
60 | if(orientation==Qt::Horizontal && role==Qt::DisplayRole) | |||
|
61 | { | |||
|
62 | switch (section) { | |||
|
63 | case 0: | |||
|
64 | return QVariant("Name"); | |||
|
65 | break; | |||
|
66 | case 1: | |||
|
67 | return QVariant("Source"); | |||
|
68 | break; | |||
|
69 | case 2: | |||
|
70 | return QVariant("Type"); | |||
|
71 | break; | |||
|
72 | case 3: | |||
|
73 | return QVariant("Unit"); | |||
|
74 | break; | |||
|
75 | case 4: | |||
|
76 | return QVariant("Size"); | |||
|
77 | break; | |||
|
78 | default: | |||
|
79 | break; | |||
|
80 | } | |||
|
81 | } | |||
39 | return QVariant(); |
|
82 | return QVariant(); | |
40 | } |
|
83 | } | |
41 |
|
84 | |||
|
85 | void QLopDataBaseViewerModel::DBChanged() | |||
|
86 | { | |||
|
87 | beginResetModel(); | |||
|
88 | endResetModel(); | |||
|
89 | } | |||
|
90 |
@@ -1,24 +1,27 | |||||
1 | #ifndef QLOPDATABASEVIEWERMODEL_H |
|
1 | #ifndef QLOPDATABASEVIEWERMODEL_H | |
2 | #define QLOPDATABASEVIEWERMODEL_H |
|
2 | #define QLOPDATABASEVIEWERMODEL_H | |
3 |
|
3 | |||
4 | #include <QObject> |
|
4 | #include <QObject> | |
5 | #include <QAbstractTableModel> |
|
5 | #include <QAbstractTableModel> | |
6 | #include <qlopdatabase.h> |
|
6 | #include <qlopdatabase.h> | |
7 |
|
7 | |||
8 | class QLopDataBaseViewerModel : public QAbstractTableModel |
|
8 | class QLopDataBaseViewerModel : public QAbstractTableModel | |
9 | { |
|
9 | { | |
|
10 | Q_OBJECT | |||
10 | public: |
|
11 | public: | |
11 | QLopDataBaseViewerModel(QObject *parent=0); |
|
12 | QLopDataBaseViewerModel(QObject *parent=0); | |
12 | ~QLopDataBaseViewerModel(); |
|
13 | ~QLopDataBaseViewerModel(); | |
13 |
|
14 | |||
14 | int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; |
|
15 | int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | |
15 | int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; |
|
16 | int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | |
16 |
|
17 | |||
17 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; |
|
18 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; | |
18 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; |
|
19 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; | |
19 |
|
20 | |||
|
21 | public slots: | |||
|
22 | void DBChanged(); | |||
20 | private: |
|
23 | private: | |
21 |
|
24 | |||
22 | }; |
|
25 | }; | |
23 |
|
26 | |||
24 | #endif // QLOPDATABASEVIEWERMODEL_H |
|
27 | #endif // QLOPDATABASEVIEWERMODEL_H |
@@ -1,58 +1,66 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the QLop Software |
|
2 | -- This file is a part of the QLop Software | |
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 |
|
22 | |||
23 | #include "qlopdata.h" |
|
23 | #include "qlopdata.h" | |
|
24 | QLopData::QLopDataTypeList_t QLopData::QLopDataTypeList[]= | |||
|
25 | { | |||
|
26 | {Scalar,"Scalar"}, | |||
|
27 | {Vector,"Vector"}, | |||
|
28 | {Matrix,"Matrix"}, | |||
|
29 | {QCPDataVector,"QCPDataVector"}, | |||
|
30 | {None,"None"} | |||
|
31 | }; | |||
24 |
|
32 | |||
25 | QLopData::QLopData(QObject *parent) : QObject(parent) |
|
33 | QLopData::QLopData(QObject *parent) : QObject(parent) | |
26 | { |
|
34 | { | |
27 | this->unit = ""; |
|
35 | this->unit = ""; | |
28 | this->source = "Not set"; |
|
36 | this->source = "Not set"; | |
29 | this->type = QLopData::None; |
|
37 | this->type = QLopData::None; | |
30 | } |
|
38 | } | |
31 |
|
39 | |||
32 | QLopData::~QLopData() |
|
40 | QLopData::~QLopData() | |
33 | { |
|
41 | { | |
34 | // delete data; |
|
42 | // delete data; | |
35 | } |
|
43 | } | |
36 |
|
44 | |||
37 |
|
45 | |||
38 |
|
46 | |||
39 | QLopQCPDataVector::QLopQCPDataVector(QObject *parent) |
|
47 | QLopQCPDataVector::QLopQCPDataVector(QObject *parent) | |
40 | { |
|
48 | { | |
41 | this->type = QLopData::QCPDataVector; |
|
49 | this->type = QLopData::QCPDataVector; | |
42 | } |
|
50 | } | |
43 |
|
51 | |||
44 | QLopQCPDataVector::~QLopQCPDataVector() |
|
52 | QLopQCPDataVector::~QLopQCPDataVector() | |
45 | { |
|
53 | { | |
46 | delete data; |
|
54 | delete data; | |
47 | } |
|
55 | } | |
48 |
|
56 | |||
49 |
|
57 | |||
50 | QLopQVector::QLopQVector(QObject *parent) |
|
58 | QLopQVector::QLopQVector(QObject *parent) | |
51 | { |
|
59 | { | |
52 | this->type = QLopData::Vector; |
|
60 | this->type = QLopData::Vector; | |
53 | } |
|
61 | } | |
54 |
|
62 | |||
55 | QLopQVector::~QLopQVector() |
|
63 | QLopQVector::~QLopQVector() | |
56 | { |
|
64 | { | |
57 | delete data; |
|
65 | delete data; | |
58 | } |
|
66 | } |
@@ -1,91 +1,111 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the QLop Software |
|
2 | -- This file is a part of the QLop Software | |
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 |
|
22 | |||
23 | #ifndef QLOPDATA_H |
|
23 | #ifndef QLOPDATA_H | |
24 | #define QLOPDATA_H |
|
24 | #define QLOPDATA_H | |
25 |
|
25 | |||
26 | #include <QObject> |
|
26 | #include <QObject> | |
27 | #include <qcustomplot.h> |
|
27 | #include <qcustomplot.h> | |
28 |
|
28 | |||
29 | typedef struct dataVector |
|
29 | typedef struct dataVector | |
30 | { |
|
30 | { | |
31 | QString name; |
|
31 | QString name; | |
32 | QString unit; |
|
32 | QString unit; | |
33 | QVector<QCPData>* data; |
|
33 | QVector<QCPData>* data; | |
34 | }dataVector; |
|
34 | }dataVector; | |
35 |
|
35 | |||
36 | typedef QList<dataVector> QListOfDataVector; |
|
36 | typedef QList<dataVector> QListOfDataVector; | |
37 |
|
37 | |||
38 |
|
38 | |||
39 |
|
||||
40 | class QLopData : public QObject |
|
39 | class QLopData : public QObject | |
41 | { |
|
40 | { | |
42 | Q_OBJECT |
|
41 | Q_OBJECT | |
43 | public: |
|
42 | public: | |
|
43 | #define QLopDataTypeCnt 5 | |||
44 | typedef enum QLopDataType |
|
44 | typedef enum QLopDataType | |
45 | { |
|
45 | { | |
46 | Scalar=0, |
|
46 | Scalar=0, | |
47 | Vector=1, |
|
47 | Vector=1, | |
48 | Matrix=2, |
|
48 | Matrix=2, | |
49 | QCPDataVector=3, |
|
49 | QCPDataVector=3, | |
50 | None=-1, |
|
50 | None=-1, | |
51 | } |
|
51 | }QLopDataType; | |
52 | QLopDataType; |
|
52 | ||
|
53 | struct QLopDataTypeList_t | |||
|
54 | { | |||
|
55 | QLopDataType type; | |||
|
56 | const char* typeStr; | |||
|
57 | }; | |||
|
58 | ||||
|
59 | static struct QLopDataTypeList_t QLopDataTypeList[]; | |||
53 | explicit QLopData(QObject *parent = 0); |
|
60 | explicit QLopData(QObject *parent = 0); | |
54 | ~QLopData(); |
|
61 | ~QLopData(); | |
55 | QString name; |
|
62 | QString name; | |
56 | QString source; |
|
63 | QString source; | |
57 | QString unit; |
|
64 | QString unit; | |
|
65 | QString typeStr() | |||
|
66 | { | |||
|
67 | for(int i=0;i<QLopDataTypeCnt;i++) | |||
|
68 | { | |||
|
69 | if(QLopDataTypeList[i].type==this->type) | |||
|
70 | return QLopDataTypeList[i].typeStr; | |||
|
71 | } | |||
|
72 | return "Unknow data type"; | |||
|
73 | } | |||
58 | QLopDataType type; |
|
74 | QLopDataType type; | |
59 | int ID; |
|
75 | int ID; | |
|
76 | virtual int size(){return 0;} | |||
60 | signals: |
|
77 | signals: | |
61 | void dataChanged(); |
|
78 | void dataChanged(); | |
62 | public slots: |
|
79 | public slots: | |
63 | private: |
|
80 | private: | |
64 | }; |
|
81 | }; | |
65 |
|
82 | |||
66 | class QLopQCPDataVector : public QLopData |
|
83 | class QLopQCPDataVector : public QLopData | |
67 | { |
|
84 | { | |
68 | Q_OBJECT |
|
85 | Q_OBJECT | |
69 | public: |
|
86 | public: | |
70 | explicit QLopQCPDataVector(QObject *parent = 0); |
|
87 | explicit QLopQCPDataVector(QObject *parent = 0); | |
71 | ~QLopQCPDataVector(); |
|
88 | ~QLopQCPDataVector(); | |
72 | QVector<QCPData>* data; |
|
89 | QVector<QCPData>* data; | |
|
90 | int size(){return data->length();} | |||
73 | signals: |
|
91 | signals: | |
74 | public slots: |
|
92 | public slots: | |
75 | private: |
|
93 | private: | |
76 | }; |
|
94 | }; | |
77 |
|
95 | |||
78 | class QLopQVector : public QLopData |
|
96 | class QLopQVector : public QLopData | |
79 | { |
|
97 | { | |
80 | Q_OBJECT |
|
98 | Q_OBJECT | |
81 | public: |
|
99 | public: | |
82 | explicit QLopQVector(QObject *parent = 0); |
|
100 | explicit QLopQVector(QObject *parent = 0); | |
83 | ~QLopQVector(); |
|
101 | ~QLopQVector(); | |
84 | QVector<double>* data; |
|
102 | QVector<double>* data; | |
|
103 | int size(){return data->length();} | |||
85 | signals: |
|
104 | signals: | |
86 | public slots: |
|
105 | public slots: | |
87 | private: |
|
106 | private: | |
88 | }; |
|
107 | }; | |
89 | typedef QList<QLopData*> QLopDataList; |
|
108 | typedef QList<QLopData*> QLopDataList; | |
90 |
|
109 | |||
|
110 | ||||
91 | #endif // QLOPDATA_H |
|
111 | #endif // QLOPDATA_H |
@@ -1,91 +1,140 | |||||
1 | #include "qlopdatabase.h" |
|
1 | #include "qlopdatabase.h" | |
|
2 | #include <qlopdatabaseviewer.h> | |||
2 |
|
3 | |||
3 | QList<QLopData*>* QLopDataBase::m_dataBase=NULL; |
|
4 | QList<QLopData*>* QLopDataBase::m_dataBase=NULL; | |
4 | QLopDataBase* QLopDataBase::_self=NULL; |
|
5 | QLopDataBase* QLopDataBase::_self=NULL; | |
|
6 | QDockWidget* QLopDataBase::m_gui=NULL; | |||
5 |
|
7 | |||
6 | #define INIT() \ |
|
8 | #define INIT() \ | |
7 | if(Q_UNLIKELY(_self==NULL))\ |
|
9 | if(Q_UNLIKELY(_self==NULL))\ | |
8 | {\ |
|
10 | {\ | |
9 | init();\ |
|
11 | init();\ | |
10 | } |
|
12 | } | |
11 |
|
13 | |||
12 |
QLopDataBase::QLopDataBase(QObject *parent) : Q |
|
14 | QLopDataBase::QLopDataBase(bool noGUI,QObject *parent) : QLopService(parent) | |
13 | { |
|
15 | { | |
14 | this->m_dataBase = new QList<QLopData*>(); |
|
16 | this->m_dataBase = new QList<QLopData*>(); | |
|
17 | m_serviceName="QLopDataBase"; | |||
|
18 | m_noGui=noGUI; | |||
15 | } |
|
19 | } | |
16 |
|
20 | |||
17 | QLopDataBase::~QLopDataBase() |
|
21 | QLopDataBase::~QLopDataBase() | |
18 | { |
|
22 | { | |
19 |
|
23 | |||
20 | } |
|
24 | } | |
21 |
|
25 | |||
22 |
|
|
26 | QDockWidget *QLopDataBase::getGUI() | |
|
27 | { | |||
|
28 | if(!m_noGui && (m_gui==NULL)) | |||
|
29 | { | |||
|
30 | m_gui=new QLopDataBaseViewer(); | |||
|
31 | m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); | |||
|
32 | } | |||
|
33 | return m_gui; | |||
|
34 | } | |||
|
35 | ||||
|
36 | void QLopDataBase::init(bool noGUI, QObject *parent) | |||
23 | { |
|
37 | { | |
24 | _self=new QLopDataBase(); |
|
38 | _self=new QLopDataBase(); | |
25 | } |
|
39 | } | |
26 |
|
40 | |||
|
41 | const QString &QLopDataBase::serviceName() | |||
|
42 | { | |||
|
43 | INIT(); | |||
|
44 | return m_serviceName; | |||
|
45 | } | |||
|
46 | ||||
27 | int QLopDataBase::addData(QLopData *data) |
|
47 | int QLopDataBase::addData(QLopData *data) | |
28 | { |
|
48 | { | |
29 | INIT(); |
|
49 | INIT(); | |
30 | if(!m_dataBase->contains(data)) |
|
50 | if(!m_dataBase->contains(data)) | |
31 | { |
|
51 | { | |
32 | m_dataBase->append(data); |
|
52 | m_dataBase->append(data); | |
|
53 | emit QLopDataBase::self()->DBChanged(); | |||
33 | return 1; |
|
54 | return 1; | |
34 | } |
|
55 | } | |
35 | return 0; |
|
56 | return 0; | |
36 | } |
|
57 | } | |
37 |
|
58 | |||
38 | int QLopDataBase::addData(const QLopDataList& data) |
|
59 | int QLopDataBase::addData(const QLopDataList& data) | |
39 | { |
|
60 | { | |
40 | INIT(); |
|
61 | INIT(); | |
41 | int addedData=0; |
|
62 | int addedData=0; | |
42 | for (int i = 0; i < data.count(); i++) |
|
63 | for (int i = 0; i < data.count(); i++) | |
43 | { |
|
64 | { | |
44 | addedData += addData(data.at(i)); |
|
65 | addedData += addData(data.at(i)); | |
45 | } |
|
66 | } | |
|
67 | emit QLopDataBase::self()->DBChanged(); | |||
46 | return addedData; |
|
68 | return addedData; | |
47 | } |
|
69 | } | |
48 |
|
70 | |||
|
71 | int QLopDataBase::removeData(QLopData *data) | |||
|
72 | { | |||
|
73 | INIT(); | |||
|
74 | if(m_dataBase->contains(data)) | |||
|
75 | { | |||
|
76 | m_dataBase->removeAll(data); | |||
|
77 | emit QLopDataBase::self()->DBChanged(); | |||
|
78 | return 1; | |||
|
79 | } | |||
|
80 | return 0; | |||
|
81 | } | |||
|
82 | ||||
|
83 | int QLopDataBase::removeData(const QLopDataList &data) | |||
|
84 | { | |||
|
85 | INIT(); | |||
|
86 | int removedData=0; | |||
|
87 | for (int i = 0; i < data.count(); i++) | |||
|
88 | { | |||
|
89 | removedData += removeData(data.at(i)); | |||
|
90 | } | |||
|
91 | emit QLopDataBase::self()->DBChanged(); | |||
|
92 | return removedData; | |||
|
93 | } | |||
|
94 | ||||
49 | QLopDataBase *QLopDataBase::self() |
|
95 | QLopDataBase *QLopDataBase::self() | |
50 | { |
|
96 | { | |
51 | INIT(); |
|
97 | INIT(); | |
52 | return _self; |
|
98 | return _self; | |
53 | } |
|
99 | } | |
54 |
|
100 | |||
55 | int QLopDataBase::count() |
|
101 | int QLopDataBase::count() | |
56 | { |
|
102 | { | |
|
103 | INIT(); | |||
57 | return m_dataBase->count(); |
|
104 | return m_dataBase->count(); | |
58 | } |
|
105 | } | |
59 |
|
106 | |||
60 | QLopData *QLopDataBase::getData(const QString &name) |
|
107 | QLopData *QLopDataBase::getData(const QString &name) | |
61 | { |
|
108 | { | |
|
109 | INIT(); | |||
62 | for (int i = 0; i < m_dataBase->count(); i++) |
|
110 | for (int i = 0; i < m_dataBase->count(); i++) | |
63 | { |
|
111 | { | |
64 | if(Q_UNLIKELY(m_dataBase->at(i)->name==name)) |
|
112 | if(Q_UNLIKELY(m_dataBase->at(i)->name==name)) | |
65 | { |
|
113 | { | |
66 | return m_dataBase->at(i); |
|
114 | return m_dataBase->at(i); | |
67 | } |
|
115 | } | |
68 | } |
|
116 | } | |
69 | return NULL; |
|
117 | return NULL; | |
70 | } |
|
118 | } | |
71 |
|
119 | |||
72 | QLopData *QLopDataBase::getData(int ID) |
|
120 | QLopData *QLopDataBase::getData(int ID) | |
73 | { |
|
121 | { | |
|
122 | INIT(); | |||
74 | for (int i = 0; i < m_dataBase->count(); i++) |
|
123 | for (int i = 0; i < m_dataBase->count(); i++) | |
75 | { |
|
124 | { | |
76 | if(Q_UNLIKELY(m_dataBase->at(i)->ID==ID)) |
|
125 | if(Q_UNLIKELY(m_dataBase->at(i)->ID==ID)) | |
77 | { |
|
126 | { | |
78 | return m_dataBase->at(i); |
|
127 | return m_dataBase->at(i); | |
79 | } |
|
128 | } | |
80 | } |
|
129 | } | |
81 | return NULL; |
|
130 | return NULL; | |
82 | } |
|
131 | } | |
83 |
|
132 | |||
84 | QLopData *QLopDataBase::getDataFromIdex(int index) |
|
133 | QLopData *QLopDataBase::getDataFromIdex(int index) | |
85 | { |
|
134 | { | |
86 | if((index>=0)&&(index<m_dataBase->count())) |
|
135 | if((index>=0)&&(index<m_dataBase->count())) | |
87 | return m_dataBase->at(index); |
|
136 | return m_dataBase->at(index); | |
88 | else |
|
137 | else | |
89 | return NULL; |
|
138 | return NULL; | |
90 | } |
|
139 | } | |
91 |
|
140 |
@@ -1,30 +1,38 | |||||
1 | #ifndef QLOPDATABASE_H |
|
1 | #ifndef QLOPDATABASE_H | |
2 | #define QLOPDATABASE_H |
|
2 | #define QLOPDATABASE_H | |
3 |
|
3 | |||
4 | #include <QObject> |
|
4 | #include <QObject> | |
5 | #include <qlopdata.h> |
|
5 | #include <qlopdata.h> | |
6 | #include <QList> |
|
6 | #include <QList> | |
|
7 | #include <qlopservice.h> | |||
7 |
|
8 | |||
8 |
class QLopDataBase |
|
9 | class QLopDataBaseViewer; | |
|
10 | ||||
|
11 | class QLopDataBase : public QLopService | |||
9 | { |
|
12 | { | |
10 | Q_OBJECT |
|
13 | Q_OBJECT | |
11 | explicit QLopDataBase(QObject *parent = 0); |
|
14 | static QDockWidget* m_gui; | |
|
15 | QLopDataBase(bool noGUI=false,QObject *parent = 0); | |||
12 | ~QLopDataBase(); |
|
16 | ~QLopDataBase(); | |
13 | static QLopDataBase* _self; |
|
17 | static QLopDataBase* _self; | |
14 | public: |
|
18 | public: | |
15 | static void init(); |
|
19 | QDockWidget* getGUI(); | |
|
20 | static void init(bool noGUI=false,QObject *parent = 0); | |||
|
21 | const QString& serviceName(); | |||
16 | static int addData(QLopData* data); |
|
22 | static int addData(QLopData* data); | |
17 | static int addData(const QLopDataList &data); |
|
23 | static int addData(const QLopDataList &data); | |
|
24 | static int removeData(QLopData* data); | |||
|
25 | static int removeData(const QLopDataList &data); | |||
18 | static QLopDataBase* self(); |
|
26 | static QLopDataBase* self(); | |
19 | static int count(); |
|
27 | static int count(); | |
20 | static QLopData* getData(const QString& name); |
|
28 | static QLopData* getData(const QString& name); | |
21 | static QLopData* getData(int ID); |
|
29 | static QLopData* getData(int ID); | |
22 | QLopData* getDataFromIdex(int index); |
|
30 | QLopData* getDataFromIdex(int index); | |
23 | signals: |
|
31 | signals: | |
24 |
|
32 | void DBChanged(); | ||
25 | public slots: |
|
33 | public slots: | |
26 | private: |
|
34 | private: | |
27 | static QList<QLopData*>* m_dataBase; |
|
35 | static QList<QLopData*>* m_dataBase; | |
28 | }; |
|
36 | }; | |
29 |
|
37 | |||
30 | #endif // QLOPDATABASE_H |
|
38 | #endif // QLOPDATABASE_H |
@@ -1,146 +1,148 | |||||
1 | /*------------------------------------------------------------------------------ |
|
1 | /*------------------------------------------------------------------------------ | |
2 | -- This file is a part of the QLop Software |
|
2 | -- This file is a part of the QLop Software | |
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 2 of the License, or |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | -------------------------------------------------------------------------------*/ |
|
18 | -------------------------------------------------------------------------------*/ | |
19 | /*-- Author : Alexis Jeandet |
|
19 | /*-- Author : Alexis Jeandet | |
20 | -- Mail : alexis.jeandet@member.fsf.org |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
21 | ----------------------------------------------------------------------------*/ |
|
21 | ----------------------------------------------------------------------------*/ | |
22 | #include "mainwindow.h" |
|
22 | #include "mainwindow.h" | |
23 | #include "ui_mainwindow.h" |
|
23 | #include "ui_mainwindow.h" | |
24 | #include <QFileDialog> |
|
24 | #include <QFileDialog> | |
25 | #include <QDir> |
|
25 | #include <QDir> | |
26 | #include "qcustomplot.h" |
|
26 | #include "qcustomplot.h" | |
27 | #include <omp.h> |
|
27 | #include <omp.h> | |
28 | #include <QAction> |
|
28 | #include <QAction> | |
29 | #include <downloadhistory.h> |
|
29 | #include <downloadhistory.h> | |
30 | #include <QDateTime> |
|
30 | #include <QDateTime> | |
31 | #include <QDate> |
|
31 | #include <QDate> | |
32 | #include <filedownloader.h> |
|
32 | #include <filedownloader.h> | |
33 | #include <cassinitools.h> |
|
33 | #include <cassinitools.h> | |
34 | #include <qlopplots.h> |
|
34 | #include <qlopplots.h> | |
|
35 | #include <qlopdatabase.h> | |||
35 |
|
36 | |||
36 | const QList<QLopService*>ServicesToLoad=QList<QLopService*>() |
|
37 | const QList<QLopService*>ServicesToLoad=QList<QLopService*>() | |
|
38 | <<QLopDataBase::self() | |||
37 | <<FileDownloader::self() |
|
39 | <<FileDownloader::self() | |
38 | <<CassiniTools::self() |
|
40 | <<CassiniTools::self() | |
39 | << QLopPlots::self(); |
|
41 | << QLopPlots::self(); | |
40 |
|
42 | |||
41 | MainWindow::MainWindow(int OMP_THREADS, QWidget *parent) : |
|
43 | MainWindow::MainWindow(int OMP_THREADS, QWidget *parent) : | |
42 | QMainWindow(parent), |
|
44 | QMainWindow(parent), | |
43 | ui(new Ui::MainWindow) |
|
45 | ui(new Ui::MainWindow) | |
44 | { |
|
46 | { | |
45 | this->OMP_THREADS = OMP_THREADS; |
|
47 | this->OMP_THREADS = OMP_THREADS; | |
46 | ui->setupUi(this); |
|
48 | ui->setupUi(this); | |
47 | this->setWindowIcon(QIcon(":img/QLop.svg")); |
|
49 | this->setWindowIcon(QIcon(":img/QLop.svg")); | |
48 |
|
50 | |||
49 | // QLopPlots::getPlot()->setXaxisTickLabelType(QCPAxis::ltDateTime); |
|
51 | // QLopPlots::getPlot()->setXaxisTickLabelType(QCPAxis::ltDateTime); | |
50 | // QLopPlots::getPlot()->setXaxisDateTimeFormat("hh:mm:ss.zzz"); |
|
52 | // QLopPlots::getPlot()->setXaxisDateTimeFormat("hh:mm:ss.zzz"); | |
51 | this->progressWidget = new QWidget(); |
|
53 | this->progressWidget = new QWidget(); | |
52 | this->progressLayout = new QVBoxLayout(this->progressWidget); |
|
54 | this->progressLayout = new QVBoxLayout(this->progressWidget); | |
53 | this->progressWidget->setLayout(this->progressLayout); |
|
55 | this->progressWidget->setLayout(this->progressLayout); | |
54 | this->progressWidget->setWindowModality(Qt::WindowModal); |
|
56 | this->progressWidget->setWindowModality(Qt::WindowModal); | |
55 | progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int)); |
|
57 | progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int)); | |
56 | for(int i=0;i<OMP_THREADS;i++) |
|
58 | for(int i=0;i<OMP_THREADS;i++) | |
57 | { |
|
59 | { | |
58 | this->progress.append(new QProgressBar(this->progressWidget)); |
|
60 | this->progress.append(new QProgressBar(this->progressWidget)); | |
59 | this->progress.last()->setMinimum(0); |
|
61 | this->progress.last()->setMinimum(0); | |
60 | this->progress.last()->setMaximum(100); |
|
62 | this->progress.last()->setMaximum(100); | |
61 | this->progressLayout->addWidget(this->progress.last()); |
|
63 | this->progressLayout->addWidget(this->progress.last()); | |
62 | this->progressWidget->hide(); |
|
64 | this->progressWidget->hide(); | |
63 | this->progressThreadIds[i] = -1; |
|
65 | this->progressThreadIds[i] = -1; | |
64 | } |
|
66 | } | |
65 | this->progressWidget->setWindowTitle("Loading File"); |
|
67 | this->progressWidget->setWindowTitle("Loading File"); | |
66 | for(int i=0;i<ServicesToLoad.count();i++) |
|
68 | for(int i=0;i<ServicesToLoad.count();i++) | |
67 | { |
|
69 | { | |
68 | qDebug()<<ServicesToLoad.at(i)->serviceName(); |
|
70 | qDebug()<<ServicesToLoad.at(i)->serviceName(); | |
69 | QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI(); |
|
71 | QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI(); | |
70 | wdgt->setAllowedAreas(Qt::AllDockWidgetAreas); |
|
72 | wdgt->setAllowedAreas(Qt::AllDockWidgetAreas); | |
71 | this->addDockWidget(Qt::TopDockWidgetArea,wdgt); |
|
73 | this->addDockWidget(Qt::TopDockWidgetArea,wdgt); | |
72 | PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i)); |
|
74 | PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i)); | |
73 | } |
|
75 | } | |
74 | } |
|
76 | } | |
75 |
|
77 | |||
76 | MainWindow::~MainWindow() |
|
78 | MainWindow::~MainWindow() | |
77 | { |
|
79 | { | |
78 | delete ui; |
|
80 | delete ui; | |
79 | } |
|
81 | } | |
80 |
|
82 | |||
81 | //QString MainWindow::getFilePath(const QString &name) |
|
83 | //QString MainWindow::getFilePath(const QString &name) | |
82 | //{ |
|
84 | //{ | |
83 | //// for(int i=0;i<this->folderViews.count();i++) |
|
85 | //// for(int i=0;i<this->folderViews.count();i++) | |
84 | //// { |
|
86 | //// { | |
85 | //// if(folderViews.at(i)->isDraging(name)) |
|
87 | //// if(folderViews.at(i)->isDraging(name)) | |
86 | //// return folderViews.at(i)->currentFolder(); |
|
88 | //// return folderViews.at(i)->currentFolder(); | |
87 | //// } |
|
89 | //// } | |
88 | // return ""; |
|
90 | // return ""; | |
89 | //} |
|
91 | //} | |
90 |
|
92 | |||
91 |
|
93 | |||
92 |
|
94 | |||
93 |
|
95 | |||
94 | void MainWindow::updateProgress(int threadId, int percentProgress) |
|
96 | void MainWindow::updateProgress(int threadId, int percentProgress) | |
95 | { |
|
97 | { | |
96 | bool updated=false; |
|
98 | bool updated=false; | |
97 | for(int i=0;i<OMP_THREADS;i++) |
|
99 | for(int i=0;i<OMP_THREADS;i++) | |
98 | { |
|
100 | { | |
99 | if(progressThreadIds[i]==threadId) |
|
101 | if(progressThreadIds[i]==threadId) | |
100 | { |
|
102 | { | |
101 | if(threadId<this->progress.count()) |
|
103 | if(threadId<this->progress.count()) | |
102 | { |
|
104 | { | |
103 | this->progress.at(i)->setValue(percentProgress); |
|
105 | this->progress.at(i)->setValue(percentProgress); | |
104 | updated=true; |
|
106 | updated=true; | |
105 | } |
|
107 | } | |
106 | } |
|
108 | } | |
107 | } |
|
109 | } | |
108 | if(Q_UNLIKELY(updated==false)) |
|
110 | if(Q_UNLIKELY(updated==false)) | |
109 | { |
|
111 | { | |
110 | for(int i=0;i<OMP_THREADS;i++) |
|
112 | for(int i=0;i<OMP_THREADS;i++) | |
111 | { |
|
113 | { | |
112 | if(progressThreadIds[i]==-1) |
|
114 | if(progressThreadIds[i]==-1) | |
113 | { |
|
115 | { | |
114 | progressThreadIds[i] = threadId; |
|
116 | progressThreadIds[i] = threadId; | |
115 | updateProgress(threadId,percentProgress); |
|
117 | updateProgress(threadId,percentProgress); | |
116 | return; |
|
118 | return; | |
117 | } |
|
119 | } | |
118 | } |
|
120 | } | |
119 | } |
|
121 | } | |
120 | } |
|
122 | } | |
121 |
|
123 | |||
122 |
|
124 | |||
123 | void MainWindow::askGlobalRescan() |
|
125 | void MainWindow::askGlobalRescan() | |
124 | { |
|
126 | { | |
125 | // for(int i=0;i<this->folderViews.count();i++) |
|
127 | // for(int i=0;i<this->folderViews.count();i++) | |
126 | // { |
|
128 | // { | |
127 | // this->folderViews.at(i)->refreshFolder(); |
|
129 | // this->folderViews.at(i)->refreshFolder(); | |
128 | // } |
|
130 | // } | |
129 | } |
|
131 | } | |
130 |
|
132 | |||
131 | void MainWindow::showThemisIndexViewer() |
|
133 | void MainWindow::showThemisIndexViewer() | |
132 | { |
|
134 | { | |
133 |
|
135 | |||
134 | } |
|
136 | } | |
135 |
|
137 | |||
136 | void MainWindow::changeEvent(QEvent *e) |
|
138 | void MainWindow::changeEvent(QEvent *e) | |
137 | { |
|
139 | { | |
138 | QMainWindow::changeEvent(e); |
|
140 | QMainWindow::changeEvent(e); | |
139 | switch (e->type()) { |
|
141 | switch (e->type()) { | |
140 | case QEvent::LanguageChange: |
|
142 | case QEvent::LanguageChange: | |
141 | ui->retranslateUi(this); |
|
143 | ui->retranslateUi(this); | |
142 | break; |
|
144 | break; | |
143 | default: |
|
145 | default: | |
144 | break; |
|
146 | break; | |
145 | } |
|
147 | } | |
146 | } |
|
148 | } |
General Comments 0
You need to be logged in to leave comments.
Login now