Skip to content

Commit

Permalink
Cleanup Qt version-dependent code (we currently require Qt 5.5+)
Browse files Browse the repository at this point in the history
- move main compile-time Qt version check into ccApplicationBase
- remove old code for versions no longer supported
- remove version checks that are now always true
- wrap Q_FALLTHROUGH() in version check
  • Loading branch information
asmaloney committed Dec 31, 2018
1 parent ae62c13 commit 008cb29
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 30 deletions.
8 changes: 0 additions & 8 deletions CC/src/NormalizedProgress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,8 @@
//we use Qt for the atomic counter
#include <QAtomicInt>

//! Qt 4/5 compatible QAtomicInt
class AtomicCounter : public QAtomicInt
{
public:
AtomicCounter() : QAtomicInt(0) {}

#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
inline int load() { return *this; }
inline void store(int value) { *static_cast<QAtomicInt*>(this) = value; }
#endif
};

#else
Expand Down
5 changes: 5 additions & 0 deletions common/ccApplicationBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
#include "ccTranslationManager.h"


#if (QT_VERSION < QT_VERSION_CHECK(5, 5, 0))
#error CloudCompare does not support versions of Qt prior to 5.5
#endif


void ccApplicationBase::init(bool noOpenGLSupport)
{
if (!noOpenGLSupport)
Expand Down
5 changes: 0 additions & 5 deletions libs/qCC_db/ccIncludeGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@
//Qt
#include <QOpenGLFunctions_2_1>

//temporary test for QOpenGLWidget integration
#if (QT_VERSION < QT_VERSION_CHECK(5, 4, 0))
#error Error: CloudCompare does not support versions of Qt prior to 5.4 anymore!
#endif

//! Shortcuts to OpenGL commands independent on the input type
class ccGL
{
Expand Down
2 changes: 2 additions & 0 deletions libs/qCC_io/E57Filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2050,7 +2050,9 @@ static ccHObject* LoadImage(const e57::Node& node, QString& associatedData3DGuid
case E57_CYLINDRICAL:
case E57_SPHERICAL:
ccLog::Warning("[E57] Unhandled camera type (image will be loaded as is)");
#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
Q_FALLTHROUGH();
#endif
case E57_VISUAL:
imageObj = new ccImage();
break;
Expand Down
1 change: 1 addition & 0 deletions plugins/ccDefaultPluginInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <QJsonObject>

#include "ccDefaultPluginInterface.h"
#include "ccLog.h"


// This class keeps JSON from being included in the header
Expand Down
8 changes: 0 additions & 8 deletions plugins/ccPluginInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
#ifndef CC_PLUGIN_INTERFACE_HEADER
#define CC_PLUGIN_INTERFACE_HEADER

//qCC_db
#include <ccObject.h> //for CC_QT5 def

//Qt
#include <QIcon>
#include <QList>
Expand All @@ -30,11 +27,6 @@

//Qt version
#include <qglobal.h>
#ifndef CC_QT5
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#define CC_QT5
#endif
#endif

class ccExternalFactory;
class ccCommandLineInterface;
Expand Down
5 changes: 0 additions & 5 deletions plugins/core/qCSF/qCSF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@
//CSF
#include <CSF.h>

#ifndef CC_QT5
//Don't forget to replace 'qMyPlugin' by your own plugin class name here also!
Q_EXPORT_PLUGIN2(qCSF,qCSF);
#endif

qCSF::qCSF(QObject* parent)
: QObject( parent )
, ccStdPluginInterface( ":/CC/plugin/qCSF/info.json" )
Expand Down
4 changes: 0 additions & 4 deletions qCC/ccConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,10 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
message.prepend("[Qt FATAL] ");
ccLog::Warning(message);
break;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)) //DGM: QtInfoMsg is only defined since version 5.5
case QtInfoMsg:
message.prepend("[Qt INFO] ");
ccLog::Warning(message);
break;
#endif
}

#ifdef QT_DEBUG
Expand All @@ -133,9 +131,7 @@ void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QS
{
case QtDebugMsg:
case QtWarningMsg:
#if (QT_VERSION >= QT_VERSION_CHECK(5, 5, 0))
case QtInfoMsg:
#endif
std::cout << message.toStdString() << std::endl;
break;

Expand Down

0 comments on commit 008cb29

Please sign in to comment.