Fixed: Compilation of tile_edit_qt with Qt 5
--HG-- branch : develop
This commit is contained in:
parent
8475f25e75
commit
fad179731a
18 changed files with 126 additions and 76 deletions
|
@ -1,8 +1,4 @@
|
|||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR}/pic)
|
||||
INCLUDE( ${QT_USE_FILE} )
|
||||
|
||||
FIND_PACKAGE(JPEG)
|
||||
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
FILE(GLOB TILE_EDIT_SRC *.cpp *.h)
|
||||
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_RCS tile_edit_qt.qrc)
|
||||
|
||||
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})
|
||||
IF(WITH_QT)
|
||||
INCLUDE_DIRECTORIES(${QT_INCLUDES})
|
||||
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(QtGeneratedUiHdr FILES ${TILE_EDIT_UI_HDRS})
|
||||
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_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)
|
||||
|
||||
|
|
|
@ -14,19 +14,9 @@
|
|||
// 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 <nel/misc/types_nl.h>
|
||||
#include "common.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 NL3D;
|
||||
using namespace NLMISC;
|
||||
|
@ -272,8 +262,8 @@ int TileList::addTile256 ()
|
|||
bool TileList::setTile128 (int tile, const std::string& name, NL3D::CTile::TBitmap type)
|
||||
{
|
||||
// Remove the absolute path from the path name
|
||||
std::string troncated=name;
|
||||
if (RemovePath (troncated, tileBankBrowser.getAbsPath ().c_str()))
|
||||
std::string troncated = name;
|
||||
if (RemovePath(troncated, tileBankBrowser.getAbsPath ().c_str()))
|
||||
{
|
||||
vector<NLMISC::CBGRA> tampon;
|
||||
uint Width;
|
||||
|
|
17
code/nel/tools/3d/tile_edit_qt/common.cpp
Normal file
17
code/nel/tools/3d/tile_edit_qt/common.cpp
Normal 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"
|
56
code/nel/tools/3d/tile_edit_qt/common.h
Normal file
56
code/nel/tools/3d/tile_edit_qt/common.h
Normal 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
|
|
@ -1,3 +1,4 @@
|
|||
#include "common.h"
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include "items_edit_dlg.h"
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef ITEMS_EDITDLG_H
|
||||
#define ITEMS_EDITDLG_H
|
||||
|
||||
#include <QtGui/QtGui>
|
||||
#include <QtGui/QDialog>
|
||||
#include "ui_items_edit_qt.h"
|
||||
|
||||
class CItems_edit_dlg : public QDialog
|
||||
|
|
|
@ -1,7 +1,20 @@
|
|||
#include <QtGui/QApplication>
|
||||
#include "nel/misc/app_context.h"
|
||||
#include "common.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[])
|
||||
{
|
||||
|
|
|
@ -14,18 +14,8 @@
|
|||
// 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 <QtCore/QString>
|
||||
#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 "common.h"
|
||||
|
||||
#include "tile_browser_dlg.h"
|
||||
#include "tile_rotation_dlg.h"
|
||||
|
||||
|
|
|
@ -17,14 +17,10 @@
|
|||
#ifndef TILE_BROWSERDLG_H
|
||||
#define TILE_BROWSERDLG_H
|
||||
|
||||
#include <QtGui/QtGui>
|
||||
#include <QtGui/QDialog>
|
||||
#include <QtGui/QButtonGroup>
|
||||
#include "ui_tile_browser_qt.h"
|
||||
#include "tiles_model.h"
|
||||
#include "browser_model.h"
|
||||
|
||||
|
||||
class CTile_browser_dlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -14,14 +14,7 @@
|
|||
// 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 <QtCore/QString>
|
||||
#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 "common.h"
|
||||
#include "tile_edit_dlg.h"
|
||||
#include "items_edit_dlg.h"
|
||||
#include "tile_browser_dlg.h"
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
#ifndef TILE_EDITDLG_H
|
||||
#define TILE_EDITDLG_H
|
||||
|
||||
#include <QtGui/QtGui>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include "ui_tile_edit_qt.h"
|
||||
|
||||
class QCheckBox;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// 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"
|
||||
#include "tile_listwidgetitem.h"
|
||||
|
||||
//tile_listwidgetitem::tile_listwidgetitem(void)
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// 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"
|
||||
#include "tile_rotation_dlg.h"
|
||||
|
||||
CTile_rotation_dlg::CTile_rotation_dlg(QWidget *parent, Qt::WindowFlags flags)
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
#ifndef TILE_ROTATIONDLG_H
|
||||
#define TILE_ROTATIONDLG_H
|
||||
|
||||
|
||||
#include <QtGui/QtGui>
|
||||
#include <QtGui/QDialog>
|
||||
#include <QtGui/QButtonGroup>
|
||||
#include "ui_tile_rotation_qt.h"
|
||||
|
||||
class CTile_rotation_dlg : public QDialog
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "common.h"
|
||||
#include <QtGui/QtGui>
|
||||
#include "tile_widget.h"
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef TILE_WIDGET_H
|
||||
#define TILE_WIDGET_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include "tiles_model.h"
|
||||
#include "ui_tile_widget_qt.h"
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
// 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"
|
||||
#include <QtGui/QtGui>
|
||||
#include "tiles_model.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)
|
||||
{
|
||||
CTile_Widget* wiwi = new CTile_Widget;
|
||||
wiwi->initWidget( tiles.value(index.row()).getPixmap(), tiles.value(index.row()).getPixmapSide(), tiles.value(index.row()).getTileLabel() );
|
||||
QPixmap pixpix = QPixmap::grabWidget(wiwi, wiwi->contentsRect());
|
||||
delete wiwi;
|
||||
CTile_Widget wiwi;
|
||||
wiwi.initWidget(tiles.value(index.row()).getPixmap(), tiles.value(index.row()).getPixmapSide(), tiles.value(index.row()).getTileLabel());
|
||||
QPixmap pixpix = wiwi.grab(wiwi.contentsRect());
|
||||
return pixpix;
|
||||
}
|
||||
else if (role == Qt::UserRole + 1)
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
#ifndef 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
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in a new issue