Skip to content

Commit 278c4c7

Browse files
authored
Cleanup (remove unused code and format style) (#492)
* Remove unused classes * Remove SingleViewWindow * Remove DrawableTexture * Remove vtkQtProgressDialog * Remove vtkProgressTerminalOutput * Remove use of deprecated AllDockWidgetFeatures * Add linter workflow * Using super-linter with clang-format * Ran clang-format * Remove code wrongfully triggering clang-format * Is this a bug in clang-format? * Will just remove it for now * Fix compile issues introduced in cleanup * Modernize and clean CMakeLists style * Amend previous run of clang-format * Add missing includes in guiutilities
1 parent 5653f2e commit 278c4c7

File tree

323 files changed

+19330
-22219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

323 files changed

+19330
-22219
lines changed

.clang-format

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
BasedOnStyle: Google
3+
IndentWidth: 4
4+
---
5+
Language: Cpp
6+
ColumnLimit: 120
7+
AccessModifierOffset: -4
8+
SpaceBeforeParens: Never
9+
SpacesInParentheses: true
10+
SpaceInEmptyParentheses: false
11+
SpaceInEmptyBlock: false
12+
SpaceAroundPointerQualifiers: Both
13+
SpaceAfterLogicalNot: false
14+
SpaceBeforeAssignmentOperators: true
15+
AlignConsecutiveAssignments: Consecutive
16+
BreakBeforeBraces: Allman
17+
AlignAfterOpenBracket: Align
18+
DerivePointerAlignment: false
19+
PointerAlignment: Middle
20+
AllowShortLambdasOnASingleLine: Empty
21+
UseTab: Never
22+
SpacesInSquareBrackets: false
23+
---

.github/workflows/super-linter.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# This workflow executes several linters on changed files based on languages used in your code base whenever
2+
# you push a code or open a pull request.
3+
#
4+
# You can adjust the behavior by modifying this file.
5+
# For more information, see:
6+
# https://github.com/github/super-linter
7+
name: Lint Code Base
8+
9+
on:
10+
push:
11+
branches: "master"
12+
pull_request:
13+
branches: "master"
14+
types: [opened, edited]
15+
jobs:
16+
run-lint:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v3
21+
with:
22+
# Full git history is needed to get a proper list of changed files within `super-linter`
23+
fetch-depth: 0
24+
25+
- name: Lint Code Base
26+
uses: github/super-linter@v4
27+
env:
28+
FILTER_REGEX_EXCLUDE: .*/IbisPlugins.*|.*/svl/.*|.*moc_.*|.*/IbisLib/.*
29+
# VALIDATE_CPP: true
30+
VALIDATE_CLANG_FORMAT: true
31+
DEFAULT_BRANCH: "master"
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
LINTER_RULES_PATH: /

CMakeLists.txt

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
1+
cmake_minimum_required( VERSION 3.5 )
22

3-
SET(CMAKE_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCommon)
3+
set( CMAKE_COMMON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCommon )
44

5-
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCommon ${CMAKE_MODULE_PATH})
5+
set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeCommon ${CMAKE_MODULE_PATH} )
66

77
#=====================================================
88
# Find location to install the progs
99
#
1010
# This MUST come before PROJECT or it does not work
1111
#======================================================
12-
INCLUDE(${CMAKE_COMMON_DIR}/InstallLocation.cmake)
12+
include( ${CMAKE_COMMON_DIR}/InstallLocation.cmake )
1313

14-
PROJECT( ibis )
14+
project( ibis )
1515

16-
INCLUDE(CMakeDependentOption)
16+
include( CMakeDependentOption )
1717

1818
#----------------------------------------
1919
# Tell the compiler to use c++11 which is required with Qt >= 5.7
@@ -24,7 +24,7 @@ set( CMAKE_CXX_STANDARD 11 )
2424
# Define a variable to hold the path of automatically compiled
2525
# dependencies.
2626
#==================================================================
27-
include(${CMAKE_COMMON_DIR}/DependencyVersions.cmake)
27+
include( ${CMAKE_COMMON_DIR}/DependencyVersions.cmake )
2828
set( IBIS_EXTERNAL_DEPENDENCIES_DIR ${CMAKE_CURRENT_BINARY_DIR}/../IbisDeps CACHE PATH "Path where the external dependencies (itk, vtk, openCV) have been built" )
2929

