Commit 03a5c3e0 authored by Matthias Möller's avatar Matthias Möller

- replaced deprecated qt4 functions

- removed some unnecessary qt headers

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17078 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 370a7d27
......@@ -320,10 +320,10 @@ void IRenderer::bindObjectUniforms( ACG::RenderObject* _obj, GLSL::Program* _pro
switch (additionalUniformsIter.value().first) {
case GL_FLOAT:
_prog->setUniform(additionalUniformsIter.key().toAscii(),additionalUniformsIter.value().second.toFloat());
_prog->setUniform(additionalUniformsIter.key().toLatin1(),additionalUniformsIter.value().second.toFloat());
break;
case GL_INT:
_prog->setUniform(additionalUniformsIter.key().toAscii(),additionalUniformsIter.value().second.toInt());
_prog->setUniform(additionalUniformsIter.key().toLatin1(),additionalUniformsIter.value().second.toInt());
break;
default:
std::cerr << "IRenderer Error: Additional Uniform data type not supported" << std::endl;
......
......@@ -452,7 +452,7 @@ void ShaderProgGenerator::loadStringListFromFile(QString _fileName, QStringList*
file.open(QIODevice::ReadOnly | QIODevice::Text);
if (!file.isReadable())
std::cout << "error: file missing -> \"" << (const char*)_fileName.toAscii() << "\"" << std::endl;
std::cout << "error: file missing -> \"" << _fileName.toStdString() << "\"" << std::endl;
else
{
......@@ -692,7 +692,7 @@ int ShaderProgGenerator::checkForIncludes(QString _str, ShaderGenerator* _gen, Q
QString strIncludeFile = _str.remove("#include ").remove('\"').remove('<').remove('>').trimmed();
if (strIncludeFile.isEmpty())
std::cout << "wrong include syntax: " << (const char*)_str.toAscii() << std::endl;
std::cout << "wrong include syntax: " << _str.toStdString() << std::endl;
else
{
QString fullPathToIncludeFile = _includePath + QDir::separator() + strIncludeFile;
......
......@@ -52,6 +52,8 @@
//== INCLUDES =================================================================
#include "QtBaseViewer.hh"
#include <QDrag>
#include <QMimeData>
//== NAMESPACES ===============================================================
......@@ -67,7 +69,7 @@ void QtBaseViewer::startDrag()
encodeView(view);
QDrag * drag = new QDrag( this );
QMimeData * mime_data = new QMimeData;
QMimeData * mime_data = new QMimeData();
mime_data->setText( view );
drag->setMimeData( mime_data );
......
......@@ -72,7 +72,7 @@ namespace QtWidgets {
QtCoordFrameDialog::
QtCoordFrameDialog( QWidget* _parent,
SceneGraph::CoordFrameNode* _node,
Qt::WFlags _fl )
Qt::WindowFlags _fl )
: QDialog(_parent, _fl),
node_(_node)
......
......@@ -60,6 +60,9 @@
#include "../Math/VectorT.hh"
#include <vector>
#include <QDialog>
#include <QWidget>
//== FORWARDDECLARATIONS ======================================================
......@@ -90,7 +93,7 @@ public:
QtCoordFrameDialog( QWidget* parent,
SceneGraph::CoordFrameNode* _node,
Qt::WFlags fl = 0 );
Qt::WindowFlags fl = Qt::Widget );
~QtCoordFrameDialog() {}
......
......@@ -70,6 +70,7 @@
#include <QKeyEvent>
#include <QResizeEvent>
#include <QMouseEvent>
#include <qdrawutil.h>
//== NAMESPACES ===============================================================
......
......@@ -132,7 +132,7 @@ namespace GLSL {
StringList strlist;
for (QStringList::const_iterator it = source.begin();it != source.end();++it)
strlist.push_back(std::string((const char*)it->toAscii()) + '\n');
strlist.push_back(std::string((const char*)it->toLatin1()) + '\n');
setSource(strlist);
}
......@@ -543,9 +543,9 @@ namespace GLSL {
path_file = qApp->applicationDirPath() + QString("/../shader/")
+ QString(filename);
} else {
path_file = QString::fromAscii(filename);
path_file = QString::fromLatin1(filename);
}
std::ifstream iShader(path_file.toAscii());
std::ifstream iShader(path_file.toLatin1());
if (!iShader) {
std::cout << "ERROR: Could not open file " << path_file.toStdString() << std::endl;
return GLSL::StringList();
......
......@@ -53,7 +53,6 @@
#include <ObjectTypes/Plane/PlaneNode.hh>
#include <qnamespace.h>
#include <qgl.h>
#include <QObject>
#include <list>
......
......@@ -520,7 +520,7 @@ Core::init() {
it.next();
/// Skip all signals for function calls
if ( checkSignal( this, it.name().toAscii() ) )
if ( checkSignal( this, it.name().toLatin1() ) )
continue;
scriptingFunctions_.push_back( "core." + it.name() );
......
......@@ -93,7 +93,7 @@ Core::
slotLog(Logtype _type, QString _message) {
emit externalLog( _type , _message );
if ( OpenFlipper::Options::logToConsole() ) {
std::string output( _message.toAscii() ) ;
std::string output( _message.toLatin1() ) ;
switch (_type) {
case LOGINFO:
......
......@@ -2089,7 +2089,7 @@ void Core::loadPlugin(const QString& _filename,const bool _silent, QString& _lic
it.next();
/// Skip all signals for function calls
if ( checkSignal( plugin, it.name().toAscii() ) )
if ( checkSignal( plugin, it.name().toLatin1() ) )
continue;
info.rpcFunctions.push_back( it.name() );
......
......@@ -53,7 +53,7 @@
// -------------------- mview
#include "Core.hh"
#include <QtUiTools/QUiLoader>
#include <QUiLoader>
//== IMPLEMENTATION ==========================================================
......
......@@ -752,7 +752,7 @@ void BaseObject::dumpTree() {
std::cerr << " ";
std::cerr << "Node ";
std::cerr << std::string(name().toAscii());
std::cerr << std::string(name().toLatin1());
std::cerr << " with id : ";
std::cerr << id();
......
......@@ -160,7 +160,7 @@ void QtGLViewerLayout::reLayout ()
if (item->size() != item->preferredSize ())
item->resize (item->preferredSize ());
item->resetTransform();
item->scale (scale, scale);
item->setScale (scale);
}
wheelX_->setPos (r.left(),
......
......@@ -117,7 +117,7 @@ QtSlideWindow::QtSlideWindow(QString _name, QGraphicsItem *_parent) :
// Hide widget
hide();
setAcceptsHoverEvents(true);
setAcceptHoverEvents(true);
updateParentGeometry();
}
......
......@@ -298,12 +298,12 @@ void LoadWidget::saveFile(){
//get filename
if (!filename.contains(".",Qt::CaseSensitive)){ //check for extension
int s = selectedFilter().indexOf("*")+1;
int e = selectedFilter().indexOf(" ", s);
int e2 = selectedFilter().indexOf(")", s);
int s = selectedNameFilter().indexOf("*")+1;
int e = selectedNameFilter().indexOf(" ", s);
int e2 = selectedNameFilter().indexOf(")", s);
if (e == -1 || e2 < e) e = e2;
QString ext = selectedFilter().mid(s,e-s);
QString ext = selectedNameFilter().mid(s,e-s);
filename += ext;
}
......
......@@ -50,14 +50,6 @@
void OptionsWidget::startDownload( QString _url ) {
QUrl url(_url);
// If username or passowrd are supplied, use them
if ( ! updateUser->text().isEmpty() )
url.setUserName(updateUser->text());
if ( ! updatePass->text().isEmpty() )
url.setPassword(updatePass->text());
QFileInfo urlInfo(_url);
// Download the file to the Home Directory
......@@ -77,11 +69,8 @@ void OptionsWidget::startDownload( QString _url ) {
file = 0;
checkUpdateButton->setEnabled(true);
} else {
QHttp::ConnectionMode mode = url.scheme().toLower() == "https" ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp;
http->setHost(url.host(), mode, url.port() == -1 ? 0 : url.port());
if (!url.userName().isEmpty())
http->setUser(url.userName(), url.password());
QNetworkRequest req;
req.setUrl(url);
httpRequestAborted = false;
QByteArray path = QUrl::toPercentEncoding(url.path(), "!$&'()*+,;=:@/");
......@@ -94,96 +83,95 @@ void OptionsWidget::startDownload( QString _url ) {
progressDialog->setLabelText(tr("Downloading %1.").arg(fileName));
progressDialog->show();
httpGetId = http->get(path, file);
downloadRep_ = networkMan_->get(req);
connect(downloadRep_, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(showError(QNetworkReply::NetworkError)));
connect(downloadRep_,SIGNAL(downloadProgress(qint64 , qint64 )),
this,SLOT(updateDataReadProgress(qint64 , qint64 )));
checkUpdateButton->setEnabled(false);
}
}
void OptionsWidget::httpRequestFinished(int requestId, bool error)
void OptionsWidget::authentication ( QNetworkReply* _reply, QAuthenticator* _authenticator )
{
if (requestId != httpGetId)
return;
if (httpRequestAborted) {
if (file) {
file->close();
file->remove();
delete file;
file = 0;
}
progressDialog->hide();
checkUpdateButton->setEnabled(true);
return;
}
if ( ! updateUser->text().isEmpty() )
_authenticator->setUser(updateUser->text());
if (requestId != httpGetId)
return;
if ( ! updatePass->text().isEmpty() )
_authenticator->setPassword(updatePass->text());
}
progressDialog->hide();
file->close();
if (error) {
file->remove();
statusLabel->setText(tr("Download failed: %1.").arg(http->errorString()));
QMessageBox::information(this, tr("HTTP"),
tr("Download failed: %1.")
.arg(http->errorString()) + file->fileName() );
} else {
QString fileName = QFileInfo(QUrl(updateURL->text()).path()).fileName();
statusLabel->setText(tr("Downloaded %1").arg(file->fileName() ));
}
void OptionsWidget::httpRequestFinished(QNetworkReply* _qnr)
{
if (_qnr != downloadRep_)
return;
checkUpdateButton->setEnabled(true);
delete file;
file = 0;
QNetworkReply::NetworkError error = _qnr->error();
if ( !error ) {
if ( downloadType == VERSIONS_FILE )
compareVersions();
if ( downloadType == PLUGIN )
updateComponent();
if (httpRequestAborted) {
if (file) {
file->close();
file->remove();
delete file;
file = 0;
}
}
void OptionsWidget::readResponseHeader(const QHttpResponseHeader &responseHeader)
{
switch (responseHeader.statusCode()) {
case 200: // Ok
case 301: // Moved Permanently
case 302: // Found
case 303: // See Other
case 307: // Temporary Redirect
// these are not error conditions
break;
default:
QMessageBox::information(this, tr("HTTP"),
tr("Download failed: %1.")
.arg(responseHeader.reasonPhrase()));
statusLabel->setText(tr("Download failed: ") + responseHeader.reasonPhrase());
httpRequestAborted = true;
progressDialog->hide();
http->abort();
checkUpdateButton->setEnabled(true);
return;
}
progressDialog->hide();
file->close();
if (error != QNetworkReply::NoError) {
file->remove();
} else {
QString fileName = QFileInfo(QUrl(updateURL->text()).path()).fileName();
statusLabel->setText(tr("Downloaded %1").arg(file->fileName() ));
}
}
checkUpdateButton->setEnabled(true);
delete file;
file = 0;
if ( error == QNetworkReply::NoError ) {
if ( downloadType == VERSIONS_FILE )
compareVersions();
if ( downloadType == PLUGIN )
updateComponent();
}
}
void OptionsWidget::cancelDownload()
{
statusLabel->setText(tr("download canceled."));
httpRequestAborted = true;
http->abort();
if (downloadRep_)
downloadRep_->abort();
checkUpdateButton->setEnabled(true);
}
void OptionsWidget::updateDataReadProgress(int bytesRead, int totalBytes)
void OptionsWidget::updateDataReadProgress(qint64 _bytesReceived, qint64 _bytesTotal)
{
if (httpRequestAborted)
return;
progressDialog->setMaximum(totalBytes);
progressDialog->setValue(bytesRead);
progressDialog->setMaximum(_bytesTotal);
progressDialog->setValue(_bytesReceived);
}
void OptionsWidget::showError(QNetworkReply::NetworkError _error)
{
if (_error == QNetworkReply::NoError)
return;
statusLabel->setText(tr("Download failed: %1.").arg(downloadRep_->errorString()));
QMessageBox::information(this, tr("HTTP Error"),
tr("Download failed: %1.")
.arg(downloadRep_->errorString()) + file->fileName() );
}
......
......@@ -121,15 +121,13 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB
pluginOptionsLayout = new QVBoxLayout;
pluginOptions->setLayout( pluginOptionsLayout );
http = new QHttp(this);
networkMan_ = new QNetworkAccessManager(this);
// http specific connections
connect(http, SIGNAL(requestFinished(int, bool)),
this, SLOT(httpRequestFinished(int, bool)));
connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
this, SLOT(readResponseHeader(const QHttpResponseHeader &)));
connect(http, SIGNAL(dataReadProgress(int, int)),
this, SLOT(updateDataReadProgress(int, int)));
connect(networkMan_, SIGNAL(finished(QNetworkReply *)),
this, SLOT(httpRequestFinished(QNetworkReply *)));
connect(networkMan_,SIGNAL(authenticationRequired(QNetworkReply* , QAuthenticator *)),
this,SLOT(authentication(QNetworkReply *, QAuthenticator*)));
progressDialog = new QProgressDialog(this);
......
......@@ -49,6 +49,7 @@
#include "ui_optionsWidget.hh"
#include <QtGui>
#include <QStringList>
#include <QProgressDialog>
#include <QtNetwork>
#include <OpenFlipper/Core/PluginInfo.hh>
......@@ -149,11 +150,11 @@ private:
// flag indicating if something went wrong and the request has to be aborted
bool httpRequestAborted;
// Id of the current request
int httpGetId;
// Request variable
QHttp *http;
QNetworkAccessManager *networkMan_;
// current request
QNetworkReply* downloadRep_;
// File for http downloads
QFile *file;
......@@ -196,13 +197,13 @@ private:
private slots:
// This slot is called when a http request has been finished
void httpRequestFinished(int requestId, bool error);
// Parses the response and gives feedback
void readResponseHeader(const QHttpResponseHeader &responseHeader);
void httpRequestFinished(QNetworkReply *_qnr);
// Updates the progress Dialog while downloading
void updateDataReadProgress(int bytesRead, int totalBytes);
void updateDataReadProgress(qint64 _bytesReceived, qint64 _bytesTotal);
/// error occured while downloading
void showError(QNetworkReply::NetworkError _error);
// Progress dialog callback for cancel
void cancelDownload();
......@@ -213,6 +214,9 @@ private slots:
// Tracks whether another language has been selected
void slotTranslationIndexChanged(int);
/// authentication
void authentication ( QNetworkReply* _reply, QAuthenticator* _authenticator );
private:
/** After checking for updates this variable will contain a list of filenames for which updates are available
*/
......
......@@ -41,7 +41,6 @@
\*===========================================================================*/
#include "postProcessorWidget.hh"
#include <QtGui>
#include <QMessageBox>
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
......
......@@ -46,6 +46,8 @@
#include <QHash>
#include <QTextCharFormat>
#include <QTextEdit>
#include <QTextDocument>
class QTextDocument;
......
......@@ -41,7 +41,7 @@
\*===========================================================================*/
#include "ui_rendererObjectWidget.hh"
#include <QtGui>
#include <QDialog>
#include <OpenFlipper/common/RendererInfo.hh>
#include "renderObjectHighLighter.hh"
......
......@@ -41,7 +41,10 @@
\*===========================================================================*/
#include "ui_rendererWidget.hh"
#include <QtGui>
#include <QDialog>
#include <QVector>
#include <QLabel>
#include <QFrame>
#include <OpenFlipper/common/RendererInfo.hh>
......
......@@ -41,7 +41,7 @@
\*===========================================================================*/
#include "Toolbox.hh"
#include <QtGui>
#include <iostream>
DatacontrolToolboxWidget::DatacontrolToolboxWidget(QWidget* _parent)
......
......@@ -41,7 +41,6 @@
\*===========================================================================*/
#include "TreeView.hh"
#include <QtGui>
#include <iostream>
DataControlTreeView::DataControlTreeView(QWidget* _parent)
......
......@@ -41,7 +41,6 @@
\*===========================================================================*/
#include "DecimaterToolbarWidget.hh"
#include <QtGui>
DecimaterToolbarWidget::DecimaterToolbarWidget(QWidget *parent)
: QWidget(parent)
......
......@@ -41,7 +41,6 @@
\*===========================================================================*/
#include "infoBar.hh"
#include <QtGui>
InfoBar::InfoBar(QWidget *parent)
: QWidget(parent)
......@@ -73,4 +72,4 @@ void InfoBar::showTargetCount(int _count){
hideCounts();
info->setText( tr("%1 targets selected").arg( _count ) );
info->show();
}
\ No newline at end of file
}
......@@ -41,7 +41,6 @@
\*===========================================================================*/
#include "infoDialog.hh"
#include <QtGui>
InfoDialog::InfoDialog(QWidget *parent)
: QDialog(parent)
......
......@@ -41,7 +41,6 @@
\*===========================================================================*/
#include "infoDialog.hh"
#include <QtGui>
InfoDialog::InfoDialog(QWidget *parent)
: QDialog(parent)
......
......@@ -40,9 +40,6 @@
* *
\*===========================================================================*/
#include <QtGui>
#include "IsotropicRemesherPlugin.hh"
#include "IsotropicRemesherT.hh"
......
......@@ -41,7 +41,6 @@
\*===========================================================================*/
#include "IsotropicRemesherToolbox.hh"
#include <QtGui>
IsotropicRemesherToolBox::IsotropicRemesherToolBox(QWidget *parent)
: QWidget(parent)
......
......@@ -41,7 +41,7 @@
\*===========================================================================*/
#include "MeshCompareToolbarWidget.hh"
#include <QtGui>
MeshCompareToolbarWidget::MeshCompareToolbarWidget(QWidget *parent)
: QWidget(parent)
......
......@@ -41,7 +41,6 @@
\*===========================================================================*/
#include "MeshRepairToolbar.hh"
#include <QtGui>
MeshRepairToolbarWidget::MeshRepairToolbarWidget(QWidget *parent)
: QWidget(parent)
......
......@@ -41,10 +41,11 @@
\*===========================================================================*/
#include "MoveProps.hh"
#include <QtGui>
movePropsWidget::movePropsWidget(int obj, QWidget *parent)
: QWidget(parent), obj_(obj)
{
setupUi(this);
}
\ No newline at end of file
}
......@@ -41,7 +41,7 @@
\*===========================================================================*/
#include "MoveToolbar.hh"
#include <QtGui>
moveToolbarWidget::moveToolbarWidget(QWidget *parent)
: QWidget(parent)
......
......@@ -497,7 +497,7 @@ slot_resample_on_edges()
for (; o_it2 != PluginFunctions::objectsEnd(); ++o_it2)
{
std::cerr << "resample " << o_it2->name().toAscii().data() << std::endl;
std::cerr << "resample " << o_it2->name().toStdString() << std::endl;
// decimate polyline
PluginFunctions::polyLineObject(*o_it2)->line()->resample_on_mesh_edges( *mesh, tbsp );
}
......
#include "PolyLineToolbarWidget.hh"
#include <QtGui>
PolyLineToolbarWidget::PolyLineToolbarWidget(QWidget *parent)
: QWidget(parent)
......
......@@ -581,27 +581,27 @@ void OMPropertyModel<MeshT>:: addProperty(QString propName, QString friendlyType
if ( (dtype == tr("Vec3d")) || (dtype == tr("Vec3f")) )
{
OpenMesh::VPropHandleT< TriMesh::Point > prop;
mesh->add_property(prop, pname.toAscii().data());
mesh->add_property(prop, pname.toStdString());
}
else if ( dtype == tr("double") )
{
OpenMesh::VPropHandleT< double > prop;
mesh->add_property(prop, pname.toAscii().data());
mesh->add_property(prop, pname.toStdString());
}
else if ( dtype == tr("unsigned int") )
{
OpenMesh::VPropHandleT< unsigned int > prop;
mesh->add_property(prop, pname.toAscii().data());
mesh->add_property(prop, pname.toStdString());
}
else if ( dtype == tr("int") )
{
OpenMesh::VPropHandleT< int > prop;
mesh->add_property(prop, pname.toAscii().data());
mesh->add_property(prop, pname.toStdString());
}
else if ( dtype == tr("bool") )
{
OpenMesh::VPropHandleT< bool > prop;
mesh->add_property(prop, pname.toAscii().data());
mesh->add_property(prop, pname.toStdString());
}
//please update the doc if you write "skin weights"-property support
......@@ -609,7 +609,7 @@ void OMPropertyModel<MeshT>:: addProperty(QString propName, QString friendlyType
else if ( dtype == tr("SkinWeights") )
{
OpenMesh::VPropHandleT< BaseSkin::SkinWeights > prop;
mesh->add_property(prop, pname.toAscii().data());
mesh->add_property(prop, pname.toStdString());
}
#endif
}
......@@ -618,27 +618,27 @@ void OMPropertyModel<MeshT>:: addProperty(QString propName, QString friendlyType
if ( (dtype == tr("Vec3d")) || (dtype == tr("Vec3f")) )
{
OpenMesh::EPropHandleT< TriMesh::Point > prop;
mesh->add_property(prop, pname.toAscii().data());
mesh->add_property(prop, pname.toStdString());