Commit bf5adef2 authored by Jan Möbius's avatar Jan Möbius

Merge branch 'Removed_QT4_ifdefs' into 'master'

Removed qt4 ifdefs

See merge request !86
parents d34b6bd3 3d5e094f
......@@ -51,11 +51,7 @@
#pragma once
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
/** \file AboutInfoInterface.hh
......
......@@ -53,11 +53,7 @@
#include <OpenFlipper/common/Types.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
/** \file BackupInterface.hh
*
......
......@@ -52,11 +52,7 @@
#define CONTEXTMENUINTERFACE_HH
#include <OpenFlipper/common/Types.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QMenuBar>
......
......@@ -53,11 +53,7 @@
#include <OpenFlipper/common/Types.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QMenuBar>
......
......@@ -52,11 +52,7 @@
#define KEYINTERFACE_HH
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
......
......@@ -51,11 +51,7 @@
#define MENUBARINTERFACE_HH
#include <OpenFlipper/common/Types.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QMenuBar>
......
......@@ -55,9 +55,7 @@
#include <QObject>
#include <QString>
#if QT_VERSION >= 0x050000
#include <QJsonDocument>
#endif
......@@ -110,14 +108,12 @@ class MetadataInterface {
virtual void slotObjectMetadataDeserialized(
QString object_name, QString value) {};
#if QT_VERSION >= 0x050000
/**
* Triggered for every piece of object specific meta data encapsulated
* in "Mesh Comments" if it is valid JSON.
*/
virtual void slotObjectMetadataDeserializedJson(
QString object_name, QJsonDocument value) {};
#endif
signals:
/**
......@@ -154,10 +150,6 @@ to find out which specific signal suits your needs.
*/
#if QT_VERSION >= 0x050000
Q_DECLARE_INTERFACE(MetadataInterface,"OpenFlipper.MetadataInterface_qt5/1.0")
#else
Q_DECLARE_INTERFACE(MetadataInterface,"OpenFlipper.MetadataInterface_qt4/1.0")
#endif
#endif // METADATAINTERFACE_HH
......@@ -52,11 +52,7 @@
#define MOUSEINTERFACE_HH
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
/** \file MouseInterface.hh
......
......@@ -52,11 +52,7 @@
#define OPTIONSINTERFACE_HH
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
/** \file OptionsInterface.hh
......
......@@ -52,11 +52,7 @@
#include <OpenFlipper/common/Types.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QMenuBar>
......
......@@ -52,11 +52,7 @@
#include <OpenFlipper/threads/OpenFlipperThread.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
/** \file ProcessInterface.hh
......
......@@ -52,11 +52,7 @@
#include <OpenFlipper/common/Types.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
/** \file SecurityInterface.hh
......
......@@ -55,11 +55,7 @@
#include <OpenFlipper/common/Types.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
/** \file SelectionInterface.hh
......
......@@ -52,11 +52,7 @@
#include <OpenFlipper/common/Types.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QStatusBar>
......
......@@ -53,11 +53,7 @@
#include <OpenFlipper/common/Types.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QMenuBar>
......
......@@ -52,11 +52,7 @@
#include <OpenFlipper/common/Types.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QMenuBar>
#include <QStringList>
......
......@@ -51,11 +51,7 @@
#define TOOLBOXINTERFACE_HH
#include <OpenFlipper/common/Types.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QMenuBar>
#include <QStringList>
......
......@@ -51,11 +51,7 @@
#define VIEWINTERFACE_HH
#include <OpenFlipper/common/Types.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QMenuBar>
......
......@@ -51,11 +51,7 @@
#define VIEWMODEINTERFACE_HH
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QMenuBar>
#include <QStringList>
......
......@@ -67,11 +67,6 @@
#include <ACG/QtWidgets/QtFileDialog.hh>
// -------------------- Qt
#if QT_VERSION >= 0x050000
#else
#undef QT_NO_OPENGL
#include <QGLFormat>
#endif
#include "OpenFlipper/BasePlugin/KeyInterface.hh"
#include "OpenFlipper/BasePlugin/MouseInterface.hh"
......
......@@ -1250,10 +1250,8 @@ private slots:
signals:
void genericMetadataDeserialized(QString key, QString value);
void objectMetadataDeserialized(QString object_name, QString value);
#if QT_VERSION >= 0x050000
void objectMetadataDeserializedJson(
QString object_name, QJsonDocument value);
#endif
private slots:
void slotMetadataDeserialized( const QVector<QPair<QString, QString> > &data);
......
......@@ -533,7 +533,6 @@ void Core::slotMetadataDeserialized(
const QStringRef value = obj_metadata.midRef(cursor, next - cursor);
emit objectMetadataDeserialized(current_object_name, value.toString());
#if QT_VERSION >= 0x050000
QJsonParseError json_error;
QJsonDocument json_doc =
QJsonDocument::fromJson(value.toUtf8(), &json_error);
......@@ -541,7 +540,6 @@ void Core::slotMetadataDeserialized(
emit objectMetadataDeserializedJson(
current_object_name, json_doc);
}
#endif
cursor = next + re_end.matchedLength();
state = STATE_SEARCH_BEGIN;
break;
......
......@@ -62,8 +62,6 @@
// -------------------- mview
#include "Core.hh"
#if QT_VERSION >= 0x050000
#endif
#include "OpenFlipper/BasePlugin/AboutInfoInterface.hh"
#include "OpenFlipper/BasePlugin/KeyInterface.hh"
......@@ -316,7 +314,6 @@ void Core::loadPlugins()
// Prepend the additional Plugins to the plugin list
pluginlist = additionalPlugins << pluginlist;
#if QT_VERSION >= 0x050000
/*
* Remove static plugins from dynamically loaded list.
*/
......@@ -334,7 +331,6 @@ void Core::loadPlugins()
}
}
}
#endif
/*
* Note: This call is not necessary, anymore. Initialization order
......@@ -430,7 +426,6 @@ void Core::loadPlugins()
delete *it;
}
#if QT_VERSION >= 0x050000
/*
* Initialize static plugins.
*/
......@@ -448,7 +443,6 @@ void Core::loadPlugins()
licenseTexts += pluginLicenseText;
}
}
#endif
emit log(LOGINFO, tr("Total time needed to load plugins was %1 ms.").arg(time.elapsed()));
......@@ -2309,12 +2303,10 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
connect(this, SIGNAL(objectMetadataDeserialized(QString, QString)),
plugin, SLOT(slotObjectMetadataDeserialized(QString, QString)));
}
#if QT_VERSION >= 0x050000
if (checkSlot(plugin, "slotObjectMetadataDeserializedJson(QString,QJsonDocument)")) {
connect(this, SIGNAL(objectMetadataDeserializedJson(QString, QJsonDocument)),
plugin, SLOT(slotObjectMetadataDeserializedJson(QString, QJsonDocument)));
}
#endif
if (checkSignal(plugin, "metadataDeserialized(QVector<QPair<QString,QString> >)")) {
connect(plugin, SIGNAL(metadataDeserialized(QVector<QPair<QString, QString> >)),
this, SLOT(slotMetadataDeserialized(QVector<QPair<QString, QString> >)));
......
......@@ -49,11 +49,7 @@
#include <QApplication>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
#include <QFile>
#include <QMessageBox>
......
......@@ -48,12 +48,7 @@
\*===========================================================================*/
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
#include <QMessageBox>
......
......@@ -77,10 +77,8 @@
#include <vector>
#include <QMap>
#include "perObjectData.hh"
#if QT_VERSION >= 0x050000
#include <QJsonDocument>
#include <QJsonObject>
#endif
//== TYPEDEFS =================================================================
......@@ -598,7 +596,6 @@ class DLLEXPORT BaseObject : public QObject {
/*
* Compose JSON parsable object.
*/
#if QT_VERSION >= 0x050000
QJsonObject comment_obj;
for (QMap<QString, QString>::const_iterator it = commentsByKey_.begin(), it_end = commentsByKey_.end();
it != it_end; ++it) {
......@@ -614,12 +611,6 @@ class DLLEXPORT BaseObject : public QObject {
}
}
result.append(QString::fromUtf8(QJsonDocument(comment_obj).toJson(QJsonDocument::Indented)));
#else
for (QMap<QString, QString>::const_iterator it = commentsByKey_.begin(), it_end = commentsByKey_.end();
it != it_end; ++it) {
result.append(QString("%1: %2").arg(it.key(), it.value()));
}
#endif
result.append(QString("END Comments for object \"%1\"\n").arg(name()));
......
......@@ -81,37 +81,26 @@ QtGLGraphicsScene::QtGLGraphicsScene(QtBaseViewer* _w) :
void QtGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_rect)
{
// Check for switch in qt4.6 to OpenGL2
#if QT_VERSION >= 0x040600
if (_painter->paintEngine()->type() != QPaintEngine::OpenGL && _painter->paintEngine()->type() != QPaintEngine::OpenGL2 ) {
std::cerr << "QtGLGraphicsScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view\n";
return;
}
#else
if (_painter->paintEngine()->type() != QPaintEngine::OpenGL ) {
std::cerr << "QtGLGraphicsScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view\n";
return;
}
#endif
// Initialize background first
_painter->setBackground(QApplication::palette().window());
_painter->eraseRect(_rect);
// From now on we do OpenGL direct painting on the scene
#if QT_VERSION >= 0x040600
// Tell Qt that we directly use OpenGL
_painter->beginNativePainting();
#endif
// Clear the depth buffer (This is required since QT4.6 Otherwise we get an emtpty scene!
glClear(GL_DEPTH_BUFFER_BIT);
w_->paintGL();
#if QT_VERSION >= 0x040600
// The rest is painting through QT again.
_painter->endNativePainting();
#endif
}
......
......@@ -466,17 +466,6 @@ updateVBO() {
#ifdef WIN32
metricWidth += leftBearing + rightBearing;
#elif QT_VERSION < 0x050000
// QFontMetrics does not seem to always give the correct width
// therefore we add a margin so that characters are not cut off
if (leftBearing + rightBearing < 0.1*maxFontWidth_) {
if (metricWidth + 0.25*maxFontWidth_ < maxFontWidth_)
metricWidth += 0.25*maxFontWidth_;
else
metricWidth = maxFontWidth_;
} else {
metricWidth += leftBearing + rightBearing;
}
#endif
float widthTx = (float) metricWidth / (float) imageWidth_;
......
......@@ -49,11 +49,9 @@
#include <OpenFlipper/common/Types.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
#include "TreeModelObjectSelection.hh"
......
......@@ -49,11 +49,7 @@
#include "ui_pluginDialog.hh"
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
#include <OpenFlipper/Core/PluginInfo.hh>
......
......@@ -50,11 +50,8 @@
#include "ui_aboutWidget.hh"
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
class AboutWidget : public QMainWindow, public Ui::AboutWidget
......
......@@ -57,14 +57,7 @@
#include "ui_addEmpty.hh"
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QtWidgets>
class addEmptyWidget : public QDialog, public Ui::addEmpty
{
......
......@@ -60,11 +60,8 @@
#include "CoreWidget.hh"
#if QT_VERSION > 0x050000
#include <QtConcurrent>
#else
#include <QtCore>
#endif
#include <OpenFlipper/widgets/snapshotDialog/SnapshotDialog.hh>
......
......@@ -91,11 +91,8 @@
#include <QImageWriter>
#if QT_VERSION < 0x050000
#include <QGLFramebufferObject>
#else
#include <QOpenGLFramebufferObject>
#endif
#ifdef max
# undef max
......
......@@ -111,13 +111,10 @@ class QtShiftPopupMenu;
class CursorPainter;
class PostProcessing;
#if QT_VERSION < 0x050000
class QGLFramebufferObject;
class QGLFramebufferObjectFormat;
#else
class QOpenGLFramebufferObject;
class QOpenGLFramebufferObjectFormat;
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
class QOpenGLDebugLogger;
......@@ -881,13 +878,10 @@ private:
private:
#if QT_VERSION < 0x050000
typedef QGLFramebufferObjectFormat QFramebufferObjectFormat;
typedef QGLFramebufferObject QFramebufferObject;
#else
typedef QOpenGLFramebufferObjectFormat QFramebufferObjectFormat;
typedef QOpenGLFramebufferObject QFramebufferObject;
#endif
/// Framebuffer object that holds the pick cache
QFramebufferObject* pickCache_;
......
......@@ -65,11 +65,9 @@
#include "OpenFlipper/common/GlobalOptions.hh"
#if QT_VERSION < 0x050000
#include <QGLFramebufferObject>
#else
#include <QOpenGLFramebufferObject>
#endif
//== NAMESPACES ===============================================================
......
......@@ -86,17 +86,10 @@ QtGLGraphicsScene::QtGLGraphicsScene(std::vector< glViewer *> *_views,
void QtGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_rect)
{
// Check for switch in qt4.6 to OpenGL2
#if QT_VERSION >= 0x040600
if (_painter->paintEngine()->type() != QPaintEngine::OpenGL && _painter->paintEngine()->type() != QPaintEngine::OpenGL2 ) {
std::cerr << "QtGLGraphicsScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view\n";
return;
}
#else
if (_painter->paintEngine()->type() != QPaintEngine::OpenGL ) {
std::cerr << "QtGLGraphicsScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view\n";
return;
}
#endif
// Initialize background first
_painter->setBackground(QApplication::palette().window());
......@@ -107,10 +100,8 @@ void QtGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_rect)
_painter->eraseRect(_rect);
// From now on we do OpenGL direct painting on the scene
#if QT_VERSION >= 0x040600
// Tell Qt that we directly use OpenGL
_painter->beginNativePainting();
#endif
static bool initialized = false;
if (!initialized)
......@@ -163,10 +154,8 @@ void QtGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_rect)
views_->at(i)->paintGL();
}
#if QT_VERSION >= 0x040600
// The rest is painting through QT again.
_painter->endNativePainting();
#endif
// Draw red box around active examiner
if (layout_->mode() != QtMultiViewLayout::SingleView)
......
......@@ -87,17 +87,10 @@ void SimpleGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_re
{
// Check for switch in qt4.6 to OpenGL2
#if QT_VERSION >= 0x040600
if (_painter->paintEngine()->type() != QPaintEngine::OpenGL && _painter->paintEngine()->type() != QPaintEngine::OpenGL2 ) {
std::cerr << "QtGLGraphicsScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view\n";
return;
}
#else
if (_painter->paintEngine()->type() != QPaintEngine::OpenGL ) {
std::cerr << "QtGLGraphicsScene: drawBackground needs a QGLWidget to be set as viewport on the graphics view\n";
return;
}
#endif
// Initialize background first
_painter->setBackground(QApplication::palette().window());
......@@ -107,10 +100,8 @@ void SimpleGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_re
return;
// From now on we do OpenGL direct painting on the scene
#if QT_VERSION >= 0x040600
// Tell Qt that we directly use OpenGL
_painter->beginNativePainting();
#endif
if (!initialized_)
{
......@@ -149,10 +140,8 @@ void SimpleGLGraphicsScene::drawBackground(QPainter *_painter, const QRectF &_re
view_->paintGL();
#if QT_VERSION >= 0x040600
// The rest is painting through QT again.
_painter->endNativePainting();
#endif
}
......
......@@ -59,12 +59,7 @@
#define HELPBROWSER_HH_
#if QT_VERSION >= 0x050000
#include <QtWidgets>