From 8574d2330c36904bc1ff92cc695cb020fd9e47c5 Mon Sep 17 00:00:00 2001 From: Stanislav Date: Mon, 15 Sep 2014 23:15:32 +0600 Subject: [PATCH 1/5] Feature #1226: Request UniversalId editing from table column --- apps/opencs/view/world/table.cpp | 45 ++++++++++++++++++++++++++++++++ apps/opencs/view/world/table.hpp | 5 ++++ 2 files changed, 50 insertions(+) diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index 57f47033d..5f26c912c 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -54,6 +54,42 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event) /// \todo add menu items for select all and clear selection + { + // Feature #1226 "Request UniversalId editing from table columns". + + if ( mGotoRefUid ) + { + delete mGotoRefUid; + + mGotoRefUid = 0; + } + + int currRow = rowAt( event->y() ), + currCol = columnAt( event->x() ); + + currRow = mProxyModel->mapToSource(mProxyModel->index( currRow, 0 )).row(); + + CSMWorld::ColumnBase::Display colType = + static_cast( + mModel->headerData( + currCol, + Qt::Horizontal, + CSMWorld::ColumnBase::Role_Display ).toInt()); + + QString cellData = mModel->data(mModel->index( currRow, currCol )).toString(); + CSMWorld::UniversalId::Type colUidType = CSMWorld::TableMimeData::convertEnums( colType ); + + if ( !cellData.isEmpty() + && colUidType != CSMWorld::UniversalId::Type::Type_None ) + { + menu.addAction( mGotoRefAction ); + menu.addSeparator(); + + mGotoRefUid = + new CSMWorld::UniversalId( colUidType, cellData.toUtf8().constData() ); + } + } + if (!mEditLock && !(mModel->getFeatures() & CSMWorld::IdTableBase::Feature_Constant)) { if (selectedRows.size()==1) @@ -218,6 +254,10 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, mMoveDownAction = new QAction (tr ("Move Down"), this); connect (mMoveDownAction, SIGNAL (triggered()), this, SLOT (moveDownRecord())); addAction (mMoveDownAction); + + mGotoRefAction = new QAction( tr("Go to Reference"), this ); + connect( mGotoRefAction, SIGNAL(triggered()), this, SLOT(gotoReference()) ); + addAction( mGotoRefAction ); mViewAction = new QAction (tr ("View"), this); connect (mViewAction, SIGNAL (triggered()), this, SLOT (viewRecord())); @@ -364,6 +404,11 @@ void CSVWorld::Table::moveDownRecord() } } +void CSVWorld::Table::gotoReference() +{ + emit editRequest( *mGotoRefUid, std::string() ); +} + void CSVWorld::Table::viewRecord() { QModelIndexList selectedRows = selectionModel()->selectedRows(); diff --git a/apps/opencs/view/world/table.hpp b/apps/opencs/view/world/table.hpp index 883834b60..6e3e8971e 100644 --- a/apps/opencs/view/world/table.hpp +++ b/apps/opencs/view/world/table.hpp @@ -45,6 +45,7 @@ namespace CSVWorld QAction *mMoveUpAction; QAction *mMoveDownAction; QAction *mViewAction; + QAction *mGotoRefAction; QAction *mPreviewAction; QAction *mExtendedDeleteAction; QAction *mExtendedRevertAction; @@ -53,6 +54,8 @@ namespace CSVWorld int mRecordStatusDisplay; CSMWorld::CommandDispatcher *mDispatcher; + CSMWorld::UniversalId *mGotoRefUid = 0; + private: void contextMenuEvent (QContextMenuEvent *event); @@ -93,6 +96,8 @@ namespace CSVWorld private slots: + void gotoReference(); + void editRecord(); void cloneRecord(); From ebb223b2d33d9dd5e0161aae3a2d8d1df6c405f6 Mon Sep 17 00:00:00 2001 From: Stanislav Date: Wed, 17 Sep 2014 09:03:02 +0600 Subject: [PATCH 2/5] Feature #1226: fixes --- apps/opencs/view/world/table.cpp | 27 ++++++++++----------------- apps/opencs/view/world/table.hpp | 8 ++++---- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index 5f26c912c..05b64af01 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -55,15 +55,8 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event) /// \todo add menu items for select all and clear selection { - // Feature #1226 "Request UniversalId editing from table columns". + // Request UniversalId editing from table columns. - if ( mGotoRefUid ) - { - delete mGotoRefUid; - - mGotoRefUid = 0; - } - int currRow = rowAt( event->y() ), currCol = columnAt( event->x() ); @@ -82,11 +75,11 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event) if ( !cellData.isEmpty() && colUidType != CSMWorld::UniversalId::Type::Type_None ) { - menu.addAction( mGotoRefAction ); - menu.addSeparator(); + mEditCellAction->setText(tr("Edit '").append(cellData).append("'")); + + menu.addAction( mEditCellAction ); - mGotoRefUid = - new CSMWorld::UniversalId( colUidType, cellData.toUtf8().constData() ); + mEditCellId = CSMWorld::UniversalId( colUidType, cellData.toUtf8().constData() ); } } @@ -255,9 +248,9 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, connect (mMoveDownAction, SIGNAL (triggered()), this, SLOT (moveDownRecord())); addAction (mMoveDownAction); - mGotoRefAction = new QAction( tr("Go to Reference"), this ); - connect( mGotoRefAction, SIGNAL(triggered()), this, SLOT(gotoReference()) ); - addAction( mGotoRefAction ); + mEditCellAction = new QAction( tr("Edit Cell"), this ); + connect( mEditCellAction, SIGNAL(triggered()), this, SLOT(editCell()) ); + addAction( mEditCellAction ); mViewAction = new QAction (tr ("View"), this); connect (mViewAction, SIGNAL (triggered()), this, SLOT (viewRecord())); @@ -404,9 +397,9 @@ void CSVWorld::Table::moveDownRecord() } } -void CSVWorld::Table::gotoReference() +void CSVWorld::Table::editCell() { - emit editRequest( *mGotoRefUid, std::string() ); + emit editRequest( mEditCellId, std::string() ); } void CSVWorld::Table::viewRecord() diff --git a/apps/opencs/view/world/table.hpp b/apps/opencs/view/world/table.hpp index 6e3e8971e..a80a0b362 100644 --- a/apps/opencs/view/world/table.hpp +++ b/apps/opencs/view/world/table.hpp @@ -8,6 +8,7 @@ #include "../../model/filter/node.hpp" #include "../../model/world/columnbase.hpp" +#include "../../model/world/universalid.hpp" #include "dragrecordtable.hpp" class QUndoStack; @@ -21,7 +22,6 @@ namespace CSMDoc namespace CSMWorld { class Data; - class UniversalId; class IdTableProxyModel; class IdTableBase; class CommandDispatcher; @@ -45,7 +45,7 @@ namespace CSVWorld QAction *mMoveUpAction; QAction *mMoveDownAction; QAction *mViewAction; - QAction *mGotoRefAction; + QAction *mEditCellAction; QAction *mPreviewAction; QAction *mExtendedDeleteAction; QAction *mExtendedRevertAction; @@ -54,7 +54,7 @@ namespace CSVWorld int mRecordStatusDisplay; CSMWorld::CommandDispatcher *mDispatcher; - CSMWorld::UniversalId *mGotoRefUid = 0; + CSMWorld::UniversalId mEditCellId; private: @@ -96,7 +96,7 @@ namespace CSVWorld private slots: - void gotoReference(); + void editCell(); void editRecord(); From 76f2e5d5b803537e2ac640ac41105c0c64c2c108 Mon Sep 17 00:00:00 2001 From: Stanislav Date: Wed, 17 Sep 2014 09:05:47 +0600 Subject: [PATCH 3/5] CMake: Added multithreading, /DWIN32_LEAN_AND_MEAN and /bigobj compile flags to VS build. --- CMakeLists.txt | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2252ec9da..f801a4439 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -592,6 +592,16 @@ endif() if (WIN32) if (MSVC) + if (MULTITHREADED_BUILD) + set( MT_BUILD "/MP") + endif (MULTITHREADED_BUILD) + + foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} ) + string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG ) + set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "$(SolutionDir)$(Configuration)\" ) + set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "$(ProjectDir)$(Configuration)\" ) + endforeach( OUTPUTCONFIG ) + if (USE_DEBUG_CONSOLE) set_target_properties(openmw PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE") set_target_properties(openmw PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE") @@ -655,31 +665,42 @@ if (WIN32) # boost::wave has a few issues with signed / unsigned conversions, so we suppress those here set(SHINY_WARNINGS "${WARNINGS} /wd4245") - set_target_properties(shiny PROPERTIES COMPILE_FLAGS ${SHINY_WARNINGS}) + set_target_properties(shiny PROPERTIES COMPILE_FLAGS "${SHINY_WARNINGS} ${MT_BUILD}") # there's an unreferenced local variable in the ogre platform, suppress it set(SHINY_OGRE_WARNINGS "${WARNINGS} /wd4101") - set_target_properties(shiny.OgrePlatform PROPERTIES COMPILE_FLAGS ${SHINY_OGRE_WARNINGS}) - set_target_properties(sdl4ogre PROPERTIES COMPILE_FLAGS ${WARNINGS}) + set_target_properties(shiny.OgrePlatform PROPERTIES COMPILE_FLAGS "${SHINY_OGRE_WARNINGS} ${MT_BUILD}") + set_target_properties(sdl4ogre PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") # oics uses tinyxml, which has an initialized but unused variable set(OICS_WARNINGS "${WARNINGS} /wd4189") - set_target_properties(oics PROPERTIES COMPILE_FLAGS ${OICS_WARNINGS}) - set_target_properties(components PROPERTIES COMPILE_FLAGS ${WARNINGS}) + set_target_properties(oics PROPERTIES COMPILE_FLAGS "${OICS_WARNINGS} ${MT_BUILD}") + set_target_properties(components PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") if (BUILD_LAUNCHER) - set_target_properties(omwlauncher PROPERTIES COMPILE_FLAGS ${WARNINGS}) + set_target_properties(omwlauncher PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") endif (BUILD_LAUNCHER) - set_target_properties(openmw PROPERTIES COMPILE_FLAGS ${WARNINGS}) + set_target_properties(openmw PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") if (BUILD_BSATOOL) - set_target_properties(bsatool PROPERTIES COMPILE_FLAGS ${WARNINGS}) + set_target_properties(bsatool PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") endif (BUILD_BSATOOL) if (BUILD_ESMTOOL) - set_target_properties(esmtool PROPERTIES COMPILE_FLAGS ${WARNINGS}) + set_target_properties(esmtool PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") endif (BUILD_ESMTOOL) if (BUILD_OPENCS) - set_target_properties(opencs PROPERTIES COMPILE_FLAGS ${WARNINGS}) + set_target_properties(opencs PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") endif (BUILD_OPENCS) if (BUILD_MWINIIMPORTER) - set_target_properties(mwiniimport PROPERTIES COMPILE_FLAGS ${WARNINGS}) + set_target_properties(mwiniimport PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") endif (BUILD_MWINIIMPORTER) + + set( OMW_CFLAGS "/DWIN32_LEAN_AND_MEAN ${MT_BUILD}" ) + + string( TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE ) + + # Debug builds need /bigobj + if ( CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO" ) + set( OMW_CFLAGS "${OMW_CFLAGS} /bigobj" ) + endif ( CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO" ) + + set_property( TARGET openmw APPEND_STRING PROPERTY COMPILE_FLAGS " ${OMW_CFLAGS}" ) endif(MSVC) # Same for MinGW From 313bdf4e780b58241031dc790ae80d08385f9ed3 Mon Sep 17 00:00:00 2001 From: Stanislav Date: Thu, 18 Sep 2014 10:25:33 +0600 Subject: [PATCH 4/5] fix --- CMakeLists.txt | 11 ----------- apps/opencs/view/world/table.cpp | 8 ++++---- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f801a4439..b25539e90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -690,17 +690,6 @@ if (WIN32) if (BUILD_MWINIIMPORTER) set_target_properties(mwiniimport PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") endif (BUILD_MWINIIMPORTER) - - set( OMW_CFLAGS "/DWIN32_LEAN_AND_MEAN ${MT_BUILD}" ) - - string( TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE ) - - # Debug builds need /bigobj - if ( CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO" ) - set( OMW_CFLAGS "${OMW_CFLAGS} /bigobj" ) - endif ( CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "RELWITHDEBINFO" ) - - set_property( TARGET openmw APPEND_STRING PROPERTY COMPILE_FLAGS " ${OMW_CFLAGS}" ) endif(MSVC) # Same for MinGW diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index 05b64af01..df0b42c88 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -62,7 +62,7 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event) currRow = mProxyModel->mapToSource(mProxyModel->index( currRow, 0 )).row(); - CSMWorld::ColumnBase::Display colType = + CSMWorld::ColumnBase::Display colDisplay = static_cast( mModel->headerData( currCol, @@ -70,16 +70,16 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event) CSMWorld::ColumnBase::Role_Display ).toInt()); QString cellData = mModel->data(mModel->index( currRow, currCol )).toString(); - CSMWorld::UniversalId::Type colUidType = CSMWorld::TableMimeData::convertEnums( colType ); + CSMWorld::UniversalId::Type colType = CSMWorld::TableMimeData::convertEnums( colDisplay ); if ( !cellData.isEmpty() - && colUidType != CSMWorld::UniversalId::Type::Type_None ) + && colType != CSMWorld::UniversalId::Type::Type_None ) { mEditCellAction->setText(tr("Edit '").append(cellData).append("'")); menu.addAction( mEditCellAction ); - mEditCellId = CSMWorld::UniversalId( colUidType, cellData.toUtf8().constData() ); + mEditCellId = CSMWorld::UniversalId( colType, cellData.toUtf8().constData() ); } } From 51151bc43e1f416369d4bbf5a9c4d8637623038a Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 22 Sep 2014 09:53:07 +0200 Subject: [PATCH 5/5] minor fix --- apps/opencs/view/world/table.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index df0b42c88..d6e0f407a 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -56,7 +56,7 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event) { // Request UniversalId editing from table columns. - + int currRow = rowAt( event->y() ), currCol = columnAt( event->x() ); @@ -73,7 +73,7 @@ void CSVWorld::Table::contextMenuEvent (QContextMenuEvent *event) CSMWorld::UniversalId::Type colType = CSMWorld::TableMimeData::convertEnums( colDisplay ); if ( !cellData.isEmpty() - && colType != CSMWorld::UniversalId::Type::Type_None ) + && colType != CSMWorld::UniversalId::Type_None ) { mEditCellAction->setText(tr("Edit '").append(cellData).append("'")); @@ -247,7 +247,7 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, mMoveDownAction = new QAction (tr ("Move Down"), this); connect (mMoveDownAction, SIGNAL (triggered()), this, SLOT (moveDownRecord())); addAction (mMoveDownAction); - + mEditCellAction = new QAction( tr("Edit Cell"), this ); connect( mEditCellAction, SIGNAL(triggered()), this, SLOT(editCell()) ); addAction( mEditCellAction );