3030
#==================================================================
@@ -39,7 +39,7 @@ endif()
3939
if( IBIS_USE_QT_NETWORK )
4040
list( APPEND IbisQtModules Network )
4141
endif()
42-
if(UNIX AND NOT APPLE)
42+
if( UNIX AND NOT APPLE )
4343
list( APPEND IbisQtModules X11Extras )
4444
endif()
4545
find_package( Qt5 COMPONENTS ${IbisQtModules} REQUIRED )
@@ -48,15 +48,15 @@ find_package( Qt5 COMPONENTS ${IbisQtModules} REQUIRED )
4848
# ibis was never tested with versions 5.6.0, 5.7.0 and 5.8.0. It might work with 5.8.0.
4949
# it worked with 5.9.3
5050

51-
if (Qt5Widgets_FOUND)
52-
if (Qt5Widgets_VERSION VERSION_LESS 5.6.0)
53-
message(SEND_ERROR "Qt version 5.5.x or lower is no longer supported.\nCurrently supported Qt version is 5.9 and higher.\nYou are using " ${Qt5Widgets_VERSION} "." )
54-
elseif (Qt5Widgets_VERSION VERSION_LESS 5.9.0)
55-
message(SEND_ERROR "Currently supported Qt version is 5.9 and higher.\nYou are using " ${Qt5Widgets_VERSION} ". It may work." )
51+
if( Qt5Widgets_FOUND )
52+
if( Qt5Widgets_VERSION VERSION_LESS 5.6.0 )
53+
message( SEND_ERROR "Qt version 5.5.x or lower is no longer supported.\nCurrently supported Qt version is 5.9 and higher.\nYou are using " ${Qt5Widgets_VERSION} "." )
54+
elseif( Qt5Widgets_VERSION VERSION_LESS 5.9.0 )
55+
message( SEND_ERROR "Currently supported Qt version is 5.9 and higher.\nYou are using " ${Qt5Widgets_VERSION} ". It may work." )
5656
endif()
5757
else()
58-
message(SEND_ERROR "The Qt5Widgets library could not be found!")
59-
endif(Qt5Widgets_FOUND)
58+
message( SEND_ERROR "The Qt5Widgets library could not be found!" )
59+
endif()
6060

6161
include_directories( ${Qt5Widgets_INCLUDE_DIRS} )
6262
include_directories( ${Qt5Xml_INCLUDE_DIRS} )
@@ -84,7 +84,7 @@ include( ${ITK_USE_FILE} )
8484
#==================================================================
8585
# Look for OpenCV (required by some plugins, but not the main app)
8686
#==================================================================
87-
OPTION( IBIS_USE_OPENCV "Use OpenCV library" OFF )
87+
option( IBIS_USE_OPENCV "Use OpenCV library" OFF )
8888
if( IBIS_USE_OPENCV )
8989
set( AutoOpenCVPath ${IBIS_EXTERNAL_DEPENDENCIES_DIR}/opencv-${IBIS_OPENCV_LONG_VERSION}/build )
9090
find_package( OpenCV ${IBIS_OPENCV_LONG_VERSION} REQUIRED EXACT PATHS ${AutoOpenCVPath} )
@@ -105,7 +105,7 @@ endif()
105105
#==================================================================
106106
# Create options to build or not the different dependent projects.
107107
#==================================================================
108-
OPTION( IBIS_BUILD_DEFAULT_HARDWARE_MODULE "Build hardware module based on OpenIGTLink and dependencies (OpenIGTLink and OpenIGTLinkIO)" ON )
108+
option( IBIS_BUILD_DEFAULT_HARDWARE_MODULE "Build hardware module based on OpenIGTLink and dependencies (OpenIGTLink and OpenIGTLinkIO)" ON )
109109

