##// END OF EJS Templates
Refactoring of app module to avoir vera++ warning and to dispatch sources files in the corrects paths
perrinel -
r54:7bf435c144fc
parent child
Show More
@@ -1,149 +1,147
1 1
2 2 ## sciqlop - CMakeLists.txt
3 3 SET(EXECUTABLE_NAME "sciqlop")
4 4 SCIQLOP_SET_TO_PARENT_SCOPE(EXECUTABLE_NAME)
5 5 SET(SOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/)
6 SET(INCLUDE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/include)
7 SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/src)
6 SET(INCLUDES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
7 SET(UI_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/ui)
8 8 SET(RES_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/resources)
9 9
10 # Include gui directory
11 include_directories("${INCLUDES_DIR}")
12
10 13 #
11 14 # Find Qt modules
12 15 #
13 16 SCIQLOP_FIND_QT(Core Widgets)
14 17
15 18 #
16 19 # Find dependent libraries
17 20 # ========================
18 21 find_package(sciqlop-gui)
19 22
20 23 SET(LIBRARIES ${SCIQLOP-GUI_LIBRARIES})
21 24 SET(EXTERN_SHARED_LIBRARIES)
22 25
23 26 INCLUDE_DIRECTORIES(${SCIQLOP-GUI_INCLUDE_DIR})
24 27
25 28 # Add sqpcore to the list of libraries to use
26 29 list(APPEND LIBRARIES ${SQPCORE_LIBRARY_NAME})
27 30
28 31 # Include core directory
29 32 include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../core/include")
30 33
31 34 # Add dependent shared libraries
32 35 list(APPEND SHARED_LIBRARIES ${SQPCORE_SHARED_LIBRARIES})
33 36
34 37 # Retrieve the location of the dynamic library to copy it to the output path
35 38 #get_property(sqpcoreLocation TARGET ${SQPCORE_LIBRARY_NAME} PROPERTY LOCATION)
36 39 list(APPEND SHARED_LIBRARIES_FROM_TARGETS ${sqpcoreLocation})
37 40
41 # Ui files
42 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
43
38 44 #
39 45 # Compile the application
40 46 #
41 47 FILE (GLOB_RECURSE APPLICATION_SOURCES
42 ${SOURCES_DIR}/*.c
43 ${SOURCES_DIR}/*.cpp
44 ${SOURCES_DIR}/*.h)
45
46 # Headers files (.h)
47 FILE (GLOB_RECURSE PROJECT_HEADERS ${INCLUDE_FOLDER}/*.h)
48 ${INCLUDES_DIR}/*.h
49 ${SOURCES_DIR}/*.c
50 ${SOURCES_DIR}/*.cpp
51 ${SOURCES_DIR}/*.h
52 ${PROJECT_FORMS})
48 53
49 # Ui files
50 FILE (GLOB_RECURSE PROJECT_FORMS ${UI_FOLDER}/*.ui)
51
52 # Resources files
53 FILE (GLOB_RECURSE PROJECT_RESOURCES ${RES_FOLDER}/*.qrc)
54
55 # Retrieve resources files
56 54 FILE (GLOB_RECURSE APPLICATION_RESOURCES ${RES_FOLDER}/*.qrc)
57 55
58 56 QT5_ADD_RESOURCES(RCC_HDRS ${APPLICATION_RESOURCES} )
59 57
60 58 QT5_WRAP_UI(UIS_HDRS
61 59 ${PROJECT_FORMS}
62 60 )
63 61
64 62
65 63 ADD_EXECUTABLE(${EXECUTABLE_NAME} ${APPLICATION_SOURCES} ${RCC_HDRS} ${UIS_HDRS})
66 64 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD 14)
67 65 set_property(TARGET ${EXECUTABLE_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)
68 66 target_link_libraries(${EXECUTABLE_NAME}
69 67 ${LIBRARIES})
70 68
71 69 # Link with Qt5 modules
72 70 qt5_use_modules(${EXECUTABLE_NAME} Core Widgets)
73 71
74 72
75 73 # Add the files to the list of files to be analyzed
76 74 LIST(APPEND CHECKSTYLE_INPUT_FILES ${APPLICATION_SOURCES})
77 75 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_INPUT_FILES)
78 76 # Vera++ exclusion files
79 77 LIST(APPEND CHECKSTYLE_EXCLUSION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/vera-exclusions/exclusions.txt)
80 78 SCIQLOP_SET_TO_PARENT_SCOPE(CHECKSTYLE_EXCLUSION_FILES)
81 79
82 80 #
83 81 # Compile the tests
84 82 #
85 83 IF(BUILD_TESTS)
86 84
87 85 INCLUDE_DIRECTORIES(${SOURCES_DIR})
88 86 FILE (GLOB_RECURSE TESTS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/Test*.cpp)
89 87 FILE (GLOB_RECURSE TESTS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/Test*.h)
90 88 SET( TEST_LIBRARIES ${LIBRARIES})
91 89
92 90 FOREACH( testFile ${TESTS_SOURCES} )
93 91 GET_FILENAME_COMPONENT( testDirectory ${testFile} DIRECTORY )
94 92 GET_FILENAME_COMPONENT( testName ${testFile} NAME_WE )
95 93
96 94 # Add to the list of sources files all the sources in the same
97 95 # directory that aren't another test
98 96 FILE (GLOB currentTestSources
99 97 ${testDirectory}/*.c
100 98 ${testDirectory}/*.cpp
101 99 ${testDirectory}/*.h)
102 100 LIST (REMOVE_ITEM currentTestSources ${TESTS_SOURCES})
103 101 LIST (REMOVE_ITEM currentTestSources ${TESTS_HEADERS})
104 102
105 103 ADD_EXECUTABLE(${testName} ${testFile} ${currentTestSources})
106 104 TARGET_LINK_LIBRARIES( ${testName} ${TEST_LIBRARIES})
107 105 qt5_use_modules(${testName} Test)
108 106
109 107 ADD_TEST( NAME ${testName} COMMAND ${testName} )
110 108
111 109 SCIQLOP_COPY_TO_TARGET(RUNTIME ${testName})
112 110 ENDFOREACH( testFile )
113 111
114 112 LIST(APPEND testFilesToFormat ${TESTS_SOURCES})
115 113 LIST(APPEND testFilesToFormat ${TESTS_HEADERS})
116 114 LIST(APPEND FORMATTING_INPUT_FILES ${testFilesToFormat})
117 115
118 116 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
119 117 ENDIF(BUILD_TESTS)
120 118
121 119 #
122 120 # Set the files that must be formatted by clang-format.
123 121 #
124 122 LIST (APPEND FORMATTING_INPUT_FILES ${APPLICATION_SOURCES})
125 123 SCIQLOP_SET_TO_PARENT_SCOPE(FORMATTING_INPUT_FILES)
126 124
127 125 #
128 126 # Set the directories that doxygen must browse to generate the
129 127 # documentation.
130 128 #
131 129 # Source directories:
132 130 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/docs")
133 131 LIST (APPEND DOXYGEN_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
134 132 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_INPUT_DIRS)
135 133 # Source directories to exclude from the documentation generation
136 134 #LIST (APPEND DOXYGEN_EXCLUDE_PATTERNS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir/*")
137 135 SCIQLOP_SET_TO_PARENT_SCOPE(DOXYGEN_EXCLUDE_PATTERNS)
138 136
139 137 #
140 138 # Set the directories with the sources to analyze and propagate the
141 139 # modification to the parent scope
142 140 #
143 141 # Source directories to analyze:
144 142 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src")
145 143 LIST (APPEND ANALYSIS_INPUT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tests")
146 144 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_INPUT_DIRS)
147 145 # Source directories to exclude from the analysis
148 146 #LIST (APPEND ANALYSIS_EXCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/path/to/subdir")
149 147 SCIQLOP_SET_TO_PARENT_SCOPE(ANALYSIS_EXCLUDE_DIRS)
@@ -1,60 +1,60
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the QLop Software
3 -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS
2 -- This file is a part of the SciQLop Software
3 -- Copyright (C) 2017, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 #ifndef MAINWINDOW_H
23 #define MAINWINDOW_H
22 #ifndef SCIQLOP_MAINWINDOW_H
23 #define SCIQLOP_MAINWINDOW_H
24 24
25 25 #include <QListWidgetItem>
26 26 #include <QMainWindow>
27 27 #include <QProgressBar>
28 28 #include <QProgressDialog>
29 29 #include <QThread>
30 30 #include <QVBoxLayout>
31 31 #include <QWidget>
32 32 //#include "../Core/qlopservice.h"
33 33 //#include "../Core/qlopgui.h"
34 34
35 #include <memory>
35 36
36 37 namespace Ui {
37 38 class MainWindow;
38 }
39 } // namespace Ui
40
39 41
40 42 class MainWindow : public QMainWindow {
41 43 Q_OBJECT
42 44
43 45 public:
44 46 explicit MainWindow(QWidget *parent = 0);
45 ~MainWindow();
47 virtual ~MainWindow();
46 48 public slots:
47 49
48 50 protected:
49 51 void changeEvent(QEvent *e);
50 52
51 53 private:
52 Ui::MainWindow *ui;
53 QList<QProgressBar *> m_progress;
54 int *m_progressThreadIds;
55 QWidget *m_progressWidget;
56 QVBoxLayout *m_progressLayout;
54 std::unique_ptr<Ui::MainWindow> m_Ui;
55 // QWidget *m_progressWidget;
56 // QVBoxLayout *m_progressLayout;
57 57 // QList<QLopService*> m_qlopServices;
58 58 };
59 59
60 #endif // MAINWINDOW_H
60 #endif // SCIQLOP_MAINWINDOW_H
@@ -1,103 +1,102
1 1 /*------------------------------------------------------------------------------
2 -- This file is a part of the QLop Software
3 -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS
2 -- This file is a part of the SciQLop Software
3 -- Copyright (C) 2017, Plasma Physics Laboratory - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 2 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@member.fsf.org
21 21 ----------------------------------------------------------------------------*/
22 #include "mainwindow.h"
23 #include "ui_mainwindow.h"
22 #include "MainWindow.h"
23 #include "ui_MainWindow.h"
24 24 #include <QAction>
25 25 #include <QDate>
26 26 #include <QDateTime>
27 27 #include <QDir>
28 28 #include <QFileDialog>
29 29 //#include <omp.h>
30 30 //#include <network/filedownloader.h>
31 31 //#include <qlopdatabase.h>
32 32 //#include <qlopsettings.h>
33 33 //#include <qlopgui.h>
34 34 //#include <spacedata.h>
35 35 //#include "qlopcore.h"
36 36 //#include "qlopcodecmanager.h"
37 37 //#include "cdfcodec.h"
38 38 //#include "amdatxtcodec.h"
39 39 //#include <qlopplotmanager.h>
40 40
41 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
41 MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), m_Ui(new Ui::MainWindow)
42 42 {
43 ui->setupUi(this);
43 m_Ui->setupUi(this);
44 44 /* QLopGUI::registerMenuBar(menuBar());
45 45 this->setWindowIcon(QIcon(":/sciqlopLOGO.svg"));
46 46 this->m_progressWidget = new QWidget();
47 47 this->m_progressLayout = new QVBoxLayout(this->m_progressWidget);
48 48 this->m_progressWidget->setLayout(this->m_progressLayout);
49 49 this->m_progressWidget->setWindowModality(Qt::WindowModal);
50 50 m_progressThreadIds = (int*) malloc(OMP_THREADS*sizeof(int));
51 51 for(int i=0;i<OMP_THREADS;i++)
52 52 {
53 53 this->m_progress.append(new QProgressBar(this->m_progressWidget));
54 54 this->m_progress.last()->setMinimum(0);
55 55 this->m_progress.last()->setMaximum(100);
56 56 this->m_progressLayout->addWidget(this->m_progress.last());
57 57 this->m_progressWidget->hide();
58 58 this->m_progressThreadIds[i] = -1;
59 59 }
60 60 this->m_progressWidget->setWindowTitle("Loading File");
61 61 const QList<QLopService*>ServicesToLoad=QList<QLopService*>()
62 62 << QLopCore::self()
63 63 << QLopPlotManager::self()
64 64 << QLopCodecManager::self()
65 65 << FileDownloader::self()
66 66 << QLopDataBase::self()
67 67 << SpaceData::self();
68 68
69 69 CDFCodec::registerToManager();
70 70 AMDATXTCodec::registerToManager();
71 71
72 72
73 73 for(int i=0;i<ServicesToLoad.count();i++)
74 74 {
75 75 qDebug()<<ServicesToLoad.at(i)->serviceName();
76 76 ServicesToLoad.at(i)->initialize(); //must be called before getGUI
77 77 QDockWidget* wdgt=ServicesToLoad.at(i)->getGUI();
78 78 if(wdgt)
79 79 {
80 80 wdgt->setAllowedAreas(Qt::AllDockWidgetAreas);
81 81 this->addDockWidget(Qt::TopDockWidgetArea,wdgt);
82 82 }
83 83 PythonQt::self()->getMainModule().addObject(ServicesToLoad.at(i)->serviceName(),(QObject*)ServicesToLoad.at(i));
84 84 }*/
85 85 }
86 86
87 87 MainWindow::~MainWindow()
88 88 {
89 delete ui;
90 89 }
91 90
92 91
93 92 void MainWindow::changeEvent(QEvent *e)
94 93 {
95 94 QMainWindow::changeEvent(e);
96 95 switch (e->type()) {
97 96 case QEvent::LanguageChange:
98 ui->retranslateUi(this);
97 m_Ui->retranslateUi(this);
99 98 break;
100 99 default:
101 100 break;
102 101 }
103 102 }
1 NO CONTENT: file renamed from app/src/mainwindow.ui to app/ui/MainWindow.ui
@@ -1,3 +1,4
1 # Ignore false positive relative to sqpApp macro
1 # Ignore false positive relative to App macro
2 \.h:\d+:.IPSIS_S04.*found: Ui
2 3 SqpApplication\.h:\d+:.IPSIS_S03.*found: sqpApp
3 4 SqpApplication\.h:\d+:.IPSIS_S04_VARIABLE.*found: sqpApp
General Comments 8
Under Review
author

Auto status change to "Under Review"

Approved
author

Status change > Approved

Under Review
author

Pull request updated. Auto status change to "Under Review"

Changed commits:
  * 1 added
  * 0 removed

Changed files:
  * M core/CMakeLists.txt
Approved
author

Status change > Approved

You need to be logged in to leave comments. Login now