Commit c5791512 authored by Hans-Christian Ebke's avatar Hans-Christian Ebke

Qt5 compat fixes.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@18905 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 42d59c76
...@@ -43,14 +43,7 @@ ...@@ -43,14 +43,7 @@
#ifndef BASEINTERFACE_HH #ifndef BASEINTERFACE_HH
#define BASEINTERFACE_HH #define BASEINTERFACE_HH
#include <QtPlugin>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
#include <QtGui>
#endif
#include <QMenuBar>
#include <OpenFlipper/common/Types.hh> #include <OpenFlipper/common/Types.hh>
#include "WhatsThisGenerator.hh" #include "WhatsThisGenerator.hh"
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
#include <OpenFlipper/common/Types.hh> #include <OpenFlipper/common/Types.hh>
#include <OpenFlipper/common/GlobalOptions.hh> #include <OpenFlipper/common/GlobalOptions.hh>
#include <QGLWidget> //#include <QGLWidget>
#include <../ObjectTypes/TriangleMesh/TriangleMesh.hh> #include <../ObjectTypes/TriangleMesh/TriangleMesh.hh>
#include <../ObjectTypes/PolyMesh/PolyMesh.hh> #include <../ObjectTypes/PolyMesh/PolyMesh.hh>
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QFile> #include <QFile>
#include <QSettings> #include <QSettings>
#include <QGLFormat>
#include <QPluginLoader> #include <QPluginLoader>
#include "OpenFlipper/BasePlugin/BaseInterface.hh" #include "OpenFlipper/BasePlugin/BaseInterface.hh"
......
...@@ -228,7 +228,7 @@ bool LicenseManager::authenticate() { ...@@ -228,7 +228,7 @@ bool LicenseManager::authenticate() {
if ( (currentMac.count(":") == 5) && if ( (currentMac.count(":") == 5) &&
( pCurrAddresses->IfType == IF_TYPE_IEEE80211 || pCurrAddresses->IfType == IF_TYPE_ETHERNET_CSMACD ) ) { ( pCurrAddresses->IfType == IF_TYPE_IEEE80211 || pCurrAddresses->IfType == IF_TYPE_ETHERNET_CSMACD ) ) {
// Cleanup and remember mac adress // Cleanup and remember mac adress
currentMac = currentMac.toAscii().toUpper(); currentMac = currentMac.toUtf8().toUpper();
currentMac = currentMac.remove(":"); currentMac = currentMac.remove(":");
macHashes.push_back(currentMac); macHashes.push_back(currentMac);
} }
...@@ -262,7 +262,7 @@ bool LicenseManager::authenticate() { ...@@ -262,7 +262,7 @@ bool LicenseManager::authenticate() {
} }
// Cleanup mac adress // Cleanup mac adress
QString currentMac = netInterface.hardwareAddress().toAscii().toUpper(); QString currentMac = netInterface.hardwareAddress().toUtf8().toUpper();
currentMac = currentMac.remove(":"); currentMac = currentMac.remove(":");
macHashes.push_back(currentMac); macHashes.push_back(currentMac);
...@@ -276,7 +276,7 @@ bool LicenseManager::authenticate() { ...@@ -276,7 +276,7 @@ bool LicenseManager::authenticate() {
// generate hashes // generate hashes
for (int i = 0 ; i < macHashes.size(); ++i ) for (int i = 0 ; i < macHashes.size(); ++i )
macHashes[i] = QCryptographicHash::hash ( macHashes[i].toAscii() , QCryptographicHash::Sha1 ).toHex(); macHashes[i] = QCryptographicHash::hash ( macHashes[i].toUtf8() , QCryptographicHash::Sha1 ).toHex();
// =============================================================================================== // ===============================================================================================
// Compute hash of processor information // Compute hash of processor information
...@@ -327,7 +327,7 @@ bool LicenseManager::authenticate() { ...@@ -327,7 +327,7 @@ bool LicenseManager::authenticate() {
} }
#endif #endif
QString cpuHash = QCryptographicHash::hash ( processor.toAscii() , QCryptographicHash::Sha1 ).toHex(); QString cpuHash = QCryptographicHash::hash ( processor.toUtf8() , QCryptographicHash::Sha1 ).toHex();
// =============================================================================================== // ===============================================================================================
// Get windows product id // Get windows product id
...@@ -342,7 +342,7 @@ bool LicenseManager::authenticate() { ...@@ -342,7 +342,7 @@ bool LicenseManager::authenticate() {
QString productId = "-"; QString productId = "-";
#endif #endif
QString productHash = QCryptographicHash::hash ( productId.toAscii() , QCryptographicHash::Sha1 ).toHex(); QString productHash = QCryptographicHash::hash ( productId.toUtf8() , QCryptographicHash::Sha1 ).toHex();
// =============================================================================================== // ===============================================================================================
// Check License or generate request // Check License or generate request
...@@ -370,7 +370,7 @@ bool LicenseManager::authenticate() { ...@@ -370,7 +370,7 @@ bool LicenseManager::authenticate() {
for ( int i = 1 ; i < elements.size(); ++i ) for ( int i = 1 ; i < elements.size(); ++i )
license += elements[i]; license += elements[i];
license += saltPost; license += saltPost;
QString licenseHash = QCryptographicHash::hash ( license.toAscii() , QCryptographicHash::Sha1 ).toHex(); QString licenseHash = QCryptographicHash::hash ( license.toUtf8() , QCryptographicHash::Sha1 ).toHex();
bool signatureOk = licenseHash == elements[0]; bool signatureOk = licenseHash == elements[0];
// Check expiry date // Check expiry date
...@@ -433,7 +433,7 @@ bool LicenseManager::authenticate() { ...@@ -433,7 +433,7 @@ bool LicenseManager::authenticate() {
authstring_ += macHashes[i] +"\n"; authstring_ += macHashes[i] +"\n";
QString keyRequest = saltPre + pluginFileName() + coreHash + pluginHash + cpuHash + productHash + macHashes.join("") + saltPost; QString keyRequest = saltPre + pluginFileName() + coreHash + pluginHash + cpuHash + productHash + macHashes.join("") + saltPost;
QString requestSig = QCryptographicHash::hash ( keyRequest.toAscii() , QCryptographicHash::Sha1 ).toHex(); QString requestSig = QCryptographicHash::hash ( keyRequest.toUtf8() , QCryptographicHash::Sha1 ).toHex();
authstring_ += requestSig + "\n"; authstring_ += requestSig + "\n";
authenticated_ = false; authenticated_ = false;
......
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
#include <QtGui> #include <QtGui>
#endif #endif
#include <QMessageBox>
#include "keygenWidget.hh" #include "keygenWidget.hh"
#include <iostream> #include <iostream>
...@@ -74,7 +76,7 @@ QString KeyGen::computeSignature() const { ...@@ -74,7 +76,7 @@ QString KeyGen::computeSignature() const {
QString keyRequest = saltPre + name + coreHash + pluginHash + cpuHash QString keyRequest = saltPre + name + coreHash + pluginHash + cpuHash
+ productHash + macHashes.join("") + saltPost; + productHash + macHashes.join("") + saltPost;
QString requestSigCheck = QString requestSigCheck =
QCryptographicHash::hash(keyRequest.toAscii(), QCryptographicHash::hash(keyRequest.toUtf8(),
QCryptographicHash::Sha1).toHex(); QCryptographicHash::Sha1).toHex();
return requestSigCheck; return requestSigCheck;
...@@ -94,7 +96,7 @@ QString KeyGen::Generate(QString expiryDate) const ...@@ -94,7 +96,7 @@ QString KeyGen::Generate(QString expiryDate) const
ADD_SALT_POST(saltPost); ADD_SALT_POST(saltPost);
QString keyRequest = saltPre + name + coreHash + pluginHash + cpuHash + productHash + macHashes.join("") + saltPost; QString keyRequest = saltPre + name + coreHash + pluginHash + cpuHash + productHash + macHashes.join("") + saltPost;
QString requestSigCheck = QCryptographicHash::hash ( keyRequest.toAscii() , QCryptographicHash::Sha1 ).toHex(); QString requestSigCheck = QCryptographicHash::hash ( keyRequest.toUtf8() , QCryptographicHash::Sha1 ).toHex();
if ( requestSig != requestSigCheck ){ if ( requestSig != requestSigCheck ){
return "ERROR"; return "ERROR";
...@@ -112,7 +114,7 @@ QString KeyGen::Generate(QString expiryDate) const ...@@ -112,7 +114,7 @@ QString KeyGen::Generate(QString expiryDate) const
license_ += macHashes.join("\n") + "\n"; license_ += macHashes.join("\n") + "\n";
QString licenseTmp = saltPre + expiryDate + name + coreHash + pluginHash + cpuHash + productHash + macHashes.join("") + saltPost; QString licenseTmp = saltPre + expiryDate + name + coreHash + pluginHash + cpuHash + productHash + macHashes.join("") + saltPost;
QString licenseHash = QCryptographicHash::hash ( licenseTmp.toAscii() , QCryptographicHash::Sha1 ).toHex(); QString licenseHash = QCryptographicHash::hash ( licenseTmp.toUtf8() , QCryptographicHash::Sha1 ).toHex();
// Prepend signature // Prepend signature
license_ = licenseHash + "\n" + license_; license_ = licenseHash + "\n" + license_;
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
// Mainwindow // Mainwindow
#include "OpenFlipper/Core/Core.hh" #include "OpenFlipper/Core/Core.hh"
#include "common/glew_wrappers.hh"
// Qt // Qt
#include <QApplication> #include <QApplication>
...@@ -78,7 +79,6 @@ ...@@ -78,7 +79,6 @@
#include <omp.h> #include <omp.h>
#endif #endif
/* ========================================================== /* ==========================================================
* *
* Stackwalker code. Used to get a backtrace if OpenFlipper * Stackwalker code. Used to get a backtrace if OpenFlipper
...@@ -458,12 +458,7 @@ int main(int argc, char **argv) ...@@ -458,12 +458,7 @@ int main(int argc, char **argv)
w->init(); w->init();
#ifndef __APPLE__ #ifndef __APPLE__
GLenum err = glewInit(); initGlew();
if (GLEW_OK != err)
{
/* Problem: glewInit failed, something is seriously wrong. */
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
}
#endif #endif
for ( int i = 0 ; i < args.FileCount(); ++i ) for ( int i = 0 ; i < args.FileCount(); ++i )
......
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 18440 $ *
* $LastChangedBy: moebius $ *
* $Date: 2014-04-08 08:26:27 +0200 (Tue, 08 Apr 2014) $ *
* *
\*===========================================================================*/
#include <GL/glew.h>
#include <stdio.h>
void initGlew() {
GLenum err = glewInit();
if (GLEW_OK != err)
{
/* Problem: glewInit failed, something is seriously wrong. */
fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
}
}
const char *getGlewVersion() {
return (const char *)glewGetString(GLEW_VERSION);
}
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 18440 $ *
* $LastChangedBy: moebius $ *
* $Date: 2014-04-08 08:26:27 +0200 (Tue, 08 Apr 2014) $ *
* *
\*===========================================================================*/
#ifndef GLEW_WRAPPERS_HH_
#define GLEW_WRAPPERS_HH_
void initGlew();
const char *getGlewVersion();
#endif /* GLEW_WRAPPERS_HH_ */
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
//== INCLUDES ================================================================= //== INCLUDES =================================================================
#include <common/glew_wrappers.hh>
#include "CoreWidget.hh" #include "CoreWidget.hh"
#include <OpenFlipper/common/FileTypes.hh> #include <OpenFlipper/common/FileTypes.hh>
...@@ -604,7 +605,7 @@ void CoreWidget::showAboutWidget( ) { ...@@ -604,7 +605,7 @@ void CoreWidget::showAboutWidget( ) {
aboutWidget_->OpenFlipperAbout->append(tr("GLEW Specific Info:")); aboutWidget_->OpenFlipperAbout->append(tr("GLEW Specific Info:"));
aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont); aboutWidget_->OpenFlipperAbout->setCurrentFont(standardFont);
QString glewVersion = QString((const char *)glewGetString(GLEW_VERSION)); QString glewVersion = QString(getGlewVersion());
aboutWidget_->OpenFlipperAbout->append(tr("GLEW Version:\t") + glewVersion); aboutWidget_->OpenFlipperAbout->append(tr("GLEW Version:\t") + glewVersion);
#endif #endif
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
// -------------------- Qt event Includes // -------------------- Qt event Includes
#include <QEvent> #include <QEvent>
#include <QWhatsThisClickedEvent> #include <QWhatsThisClickedEvent>
#include <QGLFormat>
#define WIDGET_HEIGHT 800 #define WIDGET_HEIGHT 800
#define WIDGET_WIDTH 800 #define WIDGET_WIDTH 800
......
...@@ -69,6 +69,28 @@ ...@@ -69,6 +69,28 @@
#include <string> #include <string>
#include <cassert> #include <cassert>
#include <QGLFormat>
#include <QBoxLayout>
#include <QtNetwork/QUdpSocket>
#include <QWheelEvent>
#include <QDropEvent>
#include <QContextMenuEvent>
#include <QDragEnterEvent>
#include <QMouseEvent>
#include <QAction>
#include <QKeyEvent>
#include <QSize>
#include <QMap>
#include <QString>
#include <QMenu>
#include <QToolBar>
#include <QTime>
#include <QTimer>
#include <QGraphicsWidget>
#include <QGraphicsSceneDragDropEvent>
#include <QPropertyAnimation>
#include <QOpenGLFramebufferObject>
#include <QMimeData> #include <QMimeData>
#include <QToolButton> #include <QToolButton>
#include <QFrame> #include <QFrame>
...@@ -110,13 +132,7 @@ ...@@ -110,13 +132,7 @@
#include <QImageWriter> #include <QImageWriter>
#if QT_VERSION < 0x050000 #include <QGLFramebufferObject>
#include <QGLFramebufferObject>
#else // QT_VERSION > 0x050000
#undef QT_NO_OPENGL
#include <QOpenGLFramebufferObject>
#define QT_NO_OPENGL
#endif //QT_VERSION < 0x050000
#ifdef max #ifdef max
# undef max # undef max
...@@ -707,10 +723,10 @@ void glViewer::drawScene() ...@@ -707,10 +723,10 @@ void glViewer::drawScene()
// ================================================================================= // =================================================================================
// unbind vbo for qt log window // unbind vbo for qt log window
glBindBuffer(GL_ARRAY_BUFFER, 0); ACG::GLState::bindBuffer(GL_ARRAY_BUFFER, 0);
glActiveTexture(GL_TEXTURE0); ACG::GLState::activeTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0); ACG::GLState::bindTexture(GL_TEXTURE_2D, 0);
// fbo.release(); // fbo.release();
// //
...@@ -2470,24 +2486,6 @@ void glViewer::strafeRight() { ...@@ -2470,24 +2486,6 @@ void glViewer::strafeRight() {
} }
void glViewer::readBackBuffer(ACG::GLState* _glstate)
{
GLint curFbo = 0;
glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &curFbo);
ACG::GLState::bindFramebuffer(GL_READ_FRAMEBUFFER, curFbo);
ACG::GLState::bindFramebuffer(GL_DRAW_FRAMEBUFFER, readBackFbo_.getFboID());
glBlitFramebuffer(0, 0, readBackFbo_.width(), readBackFbo_.height(),
0, 0, readBackFbo_.width(), readBackFbo_.height(),
GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT, GL_NEAREST);
checkGLError();
ACG::GLState::bindFramebuffer(GL_FRAMEBUFFER, curFbo);
}
void glViewer::updatePostProcessingBufs(int _width, int _height) void glViewer::updatePostProcessingBufs(int _width, int _height)
{ {
ACG::FBO* fbos[] = {postProcessFBO_, postProcessFBO_ + 1, &readBackFbo_}; ACG::FBO* fbos[] = {postProcessFBO_, postProcessFBO_ + 1, &readBackFbo_};
......
...@@ -65,42 +65,25 @@ ...@@ -65,42 +65,25 @@
#include <ACG/ShaderUtils/GLSLShader.hh> #include <ACG/ShaderUtils/GLSLShader.hh>
#include <ACG/GL/globjects.hh> #include <ACG/GL/globjects.hh>
#undef QT_NO_OPENGL
#include <QGLFormat>
#define QT_NO_OPENGL
#include <QBoxLayout>
#include <QtNetwork/QUdpSocket>
#include <QWheelEvent>
#include <QDropEvent>
#include <QContextMenuEvent>
#include <QDragEnterEvent>
#include <QMouseEvent>
#include <QAction>
#include <QKeyEvent>
#include <QSize>
#include <QMap>
#include <QString>
#include <QMenu>
#include <QToolBar>
#include <QTime>
#include <QTimer>
#include <QGraphicsWidget>
#include <QGraphicsSceneDragDropEvent>
#include <QPropertyAnimation>
#include <vector> #include <vector>
#include <string> #include <string>
#include <limits> #include <limits>
#include <QGraphicsWidget>
#include <QTimer>
#include <QMouseEvent>
#include <QTime>
//== FORWARDDECLARATIONS ====================================================== //== FORWARDDECLARATIONS ======================================================
class QPushButton; class QPushButton;
class QToolButton; class QToolButton;
class QSplitter; class QSplitter;
class QTimer;
class QImage; class QImage;
class QSocketNotifier; class QSocketNotifier;
class QPropertyAnimation;
class QGLWidget;
struct PostProcessorInput; struct PostProcessorInput;
......
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
//== INCLUDES ================================================================= //== INCLUDES =================================================================
#include "QtBaseViewer.hh" #include "QtBaseViewer.hh"
#include <QPropertyAnimation>
//== NAMESPACES =============================================================== //== NAMESPACES ===============================================================
......
...@@ -57,12 +57,10 @@ ...@@ -57,12 +57,10 @@
#include "QtGLGraphicsView.hh" #include "QtGLGraphicsView.hh"
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
#include <QGLFramebufferObject> #include <QGLFramebufferObject>
#else // QT_VERSION > 0x050000 #else
#undef QT_NO_OPENGL #include <QOpenGLFramebufferObject>
#include <QOpenGLFramebufferObject> #endif
#define QT_NO_OPENGL
#endif //QT_VERSION < 0x050000
//== NAMESPACES =============================================================== //== NAMESPACES ===============================================================
......
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *