Library-ize some things

--HG--
branch : qt5
hg/feature/qt5
kaetemi 10 years ago
parent 20835ab697
commit 95c54682b5

@ -152,6 +152,7 @@ IF(WITH_QT5)
FIND_PACKAGE(Qt5Widgets) FIND_PACKAGE(Qt5Widgets)
FIND_PACKAGE(Qt5LinguistTools) FIND_PACKAGE(Qt5LinguistTools)
ADD_DEFINITIONS(-DQT_NO_DEBUG) ADD_DEFINITIONS(-DQT_NO_DEBUG)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/nelqt/include)
ENDIF(WITH_QT5) ENDIF(WITH_QT5)
IF(WITH_NEL) IF(WITH_NEL)
@ -194,6 +195,10 @@ IF(WITH_NEL)
ADD_SUBDIRECTORY(nel) ADD_SUBDIRECTORY(nel)
ENDIF(WITH_NEL) ENDIF(WITH_NEL)
IF(WITH_QT5)
ADD_SUBDIRECTORY(nelqt)
ENDIF(WITH_QT5)
IF(WITH_RYZOM) IF(WITH_RYZOM)
ADD_SUBDIRECTORY(ryzom) ADD_SUBDIRECTORY(ryzom)
ENDIF(WITH_RYZOM) ENDIF(WITH_RYZOM)

@ -78,6 +78,7 @@ ENDMACRO(NL_GEN_REVISION_H)
# #
### ###
MACRO(NL_TARGET_LIB name) MACRO(NL_TARGET_LIB name)
CMAKE_POLICY(SET CMP0020 OLD)
IF(WITH_STATIC) IF(WITH_STATIC)
ADD_LIBRARY(${name} STATIC ${ARGN}) ADD_LIBRARY(${name} STATIC ${ARGN})
ELSE(WITH_STATIC) ELSE(WITH_STATIC)

@ -15,6 +15,7 @@ SET(CMAKE_AUTOMOC ON)
QT5_ADD_RESOURCES(RESOURCE_ADDED ${RESOURCES}) QT5_ADD_RESOURCES(RESOURCE_ADDED ${RESOURCES})
CMAKE_POLICY(SET CMP0020 NEW)
ADD_EXECUTABLE(nl_panoply_preview WIN32 ${SRC} ADD_EXECUTABLE(nl_panoply_preview WIN32 ${SRC}
${SRCS} ${SRCS}
${HDRS} ${HDRS}
@ -26,6 +27,7 @@ ADD_EXECUTABLE(nl_panoply_preview WIN32 ${SRC}
TARGET_LINK_LIBRARIES(nl_panoply_preview TARGET_LINK_LIBRARIES(nl_panoply_preview
nelmisc nelmisc
nel3d nel3d
nelqtdisplayer
Qt5::Widgets) Qt5::Widgets)
NL_DEFAULT_PROPS(nl_panoply_preview "NeL, Tools, 3D: panoply_preview") NL_DEFAULT_PROPS(nl_panoply_preview "NeL, Tools, 3D: panoply_preview")

@ -1,74 +0,0 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
// 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 <http://www.gnu.org/licenses/>.
#ifndef NLTOOLS_COMMAND_LOG_H
#define NLTOOLS_COMMAND_LOG_H
#include <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QWidget>
#include <QTextEdit>
#include <QLineEdit>
// NeL includes
#include <nel/misc/log.h>
#include <nel/misc/displayer.h>
// 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 */

@ -39,9 +39,9 @@
// #include <nel/misc/debug.h> // #include <nel/misc/debug.h>
#include <nel/misc/i18n.h> #include <nel/misc/i18n.h>
#include <nel/3d/u_driver.h> #include <nel/3d/u_driver.h>
#include <nelqt/displayer/command_log.h>
// Project includes // Project includes
#include "command_log.h"
#include "panoply_preview.h" #include "panoply_preview.h"
using namespace std; using namespace std;
@ -121,7 +121,7 @@ void CMainWindow::createDockWindows()
m_CommandLogDock = new QDockWidget(this); m_CommandLogDock = new QDockWidget(this);
m_CommandLogDock->setWindowTitle(tr("Console")); m_CommandLogDock->setWindowTitle(tr("Console"));
m_CommandLogDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); 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); m_CommandLogDock->setWidget(m_CommandLog);
addDockWidget(Qt::BottomDockWidgetArea, m_CommandLogDock); addDockWidget(Qt::BottomDockWidgetArea, m_CommandLogDock);
m_WidgetsMenu->addAction(m_CommandLogDock->toggleViewAction()); m_WidgetsMenu->addAction(m_CommandLogDock->toggleViewAction());

@ -38,8 +38,11 @@ class QDirModel;
class QUndoStack; class QUndoStack;
class QScrollArea; class QScrollArea;
namespace NLTOOLS { namespace NLQT {
class CCommandLog; class CCommandLog;
}
namespace NLTOOLS {
class CPanoplyPreview; class CPanoplyPreview;
/** /**
@ -75,7 +78,7 @@ private:
private: private:
CPanoplyPreview *m_PanoplyPreview; CPanoplyPreview *m_PanoplyPreview;
CCommandLog *m_CommandLog; NLQT::CCommandLog *m_CommandLog;
QDockWidget *m_CommandLogDock; QDockWidget *m_CommandLogDock;
QMenu *m_WidgetsMenu; QMenu *m_WidgetsMenu;

@ -0,0 +1,2 @@
ADD_SUBDIRECTORY(src)

@ -0,0 +1,81 @@
/*
Copyright (C) 2010-2015 by authors
Author: Jan Boon <jan.boon@kaetemi.be>
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 <nel/misc/types_nl.h>
// STL includes
// Qt includes
#include <QWidget>
#include <QTextEdit>
#include <QLineEdit>
// NeL includes
#include <nel/misc/log.h>
#include <nel/misc/displayer.h>
// 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 */

@ -0,0 +1,2 @@
ADD_SUBDIRECTORY(displayer)

@ -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)

@ -1,21 +1,34 @@
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/> /*
// Copyright (C) 2014 Jan BOON (jan.boon@kaetemi.be)
// Copyright (C) 2010-2015 by authors
// This program is free software: you can redistribute it and/or modify Author: Jan Boon <jan.boon@kaetemi.be>
// it under the terms of the GNU Affero General Public License as All rights reserved.
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version. Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of * Redistributions of source code must retain the above copyright notice, this
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the list of conditions and the following disclaimer.
// GNU Affero General Public License for more details.
// * Redistributions in binary form must reproduce the above copyright notice,
// You should have received a copy of the GNU Affero General Public License this list of conditions and the following disclaimer in the documentation
// along with this program. If not, see <http://www.gnu.org/licenses/>. 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 <nel/misc/types_nl.h> #include <nel/misc/types_nl.h>
#include "command_log.h" #include <nelqt/displayer/command_log.h>
// STL includes // STL includes
@ -32,7 +45,7 @@
using namespace std; using namespace std;
using namespace NLMISC; using namespace NLMISC;
namespace NLTOOLS { namespace NLQT {
CCommandLog::CCommandLog(QWidget *parent) : QWidget(parent) CCommandLog::CCommandLog(QWidget *parent) : QWidget(parent)
{ {
@ -190,6 +203,6 @@ void CCommandLog::returnPressed()
m_CommandInput->clear(); m_CommandInput->clear();
} }
} /* namespace NLTOOLS */ } /* namespace NLQT */
/* end of file */ /* end of file */
Loading…
Cancel
Save