diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index aa4968e0f..ef6775118 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -152,6 +152,7 @@ IF(WITH_QT5) FIND_PACKAGE(Qt5Widgets) FIND_PACKAGE(Qt5LinguistTools) ADD_DEFINITIONS(-DQT_NO_DEBUG) + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nelqt/include) ENDIF(WITH_QT5) IF(WITH_NEL) @@ -194,6 +195,10 @@ IF(WITH_NEL) ADD_SUBDIRECTORY(nel) ENDIF(WITH_NEL) +IF(WITH_QT5) + ADD_SUBDIRECTORY(nelqt) +ENDIF(WITH_QT5) + IF(WITH_RYZOM) ADD_SUBDIRECTORY(ryzom) ENDIF(WITH_RYZOM) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index 1e4ab8b2b..312cea864 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -78,6 +78,7 @@ ENDMACRO(NL_GEN_REVISION_H) # ### MACRO(NL_TARGET_LIB name) + CMAKE_POLICY(SET CMP0020 OLD) IF(WITH_STATIC) ADD_LIBRARY(${name} STATIC ${ARGN}) ELSE(WITH_STATIC) diff --git a/code/nel/tools/3d/panoply_preview/CMakeLists.txt b/code/nel/tools/3d/panoply_preview/CMakeLists.txt index fd33b0b22..05eabc9fb 100644 --- a/code/nel/tools/3d/panoply_preview/CMakeLists.txt +++ b/code/nel/tools/3d/panoply_preview/CMakeLists.txt @@ -15,6 +15,7 @@ SET(CMAKE_AUTOMOC ON) QT5_ADD_RESOURCES(RESOURCE_ADDED ${RESOURCES}) +CMAKE_POLICY(SET CMP0020 NEW) ADD_EXECUTABLE(nl_panoply_preview WIN32 ${SRC} ${SRCS} ${HDRS} @@ -26,6 +27,7 @@ ADD_EXECUTABLE(nl_panoply_preview WIN32 ${SRC} TARGET_LINK_LIBRARIES(nl_panoply_preview nelmisc nel3d + nelqtdisplayer Qt5::Widgets) NL_DEFAULT_PROPS(nl_panoply_preview "NeL, Tools, 3D: panoply_preview") diff --git a/code/nel/tools/3d/panoply_preview/command_log.h b/code/nel/tools/3d/panoply_preview/command_log.h deleted file mode 100644 index a8d1521b7..000000000 --- a/code/nel/tools/3d/panoply_preview/command_log.h +++ /dev/null @@ -1,74 +0,0 @@ -// NeL - MMORPG Framework -// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be) -// -// 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 . - -#ifndef NLTOOLS_COMMAND_LOG_H -#define NLTOOLS_COMMAND_LOG_H -#include - -// STL includes - -// Qt includes -#include -#include -#include - -// NeL includes -#include -#include - -// Project includes - -namespace NLTOOLS { - -/** - * CCommandLog - * \brief CCommandLog - * \date 2010-02-05 20:27GMT - * \author Jan BOON (jan.boon@kaetemi.be) - */ -class CCommandLog : public QWidget, public NLMISC::IDisplayer -{ - Q_OBJECT - -public: - CCommandLog(QWidget *parent); - virtual ~CCommandLog(); - -protected: - virtual void doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message); - -signals: - void tSigDisplay(const QColor &c, const QString &text); - -private slots: - void returnPressed(); - void tSlotDisplay(const QColor &c, const QString &text); - -private: - QTextEdit *m_DisplayerOutput; - QLineEdit *m_CommandInput; - -private: - CCommandLog(const CCommandLog &); - CCommandLog &operator=(const CCommandLog &); - -}; /* class CCommandLog */ - -} /* namespace NLTOOLS */ - -#endif /* #ifndef NLTOOLS_COMMAND_LOG_H */ - -/* end of file */ diff --git a/code/nel/tools/3d/panoply_preview/main_window.cpp b/code/nel/tools/3d/panoply_preview/main_window.cpp index b04cd36bb..5b5128c2b 100644 --- a/code/nel/tools/3d/panoply_preview/main_window.cpp +++ b/code/nel/tools/3d/panoply_preview/main_window.cpp @@ -39,9 +39,9 @@ // #include #include #include +#include // Project includes -#include "command_log.h" #include "panoply_preview.h" using namespace std; @@ -121,7 +121,7 @@ void CMainWindow::createDockWindows() m_CommandLogDock = new QDockWidget(this); m_CommandLogDock->setWindowTitle(tr("Console")); m_CommandLogDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); - m_CommandLog = new CCommandLog(m_CommandLogDock); + m_CommandLog = new NLQT::CCommandLog(m_CommandLogDock); m_CommandLogDock->setWidget(m_CommandLog); addDockWidget(Qt::BottomDockWidgetArea, m_CommandLogDock); m_WidgetsMenu->addAction(m_CommandLogDock->toggleViewAction()); diff --git a/code/nel/tools/3d/panoply_preview/main_window.h b/code/nel/tools/3d/panoply_preview/main_window.h index 7bf96388a..cf2a1c75f 100644 --- a/code/nel/tools/3d/panoply_preview/main_window.h +++ b/code/nel/tools/3d/panoply_preview/main_window.h @@ -38,8 +38,11 @@ class QDirModel; class QUndoStack; class QScrollArea; -namespace NLTOOLS { +namespace NLQT { class CCommandLog; +} + +namespace NLTOOLS { class CPanoplyPreview; /** @@ -75,7 +78,7 @@ private: private: CPanoplyPreview *m_PanoplyPreview; - CCommandLog *m_CommandLog; + NLQT::CCommandLog *m_CommandLog; QDockWidget *m_CommandLogDock; QMenu *m_WidgetsMenu; diff --git a/code/nelqt/CMakeLists.txt b/code/nelqt/CMakeLists.txt new file mode 100644 index 000000000..a78b36e5d --- /dev/null +++ b/code/nelqt/CMakeLists.txt @@ -0,0 +1,2 @@ + +ADD_SUBDIRECTORY(src) diff --git a/code/nelqt/include/nelqt/displayer/command_log.h b/code/nelqt/include/nelqt/displayer/command_log.h new file mode 100644 index 000000000..d60a8de19 --- /dev/null +++ b/code/nelqt/include/nelqt/displayer/command_log.h @@ -0,0 +1,81 @@ +/* + +Copyright (C) 2010-2015 by authors +Author: Jan Boon +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ + +#ifndef NLQT_COMMAND_LOG_H +#define NLQT_COMMAND_LOG_H +#include + +// STL includes + +// Qt includes +#include +#include +#include + +// NeL includes +#include +#include + +// Project includes + +namespace NLQT { + +class CCommandLog : public QWidget, public NLMISC::IDisplayer +{ + Q_OBJECT + +public: + CCommandLog(QWidget *parent); + virtual ~CCommandLog(); + +protected: + virtual void doDisplay(const NLMISC::CLog::TDisplayInfo& args, const char *message); + +signals: + void tSigDisplay(const QColor &c, const QString &text); + +private slots: + void returnPressed(); + void tSlotDisplay(const QColor &c, const QString &text); + +private: + QTextEdit *m_DisplayerOutput; + QLineEdit *m_CommandInput; + +private: + CCommandLog(const CCommandLog &); + CCommandLog &operator=(const CCommandLog &); + +}; /* class CCommandLog */ + +} /* namespace NLQT */ + +#endif /* #ifndef NLQT_COMMAND_LOG_H */ + +/* end of file */ diff --git a/code/nelqt/src/CMakeLists.txt b/code/nelqt/src/CMakeLists.txt new file mode 100644 index 000000000..dd7791ca6 --- /dev/null +++ b/code/nelqt/src/CMakeLists.txt @@ -0,0 +1,2 @@ + +ADD_SUBDIRECTORY(displayer) diff --git a/code/nelqt/src/displayer/CMakeLists.txt b/code/nelqt/src/displayer/CMakeLists.txt new file mode 100644 index 000000000..2e9978f4d --- /dev/null +++ b/code/nelqt/src/displayer/CMakeLists.txt @@ -0,0 +1,18 @@ +FILE(GLOB SRCS *.cpp *.h) +FILE(GLOB HDRS ../../include/nelqt/displayer/*.h) +SOURCE_GROUP("" FILES ${SRCS} ${HDRS}) + +SET(CMAKE_AUTOMOC ON) + +NL_TARGET_LIB(nelqtdisplayer ${SRCS} ${HDRS}) + +TARGET_LINK_LIBRARIES(nelqtdisplayer nelmisc Qt5::Widgets) + +NL_DEFAULT_PROPS(nelqtdisplayer "NeLQt, Library: Displayer") +NL_ADD_RUNTIME_FLAGS(nelqtdisplayer) + +NL_ADD_LIB_SUFFIX(nelqtdisplayer) + +IF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) + INSTALL(TARGETS nelqtdisplayer LIBRARY DESTINATION ${NL_LIB_PREFIX} ARCHIVE DESTINATION ${NL_LIB_PREFIX} COMPONENT libraries) +ENDIF((WITH_INSTALL_LIBRARIES AND WITH_STATIC) OR NOT WITH_STATIC) diff --git a/code/nel/tools/3d/panoply_preview/command_log.cpp b/code/nelqt/src/displayer/command_log.cpp similarity index 71% rename from code/nel/tools/3d/panoply_preview/command_log.cpp rename to code/nelqt/src/displayer/command_log.cpp index 8a530f7f9..8d6437dab 100644 --- a/code/nel/tools/3d/panoply_preview/command_log.cpp +++ b/code/nelqt/src/displayer/command_log.cpp @@ -1,21 +1,34 @@ -// NeL - MMORPG Framework -// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be) -// -// 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 . +/* + +Copyright (C) 2010-2015 by authors +Author: Jan Boon +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +*/ #include -#include "command_log.h" +#include // STL includes @@ -32,7 +45,7 @@ using namespace std; using namespace NLMISC; -namespace NLTOOLS { +namespace NLQT { CCommandLog::CCommandLog(QWidget *parent) : QWidget(parent) { @@ -190,6 +203,6 @@ void CCommandLog::returnPressed() m_CommandInput->clear(); } -} /* namespace NLTOOLS */ +} /* namespace NLQT */ /* end of file */