Merge remote-tracking branch 'upstream/master' into osgshadow-test

experimental^2
AnyOldName3 7 years ago
commit e2623d21ab

@ -0,0 +1,11 @@
root = true
[*.cpp]
indent_style = space
indent_size = 4
insert_final_newline = true
[*.hpp]
indent_style = space
indent_size = 4
insert_final_newline = true

1
.gitignore vendored

@ -26,6 +26,7 @@ Doxygen
.settings
.directory
.idea
files/windows/*.aps
## qt-creator
CMakeLists.txt.user*

@ -1,7 +1,7 @@
os:
- linux
- osx
osx_image: xcode8.2
osx_image: xcode8.3
language: cpp
sudo: required
dist: trusty
@ -15,11 +15,7 @@ env:
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
# via the "travis encrypt" command using the project repo's public key
- secure: "jybGzAdUbqt9vWR/GEnRd96BgAi/7Zd1+2HK68j/i/8+/1YH2XxLOy4Jv/DUBhBlJIkxs/Xv8dRcUlFOclZDHX1d/9Qnsqd3oUVkD7k1y7cTOWy9TBQaE/v/kZo3LpzA3xPwwthrb0BvqIbOfIELi5fS5s8ba85WFRg3AX70wWE="
# macOS builds FTP upload login
- secure: "MegynKyJpyL7XDwdWVEbypQh7CLjqOqOi9lGF97G7Fq0HosVZTmnwjHhmIPZspTP7ES4UbxM3rs/f3ce7sp9JN2ShRJpduD6UEFc8egQXBte9J3obUBIdUxPTRdhnht7VJ+u+pksK1S/Bm1Cs6l0eEluP3vmcaXWMykVQcZsPhY="
# macOS builds FTP upload password
- secure: "jQcAaWAdDy0+vlNu4POMX8322HanCOQEUTdpviWTAUjWQTjMa0UTM4+zVVgrtEaHMpBaVYYbTT3Rg5BQ9oG+2SiVLJBQQ2XoMcos/YrjPVT6inB02Gs0vFjP29LdPAQVrB8CkAcfQr6u+Z2C+RqAtwhE09LsBUMXjRDzPAtr1CM="
- macos_qt_formula=qt@5.5
- macos_qt_formula=qt
addons:
apt:
sources:
@ -32,7 +28,7 @@ addons:
# Tests
libgtest-dev, google-mock,
# Boost
libboost-filesystem-dev, libboost-program-options-dev, libboost-system-dev, libboost-thread-dev,
libboost-filesystem-dev, libboost-program-options-dev, libboost-system-dev,
# FFmpeg
libavcodec-dev, libavformat-dev, libavutil-dev, libswscale-dev,
# Audio & Video

@ -50,6 +50,7 @@ Programmers
Edmondo Tommasina (edmondo)
Eduard Cot (trombonecot)
Eli2
elsid
Emanuel Guével (potatoesmaster)
eroen
escondida
@ -61,8 +62,8 @@ Programmers
Hallfaer Tuilinn
hristoast
Internecine
Jacob Essex (Yacoby)
Jannik Heller (scrawl)
Jacob Essex (Yacoby)
Jake Westrip (16bitint)
Jason Hooks (jhooks)
jeaye
Jeffrey Haines (Jyby)
@ -74,6 +75,7 @@ Programmers
Jordan Ayers
Jordan Milne
Jules Blok (Armada651)
julianko
Julien Voisin (jvoisin/ap0)
Karl-Felix Glatzer (k1ll)
Kevin Poitra (PuppyKevin)
@ -108,6 +110,7 @@ Programmers
Narmo
Nathan Jeffords (blunted2night)
NeveHanter
Nialsy
Nikolay Kasyanov (corristo)
nobrakal
Nolan Poe (nopoe)
@ -117,6 +120,7 @@ Programmers
Pi03k
Pieter van der Kloet (pvdk)
pkubik
PlutonicOverkill
Radu-Marius Popovici (rpopovici)
Rafael Moura (dhustkoder)
rdimesio
@ -128,11 +132,14 @@ Programmers
Roman Proskuryakov (kpp)
Sandy Carter (bwrsandman)
Scott Howard
scrawl
Sebastian Wick (swick)
Sergey Shambir
ShadowRadiance
Siimacore
sir_herrbatka
smbas
spycrab
Stefan Galowicz (bogglez)
Stanislav Bobrov (Jiub)
stil-t
@ -141,6 +148,7 @@ Programmers
t6
terrorfisch
Thomas Luppi (Digmaster)
Will Herrmann (Thunderforge)
Tom Mason (wheybags)
Torben Leif Carrington (TorbenC)
viadanna

@ -1,3 +1,82 @@
0.42.0
------
Bug #1956: Duplicate objects after loading the game, when a mod was edited
Bug #2100: Falling leaves in Vurt's Leafy West Gash II not rendered correctly
Bug #2116: Cant fit through some doorways pressed against staircases
Bug #2289: Some modal dialogs are not centered on the screen when the window resizes
Bug #2409: Softlock when pressing weapon/magic switch keys during chargen, afterwards switches weapons even though a text field is selected
Bug #2483: Previous/Next Weapon hotkeys triggered while typing the name of game save
Bug #2629: centeroncell, coc causes death / fall damage time to time when teleporting from high
Bug #2645: Cycling weapons is possible while console/pause menu is open
Bug #2678: Combat with water creatures do not end upon exiting water
Bug #2759: Light Problems in Therana's Chamber in Tel Branora
Bug #2771: unhandled sdl event of type 0x302
Bug #2777: (constant/on cast) disintegrate armor/weapon on self is seemingly not working
Bug #2838: Editor: '.' in a record name should be allowed
Bug #2909: NPCs appear floating when standing on a slope
Bug #3093: Controller movement cannot be used while mouse is moving
Bug #3134: Crash possible when using console with open container
Bug #3254: AI enemies hit between them.
Bug #3344: Editor: Verification results sorting by Type is not alphabetical.
Bug #3345: Editor: Cloned and added pathgrids are lost after reopen of saved omwgame file
Bug #3355: [MGSO] Physics maxing out in south cornerclub Balmora
Bug #3484: Editor: camera position is not set when changing cell via drag&drop
Bug #3508: Slowfall kills Jump momentum
Bug #3580: Crash: Error ElementBufferObject::remove BufferData<0> out of range
Bug #3581: NPCs wander too much
Bug #3601: Menu Titles not centered vertically
Bug #3607: [Mac OS] Beginning of NPC speech cut off (same issue as closed bug #3453)
Bug #3613: Can not map "next weapon" or "next spell" to controller
Bug #3617: Enchanted arrows don't explode when hitting the ground
Bug #3645: Unable to use steps in Vivec, Palace of Vivec
Bug #3650: Tamriel Rebuilt 16.09.1 Hist Cuirass GND nif is rendered inside a Pink Box
Bug #3652: Item icon shadows get stuck in the alchemy GUI
Bug #3653: Incorrect swish sounds
Bug #3666: NPC collision should not be disabled until death animation has finished
Bug #3669: Editor: Text field was missing from book object editing dialogue
Bug #3670: Unhandled SDL event of type 0x304
Bug #3671: Incorrect local variable value after picking up bittercup
Bug #3686: Travelling followers doesn't increase travel fee
Bug #3689: Problematic greetings from Antares Big Mod that override the appropriate ones.
Bug #3690: Certain summoned creatures do not engage in combat with underwater creatures
Bug #3691: Enemies do not initiate combat with player followers on sight
Bug #3695: [Regression] Dispel does not always dispel spell effects in 0.41
Bug #3699: Crash on MWWorld::ProjectileManager::moveMagicBolts
Bug #3700: Climbing on rocks and mountains
Bug #3704: Creatures don't auto-equip their shields on creation
Bug #3705: AI combat engagement logic differs from vanilla
Bug #3707: Animation playing does some very odd things if pc comes in contact with the animated mesh
Bug #3712: [Mod] Freeze upon entering Adanumuran with mod Adanumuran Reclaimed
Bug #3713: [Regression] Cancelling dialogue or using travel with creatures throws a (possibly game-breaking) exception
Bug #3719: Dropped identification papers can't be picked up again
Bug #3722: Command spell doesn't bring enemies out of combat
Bug #3727: Using "Activate" mid-script-execution invalidates interpreter context
Bug #3746: Editor: Book records show attribute IDs instead of skill IDs for teached skills entry.
Bug #3755: Followers stop following after loading from savegame
Bug #3772: ModStat lowers attribute to 100 if it was greater
Bug #3781: Guns in Clean Hunter Rifles mod use crossbow sounds
Bug #3797: NPC and creature names don't show up in combat when RMB windows are displayed
Bug #3800: Wrong tooltip maximum width
Bug #3801: Drowning widget is bugged
Bug #3802: BarterOffer shouldn't limit pcMercantile
Bug #3813: Some fatal error
Bug #3816: Expression parser thinks the -> token is unexpected when a given explicit refID clashes with a journal ID
Bug #3822: Custom added creatures are not animated
Feature #451: Water sounds
Feature #2691: Light particles sometimes not shown in inventory character preview
Feature #3523: Light source on magic projectiles
Feature #3644: Nif NiSphericalCollider Unknown Record Type
Feature #3675: ess-Importer: convert mark location
Feature #3693: ess-Importer: convert last known exterior cell
Feature #3748: Editor: Replace "Scroll" check box in Book records with "Book Type" combo box.
Feature #3751: Editor: Replace "Xyz Blood" check boxes in NPC and Creature records with "Blood Type" combo box
Feature #3752: Editor: Replace emitter check boxes in Light records with "Emitter Type" combo box
Feature #3756: Editor: Replace "Female" check box in NPC records with "Gender" combo box
Feature #3757: Editor: Replace "Female" check box in BodyPart records with "Gender" combo box
Task #3092: const version of ContainerStoreIterator
Task #3795: /deps folder not in .gitignore
0.41.0
------

@ -2,10 +2,9 @@
brew update
brew rm cmake || true
brew rm pkgconfig || true
brew rm qt5 || true
brew install cmake pkgconfig $macos_qt_formula
brew outdated cmake || brew upgrade cmake
brew outdated pkgconfig || brew upgrade pkgconfig
brew install $macos_qt_formula
curl https://downloads.openmw.org/osx/dependencies/openmw-deps-c79172d.zip -o ~/openmw-deps.zip
curl https://downloads.openmw.org/osx/dependencies/openmw-deps-5e144e2.zip -o ~/openmw-deps.zip
unzip ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null

@ -75,7 +75,7 @@ Options:
Set the build platform, can also be set with environment variable PLATFORM.
-u
Configure for unity builds.
-v <2013/2015>
-v <2013/2015/2017>
Choose the Visual Studio version to use.
-V
Run verbosely
@ -213,20 +213,28 @@ if [ -z $VS_VERSION ]; then
fi
case $VS_VERSION in
15|15.0|2017 )
GENERATOR="Visual Studio 15 2017"
TOOLSET="vc140"
MSVC_VER="14"
MSVC_YEAR="2015"
MSVC_DISPLAY_YEAR="2017"
;;
14|14.0|2015 )
GENERATOR="Visual Studio 14 2015"
XP_TOOLSET="v140_xp"
TOOLSET="v140"
TOOLSET="vc140"
MSVC_VER="14"
MSVC_YEAR="2015"
MSVC_DISPLAY_YEAR="2015"
;;
12|12.0|2013 )
GENERATOR="Visual Studio 12 2013"
XP_TOOLSET="v120_xp"
TOOLSET="v120"
TOOLSET="vc120"
MSVC_VER="12"
MSVC_YEAR="2013"
MSVC_DISPLAY_YEAR="2013"
;;
esac
@ -278,7 +286,7 @@ fi
echo
echo "==================================="
echo "Starting prebuild on MSVC${MSVC_YEAR} WIN${BITS}"
echo "Starting prebuild on MSVC${MSVC_DISPLAY_YEAR} WIN${BITS}"
echo "==================================="
echo
@ -305,11 +313,11 @@ if [ -z $SKIP_DOWNLOAD ]; then
"Bullet-2.86-msvc${MSVC_YEAR}-win${BITS}.7z"
# FFmpeg
download "FFmpeg 3.0.1" \
"http://ffmpeg.zeranoe.com/builds/win${BITS}/shared/ffmpeg-3.0.1-win${BITS}-shared.7z" \
"ffmpeg-3.0.1-win${BITS}.7z" \
"http://ffmpeg.zeranoe.com/builds/win${BITS}/dev/ffmpeg-3.0.1-win${BITS}-dev.7z" \
"ffmpeg-3.0.1-dev-win${BITS}.7z"
download "FFmpeg 3.2.4" \
"http://ffmpeg.zeranoe.com/builds/win${BITS}/shared/ffmpeg-3.2.4-win${BITS}-shared.zip" \
"ffmpeg-3.2.4-win${BITS}.zip" \
"http://ffmpeg.zeranoe.com/builds/win${BITS}/dev/ffmpeg-3.2.4-win${BITS}-dev.zip" \
"ffmpeg-3.2.4-dev-win${BITS}.zip"
# MyGUI
download "MyGUI 3.2.3-git" \
@ -350,7 +358,7 @@ fi
cd .. #/..
# Set up dependencies
BUILD_DIR="MSVC${MSVC_YEAR}_${BITS}"
BUILD_DIR="MSVC${MSVC_DISPLAY_YEAR}_${BITS}"
if [ -z $KEEP ]; then
echo
echo "(Re)Creating build directory."
@ -395,6 +403,7 @@ fi
add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \
-DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0"
add_cmake_opts -DBoost_COMPILER="-${TOOLSET}"
echo Done.
else
@ -406,6 +415,7 @@ fi
fi
add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \
-DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0"
add_cmake_opts -DBoost_COMPILER="-${TOOLSET}"
echo Done.
fi
@ -434,21 +444,21 @@ cd $DEPS
echo
# FFmpeg
printf "FFmpeg 3.0.1... "
printf "FFmpeg 3.2.4... "
{
cd $DEPS_INSTALL
if [ -d FFmpeg ] && grep "FFmpeg version: 3.0.1" FFmpeg/README.txt > /dev/null; then
if [ -d FFmpeg ] && grep "FFmpeg version: 3.2.4" FFmpeg/README.txt > /dev/null; then
printf "Exists. "
elif [ -z $SKIP_EXTRACT ]; then
rm -rf FFmpeg
eval 7z x -y "${DEPS}/ffmpeg-3.0.1-win${BITS}.7z" $STRIP
eval 7z x -y "${DEPS}/ffmpeg-3.0.1-dev-win${BITS}.7z" $STRIP
eval 7z x -y "${DEPS}/ffmpeg-3.2.4-win${BITS}.zip" $STRIP
eval 7z x -y "${DEPS}/ffmpeg-3.2.4-dev-win${BITS}.zip" $STRIP
mv "ffmpeg-3.0.1-win${BITS}-shared" FFmpeg
cp -r "ffmpeg-3.0.1-win${BITS}-dev/"* FFmpeg/
rm -rf "ffmpeg-3.0.1-win${BITS}-dev"
mv "ffmpeg-3.2.4-win${BITS}-shared" FFmpeg
cp -r "ffmpeg-3.2.4-win${BITS}-dev/"* FFmpeg/
rm -rf "ffmpeg-3.2.4-win${BITS}-dev"
fi
export FFMPEG_HOME="$(real_pwd)/FFmpeg"
@ -755,4 +765,4 @@ if [ -z $CI ]; then
echo
fi
exit $RET
exit $RET

@ -5,13 +5,12 @@ export CC=clang
DEPENDENCIES_ROOT="/private/tmp/openmw-deps/openmw-deps"
QT_PATH=`brew --prefix $macos_qt_formula`
mkdir build
cd build
cmake \
-D CMAKE_PREFIX_PATH="$DEPENDENCIES_ROOT;$QT_PATH" \
-D CMAKE_OSX_DEPLOYMENT_TARGET="10.8" \
-D CMAKE_OSX_DEPLOYMENT_TARGET="10.9" \
-D CMAKE_OSX_SYSROOT="macosx10.12" \
-D CMAKE_BUILD_TYPE=Release \
-D OPENMW_OSX_DEPLOYMENT=TRUE \

@ -77,9 +77,9 @@ if [ $? -ne 0 ]; then
fi
if [ -z $APPVEYOR ]; then
msbuild OpenMW.sln //t:Build //m:8
msbuild OpenMW.sln //t:Build //p:Configuration=${CONFIGURATION} //m:8
else
msbuild OpenMW.sln //t:Build //m:8 //logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
msbuild OpenMW.sln //t:Build //p:Configuration=${CONFIGURATION} //m:8 //logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
fi
RET=$?

@ -6,4 +6,4 @@ DATE=`date +'%d%m%Y'`
SHORT_COMMIT=`git rev-parse --short ${TRAVIS_COMMIT}`
TARGET_FILENAME="OpenMW-${DATE}-${SHORT_COMMIT}.dmg"
curl --ssl --ftp-create-dirs -T *.dmg -u $OSX_FTP_USER:$OSX_FTP_PASSWORD "ftp://s3.mydevil.net:21/nightly/${TARGET_FILENAME}"
curl --ssl --ftp-create-dirs -T *.dmg -u $OSX_FTP_USER:$OSX_FTP_PASSWORD "${OSX_FTP_URL}${TARGET_FILENAME}"

@ -25,7 +25,7 @@ endif()
message(STATUS "Configuring OpenMW...")
set(OPENMW_VERSION_MAJOR 0)
set(OPENMW_VERSION_MINOR 41)
set(OPENMW_VERSION_MINOR 42)
set(OPENMW_VERSION_RELEASE 0)
set(OPENMW_VERSION_COMMITHASH "")
@ -343,7 +343,13 @@ endif()
# CXX Compiler settings
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++98 -pedantic -Wno-long-long")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++11 -pedantic -Wno-long-long")
add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS=ON )
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT APPLE)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.6 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 3.6)
@ -407,7 +413,7 @@ IF(NOT WIN32 AND NOT APPLE)
# Install icon and desktop file
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.desktop" DESTINATION "${DATAROOTDIR}/applications" COMPONENT "openmw")
INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/launcher/images/openmw.png" DESTINATION "${ICONDIR}" COMPONENT "openmw")
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.appdata.xml" DESTINATION "${DATAROOTDIR}/appdata" COMPONENT "openmw")
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw.appdata.xml" DESTINATION "${DATAROOTDIR}/metainfo" COMPONENT "openmw")
IF(BUILD_OPENCS)
INSTALL(FILES "${OpenMW_BINARY_DIR}/openmw-cs.desktop" DESTINATION "${DATAROOTDIR}/applications" COMPONENT "opencs")
INSTALL(FILES "${OpenMW_SOURCE_DIR}/files/opencs/openmw-cs.png" DESTINATION "${ICONDIR}" COMPONENT "opencs")
@ -620,6 +626,7 @@ if (WIN32)
4510 4512 # Unable to generate copy constructor/assignment operator as it's not public in the base
4706 # Assignment in conditional expression
4738 # Storing 32-bit float result in memory, possible loss of performance
4774 # Format string expected in argument is not a string literal
4986 # Undocumented warning that occurs in the crtdbg.h file
4987 # nonstandard extension used (triggered by setjmp.h)
4996 # Function was declared deprecated
@ -711,17 +718,19 @@ if (WIN32)
endif()
# Apple bundling
if (APPLE)
if (OPENMW_OSX_DEPLOYMENT AND APPLE AND DESIRED_QT_VERSION MATCHES 5)
get_property(QT_COCOA_PLUGIN_PATH TARGET Qt5::QCocoaIntegrationPlugin PROPERTY LOCATION_RELEASE)
get_filename_component(QT_COCOA_PLUGIN_DIR "${QT_COCOA_PLUGIN_PATH}" DIRECTORY)
get_filename_component(QT_COCOA_PLUGIN_GROUP "${QT_COCOA_PLUGIN_DIR}" NAME)
get_filename_component(QT_COCOA_PLUGIN_NAME "${QT_COCOA_PLUGIN_PATH}" NAME)
configure_file("${QT_COCOA_PLUGIN_PATH}" "${APP_BUNDLE_DIR}/Contents/MacOS/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}" COPYONLY)
configure_file("${QT_COCOA_PLUGIN_PATH}" "${APP_BUNDLE_DIR}/Contents/PlugIns/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}" COPYONLY)
configure_file("${OpenMW_SOURCE_DIR}/files/mac/qt.conf" "${APP_BUNDLE_DIR}/Contents/Resources/qt.conf" COPYONLY)
if (BUILD_OPENCS)
get_property(OPENCS_BUNDLE_NAME_TMP TARGET openmw-cs PROPERTY OUTPUT_NAME)
set(OPENCS_BUNDLE_NAME "${OPENCS_BUNDLE_NAME_TMP}.app")
configure_file("${QT_COCOA_PLUGIN_PATH}" "${OPENCS_BUNDLE_NAME}/Contents/MacOS/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}" COPYONLY)
configure_file("${QT_COCOA_PLUGIN_PATH}" "${OPENCS_BUNDLE_NAME}/Contents/PlugIns/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}" COPYONLY)
configure_file("${OpenMW_SOURCE_DIR}/files/mac/qt.conf" "${OPENCS_BUNDLE_NAME}/Contents/Resources/qt.conf" COPYONLY)
endif ()
install(DIRECTORY "${APP_BUNDLE_DIR}" USE_SOURCE_PERMISSIONS DESTINATION "." COMPONENT Runtime)
@ -780,8 +789,8 @@ if (APPLE)
install_plugins_for_bundle("${APP_BUNDLE_NAME}" PLUGINS)
install_plugins_for_bundle("${OPENCS_BUNDLE_NAME}" OPENCS_PLUGINS)
set(PLUGINS ${PLUGINS} "${INSTALLED_OPENMW_APP}/Contents/MacOS/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}")
set(OPENCS_PLUGINS ${OPENCS_PLUGINS} "${INSTALLED_OPENCS_APP}/Contents/MacOS/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}")
set(PLUGINS ${PLUGINS} "${INSTALLED_OPENMW_APP}/Contents/PlugIns/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}")
set(OPENCS_PLUGINS ${OPENCS_PLUGINS} "${INSTALLED_OPENCS_APP}/Contents/PlugIns/${QT_COCOA_PLUGIN_GROUP}/${QT_COCOA_PLUGIN_NAME}")
install(CODE "
function(gp_item_default_embedded_path_override item default_embedded_path_var)
@ -791,12 +800,11 @@ if (APPLE)
endif()
endfunction()
cmake_policy(SET CMP0009 OLD)
fixup_bundle(\"${INSTALLED_OPENMW_APP}\" \"${PLUGINS}\" \"\")
fixup_bundle(\"${INSTALLED_OPENCS_APP}\" \"${OPENCS_PLUGINS}\" \"\")
" COMPONENT Runtime)
include(CPack)
endif (APPLE)
endif ()
# Doxygen Target -- simply run 'make doc' or 'make doc_pages'
# output directory for 'make doc' is "${OpenMW_BINARY_DIR}/docs/Doxygen"

@ -1,16 +1,70 @@
Description
===========
How to contribute to OpenMW
=======================
Your pull request description should include (if applicable):
Not sure what to do with all your free time? Pick out a task from here:
http://bugs.openmw.org/
Currently, we are focused on completing the MW game experience and general polishing. Features out of this scope may be approved in some cases, but you should probably start a discussion first.
Note:
- Tasks set to 'openmw-future' are usually out of the current scope of the project and can't be started yet.
- Bugs that are not 'Confirmed' should be confirmed first.
- Larger Features should have a discussion before you start implementing.
- In many cases, it's best to have a discussion about possible solutions before you jump into coding.
Aside from coding, you can also help by triaging the issues list. Check for bugs that are 'Unconfirmed' and try to confirm them on your end, working out any details that may be necessary. Check for bugs that do not conform to [Bug reporting guidelines](https://wiki.openmw.org/index.php?title=Bug_Reporting_Guidelines) and improve them to do so!
There are various [Tools](https://wiki.openmw.org/index.php?title=Tools) to facilitate testing/development.
Pull Request Guidelines
=======================
Thought of a change? Great! To facilitate the review process, your pull request description should include the following (if applicable):
* A link back to the bug report or forum discussion that prompted the change
* Summary of the changes made
* Reasoning / motivation behind the change
* What testing you have carried out to verify the change
Other notes
===========
Furthermore, we advise to:
* Separate your work into multiple pull requests whenever possible. As a rule of thumb, each feature and each bugfix should go into a separate PR, unless they are closely related or dependent upon each other. Small pull requests are easier to review, and are less likely to require further changes before we can merge them. A "mega" pull request with lots of unrelated commits in it is likely to get held up in review for a long time.
* Feel free to submit incomplete pull requests. Even if the work can not be merged yet, pull requests are a great place to collect early feedback. Just make sure to mark it as *[Incomplete]* or *[Do not merge yet]* in the title.
* If you plan on contributing often, please read the [Developer Reference](https://wiki.openmw.org/index.php?title=Developer_Reference) on our wiki, especially the [Policies and Standards](https://wiki.openmw.org/index.php?title=Policies_and_Standards).
* Make sure each of your changes has a clear objective. Unnecessary changes may lead to merge conflicts, clutter the commit history and slow down review. Code formatting 'fixes' should be avoided, unless you were already changing that particular line anyway.
Guidelines for original engine "fixes"
=================================
From time to time you may be tempted to "fix" what you think was a "bug" in the original game engine.
Unfortunately, the definition of what is a "bug" is not so clear. Consider that your "bug" is actually a feature unless proven otherwise:
* We have no way of knowing what the original developers really intended (short of asking them, good luck with that).
* What may seem like an illogical mechanic can actually be part of an attempt to balance the game.
* Many people will actually <i>like</i> these "bugs" because that is what they remember the game for.
* Exploits may be part of the fun of an open-world game - they reward knowledge with power. There are too many of them to plug them all, anyway.
OpenMW, in its default configuration, is meant to be a faithful reimplementation of Morrowind, minus things like crash bugs, stability issues and design errors. However, we try to avoid touching anything that affects the core gameplay, the balancing of the game or introduces incompatibilities with existing mod content.
That said, we may sometimes evaluate such issues on an individual basis. Common exceptions to the above would be:
* Issues so glaring that they would severely limit the capabilities of the engine in the future (for example, the scripting engine not being allowed to access objects in remote cells)
* Bugs where the intent is very obvious, and that have little to no balancing impact (e.g. the bug were being tired made it easier to repair items, instead of harder)
* Bugs that were fixed in an official patch for Morrowind
Feature additions policy
=====================
We get it, you have waited so long for feature XYZ to be available in Morrowind and now that OpenMW is here you can not wait to implement your ingenious idea and share it with the world.
Unfortunately, since maintaining features comes at a cost and our resources are limited, we have to be a little selective in what features we allow into the main repository. Generally:
- Features should be as generic and non-redundant as possible.
- Any feature that is also possible with modding should be done as a mod instead.
- In the future, OpenMW plans to expand the scope of what is possible with modding, e.g. by moving certain game logic into editable scripts.
- Currently, modders can edit OpenMW's GUI skins and layout XML files, although there are still a few missing hooks (e.g. scripting support) in order to make this into a powerful way of modding.
- If a feature introduces new game UI strings, that reduces its chance of being accepted because we do not currently have any way of localizing these to the user's Morrowind installation language.
If you are in doubt of your feature being within our scope, it is probably best to start a forum discussion first. See the [settings documentation](https://openmw.readthedocs.io/en/stable/reference/modding/settings/index.html) and [Features list](https://wiki.openmw.org/index.php?title=Features) for some examples of features that were deemed acceptable.

@ -7,7 +7,7 @@ OpenMW is a recreation of the engine for the popular role-playing game Morrowind
OpenMW also comes with OpenMW-CS, a replacement for Morrowind's TES Construction Set.
* Version: 0.41.0
* Version: 0.42.0
* License: GPLv3 (see [docs/license/GPL3.txt](https://github.com/OpenMW/openmw/blob/master/docs/license/GPL3.txt) for more information)
* Website: http://www.openmw.org
* IRC: #openmw on irc.freenode.net
@ -18,7 +18,7 @@ Font Licenses:
Current Status
--------------
The main quests in Morrowind, Tribunal and Bloodmoon are all completable. Some issues with side quests are to be expected (but rare). Check the [bug tracker](https://bugs.openmw.org/versions/21) for a list of issues we need to resolve before the "1.0" release. Even before the "1.0" release however, OpenMW boasts some new [features](https://wiki.openmw.org/index.php?title=Features), such as improved graphics and user interfaces.
The main quests in Morrowind, Tribunal and Bloodmoon are all completable. Some issues with side quests are to be expected (but rare). Check the [bug tracker](https://bugs.openmw.org/) for a list of issues we need to resolve before the "1.0" release. Even before the "1.0" release however, OpenMW boasts some new [features](https://wiki.openmw.org/index.php?title=Features), such as improved graphics and user interfaces.
Pre-existing modifications created for the original Morrowind engine can be hit-and-miss. The OpenMW script compiler performs more thorough error-checking than Morrowind does, meaning that a mod created for Morrowind may not necessarily run in OpenMW. Some mods also rely on quirky behaviour or engine bugs in order to work. We are considering such compatibility issues on a case-by-case basis - in some cases adding a workaround to OpenMW may be feasible, in other cases fixing the mod will be the only option. If you know of any mods that work or don't work, feel free to add them to the [Mod status](https://wiki.openmw.org/index.php?title=Mod_status) wiki page.

@ -1,7 +1,6 @@
#include <iostream>
#include <iomanip>
#include <vector>
#include <exception>
#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>

@ -11,7 +11,6 @@
#include <components/esm/loadrace.hpp>
#include <components/esm/loadspel.hpp>
#include <components/esm/loadweap.hpp>
#include <components/esm/aipackage.hpp>
#include <boost/format.hpp>

@ -2,7 +2,7 @@
#include <iomanip>
#include <boost/shared_ptr.hpp>
#include <boost/filesystem/fstream.hpp>
#include <osgDB/ReadFile>
#include <osg/ImageUtils>
@ -272,37 +272,37 @@ namespace ESSImport
const unsigned int recGAME = ESM::FourCC<'G','A','M','E'>::value;
const unsigned int recJOUR = ESM::FourCC<'J','O','U','R'>::value;
std::map<unsigned int, boost::shared_ptr<Converter> > converters;
converters[ESM::REC_GLOB] = boost::shared_ptr<Converter>(new ConvertGlobal());
converters[ESM::REC_BOOK] = boost::shared_ptr<Converter>(new ConvertBook());
converters[ESM::REC_NPC_] = boost::shared_ptr<Converter>(new ConvertNPC());
converters[ESM::REC_CREA] = boost::shared_ptr<Converter>(new ConvertCREA());
converters[ESM::REC_NPCC] = boost::shared_ptr<Converter>(new ConvertNPCC());
converters[ESM::REC_CREC] = boost::shared_ptr<Converter>(new ConvertCREC());
converters[recREFR ] = boost::shared_ptr<Converter>(new ConvertREFR());
converters[recPCDT ] = boost::shared_ptr<Converter>(new ConvertPCDT());
converters[recFMAP ] = boost::shared_ptr<Converter>(new ConvertFMAP());
converters[recKLST ] = boost::shared_ptr<Converter>(new ConvertKLST());
converters[recSTLN ] = boost::shared_ptr<Converter>(new ConvertSTLN());
converters[recGAME ] = boost::shared_ptr<Converter>(new ConvertGAME());
converters[ESM::REC_CELL] = boost::shared_ptr<Converter>(new ConvertCell());
converters[ESM::REC_ALCH] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Potion>());
converters[ESM::REC_CLAS] = boost::shared_ptr<Converter>(new ConvertClass());
converters[ESM::REC_SPEL] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Spell>());
converters[ESM::REC_ARMO] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Armor>());
converters[ESM::REC_WEAP] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Weapon>());
converters[ESM::REC_CLOT] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Clothing>());
converters[ESM::REC_ENCH] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Enchantment>());
converters[ESM::REC_WEAP] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Weapon>());
converters[ESM::REC_LEVC] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::CreatureLevList>());
converters[ESM::REC_LEVI] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::ItemLevList>());
converters[ESM::REC_CNTC] = boost::shared_ptr<Converter>(new ConvertCNTC());
converters[ESM::REC_FACT] = boost::shared_ptr<Converter>(new ConvertFACT());
converters[ESM::REC_INFO] = boost::shared_ptr<Converter>(new ConvertINFO());
converters[ESM::REC_DIAL] = boost::shared_ptr<Converter>(new ConvertDIAL());
converters[ESM::REC_QUES] = boost::shared_ptr<Converter>(new ConvertQUES());
converters[recJOUR ] = boost::shared_ptr<Converter>(new ConvertJOUR());
converters[ESM::REC_SCPT] = boost::shared_ptr<Converter>(new ConvertSCPT());
std::map<unsigned int, std::shared_ptr<Converter> > converters;
converters[ESM::REC_GLOB] = std::shared_ptr<Converter>(new ConvertGlobal());
converters[ESM::REC_BOOK] = std::shared_ptr<Converter>(new ConvertBook());
converters[ESM::REC_NPC_] = std::shared_ptr<Converter>(new ConvertNPC());
converters[ESM::REC_CREA] = std::shared_ptr<Converter>(new ConvertCREA());
converters[ESM::REC_NPCC] = std::shared_ptr<Converter>(new ConvertNPCC());
converters[ESM::REC_CREC] = std::shared_ptr<Converter>(new ConvertCREC());
converters[recREFR ] = std::shared_ptr<Converter>(new ConvertREFR());
converters[recPCDT ] = std::shared_ptr<Converter>(new ConvertPCDT());
converters[recFMAP ] = std::shared_ptr<Converter>(new ConvertFMAP());
converters[recKLST ] = std::shared_ptr<Converter>(new ConvertKLST());
converters[recSTLN ] = std::shared_ptr<Converter>(new ConvertSTLN());
converters[recGAME ] = std::shared_ptr<Converter>(new ConvertGAME());
converters[ESM::REC_CELL] = std::shared_ptr<Converter>(new ConvertCell());
converters[ESM::REC_ALCH] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Potion>());
converters[ESM::REC_CLAS] = std::shared_ptr<Converter>(new ConvertClass());
converters[ESM::REC_SPEL] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Spell>());
converters[ESM::REC_ARMO] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Armor>());
converters[ESM::REC_WEAP] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Weapon>());
converters[ESM::REC_CLOT] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Clothing>());
converters[ESM::REC_ENCH] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Enchantment>());
converters[ESM::REC_WEAP] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Weapon>());
converters[ESM::REC_LEVC] = std::shared_ptr<Converter>(new DefaultConverter<ESM::CreatureLevList>());
converters[ESM::REC_LEVI] = std::shared_ptr<Converter>(new DefaultConverter<ESM::ItemLevList>());
converters[ESM::REC_CNTC] = std::shared_ptr<Converter>(new ConvertCNTC());
converters[ESM::REC_FACT] = std::shared_ptr<Converter>(new ConvertFACT());
converters[ESM::REC_INFO] = std::shared_ptr<Converter>(new ConvertINFO());
converters[ESM::REC_DIAL] = std::shared_ptr<Converter>(new ConvertDIAL());
converters[ESM::REC_QUES] = std::shared_ptr<Converter>(new ConvertQUES());
converters[recJOUR ] = std::shared_ptr<Converter>(new ConvertJOUR());
converters[ESM::REC_SCPT] = std::shared_ptr<Converter>(new ConvertSCPT());
// TODO:
// - REGN (weather in certain regions?)
@ -312,7 +312,7 @@ namespace ESSImport
std::set<unsigned int> unknownRecords;
for (std::map<unsigned int, boost::shared_ptr<Converter> >::const_iterator it = converters.begin();
for (std::map<unsigned int, std::shared_ptr<Converter> >::const_iterator it = converters.begin();
it != converters.end(); ++it)
{
it->second->setContext(context);
@ -323,7 +323,7 @@ namespace ESSImport
ESM::NAME n = esm.getRecName();
esm.getRecHeader();
std::map<unsigned int, boost::shared_ptr<Converter> >::iterator it = converters.find(n.intval);
std::map<unsigned int, std::shared_ptr<Converter> >::iterator it = converters.find(n.intval);
if (it != converters.end())
{
it->second->read(esm);
@ -386,7 +386,7 @@ namespace ESSImport
// Writing order should be Dynamic Store -> Cells -> Player,
// so that references to dynamic records can be recognized when loading
for (std::map<unsigned int, boost::shared_ptr<Converter> >::const_iterator it = converters.begin();
for (std::map<unsigned int, std::shared_ptr<Converter> >::const_iterator it = converters.begin();
it != converters.end(); ++it)
{
if (it->second->getStage() != 0)
@ -399,7 +399,7 @@ namespace ESSImport
context.mPlayerBase.save(writer);
writer.endRecord(ESM::REC_NPC_);
for (std::map<unsigned int, boost::shared_ptr<Converter> >::const_iterator it = converters.begin();
for (std::map<unsigned int, std::shared_ptr<Converter> >::const_iterator it = converters.begin();
it != converters.end(); ++it)
{
if (it->second->getStage() != 1)

@ -2,8 +2,6 @@
#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <components/files/configurationmanager.hpp>

@ -1,5 +1,6 @@
#include "graphicspage.hpp"
#include <boost/math/common_factor.hpp>
#include <QDesktopWidget>
#include <QMessageBox>
#include <QDir>
@ -12,14 +13,8 @@
#include <SDL_video.h>
#include <boost/math/common_factor.hpp>
#include <components/files/configurationmanager.hpp>
#include <components/contentselector/model/naturalsort.hpp>
#include <components/settings/settings.hpp>
QString getAspect(int x, int y)
{
int gcd = boost::math::gcd (x, y);

@ -172,7 +172,10 @@ Launcher::FirstRunDialogResult Launcher::MainDialog::showFirstRunDialog()
}
}
return setup() ? FirstRunDialogResultContinue : FirstRunDialogResultFailure;
if (!setup() || !setupGameData()) {
return FirstRunDialogResultFailure;
}
return FirstRunDialogResultContinue;
}
void Launcher::MainDialog::setVersionLabel()
@ -344,6 +347,11 @@ bool Launcher::MainDialog::setupGameSettings()
file.close();
}
return true;
}
bool Launcher::MainDialog::setupGameData()
{
QStringList dataDirs;
// Check if the paths actually contain data files

@ -72,6 +72,7 @@ namespace Launcher
bool setupLauncherSettings();
bool setupGameSettings();
bool setupGraphicsSettings();
bool setupGameData();
void setVersionLabel();

@ -1,17 +1,12 @@
#include "importer.hpp"
#include <ctime>
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <sstream>
#include <components/misc/stringops.hpp>
#include <boost/version.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/version.hpp>
namespace bfs = boost::filesystem;

@ -1,11 +1,9 @@
#include "importer.hpp"
#include <string>
#include <iostream>
#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
namespace bpo = boost::program_options;

@ -110,7 +110,7 @@ opencs_units_noqt (view/tools
)
opencs_units (view/prefs
dialogue pagebase page keybindingpage
dialogue pagebase page keybindingpage contextmenulist
)
opencs_units (model/prefs

@ -5,9 +5,6 @@
#include <QLocalSocket>
#include <QMessageBox>
#include <components/vfs/manager.hpp>
#include <components/vfs/registerarchives.hpp>
#include <components/fallback/validate.hpp>
#include <components/nifosg/nifloader.hpp>
@ -33,11 +30,7 @@ CS::Editor::Editor ()
NifOsg::Loader::setShowMarkers(true);
mVFS.reset(new VFS::Manager(mFsStrict));
VFS::registerArchives(mVFS.get(), Files::Collections(config.first, !mFsStrict), config.second, true);
mDocumentManager.setVFS(mVFS.get());
mDocumentManager.setFileData(mFsStrict, config.first, config.second);
mNewGame.setLocalData (mLocal);
mFileDialog.setLocalData (mLocal);

@ -1,8 +1,6 @@
#ifndef CS_EDITOR_H
#define CS_EDITOR_H
#include <memory>
#include <boost/interprocess/sync/file_lock.hpp>
#include <boost/filesystem/fstream.hpp>
@ -30,11 +28,6 @@
#include "view/tools/merge.hpp"
namespace VFS
{
class Manager;
}
namespace CSMDoc
{
class Document;
@ -46,9 +39,6 @@ namespace CS
{
Q_OBJECT
// FIXME: should be moved to document, so we can have different resources for each opened project
std::auto_ptr<VFS::Manager> mVFS;
Files::ConfigurationManager mCfgMgr;
CSMPrefs::State mSettingsState;
CSMDoc::DocumentManager mDocumentManager;

@ -5,6 +5,7 @@
#include <iostream>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include "../world/defaultgmsts.hpp"
@ -268,13 +269,14 @@ void CSMDoc::Document::createBase()
}
}
CSMDoc::Document::Document (const VFS::Manager* vfs, const Files::ConfigurationManager& configuration,
const std::vector< boost::filesystem::path >& files, bool new_,
CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
const std::vector< boost::filesystem::path >& files,bool new_,
const boost::filesystem::path& savePath, const boost::filesystem::path& resDir,
const Fallback::Map* fallback,
ToUTF8::FromType encoding, const CSMWorld::ResourcesManager& resourcesManager,
const std::vector<std::string>& blacklistedScripts)
: mVFS(vfs), mSavePath (savePath), mContentFiles (files), mNew (new_), mData (encoding, resourcesManager, fallback, resDir),
ToUTF8::FromType encoding,
const std::vector<std::string>& blacklistedScripts,
bool fsStrict, const Files::PathContainer& dataPaths, const std::vector<std::string>& archives)
: mSavePath (savePath), mContentFiles (files), mNew (new_), mData (encoding, fsStrict, dataPaths, archives, fallback, resDir),
mTools (*this, encoding),
mProjectPath ((configuration.getUserDataPath() / "projects") /
(savePath.filename().string() + ".project")),
@ -336,11 +338,6 @@ CSMDoc::Document::~Document()
{
}
const VFS::Manager *CSMDoc::Document::getVFS() const
{
return mVFS;
}
QUndoStack& CSMDoc::Document::getUndoStack()
{
return mUndoStack;
@ -415,9 +412,9 @@ void CSMDoc::Document::runSearch (const CSMWorld::UniversalId& searchId, const C
emit stateChanged (getState(), this);
}
void CSMDoc::Document::runMerge (std::auto_ptr<CSMDoc::Document> target)
void CSMDoc::Document::runMerge (std::unique_ptr<CSMDoc::Document> target)
{
mTools.runMerge (target);
mTools.runMerge (std::move(target));
emit stateChanged (getState(), this);
}

@ -3,13 +3,13 @@
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/filesystem/path.hpp>
#include <QUndoStack>
#include <QObject>
#include <QTimer>
#include <components/files/multidircollection.hpp>
#include <components/to_utf8/to_utf8.hpp>
#include "../world/data.hpp"
@ -60,7 +60,6 @@ namespace CSMDoc
private:
const VFS::Manager* mVFS;
boost::filesystem::path mSavePath;
std::vector<boost::filesystem::path> mContentFiles;
bool mNew;
@ -103,17 +102,15 @@ namespace CSMDoc
public:
Document (const VFS::Manager* vfs, const Files::ConfigurationManager& configuration,
Document (const Files::ConfigurationManager& configuration,
const std::vector< boost::filesystem::path >& files, bool new_,
const boost::filesystem::path& savePath, const boost::filesystem::path& resDir,
const Fallback::Map* fallback,
ToUTF8::FromType encoding, const CSMWorld::ResourcesManager& resourcesManager,
const std::vector<std::string>& blacklistedScripts);
const Fallback::Map* fallback, ToUTF8::FromType encoding,
const std::vector<std::string>& blacklistedScripts,
bool fsStrict, const Files::PathContainer& dataPaths, const std::vector<std::string>& archives);
~Document();
const VFS::Manager* getVFS() const;
QUndoStack& getUndoStack();
int getState() const;
@ -137,7 +134,7 @@ namespace CSMDoc
void runSearch (const CSMWorld::UniversalId& searchId, const CSMTools::Search& search);
void runMerge (std::auto_ptr<CSMDoc::Document> target);
void runMerge (std::unique_ptr<CSMDoc::Document> target);
void abortOperation (int type);

@ -1,8 +1,5 @@
#include "documentmanager.hpp"
#include <algorithm>
#include <stdexcept>
#include <boost/filesystem.hpp>
#ifndef Q_MOC_RUN
@ -12,7 +9,7 @@
#include "document.hpp"
CSMDoc::DocumentManager::DocumentManager (const Files::ConfigurationManager& configuration)
: mConfiguration (configuration), mEncoding (ToUTF8::WINDOWS_1252), mVFS(NULL)
: mConfiguration (configuration), mEncoding (ToUTF8::WINDOWS_1252)
{
boost::filesystem::path projectPath = configuration.getUserDataPath() / "projects";
@ -65,7 +62,7 @@ CSMDoc::Document *CSMDoc::DocumentManager::makeDocument (
const std::vector< boost::filesystem::path >& files,
const boost::filesystem::path& savePath, bool new_)
{
return new Document (mVFS, mConfiguration, files, new_, savePath, mResDir, &mFallbackMap, mEncoding, mResourcesManager, mBlacklistedScripts);
return new Document (mConfiguration, files, new_, savePath, mResDir, &mFallbackMap, mEncoding, mBlacklistedScripts, mFsStrict, mDataPaths, mArchives);
}
void CSMDoc::DocumentManager::insertDocument (CSMDoc::Document *document)
@ -130,8 +127,9 @@ void CSMDoc::DocumentManager::documentNotLoaded (Document *document, const std::
removeDocument (document);
}
void CSMDoc::DocumentManager::setVFS(const VFS::Manager *vfs)
void CSMDoc::DocumentManager::setFileData(bool strict, const Files::PathContainer& dataPaths, const std::vector<std::string>& archives)
{
mResourcesManager.setVFS(vfs);
mVFS = vfs;
mFsStrict = strict;
mDataPaths = dataPaths;
mArchives = archives;
}

@ -11,8 +11,7 @@
#include <components/to_utf8/to_utf8.hpp>
#include <components/fallback/fallback.hpp>
#include "../world/resourcesmanager.hpp"
#include <components/files/multidircollection.hpp>
#include "loader.hpp"
@ -39,9 +38,14 @@ namespace CSMDoc
QThread mLoaderThread;
Loader mLoader;
ToUTF8::FromType mEncoding;
CSMWorld::ResourcesManager mResourcesManager;
std::vector<std::string> mBlacklistedScripts;
const VFS::Manager* mVFS;
boost::filesystem::path mResDir;
Fallback::Map mFallbackMap;
bool mFsStrict;
Files::PathContainer mDataPaths;
std::vector<std::string> mArchives;
DocumentManager (const DocumentManager&);
DocumentManager& operator= (const DocumentManager&);
@ -74,15 +78,11 @@ namespace CSMDoc
void setBlacklistedScripts (const std::vector<std::string>& scriptIds);
void setVFS(const VFS::Manager* vfs);
/// Sets the file data that gets passed to newly created documents.
void setFileData(bool strict, const Files::PathContainer& dataPaths, const std::vector<std::string>& archives);
bool isEmpty();
private:
boost::filesystem::path mResDir;
Fallback::Map mFallbackMap;
private slots:
void documentLoaded (Document *document);

@ -1,20 +1,15 @@
#include "savingstages.hpp"
#include <fstream>
#include <boost/filesystem.hpp>
#include <QUndoStack>
#include <components/esm/loaddial.hpp>
#include <components/misc/stringops.hpp>
#include "../world/infocollection.hpp"
#include "../world/cellcoordinates.hpp"
#include "document.hpp"
#include "savingstate.hpp"
CSMDoc::OpenSaveStage::OpenSaveStage (Document& document, SavingState& state, bool projectFile)
: mDocument (document), mState (state), mProjectFile (projectFile)

@ -1,5 +1,7 @@
#include "savingstate.hpp"
#include <boost/filesystem/fstream.hpp>
#include "operation.hpp"
#include "document.hpp"

@ -2,7 +2,7 @@
#include <sstream>
CSMFilter::AndNode::AndNode (const std::vector<boost::shared_ptr<Node> >& nodes)
CSMFilter::AndNode::AndNode (const std::vector<std::shared_ptr<Node> >& nodes)
: NAryNode (nodes, "and")
{}

@ -9,7 +9,7 @@ namespace CSMFilter
{
public:
AndNode (const std::vector<boost::shared_ptr<Node> >& nodes);
AndNode (const std::vector<std::shared_ptr<Node> >& nodes);
virtual bool test (const CSMWorld::IdTableBase& table, int row,
const std::map<int, int>& columns) const;

@ -2,7 +2,7 @@
#include <sstream>
CSMFilter::NAryNode::NAryNode (const std::vector<boost::shared_ptr<Node> >& nodes,
CSMFilter::NAryNode::NAryNode (const std::vector<std::shared_ptr<Node> >& nodes,
const std::string& name)
: mNodes (nodes), mName (name)
{}
@ -21,7 +21,7 @@ std::vector<int> CSMFilter::NAryNode::getReferencedColumns() const
{
std::vector<int> columns;
for (std::vector<boost::shared_ptr<Node> >::const_iterator iter (mNodes.begin());
for (std::vector<std::shared_ptr<Node> >::const_iterator iter (mNodes.begin());
iter!=mNodes.end(); ++iter)
{
std::vector<int> columns2 = (*iter)->getReferencedColumns();

@ -4,20 +4,18 @@
#include <vector>
#include <string>
#include <boost/shared_ptr.hpp>
#include "node.hpp"
namespace CSMFilter
{
class NAryNode : public Node
{
std::vector<boost::shared_ptr<Node> > mNodes;
std::vector<std::shared_ptr<Node> > mNodes;
std::string mName;
public:
NAryNode (const std::vector<boost::shared_ptr<Node> >& nodes, const std::string& name);
NAryNode (const std::vector<std::shared_ptr<Node> >& nodes, const std::string& name);
int getSize() const;

@ -3,10 +3,9 @@
#include <string>
#include <map>
#include <memory>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <QMetaType>
namespace CSMWorld
@ -48,6 +47,6 @@ namespace CSMFilter
};
}
Q_DECLARE_METATYPE (boost::shared_ptr<CSMFilter::Node>)
Q_DECLARE_METATYPE (std::shared_ptr<CSMFilter::Node>)
#endif

@ -1,6 +1,6 @@
#include "notnode.hpp"
CSMFilter::NotNode::NotNode (boost::shared_ptr<Node> child) : UnaryNode (child, "not") {}
CSMFilter::NotNode::NotNode (std::shared_ptr<Node> child) : UnaryNode (child, "not") {}
bool CSMFilter::NotNode::test (const CSMWorld::IdTableBase& table, int row,
const std::map<int, int>& columns) const

@ -9,7 +9,7 @@ namespace CSMFilter
{
public:
NotNode (boost::shared_ptr<Node> child);
NotNode (std::shared_ptr<Node> child);
virtual bool test (const CSMWorld::IdTableBase& table, int row,
const std::map<int, int>& columns) const;

@ -2,7 +2,7 @@
#include <sstream>
CSMFilter::OrNode::OrNode (const std::vector<boost::shared_ptr<Node> >& nodes)
CSMFilter::OrNode::OrNode (const std::vector<std::shared_ptr<Node> >& nodes)
: NAryNode (nodes, "or")
{}

@ -9,7 +9,7 @@ namespace CSMFilter
{
public:
OrNode (const std::vector<boost::shared_ptr<Node> >& nodes);
OrNode (const std::vector<std::shared_ptr<Node> >& nodes);
virtual bool test (const CSMWorld::IdTableBase& table, int row,
const std::map<int, int>& columns) const;

@ -235,7 +235,7 @@ CSMFilter::Token CSMFilter::Parser::getNextToken()
return Token (Token::Type_None);
}
boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty, bool ignoreOneShot)
std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty, bool ignoreOneShot)
{
if (Token token = getNextToken())
{
@ -247,11 +247,11 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty,
{
case Token::Type_Keyword_True:
return boost::shared_ptr<CSMFilter::Node> (new BooleanNode (true));
return std::shared_ptr<CSMFilter::Node> (new BooleanNode (true));
case Token::Type_Keyword_False:
return boost::shared_ptr<CSMFilter::Node> (new BooleanNode (false));
return std::shared_ptr<CSMFilter::Node> (new BooleanNode (false));
case Token::Type_Keyword_And:
case Token::Type_Keyword_Or:
@ -260,12 +260,12 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty,
case Token::Type_Keyword_Not:
{
boost::shared_ptr<CSMFilter::Node> node = parseImp();
std::shared_ptr<CSMFilter::Node> node = parseImp();
if (mError)
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
return boost::shared_ptr<CSMFilter::Node> (new NotNode (node));
return std::shared_ptr<CSMFilter::Node> (new NotNode (node));
}
case Token::Type_Keyword_Text:
@ -281,7 +281,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty,
if (!allowEmpty)
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
default:
@ -289,27 +289,27 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty,
}
}
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseNAry (const Token& keyword)
std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseNAry (const Token& keyword)
{
std::vector<boost::shared_ptr<Node> > nodes;
std::vector<std::shared_ptr<Node> > nodes;
Token token = getNextToken();
if (token.mType!=Token::Type_Open)
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
for (;;)
{
boost::shared_ptr<Node> node = parseImp();
std::shared_ptr<Node> node = parseImp();
if (mError)
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
nodes.push_back (node);
@ -318,7 +318,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseNAry (const Token& ke
if (!token || (token.mType!=Token::Type_Close && token.mType!=Token::Type_Comma))
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
if (token.mType==Token::Type_Close)
@ -328,31 +328,31 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseNAry (const Token& ke
if (nodes.empty())
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
switch (keyword.mType)
{
case Token::Type_Keyword_And: return boost::shared_ptr<CSMFilter::Node> (new AndNode (nodes));
case Token::Type_Keyword_Or: return boost::shared_ptr<CSMFilter::Node> (new OrNode (nodes));
default: error(); return boost::shared_ptr<Node>();
case Token::Type_Keyword_And: return std::shared_ptr<CSMFilter::Node> (new AndNode (nodes));
case Token::Type_Keyword_Or: return std::shared_ptr<CSMFilter::Node> (new OrNode (nodes));
default: error(); return std::shared_ptr<Node>();
}
}
boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseText()
std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseText()
{
Token token = getNextToken();
if (token.mType!=Token::Type_Open)
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
token = getNextToken();
if (!token)
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
// parse column ID
int columnId = -1;
@ -370,7 +370,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseText()
if (columnId<0)
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
token = getNextToken();
@ -378,7 +378,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseText()
if (token.mType!=Token::Type_Comma)
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
// parse text pattern
@ -387,7 +387,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseText()
if (!token.isString())
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
std::string text = token.mString;
@ -397,26 +397,26 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseText()
if (token.mType!=Token::Type_Close)
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
return boost::shared_ptr<Node> (new TextNode (columnId, text));
return std::shared_ptr<Node> (new TextNode (columnId, text));
}
boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
{
Token token = getNextToken();
if (token.mType!=Token::Type_Open)
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
token = getNextToken();
if (!token)
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
// parse column ID
int columnId = -1;
@ -434,7 +434,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
if (columnId<0)
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
token = getNextToken();
@ -442,7 +442,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
if (token.mType!=Token::Type_Comma)
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
// parse value
@ -467,7 +467,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
else if (token.mType!=Token::Type_CloseSquare && token.mType!=Token::Type_Open)
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
token = getNextToken();
@ -481,7 +481,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
if (token.mType!=Token::Type_Comma)
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
}
else if (token.mType==Token::Type_Comma)
@ -491,7 +491,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
else
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
token = getNextToken();
@ -513,7 +513,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
else if (token.mType!=Token::Type_OpenSquare && token.mType!=Token::Type_Close)
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
}
@ -522,10 +522,10 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
if (token.mType!=Token::Type_Close)
{
error();
return boost::shared_ptr<Node>();
return std::shared_ptr<Node>();
}
return boost::shared_ptr<Node> (new ValueNode (columnId, lowerType, upperType, lower, upper));
return std::shared_ptr<Node> (new ValueNode (columnId, lowerType, upperType, lower, upper));
}
void CSMFilter::Parser::error()
@ -556,7 +556,7 @@ bool CSMFilter::Parser::parse (const std::string& filter, bool allowPredefined)
}
else if (!allowPredefined || token==Token (Token::Type_OneShot))
{
boost::shared_ptr<Node> node = parseImp (true, token!=Token (Token::Type_OneShot));
std::shared_ptr<Node> node = parseImp (true, token!=Token (Token::Type_OneShot));
if (mError)
return false;
@ -612,7 +612,7 @@ bool CSMFilter::Parser::parse (const std::string& filter, bool allowPredefined)
}
}
boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::getFilter() const
std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::getFilter() const
{
if (mError)
throw std::logic_error ("No filter available");

@ -1,8 +1,6 @@
#ifndef CSM_FILTER_PARSER_H
#define CSM_FILTER_PARSER_H
#include <boost/shared_ptr.hpp>
#include "node.hpp"
namespace CSMWorld
@ -16,7 +14,7 @@ namespace CSMFilter
class Parser
{
boost::shared_ptr<Node> mFilter;
std::shared_ptr<Node> mFilter;
std::string mInput;
int mIndex;
bool mError;
@ -31,14 +29,14 @@ namespace CSMFilter
Token checkKeywords (const Token& token);
///< Turn string token into keyword token, if possible.
boost::shared_ptr<Node> parseImp (bool allowEmpty = false, bool ignoreOneShot = false);
std::shared_ptr<Node> parseImp (bool allowEmpty = false, bool ignoreOneShot = false);
///< Will return a null-pointer, if there is nothing more to parse.
boost::shared_ptr<Node> parseNAry (const Token& keyword);
std::shared_ptr<Node> parseNAry (const Token& keyword);
boost::shared_ptr<Node> parseText();
std::shared_ptr<Node> parseText();
boost::shared_ptr<Node> parseValue();
std::shared_ptr<Node> parseValue();
void error();
@ -51,7 +49,7 @@ namespace CSMFilter
///
/// \return Success?
boost::shared_ptr<Node> getFilter() const;
std::shared_ptr<Node> getFilter() const;
///< Throws an exception if the last call to parse did not return true.
};
}

@ -1,6 +1,6 @@
#include "unarynode.hpp"
CSMFilter::UnaryNode::UnaryNode (boost::shared_ptr<Node> child, const std::string& name)
CSMFilter::UnaryNode::UnaryNode (std::shared_ptr<Node> child, const std::string& name)
: mChild (child), mName (name)
{}

@ -1,20 +1,18 @@
#ifndef CSM_FILTER_UNARYNODE_H
#define CSM_FILTER_UNARYNODE_H
#include <boost/shared_ptr.hpp>
#include "node.hpp"
namespace CSMFilter
{
class UnaryNode : public Node
{
boost::shared_ptr<Node> mChild;
std::shared_ptr<Node> mChild;
std::string mName;
public:
UnaryNode (boost::shared_ptr<Node> child, const std::string& name);
UnaryNode (std::shared_ptr<Node> child, const std::string& name);
const Node& getChild() const;

@ -11,7 +11,7 @@
CSMPrefs::BoolSetting::BoolSetting (Category *parent, Settings::Manager *values,
QMutex *mutex, const std::string& key, const std::string& label, bool default_)
: Setting (parent, values, mutex, key, label), mDefault (default_)
: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget(0)
{}
CSMPrefs::BoolSetting& CSMPrefs::BoolSetting::setTooltip (const std::string& tooltip)
@ -22,18 +22,28 @@ CSMPrefs::BoolSetting& CSMPrefs::BoolSetting::setTooltip (const std::string& too
std::pair<QWidget *, QWidget *> CSMPrefs::BoolSetting::makeWidgets (QWidget *parent)
{
QCheckBox *widget = new QCheckBox (QString::fromUtf8 (getLabel().c_str()), parent);
widget->setCheckState (mDefault ? Qt::Checked : Qt::Unchecked);
mWidget = new QCheckBox (QString::fromUtf8 (getLabel().c_str()), parent);
mWidget->setCheckState (mDefault ? Qt::Checked : Qt::Unchecked);
if (!mTooltip.empty())
{
QString tooltip = QString::fromUtf8 (mTooltip.c_str());
widget->setToolTip (tooltip);
mWidget->setToolTip (tooltip);
}
connect (widget, SIGNAL (stateChanged (int)), this, SLOT (valueChanged (int)));
connect (mWidget, SIGNAL (stateChanged (int)), this, SLOT (valueChanged (int)));
return std::make_pair (static_cast<QWidget *> (0), widget);
return std::make_pair (static_cast<QWidget *> (0), mWidget);
}
void CSMPrefs::BoolSetting::updateWidget()
{
if (mWidget)
{
mWidget->setCheckState(getValues().getBool(getKey(), getParent()->getKey())
? Qt::Checked
: Qt::Unchecked);
}
}
void CSMPrefs::BoolSetting::valueChanged (int value)

@ -3,6 +3,8 @@
#include "setting.hpp"
class QCheckBox;
namespace CSMPrefs
{
class BoolSetting : public Setting
@ -11,6 +13,7 @@ namespace CSMPrefs
std::string mTooltip;
bool mDefault;
QCheckBox* mWidget;
public:
@ -22,6 +25,8 @@ namespace CSMPrefs
/// Return label, input widget.
virtual std::pair<QWidget *, QWidget *> makeWidgets (QWidget *parent);
virtual void updateWidget();
private slots:
void valueChanged (int value);

@ -3,6 +3,7 @@
#include <QLabel>
#include <QMutexLocker>
#include <QString>
#include <components/settings/settings.hpp>
@ -13,7 +14,7 @@
CSMPrefs::ColourSetting::ColourSetting (Category *parent, Settings::Manager *values,
QMutex *mutex, const std::string& key, const std::string& label, QColor default_)
: Setting (parent, values, mutex, key, label), mDefault (default_)
: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget(0)
{}
CSMPrefs::ColourSetting& CSMPrefs::ColourSetting::setTooltip (const std::string& tooltip)
@ -26,18 +27,27 @@ std::pair<QWidget *, QWidget *> CSMPrefs::ColourSetting::makeWidgets (QWidget *p
{
QLabel *label = new QLabel (QString::fromUtf8 (getLabel().c_str()), parent);
CSVWidget::ColorEditor *widget = new CSVWidget::ColorEditor (mDefault, parent);
mWidget = new CSVWidget::ColorEditor (mDefault, parent);
if (!mTooltip.empty())
{
QString tooltip = QString::fromUtf8 (mTooltip.c_str());
label->setToolTip (tooltip);
widget->setToolTip (tooltip);
mWidget->setToolTip (tooltip);
}
connect (widget, SIGNAL (pickingFinished()), this, SLOT (valueChanged()));
connect (mWidget, SIGNAL (pickingFinished()), this, SLOT (valueChanged()));
return std::make_pair (label, widget);
return std::make_pair (label, mWidget);
}
void CSMPrefs::ColourSetting::updateWidget()
{
if (mWidget)
{
mWidget->setColor(QString::fromStdString
(getValues().getString(getKey(), getParent()->getKey())));
}
}
void CSMPrefs::ColourSetting::valueChanged()

@ -5,6 +5,11 @@
#include <QColor>
namespace CSVWidget
{
class ColorEditor;
}
namespace CSMPrefs
{
class ColourSetting : public Setting
@ -13,6 +18,7 @@ namespace CSMPrefs
std::string mTooltip;
QColor mDefault;
CSVWidget::ColorEditor* mWidget;
public:
@ -25,6 +31,8 @@ namespace CSMPrefs
/// Return label, input widget.
virtual std::pair<QWidget *, QWidget *> makeWidgets (QWidget *parent);
virtual void updateWidget();
private slots:
void valueChanged();

@ -16,7 +16,7 @@ CSMPrefs::DoubleSetting::DoubleSetting (Category *parent, Settings::Manager *val
QMutex *mutex, const std::string& key, const std::string& label, double default_)
: Setting (parent, values, mutex, key, label),
mPrecision(2), mMin (0), mMax (std::numeric_limits<double>::max()),
mDefault (default_)
mDefault (default_), mWidget(0)
{}
CSMPrefs::DoubleSetting& CSMPrefs::DoubleSetting::setPrecision(int precision)
@ -54,21 +54,29 @@ std::pair<QWidget *, QWidget *> CSMPrefs::DoubleSetting::makeWidgets (QWidget *p
{
QLabel *label = new QLabel (QString::fromUtf8 (getLabel().c_str()), parent);
QDoubleSpinBox *widget = new QDoubleSpinBox (parent);
widget->setDecimals(mPrecision);
widget->setRange (mMin, mMax);
widget->setValue (mDefault);
mWidget = new QDoubleSpinBox (parent);
mWidget->setDecimals(mPrecision);
mWidget->setRange (mMin, mMax);
mWidget->setValue (mDefault);
if (!mTooltip.empty())
{
QString tooltip = QString::fromUtf8 (mTooltip.c_str());
label->setToolTip (tooltip);
widget->setToolTip (tooltip);
mWidget->setToolTip (tooltip);
}
connect (widget, SIGNAL (valueChanged (double)), this, SLOT (valueChanged (double)));
connect (mWidget, SIGNAL (valueChanged (double)), this, SLOT (valueChanged (double)));
return std::make_pair (label, widget);
return std::make_pair (label, mWidget);
}
void CSMPrefs::DoubleSetting::updateWidget()
{
if (mWidget)
{
mWidget->setValue(getValues().getFloat(getKey(), getParent()->getKey()));
}
}
void CSMPrefs::DoubleSetting::valueChanged (double value)

@ -3,6 +3,8 @@
#include "setting.hpp"
class QDoubleSpinBox;
namespace CSMPrefs
{
class DoubleSetting : public Setting
@ -14,6 +16,7 @@ namespace CSMPrefs
double mMax;
std::string mTooltip;
double mDefault;
QDoubleSpinBox* mWidget;
public:
@ -35,6 +38,8 @@ namespace CSMPrefs
/// Return label, input widget.
virtual std::pair<QWidget *, QWidget *> makeWidgets (QWidget *parent);
virtual void updateWidget();
private slots:
void valueChanged (double value);

@ -4,6 +4,7 @@
#include <QLabel>
#include <QComboBox>
#include <QMutexLocker>
#include <QString>
#include <components/settings/settings.hpp>
@ -41,7 +42,7 @@ CSMPrefs::EnumValues& CSMPrefs::EnumValues::add (const std::string& value, const
CSMPrefs::EnumSetting::EnumSetting (Category *parent, Settings::Manager *values,
QMutex *mutex, const std::string& key, const std::string& label, const EnumValue& default_)
: Setting (parent, values, mutex, key, label), mDefault (default_)
: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget(0)
{}
CSMPrefs::EnumSetting& CSMPrefs::EnumSetting::setTooltip (const std::string& tooltip)
@ -72,7 +73,7 @@ std::pair<QWidget *, QWidget *> CSMPrefs::EnumSetting::makeWidgets (QWidget *par
{
QLabel *label = new QLabel (QString::fromUtf8 (getLabel().c_str()), parent);
QComboBox *widget = new QComboBox (parent);
mWidget = new QComboBox (parent);
int index = 0;
@ -81,14 +82,14 @@ std::pair<QWidget *, QWidget *> CSMPrefs::EnumSetting::makeWidgets (QWidget *par
if (mDefault.mValue==mValues.mValues[i].mValue)
index = i;
widget->addItem (QString::fromUtf8 (mValues.mValues[i].mValue.c_str()));
mWidget->addItem (QString::fromUtf8 (mValues.mValues[i].mValue.c_str()));
if (!mValues.mValues[i].mTooltip.empty())
widget->setItemData (i, QString::fromUtf8 (mValues.mValues[i].mTooltip.c_str()),
mWidget->setItemData (i, QString::fromUtf8 (mValues.mValues[i].mTooltip.c_str()),
Qt::ToolTipRole);
}
widget->setCurrentIndex (index);
mWidget->setCurrentIndex (index);
if (!mTooltip.empty())
{
@ -96,9 +97,20 @@ std::pair<QWidget *, QWidget *> CSMPrefs::EnumSetting::makeWidgets (QWidget *par
label->setToolTip (tooltip);
}
connect (widget, SIGNAL (currentIndexChanged (int)), this, SLOT (valueChanged (int)));
connect (mWidget, SIGNAL (currentIndexChanged (int)), this, SLOT (valueChanged (int)));
return std::make_pair (label, widget);
return std::make_pair (label, mWidget);
}
void CSMPrefs::EnumSetting::updateWidget()
{
if (mWidget)
{
int index = mWidget->findText(QString::fromStdString
(getValues().getString(getKey(), getParent()->getKey())));
mWidget->setCurrentIndex(index);
}
}
void CSMPrefs::EnumSetting::valueChanged (int value)

@ -5,6 +5,8 @@
#include "setting.hpp"
class QComboBox;
namespace CSMPrefs
{
struct EnumValue
@ -35,6 +37,7 @@ namespace CSMPrefs
std::string mTooltip;
EnumValue mDefault;
EnumValues mValues;
QComboBox* mWidget;
public:
@ -53,6 +56,8 @@ namespace CSMPrefs
/// Return label, input widget.
virtual std::pair<QWidget *, QWidget *> makeWidgets (QWidget *parent);
virtual void updateWidget();
private slots:
void valueChanged (int value);

@ -15,7 +15,7 @@
CSMPrefs::IntSetting::IntSetting (Category *parent, Settings::Manager *values,
QMutex *mutex, const std::string& key, const std::string& label, int default_)
: Setting (parent, values, mutex, key, label), mMin (0), mMax (std::numeric_limits<int>::max()),
mDefault (default_)
mDefault (default_), mWidget(0)
{}
CSMPrefs::IntSetting& CSMPrefs::IntSetting::setRange (int min, int max)
@ -47,20 +47,28 @@ std::pair<QWidget *, QWidget *> CSMPrefs::IntSetting::makeWidgets (QWidget *pare
{
QLabel *label = new QLabel (QString::fromUtf8 (getLabel().c_str()), parent);
QSpinBox *widget = new QSpinBox (parent);
widget->setRange (mMin, mMax);
widget->setValue (mDefault);
mWidget = new QSpinBox (parent);
mWidget->setRange (mMin, mMax);
mWidget->setValue (mDefault);
if (!mTooltip.empty())
{
QString tooltip = QString::fromUtf8 (mTooltip.c_str());
label->setToolTip (tooltip);
widget->setToolTip (tooltip);
mWidget->setToolTip (tooltip);
}
connect (widget, SIGNAL (valueChanged (int)), this, SLOT (valueChanged (int)));
connect (mWidget, SIGNAL (valueChanged (int)), this, SLOT (valueChanged (int)));
return std::make_pair (label, widget);
return std::make_pair (label, mWidget);
}
void CSMPrefs::IntSetting::updateWidget()
{
if (mWidget)
{
mWidget->setValue(getValues().getInt(getKey(), getParent()->getKey()));
}
}
void CSMPrefs::IntSetting::valueChanged (int value)

@ -3,6 +3,8 @@
#include "setting.hpp"
class QSpinBox;
namespace CSMPrefs
{
class IntSetting : public Setting
@ -13,6 +15,7 @@ namespace CSMPrefs
int mMax;
std::string mTooltip;
int mDefault;
QSpinBox* mWidget;
public:
@ -31,6 +34,8 @@ namespace CSMPrefs
/// Return label, input widget.
virtual std::pair<QWidget *, QWidget *> makeWidgets (QWidget *parent);
virtual void updateWidget();
private slots:
void valueChanged (int value);

@ -32,6 +32,10 @@ namespace CSMPrefs
widget->setCheckable(true);
widget->installEventFilter(this);
// right clicking on button sets shortcut to RMB, so context menu should not appear
widget->setContextMenuPolicy(Qt::PreventContextMenu);
mButton = widget;
connect(widget, SIGNAL(toggled(bool)), this, SLOT(buttonToggled(bool)));
@ -39,6 +43,19 @@ namespace CSMPrefs
return std::make_pair(label, widget);
}
void ModifierSetting::updateWidget()
{
if (mButton)
{
std::string shortcut = getValues().getString(getKey(), getParent()->getKey());
int modifier;
State::get().getShortcutManager().convertFromString(shortcut, modifier);
State::get().getShortcutManager().setModifier(getKey(), modifier);
resetState();
}
}
bool ModifierSetting::eventFilter(QObject* target, QEvent* event)
{
if (event->type() == QEvent::KeyPress)

@ -21,6 +21,8 @@ namespace CSMPrefs
virtual std::pair<QWidget*, QWidget*> makeWidgets(QWidget* parent);
virtual void updateWidget();
protected:
bool eventFilter(QObject* target, QEvent* event);

@ -30,6 +30,10 @@ std::pair<QWidget *, QWidget *> CSMPrefs::Setting::makeWidgets (QWidget *parent)
return std::pair<QWidget *, QWidget *> (0, 0);
}
void CSMPrefs::Setting::updateWidget()
{
}
const CSMPrefs::Category *CSMPrefs::Setting::getParent() const
{
return mParent;

@ -47,6 +47,11 @@ namespace CSMPrefs
/// widget.
virtual std::pair<QWidget *, QWidget *> makeWidgets (QWidget *parent);
/// Updates the widget returned by makeWidgets() to the current setting.
///
/// \note If make_widgets() has not been called yet then nothing happens.
virtual void updateWidget();
const Category *getParent() const;
const std::string& getKey() const;

@ -6,6 +6,7 @@
#include <QMouseEvent>
#include <QPushButton>
#include <QWidget>
#include <QString>
#include "state.hpp"
#include "shortcutmanager.hpp"
@ -39,6 +40,10 @@ namespace CSMPrefs
widget->setCheckable(true);
widget->installEventFilter(this);
// right clicking on button sets shortcut to RMB, so context menu should not appear
widget->setContextMenuPolicy(Qt::PreventContextMenu);
mButton = widget;
connect(widget, SIGNAL(toggled(bool)), this, SLOT(buttonToggled(bool)));
@ -46,6 +51,19 @@ namespace CSMPrefs
return std::make_pair(label, widget);
}
void ShortcutSetting::updateWidget()
{
if (mButton)
{
std::string shortcut = getValues().getString(getKey(), getParent()->getKey());
QKeySequence sequence;
State::get().getShortcutManager().convertFromString(shortcut, sequence);
State::get().getShortcutManager().setSequence(getKey(), sequence);
resetState();
}
}
bool ShortcutSetting::eventFilter(QObject* target, QEvent* event)
{
if (event->type() == QEvent::KeyPress)

@ -21,6 +21,8 @@ namespace CSMPrefs
virtual std::pair<QWidget*, QWidget*> makeWidgets(QWidget* parent);
virtual void updateWidget();
protected:
bool eventFilter(QObject* target, QEvent* event);

@ -152,6 +152,8 @@ void CSMPrefs::State::declare()
setRange (0, 10000);
declareInt ("error-height", "Initial height of the error panel", 100).
setRange (100, 10000);
declareBool ("highlight-occurrences", "Highlight other occurrences of selected names", true);
declareColour ("colour-highlight", "Colour of highlighted occurrences", QColor("lightcyan"));
declareSeparator();
declareColour ("colour-int", "Highlight Colour: Integer Literals", QColor ("darkmagenta"));
declareColour ("colour-float", "Highlight Colour: Float Literals", QColor ("magenta"));
@ -257,6 +259,7 @@ void CSMPrefs::State::declare()
declareShortcut ("document-character-topicinfos", "Open Topic Info List", QKeySequence());
declareShortcut ("document-character-journalinfos", "Open Journal Info List", QKeySequence());
declareShortcut ("document-character-bodyparts", "Open Body Part List", QKeySequence());
declareShortcut ("document-assets-reload", "Reload Assets", QKeySequence(Qt::Key_F5));
declareShortcut ("document-assets-sounds", "Open Sound Asset List", QKeySequence());
declareShortcut ("document-assets-soundgens", "Open Sound Generator List", QKeySequence());
declareShortcut ("document-assets-meshes", "Open Mesh Asset List", QKeySequence());
@ -326,6 +329,10 @@ void CSMPrefs::State::declare()
declareShortcut ("orbit-roll-right", "Roll Right", QKeySequence(Qt::Key_E));
declareShortcut ("orbit-speed-mode", "Toggle Speed Mode", QKeySequence(Qt::Key_F));
declareShortcut ("orbit-center-selection", "Center On Selected", QKeySequence(Qt::Key_C));
declareSubcategory ("Script Editor");
declareShortcut ("script-editor-comment", "Comment Selection", QKeySequence());
declareShortcut ("script-editor-uncomment", "Uncomment Selection", QKeySequence());
}
void CSMPrefs::State::declareCategory (const std::string& key)
@ -581,6 +588,41 @@ CSMPrefs::State& CSMPrefs::State::get()
return *sThis;
}
void CSMPrefs::State::resetCategory(const std::string& category)
{
for (Settings::CategorySettingValueMap::iterator i = mSettings.mUserSettings.begin();
i != mSettings.mUserSettings.end(); ++i)
{
// if the category matches
if (i->first.first == category)
{
// mark the setting as changed
mSettings.mChangedSettings.insert(std::make_pair(i->first.first, i->first.second));
// reset the value to the default
i->second = mSettings.mDefaultSettings[i->first];
}
}
Collection::iterator container = mCategories.find(category);
if (container != mCategories.end())
{
Category settings = container->second;
for (Category::Iterator i = settings.begin(); i != settings.end(); ++i)
{
(*i)->updateWidget();
update(**i);
}
}
}
void CSMPrefs::State::resetAll()
{
for (Collection::iterator iter = mCategories.begin(); iter != mCategories.end(); ++iter)
{
resetCategory(iter->first);
}
}
CSMPrefs::State& CSMPrefs::get()
{

@ -106,6 +106,10 @@ namespace CSMPrefs
static State& get();
void resetCategory(const std::string& category);
void resetAll();
signals:
void settingChanged (const CSMPrefs::Setting *setting);

@ -45,9 +45,9 @@ CSMTools::MergeOperation::MergeOperation (CSMDoc::Document& document, ToUTF8::Fr
appendStage (new FinishMergedDocumentStage (mState, encoding));
}
void CSMTools::MergeOperation::setTarget (std::auto_ptr<CSMDoc::Document> document)
void CSMTools::MergeOperation::setTarget (std::unique_ptr<CSMDoc::Document> document)
{
mState.mTarget = document;
mState.mTarget = std::move(document);
}
void CSMTools::MergeOperation::operationDone()

@ -27,7 +27,7 @@ namespace CSMTools
MergeOperation (CSMDoc::Document& document, ToUTF8::FromType encoding);
/// \attention Do not call this function while a merge is running.
void setTarget (std::auto_ptr<CSMDoc::Document> document);
void setTarget (std::unique_ptr<CSMDoc::Document> document);
protected slots:

@ -12,7 +12,7 @@ namespace CSMTools
{
struct MergeState
{
std::auto_ptr<CSMDoc::Document> mTarget;
std::unique_ptr<CSMDoc::Document> mTarget;
CSMDoc::Document& mSource;
bool mCompleted;
std::map<std::pair<uint16_t, int>, int> mTextureIndices; // (texture, content file) -> new texture

@ -1,7 +1,5 @@
#include "referencecheck.hpp"
#include <boost/lexical_cast.hpp>
CSMTools::ReferenceCheckStage::ReferenceCheckStage(
const CSMWorld::RefCollection& references,
const CSMWorld::RefIdCollection& referencables,
@ -40,9 +38,9 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message
if ((isLight && cellRef.mChargeFloat < -1) || (!isLight && cellRef.mChargeInt < -1)) {
std::string str = " has invalid charge ";
if (localIndex.second == CSMWorld::UniversalId::Type_Light)
str += boost::lexical_cast<std::string>(cellRef.mChargeFloat);
str += std::to_string(cellRef.mChargeFloat);
else
str += boost::lexical_cast<std::string>(cellRef.mChargeInt);
str += std::to_string(cellRef.mChargeInt);
messages.push_back(std::make_pair(id, id.getId() + str));
}
}
@ -66,9 +64,9 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message
// Check item's faction rank
if (hasFaction && cellRef.mFactionRank < -1)
messages.push_back(std::make_pair(id, " has faction set but has invalid faction rank " + boost::lexical_cast<std::string>(cellRef.mFactionRank)));
messages.push_back(std::make_pair(id, " has faction set but has invalid faction rank " + std::to_string(cellRef.mFactionRank)));
else if (!hasFaction && cellRef.mFactionRank != -2)
messages.push_back(std::make_pair(id, " has invalid faction rank " + boost::lexical_cast<std::string>(cellRef.mFactionRank)));
messages.push_back(std::make_pair(id, " has invalid faction rank " + std::to_string(cellRef.mFactionRank)));
// If door have destination cell, check if that reference is valid
if (!cellRef.mDestCell.empty())
@ -79,7 +77,7 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message
if (cellRef.mScale < 0)
{
std::string str = " has negative scale ";
str += boost::lexical_cast<std::string>(cellRef.mScale);
str += std::to_string(cellRef.mScale);
messages.push_back(std::make_pair(id, id.getId() + str));
}
@ -87,7 +85,7 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message
if (cellRef.mEnchantmentCharge < 0 && cellRef.mEnchantmentCharge != -1)
{
std::string str = " has negative enchantment points ";
str += boost::lexical_cast<std::string>(cellRef.mEnchantmentCharge);
str += std::to_string(cellRef.mEnchantmentCharge);
messages.push_back(std::make_pair(id, id.getId() + str));
}

@ -216,7 +216,7 @@ void CSMTools::Tools::runSearch (const CSMWorld::UniversalId& searchId, const Se
mSearch.start();
}
void CSMTools::Tools::runMerge (std::auto_ptr<CSMDoc::Document> target)
void CSMTools::Tools::runMerge (std::unique_ptr<CSMDoc::Document> target)
{
// not setting an active report, because merge does not produce messages
@ -230,7 +230,7 @@ void CSMTools::Tools::runMerge (std::auto_ptr<CSMDoc::Document> target)
target->flagAsDirty();
mMergeOperation->setTarget (target);
mMergeOperation->setTarget (std::move(target));
mMerge.start();
}

@ -77,7 +77,7 @@ namespace CSMTools
void runSearch (const CSMWorld::UniversalId& searchId, const Search& search);
void runMerge (std::auto_ptr<CSMDoc::Document> target);
void runMerge (std::unique_ptr<CSMDoc::Document> target);
void abortOperation (int type);
///< \attention The operation is not aborted immediately.

@ -5,8 +5,6 @@
#include <sstream>
#include <stdexcept>
#include <boost/lexical_cast.hpp>
#include <QColor>
#include <components/esm/loadbody.hpp>

@ -138,7 +138,7 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *model, cons
if (mLocked)
return;
std::auto_ptr<CSMWorld::UpdateCellCommand> modifyCell;
std::unique_ptr<CSMWorld::UpdateCellCommand> modifyCell;
int columnId = model->data (index, ColumnBase::Role_ColumnId).toInt();
@ -167,7 +167,7 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *model, cons
}
}
std::auto_ptr<CSMWorld::ModifyCommand> modifyData (
std::unique_ptr<CSMWorld::ModifyCommand> modifyData (
new CSMWorld::ModifyCommand (*model, index, new_));
if (modifyCell.get())

@ -11,6 +11,8 @@
#include <components/esm/cellref.hpp>
#include <components/resource/scenemanager.hpp>
#include <components/vfs/manager.hpp>
#include <components/vfs/registerarchives.hpp>
#include "idtable.hpp"
#include "idtree.hpp"
@ -61,11 +63,18 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec
return number;
}
CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir)
CSMWorld::Data::Data (ToUTF8::FromType encoding, bool fsStrict, const Files::PathContainer& dataPaths,
const std::vector<std::string>& archives, const Fallback::Map* fallback, const boost::filesystem::path& resDir)
: mEncoder (encoding), mPathgrids (mCells), mRefs (mCells),
mResourcesManager (resourcesManager), mFallbackMap(fallback),
mReader (0), mDialogue (0), mReaderIndex(1), mResourceSystem(new Resource::ResourceSystem(resourcesManager.getVFS()))
mFallbackMap(fallback), mReader (0), mDialogue (0), mReaderIndex(1),
mFsStrict(fsStrict), mDataPaths(dataPaths), mArchives(archives)
{
mVFS.reset(new VFS::Manager(mFsStrict));
VFS::registerArchives(mVFS.get(), Files::Collections(mDataPaths, !mFsStrict), mArchives, true);
mResourcesManager.setVFS(mVFS.get());
mResourceSystem.reset(new Resource::ResourceSystem(mVFS.get()));
mResourceSystem->getSceneManager()->setShaderPath((resDir / "shaders").string());
int index = 0;
@ -327,7 +336,7 @@ CSMWorld::Data::Data (ToUTF8::FromType encoding, const ResourcesManager& resourc
mCells.getNestableColumn(index)->addColumn(
new NestedChildColumn (Columns::ColumnId_WaterLevel, ColumnBase::Display_Float));
mCells.getNestableColumn(index)->addColumn(
new NestedChildColumn (Columns::ColumnId_MapColor, ColumnBase::Display_Integer));
new NestedChildColumn (Columns::ColumnId_MapColor, ColumnBase::Display_Colour));
mEnchantments.addColumn (new StringIdColumn<ESM::Enchantment>);
mEnchantments.addColumn (new RecordStateColumn<ESM::Enchantment>);
@ -554,12 +563,12 @@ CSMWorld::Data::~Data()
delete mReader;
}
boost::shared_ptr<Resource::ResourceSystem> CSMWorld::Data::getResourceSystem()
std::shared_ptr<Resource::ResourceSystem> CSMWorld::Data::getResourceSystem()
{
return mResourceSystem;
}
boost::shared_ptr<const Resource::ResourceSystem> CSMWorld::Data::getResourceSystem() const
std::shared_ptr<const Resource::ResourceSystem> CSMWorld::Data::getResourceSystem() const
{
return mResourceSystem;
}
@ -891,7 +900,7 @@ void CSMWorld::Data::merge()
int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base, bool project)
{
// Don't delete the Reader yet. Some record types store a reference to the Reader to handle on-demand loading
boost::shared_ptr<ESM::ESMReader> ptr(mReader);
std::shared_ptr<ESM::ESMReader> ptr(mReader);
mReaders.push_back(ptr);
mReader = 0;
@ -945,7 +954,7 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Messages& messages)
// Don't delete the Reader yet. Some record types store a reference to the Reader to handle on-demand loading.
// We don't store non-base reader, because everything going into modified will be
// fully loaded during the initial loading process.
boost::shared_ptr<ESM::ESMReader> ptr(mReader);
std::shared_ptr<ESM::ESMReader> ptr(mReader);
mReaders.push_back(ptr);
}
else
@ -1215,6 +1224,43 @@ std::vector<std::string> CSMWorld::Data::getIds (bool listDeleted) const
return ids;
}
void CSMWorld::Data::assetsChanged()
{
mVFS.get()->reset();
VFS::registerArchives(mVFS.get(), Files::Collections(mDataPaths, !mFsStrict), mArchives, true);
const UniversalId assetTableIds[] = {
UniversalId::Type_Meshes,
UniversalId::Type_Icons,
UniversalId::Type_Musics,
UniversalId::Type_SoundsRes,
UniversalId::Type_Textures,
UniversalId::Type_Videos
};
size_t numAssetTables = sizeof(assetTableIds) / sizeof(UniversalId);
for (size_t i = 0; i < numAssetTables; ++i)
{
ResourceTable* table = static_cast<ResourceTable*>(getTableModel(assetTableIds[i]));
table->beginReset();
}
// Trigger recreation
mResourcesManager.recreateResources();
for (size_t i = 0; i < numAssetTables; ++i)
{
ResourceTable* table = static_cast<ResourceTable*>(getTableModel(assetTableIds[i]));
table->endReset();
}
// Get rid of potentially old cached assets
mResourceSystem->clearCache();
emit assetTablesChanged();
}
void CSMWorld::Data::dataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight)
{
if (topLeft.column()<=0)
@ -1228,7 +1274,7 @@ void CSMWorld::Data::rowsChanged (const QModelIndex& parent, int start, int end)
const VFS::Manager* CSMWorld::Data::getVFS() const
{
return mResourcesManager.getVFS();
return mVFS.get();
}
const Fallback::Map* CSMWorld::Data::getFallbackMap() const

@ -31,6 +31,7 @@
#include <components/resource/resourcesystem.hpp>
#include <components/files/multidircollection.hpp>
#include <components/to_utf8/to_utf8.hpp>
#include "../doc/stage.hpp"
@ -46,6 +47,7 @@
#include "infocollection.hpp"
#include "nestedinfocollection.hpp"
#include "pathgrid.hpp"
#include "resourcesmanager.hpp"
#include "metadata.hpp"
#ifndef Q_MOC_RUN
#include "subcellcollection.hpp"
@ -108,7 +110,6 @@ namespace CSMWorld
RefCollection mRefs;
IdCollection<ESM::Filter> mFilters;
Collection<MetaData> mMetaData;
const ResourcesManager& mResourcesManager;
const Fallback::Map* mFallbackMap;
std::vector<QAbstractItemModel *> mModels;
std::map<UniversalId::Type, QAbstractItemModel *> mModelIndex;
@ -119,9 +120,14 @@ namespace CSMWorld
std::map<std::string, std::map<ESM::RefNum, std::string> > mRefLoadCache;
int mReaderIndex;
boost::shared_ptr<Resource::ResourceSystem> mResourceSystem;
bool mFsStrict;
Files::PathContainer mDataPaths;
std::vector<std::string> mArchives;
std::unique_ptr<VFS::Manager> mVFS;
ResourcesManager mResourcesManager;
std::shared_ptr<Resource::ResourceSystem> mResourceSystem;
std::vector<boost::shared_ptr<ESM::ESMReader> > mReaders;
std::vector<std::shared_ptr<ESM::ESMReader> > mReaders;
std::map<std::string, int> mContentFileNames;
@ -140,7 +146,9 @@ namespace CSMWorld
public:
Data (ToUTF8::FromType encoding, const ResourcesManager& resourcesManager, const Fallback::Map* fallback, const boost::filesystem::path& resDir);
Data (ToUTF8::FromType encoding, bool fsStrict, const Files::PathContainer& dataPaths,
const std::vector<std::string>& archives, const Fallback::Map* fallback,
const boost::filesystem::path& resDir);
virtual ~Data();
@ -148,9 +156,9 @@ namespace CSMWorld
const Fallback::Map* getFallbackMap() const;
boost::shared_ptr<Resource::ResourceSystem> getResourceSystem();
std::shared_ptr<Resource::ResourceSystem> getResourceSystem();
boost::shared_ptr<const Resource::ResourceSystem> getResourceSystem() const;
std::shared_ptr<const Resource::ResourceSystem> getResourceSystem() const;
const IdCollection<ESM::Global>& getGlobals() const;
@ -304,8 +312,12 @@ namespace CSMWorld
void idListChanged();
void assetTablesChanged();
private slots:
void assetsChanged();
void dataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);
void rowsChanged (const QModelIndex& parent, int start, int end);

@ -1,7 +1,5 @@
#include "idcompletionmanager.hpp"
#include <boost/make_shared.hpp>
#include <QCompleter>
#include "../../view/widget/completerpopup.hpp"
@ -77,7 +75,7 @@ bool CSMWorld::IdCompletionManager::hasCompleterFor(CSMWorld::ColumnBase::Displa
return mCompleters.find(display) != mCompleters.end();
}
boost::shared_ptr<QCompleter> CSMWorld::IdCompletionManager::getCompleter(CSMWorld::ColumnBase::Display display)
std::shared_ptr<QCompleter> CSMWorld::IdCompletionManager::getCompleter(CSMWorld::ColumnBase::Display display)
{
if (!hasCompleterFor(display))
{
@ -99,7 +97,7 @@ void CSMWorld::IdCompletionManager::generateCompleters(CSMWorld::Data &data)
int idColumn = table->searchColumnIndex(CSMWorld::Columns::ColumnId_Id);
if (idColumn != -1)
{
boost::shared_ptr<QCompleter> completer = boost::make_shared<QCompleter>(table);
std::shared_ptr<QCompleter> completer = std::make_shared<QCompleter>(table);
completer->setCompletionColumn(idColumn);
// The completion role must be Qt::DisplayRole to get the ID values from the model
completer->setCompletionRole(Qt::DisplayRole);

@ -3,8 +3,7 @@
#include <vector>
#include <map>
#include <boost/shared_ptr.hpp>
#include <memory>
#include "columnbase.hpp"
#include "universalid.hpp"
@ -20,7 +19,7 @@ namespace CSMWorld
{
static const std::map<ColumnBase::Display, UniversalId::Type> sCompleterModelTypes;
std::map<ColumnBase::Display, boost::shared_ptr<QCompleter> > mCompleters;
std::map<ColumnBase::Display, std::shared_ptr<QCompleter> > mCompleters;
// Don't allow copying
IdCompletionManager(const IdCompletionManager &);
@ -34,7 +33,7 @@ namespace CSMWorld
IdCompletionManager(Data &data);
bool hasCompleterFor(ColumnBase::Display display) const;
boost::shared_ptr<QCompleter> getCompleter(ColumnBase::Display display);
std::shared_ptr<QCompleter> getCompleter(ColumnBase::Display display);
};
}

@ -82,7 +82,7 @@ void CSMWorld::IdTableProxyModel::setSourceModel(QAbstractItemModel *model)
SLOT(sourceDataChanged(const QModelIndex &, const QModelIndex &)));
}
void CSMWorld::IdTableProxyModel::setFilter (const boost::shared_ptr<CSMFilter::Node>& filter)
void CSMWorld::IdTableProxyModel::setFilter (const std::shared_ptr<CSMFilter::Node>& filter)
{
beginResetModel();
mFilter = filter;

@ -3,8 +3,6 @@
#include <string>
#include <boost/shared_ptr.hpp>
#include <map>
#include <QSortFilterProxyModel>
@ -19,7 +17,7 @@ namespace CSMWorld
{
Q_OBJECT
boost::shared_ptr<CSMFilter::Node> mFilter;
std::shared_ptr<CSMFilter::Node> mFilter;
std::map<int, int> mColumnMap; // column ID, column index in this model (or -1)
// Cache of enum values for enum columns (e.g. Modified, Record Type).
@ -43,7 +41,7 @@ namespace CSMWorld
virtual void setSourceModel(QAbstractItemModel *model);
void setFilter (const boost::shared_ptr<CSMFilter::Node>& filter);
void setFilter (const std::shared_ptr<CSMFilter::Node>& filter);
void refreshFilter();

@ -808,7 +808,7 @@ void CSMWorld::RefIdCollection::cloneRecord(const std::string& origin,
const std::string& destination,
const CSMWorld::UniversalId::Type type)
{
std::auto_ptr<RecordBase> newRecord(mData.getRecord(mData.searchId(origin)).modifiedCopy());
std::unique_ptr<RecordBase> newRecord(mData.getRecord(mData.searchId(origin)).modifiedCopy());
mAdapters.find(type)->second->setId(*newRecord, destination);
mData.insertRecord(*newRecord, type, destination);
}

@ -389,7 +389,7 @@ void CSMWorld::RefIdData::copyTo (int index, RefIdData& target) const
std::string id = source->getId (localIndex.first);
std::auto_ptr<CSMWorld::RecordBase> newRecord (source->getRecord (localIndex.first).modifiedCopy());
std::unique_ptr<CSMWorld::RecordBase> newRecord (source->getRecord (localIndex.first).modifiedCopy());
target.insertRecord (*newRecord, localIndex.second, id);
}

@ -12,6 +12,14 @@ CSMWorld::Resources::Resources (const VFS::Manager* vfs, const std::string& base
const char * const *extensions)
: mBaseDirectory (baseDirectory), mType (type)
{
recreate(vfs, extensions);
}
void CSMWorld::Resources::recreate(const VFS::Manager* vfs, const char * const *extensions)
{
mFiles.clear();
mIndex.clear();
int baseSize = mBaseDirectory.size();
const std::map<std::string, VFS::File*>& index = vfs->getIndex();

@ -27,6 +27,8 @@ namespace CSMWorld
Resources (const VFS::Manager* vfs, const std::string& baseDirectory, UniversalId::Type type,
const char * const *extensions = 0);
void recreate(const VFS::Manager* vfs, const char * const *extensions = 0);
int getSize() const;
std::string getId (int index) const;

@ -14,21 +14,24 @@ void CSMWorld::ResourcesManager::addResources (const Resources& resources)
resources));
}
const char * const * CSMWorld::ResourcesManager::getMeshExtensions()
{
// maybe we could go over the osgDB::Registry to list all supported node formats
static const char * const sMeshTypes[] = { "nif", "osg", "osgt", "osgb", "osgx", "osg2", 0 };
return sMeshTypes;
}
void CSMWorld::ResourcesManager::setVFS(const VFS::Manager *vfs)
{
mVFS = vfs;
mResources.clear();
// maybe we could go over the osgDB::Registry to list all supported node formats
static const char * const sMeshTypes[] = { "nif", "osg", "osgt", "osgb", "osgx", "osg2", 0 };
addResources (Resources (vfs, "meshes", UniversalId::Type_Mesh, sMeshTypes));
addResources (Resources (vfs, "meshes", UniversalId::Type_Mesh, getMeshExtensions()));
addResources (Resources (vfs, "icons", UniversalId::Type_Icon));
addResources (Resources (vfs, "music", UniversalId::Type_Music));
addResources (Resources (vfs, "sound", UniversalId::Type_SoundRes));
addResources (Resources (vfs, "textures", UniversalId::Type_Texture));
addResources (Resources (vfs, "videos", UniversalId::Type_Video));
addResources (Resources (vfs, "video", UniversalId::Type_Video));
}
const VFS::Manager* CSMWorld::ResourcesManager::getVFS() const
@ -36,6 +39,18 @@ const VFS::Manager* CSMWorld::ResourcesManager::getVFS() const
return mVFS;
}
void CSMWorld::ResourcesManager::recreateResources()
{
std::map<UniversalId::Type, Resources>::iterator it = mResources.begin();
for ( ; it != mResources.end(); ++it)
{
if (it->first == UniversalId::Type_Mesh)
it->second.recreate(mVFS, getMeshExtensions());
else
it->second.recreate(mVFS);
}
}
const CSMWorld::Resources& CSMWorld::ResourcesManager::get (UniversalId::Type type) const
{
std::map<UniversalId::Type, Resources>::const_iterator iter = mResources.find (type);

@ -22,6 +22,8 @@ namespace CSMWorld
void addResources (const Resources& resources);
const char * const * getMeshExtensions();
public:
ResourcesManager();
@ -30,6 +32,8 @@ namespace CSMWorld
void setVFS(const VFS::Manager* vfs);
void recreateResources();
const Resources& get (UniversalId::Type type) const;
};
}

@ -154,3 +154,13 @@ int CSMWorld::ResourceTable::getColumnId (int column) const
return -1;
}
void CSMWorld::ResourceTable::beginReset()
{
beginResetModel();
}
void CSMWorld::ResourceTable::endReset()
{
endResetModel();
}

@ -52,7 +52,12 @@ namespace CSMWorld
/// Is \a id flagged as deleted?
virtual bool isDeleted (const std::string& id) const;
virtual int getColumnId (int column) const;
virtual int getColumnId (int column) const;
/// Signal Qt that the data is about to change.
void beginReset();
/// Signal Qt that the data has been changed.
void endReset();
};
}

@ -1,8 +1,5 @@
#include "adjusterwidget.hpp"
#include <stdexcept>
#include <string>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string/case_conv.hpp>

@ -284,6 +284,13 @@ void CSVDoc::View::setupAssetsMenu()
{
QMenu *assets = menuBar()->addMenu (tr ("Assets"));
QAction *reload = new QAction (tr ("Reload"), this);
connect (reload, SIGNAL (triggered()), &mDocument->getData(), SLOT (assetsChanged()));
setupShortcut("document-assets-reload", reload);
assets->addAction (reload);
assets->addSeparator();
QAction *sounds = new QAction (tr ("Sounds"), this);
connect (sounds, SIGNAL (triggered()), this, SLOT (addSoundsSubView()));
setupShortcut("document-assets-sounds", sounds);

@ -1,8 +1,6 @@
#ifndef CSV_FILTER_EDITWIDGET_H
#define CSV_FILTER_EDITWIDGET_H
#include <boost/shared_ptr.hpp>
#include <QLineEdit>
#include <QPalette>
#include <QtCore/qnamespace.h>
@ -38,7 +36,7 @@ namespace CSVFilter
signals:
void filterChanged (boost::shared_ptr<CSMFilter::Node> filter);
void filterChanged (std::shared_ptr<CSMFilter::Node> filter);
private:
std::string generateFilter(std::pair<std::string, std::vector<std::string> >& seekedString) const;

@ -21,8 +21,8 @@ CSVFilter::FilterBox::FilterBox (CSMWorld::Data& data, QWidget *parent)
setLayout (layout);
connect (mRecordFilterBox,
SIGNAL (filterChanged (boost::shared_ptr<CSMFilter::Node>)),
this, SIGNAL (recordFilterChanged (boost::shared_ptr<CSMFilter::Node>)));
SIGNAL (filterChanged (std::shared_ptr<CSMFilter::Node>)),
this, SIGNAL (recordFilterChanged (std::shared_ptr<CSMFilter::Node>)));
setAcceptDrops(true);
}

@ -41,7 +41,7 @@ namespace CSVFilter
void dragMoveEvent(QDragMoveEvent *event);
signals:
void recordFilterChanged (boost::shared_ptr<CSMFilter::Node> filter);
void recordFilterChanged (std::shared_ptr<CSMFilter::Node> filter);
void recordDropped (std::vector<CSMWorld::UniversalId>& types, Qt::DropAction action);
};

@ -23,8 +23,8 @@ CSVFilter::RecordFilterBox::RecordFilterBox (CSMWorld::Data& data, QWidget *pare
setLayout (layout);
connect (
mEdit, SIGNAL (filterChanged (boost::shared_ptr<CSMFilter::Node>)),
this, SIGNAL (filterChanged (boost::shared_ptr<CSMFilter::Node>)));
mEdit, SIGNAL (filterChanged (std::shared_ptr<CSMFilter::Node>)),
this, SIGNAL (filterChanged (std::shared_ptr<CSMFilter::Node>)));
}
void CSVFilter::RecordFilterBox::setFilter (const std::string& filter)

@ -1,8 +1,6 @@
#ifndef CSV_FILTER_RECORDFILTERBOX_H
#define CSV_FILTER_RECORDFILTERBOX_H
#include <boost/shared_ptr.hpp>
#include <QWidget>
#include <QtCore/qnamespace.h>
@ -38,7 +36,7 @@ namespace CSVFilter
signals:
void filterChanged (boost::shared_ptr<CSMFilter::Node> filter);
void filterChanged (std::shared_ptr<CSMFilter::Node> filter);
};
}

@ -0,0 +1,44 @@
#include "contextmenulist.hpp"
#include <QMenu>
#include <QContextMenuEvent>
#include <QMouseEvent>
#include "../../model/prefs/state.hpp"
CSVPrefs::ContextMenuList::ContextMenuList(QWidget* parent)
:QListWidget(parent)
{
}
void CSVPrefs::ContextMenuList::contextMenuEvent(QContextMenuEvent* e)
{
QMenu* menu = new QMenu();
menu->addAction("Reset category to default", this, SLOT(resetCategory()));
menu->addAction("Reset all to default", this, SLOT(resetAll()));
menu->exec(e->globalPos());
delete menu;
}
void CSVPrefs::ContextMenuList::mousePressEvent(QMouseEvent* e)
{
// enable all buttons except right click
// This means that when right-clicking to enable the
// context menu, the page doesn't switch at the same time.
if (!(e->buttons() & Qt::RightButton))
{
QListWidget::mousePressEvent(e);
}
}
void CSVPrefs::ContextMenuList::resetCategory()
{
CSMPrefs::State::get().resetCategory(currentItem()->text().toStdString());
}
void CSVPrefs::ContextMenuList::resetAll()
{
CSMPrefs::State::get().resetAll();
}

@ -0,0 +1,33 @@
#ifndef CSV_PREFS_CONTEXTMENULIST_H
#define CSV_PREFS_CONTEXTMENULIST_H
#include <QListWidget>
class QContextMenuEvent;
class QMouseEvent;
namespace CSVPrefs
{
class ContextMenuList : public QListWidget
{
Q_OBJECT
public:
ContextMenuList(QWidget* parent = 0);
protected:
void contextMenuEvent(QContextMenuEvent* e);
void mousePressEvent(QMouseEvent* e);
private slots:
void resetCategory();
void resetAll();
};
}
#endif

@ -12,16 +12,17 @@
#include "page.hpp"
#include "keybindingpage.hpp"
#include "contextmenulist.hpp"
void CSVPrefs::Dialogue::buildCategorySelector (QSplitter *main)
{
mList = new QListWidget (main);
mList->setMinimumWidth (50);
mList->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
CSVPrefs::ContextMenuList* list = new CSVPrefs::ContextMenuList (main);
list->setMinimumWidth (50);
list->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
mList->setSelectionBehavior (QAbstractItemView::SelectItems);
list->setSelectionBehavior (QAbstractItemView::SelectItems);
main->addWidget (mList);
main->addWidget (list);
QFontMetrics metrics (QApplication::font());
@ -33,12 +34,12 @@ void CSVPrefs::Dialogue::buildCategorySelector (QSplitter *main)
QString label = QString::fromUtf8 (iter->second.getKey().c_str());
maxWidth = std::max (maxWidth, metrics.width (label));
mList->addItem (label);
list->addItem (label);
}
mList->setMaximumWidth (maxWidth + 10);
list->setMaximumWidth (maxWidth + 10);
connect (mList, SIGNAL (currentItemChanged (QListWidgetItem *, QListWidgetItem *)),
connect (list, SIGNAL (currentItemChanged (QListWidgetItem *, QListWidgetItem *)),
this, SLOT (selectionChanged (QListWidgetItem *, QListWidgetItem *)));
}

@ -16,7 +16,6 @@ namespace CSVPrefs
{
Q_OBJECT
QListWidget *mList;
QStackedWidget *mContent;
private:

@ -1,7 +1,11 @@
#include "pagebase.hpp"
#include <QMenu>
#include <QContextMenuEvent>
#include "../../model/prefs/category.hpp"
#include "../../model/prefs/state.hpp"
CSVPrefs::PageBase::PageBase (CSMPrefs::Category& category, QWidget *parent)
: QScrollArea (parent), mCategory (category)
@ -11,3 +15,24 @@ CSMPrefs::Category& CSVPrefs::PageBase::getCategory()
{
return mCategory;
}
void CSVPrefs::PageBase::contextMenuEvent(QContextMenuEvent* e)
{
QMenu* menu = new QMenu();
menu->addAction("Reset category to default", this, SLOT(resetCategory()));
menu->addAction("Reset all to default", this, SLOT(resetAll()));
menu->exec(e->globalPos());
delete menu;
}
void CSVPrefs::PageBase::resetCategory()
{
CSMPrefs::State::get().resetCategory(getCategory().getKey());
}
void CSVPrefs::PageBase::resetAll()
{
CSMPrefs::State::get().resetAll();
}

@ -3,6 +3,8 @@
#include <QScrollArea>
class QContextMenuEvent;
namespace CSMPrefs
{
class Category;
@ -21,6 +23,16 @@ namespace CSVPrefs
PageBase (CSMPrefs::Category& category, QWidget *parent);
CSMPrefs::Category& getCategory();
protected:
void contextMenuEvent(QContextMenuEvent*);
private slots:
void resetCategory();
void resetAll();
};
}

@ -62,7 +62,7 @@ bool CSVRender::Cell::addObjects (int start, int end)
{
std::string id = Misc::StringUtils::lowerCase (collection.getRecord (i).get().mId);
std::auto_ptr<Object> object (new Object (mData, mCellNode, id, false));
std::unique_ptr<Object> object (new Object (mData, mCellNode, id, false));
if (mSubModeElementMask & Mask_Reference)
object->setSubMode (mSubMode);
@ -283,6 +283,24 @@ void CSVRender::Cell::pathgridRemoved()
mPathgrid->removeGeometry();
}
void CSVRender::Cell::reloadAssets()
{
for (std::map<std::string, Object *>::const_iterator iter (mObjects.begin());
iter != mObjects.end(); ++iter)
{
iter->second->reloadAssets();
}
if (mTerrain)
{
mTerrain->unloadCell(mCoordinates.getX(), mCoordinates.getY());
mTerrain->loadCell(mCoordinates.getX(), mCoordinates.getY());
}
if (mCellWater)
mCellWater->reloadAssets();
}
void CSVRender::Cell::setSelection (int elementMask, Selection mode)
{
if (elementMask & Mask_Reference)

@ -47,13 +47,13 @@ namespace CSVRender
std::string mId;
osg::ref_ptr<osg::Group> mCellNode;
std::map<std::string, Object *> mObjects;
std::auto_ptr<Terrain::TerrainGrid> mTerrain;
std::unique_ptr<Terrain::TerrainGrid> mTerrain;
CSMWorld::CellCoordinates mCoordinates;
std::auto_ptr<CellArrow> mCellArrows[4];
std::auto_ptr<CellMarker> mCellMarker;
std::auto_ptr<CellBorder> mCellBorder;
std::auto_ptr<CellWater> mCellWater;
std::auto_ptr<Pathgrid> mPathgrid;
std::unique_ptr<CellArrow> mCellArrows[4];
std::unique_ptr<CellMarker> mCellMarker;
std::unique_ptr<CellBorder> mCellBorder;
std::unique_ptr<CellWater> mCellWater;
std::unique_ptr<Pathgrid> mPathgrid;
bool mDeleted;
int mSubMode;
unsigned int mSubModeElementMask;
@ -118,6 +118,8 @@ namespace CSVRender
void pathgridRemoved();
void reloadAssets();
void setSelection (int elementMask, Selection mode);
// Select everything that references the same ID as at least one of the elements

@ -1,15 +1,10 @@
#include "cellmarker.hpp"
#include <boost/lexical_cast.hpp>
#include <osg/AutoTransform>
#include <osg/Material>
#include <osg/Geode>
#include <osg/Group>
#include <osgText/Text>
#include "mask.hpp"
CSVRender::CellMarkerTag::CellMarkerTag(CellMarker *marker)
: TagBase(Mask_CellMarker), mMarker(marker)
{}
@ -42,8 +37,8 @@ void CSVRender::CellMarker::buildMarker()
// Add text containing cell's coordinates.
std::string coordinatesText =
boost::lexical_cast<std::string>(mCoordinates.getX()) + "," +
boost::lexical_cast<std::string>(mCoordinates.getY());
std::to_string(mCoordinates.getX()) + "," +
std::to_string(mCoordinates.getY());
markerText->setText(coordinatesText);
// Add text to marker node.

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save