110110
find_package ( OpenCL QUIET )
111111
include(${CMAKE_COMMON_DIR}/OpenCLMacros.cmake)
@@ -150,22 +150,22 @@ add_subdirectory( Ibis )
150150
#
151151
option( IBIS_BUILD_DOCUMENTATION "Build ibis documentation using Doxygen" OFF )
152152
if( IBIS_BUILD_DOCUMENTATION )
153-
option(DOXYGEN_SHORT_NAMES "Build Doxygen of VTK using short file names" OFF)
154-
option(DOXYGEN_GENERATE_HTMLHELP "Generate HTML help (CHM) files" ON)
155-
if(DOXYGEN_SHORT_NAMES)
156-
set(DOXYGEN_SHORT_NAMES YES)
153+
option( DOXYGEN_SHORT_NAMES "Build Doxygen of VTK using short file names" OFF )
154+
option( DOXYGEN_GENERATE_HTMLHELP "Generate HTML help (CHM) files" ON )
155+
if( DOXYGEN_SHORT_NAMES )
156+
set( DOXYGEN_SHORT_NAMES YES )
157157
else()
158-
set(DOXYGEN_SHORT_NAMES NO)
158+
set( DOXYGEN_SHORT_NAMES NO )
159159
endif()
160-
if(DOXYGEN_GENERATE_HTMLHELP)
161-
set(DOXYGEN_GENERATE_HTMLHELP YES)
160+
if( DOXYGEN_GENERATE_HTMLHELP )
161+
set( DOXYGEN_GENERATE_HTMLHELP YES )
162162
else()
163-
set(DOXYGEN_GENERATE_HTMLHELP NO)
163+
set( DOXYGEN_GENERATE_HTMLHELP NO )
164164
endif()
165165
find_package(Doxygen REQUIRED)
166-
if (DOXYGEN_FOUND)
167-
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doxyfile.in)
168-
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxygen/Doxyfile)
166+
if( DOXYGEN_FOUND )
167+
set( DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doxyfile.in )
168+
set( DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxygen/Doxyfile )
169169
# configure Doxygen file
170170
configure_file( ${DOXYGEN_IN} ${DOXYGEN_OUT} )
171171
# note the option ALL which allows to build the docs together with the application
@@ -174,8 +174,7 @@ if( IBIS_BUILD_DOCUMENTATION )
174174
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
175175
COMMENT "Generating API documentation with Doxygen"
176176
VERBATIM )
177-
else (DOXYGEN_FOUND)
178-
message("Doxygen needs to be installed to generate documentation")
179-
endif (DOXYGEN_FOUND)
180-
endif()
181-
177+
else( DOXYGEN_FOUND )
178+
message( "Doxygen needs to be installed to generate documentation" )
179+
endif()
180+
endif()

Ibis/commandlinearguments.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ See Copyright.txt or http://ibisneuronav.org/Copyright.html for details.
99
PURPOSE. See the above copyright notice for more information.
1010
=========================================================================*/
1111
#include "commandlinearguments.h"
12+
1213
#include <iostream>
1314

1415
CommandLineArguments::CommandLineArguments()
15-
: m_viewerOnly( false )
16-
, m_loadPrevConfig( false )
17-
, m_loadDefaultConfig( false )
18-
, m_loadConfigFile( false )
16+
: m_viewerOnly( false ), m_loadPrevConfig( false ), m_loadDefaultConfig( false ), m_loadConfigFile( false )
1917
{
2018
}
2119

