Skip to content

Commit

Permalink
Squelch compilation warnings (#517)
Browse files Browse the repository at this point in the history
* Fix missing override warnings

* Fix warnings about signed vs unsigned comparison

* Fix misc compiler warnings

* Update use of deprecated functions

* Squelch unnecessary warnings

* Remove use of QTime un UpdateManager

* QTime.elapsed is deprecated. Instead of replacing it with QElapsedTimer, the UpdateManger is modified to use QTimer directly. We can expect the behaviour to be the same as before in most if not all scenarios. The new version is less resource intensive at the cost of possibly lower timing accuracy (although the previous version of the code also saw Ibis' tick period vary as a function of workload).
  • Loading branch information
errollgarner committed Jan 5, 2024
1 parent 5d6839c commit e2271f9
Show file tree
Hide file tree
Showing 55 changed files with 155 additions and 130 deletions.
6 changes: 3 additions & 3 deletions IbisHardwareIGSIO/ibishardwareIGSIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,11 @@ void IbisHardwareIGSIO::InitPlugin()
bool IbisHardwareIGSIO::LaunchLocalServer( QString plusConfigFile )
{
QString plusServerExec = GetIbisAPI()->GetCustomPath( PlusServerExecutable );
if( plusServerExec == QString::null || plusServerExec.isEmpty() )
if( plusServerExec.isNull() || plusServerExec.isEmpty() )
{
QString message;
message = QString( "PlusServer executable path not defined.\n" );
message = QString( "Go to Settings/Preferences and set PlusServer executable." );
message = QString( "PlusServer executable path not defined.\n"
"Go to Settings/Preferences and set PlusServer executable." );
QMessageBox::warning( nullptr, "Error", message );
return false;
}
Expand Down
24 changes: 17 additions & 7 deletions IbisHardwareIGSIO/plusserverinterface.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
/*=========================================================================
Ibis Neuronav
Copyright (c) Simon Drouin, Anna Kochanowska, Louis Collins.
All rights reserved.
See Copyright.txt or http://ibisneuronav.org/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// Thanks to Simon Drouin for writing this class

#include "plusserverinterface.h"

#include <vtkObjectFactory.h>

#include <QApplication>
#include <QElapsedTimer>
#include <QFileInfo>
#include <QThread>
#include <QTime>

#include "logger.h"

Expand Down Expand Up @@ -68,11 +80,9 @@ bool PlusServerInterface::StartServer( const QString & configFilePath )

// PlusServerLauncher wants at least LOG_LEVEL_INFO to parse status information from the PlusServer executable
// Un-requested log entries that are captured from the PlusServer executable are parsed and dropped from output
QString cmdLine = QString( "\"%1\" --config-file=\"%2\" --verbose=%3" )
.arg( m_plusServerExecutable )
.arg( configFilePath )
.arg( m_serverLogLevel );
m_CurrentServerInstance->start( cmdLine );
QStringList args = { QString( "--config-file=\"%1\"" ).arg( configFilePath ),
QString( " --verbose=%1" ).arg( m_serverLogLevel ) };
m_CurrentServerInstance->start( m_plusServerExecutable, args );
m_CurrentServerInstance->waitForStarted();

// During waitForFinished an error signal may be emitted, which may delete m_CurrentServerInstance,
Expand All @@ -89,7 +99,7 @@ bool PlusServerInterface::StartServer( const QString & configFilePath )

// Wait for the server to be listening or fail
QThread * thread = QThread::currentThread();
QTime timeWaited;
QElapsedTimer timeWaited;
timeWaited.start();
while( timeWaited.elapsed() < 20000 && m_state == Starting )
{
Expand Down
12 changes: 12 additions & 0 deletions IbisHardwareIGSIO/plusserverinterface.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*=========================================================================
Ibis Neuronav
Copyright (c) Simon Drouin, Anna Kochanowska, Louis Collins.
All rights reserved.
See Copyright.txt or http://ibisneuronav.org/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// Thanks to Simon Drouin for writing this class

#ifndef PlusServerInterface_h
#define PlusServerInterface_h

Expand Down
7 changes: 6 additions & 1 deletion IbisLib/filereader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ See Copyright.txt or http://ibisneuronav.org/Copyright.html for details.
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#define _CRT_SECURE_NO_WARNINGS
#include "filereader.h"

#include <itkImageIOFactory.h>
Expand Down Expand Up @@ -111,7 +112,7 @@ void FileReader::SetIbisAPI( IbisAPI * api )
if( m_ibisAPI )
{
QString mincDir = m_ibisAPI->GetCustomPath( MINCToolsPathVarName );
if( mincDir != QString::null && !mincDir.isEmpty() )
if( !mincDir.isNull() && !mincDir.isEmpty() )
{
if( mincDir.at( mincDir.count() - 1 ) != '/' ) mincDir.append( "/" );
m_mincconvert.clear();
Expand Down Expand Up @@ -472,6 +473,7 @@ bool FileReader::OpenItkFile( QList<SceneObject *> & readObjects, QString filena
}
catch( itk::ExceptionObject & err )
{
std::cerr << err << std::endl;
return false;
}
// Update progress. simtodo : do something smarter. Itk minc reader doesn't seem to support progress.
Expand Down Expand Up @@ -507,6 +509,7 @@ bool FileReader::OpenItkLabelFile( QList<SceneObject *> & readObjects, QString f
}
catch( itk::ExceptionObject & err )
{
std::cerr << err << std::endl;
return false;
}
// Update progress. simtodo : do something smarter. Itk minc reader doesn't seem to support progress.
Expand Down Expand Up @@ -878,6 +881,7 @@ bool FileReader::GetGrayFrame( QString filename, IbisItkUnsignedChar3ImageType::
}
catch( itk::ExceptionObject & err )
{
std::cerr << err << std::endl;
return false;
}

Expand Down Expand Up @@ -915,6 +919,7 @@ bool FileReader::GetRGBFrame( QString filename, IbisRGBImageType::Pointer itkIma
}
catch( itk::ExceptionObject & err )
{
std::cerr << err << std::endl;
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion IbisLib/gui/automaticgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ AutomaticGui::AutomaticGui( vtkGenericParamInterface * params, QWidget * parent
{
QVBoxLayout * layout = new QVBoxLayout( this );

for( int paramIndex = 0; paramIndex < m_paramInterface->GetNumberOfParams(); ++paramIndex )
for( unsigned int paramIndex = 0; paramIndex < m_paramInterface->GetNumberOfParams(); ++paramIndex )
{
vtkGenericParam * p = m_paramInterface->GetParam( paramIndex );

Expand Down
3 changes: 1 addition & 2 deletions IbisLib/gui/filesystemtree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ FileSystemTree::FileSystemTree( QWidget * parent ) : QWidget( parent ), ui( new
{
ui->setupUi( this );
m_pathForm = nullptr;
m_model = new QDirModel( this );
m_model = new QFileSystemModel( this );
m_model->setReadOnly( true );
m_model->setSorting( QDir::DirsFirst | QDir::IgnoreCase | QDir::Name );

QModelIndex index = m_model->index( QDir::homePath() );

Expand Down
4 changes: 2 additions & 2 deletions IbisLib/gui/filesystemtree.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef FILESYSTEMTREE_H
#define FILESYSTEMTREE_H

#include <QDirModel>
#include <QFileSystemModel>
#include <QObject>
#include <QWidget>

Expand All @@ -28,7 +28,7 @@ private slots:

private:
Ui::FileSystemTree * ui;
QDirModel * m_model;
QFileSystemModel * m_model;
PathForm * m_pathForm;
};

Expand Down
2 changes: 1 addition & 1 deletion IbisLib/gui/imageobjectsettingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ImageObjectSettingsDialog : public QWidget, public Ui::ImageObjectSettings
Q_OBJECT

public:
ImageObjectSettingsDialog( QWidget * parent = 0, Qt::WindowFlags fl = 0 );
ImageObjectSettingsDialog( QWidget * parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() );
virtual ~ImageObjectSettingsDialog();

virtual void SetImageObject( ImageObject * obj );
Expand Down
2 changes: 1 addition & 1 deletion IbisLib/gui/objecttreemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ bool ObjectTreeModel::setData( const QModelIndex & index, const QVariant & value

Qt::ItemFlags ObjectTreeModel::flags( const QModelIndex & index ) const
{
if( !index.isValid() ) return 0;
if( !index.isValid() ) return Qt::ItemFlags();

Qt::ItemFlags f = Qt::ItemIsEnabled | Qt::ItemIsSelectable;
SceneObject * item = static_cast<SceneObject *>( index.internalPointer() );
Expand Down
2 changes: 1 addition & 1 deletion IbisLib/gui/opendatafiledialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class OpenDataFileDialog : public QDialog
Q_OBJECT

public:
OpenDataFileDialog( QWidget * parent = 0, Qt::WindowFlags fl = 0, SceneManager * man = 0,
OpenDataFileDialog( QWidget * parent = 0, Qt::WindowFlags fl = Qt::WindowFlags(), SceneManager * man = 0,
OpenFileParams * params = 0 );
virtual ~OpenDataFileDialog();

Expand Down
2 changes: 1 addition & 1 deletion IbisLib/gui/pointcloudobjectsettingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PointCloudObjectSettingsDialog : public QWidget, public Ui::PointCloudObje
Q_OBJECT

public:
PointCloudObjectSettingsDialog( QWidget * parent = 0, Qt::WindowFlags fl = 0 );
PointCloudObjectSettingsDialog( QWidget * parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() );
virtual ~PointCloudObjectSettingsDialog();

void SetPointCloudObject( PointCloudObject * object );
Expand Down
2 changes: 1 addition & 1 deletion IbisLib/gui/polydataobjectsettingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PolyDataObjectSettingsDialog : public QWidget, public Ui::PolyDataObjectSe
Q_OBJECT

public:
PolyDataObjectSettingsDialog( QWidget * parent = 0, Qt::WindowFlags fl = 0 );
PolyDataObjectSettingsDialog( QWidget * parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() );
virtual ~PolyDataObjectSettingsDialog();

void SetPolyDataObject( PolyDataObject * object );
Expand Down
7 changes: 4 additions & 3 deletions IbisLib/gui/quadviewwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ See Copyright.txt or http://ibisneuronav.org/Copyright.html for details.
#include <QLabel>
#include <QLayout>
#include <QPushButton>
#include <QScreen>
#include <QSettings>
#include <QSplitter>
#include <QToolButton>
Expand Down Expand Up @@ -234,10 +235,10 @@ void QuadViewWindow::Detach3DView( QWidget * /*parent*/ )
layout->setMargin( 0 );
layout->addWidget( m_vtkWidgets[1] );

int nbScreens = QApplication::desktop()->screenCount();
int nbScreens = QGuiApplication::screens().size();
if( nbScreens > 1 )
{
QRect screenres = QApplication::desktop()->screenGeometry( 1 );
QRect screenres = QGuiApplication::screens().at( 1 )->geometry();
m_detachedWidget->move( QPoint( screenres.x(), screenres.y() ) );
m_detachedWidget->showFullScreen();
}
Expand Down Expand Up @@ -304,7 +305,7 @@ void QuadViewWindow::OnCursorMoved()
double cursorPos[3];
m_sceneManager->GetCursorPosition( cursorPos );
QString text;
text.sprintf( "Cursor: ( %.2f, %.2f, %.2f )\t", cursorPos[0], cursorPos[1], cursorPos[2] );
text.asprintf( "Cursor: ( %.2f, %.2f, %.2f )\t", cursorPos[0], cursorPos[1], cursorPos[2] );
m_cursorPosLabel->setText( text );
}

Expand Down
2 changes: 1 addition & 1 deletion IbisLib/gui/quadviewwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class QuadViewWindow : public QWidget
Q_OBJECT

public:
QuadViewWindow( QWidget * parent = 0, Qt::WindowFlags fl = 0 );
QuadViewWindow( QWidget * parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() );
virtual ~QuadViewWindow();

/**
Expand Down
2 changes: 1 addition & 1 deletion IbisLib/gui/tractogramobjectsettingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class TractogramObjectSettingsDialog : public QWidget, public Ui::TractogramObje
Q_OBJECT

public:
TractogramObjectSettingsDialog( QWidget * parent = 0, Qt::WindowFlags fl = 0 );
TractogramObjectSettingsDialog( QWidget * parent = 0, Qt::WindowFlags fl = Qt::WindowFlags() );
virtual ~TractogramObjectSettingsDialog();

void SetTractogramObject( TractogramObject * object );
Expand Down
2 changes: 1 addition & 1 deletion IbisLib/gui/triplecutplaneobjectsettingswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void TripleCutPlaneObjectSettingsWidget::UpdateImageSliders()
}

// Add new widgets
for( int i = 0; i < m_cutPlaneObject->GetNumberOfImages(); ++i )
for( size_t i = 0; i < m_cutPlaneObject->GetNumberOfImages(); ++i )
{
TripleCutPlaneObjectMixerWidget * w = new TripleCutPlaneObjectMixerWidget( ui->volumeContributionGroupBox );
w->SetTripleCutPlaneObject( m_cutPlaneObject, i );
Expand Down
2 changes: 1 addition & 1 deletion IbisLib/ibisapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class IbisAPI : public QObject
Q_OBJECT

public:
IbisAPI( Application * app );
explicit IbisAPI( Application * app );
~IbisAPI();

/**
Expand Down
5 changes: 3 additions & 2 deletions IbisLib/ibispreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <QApplication>
#include <QDesktopWidget>
#include <QRect>
#include <QScreen>

#include "application.h"
#include "preferencewidget.h"
Expand Down Expand Up @@ -47,7 +48,7 @@ const QString IbisPreferences::GetPath( const QString & pathName )
{
QMap<QString, QString>::const_iterator it = m_customPaths.find( pathName );
if( it != m_customPaths.end() ) return it.value();
return QString::null;
return QString();
}

bool IbisPreferences::IsPathRegistered( const QString & pathName )
Expand All @@ -61,7 +62,7 @@ void IbisPreferences::ShowPreferenceDialog()
{
m_prefWidget = new PreferenceWidget;
m_prefWidget->SetPreferences( this );
const QRect screenGeometry = QApplication::desktop()->screenGeometry();
const QRect screenGeometry = QGuiApplication::screens().at( 0 )->geometry();
m_prefWidget->move( screenGeometry.width() / 3, screenGeometry.height() / 3 );
connect( m_prefWidget, SIGNAL( destroyed() ), this, SLOT( OnPreferenceWidgetClosed() ) );
Application::GetInstance().ShowFloatingDock( m_prefWidget );
Expand Down
2 changes: 1 addition & 1 deletion IbisLib/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ void MainWindow::fileOpenFile()
OpenFileParams params;
params.lastVisitedDir = lastVisitedDir;
params.defaultParent = Application::GetSceneManager()->GetSceneRoot();
OpenDataFileDialog * dialog = new OpenDataFileDialog( this, nullptr, Application::GetSceneManager(), &params );
OpenDataFileDialog * dialog = new OpenDataFileDialog( this, Qt::WindowFlags(), Application::GetSceneManager(), &params );

int result = dialog->exec();

Expand Down
2 changes: 1 addition & 1 deletion IbisLib/pointcloudobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void PointCloudObject::Setup( View * view )
// Deep Copy of Point Cloud Array
void PointCloudObject::SetPointCloudArray( vtkPoints * pointCloudArray )
{
for( size_t i = 0; i < pointCloudArray->GetNumberOfPoints(); i++ )
for( int i = 0; i < pointCloudArray->GetNumberOfPoints(); i++ )
{
m_PointCloudArray->InsertNextPoint( pointCloudArray->GetPoint( i ) );
}
Expand Down
2 changes: 1 addition & 1 deletion IbisLib/scenemanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class SceneManager : public QObject, public vtkObject
vtkGetMacro( MainSagittalViewID, int );
vtkGetMacro( MainTransverseViewID, int );
View * GetViewByID( int id );
View * CreateView( int type, QString name = QString::null, int id = InvalidId );
View * CreateView( int type, QString name = QString(), int id = InvalidId );
View * GetMain3DView();
View * GetMainCoronalView();
View * GetMainSagittalView();
Expand Down
Loading

0 comments on commit e2271f9

Please sign in to comment.