Fixed: Compilation of tile_edit_qt with Qt 5

This commit is contained in:
kervala 2016-01-06 12:29:34 +01:00
parent ca54fa4a5a
commit ba81d0ad85
18 changed files with 126 additions and 76 deletions

View file

@ -1,8 +1,4 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/pic) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE( ${QT_USE_FILE} )
FIND_PACKAGE(JPEG)
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
FILE(GLOB TILE_EDIT_SRC *.cpp *.h) FILE(GLOB TILE_EDIT_SRC *.cpp *.h)
FILE(GLOB PIC_SRC pic/*.c pic/*.cpp) FILE(GLOB PIC_SRC pic/*.c pic/*.cpp)
@ -10,22 +6,35 @@ SET(TILE_EDIT_HDR items_edit_dlg.h tile_browser_dlg.h tile_edit_dlg.h tile_rotat
SET(TILE_EDIT_UIS tile_widget_qt.ui tile_rotation_qt.ui tile_edit_qt.ui tile_browser_qt.ui items_edit_qt.ui) SET(TILE_EDIT_UIS tile_widget_qt.ui tile_rotation_qt.ui tile_edit_qt.ui tile_browser_qt.ui items_edit_qt.ui)
SET(TILE_EDIT_RCS tile_edit_qt.qrc) SET(TILE_EDIT_RCS tile_edit_qt.qrc)
QT4_ADD_RESOURCES( TILE_EDIT_RC_SRCS ${TILE_EDIT_RCS} ) IF(WITH_QT)
QT4_WRAP_UI( TILE_EDIT_UI_HDRS ${TILE_EDIT_UIS} ) INCLUDE_DIRECTORIES(${QT_INCLUDES})
QT4_WRAP_CPP( TILE_EDIT_MOC_SRCS ${TILE_EDIT_HDR}) INCLUDE(${QT_USE_FILE})
QT4_ADD_RESOURCES(TILE_EDIT_RC_SRCS ${TILE_EDIT_RCS})
QT4_WRAP_UI(TILE_EDIT_UI_HDRS ${TILE_EDIT_UIS})
QT4_WRAP_CPP(TILE_EDIT_MOC_SRCS ${TILE_EDIT_HDR})
ADD_DEFINITIONS(${QT_DEFINITIONS})
ELSEIF(WITH_QT5)
QT5_ADD_RESOURCES(TILE_EDIT_RC_SRCS ${TILE_EDIT_RCS})
QT5_WRAP_UI(TILE_EDIT_UI_HDRS ${TILE_EDIT_UIS})
QT5_WRAP_CPP(TILE_EDIT_MOC_SRCS ${TILE_EDIT_HDR})
ENDIF()
SOURCE_GROUP(QtResources FILES ${TILE_EDIT_UIS} ${TILE_EDIT_RCS}) SOURCE_GROUP(QtResources FILES ${TILE_EDIT_UIS} ${TILE_EDIT_RCS})
SOURCE_GROUP(QtGeneratedUiHdr FILES ${TILE_EDIT_UI_HDRS}) SOURCE_GROUP(QtGeneratedUiHdr FILES ${TILE_EDIT_UI_HDRS})
SOURCE_GROUP(QtGeneratedMocSrc FILES ${TILE_EDIT_MOC_SRCS}) SOURCE_GROUP(QtGeneratedMocSrc FILES ${TILE_EDIT_MOC_SRCS})
SOURCE_GROUP(PICLibrary FILES ${PIC_SRC})
ADD_EXECUTABLE(tile_edit_qt ${TILE_EDIT_SRC} ${PIC_SRC} ${TILE_EDIT_MOC_SRCS} ${TILE_EDIT_RC_SRCS} ${TILE_EDIT_UI_HDRS}) ADD_EXECUTABLE(tile_edit_qt WIN32 ${TILE_EDIT_SRC} ${TILE_EDIT_MOC_SRCS} ${TILE_EDIT_RC_SRCS} ${TILE_EDIT_UI_HDRS})
TARGET_LINK_LIBRARIES(tile_edit_qt ${QT_LIBRARIES} ${JPEG_LIBRARY} nelmisc nel3d) TARGET_LINK_LIBRARIES(tile_edit_qt ${QT_LIBRARIES} nelmisc nel3d)
NL_DEFAULT_PROPS(tile_edit_qt "NeL, Tools, 3D: Qt Tile Editor") NL_DEFAULT_PROPS(tile_edit_qt "NeL, Tools, 3D: Qt Tile Editor")
NL_ADD_RUNTIME_FLAGS(tile_edit_qt) NL_ADD_RUNTIME_FLAGS(tile_edit_qt)
ADD_DEFINITIONS(${QT_DEFINITIONS}) IF(WITH_PCH)
ADD_NATIVE_PRECOMPILED_HEADER(tile_edit_qt ${CMAKE_CURRENT_SOURCE_DIR}/common.h ${CMAKE_CURRENT_SOURCE_DIR}/common.cpp)
ENDIF()
INSTALL(TARGETS tile_edit_qt RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d) INSTALL(TARGETS tile_edit_qt RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT tools3d)

View file

@ -14,19 +14,9 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <nel/misc/types_nl.h> #include "common.h"
#include "browser_model.h" #include "browser_model.h"
#include <string>
#include <nel/3d/tile_bank.h>
#include <nel/misc/stream.h>
#include <nel/misc/file.h>
#include <QtGui/QMessageBox>
#include "pic/readpic.h"
using namespace std; using namespace std;
using namespace NL3D; using namespace NL3D;
using namespace NLMISC; using namespace NLMISC;
@ -272,8 +262,8 @@ int TileList::addTile256 ()
bool TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitmap type) bool TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitmap type)
{ {
// Remove the absolute path from the path name // Remove the absolute path from the path name
std::string troncated=name; std::string troncated = name;
if (RemovePath (troncated, tileBankBrowser.getAbsPath ().c_str())) if (RemovePath(troncated, tileBankBrowser.getAbsPath ().c_str()))
{ {
vector<NLMISC::CBGRA> tampon; vector<NLMISC::CBGRA> tampon;
uint Width; uint Width;

View file

@ -0,0 +1,17 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "common.h"

View file

@ -0,0 +1,56 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// Copyright (C) 2010 Winch Gate Property Limited
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program 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 Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef COMMON_H
#define COMMON_H
#if defined(_MSC_VER) && defined(_DEBUG)
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
#undef realloc
#undef free
#endif
#include <qglobal.h>
#ifdef Q_COMPILER_RVALUE_REFS
#undef Q_COMPILER_RVALUE_REFS
#endif
#include <QtCore/QtCore>
#include <QtGui/QtGui>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#define USE_QT5
#endif
#ifdef USE_QT5
#include <QtWidgets/QtWidgets>
#include <QtConcurrent/QtConcurrent>
#endif
#include <string>
#include <nel/misc/types_nl.h>
#include <nel/3d/tile_bank.h>
#include <nel/misc/stream.h>
#include <nel/misc/file.h>
#include <nel/misc/app_context.h>
#include <nel/misc/bitmap.h>
#endif

View file

@ -1,3 +1,4 @@
#include "common.h"
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include "items_edit_dlg.h" #include "items_edit_dlg.h"

View file

@ -1,8 +1,6 @@
#ifndef ITEMS_EDITDLG_H #ifndef ITEMS_EDITDLG_H
#define ITEMS_EDITDLG_H #define ITEMS_EDITDLG_H
#include <QtGui/QtGui>
#include <QtGui/QDialog>
#include "ui_items_edit_qt.h" #include "ui_items_edit_qt.h"
class CItems_edit_dlg : public QDialog class CItems_edit_dlg : public QDialog

View file

@ -1,7 +1,20 @@
#include <QtGui/QApplication> #include "common.h"
#include "nel/misc/app_context.h"
#include "tile_edit_dlg.h" #include "tile_edit_dlg.h"
#ifdef QT_STATICPLUGIN
#include <QtPlugin>
#if defined(Q_OS_WIN32)
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
#elif defined(Q_OS_MAC)
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
#elif defined(Q_OS_UNIX)
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
#endif
#endif
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {

View file

@ -14,18 +14,8 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QtCore/QString> #include "common.h"
#include <QtCore/QStringList>
#include <QtGui/QListWidgetItem>
#include <QtGui/QColor>
#include <QtCore/QList>
#include <QtGui/QAction>
#include <QtCore/QSettings>
#include "nel/3d/tile_bank.h"
#include "nel/misc/bitmap.h"
#include "nel/misc/file.h"
#include "pic/readpic.h"
#include "pic/pic.h"
#include "tile_browser_dlg.h" #include "tile_browser_dlg.h"
#include "tile_rotation_dlg.h" #include "tile_rotation_dlg.h"

View file

@ -17,14 +17,10 @@
#ifndef TILE_BROWSERDLG_H #ifndef TILE_BROWSERDLG_H
#define TILE_BROWSERDLG_H #define TILE_BROWSERDLG_H
#include <QtGui/QtGui>
#include <QtGui/QDialog>
#include <QtGui/QButtonGroup>
#include "ui_tile_browser_qt.h" #include "ui_tile_browser_qt.h"
#include "tiles_model.h" #include "tiles_model.h"
#include "browser_model.h" #include "browser_model.h"
class CTile_browser_dlg : public QDialog class CTile_browser_dlg : public QDialog
{ {
Q_OBJECT Q_OBJECT

View file

@ -14,14 +14,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QtCore/QString> #include "common.h"
#include <QtGui/QListWidgetItem>
#include <QtGui/QMessageBox>
#include <QtCore/QDir>
#include <string>
#include <nel/3d/tile_bank.h>
#include <nel/misc/stream.h>
#include <nel/misc/file.h>
#include "tile_edit_dlg.h" #include "tile_edit_dlg.h"
#include "items_edit_dlg.h" #include "items_edit_dlg.h"
#include "tile_browser_dlg.h" #include "tile_browser_dlg.h"

View file

@ -17,8 +17,6 @@
#ifndef TILE_EDITDLG_H #ifndef TILE_EDITDLG_H
#define TILE_EDITDLG_H #define TILE_EDITDLG_H
#include <QtGui/QtGui>
#include <QtGui/QMainWindow>
#include "ui_tile_edit_qt.h" #include "ui_tile_edit_qt.h"
class QCheckBox; class QCheckBox;

View file

@ -14,6 +14,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "common.h"
#include "tile_listwidgetitem.h" #include "tile_listwidgetitem.h"
//tile_listwidgetitem::tile_listwidgetitem(void) //tile_listwidgetitem::tile_listwidgetitem(void)

View file

@ -14,6 +14,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "common.h"
#include "tile_rotation_dlg.h" #include "tile_rotation_dlg.h"
CTile_rotation_dlg::CTile_rotation_dlg(QWidget *parent, Qt::WindowFlags flags) CTile_rotation_dlg::CTile_rotation_dlg(QWidget *parent, Qt::WindowFlags flags)

View file

@ -17,10 +17,6 @@
#ifndef TILE_ROTATIONDLG_H #ifndef TILE_ROTATIONDLG_H
#define TILE_ROTATIONDLG_H #define TILE_ROTATIONDLG_H
#include <QtGui/QtGui>
#include <QtGui/QDialog>
#include <QtGui/QButtonGroup>
#include "ui_tile_rotation_qt.h" #include "ui_tile_rotation_qt.h"
class CTile_rotation_dlg : public QDialog class CTile_rotation_dlg : public QDialog

View file

@ -1,3 +1,4 @@
#include "common.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#include "tile_widget.h" #include "tile_widget.h"

View file

@ -1,7 +1,6 @@
#ifndef TILE_WIDGET_H #ifndef TILE_WIDGET_H
#define TILE_WIDGET_H #define TILE_WIDGET_H
#include <QtGui/QWidget>
#include "tiles_model.h" #include "tiles_model.h"
#include "ui_tile_widget_qt.h" #include "ui_tile_widget_qt.h"

View file

@ -14,6 +14,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "common.h"
#include <QtGui/QtGui> #include <QtGui/QtGui>
#include "tiles_model.h" #include "tiles_model.h"
#include "tile_widget.h" #include "tile_widget.h"
@ -57,10 +58,9 @@ QVariant tiles_model::data(const QModelIndex &index, int role) const
if (role == Qt::DecorationRole || role == Qt::UserRole) if (role == Qt::DecorationRole || role == Qt::UserRole)
{ {
CTile_Widget* wiwi = new CTile_Widget; CTile_Widget wiwi;
wiwi->initWidget( tiles.value(index.row()).getPixmap(), tiles.value(index.row()).getPixmapSide(), tiles.value(index.row()).getTileLabel() ); wiwi.initWidget(tiles.value(index.row()).getPixmap(), tiles.value(index.row()).getPixmapSide(), tiles.value(index.row()).getTileLabel());
QPixmap pixpix = QPixmap::grabWidget(wiwi, wiwi->contentsRect()); QPixmap pixpix = wiwi.grab(wiwi.contentsRect());
delete wiwi;
return pixpix; return pixpix;
} }
else if (role == Qt::UserRole + 1) else if (role == Qt::UserRole + 1)

View file

@ -1,15 +1,6 @@
#ifndef TILESMODEL_H #ifndef TILESMODEL_H
#define TILESMODEL_H #define TILESMODEL_H
#include <QtCore/QAbstractListModel>
#include <QtCore/QList>
#include <QtGui/QPixmap>
#include <QtCore/QPoint>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
#include <QtGui/QStackedWidget>
#include <QtGui/QLabel>
class TileModel class TileModel
{ {