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