@@ -24,17 +22,17 @@ bool CommandLineArguments::ParseArguments( QStringList & args )
2422
for( int i = 1; i < args.size(); ++i )
2523
{
2624
QString arg = args[i];
27-
if( arg == "-l")
25+
if( arg == "-l" )
2826
m_loadPrevConfig = true;
29-
else if( arg == "-d")
27+
else if( arg == "-d" )
3028
m_loadDefaultConfig = true;
3129
else if( arg == "-f" )
3230
{
3331
m_loadConfigFile = true;
3432
if( args.size() > i + 1 )
3533
{
36-
QString nextArg = args[i+1];
37-
if( nextArg.startsWith('-') )
34+
QString nextArg = args[i + 1];
35+
if( nextArg.startsWith( '-' ) )
3836
{
3937
std::cerr << "Error: expecting config filename after -f option" << std::endl;
4038
return false;
@@ -48,7 +46,7 @@ bool CommandLineArguments::ParseArguments( QStringList & args )
4846
return false;
4947
}
5048
}
51-
else if( arg == "-v")
49+
else if( arg == "-v" )
5250
m_viewerOnly = true;
5351
else
5452
m_loadFileNames.push_back( arg );

Ibis/commandlinearguments.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ See Copyright.txt or http://ibisneuronav.org/Copyright.html for details.
1515

1616
class CommandLineArguments
1717
{
18-
1918
public:
20-
2119
CommandLineArguments();
2220
bool ParseArguments( QStringList & args );
2321

@@ -29,14 +27,12 @@ class CommandLineArguments
2927
QStringList GetDataFilesToLoad() { return m_loadFileNames; }
3028

3129
protected:
32-
3330
bool m_viewerOnly;
3431
bool m_loadPrevConfig;
3532
bool m_loadDefaultConfig;
3633
bool m_loadConfigFile;
3734
QString m_configFile;
3835
QStringList m_loadFileNames;
39-
4036
};
4137

4238
#endif

Ibis/main.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,38 @@ See Copyright.txt or http://ibisneuronav.org/Copyright.html for details.
88
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
99
PURPOSE. See the above copyright notice for more information.
1010
=========================================================================*/
11+
#include <QVTKRenderWidget.h>
12+
#include <vtkObject.h>
13+
1114
#include <QApplication>
12-
#include <QTimer>
13-
#include <QFile>
1415
#include <QDir>
16+
#include <QFile>
1517
#include <QMessageBox>
18+
#include <QTimer>
19+
1620
#include "application.h"
17-
#include "mainwindow.h"
1821
#include "commandlinearguments.h"
19-
#include <vtkObject.h>
20-
#include <QVTKRenderWidget.h>
22+
#include "mainwindow.h"
2123

22-
int main( int argc, char** argv )
24+
int main( int argc, char ** argv )
2325
{
2426
// Disable VTK warnings unless not wanted
2527
#ifdef VTK_NO_WARNINGS
2628
vtkObject::SetGlobalWarningDisplay( 0 );
2729
#endif
2830

2931
// Set default format for render windows - Warning: has to be done before QApplication instanciation
30-
QSurfaceFormat::setDefaultFormat(QVTKRenderWidget::defaultFormat());
32+
QSurfaceFormat::setDefaultFormat( QVTKRenderWidget::defaultFormat() );
3133

3234
// Create Qt app
3335
QApplication a( argc, argv );
34-
Q_INIT_RESOURCE(IbisLib);
36+
Q_INIT_RESOURCE( IbisLib );
3537

3638
// Warning : IBIS IS NOT APPROVED FOR CLINICAL USE.
37-
if( !QFile::exists( QDir::homePath() + QString("/.ibis/no-clinical-warning.txt") ) )
38-
QMessageBox::warning( nullptr, "WARNING!", QString("The Ibis platform is not approved for clinical use.") );
39-
40-
// On Mac, we always do Viewer-mode only without command-line params for now
39+
if( !QFile::exists( QDir::homePath() + QString( "/.ibis/no-clinical-warning.txt" ) ) )
40+
QMessageBox::warning( nullptr, "WARNING!", QString( "The Ibis platform is not approved for clinical use." ) );
41+
42+
// On Mac, we always do Viewer-mode only without command-line params for now
4143
// Parse command-line arguments
4244
CommandLineArguments cmdArgs;
4345
QStringList args = a.arguments();
@@ -70,7 +72,7 @@ int main( int argc, char** argv )
7072
a.installEventFilter( mw );
7173

7274
// Will cause OnStartMainLoop slot to be called after main loop is started
73-
QTimer::singleShot( 0, mw, SLOT(OnStartMainLoop()) );
75+
QTimer::singleShot( 0, mw, SLOT( OnStartMainLoop() ) );
7476

7577
// Start main loop
7678
int ret = a.exec();

0 commit comments

Comments
 (0)