mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
new attempt at the editor
This commit is contained in:
parent
c8562d8442
commit
c3cd6e8a8a
7 changed files with 144 additions and 1 deletions
|
@ -31,6 +31,7 @@ option(OGRE_STATIC "Link static build of Ogre and Ogre Plugins into the binaries
|
|||
option(BUILD_ESMTOOL "build ESM inspector" ON)
|
||||
option(BUILD_LAUNCHER "build Launcher" ON)
|
||||
option(BUILD_MWINIIMPORTER "build MWiniImporter" ON)
|
||||
option(BUILD_OPENCS "build OpenMW Construction Set" ON)
|
||||
option(BUILD_WITH_CODE_COVERAGE "Enable code coverage with gconv" OFF)
|
||||
option(BUILD_UNITTESTS "Enable Unittests with Google C++ Unittest ang GMock frameworks" OFF)
|
||||
|
||||
|
@ -462,6 +463,10 @@ if (BUILD_MWINIIMPORTER)
|
|||
add_subdirectory( apps/mwiniimporter )
|
||||
endif()
|
||||
|
||||
if (BUILD_OPENCS)
|
||||
add_subdirectory (apps/opencs)
|
||||
endif()
|
||||
|
||||
# UnitTests
|
||||
if (BUILD_UNITTESTS)
|
||||
add_subdirectory( apps/openmw_test_suite )
|
||||
|
|
44
apps/opencs/CMakeLists.txt
Normal file
44
apps/opencs/CMakeLists.txt
Normal file
|
@ -0,0 +1,44 @@
|
|||
|
||||
set (OPENCS_SRC
|
||||
main.cpp
|
||||
|
||||
model/doc/documentmanager.cpp model/doc/document.cpp
|
||||
)
|
||||
|
||||
set (OPENCS_HDR
|
||||
model/doc/documentmanager.hpp model/doc/document.hpp
|
||||
)
|
||||
|
||||
set (OPENCS_US
|
||||
)
|
||||
|
||||
set (OPENCS_RES
|
||||
)
|
||||
|
||||
source_group (opencs FILES ${OPENCS_SRC} ${OPENCS_HDR})
|
||||
|
||||
if(WIN32)
|
||||
set(QT_USE_QTMAIN TRUE)
|
||||
endif(WIN32)
|
||||
|
||||
find_package(Qt4 COMPONENTS QtCore QtGui QtXml QtXmlPatterns REQUIRED)
|
||||
include(${QT_USE_FILE})
|
||||
|
||||
qt4_wrap_ui(OPENCS_UI_HDR ${OPENCS_UI})
|
||||
qt4_wrap_cpp(OPENCS_MOC_SRC ${OPENCS_HDR})
|
||||
qt4_add_resources(OPENCS_RES_SRC ${OPENCS_RES})
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
add_executable(opencs
|
||||
${OPENCS_SRC}
|
||||
${OPENCS_UI_HDR}
|
||||
${OPENCS_MOC_SRC}
|
||||
${OPENCS_RES_SRC}
|
||||
)
|
||||
|
||||
target_link_libraries(opencs
|
||||
${Boost_LIBRARIES}
|
||||
${QT_LIBRARIES}
|
||||
components
|
||||
)
|
5
apps/opencs/main.cpp
Normal file
5
apps/opencs/main.cpp
Normal file
|
@ -0,0 +1,5 @@
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
}
|
4
apps/opencs/model/doc/document.cpp
Normal file
4
apps/opencs/model/doc/document.cpp
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
#include "document.hpp"
|
||||
|
||||
CSMDoc::Document::Document() {}
|
17
apps/opencs/model/doc/document.hpp
Normal file
17
apps/opencs/model/doc/document.hpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef CSM_DOCUMENT_H
|
||||
#define CSM_DOCUMENT_H
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
class Document
|
||||
{
|
||||
Document (const Document&);
|
||||
Document& operator= (const Document&);
|
||||
|
||||
public:
|
||||
|
||||
Document();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
37
apps/opencs/model/doc/documentmanager.cpp
Normal file
37
apps/opencs/model/doc/documentmanager.cpp
Normal file
|
@ -0,0 +1,37 @@
|
|||
|
||||
#include "documentmanager.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "document.hpp"
|
||||
|
||||
CSMDoc::DocumentManager::DocumentManager() {}
|
||||
|
||||
CSMDoc::DocumentManager::~DocumentManager()
|
||||
{
|
||||
for (std::vector<Document *>::iterator iter (mDocuments.begin()); iter!=mDocuments.end(); ++iter)
|
||||
delete *iter;
|
||||
}
|
||||
|
||||
CSMDoc::Document *CSMDoc::DocumentManager::addDocument()
|
||||
{
|
||||
Document *document = new Document;
|
||||
|
||||
mDocuments.push_back (document);
|
||||
|
||||
return document;
|
||||
}
|
||||
|
||||
bool CSMDoc::DocumentManager::removeDocument (Document *document)
|
||||
{
|
||||
std::vector<Document *>::iterator iter = std::find (mDocuments.begin(), mDocuments.end(), document);
|
||||
|
||||
if (iter==mDocuments.end())
|
||||
throw std::runtime_error ("removing invalid document");
|
||||
|
||||
mDocuments.erase (iter);
|
||||
delete document;
|
||||
|
||||
return mDocuments.empty();
|
||||
}
|
31
apps/opencs/model/doc/documentmanager.hpp
Normal file
31
apps/opencs/model/doc/documentmanager.hpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#ifndef CSM_DOCUMENTMGR_H
|
||||
#define CSM_DOCUMENTMGR_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
class Document;
|
||||
|
||||
class DocumentManager
|
||||
{
|
||||
std::vector<Document *> mDocuments;
|
||||
|
||||
DocumentManager (const DocumentManager&);
|
||||
DocumentManager& operator= (const DocumentManager&);
|
||||
|
||||
public:
|
||||
|
||||
DocumentManager();
|
||||
|
||||
~DocumentManager();
|
||||
|
||||
Document *addDocument();
|
||||
///< The ownership of the returned document is not transferred to the caller.
|
||||
|
||||
bool removeDocument (Document *document);
|
||||
///< \return last document removed?
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue