@@ -0,0 +1,73 | |||||
|
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
|
2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | |||
|
3 | <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://web.resource.org/cc/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="48" height="48" id="svg7854" sodipodi:version="0.32" inkscape:version="0.45" version="1.0" sodipodi:docbase="/home/dobey/Projects/gnome-icon-theme/scalable/emblems" sodipodi:docname="emblem-downloads.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape" inkscape:export-filename="/home/lapo/Desktop/emblem-downloads.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90"> | |||
|
4 | <defs id="defs7856"> | |||
|
5 | <linearGradient inkscape:collect="always" id="linearGradient6975"> | |||
|
6 | <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop6977"/> | |||
|
7 | <stop style="stop-color:#ffffff;stop-opacity:0;" offset="1" id="stop6979"/> | |||
|
8 | </linearGradient> | |||
|
9 | <linearGradient inkscape:collect="always" id="linearGradient6964"> | |||
|
10 | <stop style="stop-color:#ffffff;stop-opacity:1;" offset="0" id="stop6967"/> | |||
|
11 | <stop style="stop-color:#ffffff;stop-opacity:0;" offset="1" id="stop6969"/> | |||
|
12 | </linearGradient> | |||
|
13 | <linearGradient inkscape:collect="always" id="linearGradient6970"> | |||
|
14 | <stop style="stop-color:#eeeeec;stop-opacity:1" offset="0" id="stop6972"/> | |||
|
15 | <stop style="stop-color:#eeeeec;stop-opacity:0" offset="1" id="stop6974"/> | |||
|
16 | </linearGradient> | |||
|
17 | <linearGradient inkscape:collect="always" id="linearGradient6962"> | |||
|
18 | <stop style="stop-color:#babdb6;stop-opacity:1" offset="0" id="stop6964"/> | |||
|
19 | <stop style="stop-color:#babdb6;stop-opacity:0" offset="1" id="stop6966"/> | |||
|
20 | </linearGradient> | |||
|
21 | <linearGradient inkscape:collect="always" id="linearGradient7129"> | |||
|
22 | <stop style="stop-color:#000000;stop-opacity:1;" offset="0" id="stop7131"/> | |||
|
23 | <stop style="stop-color:#000000;stop-opacity:0;" offset="1" id="stop7133"/> | |||
|
24 | </linearGradient> | |||
|
25 | <radialGradient inkscape:collect="always" xlink:href="#linearGradient7129" id="radialGradient5955" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1,0,0,0.4320988,0,10.586385)" cx="11.313708" cy="18.641243" fx="11.313708" fy="18.641243" r="7.1594563"/> | |||
|
26 | <linearGradient inkscape:collect="always" xlink:href="#linearGradient6970" id="linearGradient6996" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.8421053,0,0,1.9998392,2.8157881,0.503458)" x1="10.5625" y1="11.850357" x2="10.5625" y2="7.0549741"/> | |||
|
27 | <linearGradient inkscape:collect="always" xlink:href="#linearGradient6962" id="linearGradient6998" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1.8421053,0,0,1.9998392,2.8157881,0.503458)" x1="8.4375" y1="11" x2="8.4375" y2="7.0917883"/> | |||
|
28 | <linearGradient inkscape:collect="always" xlink:href="#linearGradient6964" id="linearGradient7000" gradientUnits="userSpaceOnUse" x1="19.75" y1="22.500912" x2="19.75" y2="13.937252"/> | |||
|
29 | <linearGradient inkscape:collect="always" xlink:href="#linearGradient6975" id="linearGradient7002" gradientUnits="userSpaceOnUse" x1="22.539028" y1="41.65625" x2="23.246136" y2="31.736544"/> | |||
|
30 | </defs> | |||
|
31 | <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#494949" borderopacity="1" gridtolerance="10000" guidetolerance="10" objecttolerance="10" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="1" inkscape:cx="36.776007" inkscape:cy="31.76253" inkscape:document-units="px" inkscape:current-layer="layer1" width="48px" height="48px" inkscape:showpageshadow="false" inkscape:window-width="1063" inkscape:window-height="894" inkscape:window-x="128" inkscape:window-y="114" showgrid="false" gridspacingx="0.5px" gridspacingy="0.5px" gridempspacing="2" showborder="false" showguides="true" inkscape:guide-bbox="false" borderlayer="false" inkscape:grid-bbox="false" inkscape:grid-points="true"/> | |||
|
32 | <metadata id="metadata7859"> | |||
|
33 | <rdf:RDF> | |||
|
34 | <cc:Work rdf:about=""> | |||
|
35 | <dc:format>image/svg+xml</dc:format> | |||
|
36 | <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> | |||
|
37 | <dc:creator> | |||
|
38 | <cc:Agent> | |||
|
39 | <dc:title>Lapo Calamandrei</dc:title> | |||
|
40 | </cc:Agent> | |||
|
41 | </dc:creator> | |||
|
42 | <dc:source/> | |||
|
43 | <cc:license rdf:resource="http://creativecommons.org/licenses/GPL/2.0/"/> | |||
|
44 | <dc:title>Download</dc:title> | |||
|
45 | <dc:subject> | |||
|
46 | <rdf:Bag/> | |||
|
47 | </dc:subject> | |||
|
48 | </cc:Work> | |||
|
49 | <cc:License rdf:about="http://creativecommons.org/licenses/GPL/2.0/"> | |||
|
50 | <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/> | |||
|
51 | <cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/> | |||
|
52 | <cc:requires rdf:resource="http://web.resource.org/cc/Notice"/> | |||
|
53 | <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/> | |||
|
54 | <cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike"/> | |||
|
55 | <cc:requires rdf:resource="http://web.resource.org/cc/SourceCode"/> | |||
|
56 | </cc:License> | |||
|
57 | </rdf:RDF> | |||
|
58 | </metadata> | |||
|
59 | <g inkscape:label="Layer 1" inkscape:groupmode="layer" id="layer1"> | |||
|
60 | <path sodipodi:type="arc" style="opacity:0.15;fill:url(#radialGradient5955);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" id="path5975" sodipodi:cx="11.313708" sodipodi:cy="18.641243" sodipodi:rx="7.1594563" sodipodi:ry="3.0935922" d="M 18.473165 18.641243 A 7.1594563 3.0935922 0 1 1 4.1542521,18.641243 A 7.1594563 3.0935922 0 1 1 18.473165 18.641243 z" transform="matrix(2.5432565,0,0,1.5691033,-4.7736618,11.749965)"/> | |||
|
61 | <g id="g7012" transform="translate(0,-2)"> | |||
|
62 | <rect ry="4.4840183" rx="4.4840183" y="6.5206337" x="4.5084929" height="19.962349" width="38.987251" id="rect5987" style="fill:#d3d7cf;fill-opacity:1;fill-rule:evenodd;stroke:#888a85;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/> | |||
|
63 | <rect ry="2.0382936" rx="2.0382936" y="12.5" x="9.5" height="8" width="29" id="rect6983" style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:#babdb6;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/> | |||
|
64 | <rect ry="3.5065231" rx="3.5065231" y="7.5" x="5.5042353" height="18.003614" width="36.995766" id="rect6959" style="opacity:0.55;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/> | |||
|
65 | <rect ry="0.53477186" rx="0.53477186" y="14" x="11" height="5" width="15" id="rect5981" style="fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/> | |||
|
66 | </g> | |||
|
67 | <g id="g6991"> | |||
|
68 | <path sodipodi:nodetypes="cccccccc" id="path5977" d="M 18.506578,13.5 L 18.5,29.5 L 11.499998,29.501126 L 23.999999,43.5 L 36.499999,29.501126 L 29.520162,29.501126 L 29.520162,13.5 L 18.506578,13.5 z " style="color:#000000;fill:url(#linearGradient6996);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient6998);stroke-width:0.99999982;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/> | |||
|
69 | <path sodipodi:nodetypes="cccccccccc" id="path6962" d="M 19.5,12.5 L 19.5,28.5 C 19.499945,29.052262 19.052262,29.499945 18.5,29.5 L 13.71875,29.5 L 24,41 L 34.28125,29.5 L 29.53125,29.5 C 28.978988,29.499945 28.531305,29.052262 28.53125,28.5 L 28.53125,12.5 L 19.5,12.5 z " style="color:#000000;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient7000);stroke-width:0.99999982;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" transform="translate(0,1)"/> | |||
|
70 | <path transform="translate(0,1)" sodipodi:nodetypes="cscccccscc" id="path6973" d="M 19.0625,28.5 C 19.06368,28.649543 19.004796,28.793303 18.89905,28.89905 C 18.793303,29.004796 18.649543,29.06368 18.5,29.0625 L 12.75,29.0625 L 24,41.65625 L 35.25,29.0625 L 29.53125,29.0625 C 29.381707,29.06368 29.237947,29.004796 29.1322,28.89905 C 29.026454,28.793303 28.96757,28.649543 28.96875,28.5 L 19.0625,28.5 z " style="opacity:0.27238805;color:#000000;fill:url(#linearGradient7002);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999982;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"/> | |||
|
71 | </g> | |||
|
72 | </g> | |||
|
73 | </svg> No newline at end of file |
1 | NO CONTENT: new file 100644, binary diff hidden |
|
NO CONTENT: new file 100644, binary diff hidden |
@@ -0,0 +1,26 | |||||
|
1 | #include "cassinitoolssettingsgui.h" | |||
|
2 | #include "ui_cassinitoolssettingsgui.h" | |||
|
3 | ||||
|
4 | CassiniToolsSettingsGUI::CassiniToolsSettingsGUI(QWidget *parent) : | |||
|
5 | QWidget(parent), | |||
|
6 | ui(new Ui::CassiniToolsSettingsGUI) | |||
|
7 | { | |||
|
8 | ui->setupUi(this); | |||
|
9 | } | |||
|
10 | ||||
|
11 | CassiniToolsSettingsGUI::~CassiniToolsSettingsGUI() | |||
|
12 | { | |||
|
13 | delete ui; | |||
|
14 | } | |||
|
15 | ||||
|
16 | void CassiniToolsSettingsGUI::changeEvent(QEvent *e) | |||
|
17 | { | |||
|
18 | QWidget::changeEvent(e); | |||
|
19 | switch (e->type()) { | |||
|
20 | case QEvent::LanguageChange: | |||
|
21 | ui->retranslateUi(this); | |||
|
22 | break; | |||
|
23 | default: | |||
|
24 | break; | |||
|
25 | } | |||
|
26 | } |
@@ -0,0 +1,25 | |||||
|
1 | #ifndef CASSINITOOLSSETTINGSGUI_H | |||
|
2 | #define CASSINITOOLSSETTINGSGUI_H | |||
|
3 | ||||
|
4 | #include <QWidget> | |||
|
5 | ||||
|
6 | namespace Ui { | |||
|
7 | class CassiniToolsSettingsGUI; | |||
|
8 | } | |||
|
9 | ||||
|
10 | class CassiniToolsSettingsGUI : public QWidget | |||
|
11 | { | |||
|
12 | Q_OBJECT | |||
|
13 | ||||
|
14 | public: | |||
|
15 | explicit CassiniToolsSettingsGUI(QWidget *parent = 0); | |||
|
16 | ~CassiniToolsSettingsGUI(); | |||
|
17 | ||||
|
18 | protected: | |||
|
19 | void changeEvent(QEvent *e); | |||
|
20 | ||||
|
21 | private: | |||
|
22 | Ui::CassiniToolsSettingsGUI *ui; | |||
|
23 | }; | |||
|
24 | ||||
|
25 | #endif // CASSINITOOLSSETTINGSGUI_H |
@@ -0,0 +1,21 | |||||
|
1 | <ui version="4.0"> | |||
|
2 | <author/> | |||
|
3 | <comment/> | |||
|
4 | <exportmacro/> | |||
|
5 | <class>CassiniToolsSettingsGUI</class> | |||
|
6 | <widget name="CassiniToolsSettingsGUI" class="QWidget"> | |||
|
7 | <property name="geometry"> | |||
|
8 | <rect> | |||
|
9 | <x>0</x> | |||
|
10 | <y>0</y> | |||
|
11 | <width>400</width> | |||
|
12 | <height>300</height> | |||
|
13 | </rect> | |||
|
14 | </property> | |||
|
15 | <property name="windowTitle"> | |||
|
16 | <string>Form</string> | |||
|
17 | </property> | |||
|
18 | </widget> | |||
|
19 | <pixmapfunction/> | |||
|
20 | <connections/> | |||
|
21 | </ui> |
@@ -0,0 +1,61 | |||||
|
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 | #include "filedowloadersettingsgui.h" | |||
|
23 | #include "ui_filedowloadersettingsgui.h" | |||
|
24 | ||||
|
25 | FileDowloaderSettingsGUI::FileDowloaderSettingsGUI(QWidget *parent) : | |||
|
26 | QWidget(parent), | |||
|
27 | ui(new Ui::FileDowloaderSettingsGUI) | |||
|
28 | { | |||
|
29 | ui->setupUi(this); | |||
|
30 | this->manualProxyCFG_GUI = new ManualProxyCFG_GUI(); | |||
|
31 | lastWidget = NULL; | |||
|
32 | connect(this->ui->comboBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(proxyMethodChanged(QString))); | |||
|
33 | } | |||
|
34 | ||||
|
35 | FileDowloaderSettingsGUI::~FileDowloaderSettingsGUI() | |||
|
36 | { | |||
|
37 | delete ui; | |||
|
38 | } | |||
|
39 | ||||
|
40 | void FileDowloaderSettingsGUI::changeEvent(QEvent *e) | |||
|
41 | { | |||
|
42 | QWidget::changeEvent(e); | |||
|
43 | switch (e->type()) { | |||
|
44 | case QEvent::LanguageChange: | |||
|
45 | ui->retranslateUi(this); | |||
|
46 | break; | |||
|
47 | default: | |||
|
48 | break; | |||
|
49 | } | |||
|
50 | } | |||
|
51 | ||||
|
52 | void FileDowloaderSettingsGUI::proxyMethodChanged(const QString &text) | |||
|
53 | { | |||
|
54 | this->ui->gridLayout->removeWidget(this->lastWidget); | |||
|
55 | if(text=="manual") | |||
|
56 | { | |||
|
57 | this->ui->gridLayout->addWidget(this->manualProxyCFG_GUI,1,0,1,-1); | |||
|
58 | this->lastWidget = this->manualProxyCFG_GUI; | |||
|
59 | return; | |||
|
60 | } | |||
|
61 | } |
@@ -0,0 +1,51 | |||||
|
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 FILEDOWLOADERSETTINGSGUI_H | |||
|
23 | #define FILEDOWLOADERSETTINGSGUI_H | |||
|
24 | ||||
|
25 | #include <QWidget> | |||
|
26 | #include "manualproxycfg_gui.h" | |||
|
27 | ||||
|
28 | namespace Ui { | |||
|
29 | class FileDowloaderSettingsGUI; | |||
|
30 | } | |||
|
31 | ||||
|
32 | class FileDowloaderSettingsGUI : public QWidget | |||
|
33 | { | |||
|
34 | Q_OBJECT | |||
|
35 | ||||
|
36 | public: | |||
|
37 | explicit FileDowloaderSettingsGUI(QWidget *parent = 0); | |||
|
38 | ~FileDowloaderSettingsGUI(); | |||
|
39 | ||||
|
40 | protected: | |||
|
41 | void changeEvent(QEvent *e); | |||
|
42 | ||||
|
43 | private slots: | |||
|
44 | void proxyMethodChanged(const QString & text); | |||
|
45 | private: | |||
|
46 | ManualProxyCFG_GUI* manualProxyCFG_GUI; | |||
|
47 | Ui::FileDowloaderSettingsGUI *ui; | |||
|
48 | QWidget* lastWidget; | |||
|
49 | }; | |||
|
50 | ||||
|
51 | #endif // FILEDOWLOADERSETTINGSGUI_H |
@@ -0,0 +1,74 | |||||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |||
|
2 | <ui version="4.0"> | |||
|
3 | <class>FileDowloaderSettingsGUI</class> | |||
|
4 | <widget class="QWidget" name="FileDowloaderSettingsGUI"> | |||
|
5 | <property name="geometry"> | |||
|
6 | <rect> | |||
|
7 | <x>0</x> | |||
|
8 | <y>0</y> | |||
|
9 | <width>318</width> | |||
|
10 | <height>128</height> | |||
|
11 | </rect> | |||
|
12 | </property> | |||
|
13 | <property name="windowTitle"> | |||
|
14 | <string>Form</string> | |||
|
15 | </property> | |||
|
16 | <layout class="QFormLayout" name="formLayout"> | |||
|
17 | <item row="0" column="0"> | |||
|
18 | <widget class="QLabel" name="label"> | |||
|
19 | <property name="text"> | |||
|
20 | <string>Default destination path</string> | |||
|
21 | </property> | |||
|
22 | </widget> | |||
|
23 | </item> | |||
|
24 | <item row="0" column="1"> | |||
|
25 | <widget class="QLineEdit" name="lineEdit"/> | |||
|
26 | </item> | |||
|
27 | <item row="1" column="0" colspan="2"> | |||
|
28 | <widget class="QGroupBox" name="groupBox"> | |||
|
29 | <property name="title"> | |||
|
30 | <string>Proxy server</string> | |||
|
31 | </property> | |||
|
32 | <layout class="QGridLayout" name="gridLayout"> | |||
|
33 | <item row="0" column="0"> | |||
|
34 | <widget class="QLabel" name="label_2"> | |||
|
35 | <property name="text"> | |||
|
36 | <string>Method</string> | |||
|
37 | </property> | |||
|
38 | <property name="alignment"> | |||
|
39 | <set>Qt::AlignCenter</set> | |||
|
40 | </property> | |||
|
41 | </widget> | |||
|
42 | </item> | |||
|
43 | <item row="0" column="1"> | |||
|
44 | <widget class="QComboBox" name="comboBox"> | |||
|
45 | <item> | |||
|
46 | <property name="text"> | |||
|
47 | <string>none</string> | |||
|
48 | </property> | |||
|
49 | </item> | |||
|
50 | <item> | |||
|
51 | <property name="text"> | |||
|
52 | <string>system</string> | |||
|
53 | </property> | |||
|
54 | </item> | |||
|
55 | <item> | |||
|
56 | <property name="text"> | |||
|
57 | <string>manual</string> | |||
|
58 | </property> | |||
|
59 | </item> | |||
|
60 | <item> | |||
|
61 | <property name="text"> | |||
|
62 | <string>automatic</string> | |||
|
63 | </property> | |||
|
64 | </item> | |||
|
65 | </widget> | |||
|
66 | </item> | |||
|
67 | </layout> | |||
|
68 | </widget> | |||
|
69 | </item> | |||
|
70 | </layout> | |||
|
71 | </widget> | |||
|
72 | <resources/> | |||
|
73 | <connections/> | |||
|
74 | </ui> |
@@ -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 | #include "manualproxycfg_gui.h" | |||
|
23 | #include "ui_manualproxycfg_gui.h" | |||
|
24 | ||||
|
25 | ManualProxyCFG_GUI::ManualProxyCFG_GUI(QWidget *parent) : | |||
|
26 | QWidget(parent), | |||
|
27 | ui(new Ui::ManualProxyCFG_GUI) | |||
|
28 | { | |||
|
29 | ui->setupUi(this); | |||
|
30 | } | |||
|
31 | ||||
|
32 | ManualProxyCFG_GUI::~ManualProxyCFG_GUI() | |||
|
33 | { | |||
|
34 | delete ui; | |||
|
35 | } | |||
|
36 | ||||
|
37 | void ManualProxyCFG_GUI::changeEvent(QEvent *e) | |||
|
38 | { | |||
|
39 | QWidget::changeEvent(e); | |||
|
40 | switch (e->type()) { | |||
|
41 | case QEvent::LanguageChange: | |||
|
42 | ui->retranslateUi(this); | |||
|
43 | break; | |||
|
44 | default: | |||
|
45 | break; | |||
|
46 | } | |||
|
47 | } |
@@ -0,0 +1,46 | |||||
|
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 MANUALPROXYCFG_GUI_H | |||
|
23 | #define MANUALPROXYCFG_GUI_H | |||
|
24 | ||||
|
25 | #include <QWidget> | |||
|
26 | ||||
|
27 | namespace Ui { | |||
|
28 | class ManualProxyCFG_GUI; | |||
|
29 | } | |||
|
30 | ||||
|
31 | class ManualProxyCFG_GUI : public QWidget | |||
|
32 | { | |||
|
33 | Q_OBJECT | |||
|
34 | ||||
|
35 | public: | |||
|
36 | explicit ManualProxyCFG_GUI(QWidget *parent = 0); | |||
|
37 | ~ManualProxyCFG_GUI(); | |||
|
38 | ||||
|
39 | protected: | |||
|
40 | void changeEvent(QEvent *e); | |||
|
41 | ||||
|
42 | private: | |||
|
43 | Ui::ManualProxyCFG_GUI *ui; | |||
|
44 | }; | |||
|
45 | ||||
|
46 | #endif // MANUALPROXYCFG_GUI_H |
@@ -0,0 +1,109 | |||||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |||
|
2 | <ui version="4.0"> | |||
|
3 | <class>ManualProxyCFG_GUI</class> | |||
|
4 | <widget class="QWidget" name="ManualProxyCFG_GUI"> | |||
|
5 | <property name="geometry"> | |||
|
6 | <rect> | |||
|
7 | <x>0</x> | |||
|
8 | <y>0</y> | |||
|
9 | <width>423</width> | |||
|
10 | <height>207</height> | |||
|
11 | </rect> | |||
|
12 | </property> | |||
|
13 | <property name="windowTitle"> | |||
|
14 | <string>Form</string> | |||
|
15 | </property> | |||
|
16 | <layout class="QGridLayout" name="gridLayout"> | |||
|
17 | <item row="0" column="0"> | |||
|
18 | <widget class="QLabel" name="label"> | |||
|
19 | <property name="text"> | |||
|
20 | <string>HTTP proxy</string> | |||
|
21 | </property> | |||
|
22 | </widget> | |||
|
23 | </item> | |||
|
24 | <item row="0" column="1"> | |||
|
25 | <widget class="QLineEdit" name="httpHost"/> | |||
|
26 | </item> | |||
|
27 | <item row="1" column="0"> | |||
|
28 | <widget class="QLabel" name="label_2"> | |||
|
29 | <property name="text"> | |||
|
30 | <string>HTTPS proxy</string> | |||
|
31 | </property> | |||
|
32 | </widget> | |||
|
33 | </item> | |||
|
34 | <item row="1" column="1"> | |||
|
35 | <widget class="QLineEdit" name="httpsHost"/> | |||
|
36 | </item> | |||
|
37 | <item row="2" column="0"> | |||
|
38 | <widget class="QLabel" name="label_3"> | |||
|
39 | <property name="text"> | |||
|
40 | <string>FTP proxy</string> | |||
|
41 | </property> | |||
|
42 | </widget> | |||
|
43 | </item> | |||
|
44 | <item row="2" column="1"> | |||
|
45 | <widget class="QLineEdit" name="ftpHost"/> | |||
|
46 | </item> | |||
|
47 | <item row="3" column="0"> | |||
|
48 | <widget class="QLabel" name="label_4"> | |||
|
49 | <property name="text"> | |||
|
50 | <string>SOCKS proxy</string> | |||
|
51 | </property> | |||
|
52 | </widget> | |||
|
53 | </item> | |||
|
54 | <item row="3" column="1"> | |||
|
55 | <widget class="QLineEdit" name="socksHost"/> | |||
|
56 | </item> | |||
|
57 | <item row="4" column="0"> | |||
|
58 | <widget class="QLabel" name="label_5"> | |||
|
59 | <property name="text"> | |||
|
60 | <string>Ignore hosts</string> | |||
|
61 | </property> | |||
|
62 | </widget> | |||
|
63 | </item> | |||
|
64 | <item row="0" column="2"> | |||
|
65 | <widget class="QLineEdit" name="httpPort"> | |||
|
66 | <property name="sizePolicy"> | |||
|
67 | <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> | |||
|
68 | <horstretch>0</horstretch> | |||
|
69 | <verstretch>0</verstretch> | |||
|
70 | </sizepolicy> | |||
|
71 | </property> | |||
|
72 | <property name="inputMask"> | |||
|
73 | <string>000000</string> | |||
|
74 | </property> | |||
|
75 | </widget> | |||
|
76 | </item> | |||
|
77 | <item row="1" column="2"> | |||
|
78 | <widget class="QLineEdit" name="httpsPort"> | |||
|
79 | <property name="inputMask"> | |||
|
80 | <string>000000</string> | |||
|
81 | </property> | |||
|
82 | </widget> | |||
|
83 | </item> | |||
|
84 | <item row="2" column="2"> | |||
|
85 | <widget class="QLineEdit" name="ftpPort"> | |||
|
86 | <property name="inputMask"> | |||
|
87 | <string>000000</string> | |||
|
88 | </property> | |||
|
89 | </widget> | |||
|
90 | </item> | |||
|
91 | <item row="3" column="2"> | |||
|
92 | <widget class="QLineEdit" name="socksPort"> | |||
|
93 | <property name="inputMask"> | |||
|
94 | <string>000000</string> | |||
|
95 | </property> | |||
|
96 | </widget> | |||
|
97 | </item> | |||
|
98 | <item row="4" column="1" colspan="2"> | |||
|
99 | <widget class="QLineEdit" name="IgnoreHosts"> | |||
|
100 | <property name="text"> | |||
|
101 | <string>localhost, 127.0.0.0/8, ::1</string> | |||
|
102 | </property> | |||
|
103 | </widget> | |||
|
104 | </item> | |||
|
105 | </layout> | |||
|
106 | </widget> | |||
|
107 | <resources/> | |||
|
108 | <connections/> | |||
|
109 | </ui> |
@@ -0,0 +1,70 | |||||
|
1 | #include "qlopsettingsdialog.h" | |||
|
2 | #include "ui_qlopsettingsdialog.h" | |||
|
3 | ||||
|
4 | QLopSettingsDialog::QLopSettingsDialog(QWidget *parent) : | |||
|
5 | QDialog(parent), | |||
|
6 | ui(new Ui::QLopSettingsDialog) | |||
|
7 | { | |||
|
8 | ui->setupUi(this); | |||
|
9 | connect(ui->contentsWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)),this, SLOT(changePage(QListWidgetItem*,QListWidgetItem*))); | |||
|
10 | ui->contentsWidget->setViewMode(QListView::IconMode); | |||
|
11 | ui->contentsWidget->setIconSize(QSize(96, 84)); | |||
|
12 | ui->contentsWidget->setMovement(QListView::Static); | |||
|
13 | ui->contentsWidget->setSpacing(12); | |||
|
14 | } | |||
|
15 | ||||
|
16 | QLopSettingsDialog::~QLopSettingsDialog() | |||
|
17 | { | |||
|
18 | delete ui; | |||
|
19 | } | |||
|
20 | ||||
|
21 | void QLopSettingsDialog::changeEvent(QEvent *e) | |||
|
22 | { | |||
|
23 | QDialog::changeEvent(e); | |||
|
24 | switch (e->type()) { | |||
|
25 | case QEvent::LanguageChange: | |||
|
26 | ui->retranslateUi(this); | |||
|
27 | break; | |||
|
28 | default: | |||
|
29 | break; | |||
|
30 | } | |||
|
31 | } | |||
|
32 | ||||
|
33 | ||||
|
34 | void QLopSettingsDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous) | |||
|
35 | { | |||
|
36 | if (!current) | |||
|
37 | current = previous; | |||
|
38 | ||||
|
39 | ui->pagesWidget->setCurrentIndex(ui->contentsWidget->row(current)); | |||
|
40 | } | |||
|
41 | ||||
|
42 | bool QLopSettingsDialog::registerConfigEntry(QWidget *configEntry, QIcon icon, QString text) | |||
|
43 | { | |||
|
44 | if(configEntry!=NULL) | |||
|
45 | { | |||
|
46 | ui->pagesWidget->addWidget(configEntry); | |||
|
47 | QListWidgetItem *configButton = new QListWidgetItem(ui->contentsWidget); | |||
|
48 | configButton->setIcon(icon); | |||
|
49 | configButton->setText(text); | |||
|
50 | configButton->setTextAlignment(Qt::AlignHCenter); | |||
|
51 | configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); | |||
|
52 | return true; | |||
|
53 | } | |||
|
54 | return false; | |||
|
55 | } | |||
|
56 | ||||
|
57 | void QLopSettingsDialog::popConfigDialog(QWidget *selectedConfigEntry) | |||
|
58 | { | |||
|
59 | if(selectedConfigEntry!=NULL) | |||
|
60 | { | |||
|
61 | for(int i=0;i<ui->pagesWidget->count();i++) | |||
|
62 | { | |||
|
63 | if(ui->pagesWidget->widget(i)==selectedConfigEntry) | |||
|
64 | { | |||
|
65 | ui->pagesWidget->setCurrentIndex(i); | |||
|
66 | } | |||
|
67 | } | |||
|
68 | } | |||
|
69 | this->show(); | |||
|
70 | } |
@@ -0,0 +1,30 | |||||
|
1 | #ifndef QLOPSETTINGSDIALOG_H | |||
|
2 | #define QLOPSETTINGSDIALOG_H | |||
|
3 | ||||
|
4 | #include <QDialog> | |||
|
5 | ||||
|
6 | namespace Ui { | |||
|
7 | class QLopSettingsDialog; | |||
|
8 | } | |||
|
9 | #include <QListWidgetItem> | |||
|
10 | ||||
|
11 | class QLopSettingsDialog : public QDialog | |||
|
12 | { | |||
|
13 | Q_OBJECT | |||
|
14 | ||||
|
15 | public: | |||
|
16 | explicit QLopSettingsDialog(QWidget *parent = 0); | |||
|
17 | ~QLopSettingsDialog(); | |||
|
18 | ||||
|
19 | public slots: | |||
|
20 | void changePage(QListWidgetItem *current, QListWidgetItem *previous); | |||
|
21 | bool registerConfigEntry(QWidget* configEntry, QIcon icon, QString text); | |||
|
22 | void popConfigDialog(QWidget* selectedConfigEntry=0); | |||
|
23 | protected: | |||
|
24 | void changeEvent(QEvent *e); | |||
|
25 | ||||
|
26 | private: | |||
|
27 | Ui::QLopSettingsDialog *ui; | |||
|
28 | }; | |||
|
29 | ||||
|
30 | #endif // QLOPSETTINGSDIALOG_H |
@@ -0,0 +1,102 | |||||
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |||
|
2 | <ui version="4.0"> | |||
|
3 | <class>QLopSettingsDialog</class> | |||
|
4 | <widget class="QDialog" name="QLopSettingsDialog"> | |||
|
5 | <property name="geometry"> | |||
|
6 | <rect> | |||
|
7 | <x>0</x> | |||
|
8 | <y>0</y> | |||
|
9 | <width>534</width> | |||
|
10 | <height>379</height> | |||
|
11 | </rect> | |||
|
12 | </property> | |||
|
13 | <property name="windowTitle"> | |||
|
14 | <string>Dialog</string> | |||
|
15 | </property> | |||
|
16 | <layout class="QGridLayout" name="gridLayout"> | |||
|
17 | <item row="0" column="0"> | |||
|
18 | <widget class="QListWidget" name="contentsWidget"> | |||
|
19 | <property name="sizePolicy"> | |||
|
20 | <sizepolicy hsizetype="Maximum" vsizetype="Expanding"> | |||
|
21 | <horstretch>0</horstretch> | |||
|
22 | <verstretch>0</verstretch> | |||
|
23 | </sizepolicy> | |||
|
24 | </property> | |||
|
25 | <property name="minimumSize"> | |||
|
26 | <size> | |||
|
27 | <width>100</width> | |||
|
28 | <height>0</height> | |||
|
29 | </size> | |||
|
30 | </property> | |||
|
31 | <property name="maximumSize"> | |||
|
32 | <size> | |||
|
33 | <width>16777215</width> | |||
|
34 | <height>16777215</height> | |||
|
35 | </size> | |||
|
36 | </property> | |||
|
37 | </widget> | |||
|
38 | </item> | |||
|
39 | <item row="0" column="1"> | |||
|
40 | <widget class="QStackedWidget" name="pagesWidget"> | |||
|
41 | <property name="sizePolicy"> | |||
|
42 | <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> | |||
|
43 | <horstretch>0</horstretch> | |||
|
44 | <verstretch>0</verstretch> | |||
|
45 | </sizepolicy> | |||
|
46 | </property> | |||
|
47 | <property name="minimumSize"> | |||
|
48 | <size> | |||
|
49 | <width>100</width> | |||
|
50 | <height>0</height> | |||
|
51 | </size> | |||
|
52 | </property> | |||
|
53 | </widget> | |||
|
54 | </item> | |||
|
55 | <item row="1" column="0" colspan="2"> | |||
|
56 | <widget class="QDialogButtonBox" name="buttonBox"> | |||
|
57 | <property name="orientation"> | |||
|
58 | <enum>Qt::Horizontal</enum> | |||
|
59 | </property> | |||
|
60 | <property name="standardButtons"> | |||
|
61 | <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> | |||
|
62 | </property> | |||
|
63 | </widget> | |||
|
64 | </item> | |||
|
65 | </layout> | |||
|
66 | </widget> | |||
|
67 | <resources/> | |||
|
68 | <connections> | |||
|
69 | <connection> | |||
|
70 | <sender>buttonBox</sender> | |||
|
71 | <signal>accepted()</signal> | |||
|
72 | <receiver>QLopSettingsDialog</receiver> | |||
|
73 | <slot>accept()</slot> | |||
|
74 | <hints> | |||
|
75 | <hint type="sourcelabel"> | |||
|
76 | <x>227</x> | |||
|
77 | <y>431</y> | |||
|
78 | </hint> | |||
|
79 | <hint type="destinationlabel"> | |||
|
80 | <x>157</x> | |||
|
81 | <y>274</y> | |||
|
82 | </hint> | |||
|
83 | </hints> | |||
|
84 | </connection> | |||
|
85 | <connection> | |||
|
86 | <sender>buttonBox</sender> | |||
|
87 | <signal>rejected()</signal> | |||
|
88 | <receiver>QLopSettingsDialog</receiver> | |||
|
89 | <slot>reject()</slot> | |||
|
90 | <hints> | |||
|
91 | <hint type="sourcelabel"> | |||
|
92 | <x>295</x> | |||
|
93 | <y>431</y> | |||
|
94 | </hint> | |||
|
95 | <hint type="destinationlabel"> | |||
|
96 | <x>286</x> | |||
|
97 | <y>274</y> | |||
|
98 | </hint> | |||
|
99 | </hints> | |||
|
100 | </connection> | |||
|
101 | </connections> | |||
|
102 | </ui> |
@@ -0,0 +1,110 | |||||
|
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 | #include "qlopgui.h" | |||
|
23 | QLopGUI* QLopGUI::_self=NULL; | |||
|
24 | QDockWidget* QLopGUI::m_gui=NULL; | |||
|
25 | QMenuBar* QLopGUI::m_mainMenuBar=NULL; | |||
|
26 | QMenu* QLopGUI::m_fileMenu=NULL; | |||
|
27 | QMenu* QLopGUI::m_SettingsMenu=NULL; | |||
|
28 | ||||
|
29 | #define INIT() \ | |||
|
30 | if(Q_UNLIKELY(_self==NULL))\ | |||
|
31 | {\ | |||
|
32 | init();\ | |||
|
33 | } | |||
|
34 | ||||
|
35 | QLopGUI::QLopGUI(bool noGUI,QObject *parent) | |||
|
36 | { | |||
|
37 | m_serviceName="QLopGUI"; | |||
|
38 | m_noGui=noGUI; | |||
|
39 | } | |||
|
40 | ||||
|
41 | QLopGUI::~QLopGUI() | |||
|
42 | { | |||
|
43 | ||||
|
44 | } | |||
|
45 | ||||
|
46 | QDockWidget *QLopGUI::getGUI() | |||
|
47 | { | |||
|
48 | return m_gui; | |||
|
49 | } | |||
|
50 | ||||
|
51 | void QLopGUI::init(bool noGUI, QObject *parent) | |||
|
52 | { | |||
|
53 | _self=new QLopGUI(noGUI,parent); | |||
|
54 | } | |||
|
55 | ||||
|
56 | const QString &QLopGUI::serviceName() | |||
|
57 | { | |||
|
58 | INIT(); | |||
|
59 | return m_serviceName; | |||
|
60 | } | |||
|
61 | ||||
|
62 | QLopGUI *QLopGUI::self() | |||
|
63 | { | |||
|
64 | INIT(); | |||
|
65 | return _self; | |||
|
66 | } | |||
|
67 | ||||
|
68 | void QLopGUI::registerMenuBar(QMenuBar *menuBar) | |||
|
69 | { | |||
|
70 | INIT(); | |||
|
71 | m_mainMenuBar = menuBar; | |||
|
72 | if(m_mainMenuBar) | |||
|
73 | { | |||
|
74 | m_fileMenu = m_mainMenuBar->addMenu(tr("File")); | |||
|
75 | m_SettingsMenu = m_mainMenuBar->addMenu(tr("Settings")); | |||
|
76 | } | |||
|
77 | } | |||
|
78 | ||||
|
79 | QMenu *QLopGUI::addMenu(const QString &title) | |||
|
80 | { | |||
|
81 | INIT(); | |||
|
82 | if(m_mainMenuBar) | |||
|
83 | { | |||
|
84 | return m_mainMenuBar->addMenu(title); | |||
|
85 | } | |||
|
86 | return NULL; | |||
|
87 | } | |||
|
88 | ||||
|
89 | bool QLopGUI::addFileAction(QAction *action) | |||
|
90 | { | |||
|
91 | INIT(); | |||
|
92 | if(m_fileMenu) | |||
|
93 | { | |||
|
94 | m_fileMenu->addAction(action); | |||
|
95 | return true; | |||
|
96 | } | |||
|
97 | return false; | |||
|
98 | } | |||
|
99 | ||||
|
100 | bool QLopGUI::addSettingsAction(QAction *action) | |||
|
101 | { | |||
|
102 | INIT(); | |||
|
103 | if(m_SettingsMenu) | |||
|
104 | { | |||
|
105 | m_SettingsMenu->addAction(action); | |||
|
106 | return true; | |||
|
107 | } | |||
|
108 | return false; | |||
|
109 | } | |||
|
110 |
@@ -0,0 +1,52 | |||||
|
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 QLOPGUI_H | |||
|
23 | #define QLOPGUI_H | |||
|
24 | ||||
|
25 | #include <QObject> | |||
|
26 | #include <qlopservice.h> | |||
|
27 | #include <QMenu> | |||
|
28 | #include <QMenuBar> | |||
|
29 | #include <QAction> | |||
|
30 | ||||
|
31 | class QLopGUI : public QLopService | |||
|
32 | { | |||
|
33 | Q_OBJECT | |||
|
34 | static QDockWidget* m_gui; | |||
|
35 | QLopGUI(bool noGUI=false,QObject *parent = 0); | |||
|
36 | ~QLopGUI(); | |||
|
37 | static QLopGUI* _self; | |||
|
38 | static QMenuBar* m_mainMenuBar; | |||
|
39 | static QMenu* m_fileMenu; | |||
|
40 | static QMenu* m_SettingsMenu; | |||
|
41 | public: | |||
|
42 | QDockWidget* getGUI(); | |||
|
43 | static void init(bool noGUI=false,QObject *parent = 0); | |||
|
44 | const QString& serviceName(); | |||
|
45 | static QLopGUI* self(); | |||
|
46 | static void registerMenuBar(QMenuBar* menuBar); | |||
|
47 | static QMenu* addMenu(const QString & title); | |||
|
48 | static bool addFileAction(QAction * action); | |||
|
49 | static bool addSettingsAction(QAction * action); | |||
|
50 | }; | |||
|
51 | ||||
|
52 | #endif // QLOPGUI_H |
@@ -0,0 +1,98 | |||||
|
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 | #include "qlopsettings.h" | |||
|
23 | #include <QtWidgets> | |||
|
24 | #include <QAction> | |||
|
25 | #include <qlopgui.h> | |||
|
26 | ||||
|
27 | QLopSettings* QLopSettings::_self=NULL; | |||
|
28 | QDockWidget* QLopSettings::m_gui=NULL; | |||
|
29 | QSettings* QLopSettings::m_settings=NULL; | |||
|
30 | QLopSettingsDialog* QLopSettings::m_configDialog=NULL; | |||
|
31 | ||||
|
32 | #define INIT() \ | |||
|
33 | if(Q_UNLIKELY(_self==NULL))\ | |||
|
34 | {\ | |||
|
35 | init();\ | |||
|
36 | } | |||
|
37 | ||||
|
38 | QLopSettings::QLopSettings(bool noGUI,QObject *parent) : QLopService(parent) | |||
|
39 | { | |||
|
40 | m_serviceName="QLopSettings"; | |||
|
41 | m_settings = new QSettings(); | |||
|
42 | m_noGui=noGUI; | |||
|
43 | m_configDialog = new QLopSettingsDialog(); | |||
|
44 | QAction* trigerGUI = new QAction(tr("Settings"),this); | |||
|
45 | connect(trigerGUI,SIGNAL(triggered()),this,SLOT(popConfigDialog())); | |||
|
46 | QLopGUI::addSettingsAction(trigerGUI); | |||
|
47 | } | |||
|
48 | ||||
|
49 | QLopSettings::~QLopSettings() | |||
|
50 | { | |||
|
51 | delete m_configDialog; | |||
|
52 | delete m_settings; | |||
|
53 | } | |||
|
54 | ||||
|
55 | QDockWidget *QLopSettings::getGUI() | |||
|
56 | { | |||
|
57 | if(!m_noGui && (m_gui==NULL)) | |||
|
58 | { | |||
|
59 | // m_gui=new QLopDataBaseViewer(); | |||
|
60 | // m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); | |||
|
61 | } | |||
|
62 | return m_gui; | |||
|
63 | } | |||
|
64 | ||||
|
65 | void QLopSettings::init(bool noGUI, QObject *parent) | |||
|
66 | { | |||
|
67 | _self=new QLopSettings(noGUI,parent); | |||
|
68 | } | |||
|
69 | ||||
|
70 | const QString &QLopSettings::serviceName() | |||
|
71 | { | |||
|
72 | INIT(); | |||
|
73 | return m_serviceName; | |||
|
74 | } | |||
|
75 | ||||
|
76 | QLopSettings *QLopSettings::self() | |||
|
77 | { | |||
|
78 | INIT(); | |||
|
79 | return _self; | |||
|
80 | } | |||
|
81 | ||||
|
82 | void QLopSettings::popConfigDialog(QWidget *selectedConfigEntry) | |||
|
83 | { | |||
|
84 | INIT(); | |||
|
85 | m_configDialog->popConfigDialog(selectedConfigEntry); | |||
|
86 | } | |||
|
87 | ||||
|
88 | void QLopSettings::popConfigDialog() | |||
|
89 | { | |||
|
90 | m_configDialog->popConfigDialog(NULL); | |||
|
91 | } | |||
|
92 | ||||
|
93 | bool QLopSettings::registerConfigEntry(QWidget *configEntry, QIcon icon, QString text) | |||
|
94 | { | |||
|
95 | INIT(); | |||
|
96 | return m_configDialog->registerConfigEntry(configEntry, icon, text); | |||
|
97 | } | |||
|
98 |
@@ -0,0 +1,53 | |||||
|
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 QLOPSETTINGS_H | |||
|
23 | #define QLOPSETTINGS_H | |||
|
24 | ||||
|
25 | #include <QObject> | |||
|
26 | #include <qlopservice.h> | |||
|
27 | #include <QSettings> | |||
|
28 | #include <QDialog> | |||
|
29 | #include <QIcon> | |||
|
30 | #include <qlopsettingsdialog.h> | |||
|
31 | ||||
|
32 | ||||
|
33 | class QLopSettings : public QLopService | |||
|
34 | { | |||
|
35 | Q_OBJECT | |||
|
36 | static QDockWidget* m_gui; | |||
|
37 | QLopSettings(bool noGUI=false,QObject *parent = 0); | |||
|
38 | ~QLopSettings(); | |||
|
39 | static QLopSettings* _self; | |||
|
40 | static QSettings* m_settings; | |||
|
41 | static QLopSettingsDialog* m_configDialog; | |||
|
42 | public: | |||
|
43 | QDockWidget* getGUI(); | |||
|
44 | static void init(bool noGUI=false,QObject *parent = 0); | |||
|
45 | const QString& serviceName(); | |||
|
46 | static QLopSettings* self(); | |||
|
47 | static void popConfigDialog(QWidget* selectedConfigEntry); | |||
|
48 | static bool registerConfigEntry(QWidget* configEntry,QIcon icon, QString text); | |||
|
49 | public slots: | |||
|
50 | void popConfigDialog(); | |||
|
51 | }; | |||
|
52 | ||||
|
53 | #endif // QLOPSETTINGS_H |
@@ -1,143 +1,164 | |||||
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 | defined(QLOP_DEBUG,var){ | |
29 |
QMAKE_ |
|
29 | QMAKE_CXXFLAGS += -O0 -fopenmp | |
30 |
|
|
30 | QMAKE_LFLAGS += -O0 -fopenmp | |
31 | #QMAKE_LFLAGS += -O0 -fopenmp |
|
31 | } | |
|
32 | !defined(QLOP_DEBUG,var){ | |||
|
33 | QMAKE_CXXFLAGS += -O5 -fopenmp | |||
|
34 | QMAKE_LFLAGS += -O5 -fopenmp | |||
|
35 | } | |||
|
36 | ||||
32 |
|
37 | |||
33 | SOURCES += src/main.cpp\ |
|
38 | SOURCES += src/main.cpp\ | |
34 | src/mainwindow.cpp \ |
|
39 | src/mainwindow.cpp \ | |
35 | src/SocExplorerPlot.cpp \ |
|
40 | src/SocExplorerPlot.cpp \ | |
36 | src/QCustomPlot/qcustomplot.cpp \ |
|
41 | src/QCustomPlot/qcustomplot.cpp \ | |
37 | src/toolbarcontainer.cpp \ |
|
42 | src/toolbarcontainer.cpp \ | |
38 | src/Core/abstractfileloader.cpp \ |
|
43 | src/Core/abstractfileloader.cpp \ | |
39 | src/Core/filedownloader.cpp \ |
|
44 | src/Core/filedownloader.cpp \ | |
40 | src/Core/filedownloadertask.cpp \ |
|
45 | src/Core/filedownloadertask.cpp \ | |
41 | src/Core/Widgets/downloadhistory.cpp \ |
|
46 | src/Core/Widgets/downloadhistory.cpp \ | |
42 | src/Core/Widgets/downloadhistoryelement.cpp \ |
|
47 | src/Core/Widgets/downloadhistoryelement.cpp \ | |
43 | src/Core/qlopservice.cpp \ |
|
48 | src/Core/qlopservice.cpp \ | |
44 | src/Cassini/expxmldownloader.cpp \ |
|
49 | src/Cassini/expxmldownloader.cpp \ | |
45 | src/Cassini/cassinidatadownloader.cpp \ |
|
50 | src/Cassini/cassinidatadownloader.cpp \ | |
46 | src/Cassini/cassinidatafile.cpp \ |
|
51 | src/Cassini/cassinidatafile.cpp \ | |
47 | src/Cassini/cassiniindexfile.cpp \ |
|
52 | src/Cassini/cassiniindexfile.cpp \ | |
48 | src/Cassini/cassiniindexfileviewer.cpp \ |
|
53 | src/Cassini/cassiniindexfileviewer.cpp \ | |
49 | src/Cassini/cassinitools.cpp \ |
|
54 | src/Cassini/cassinitools.cpp \ | |
50 | src/Cassini/cassinitoolsgui.cpp \ |
|
55 | src/Cassini/cassinitoolsgui.cpp \ | |
51 | src/Core/Widgets/qlopplots.cpp \ |
|
56 | src/Core/Widgets/qlopplots.cpp \ | |
52 | src/Core/qlopdata.cpp \ |
|
57 | src/Core/qlopdata.cpp \ | |
53 | src/Core/Widgets/PyWdgt/pythonconsole.cpp \ |
|
58 | src/Core/Widgets/PyWdgt/pythonconsole.cpp \ | |
54 | src/Core/Widgets/PyWdgt/pythonqtscriptingconsoledandd.cpp \ |
|
59 | src/Core/Widgets/PyWdgt/pythonqtscriptingconsoledandd.cpp \ | |
55 | src/QCustomPlot/qcpdocumentobject.cpp \ |
|
60 | src/QCustomPlot/qcpdocumentobject.cpp \ | |
56 | src/Core/Widgets/filebrowser.cpp \ |
|
61 | src/Core/Widgets/filebrowser.cpp \ | |
57 | src/Core/Widgets/filesystemmodel.cpp \ |
|
62 | src/Core/Widgets/filesystemmodel.cpp \ | |
58 | src/Core/Widgets/qcustomplotvect.cpp \ |
|
63 | src/Core/Widgets/qcustomplotvect.cpp \ | |
59 | src/Core/qlopdatabase.cpp \ |
|
64 | src/Core/qlopdatabase.cpp \ | |
60 | src/Core/Widgets/qlopdatabaseviewer.cpp \ |
|
65 | src/Core/Widgets/qlopdatabaseviewer.cpp \ | |
61 | src/Core/Widgets/qlopdatabaseviewermodel.cpp \ |
|
66 | src/Core/Widgets/qlopdatabaseviewermodel.cpp \ | |
62 | src/Cassini/exptimetabledownloader.cpp |
|
67 | src/Cassini/exptimetabledownloader.cpp \ | |
|
68 | src/Core/qlopsettings.cpp \ | |||
|
69 | src/Core/Widgets/filedowloadersettingsgui.cpp \ | |||
|
70 | src/Core/qlopgui.cpp \ | |||
|
71 | src/Core/Widgets/manualproxycfg_gui.cpp \ | |||
|
72 | src/Core/Widgets/qlopsettingsdialog.cpp \ | |||
|
73 | src/Cassini/cassinitoolssettingsgui.cpp | |||
63 |
|
74 | |||
64 | HEADERS += src/mainwindow.h \ |
|
75 | HEADERS += src/mainwindow.h \ | |
65 | src/SocExplorerPlot.h \ |
|
76 | src/SocExplorerPlot.h \ | |
66 | src/QCustomPlot/qcustomplot.h \ |
|
77 | src/QCustomPlot/qcustomplot.h \ | |
67 | src/toolbarcontainer.h \ |
|
78 | src/toolbarcontainer.h \ | |
68 | src/Core/abstractfileloader.h \ |
|
79 | src/Core/abstractfileloader.h \ | |
69 | src/Core/filedownloader.h \ |
|
80 | src/Core/filedownloader.h \ | |
70 | src/Core/filedownloadertask.h \ |
|
81 | src/Core/filedownloadertask.h \ | |
71 | src/Core/Widgets/downloadhistory.h \ |
|
82 | src/Core/Widgets/downloadhistory.h \ | |
72 | src/Core/Widgets/downloadhistoryelement.h \ |
|
83 | src/Core/Widgets/downloadhistoryelement.h \ | |
73 | src/Core/qlopservice.h \ |
|
84 | src/Core/qlopservice.h \ | |
74 | src/Cassini/expxmldownloader.h \ |
|
85 | src/Cassini/expxmldownloader.h \ | |
75 | src/Cassini/cassinidatadownloader.h \ |
|
86 | src/Cassini/cassinidatadownloader.h \ | |
76 | src/Cassini/cassinidatafile.h \ |
|
87 | src/Cassini/cassinidatafile.h \ | |
77 | src/Cassini/cassiniindexfile.h \ |
|
88 | src/Cassini/cassiniindexfile.h \ | |
78 | src/Cassini/cassiniindexfileviewer.h \ |
|
89 | src/Cassini/cassiniindexfileviewer.h \ | |
79 | src/Cassini/cassinitools.h \ |
|
90 | src/Cassini/cassinitools.h \ | |
80 | src/Cassini/cassinitoolsgui.h \ |
|
91 | src/Cassini/cassinitoolsgui.h \ | |
81 | src/Core/Widgets/qlopplots.h \ |
|
92 | src/Core/Widgets/qlopplots.h \ | |
82 | src/Core/qlopdata.h \ |
|
93 | src/Core/qlopdata.h \ | |
83 | src/Core/Widgets/PyWdgt/pythonconsole.h \ |
|
94 | src/Core/Widgets/PyWdgt/pythonconsole.h \ | |
84 | src/Core/Widgets/PyWdgt/pythonqtscriptingconsoledandd.h \ |
|
95 | src/Core/Widgets/PyWdgt/pythonqtscriptingconsoledandd.h \ | |
85 | src/Core/qlop.h \ |
|
96 | src/Core/qlop.h \ | |
86 | src/Core/pyqlop.h \ |
|
97 | src/Core/pyqlop.h \ | |
87 | src/QCustomPlot/qcpdocumentobject.h \ |
|
98 | src/QCustomPlot/qcpdocumentobject.h \ | |
88 | src/Core/Widgets/filebrowser.h \ |
|
99 | src/Core/Widgets/filebrowser.h \ | |
89 | src/Core/Widgets/filesystemmodel.h \ |
|
100 | src/Core/Widgets/filesystemmodel.h \ | |
90 | src/Core/Widgets/qcustomplotvect.h \ |
|
101 | src/Core/Widgets/qcustomplotvect.h \ | |
91 | src/Core/qlopdatabase.h \ |
|
102 | src/Core/qlopdatabase.h \ | |
92 | src/Core/Widgets/qlopdatabaseviewer.h \ |
|
103 | src/Core/Widgets/qlopdatabaseviewer.h \ | |
93 | src/Core/Widgets/qlopdatabaseviewermodel.h \ |
|
104 | src/Core/Widgets/qlopdatabaseviewermodel.h \ | |
94 | src/Cassini/exptimetabledownloader.h |
|
105 | src/Cassini/exptimetabledownloader.h \ | |
|
106 | src/Core/qlopsettings.h \ | |||
|
107 | src/Core/Widgets/filedowloadersettingsgui.h \ | |||
|
108 | src/Core/qlopgui.h \ | |||
|
109 | src/Core/Widgets/manualproxycfg_gui.h \ | |||
|
110 | src/Core/Widgets/qlopsettingsdialog.h \ | |||
|
111 | src/Cassini/cassinitoolssettingsgui.h | |||
95 |
|
112 | |||
96 | FORMS += src/mainwindow.ui \ |
|
113 | FORMS += src/mainwindow.ui \ | |
97 | src/Core/Widgets/downloadhistory.ui \ |
|
114 | src/Core/Widgets/downloadhistory.ui \ | |
98 | src/Core/Widgets/downloadhistoryelement.ui \ |
|
115 | src/Core/Widgets/downloadhistoryelement.ui \ | |
99 | src/Cassini/cassinidatadownloader.ui \ |
|
116 | src/Cassini/cassinidatadownloader.ui \ | |
100 | src/Cassini/cassiniindexfileviewer.ui \ |
|
117 | src/Cassini/cassiniindexfileviewer.ui \ | |
101 | src/Cassini/cassinitoolsgui.ui \ |
|
118 | src/Cassini/cassinitoolsgui.ui \ | |
102 | src/Core/Widgets/filebrowser.ui \ |
|
119 | src/Core/Widgets/filebrowser.ui \ | |
103 | src/Core/Widgets/qlopdatabaseviewer.ui |
|
120 | src/Core/Widgets/qlopdatabaseviewer.ui \ | |
|
121 | src/Core/Widgets/filedowloadersettingsgui.ui \ | |||
|
122 | src/Core/Widgets/manualproxycfg_gui.ui \ | |||
|
123 | src/Core/Widgets/qlopsettingsdialog.ui \ | |||
|
124 | src/Cassini/cassinitoolssettingsgui.ui | |||
104 |
|
125 | |||
105 | RESOURCES += \ |
|
126 | RESOURCES += \ | |
106 | resources/qlop.qrc |
|
127 | resources/qlop.qrc | |
107 |
|
128 | |||
108 | include(src/Core/Widgets/NicePyConsole/NicePyConsole.pri) |
|
129 | include(src/Core/Widgets/NicePyConsole/NicePyConsole.pri) | |
109 | include(src/Core/pythonQtOut/generated_cpp/PyQLop/PyQLop.pri) |
|
130 | include(src/Core/pythonQtOut/generated_cpp/PyQLop/PyQLop.pri) | |
110 |
|
131 | |||
111 | win32 { |
|
132 | win32 { | |
112 | DEFINES += WIN32 |
|
133 | DEFINES += WIN32 | |
113 | } |
|
134 | } | |
114 |
|
135 | |||
115 | unix { |
|
136 | unix { | |
116 | DEFINES += UNIX |
|
137 | DEFINES += UNIX | |
117 | } |
|
138 | } | |
118 |
|
139 | |||
119 | unix{ |
|
140 | unix{ | |
120 | target.path = /usr/bin |
|
141 | target.path = /usr/bin | |
121 | INSTALLS += target |
|
142 | INSTALLS += target | |
122 | } |
|
143 | } | |
123 |
|
144 | |||
124 |
|
145 | |||
125 | unix{ |
|
146 | unix{ | |
126 | QLopLauncher.path = /usr/share/applications/ |
|
147 | QLopLauncher.path = /usr/share/applications/ | |
127 | QLopLauncher.files = linux/QLop.desktop |
|
148 | QLopLauncher.files = linux/QLop.desktop | |
128 | QLopAppData.path = /usr/share/appdata/ |
|
149 | QLopAppData.path = /usr/share/appdata/ | |
129 | QLopAppData.files = linux/QLop.appdata.xml |
|
150 | QLopAppData.files = linux/QLop.appdata.xml | |
130 | share.path = /usr/share/QLop |
|
151 | share.path = /usr/share/QLop | |
131 | share.files = resources/QLop.svg \ |
|
152 | share.files = resources/QLop.svg \ | |
132 | resources/QLop.png |
|
153 | resources/QLop.png | |
133 |
|
154 | |||
134 | INSTALLS+= QLopLauncher share QLopAppData |
|
155 | INSTALLS+= QLopLauncher share QLopAppData | |
135 | } |
|
156 | } | |
136 |
|
157 | |||
137 | DISTFILES += \ |
|
158 | DISTFILES += \ | |
138 | src/Core/pythongenerator.sh \ |
|
159 | src/Core/pythongenerator.sh \ | |
139 | src/Core/pythonQtgeneratorCfg.txt \ |
|
160 | src/Core/pythonQtgeneratorCfg.txt \ | |
140 | linux/QLop.spec \ |
|
161 | linux/QLop.spec \ | |
141 | linux/QLop.desktop \ |
|
162 | linux/QLop.desktop \ | |
142 | linux/QLop.appdata.xml |
|
163 | linux/QLop.appdata.xml | |
143 |
|
164 |
@@ -1,13 +1,15 | |||||
1 | <RCC> |
|
1 | <RCC> | |
2 | <qresource prefix="/img"> |
|
2 | <qresource prefix="/img"> | |
3 | <file>Gnome-view-refresh.svg</file> |
|
3 | <file>Gnome-view-refresh.svg</file> | |
4 | <file>Gnome-list-add.svg</file> |
|
4 | <file>Gnome-list-add.svg</file> | |
5 | <file>ListView.svg</file> |
|
5 | <file>ListView.svg</file> | |
6 | <file>TreeView.svg</file> |
|
6 | <file>TreeView.svg</file> | |
7 | <file>Gnome-go-up.svg</file> |
|
7 | <file>Gnome-go-up.svg</file> | |
8 | <file>QLop.svg</file> |
|
8 | <file>QLop.svg</file> | |
|
9 | <file>Gnome-emblem-downloads.svg</file> | |||
|
10 | <file>cassini.gif</file> | |||
9 | </qresource> |
|
11 | </qresource> | |
10 | <qresource prefix="/"> |
|
12 | <qresource prefix="/"> | |
11 | <file>QLop.png</file> |
|
13 | <file>QLop.png</file> | |
12 | </qresource> |
|
14 | </qresource> | |
13 | </RCC> |
|
15 | </RCC> |
@@ -1,102 +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="2" column="0"> |
|
57 | <item row="2" column="0"> | |
58 |
<widget class="QGroupBox" name=" |
|
58 | <widget class="QGroupBox" name="DownLoadList"> | |
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="3" column="0"> |
|
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"> |
|
85 | <item row="1" column="0"> | |
86 | <widget class="QPushButton" name="LoadTimeTableQpb"> |
|
86 | <widget class="QPushButton" name="LoadTimeTableQpb"> | |
87 | <property name="text"> |
|
87 | <property name="text"> | |
88 | <string>Load a Time Table</string> |
|
88 | <string>Load a Time Table</string> | |
89 | </property> |
|
89 | </property> | |
90 | </widget> |
|
90 | </widget> | |
91 | </item> |
|
91 | </item> | |
92 | </layout> |
|
92 | </layout> | |
93 | </widget> |
|
93 | </widget> | |
94 | </widget> |
|
94 | </widget> | |
95 | </item> |
|
95 | </item> | |
96 | </layout> |
|
96 | </layout> | |
97 | </item> |
|
97 | </item> | |
98 | </layout> |
|
98 | </layout> | |
99 | </widget> |
|
99 | </widget> | |
100 | <resources/> |
|
100 | <resources/> | |
101 | <connections/> |
|
101 | <connections/> | |
102 | </ui> |
|
102 | </ui> |
@@ -1,346 +1,350 | |||||
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 | #include <qlopdatabase.h> | |
|
30 | #include <qlopsettings.h> | |||
30 |
|
31 | |||
31 | CassiniTools* CassiniTools::_self=NULL; |
|
32 | CassiniTools* CassiniTools::_self=NULL; | |
32 | QDockWidget* CassiniTools::m_gui=NULL; |
|
33 | QDockWidget* CassiniTools::m_gui=NULL; | |
33 | CassiniToolsGUI* CassiniTools::m_CassiniToolsGUI=NULL; |
|
34 | CassiniToolsGUI* CassiniTools::m_CassiniToolsGUI=NULL; | |
|
35 | CassiniToolsSettingsGUI* CassiniTools::m_SettingsGui=NULL; | |||
34 | CassiniDataFile* CassiniTools::m_dataFile=NULL; |
|
36 | CassiniDataFile* CassiniTools::m_dataFile=NULL; | |
35 | int CassiniTools::m_defaultPlot=-1; |
|
37 | int CassiniTools::m_defaultPlot=-1; | |
36 | int CassiniTools::m_fftPlot=-1; |
|
38 | int CassiniTools::m_fftPlot=-1; | |
37 | SocExplorerPlotActions* CassiniTools::ExportAction=NULL; |
|
39 | SocExplorerPlotActions* CassiniTools::ExportAction=NULL; | |
38 |
|
40 | |||
39 |
|
41 | |||
40 | Qt::GlobalColor QLopColours[]= {Qt::black, |
|
42 | Qt::GlobalColor QLopColours[]= {Qt::black, | |
41 | Qt::red, |
|
43 | Qt::red, | |
42 | Qt::blue, |
|
44 | Qt::blue, | |
43 | Qt::green, |
|
45 | Qt::green, | |
44 | Qt::darkGreen, |
|
46 | Qt::darkGreen, | |
45 | Qt::cyan, |
|
47 | Qt::cyan, | |
46 | Qt::darkRed, |
|
48 | Qt::darkRed, | |
47 | Qt::gray, |
|
49 | Qt::gray, | |
48 | Qt::yellow, |
|
50 | Qt::yellow, | |
49 | Qt::darkBlue, |
|
51 | Qt::darkBlue, | |
50 | Qt::darkCyan, |
|
52 | Qt::darkCyan, | |
51 | Qt::magenta, |
|
53 | Qt::magenta, | |
52 | Qt::darkMagenta, |
|
54 | Qt::darkMagenta, | |
53 | Qt::darkYellow, |
|
55 | Qt::darkYellow, | |
54 | Qt::darkGray, |
|
56 | Qt::darkGray, | |
55 | Qt::lightGray}; |
|
57 | Qt::lightGray}; | |
56 |
|
58 | |||
57 | int QLopColoursCount=16; |
|
59 | int QLopColoursCount=16; | |
58 |
|
60 | |||
59 | #define _INIT() if(Q_UNLIKELY(_self==NULL)){init();} |
|
61 | #define _INIT() if(Q_UNLIKELY(_self==NULL)){init();} | |
60 |
|
62 | |||
61 | CassiniTools::CassiniTools(bool noGUI,QObject *parent) : QLopService(parent) |
|
63 | CassiniTools::CassiniTools(bool noGUI,QObject *parent) : QLopService(parent) | |
62 | { |
|
64 | { | |
63 | m_dataFile = new CassiniDataFile(); |
|
65 | m_dataFile = new CassiniDataFile(); | |
64 | connect(m_dataFile,SIGNAL(dataReady(QLopDataList)),this,SLOT(dataReady(QLopDataList))); |
|
66 | connect(m_dataFile,SIGNAL(dataReady(QLopDataList)),this,SLOT(dataReady(QLopDataList))); | |
65 | connect(m_dataFile,SIGNAL(fileWritten()),this,SLOT(fileWritten())); |
|
67 | connect(m_dataFile,SIGNAL(fileWritten()),this,SLOT(fileWritten())); | |
66 | m_serviceName="CassiniTools"; |
|
68 | m_serviceName="CassiniTools"; | |
67 | m_noGui=noGUI; |
|
69 | m_noGui=noGUI; | |
68 | fftw_init_threads(); |
|
70 | fftw_init_threads(); | |
69 | } |
|
71 | } | |
70 |
|
72 | |||
71 | CassiniTools::~CassiniTools() |
|
73 | CassiniTools::~CassiniTools() | |
72 | { |
|
74 | { | |
73 | delete m_dataFile; |
|
75 | delete m_dataFile; | |
74 | delete m_CassiniToolsGUI; |
|
76 | delete m_CassiniToolsGUI; | |
75 | delete m_gui; |
|
77 | delete m_gui; | |
76 | } |
|
78 | } | |
77 |
|
79 | |||
78 | void CassiniTools::makePlot() |
|
80 | void CassiniTools::makePlot() | |
79 | { |
|
81 | { | |
80 | m_defaultPlot = QLopPlots::addPlot(); |
|
82 | m_defaultPlot = QLopPlots::addPlot(); | |
81 | m_fftPlot = QLopPlots::addPlot(); |
|
83 | m_fftPlot = QLopPlots::addPlot(); | |
82 | SocExplorerPlot* plot=QLopPlots::getPlot(m_defaultPlot); |
|
84 | SocExplorerPlot* plot=QLopPlots::getPlot(m_defaultPlot); | |
83 | if(plot) |
|
85 | if(plot) | |
84 | { |
|
86 | { | |
85 | plot->setTitle(_self->m_serviceName + " plot"); |
|
87 | plot->setTitle(_self->m_serviceName + " plot"); | |
86 | plot->setXaxisTickLabelType(QCPAxis::ltDateTime); |
|
88 | plot->setXaxisTickLabelType(QCPAxis::ltDateTime); | |
87 | plot->setXaxisDateTimeFormat("hh:mm:ss.zzz"); |
|
89 | plot->setXaxisDateTimeFormat("hh:mm:ss.zzz"); | |
88 | plot->setContextMenuPolicy(Qt::ActionsContextMenu); |
|
90 | plot->setContextMenuPolicy(Qt::ActionsContextMenu); | |
89 | SocExplorerPlotActions* action=new SocExplorerPlotActions("export view",plot->PID(),_self); |
|
91 | SocExplorerPlotActions* action=new SocExplorerPlotActions("export view",plot->PID(),_self); | |
90 | plot->addAction(action); |
|
92 | plot->addAction(action); | |
91 | QObject::connect(action,SIGNAL(triggered(int)),_self,SLOT(export_view(int))); |
|
93 | QObject::connect(action,SIGNAL(triggered(int)),_self,SLOT(export_view(int))); | |
92 | QString fileName = QString(plot->title()).replace(".TAB",""); |
|
94 | QString fileName = QString(plot->title()).replace(".TAB",""); | |
93 | fileName = generateFileName(fileName,".TAB"); |
|
95 | fileName = generateFileName(fileName,".TAB"); | |
94 | ExportAction=new SocExplorerPlotActions("export view to "+fileName,plot->PID(),_self); |
|
96 | ExportAction=new SocExplorerPlotActions("export view to "+fileName,plot->PID(),_self); | |
95 | plot->addAction(ExportAction); |
|
97 | plot->addAction(ExportAction); | |
96 | QObject::connect(ExportAction,SIGNAL(triggered(int)),_self,SLOT(export_view_Predefined_FileName(int))); |
|
98 | QObject::connect(ExportAction,SIGNAL(triggered(int)),_self,SLOT(export_view_Predefined_FileName(int))); | |
97 | action=new SocExplorerPlotActions("FFT of the current view",plot->PID(),_self); |
|
99 | action=new SocExplorerPlotActions("FFT of the current view",plot->PID(),_self); | |
98 | plot->addAction(action); |
|
100 | plot->addAction(action); | |
99 | QObject::connect(action,SIGNAL(triggered(int)),_self,SLOT(compute_fft_on_view(int))); |
|
101 | QObject::connect(action,SIGNAL(triggered(int)),_self,SLOT(compute_fft_on_view(int))); | |
100 | } |
|
102 | } | |
101 | } |
|
103 | } | |
102 |
|
104 | |||
103 | void CassiniTools::init(bool noGUI, QObject *parent) |
|
105 | void CassiniTools::init(bool noGUI, QObject *parent) | |
104 | { |
|
106 | { | |
105 | if(Q_UNLIKELY(_self==NULL)) |
|
107 | if(Q_UNLIKELY(_self==NULL)) | |
106 | { |
|
108 | { | |
107 | _self=new CassiniTools(noGUI,parent); |
|
109 | _self=new CassiniTools(noGUI,parent); | |
108 | } |
|
110 | } | |
109 | } |
|
111 | } | |
110 |
|
112 | |||
111 | CassiniTools *CassiniTools::self() |
|
113 | CassiniTools *CassiniTools::self() | |
112 | { |
|
114 | { | |
113 | _INIT(); |
|
115 | _INIT(); | |
114 | return _self; |
|
116 | return _self; | |
115 | } |
|
117 | } | |
116 |
|
118 | |||
117 | void CassiniTools::decodeFGMData(const QString &file) |
|
119 | void CassiniTools::decodeFGMData(const QString &file) | |
118 | { |
|
120 | { | |
119 | _INIT(); |
|
121 | _INIT(); | |
120 | m_dataFile->parseFile(file); |
|
122 | m_dataFile->parseFile(file); | |
121 | } |
|
123 | } | |
122 |
|
124 | |||
123 | void CassiniTools::plotFile(const QString &File) |
|
125 | void CassiniTools::plotFile(const QString &File) | |
124 | { |
|
126 | { | |
125 | if(!m_dataFile->isRunning()) |
|
127 | if(!m_dataFile->isRunning()) | |
126 | { |
|
128 | { | |
127 | m_dataFile->parseFile(File); |
|
129 | m_dataFile->parseFile(File); | |
128 | // TODO fixme |
|
130 | // TODO fixme | |
129 | SocExplorerPlot* plot = QLopPlots::getPlot(m_defaultPlot); |
|
131 | SocExplorerPlot* plot = QLopPlots::getPlot(m_defaultPlot); | |
130 | if(plot==NULL) |
|
132 | if(plot==NULL) | |
131 | { |
|
133 | { | |
132 | makePlot(); |
|
134 | makePlot(); | |
133 | plot = QLopPlots::getPlot(m_defaultPlot); |
|
135 | plot = QLopPlots::getPlot(m_defaultPlot); | |
134 | } |
|
136 | } | |
135 | if(plot) |
|
137 | if(plot) | |
136 | { |
|
138 | { | |
137 | plot->setTitle(File); |
|
139 | plot->setTitle(File); | |
138 | QString fileName = QString(File).replace(".TAB","-part"); |
|
140 | QString fileName = QString(File).replace(".TAB","-part"); | |
139 | fileName = generateFileName(fileName,".TAB"); |
|
141 | fileName = generateFileName(fileName,".TAB"); | |
140 | ExportAction->setText("export view to "+fileName); |
|
142 | ExportAction->setText("export view to "+fileName); | |
141 | } |
|
143 | } | |
142 | } |
|
144 | } | |
143 | } |
|
145 | } | |
144 |
|
146 | |||
145 | void CassiniTools::plot_TAB_File(const QString &fileName) |
|
147 | void CassiniTools::plot_TAB_File(const QString &fileName) | |
146 | { |
|
148 | { | |
147 | //TODO fix: accent not accepted |
|
149 | //TODO fix: accent not accepted | |
148 | plotFile(fileName); |
|
150 | plotFile(fileName); | |
149 | } |
|
151 | } | |
150 |
|
152 | |||
151 | void CassiniTools::export_view(int PID) |
|
153 | void CassiniTools::export_view(int PID) | |
152 | { |
|
154 | { | |
153 | SocExplorerPlot* plot = QLopPlots::getPlot(PID); |
|
155 | SocExplorerPlot* plot = QLopPlots::getPlot(PID); | |
154 | if(plot==NULL) |
|
156 | if(plot==NULL) | |
155 | return; |
|
157 | return; | |
156 | { |
|
158 | { | |
157 | QString fileName = plot->title(); |
|
159 | QString fileName = plot->title(); | |
158 | fileName = QFileDialog::getSaveFileName(0,tr("Set filename"),fileName.replace(".TAB","-part.TAB")); |
|
160 | fileName = QFileDialog::getSaveFileName(0,tr("Set filename"),fileName.replace(".TAB","-part.TAB")); | |
159 | if(fileName!="") |
|
161 | if(fileName!="") | |
160 | { |
|
162 | { | |
161 | QLopDataList vectors; |
|
163 | QLopDataList vectors; | |
162 | for(int i=0;i<plot->graphCount();i++) |
|
164 | for(int i=0;i<plot->graphCount();i++) | |
163 | { |
|
165 | { | |
164 | QLopQCPDataVector* vect = new QLopQCPDataVector(); |
|
166 | QLopQCPDataVector* vect = new QLopQCPDataVector(); | |
165 | vect->data = plot->getVisibleData(i); |
|
167 | vect->data = plot->getVisibleData(i); | |
166 | vectors.append(vect); |
|
168 | vectors.append(vect); | |
167 | } |
|
169 | } | |
168 | m_dataFile->saveFile(fileName,vectors); |
|
170 | m_dataFile->saveFile(fileName,vectors); | |
169 | } |
|
171 | } | |
170 | } |
|
172 | } | |
171 | } |
|
173 | } | |
172 |
|
174 | |||
173 | void CassiniTools::export_view_Predefined_FileName(int PID) |
|
175 | void CassiniTools::export_view_Predefined_FileName(int PID) | |
174 | { |
|
176 | { | |
175 | SocExplorerPlot* plot = QLopPlots::getPlot(PID); |
|
177 | SocExplorerPlot* plot = QLopPlots::getPlot(PID); | |
176 | if(plot==NULL) |
|
178 | if(plot==NULL) | |
177 | return; |
|
179 | return; | |
178 | { |
|
180 | { | |
179 | QString fileName = QString(plot->title()).replace(".TAB","-part"); |
|
181 | QString fileName = QString(plot->title()).replace(".TAB","-part"); | |
180 | fileName = generateFileName(fileName,".TAB"); |
|
182 | fileName = generateFileName(fileName,".TAB"); | |
181 | if(fileName!="") |
|
183 | if(fileName!="") | |
182 | { |
|
184 | { | |
183 | QLopDataList vectors; |
|
185 | QLopDataList vectors; | |
184 | for(int i=0;i<plot->graphCount();i++) |
|
186 | for(int i=0;i<plot->graphCount();i++) | |
185 | { |
|
187 | { | |
186 | QLopQCPDataVector* vect = new QLopQCPDataVector(); |
|
188 | QLopQCPDataVector* vect = new QLopQCPDataVector(); | |
187 | vect->data = plot->getVisibleData(i); |
|
189 | vect->data = plot->getVisibleData(i); | |
188 | vectors.append(vect); |
|
190 | vectors.append(vect); | |
189 | } |
|
191 | } | |
190 | m_dataFile->saveFile(fileName,vectors); |
|
192 | m_dataFile->saveFile(fileName,vectors); | |
191 | } |
|
193 | } | |
192 | } |
|
194 | } | |
193 | } |
|
195 | } | |
194 |
|
196 | |||
195 | void CassiniTools::compute_fft_on_view(int PID) |
|
197 | void CassiniTools::compute_fft_on_view(int PID) | |
196 | { |
|
198 | { | |
197 |
|
199 | |||
198 | QElapsedTimer timr; |
|
200 | QElapsedTimer timr; | |
199 | SocExplorerPlot* plot = QLopPlots::getPlot(PID); |
|
201 | SocExplorerPlot* plot = QLopPlots::getPlot(PID); | |
200 | if(plot==NULL) |
|
202 | if(plot==NULL) | |
201 | return; |
|
203 | return; | |
202 | { |
|
204 | { | |
203 | timr.start(); |
|
205 | timr.start(); | |
204 | QLopDataList vectors; |
|
206 | QLopDataList vectors; | |
205 | for(int i=0;i<plot->graphCount();i++) |
|
207 | for(int i=0;i<plot->graphCount();i++) | |
206 | { |
|
208 | { | |
207 | QLopQCPDataVector* vect = new QLopQCPDataVector(); |
|
209 | QLopQCPDataVector* vect = new QLopQCPDataVector(); | |
208 | vect->data = plot->getVisibleData(i); |
|
210 | vect->data = plot->getVisibleData(i); | |
209 | vectors.append(vect); |
|
211 | vectors.append(vect); | |
210 | } |
|
212 | } | |
211 | if(vectors.count()==3) |
|
213 | if(vectors.count()==3) | |
212 | { |
|
214 | { | |
213 | QLopQCPDataVector* ch1V=(QLopQCPDataVector*)vectors.at(0); |
|
215 | QLopQCPDataVector* ch1V=(QLopQCPDataVector*)vectors.at(0); | |
214 | QLopQCPDataVector* ch2V=(QLopQCPDataVector*)vectors.at(1); |
|
216 | QLopQCPDataVector* ch2V=(QLopQCPDataVector*)vectors.at(1); | |
215 | QLopQCPDataVector* ch3V=(QLopQCPDataVector*)vectors.at(2); |
|
217 | QLopQCPDataVector* ch3V=(QLopQCPDataVector*)vectors.at(2); | |
216 | QLopQCPDataVector* FFTout=new QLopQCPDataVector(); |
|
218 | QLopQCPDataVector* FFTout=new QLopQCPDataVector(); | |
217 | if(ch1V->data->count()==ch2V->data->count() && ch1V->data->count()==ch3V->data->count()) |
|
219 | if(ch1V->data->count()==ch2V->data->count() && ch1V->data->count()==ch3V->data->count()) | |
218 | { |
|
220 | { | |
219 |
|
221 | |||
220 | double* in; |
|
222 | double* in; | |
221 | fftw_complex *out; |
|
223 | fftw_complex *out; | |
222 | fftw_plan p; |
|
224 | fftw_plan p; | |
223 | FFTout->data = new QVector<QCPData>(ch1V->data->count()/2); |
|
225 | FFTout->data = new QVector<QCPData>(ch1V->data->count()/2); | |
224 | in = (double*) fftw_malloc(sizeof(double) * ch1V->data->count()); |
|
226 | in = (double*) fftw_malloc(sizeof(double) * ch1V->data->count()); | |
225 | out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * ch1V->data->count()); |
|
227 | out = (fftw_complex*) fftw_malloc(sizeof(fftw_complex) * ch1V->data->count()); | |
226 | double av=0; |
|
228 | double av=0; | |
227 | for(int i=0;i<ch1V->data->count();i++) |
|
229 | for(int i=0;i<ch1V->data->count();i++) | |
228 | { |
|
230 | { | |
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)); |
|
231 | 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)); | |
230 | av = av+in[i]; |
|
232 | av = av+in[i]; | |
231 | } |
|
233 | } | |
232 | av/=ch1V->data->count(); |
|
234 | av/=ch1V->data->count(); | |
233 | for(int i=0;i<ch1V->data->count();i++) |
|
235 | for(int i=0;i<ch1V->data->count();i++) | |
234 | { |
|
236 | { | |
235 | in[i]=in[i]-av; |
|
237 | in[i]=in[i]-av; | |
236 | } |
|
238 | } | |
237 | fftw_plan_with_nthreads(4); |
|
239 | fftw_plan_with_nthreads(4); | |
238 | p = fftw_plan_dft_r2c_1d(ch1V->data->count(),in, out,FFTW_ESTIMATE); |
|
240 | p = fftw_plan_dft_r2c_1d(ch1V->data->count(),in, out,FFTW_ESTIMATE); | |
239 | fftw_execute(p); /* repeat as needed */ |
|
241 | fftw_execute(p); /* repeat as needed */ | |
240 | fftw_destroy_plan(p); |
|
242 | fftw_destroy_plan(p); | |
241 | fftw_free(in); |
|
243 | fftw_free(in); | |
242 | for(int i=0;i<ch1V->data->count()/2;i++) |
|
244 | for(int i=0;i<ch1V->data->count()/2;i++) | |
243 | { |
|
245 | { | |
244 | // (*FFTout->data)[i].value=sqrt((out[i][0] * out[i][0]) + (out[i][1] * out[i][1]))/ch1V->data->count(); |
|
246 | // (*FFTout->data)[i].value=sqrt((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()); |
|
247 | (*FFTout->data)[i].value=((out[i][0] * out[i][0]) + (out[i][1] * out[i][1]))/(ch1V->data->count()); | |
246 | (*FFTout->data)[i].key = i; |
|
248 | (*FFTout->data)[i].key = i; | |
247 | } |
|
249 | } | |
248 | fftw_free(out); |
|
250 | fftw_free(out); | |
249 | SocExplorerPlot* plot = QLopPlots::getPlot(m_fftPlot); |
|
251 | SocExplorerPlot* plot = QLopPlots::getPlot(m_fftPlot); | |
250 | if(plot==NULL) |
|
252 | if(plot==NULL) | |
251 | return; |
|
253 | return; | |
252 | plot->removeAllGraphs(); |
|
254 | plot->removeAllGraphs(); | |
253 | plot->addGraph(); |
|
255 | plot->addGraph(); | |
254 | plot->setXaxisLog(); |
|
256 | plot->setXaxisLog(); | |
255 | plot->setYaxisLog(); |
|
257 | plot->setYaxisLog(); | |
256 | plot->setAdaptativeSampling(0,true); |
|
258 | plot->setAdaptativeSampling(0,true); | |
257 | QPen pen = plot->getGraphPen(0); |
|
259 | QPen pen = plot->getGraphPen(0); | |
258 | pen.setColor(QLopColours[0%QLopColoursCount]); |
|
260 | pen.setColor(QLopColours[0%QLopColoursCount]); | |
259 | plot->setGraphPen(0,pen); |
|
261 | plot->setGraphPen(0,pen); | |
260 | plot->setGraphData(0,FFTout->data,false); |
|
262 | plot->setGraphData(0,FFTout->data,false); | |
261 | plot->rescaleAxis(); |
|
263 | plot->rescaleAxis(); | |
262 | plot->replot(); |
|
264 | plot->replot(); | |
263 |
|
265 | |||
264 | qDebug()<< ch1V->data->count() <<" Points loaded in "<< timr.elapsed()<<"ms"; |
|
266 | qDebug()<< ch1V->data->count() <<" Points loaded in "<< timr.elapsed()<<"ms"; | |
265 | } |
|
267 | } | |
266 | } |
|
268 | } | |
267 | } |
|
269 | } | |
268 | } |
|
270 | } | |
269 |
|
271 | |||
270 | QString CassiniTools::generateFileName(const QString &baseName, const QString &extension) |
|
272 | QString CassiniTools::generateFileName(const QString &baseName, const QString &extension) | |
271 | { |
|
273 | { | |
272 | QString fileName = baseName+extension; |
|
274 | QString fileName = baseName+extension; | |
273 | int i=0; |
|
275 | int i=0; | |
274 | while(QFile::exists(fileName)) |
|
276 | while(QFile::exists(fileName)) | |
275 | { |
|
277 | { | |
276 | fileName = baseName+QString::number(i++)+extension; |
|
278 | fileName = baseName+QString::number(i++)+extension; | |
277 | } |
|
279 | } | |
278 | return fileName; |
|
280 | return fileName; | |
279 | } |
|
281 | } | |
280 |
|
282 | |||
281 | QDockWidget *CassiniTools::getGUI() |
|
283 | QDockWidget *CassiniTools::getGUI() | |
282 | { |
|
284 | { | |
283 | if(!m_noGui && (m_gui==NULL)) |
|
285 | if(!m_noGui && (m_gui==NULL)) | |
284 | { |
|
286 | { | |
285 | m_gui=new QDockWidget("Cassini Tools"); |
|
287 | m_gui=new QDockWidget("Cassini Tools"); | |
286 | m_CassiniToolsGUI = new CassiniToolsGUI(); |
|
288 | m_CassiniToolsGUI = new CassiniToolsGUI(); | |
287 | m_gui->setWidget(m_CassiniToolsGUI); |
|
289 | m_gui->setWidget(m_CassiniToolsGUI); | |
288 | m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); |
|
290 | m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); | |
|
291 | m_SettingsGui = new CassiniToolsSettingsGUI(); | |||
|
292 | QLopSettings::registerConfigEntry(this->m_SettingsGui,QIcon(":/img/cassini.gif"),"Cassini Tools"); | |||
289 | } |
|
293 | } | |
290 | return m_gui; |
|
294 | return m_gui; | |
291 | } |
|
295 | } | |
292 |
|
296 | |||
293 | const QString &CassiniTools::serviceName() |
|
297 | const QString &CassiniTools::serviceName() | |
294 | { |
|
298 | { | |
295 | _INIT(); |
|
299 | _INIT(); | |
296 | return m_serviceName; |
|
300 | return m_serviceName; | |
297 | } |
|
301 | } | |
298 |
|
302 | |||
299 | void CassiniTools::dataReady(QLopDataList data) |
|
303 | void CassiniTools::dataReady(QLopDataList data) | |
300 | { |
|
304 | { | |
301 | static QLopDataList prevData=QLopDataList(); |
|
305 | static QLopDataList prevData=QLopDataList(); | |
302 | SocExplorerPlot* plot = QLopPlots::getPlot(m_defaultPlot); |
|
306 | SocExplorerPlot* plot = QLopPlots::getPlot(m_defaultPlot); | |
303 | if(plot==NULL) |
|
307 | if(plot==NULL) | |
304 | { |
|
308 | { | |
305 | makePlot(); |
|
309 | makePlot(); | |
306 | plot = QLopPlots::getPlot(m_defaultPlot); |
|
310 | plot = QLopPlots::getPlot(m_defaultPlot); | |
307 | } |
|
311 | } | |
308 | if(plot) |
|
312 | if(plot) | |
309 | { |
|
313 | { | |
310 | QLopDataBase::removeData(prevData); |
|
314 | QLopDataBase::removeData(prevData); | |
311 | plot->removeAllGraphs(); |
|
315 | plot->removeAllGraphs(); | |
312 | // QLopDataBase::re |
|
316 | // QLopDataBase::re | |
313 | for(int i=0;i<data.count();i++) |
|
317 | for(int i=0;i<data.count();i++) | |
314 | { |
|
318 | { | |
315 | plot->addGraph(); |
|
319 | plot->addGraph(); | |
316 | plot->setAdaptativeSampling(i,true); |
|
320 | plot->setAdaptativeSampling(i,true); | |
317 | plot->setUseFastVector(i,true); |
|
321 | plot->setUseFastVector(i,true); | |
318 | QPen pen = plot->getGraphPen(i); |
|
322 | QPen pen = plot->getGraphPen(i); | |
319 | pen.setColor(QLopColours[i%QLopColoursCount]); |
|
323 | pen.setColor(QLopColours[i%QLopColoursCount]); | |
320 | plot->setGraphPen(i,pen); |
|
324 | plot->setGraphPen(i,pen); | |
321 | plot->setGraphName(i,data.at(i)->name+"("+data.at(i)->unit+")"); |
|
325 | plot->setGraphName(i,data.at(i)->name+"("+data.at(i)->unit+")"); | |
322 | plot->setGraphData(i,((QLopQCPDataVector*)data.at(i))->data,false); |
|
326 | plot->setGraphData(i,((QLopQCPDataVector*)data.at(i))->data,false); | |
323 | } |
|
327 | } | |
324 | plot->rescaleAxis(); |
|
328 | plot->rescaleAxis(); | |
325 | plot->replot(); |
|
329 | plot->replot(); | |
326 | prevData = data; |
|
330 | prevData = data; | |
327 | QLopDataBase::addData(data); |
|
331 | QLopDataBase::addData(data); | |
328 | } |
|
332 | } | |
329 | } |
|
333 | } | |
330 |
|
334 | |||
331 | void CassiniTools::fileWritten() |
|
335 | void CassiniTools::fileWritten() | |
332 | { |
|
336 | { | |
333 | SocExplorerPlot* plot = QLopPlots::getPlot(m_defaultPlot); |
|
337 | SocExplorerPlot* plot = QLopPlots::getPlot(m_defaultPlot); | |
334 | if(plot==NULL) |
|
338 | if(plot==NULL) | |
335 | { |
|
339 | { | |
336 | makePlot(); |
|
340 | makePlot(); | |
337 | plot = QLopPlots::getPlot(m_defaultPlot); |
|
341 | plot = QLopPlots::getPlot(m_defaultPlot); | |
338 | } |
|
342 | } | |
339 | if(plot) |
|
343 | if(plot) | |
340 | { |
|
344 | { | |
341 | QString fileName = QString(plot->title()).replace(".TAB","-part"); |
|
345 | QString fileName = QString(plot->title()).replace(".TAB","-part"); | |
342 | fileName = generateFileName(fileName,".TAB"); |
|
346 | fileName = generateFileName(fileName,".TAB"); | |
343 | ExportAction->setText("export view to "+fileName); |
|
347 | ExportAction->setText("export view to "+fileName); | |
344 | } |
|
348 | } | |
345 | } |
|
349 | } | |
346 |
|
350 |
@@ -1,66 +1,68 | |||||
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 | #include <cassinitoolssettingsgui.h> | |||
32 |
|
33 | |||
33 | class CassiniTools: public QLopService |
|
34 | class CassiniTools: public QLopService | |
34 | { |
|
35 | { | |
35 | Q_OBJECT |
|
36 | Q_OBJECT | |
36 | private: |
|
37 | private: | |
37 | static CassiniTools* _self; |
|
38 | static CassiniTools* _self; | |
38 | static QDockWidget* m_gui; |
|
39 | static QDockWidget* m_gui; | |
39 | static CassiniToolsGUI* m_CassiniToolsGUI; |
|
40 | static CassiniToolsGUI* m_CassiniToolsGUI; | |
|
41 | static CassiniToolsSettingsGUI* m_SettingsGui; | |||
40 | static CassiniDataFile* m_dataFile; |
|
42 | static CassiniDataFile* m_dataFile; | |
41 | static int m_defaultPlot,m_fftPlot; |
|
43 | static int m_defaultPlot,m_fftPlot; | |
42 | static SocExplorerPlotActions* ExportAction; |
|
44 | static SocExplorerPlotActions* ExportAction; | |
43 | CassiniTools(bool noGUI=false, QObject *parent=0); |
|
45 | CassiniTools(bool noGUI=false, QObject *parent=0); | |
44 | ~CassiniTools(); |
|
46 | ~CassiniTools(); | |
45 | static void makePlot(); |
|
47 | static void makePlot(); | |
46 | public: |
|
48 | public: | |
47 | static void init(bool noGUI=false,QObject *parent = 0); |
|
49 | static void init(bool noGUI=false,QObject *parent = 0); | |
48 | static CassiniTools *self(); |
|
50 | static CassiniTools *self(); | |
49 | static void decodeFGMData(const QString& file); |
|
51 | static void decodeFGMData(const QString& file); | |
50 | // QLopService methodes |
|
52 | // QLopService methodes | |
51 | QDockWidget* getGUI(); |
|
53 | QDockWidget* getGUI(); | |
52 | const QString& serviceName(); |
|
54 | const QString& serviceName(); | |
53 | static void plotFile(const QString &File); |
|
55 | static void plotFile(const QString &File); | |
54 | public slots: |
|
56 | public slots: | |
55 | void plot_TAB_File(const QString& fileName); |
|
57 | void plot_TAB_File(const QString& fileName); | |
56 | void export_view(int PID); |
|
58 | void export_view(int PID); | |
57 | void export_view_Predefined_FileName(int PID); |
|
59 | void export_view_Predefined_FileName(int PID); | |
58 | void compute_fft_on_view(int PID); |
|
60 | void compute_fft_on_view(int PID); | |
59 | private slots: |
|
61 | private slots: | |
60 | static QString generateFileName(const QString& baseName,const QString& extension); |
|
62 | static QString generateFileName(const QString& baseName,const QString& extension); | |
61 | void dataReady(QLopDataList data); |
|
63 | void dataReady(QLopDataList data); | |
62 | void fileWritten(); |
|
64 | void fileWritten(); | |
63 | }; |
|
65 | }; | |
64 |
|
66 | |||
65 | #endif // CASSINITOOLS_H |
|
67 | #endif // CASSINITOOLS_H | |
66 |
|
68 |
@@ -1,31 +1,52 | |||||
|
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 | ----------------------------------------------------------------------------*/ | |||
1 | #include "qlopdatabaseviewer.h" |
|
22 | #include "qlopdatabaseviewer.h" | |
2 | #include "ui_qlopdatabaseviewer.h" |
|
23 | #include "ui_qlopdatabaseviewer.h" | |
3 |
|
24 | |||
4 | QLopDataBaseViewer::QLopDataBaseViewer(QWidget *parent) : |
|
25 | QLopDataBaseViewer::QLopDataBaseViewer(QWidget *parent) : | |
5 | QDockWidget(parent), |
|
26 | QDockWidget(parent), | |
6 | ui(new Ui::QLopDataBaseViewer) |
|
27 | ui(new Ui::QLopDataBaseViewer) | |
7 | { |
|
28 | { | |
8 | ui->setupUi(this); |
|
29 | ui->setupUi(this); | |
9 | this->model = new QLopDataBaseViewerModel(); |
|
30 | this->model = new QLopDataBaseViewerModel(); | |
10 | this->ui->dataBaseTbleView->setModel(model); |
|
31 | this->ui->dataBaseTbleView->setModel(model); | |
11 | connect(QLopDataBase::self(),SIGNAL(DBChanged()),this->model,SLOT(DBChanged())); |
|
32 | connect(QLopDataBase::self(),SIGNAL(DBChanged()),this->model,SLOT(DBChanged())); | |
12 | } |
|
33 | } | |
13 |
|
34 | |||
14 | QLopDataBaseViewer::~QLopDataBaseViewer() |
|
35 | QLopDataBaseViewer::~QLopDataBaseViewer() | |
15 | { |
|
36 | { | |
16 | delete ui; |
|
37 | delete ui; | |
17 | delete model; |
|
38 | delete model; | |
18 | } |
|
39 | } | |
19 |
|
40 | |||
20 | void QLopDataBaseViewer::changeEvent(QEvent *e) |
|
41 | void QLopDataBaseViewer::changeEvent(QEvent *e) | |
21 | { |
|
42 | { | |
22 | QDockWidget::changeEvent(e); |
|
43 | QDockWidget::changeEvent(e); | |
23 | switch (e->type()) { |
|
44 | switch (e->type()) { | |
24 | case QEvent::LanguageChange: |
|
45 | case QEvent::LanguageChange: | |
25 | ui->retranslateUi(this); |
|
46 | ui->retranslateUi(this); | |
26 | break; |
|
47 | break; | |
27 | default: |
|
48 | default: | |
28 | break; |
|
49 | break; | |
29 | } |
|
50 | } | |
30 | } |
|
51 | } | |
31 |
|
52 |
@@ -1,27 +1,48 | |||||
|
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 | ----------------------------------------------------------------------------*/ | |||
1 | #ifndef QLOPDATABASEVIEWER_H |
|
22 | #ifndef QLOPDATABASEVIEWER_H | |
2 | #define QLOPDATABASEVIEWER_H |
|
23 | #define QLOPDATABASEVIEWER_H | |
3 |
|
24 | |||
4 | #include <QDockWidget> |
|
25 | #include <QDockWidget> | |
5 | #include <qlopdatabaseviewermodel.h> |
|
26 | #include <qlopdatabaseviewermodel.h> | |
6 |
|
27 | |||
7 | namespace Ui { |
|
28 | namespace Ui { | |
8 | class QLopDataBaseViewer; |
|
29 | class QLopDataBaseViewer; | |
9 | } |
|
30 | } | |
10 |
|
31 | |||
11 | class QLopDataBaseViewer : public QDockWidget |
|
32 | class QLopDataBaseViewer : public QDockWidget | |
12 | { |
|
33 | { | |
13 | Q_OBJECT |
|
34 | Q_OBJECT | |
14 |
|
35 | |||
15 | public: |
|
36 | public: | |
16 | explicit QLopDataBaseViewer(QWidget *parent = 0); |
|
37 | explicit QLopDataBaseViewer(QWidget *parent = 0); | |
17 | ~QLopDataBaseViewer(); |
|
38 | ~QLopDataBaseViewer(); | |
18 |
|
39 | |||
19 | protected: |
|
40 | protected: | |
20 | void changeEvent(QEvent *e); |
|
41 | void changeEvent(QEvent *e); | |
21 |
|
42 | |||
22 | private: |
|
43 | private: | |
23 | Ui::QLopDataBaseViewer *ui; |
|
44 | Ui::QLopDataBaseViewer *ui; | |
24 | QLopDataBaseViewerModel* model; |
|
45 | QLopDataBaseViewerModel* model; | |
25 | }; |
|
46 | }; | |
26 |
|
47 | |||
27 | #endif // QLOPDATABASEVIEWER_H |
|
48 | #endif // QLOPDATABASEVIEWER_H |
@@ -1,30 +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>D |
|
14 | <string>Database Explorer</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"> |
|
20 | <attribute name="horizontalHeaderShowSortIndicator" stdset="0"> | |
21 | <bool>false</bool> |
|
21 | <bool>false</bool> | |
22 | </attribute> |
|
22 | </attribute> | |
23 | </widget> |
|
23 | </widget> | |
24 | </item> |
|
24 | </item> | |
25 | </layout> |
|
25 | </layout> | |
26 | </widget> |
|
26 | </widget> | |
27 | </widget> |
|
27 | </widget> | |
28 | <resources/> |
|
28 | <resources/> | |
29 | <connections/> |
|
29 | <connections/> | |
30 | </ui> |
|
30 | </ui> |
@@ -1,90 +1,111 | |||||
|
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 | ----------------------------------------------------------------------------*/ | |||
1 | #include "qlopdatabaseviewermodel.h" |
|
22 | #include "qlopdatabaseviewermodel.h" | |
2 |
|
23 | |||
3 | QLopDataBaseViewerModel::QLopDataBaseViewerModel(QObject *parent) |
|
24 | QLopDataBaseViewerModel::QLopDataBaseViewerModel(QObject *parent) | |
4 | : QAbstractTableModel(parent) |
|
25 | : QAbstractTableModel(parent) | |
5 | { |
|
26 | { | |
6 | beginResetModel(); |
|
27 | beginResetModel(); | |
7 | endResetModel(); |
|
28 | endResetModel(); | |
8 | } |
|
29 | } | |
9 |
|
30 | |||
10 | QLopDataBaseViewerModel::~QLopDataBaseViewerModel() |
|
31 | QLopDataBaseViewerModel::~QLopDataBaseViewerModel() | |
11 | { |
|
32 | { | |
12 |
|
33 | |||
13 | } |
|
34 | } | |
14 |
|
35 | |||
15 | int QLopDataBaseViewerModel::rowCount(const QModelIndex &parent) const |
|
36 | int QLopDataBaseViewerModel::rowCount(const QModelIndex &parent) const | |
16 | { |
|
37 | { | |
17 | return QLopDataBase::count(); |
|
38 | return QLopDataBase::count(); | |
18 | } |
|
39 | } | |
19 |
|
40 | |||
20 | int QLopDataBaseViewerModel::columnCount(const QModelIndex &parent) const |
|
41 | int QLopDataBaseViewerModel::columnCount(const QModelIndex &parent) const | |
21 | { |
|
42 | { | |
22 | return 5; |
|
43 | return 5; | |
23 | } |
|
44 | } | |
24 |
|
45 | |||
25 | QVariant QLopDataBaseViewerModel::data(const QModelIndex &index, int role) const |
|
46 | QVariant QLopDataBaseViewerModel::data(const QModelIndex &index, int role) const | |
26 | { |
|
47 | { | |
27 | if (!index.isValid() || role != Qt::DisplayRole) |
|
48 | if (!index.isValid() || role != Qt::DisplayRole) | |
28 | return QVariant(); |
|
49 | return QVariant(); | |
29 | QLopData* data=QLopDataBase::self()->getDataFromIdex(index.row()); |
|
50 | QLopData* data=QLopDataBase::self()->getDataFromIdex(index.row()); | |
30 | if(data) |
|
51 | if(data) | |
31 | { |
|
52 | { | |
32 | switch (index.column()) { |
|
53 | switch (index.column()) { | |
33 | case 0: |
|
54 | case 0: | |
34 | return data->name; |
|
55 | return data->name; | |
35 | break; |
|
56 | break; | |
36 | case 1: |
|
57 | case 1: | |
37 | return data->source; |
|
58 | return data->source; | |
38 | break; |
|
59 | break; | |
39 | case 2: |
|
60 | case 2: | |
40 | return data->typeStr(); |
|
61 | return data->typeStr(); | |
41 | break; |
|
62 | break; | |
42 | case 3: |
|
63 | case 3: | |
43 | return data->unit; |
|
64 | return data->unit; | |
44 | break; |
|
65 | break; | |
45 | case 4: |
|
66 | case 4: | |
46 | return data->size(); |
|
67 | return data->size(); | |
47 | break; |
|
68 | break; | |
48 | default: |
|
69 | default: | |
49 | return data->name; |
|
70 | return data->name; | |
50 | break; |
|
71 | break; | |
51 | } |
|
72 | } | |
52 | } |
|
73 | } | |
53 | else QVariant(); |
|
74 | else QVariant(); | |
54 | } |
|
75 | } | |
55 |
|
76 | |||
56 | QVariant QLopDataBaseViewerModel::headerData(int section, Qt::Orientation orientation, int role) const |
|
77 | QVariant QLopDataBaseViewerModel::headerData(int section, Qt::Orientation orientation, int role) const | |
57 | { |
|
78 | { | |
58 | //if (role == Qt::SizeHintRole) |
|
79 | //if (role == Qt::SizeHintRole) | |
59 | // return QSize(1, 1); |
|
80 | // return QSize(1, 1); | |
60 | if(orientation==Qt::Horizontal && role==Qt::DisplayRole) |
|
81 | if(orientation==Qt::Horizontal && role==Qt::DisplayRole) | |
61 | { |
|
82 | { | |
62 | switch (section) { |
|
83 | switch (section) { | |
63 | case 0: |
|
84 | case 0: | |
64 | return QVariant("Name"); |
|
85 | return QVariant("Name"); | |
65 | break; |
|
86 | break; | |
66 | case 1: |
|
87 | case 1: | |
67 | return QVariant("Source"); |
|
88 | return QVariant("Source"); | |
68 | break; |
|
89 | break; | |
69 | case 2: |
|
90 | case 2: | |
70 | return QVariant("Type"); |
|
91 | return QVariant("Type"); | |
71 | break; |
|
92 | break; | |
72 | case 3: |
|
93 | case 3: | |
73 | return QVariant("Unit"); |
|
94 | return QVariant("Unit"); | |
74 | break; |
|
95 | break; | |
75 | case 4: |
|
96 | case 4: | |
76 | return QVariant("Size"); |
|
97 | return QVariant("Size"); | |
77 | break; |
|
98 | break; | |
78 | default: |
|
99 | default: | |
79 | break; |
|
100 | break; | |
80 | } |
|
101 | } | |
81 | } |
|
102 | } | |
82 | return QVariant(); |
|
103 | return QVariant(); | |
83 | } |
|
104 | } | |
84 |
|
105 | |||
85 | void QLopDataBaseViewerModel::DBChanged() |
|
106 | void QLopDataBaseViewerModel::DBChanged() | |
86 | { |
|
107 | { | |
87 | beginResetModel(); |
|
108 | beginResetModel(); | |
88 | endResetModel(); |
|
109 | endResetModel(); | |
89 | } |
|
110 | } | |
90 |
|
111 |
@@ -1,27 +1,48 | |||||
|
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 | ----------------------------------------------------------------------------*/ | |||
1 | #ifndef QLOPDATABASEVIEWERMODEL_H |
|
22 | #ifndef QLOPDATABASEVIEWERMODEL_H | |
2 | #define QLOPDATABASEVIEWERMODEL_H |
|
23 | #define QLOPDATABASEVIEWERMODEL_H | |
3 |
|
24 | |||
4 | #include <QObject> |
|
25 | #include <QObject> | |
5 | #include <QAbstractTableModel> |
|
26 | #include <QAbstractTableModel> | |
6 | #include <qlopdatabase.h> |
|
27 | #include <qlopdatabase.h> | |
7 |
|
28 | |||
8 | class QLopDataBaseViewerModel : public QAbstractTableModel |
|
29 | class QLopDataBaseViewerModel : public QAbstractTableModel | |
9 | { |
|
30 | { | |
10 | Q_OBJECT |
|
31 | Q_OBJECT | |
11 | public: |
|
32 | public: | |
12 | QLopDataBaseViewerModel(QObject *parent=0); |
|
33 | QLopDataBaseViewerModel(QObject *parent=0); | |
13 | ~QLopDataBaseViewerModel(); |
|
34 | ~QLopDataBaseViewerModel(); | |
14 |
|
35 | |||
15 | int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; |
|
36 | int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | |
16 | int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; |
|
37 | int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; | |
17 |
|
38 | |||
18 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; |
|
39 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; | |
19 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; |
|
40 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE; | |
20 |
|
41 | |||
21 | public slots: |
|
42 | public slots: | |
22 | void DBChanged(); |
|
43 | void DBChanged(); | |
23 | private: |
|
44 | private: | |
24 |
|
45 | |||
25 | }; |
|
46 | }; | |
26 |
|
47 | |||
27 | #endif // QLOPDATABASEVIEWERMODEL_H |
|
48 | #endif // QLOPDATABASEVIEWERMODEL_H |
@@ -1,175 +1,193 | |||||
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 "filedownloader.h" |
|
23 | #include "filedownloader.h" | |
24 | #include <QFile> |
|
24 | #include <QFile> | |
|
25 | #include <QIcon> | |||
|
26 | ||||
25 | FileDownloader* FileDownloader::_self=NULL; |
|
27 | FileDownloader* FileDownloader::_self=NULL; | |
26 | QNetworkAccessManager* FileDownloader::m_WebCtrl=NULL; |
|
28 | QNetworkAccessManager* FileDownloader::m_WebCtrl=NULL; | |
27 | QList<FileDownloaderTask*>* FileDownloader::m_pendingTasks=NULL; |
|
29 | QList<FileDownloaderTask*>* FileDownloader::m_pendingTasks=NULL; | |
28 | QDockWidget* FileDownloader::m_gui=NULL; |
|
30 | QDockWidget* FileDownloader::m_gui=NULL; | |
29 | DownLoadHistory* FileDownloader::m_DownLoadHistory=NULL; |
|
31 | DownLoadHistory* FileDownloader::m_DownLoadHistory=NULL; | |
|
32 | FileDowloaderSettingsGUI* FileDownloader::m_SettingsGui=NULL; | |||
30 |
|
33 | |||
31 | #define _INIT \ |
|
34 | #define _INIT \ | |
32 | if(Q_UNLIKELY(_self==NULL))\ |
|
35 | if(Q_UNLIKELY(_self==NULL))\ | |
33 | {\ |
|
36 | {\ | |
34 | init();\ |
|
37 | init();\ | |
35 | }\ |
|
38 | }\ | |
36 |
|
39 | |||
37 |
|
40 | |||
38 | int FileDownloader::downloadFile(QUrl fileUrl, const QString &name) |
|
41 | int FileDownloader::downloadFile(QUrl fileUrl, const QString &name) | |
39 | { |
|
42 | { | |
40 | _INIT |
|
43 | _INIT | |
41 | if(QFile::exists(name)|| QFile::exists(name+".part")) |
|
44 | if(QFile::exists(name)|| QFile::exists(name+".part")) | |
42 | { |
|
45 | { | |
43 | return -1; |
|
46 | return -1; | |
44 | } |
|
47 | } | |
45 | FileDownloaderTask* task=NULL; |
|
48 | FileDownloaderTask* task=NULL; | |
46 | int ID=_self->getTaskId(); |
|
49 | int ID=_self->getTaskId(); | |
47 | if(ID!=-1) |
|
50 | if(ID!=-1) | |
48 | { |
|
51 | { | |
49 | QNetworkRequest request(fileUrl); |
|
52 | QNetworkRequest request(fileUrl); | |
50 | QNetworkReply* reply = m_WebCtrl->get(request); |
|
53 | QNetworkReply* reply = m_WebCtrl->get(request); | |
51 | if(reply && (reply->error()==QNetworkReply::NoError)) |
|
54 | if(reply && (reply->error()==QNetworkReply::NoError)) | |
52 | { |
|
55 | { | |
53 | task=new FileDownloaderTask(reply,ID,name,_self); |
|
56 | task=new FileDownloaderTask(reply,ID,name,_self); | |
54 | m_pendingTasks->append(task); |
|
57 | m_pendingTasks->append(task); | |
55 | if(!_self->m_noGui) |
|
58 | if(!_self->m_noGui) | |
56 | { |
|
59 | { | |
57 | m_DownLoadHistory->addElement(new DownloadHistoryElement(task)); |
|
60 | m_DownLoadHistory->addElement(new DownloadHistoryElement(task)); | |
58 | } |
|
61 | } | |
59 | } |
|
62 | } | |
60 | else |
|
63 | else | |
61 | { |
|
64 | { | |
62 | return -1; |
|
65 | return -1; | |
63 | } |
|
66 | } | |
64 | } |
|
67 | } | |
65 | return ID; |
|
68 | return ID; | |
66 | } |
|
69 | } | |
67 |
|
70 | |||
68 | int FileDownloader::downloadFile(QString fileUrl, const QString &name) |
|
71 | int FileDownloader::downloadFile(QString fileUrl, const QString &name) | |
69 | { |
|
72 | { | |
70 | return downloadFile(QUrl(fileUrl),name); |
|
73 | return downloadFile(QUrl(fileUrl),name); | |
71 | } |
|
74 | } | |
72 |
|
75 | |||
73 | QDockWidget *FileDownloader::getGUI() |
|
76 | QDockWidget *FileDownloader::getGUI() | |
74 | { |
|
77 | { | |
75 | if(!_self->m_noGui && (m_gui==NULL)) |
|
78 | if(!_self->m_noGui && (m_gui==NULL)) | |
76 | { |
|
79 | { | |
77 | m_DownLoadHistory=new DownLoadHistory(); |
|
80 | m_DownLoadHistory=new DownLoadHistory(); | |
78 | m_gui=new QDockWidget("Download History"); |
|
81 | m_gui=new QDockWidget("Download History"); | |
79 | m_gui->setWidget(m_DownLoadHistory); |
|
82 | m_gui->setWidget(m_DownLoadHistory); | |
80 | m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); |
|
83 | m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); | |
|
84 | m_SettingsGui = new FileDowloaderSettingsGUI(); | |||
|
85 | QLopSettings::registerConfigEntry(this->m_SettingsGui,QIcon(":/img/Gnome-emblem-downloads.svg"),"Qlop Downloader"); | |||
81 | } |
|
86 | } | |
82 | return (QDockWidget*) m_gui; |
|
87 | return (QDockWidget*) m_gui; | |
83 | } |
|
88 | } | |
84 |
|
89 | |||
85 | const QString &FileDownloader::serviceName() |
|
90 | const QString &FileDownloader::serviceName() | |
86 | { |
|
91 | { | |
87 | return m_serviceName; |
|
92 | return m_serviceName; | |
88 | } |
|
93 | } | |
89 |
|
94 | |||
90 | int FileDownloader::download_file(QUrl fileUrl, const QString &name) |
|
95 | int FileDownloader::download_file(QUrl fileUrl, const QString &name) | |
91 | { |
|
96 | { | |
92 | return downloadFile(fileUrl,name); |
|
97 | return downloadFile(fileUrl,name); | |
93 | } |
|
98 | } | |
94 |
|
99 | |||
95 | int FileDownloader::download_file(QString fileUrl, const QString &name) |
|
100 | int FileDownloader::download_file(QString fileUrl, const QString &name) | |
96 | { |
|
101 | { | |
97 | return downloadFile(fileUrl,name); |
|
102 | return downloadFile(fileUrl,name); | |
98 | } |
|
103 | } | |
99 |
|
104 | |||
100 | FileDownloaderTask* FileDownloader::getDownloadTask(int ID) |
|
105 | FileDownloaderTask* FileDownloader::getDownloadTask(int ID) | |
101 | { |
|
106 | { | |
102 | _INIT |
|
107 | _INIT | |
103 | for(int i=0;i<m_pendingTasks->count();i++) |
|
108 | for(int i=0;i<m_pendingTasks->count();i++) | |
104 | { |
|
109 | { | |
105 | if(m_pendingTasks->at(i)->ID()==ID) |
|
110 | if(m_pendingTasks->at(i)->ID()==ID) | |
106 | return m_pendingTasks->at(i); |
|
111 | return m_pendingTasks->at(i); | |
107 | } |
|
112 | } | |
108 | return NULL; |
|
113 | return NULL; | |
109 | } |
|
114 | } | |
110 |
|
115 | |||
111 | bool FileDownloader::taskIsCompleted(int ID) |
|
116 | bool FileDownloader::taskIsCompleted(int ID) | |
112 | { |
|
117 | { | |
113 | return getDownloadTask(ID)->downloadComplete(); |
|
118 | return getDownloadTask(ID)->downloadComplete(); | |
114 | } |
|
119 | } | |
115 |
|
120 | |||
116 | FileDownloader *FileDownloader::self() |
|
121 | FileDownloader *FileDownloader::self() | |
117 | { |
|
122 | { | |
118 | _INIT |
|
123 | _INIT | |
119 | return _self; |
|
124 | return _self; | |
120 | } |
|
125 | } | |
121 |
|
126 | |||
122 | int FileDownloader::getTaskId() |
|
127 | int FileDownloader::getTaskId() | |
123 | { |
|
128 | { | |
124 | for(unsigned int i=0;i<INT_MAX;i++) |
|
129 | for(unsigned int i=0;i<INT_MAX;i++) | |
125 | { |
|
130 | { | |
126 | bool idValid=true; |
|
131 | bool idValid=true; | |
127 | for(int j=0;j<m_pendingTasks->count();j++) |
|
132 | for(int j=0;j<m_pendingTasks->count();j++) | |
128 | { |
|
133 | { | |
129 | if(m_pendingTasks->at(j)->ID()==(int)i) |
|
134 | if(m_pendingTasks->at(j)->ID()==(int)i) | |
130 | idValid=false; |
|
135 | idValid=false; | |
131 | } |
|
136 | } | |
132 | if(idValid) |
|
137 | if(idValid) | |
133 | return (int)i; |
|
138 | return (int)i; | |
134 | } |
|
139 | } | |
135 | return -1; |
|
140 | return -1; | |
136 | } |
|
141 | } | |
137 |
|
142 | |||
|
143 | void FileDownloader::proxyConfig() | |||
|
144 | { | |||
|
145 | ||||
|
146 | } | |||
|
147 | ||||
138 | void FileDownloader::init(bool noGUI, QObject *parent) |
|
148 | void FileDownloader::init(bool noGUI, QObject *parent) | |
139 | { |
|
149 | { | |
140 | if(Q_UNLIKELY(_self==NULL)) |
|
150 | if(Q_UNLIKELY(_self==NULL)) | |
141 | { |
|
151 | { | |
142 | _self=new FileDownloader(noGUI,parent); |
|
152 | _self=new FileDownloader(noGUI,parent); | |
143 | } |
|
153 | } | |
144 | } |
|
154 | } | |
145 |
|
155 | /*for gnome: | ||
|
156 | * | |||
|
157 | * gsettings list-recursively org.gnome.system.proxy | |||
|
158 | * gsettings get org.gnome.system.proxy.http host | |||
|
159 | * | |||
|
160 | * To detect desktop $XDG_CURRENT_DESKTOP | |||
|
161 | */ | |||
146 | FileDownloader::FileDownloader(bool noGUI,QObject *parent) : QLopService(parent) |
|
162 | FileDownloader::FileDownloader(bool noGUI,QObject *parent) : QLopService(parent) | |
147 | { |
|
163 | { | |
148 | QNetworkProxyQuery q(QUrl("http://www.google.com")); |
|
164 | QNetworkProxyQuery q(QUrl(QLatin1String("http://www.google.com"))); | |
149 | q.setQueryType(QNetworkProxyQuery::UrlRequest); |
|
165 | //q.setQueryType(QNetworkProxyQuery::UrlRequest); | |
150 | q.setProtocolTag("http"); |
|
166 | //q.setProtocolTag("http"); | |
151 | QList<QNetworkProxy> proxies = QNetworkProxyFactory::systemProxyForQuery(q); |
|
167 | QList<QNetworkProxy> proxies = QNetworkProxyFactory::systemProxyForQuery(q); | |
|
168 | foreach ( QNetworkProxy loopItem, proxies ) { | |||
|
169 | qDebug() << "proxyUsed:" << loopItem.hostName(); | |||
|
170 | } | |||
152 | if( proxies.size() > 0 && proxies[0].type() != QNetworkProxy::NoProxy ) |
|
171 | if( proxies.size() > 0 && proxies[0].type() != QNetworkProxy::NoProxy ) | |
153 | QNetworkProxy::setApplicationProxy(proxies[0]); |
|
172 | QNetworkProxy::setApplicationProxy(proxies[0]); | |
154 | else |
|
173 | else | |
155 | qDebug("No proxy server selected"); |
|
174 | qDebug("No proxy server selected"); | |
156 | m_WebCtrl = new QNetworkAccessManager(this); |
|
175 | m_WebCtrl = new QNetworkAccessManager(this); | |
157 | m_pendingTasks = new QList<FileDownloaderTask*>(); |
|
176 | m_pendingTasks = new QList<FileDownloaderTask*>(); | |
158 | m_noGui=noGUI; |
|
177 | m_noGui=noGUI; | |
159 | m_serviceName="FileDownloader"; |
|
178 | m_serviceName="FileDownloader"; | |
160 |
|
||||
161 | } |
|
179 | } | |
162 |
|
180 | |||
163 | FileDownloader::~FileDownloader() |
|
181 | FileDownloader::~FileDownloader() | |
164 | { |
|
182 | { | |
165 | if(!m_noGui) |
|
183 | if(!m_noGui) | |
166 | delete m_gui; |
|
184 | delete m_gui; | |
167 | while (m_pendingTasks->count()) |
|
185 | while (m_pendingTasks->count()) | |
168 | { |
|
186 | { | |
169 | FileDownloaderTask* task=m_pendingTasks->last(); |
|
187 | FileDownloaderTask* task=m_pendingTasks->last(); | |
170 | m_pendingTasks->removeLast(); |
|
188 | m_pendingTasks->removeLast(); | |
171 | delete task; |
|
189 | delete task; | |
172 | } |
|
190 | } | |
173 | delete m_WebCtrl; |
|
191 | delete m_WebCtrl; | |
174 | } |
|
192 | } | |
175 |
|
193 |
@@ -1,68 +1,72 | |||||
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 FILEDOWNLOADER_H |
|
23 | #ifndef FILEDOWNLOADER_H | |
24 | #define FILEDOWNLOADER_H |
|
24 | #define FILEDOWNLOADER_H | |
25 |
|
25 | |||
26 | #include <QObject> |
|
26 | #include <QObject> | |
27 | #include <QNetworkAccessManager> |
|
27 | #include <QNetworkAccessManager> | |
28 | #include <QNetworkReply> |
|
28 | #include <QNetworkReply> | |
29 | #include <QNetworkProxy> |
|
29 | #include <QNetworkProxy> | |
30 | #include <QList> |
|
30 | #include <QList> | |
31 | #include <QHash> |
|
31 | #include <QHash> | |
32 | #include <filedownloadertask.h> |
|
32 | #include <filedownloadertask.h> | |
33 | #include <downloadhistory.h> |
|
33 | #include <downloadhistory.h> | |
34 | #include <qlopservice.h> |
|
34 | #include <qlopservice.h> | |
35 | #include <QDockWidget> |
|
35 | #include <QDockWidget> | |
|
36 | #include <filedowloadersettingsgui.h> | |||
|
37 | #include <qlopsettings.h> | |||
36 |
|
38 | |||
37 | class FileDownloader : public QLopService |
|
39 | class FileDownloader : public QLopService | |
38 | { |
|
40 | { | |
39 | Q_OBJECT |
|
41 | Q_OBJECT | |
40 | private: |
|
42 | private: | |
41 | static FileDownloader* _self; |
|
43 | static FileDownloader* _self; | |
42 | static QNetworkAccessManager* m_WebCtrl; |
|
44 | static QNetworkAccessManager* m_WebCtrl; | |
43 | static QList<FileDownloaderTask*>* m_pendingTasks; |
|
45 | static QList<FileDownloaderTask*>* m_pendingTasks; | |
44 | static DownLoadHistory* m_DownLoadHistory; |
|
46 | static DownLoadHistory* m_DownLoadHistory; | |
45 | static QDockWidget* m_gui; |
|
47 | static QDockWidget* m_gui; | |
|
48 | static FileDowloaderSettingsGUI* m_SettingsGui; | |||
46 | FileDownloader(bool noGUI=false,QObject *parent = 0); |
|
49 | FileDownloader(bool noGUI=false,QObject *parent = 0); | |
47 | ~FileDownloader(); |
|
50 | ~FileDownloader(); | |
48 |
|
51 | |||
49 | public: |
|
52 | public: | |
50 | static void init(bool noGUI=false,QObject *parent = 0); |
|
53 | static void init(bool noGUI=false,QObject *parent = 0); | |
51 | static int downloadFile(QUrl fileUrl,const QString& name); |
|
54 | static int downloadFile(QUrl fileUrl,const QString& name); | |
52 | static int downloadFile(QString fileUrl,const QString& name); |
|
55 | static int downloadFile(QString fileUrl,const QString& name); | |
53 | static FileDownloaderTask *getDownloadTask(int ID); |
|
56 | static FileDownloaderTask *getDownloadTask(int ID); | |
54 | static bool taskIsCompleted(int ID); |
|
57 | static bool taskIsCompleted(int ID); | |
55 | static FileDownloader *self(); |
|
58 | static FileDownloader *self(); | |
56 | // QLopService methodes |
|
59 | // QLopService methodes | |
57 | QDockWidget* getGUI(); |
|
60 | QDockWidget* getGUI(); | |
58 | const QString& serviceName(); |
|
61 | const QString& serviceName(); | |
59 | signals: |
|
62 | signals: | |
60 |
|
63 | |||
61 | public slots: |
|
64 | public slots: | |
62 | int download_file(QUrl fileUrl,const QString& name); |
|
65 | int download_file(QUrl fileUrl,const QString& name); | |
63 | int download_file(QString fileUrl,const QString& name); |
|
66 | int download_file(QString fileUrl,const QString& name); | |
64 | private: |
|
67 | private: | |
65 | int getTaskId(); |
|
68 | int getTaskId(); | |
|
69 | void proxyConfig(); | |||
66 | }; |
|
70 | }; | |
67 |
|
71 | |||
68 | #endif // FILEDOWNLOADER_H |
|
72 | #endif // FILEDOWNLOADER_H |
@@ -1,140 +1,161 | |||||
|
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 | ----------------------------------------------------------------------------*/ | |||
1 | #include "qlopdatabase.h" |
|
22 | #include "qlopdatabase.h" | |
2 | #include <qlopdatabaseviewer.h> |
|
23 | #include <qlopdatabaseviewer.h> | |
3 |
|
24 | |||
4 | QList<QLopData*>* QLopDataBase::m_dataBase=NULL; |
|
25 | QList<QLopData*>* QLopDataBase::m_dataBase=NULL; | |
5 | QLopDataBase* QLopDataBase::_self=NULL; |
|
26 | QLopDataBase* QLopDataBase::_self=NULL; | |
6 | QDockWidget* QLopDataBase::m_gui=NULL; |
|
27 | QDockWidget* QLopDataBase::m_gui=NULL; | |
7 |
|
28 | |||
8 | #define INIT() \ |
|
29 | #define INIT() \ | |
9 | if(Q_UNLIKELY(_self==NULL))\ |
|
30 | if(Q_UNLIKELY(_self==NULL))\ | |
10 | {\ |
|
31 | {\ | |
11 | init();\ |
|
32 | init();\ | |
12 | } |
|
33 | } | |
13 |
|
34 | |||
14 | QLopDataBase::QLopDataBase(bool noGUI,QObject *parent) : QLopService(parent) |
|
35 | QLopDataBase::QLopDataBase(bool noGUI,QObject *parent) : QLopService(parent) | |
15 | { |
|
36 | { | |
16 | this->m_dataBase = new QList<QLopData*>(); |
|
37 | this->m_dataBase = new QList<QLopData*>(); | |
17 | m_serviceName="QLopDataBase"; |
|
38 | m_serviceName="QLopDataBase"; | |
18 | m_noGui=noGUI; |
|
39 | m_noGui=noGUI; | |
19 | } |
|
40 | } | |
20 |
|
41 | |||
21 | QLopDataBase::~QLopDataBase() |
|
42 | QLopDataBase::~QLopDataBase() | |
22 | { |
|
43 | { | |
23 |
|
44 | |||
24 | } |
|
45 | } | |
25 |
|
46 | |||
26 | QDockWidget *QLopDataBase::getGUI() |
|
47 | QDockWidget *QLopDataBase::getGUI() | |
27 | { |
|
48 | { | |
28 | if(!m_noGui && (m_gui==NULL)) |
|
49 | if(!m_noGui && (m_gui==NULL)) | |
29 | { |
|
50 | { | |
30 | m_gui=new QLopDataBaseViewer(); |
|
51 | m_gui=new QLopDataBaseViewer(); | |
31 | m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); |
|
52 | m_gui->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable); | |
32 | } |
|
53 | } | |
33 | return m_gui; |
|
54 | return m_gui; | |
34 | } |
|
55 | } | |
35 |
|
56 | |||
36 | void QLopDataBase::init(bool noGUI, QObject *parent) |
|
57 | void QLopDataBase::init(bool noGUI, QObject *parent) | |
37 | { |
|
58 | { | |
38 | _self=new QLopDataBase(); |
|
59 | _self=new QLopDataBase(noGUI,parent); | |
39 | } |
|
60 | } | |
40 |
|
61 | |||
41 | const QString &QLopDataBase::serviceName() |
|
62 | const QString &QLopDataBase::serviceName() | |
42 | { |
|
63 | { | |
43 | INIT(); |
|
64 | INIT(); | |
44 | return m_serviceName; |
|
65 | return m_serviceName; | |
45 | } |
|
66 | } | |
46 |
|
67 | |||
47 | int QLopDataBase::addData(QLopData *data) |
|
68 | int QLopDataBase::addData(QLopData *data) | |
48 | { |
|
69 | { | |
49 | INIT(); |
|
70 | INIT(); | |
50 | if(!m_dataBase->contains(data)) |
|
71 | if(!m_dataBase->contains(data)) | |
51 | { |
|
72 | { | |
52 | m_dataBase->append(data); |
|
73 | m_dataBase->append(data); | |
53 | emit QLopDataBase::self()->DBChanged(); |
|
74 | emit QLopDataBase::self()->DBChanged(); | |
54 | return 1; |
|
75 | return 1; | |
55 | } |
|
76 | } | |
56 | return 0; |
|
77 | return 0; | |
57 | } |
|
78 | } | |
58 |
|
79 | |||
59 | int QLopDataBase::addData(const QLopDataList& data) |
|
80 | int QLopDataBase::addData(const QLopDataList& data) | |
60 | { |
|
81 | { | |
61 | INIT(); |
|
82 | INIT(); | |
62 | int addedData=0; |
|
83 | int addedData=0; | |
63 | for (int i = 0; i < data.count(); i++) |
|
84 | for (int i = 0; i < data.count(); i++) | |
64 | { |
|
85 | { | |
65 | addedData += addData(data.at(i)); |
|
86 | addedData += addData(data.at(i)); | |
66 | } |
|
87 | } | |
67 | emit QLopDataBase::self()->DBChanged(); |
|
88 | emit QLopDataBase::self()->DBChanged(); | |
68 | return addedData; |
|
89 | return addedData; | |
69 | } |
|
90 | } | |
70 |
|
91 | |||
71 | int QLopDataBase::removeData(QLopData *data) |
|
92 | int QLopDataBase::removeData(QLopData *data) | |
72 | { |
|
93 | { | |
73 | INIT(); |
|
94 | INIT(); | |
74 | if(m_dataBase->contains(data)) |
|
95 | if(m_dataBase->contains(data)) | |
75 | { |
|
96 | { | |
76 | m_dataBase->removeAll(data); |
|
97 | m_dataBase->removeAll(data); | |
77 | emit QLopDataBase::self()->DBChanged(); |
|
98 | emit QLopDataBase::self()->DBChanged(); | |
78 | return 1; |
|
99 | return 1; | |
79 | } |
|
100 | } | |
80 | return 0; |
|
101 | return 0; | |
81 | } |
|
102 | } | |
82 |
|
103 | |||
83 | int QLopDataBase::removeData(const QLopDataList &data) |
|
104 | int QLopDataBase::removeData(const QLopDataList &data) | |
84 | { |
|
105 | { | |
85 | INIT(); |
|
106 | INIT(); | |
86 | int removedData=0; |
|
107 | int removedData=0; | |
87 | for (int i = 0; i < data.count(); i++) |
|
108 | for (int i = 0; i < data.count(); i++) | |
88 | { |
|
109 | { | |
89 | removedData += removeData(data.at(i)); |
|
110 | removedData += removeData(data.at(i)); | |
90 | } |
|
111 | } | |
91 | emit QLopDataBase::self()->DBChanged(); |
|
112 | emit QLopDataBase::self()->DBChanged(); | |
92 | return removedData; |
|
113 | return removedData; | |
93 | } |
|
114 | } | |
94 |
|
115 | |||
95 | QLopDataBase *QLopDataBase::self() |
|
116 | QLopDataBase *QLopDataBase::self() | |
96 | { |
|
117 | { | |
97 | INIT(); |
|
118 | INIT(); | |
98 | return _self; |
|
119 | return _self; | |
99 | } |
|
120 | } | |
100 |
|
121 | |||
101 | int QLopDataBase::count() |
|
122 | int QLopDataBase::count() | |
102 | { |
|
123 | { | |
103 | INIT(); |
|
124 | INIT(); | |
104 | return m_dataBase->count(); |
|
125 | return m_dataBase->count(); | |
105 | } |
|
126 | } | |
106 |
|
127 | |||
107 | QLopData *QLopDataBase::getData(const QString &name) |
|
128 | QLopData *QLopDataBase::getData(const QString &name) | |
108 | { |
|
129 | { | |
109 | INIT(); |
|
130 | INIT(); | |
110 | for (int i = 0; i < m_dataBase->count(); i++) |
|
131 | for (int i = 0; i < m_dataBase->count(); i++) | |
111 | { |
|
132 | { | |
112 | if(Q_UNLIKELY(m_dataBase->at(i)->name==name)) |
|
133 | if(Q_UNLIKELY(m_dataBase->at(i)->name==name)) | |
113 | { |
|
134 | { | |
114 | return m_dataBase->at(i); |
|
135 | return m_dataBase->at(i); | |
115 | } |
|
136 | } | |
116 | } |
|
137 | } | |
117 | return NULL; |
|
138 | return NULL; | |
118 | } |
|
139 | } | |
119 |
|
140 | |||
120 | QLopData *QLopDataBase::getData(int ID) |
|
141 | QLopData *QLopDataBase::getData(int ID) | |
121 | { |
|
142 | { | |
122 | INIT(); |
|
143 | INIT(); | |
123 | for (int i = 0; i < m_dataBase->count(); i++) |
|
144 | for (int i = 0; i < m_dataBase->count(); i++) | |
124 | { |
|
145 | { | |
125 | if(Q_UNLIKELY(m_dataBase->at(i)->ID==ID)) |
|
146 | if(Q_UNLIKELY(m_dataBase->at(i)->ID==ID)) | |
126 | { |
|
147 | { | |
127 | return m_dataBase->at(i); |
|
148 | return m_dataBase->at(i); | |
128 | } |
|
149 | } | |
129 | } |
|
150 | } | |
130 | return NULL; |
|
151 | return NULL; | |
131 | } |
|
152 | } | |
132 |
|
153 | |||
133 | QLopData *QLopDataBase::getDataFromIdex(int index) |
|
154 | QLopData *QLopDataBase::getDataFromIdex(int index) | |
134 | { |
|
155 | { | |
135 | if((index>=0)&&(index<m_dataBase->count())) |
|
156 | if((index>=0)&&(index<m_dataBase->count())) | |
136 | return m_dataBase->at(index); |
|
157 | return m_dataBase->at(index); | |
137 | else |
|
158 | else | |
138 | return NULL; |
|
159 | return NULL; | |
139 | } |
|
160 | } | |
140 |
|
161 |
@@ -1,38 +1,59 | |||||
|
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 | ----------------------------------------------------------------------------*/ | |||
1 | #ifndef QLOPDATABASE_H |
|
22 | #ifndef QLOPDATABASE_H | |
2 | #define QLOPDATABASE_H |
|
23 | #define QLOPDATABASE_H | |
3 |
|
24 | |||
4 | #include <QObject> |
|
25 | #include <QObject> | |
5 | #include <qlopdata.h> |
|
26 | #include <qlopdata.h> | |
6 | #include <QList> |
|
27 | #include <QList> | |
7 | #include <qlopservice.h> |
|
28 | #include <qlopservice.h> | |
8 |
|
29 | |||
9 | class QLopDataBaseViewer; |
|
30 | class QLopDataBaseViewer; | |
10 |
|
31 | |||
11 | class QLopDataBase : public QLopService |
|
32 | class QLopDataBase : public QLopService | |
12 | { |
|
33 | { | |
13 | Q_OBJECT |
|
34 | Q_OBJECT | |
14 | static QDockWidget* m_gui; |
|
35 | static QDockWidget* m_gui; | |
15 | QLopDataBase(bool noGUI=false,QObject *parent = 0); |
|
36 | QLopDataBase(bool noGUI=false,QObject *parent = 0); | |
16 | ~QLopDataBase(); |
|
37 | ~QLopDataBase(); | |
17 | static QLopDataBase* _self; |
|
38 | static QLopDataBase* _self; | |
18 | public: |
|
39 | public: | |
19 | QDockWidget* getGUI(); |
|
40 | QDockWidget* getGUI(); | |
20 | static void init(bool noGUI=false,QObject *parent = 0); |
|
41 | static void init(bool noGUI=false,QObject *parent = 0); | |
21 | const QString& serviceName(); |
|
42 | const QString& serviceName(); | |
22 | static int addData(QLopData* data); |
|
43 | static int addData(QLopData* data); | |
23 | static int addData(const QLopDataList &data); |
|
44 | static int addData(const QLopDataList &data); | |
24 | static int removeData(QLopData* data); |
|
45 | static int removeData(QLopData* data); | |
25 | static int removeData(const QLopDataList &data); |
|
46 | static int removeData(const QLopDataList &data); | |
26 | static QLopDataBase* self(); |
|
47 | static QLopDataBase* self(); | |
27 | static int count(); |
|
48 | static int count(); | |
28 | static QLopData* getData(const QString& name); |
|
49 | static QLopData* getData(const QString& name); | |
29 | static QLopData* getData(int ID); |
|
50 | static QLopData* getData(int ID); | |
30 | QLopData* getDataFromIdex(int index); |
|
51 | QLopData* getDataFromIdex(int index); | |
31 | signals: |
|
52 | signals: | |
32 | void DBChanged(); |
|
53 | void DBChanged(); | |
33 | public slots: |
|
54 | public slots: | |
34 | private: |
|
55 | private: | |
35 | static QList<QLopData*>* m_dataBase; |
|
56 | static QList<QLopData*>* m_dataBase; | |
36 | }; |
|
57 | }; | |
37 |
|
58 | |||
38 | #endif // QLOPDATABASE_H |
|
59 | #endif // QLOPDATABASE_H |
@@ -1,54 +1,57 | |||||
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 <QApplication> |
|
23 | #include <QApplication> | |
24 | #include <omp.h> |
|
24 | #include <omp.h> | |
25 | #include <QProcessEnvironment> |
|
25 | #include <QProcessEnvironment> | |
26 | #include <qglobal.h> |
|
26 | #include <qglobal.h> | |
27 | #include <QThread> |
|
27 | #include <QThread> | |
28 | #include "abstractfileloader.h" |
|
28 | #include "abstractfileloader.h" | |
29 | #include <qlopdata.h> |
|
29 | #include <qlopdata.h> | |
30 |
|
30 | |||
31 | int main(int argc, char *argv[]) |
|
31 | int main(int argc, char *argv[]) | |
32 | { |
|
32 | { | |
33 | QApplication a(argc, argv); |
|
33 | QApplication a(argc, argv); | |
34 | QByteArray OMP_NUM_THREADS = qgetenv("OMP_NUM_THREADS"); |
|
34 | QByteArray OMP_NUM_THREADS = qgetenv("OMP_NUM_THREADS"); | |
35 | int OMP_THREADS; |
|
35 | int OMP_THREADS; | |
36 | if (0==OMP_NUM_THREADS.count()) |
|
36 | if (0==OMP_NUM_THREADS.count()) | |
37 | { |
|
37 | { | |
38 | omp_set_num_threads(QThread::idealThreadCount()); |
|
38 | omp_set_num_threads(QThread::idealThreadCount()); | |
39 | // omp_set_num_threads(2); |
|
39 | // omp_set_num_threads(2); | |
40 | OMP_THREADS = QThread::idealThreadCount(); |
|
40 | OMP_THREADS = QThread::idealThreadCount(); | |
41 | } |
|
41 | } | |
42 | else |
|
42 | else | |
43 | { |
|
43 | { | |
44 | OMP_THREADS = QString(OMP_NUM_THREADS).toInt(); |
|
44 | OMP_THREADS = QString(OMP_NUM_THREADS).toInt(); | |
45 | } |
|
45 | } | |
46 | qRegisterMetaType<QListOfDataVector>("QListOfDataVector"); |
|
46 | qRegisterMetaType<QListOfDataVector>("QListOfDataVector"); | |
47 | qRegisterMetaType<QLopDataList>("QLopDataList"); |
|
47 | qRegisterMetaType<QLopDataList>("QLopDataList"); | |
|
48 | QApplication::setOrganizationName("LPP"); | |||
|
49 | QApplication::setOrganizationDomain("lpp.fr"); | |||
|
50 | QApplication::setApplicationName("QLop"); | |||
48 | MainWindow w(OMP_THREADS); |
|
51 | MainWindow w(OMP_THREADS); | |
49 | w.show(); |
|
52 | w.show(); | |
50 |
|
53 | |||
51 | return a.exec(); |
|
54 | return a.exec(); | |
52 | } |
|
55 | } | |
53 |
|
56 | |||
54 |
|
57 |
@@ -1,148 +1,123 | |||||
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 | #include <qlopdatabase.h> | |
|
36 | #include <qlopsettings.h> | |||
|
37 | #include <qlopgui.h> | |||
|
38 | ||||
36 |
|
39 | |||
37 | const QList<QLopService*>ServicesToLoad=QList<QLopService*>() |
|
40 | const QList<QLopService*>ServicesToLoad=QList<QLopService*>() | |
38 | <<QLopDataBase::self() |
|
41 | <<QLopDataBase::self() | |
39 | <<FileDownloader::self() |
|
42 | <<FileDownloader::self() | |
40 | <<CassiniTools::self() |
|
43 | <<CassiniTools::self() | |
41 | << QLopPlots::self(); |
|
44 | << QLopPlots::self(); | |
42 |
|
45 | |||
43 | MainWindow::MainWindow(int OMP_THREADS, QWidget *parent) : |
|
46 | MainWindow::MainWindow(int OMP_THREADS, QWidget *parent) : | |
44 | QMainWindow(parent), |
|
47 | QMainWindow(parent), | |
45 | ui(new Ui::MainWindow) |
|
48 | ui(new Ui::MainWindow) | |
46 | { |
|
49 | { | |
47 | this->OMP_THREADS = OMP_THREADS; |
|
50 | this->OMP_THREADS = OMP_THREADS; | |
48 | ui->setupUi(this); |
|
51 | ui->setupUi(this); | |
|
52 | QLopGUI::registerMenuBar(menuBar()); | |||
49 | this->setWindowIcon(QIcon(":img/QLop.svg")); |
|
53 | this->setWindowIcon(QIcon(":img/QLop.svg")); | |
50 |
|
||||
51 | // QLopPlots::getPlot()->setXaxisTickLabelType(QCPAxis::ltDateTime); |
|
|||
52 | // QLopPlots::getPlot()->setXaxisDateTimeFormat("hh:mm:ss.zzz"); |
|
|||
53 | this->progressWidget = new QWidget(); |
|
54 | this->progressWidget = new QWidget(); | |
54 | this->progressLayout = new QVBoxLayout(this->progressWidget); |
|
55 | this->progressLayout = new QVBoxLayout(this->progressWidget); | |
55 | this->progressWidget->setLayout(this->progressLayout); |
|
56 | this->progressWidget->setLayout(this->progressLayout); | |
56 | this->progressWidget->setWindowModality(Qt::WindowModal); |
|
57 | this->progressWidget->setWindowModality(Qt::WindowModal); | |
57 | progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int)); |
|
58 | progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int)); | |
58 | for(int i=0;i<OMP_THREADS;i++) |
|
59 | for(int i=0;i<OMP_THREADS;i++) | |
59 | { |
|
60 | { | |
60 | this->progress.append(new QProgressBar(this->progressWidget)); |
|
61 | this->progress.append(new QProgressBar(this->progressWidget)); | |
61 | this->progress.last()->setMinimum(0); |
|
62 | this->progress.last()->setMinimum(0); | |
62 | this->progress.last()->setMaximum(100); |
|
63 | this->progress.last()->setMaximum(100); | |
63 | this->progressLayout->addWidget(this->progress.last()); |
|
64 | this->progressLayout->addWidget(this->progress.last()); | |
64 | this->progressWidget->hide(); |
|
65 | this->progressWidget->hide(); | |
65 | this->progressThreadIds[i] = -1; |
|
66 | this->progressThreadIds[i] = -1; | |
66 | } |
|
67 | } | |
67 | this->progressWidget->setWindowTitle("Loading File"); |
|
68 | this->progressWidget->setWindowTitle("Loading File"); | |
68 | for(int i=0;i<ServicesToLoad.count();i++) |
|
69 | for(int i=0;i<ServicesToLoad.count();i++) | |
69 | { |
|
70 | { | |
70 | qDebug()<<ServicesToLoad.at(i)->serviceName(); |
|
71 | qDebug()<<ServicesToLoad.at(i)->serviceName(); | |
71 | QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI(); |
|
72 | QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI(); | |
72 | wdgt->setAllowedAreas(Qt::AllDockWidgetAreas); |
|
73 | wdgt->setAllowedAreas(Qt::AllDockWidgetAreas); | |
73 | this->addDockWidget(Qt::TopDockWidgetArea,wdgt); |
|
74 | this->addDockWidget(Qt::TopDockWidgetArea,wdgt); | |
74 | PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i)); |
|
75 | PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i)); | |
75 | } |
|
76 | } | |
76 | } |
|
77 | } | |
77 |
|
78 | |||
78 | MainWindow::~MainWindow() |
|
79 | MainWindow::~MainWindow() | |
79 | { |
|
80 | { | |
80 | delete ui; |
|
81 | delete ui; | |
81 | } |
|
82 | } | |
82 |
|
83 | |||
83 | //QString MainWindow::getFilePath(const QString &name) |
|
|||
84 | //{ |
|
|||
85 | //// for(int i=0;i<this->folderViews.count();i++) |
|
|||
86 | //// { |
|
|||
87 | //// if(folderViews.at(i)->isDraging(name)) |
|
|||
88 | //// return folderViews.at(i)->currentFolder(); |
|
|||
89 | //// } |
|
|||
90 | // return ""; |
|
|||
91 | //} |
|
|||
92 |
|
||||
93 |
|
||||
94 |
|
||||
95 |
|
||||
96 | void MainWindow::updateProgress(int threadId, int percentProgress) |
|
84 | void MainWindow::updateProgress(int threadId, int percentProgress) | |
97 | { |
|
85 | { | |
98 | bool updated=false; |
|
86 | bool updated=false; | |
99 | for(int i=0;i<OMP_THREADS;i++) |
|
87 | for(int i=0;i<OMP_THREADS;i++) | |
100 | { |
|
88 | { | |
101 | if(progressThreadIds[i]==threadId) |
|
89 | if(progressThreadIds[i]==threadId) | |
102 | { |
|
90 | { | |
103 | if(threadId<this->progress.count()) |
|
91 | if(threadId<this->progress.count()) | |
104 | { |
|
92 | { | |
105 | this->progress.at(i)->setValue(percentProgress); |
|
93 | this->progress.at(i)->setValue(percentProgress); | |
106 | updated=true; |
|
94 | updated=true; | |
107 | } |
|
95 | } | |
108 | } |
|
96 | } | |
109 | } |
|
97 | } | |
110 | if(Q_UNLIKELY(updated==false)) |
|
98 | if(Q_UNLIKELY(updated==false)) | |
111 | { |
|
99 | { | |
112 | for(int i=0;i<OMP_THREADS;i++) |
|
100 | for(int i=0;i<OMP_THREADS;i++) | |
113 | { |
|
101 | { | |
114 | if(progressThreadIds[i]==-1) |
|
102 | if(progressThreadIds[i]==-1) | |
115 | { |
|
103 | { | |
116 | progressThreadIds[i] = threadId; |
|
104 | progressThreadIds[i] = threadId; | |
117 | updateProgress(threadId,percentProgress); |
|
105 | updateProgress(threadId,percentProgress); | |
118 | return; |
|
106 | return; | |
119 | } |
|
107 | } | |
120 | } |
|
108 | } | |
121 | } |
|
109 | } | |
122 | } |
|
110 | } | |
123 |
|
111 | |||
124 |
|
112 | |||
125 | void MainWindow::askGlobalRescan() |
|
|||
126 | { |
|
|||
127 | // for(int i=0;i<this->folderViews.count();i++) |
|
|||
128 | // { |
|
|||
129 | // this->folderViews.at(i)->refreshFolder(); |
|
|||
130 | // } |
|
|||
131 | } |
|
|||
132 |
|
||||
133 | void MainWindow::showThemisIndexViewer() |
|
|||
134 | { |
|
|||
135 |
|
||||
136 | } |
|
|||
137 |
|
||||
138 | void MainWindow::changeEvent(QEvent *e) |
|
113 | void MainWindow::changeEvent(QEvent *e) | |
139 | { |
|
114 | { | |
140 | QMainWindow::changeEvent(e); |
|
115 | QMainWindow::changeEvent(e); | |
141 | switch (e->type()) { |
|
116 | switch (e->type()) { | |
142 | case QEvent::LanguageChange: |
|
117 | case QEvent::LanguageChange: | |
143 | ui->retranslateUi(this); |
|
118 | ui->retranslateUi(this); | |
144 | break; |
|
119 | break; | |
145 | default: |
|
120 | default: | |
146 | break; |
|
121 | break; | |
147 | } |
|
122 | } | |
148 | } |
|
123 | } |
@@ -1,67 +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 MAINWINDOW_H |
|
22 | #ifndef MAINWINDOW_H | |
23 | #define MAINWINDOW_H |
|
23 | #define MAINWINDOW_H | |
24 |
|
24 | |||
25 | #include <QMainWindow> |
|
25 | #include <QMainWindow> | |
26 | #include <QThread> |
|
26 | #include <QThread> | |
27 | #include "cassinidatafile.h" |
|
27 | #include "cassinidatafile.h" | |
28 | #include <QProgressDialog> |
|
28 | #include <QProgressDialog> | |
29 | #include <QProgressBar> |
|
29 | #include <QProgressBar> | |
30 | #include <QListWidgetItem> |
|
30 | #include <QListWidgetItem> | |
31 | #include <QVBoxLayout> |
|
31 | #include <QVBoxLayout> | |
32 | #include <QWidget> |
|
32 | #include <QWidget> | |
33 | #include "abstractfileloader.h" |
|
33 | #include "abstractfileloader.h" | |
34 | #include "cassiniindexfileviewer.h" |
|
34 | #include "cassiniindexfileviewer.h" | |
35 | #include <downloadhistory.h> |
|
35 | #include <downloadhistory.h> | |
36 | #include <qlopservice.h> |
|
36 | #include <qlopservice.h> | |
|
37 | #include <qlopgui.h> | |||
37 |
|
38 | |||
38 | namespace Ui { |
|
39 | namespace Ui { | |
39 | class MainWindow; |
|
40 | class MainWindow; | |
40 | } |
|
41 | } | |
41 |
|
42 | |||
42 | class MainWindow : public QMainWindow |
|
43 | class MainWindow : public QMainWindow | |
43 | { |
|
44 | { | |
44 | Q_OBJECT |
|
45 | Q_OBJECT | |
45 |
|
46 | |||
46 | public: |
|
47 | public: | |
47 | explicit MainWindow(int OMP_THREADS,QWidget *parent = 0); |
|
48 | explicit MainWindow(int OMP_THREADS,QWidget *parent = 0); | |
48 | ~MainWindow(); |
|
49 | ~MainWindow(); | |
49 | QString getFilePath(const QString& name); |
|
|||
50 | public slots: |
|
50 | public slots: | |
51 | void updateProgress(int threadId,int percentProgress); |
|
51 | void updateProgress(int threadId,int percentProgress); | |
52 | void askGlobalRescan(); |
|
52 | ||
53 | void showThemisIndexViewer(); |
|
|||
54 | protected: |
|
53 | protected: | |
55 | void changeEvent(QEvent *e); |
|
54 | void changeEvent(QEvent *e); | |
56 |
|
55 | |||
57 | private: |
|
56 | private: | |
58 | Ui::MainWindow *ui; |
|
57 | Ui::MainWindow *ui; | |
59 | QList<QProgressBar*> progress; |
|
58 | QList<QProgressBar*> progress; | |
60 | int* progressThreadIds; |
|
59 | int* progressThreadIds; | |
61 | QWidget* progressWidget; |
|
60 | QWidget* progressWidget; | |
62 | QVBoxLayout*progressLayout; |
|
61 | QVBoxLayout*progressLayout; | |
63 | QList<QLopService*> qlopServices; |
|
62 | QList<QLopService*> qlopServices; | |
64 | int OMP_THREADS; |
|
63 | int OMP_THREADS; | |
65 | }; |
|
64 | }; | |
66 |
|
65 | |||
67 | #endif // MAINWINDOW_H |
|
66 | #endif // MAINWINDOW_H |
@@ -1,77 +1,64 | |||||
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>MainWindow</class> |
|
3 | <class>MainWindow</class> | |
4 | <widget class="QMainWindow" name="MainWindow"> |
|
4 | <widget class="QMainWindow" name="MainWindow"> | |
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>800</width> |
|
9 | <width>800</width> | |
10 | <height>600</height> |
|
10 | <height>600</height> | |
11 | </rect> |
|
11 | </rect> | |
12 | </property> |
|
12 | </property> | |
13 | <property name="windowTitle"> |
|
13 | <property name="windowTitle"> | |
14 | <string>QLop</string> |
|
14 | <string>QLop</string> | |
15 | </property> |
|
15 | </property> | |
16 | <property name="dockNestingEnabled"> |
|
16 | <property name="dockNestingEnabled"> | |
17 | <bool>true</bool> |
|
17 | <bool>true</bool> | |
18 | </property> |
|
18 | </property> | |
19 | <widget class="PythonConsole" name="centralWidget"> |
|
19 | <widget class="PythonConsole" name="centralWidget"> | |
20 | <property name="enabled"> |
|
20 | <property name="enabled"> | |
21 | <bool>true</bool> |
|
21 | <bool>true</bool> | |
22 | </property> |
|
22 | </property> | |
23 | <property name="sizePolicy"> |
|
23 | <property name="sizePolicy"> | |
24 | <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> |
|
24 | <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> | |
25 | <horstretch>0</horstretch> |
|
25 | <horstretch>0</horstretch> | |
26 | <verstretch>0</verstretch> |
|
26 | <verstretch>0</verstretch> | |
27 | </sizepolicy> |
|
27 | </sizepolicy> | |
28 | </property> |
|
28 | </property> | |
29 | <property name="maximumSize"> |
|
29 | <property name="maximumSize"> | |
30 | <size> |
|
30 | <size> | |
31 | <width>16777215</width> |
|
31 | <width>16777215</width> | |
32 | <height>16777215</height> |
|
32 | <height>16777215</height> | |
33 | </size> |
|
33 | </size> | |
34 | </property> |
|
34 | </property> | |
35 | </widget> |
|
35 | </widget> | |
36 | <widget class="QMenuBar" name="menuBar"> |
|
36 | <widget class="QMenuBar" name="menuBar"> | |
37 | <property name="geometry"> |
|
37 | <property name="geometry"> | |
38 | <rect> |
|
38 | <rect> | |
39 | <x>0</x> |
|
39 | <x>0</x> | |
40 | <y>0</y> |
|
40 | <y>0</y> | |
41 | <width>800</width> |
|
41 | <width>800</width> | |
42 | <height>27</height> |
|
42 | <height>27</height> | |
43 | </rect> |
|
43 | </rect> | |
44 | </property> |
|
44 | </property> | |
45 | <widget class="QMenu" name="menuTools"> |
|
|||
46 | <property name="title"> |
|
|||
47 | <string>tools</string> |
|
|||
48 | </property> |
|
|||
49 | <widget class="QMenu" name="menuThemis"> |
|
|||
50 | <property name="title"> |
|
|||
51 | <string>Themis</string> |
|
|||
52 | </property> |
|
|||
53 | <addaction name="actionIndex_Viewer"/> |
|
|||
54 | </widget> |
|
|||
55 | <addaction name="menuThemis"/> |
|
|||
56 | </widget> |
|
|||
57 | <addaction name="menuTools"/> |
|
|||
58 | </widget> |
|
45 | </widget> | |
59 | <widget class="QStatusBar" name="statusBar"/> |
|
46 | <widget class="QStatusBar" name="statusBar"/> | |
60 | <action name="actionIndex_Viewer"> |
|
47 | <action name="actionIndex_Viewer"> | |
61 | <property name="text"> |
|
48 | <property name="text"> | |
62 | <string>Index Viewer</string> |
|
49 | <string>Index Viewer</string> | |
63 | </property> |
|
50 | </property> | |
64 | </action> |
|
51 | </action> | |
65 | </widget> |
|
52 | </widget> | |
66 | <layoutdefault spacing="6" margin="11"/> |
|
53 | <layoutdefault spacing="6" margin="11"/> | |
67 | <customwidgets> |
|
54 | <customwidgets> | |
68 | <customwidget> |
|
55 | <customwidget> | |
69 | <class>PythonConsole</class> |
|
56 | <class>PythonConsole</class> | |
70 | <extends>QWidget</extends> |
|
57 | <extends>QWidget</extends> | |
71 | <header location="global">pythonconsole.h</header> |
|
58 | <header location="global">pythonconsole.h</header> | |
72 | <container>1</container> |
|
59 | <container>1</container> | |
73 | </customwidget> |
|
60 | </customwidget> | |
74 | </customwidgets> |
|
61 | </customwidgets> | |
75 | <resources/> |
|
62 | <resources/> | |
76 | <connections/> |
|
63 | <connections/> | |
77 | </ui> |
|
64 | </ui> |
General Comments 0
You need to be logged in to leave comments.
Login now