logic: Fulltextsearch
* fulltextsearch enabled in sqlite * fulltextsearch start search with @ * codeview performance improved * strip sRGB profile from png files to get rid of libpng warning at runtime
@@ -36,12 +36,6 @@ else ()
|
|||||||
set(PLATFORM_INCLUDE "includesLinux.h")
|
set(PLATFORM_INCLUDE "includesLinux.h")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Settings ---------------------------------------------------------------------
|
|
||||||
|
|
||||||
if (UNIX)
|
|
||||||
add_definitions(-std=c++11 -Wno-unknown-warning-option -fcolor-diagnostics -DQT_COMPILING_QSTRING_COMPAT_CPP )
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Project ----------------------------------------------------------------------
|
# Project ----------------------------------------------------------------------
|
||||||
|
|
||||||
project(${PROJECT_NAME})
|
project(${PROJECT_NAME})
|
||||||
@@ -57,6 +51,15 @@ endif()
|
|||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
# Settings ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
add_definitions(-std=c++11 -Wno-unknown-warning-option -fcolor-diagnostics -DQT_COMPILING_QSTRING_COMPAT_CPP )
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# enable fts4 module for sqlite
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS4_PARENTHESIS")
|
||||||
|
|
||||||
# Clang ------------------------------------------------------------------------
|
# Clang ------------------------------------------------------------------------
|
||||||
|
|
||||||
if (UNIX AND APPLE)
|
if (UNIX AND APPLE)
|
||||||
@@ -622,6 +625,7 @@ elseif (UNIX)
|
|||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${TESTGEN_FILE}
|
OUTPUT ${TESTGEN_FILE}
|
||||||
PRE_BUILD
|
PRE_BUILD
|
||||||
|
COMMAND rm -f ${TESTGEN_FILE}
|
||||||
COMMAND cd ${PROJECT_SOURCE_DIR} && ${PYTHON_EXECUTABLE} ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE} --runner=ParenPrinter -o ${TESTGEN_FILE} ${TEST_FILES}
|
COMMAND cd ${PROJECT_SOURCE_DIR} && ${PYTHON_EXECUTABLE} ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE} --runner=ParenPrinter -o ${TESTGEN_FILE} ${TEST_FILES}
|
||||||
COMMENT "Generating unittest code with cxxtestgen"
|
COMMENT "Generating unittest code with cxxtestgen"
|
||||||
)
|
)
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 517 B |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 8.0 KiB |
|
Before Width: | Height: | Size: 1007 B After Width: | Height: | Size: 867 B |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 536 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 606 B |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 536 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 604 B |
|
Before Width: | Height: | Size: 697 B After Width: | Height: | Size: 614 B |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 541 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 618 B |
|
Before Width: | Height: | Size: 760 B After Width: | Height: | Size: 986 B |
|
Before Width: | Height: | Size: 748 B After Width: | Height: | Size: 827 B |
|
Before Width: | Height: | Size: 584 B After Width: | Height: | Size: 693 B |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 436 B After Width: | Height: | Size: 588 B |
|
Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 475 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 656 B After Width: | Height: | Size: 811 B |
|
Before Width: | Height: | Size: 697 B After Width: | Height: | Size: 614 B |
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 852 B After Width: | Height: | Size: 718 B |
|
Before Width: | Height: | Size: 546 B After Width: | Height: | Size: 699 B |
|
Before Width: | Height: | Size: 684 B After Width: | Height: | Size: 816 B |
|
Before Width: | Height: | Size: 805 B After Width: | Height: | Size: 953 B |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 8.1 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 915 B |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 925 B |
|
Before Width: | Height: | Size: 571 B After Width: | Height: | Size: 706 B |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 811 B |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 314 B After Width: | Height: | Size: 482 B |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 578 B |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 562 B |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2.8 KiB |
@@ -47,11 +47,3 @@ NetworkProtocolHelper.cpp ERROR: Failed to parse message, invalid type token
|
|||||||
NetworkProtocolHelper.cpp ERROR: Failed to parse setActiveToken message, invalid token count
|
NetworkProtocolHelper.cpp ERROR: Failed to parse setActiveToken message, invalid token count
|
||||||
Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml
|
Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml
|
||||||
Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml
|
Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_settings.xml
|
||||||
TextAccess.cpp ERROR: Could not open file path/to/test.h
|
|
||||||
TextAccess.cpp WARNING: Index 'firstLine' has to be lower or equal index 'lastLine', is 3 > 2
|
|
||||||
TextAccess.cpp WARNING: Tried to access index 10. Maximum index is 8
|
|
||||||
TextAccess.cpp WARNING: Tried to access index 10. Maximum index is 8
|
|
||||||
TextAccess.cpp WARNING: Line numbers start with one, is 0
|
|
||||||
TextAccess.cpp WARNING: Line numbers start with one, is 0
|
|
||||||
TokenLocationCollection.cpp ERROR: Can't create TokenLocation with wrong boundaries.
|
|
||||||
TokenLocationCollection.cpp ERROR: Can't create TokenLocation with wrong boundaries.
|
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ function(AddSharedToComponent componentName)
|
|||||||
DESTINATION .
|
DESTINATION .
|
||||||
COMPONENT ${componentName}
|
COMPONENT ${componentName}
|
||||||
PATTERN "log/*" EXCLUDE
|
PATTERN "log/*" EXCLUDE
|
||||||
PATTERN "projects/ignored" EXCLUDE
|
|
||||||
PATTERN "data/src" EXCLUDE
|
PATTERN "data/src" EXCLUDE
|
||||||
PATTERN "data/gui/installer" EXCLUDE
|
PATTERN "data/gui/installer" EXCLUDE
|
||||||
PATTERN "data/install" EXCLUDE
|
PATTERN "data/install" EXCLUDE
|
||||||
@@ -83,7 +82,13 @@ function(AddSharedToComponent componentName)
|
|||||||
PATTERN "ApplicationSettings_for_package.xml" EXCLUDE
|
PATTERN "ApplicationSettings_for_package.xml" EXCLUDE
|
||||||
PATTERN "ProjectSettings_template.xml" EXCLUDE
|
PATTERN "ProjectSettings_template.xml" EXCLUDE
|
||||||
PATTERN "ApplicationSettings_template.xml" EXCLUDE
|
PATTERN "ApplicationSettings_template.xml" EXCLUDE
|
||||||
PATTERN "window_settings.ini_for_package" EXCLUDE
|
PATTERN "window_settings_for_package.ini" EXCLUDE
|
||||||
|
)
|
||||||
|
|
||||||
|
INSTALL(FILES ${CMAKE_SOURCE_DIR}/bin/app/user/window_settings_for_package.ini
|
||||||
|
DESTINATION user
|
||||||
|
COMPONENT ${componentName}
|
||||||
|
RENAME window_settings.ini
|
||||||
)
|
)
|
||||||
endfunction(AddSharedToComponent)
|
endfunction(AddSharedToComponent)
|
||||||
|
|
||||||
@@ -141,32 +146,32 @@ INSTALL(PROGRAMS
|
|||||||
COMPONENT FULL
|
COMPONENT FULL
|
||||||
)
|
)
|
||||||
|
|
||||||
#INSTALL(PROGRAMS
|
INSTALL(PROGRAMS
|
||||||
#${CMAKE_SOURCE_DIR}/bin/app/Release/Coati_upx
|
${CMAKE_SOURCE_DIR}/bin/app/Release/Coati_upx
|
||||||
#DESTINATION .
|
|
||||||
#COMPONENT FULL
|
|
||||||
#RENAME Coati
|
|
||||||
#)
|
|
||||||
|
|
||||||
#INSTALL(PROGRAMS
|
|
||||||
#${CMAKE_SOURCE_DIR}/bin/app/Release/Coati_trial_upx
|
|
||||||
#DESTINATION .
|
|
||||||
#COMPONENT TRIAL
|
|
||||||
#RENAME Coati_trial
|
|
||||||
#)
|
|
||||||
|
|
||||||
INSTALL(TARGETS
|
|
||||||
${APP_PROJECT_NAME}
|
|
||||||
DESTINATION .
|
DESTINATION .
|
||||||
COMPONENT FULL
|
COMPONENT FULL
|
||||||
|
RENAME Coati
|
||||||
)
|
)
|
||||||
|
|
||||||
INSTALL(TARGETS
|
INSTALL(PROGRAMS
|
||||||
${TRIAL_PROJECT_NAME}
|
${CMAKE_SOURCE_DIR}/bin/app/Release/Coati_trial_upx
|
||||||
DESTINATION .
|
DESTINATION .
|
||||||
COMPONENT TRIAL
|
COMPONENT TRIAL
|
||||||
|
RENAME Coati_trial
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#INSTALL(TARGETS
|
||||||
|
#${APP_PROJECT_NAME}
|
||||||
|
#DESTINATION .
|
||||||
|
#COMPONENT FULL
|
||||||
|
#)
|
||||||
|
|
||||||
|
#INSTALL(TARGETS
|
||||||
|
#${TRIAL_PROJECT_NAME}
|
||||||
|
#DESTINATION .
|
||||||
|
#COMPONENT TRIAL
|
||||||
|
#)
|
||||||
|
|
||||||
# SET(CPACK_GENERATOR "DEB;TGZ")
|
# SET(CPACK_GENERATOR "DEB;TGZ")
|
||||||
SET(CPACK_GENERATOR "TGZ")
|
SET(CPACK_GENERATOR "TGZ")
|
||||||
SET(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
|
SET(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")
|
||||||
@@ -186,6 +191,7 @@ endif()
|
|||||||
|
|
||||||
SET(CPACK_PACKAGE_NAME "Coati")
|
SET(CPACK_PACKAGE_NAME "Coati")
|
||||||
SET(CPACK_PACKAGING_INSTALL_PREFIX "")
|
SET(CPACK_PACKAGING_INSTALL_PREFIX "")
|
||||||
|
SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 1)
|
||||||
SET(CPACK_PACKAGING_INSTALL_DIRECTORY "Coati")
|
SET(CPACK_PACKAGING_INSTALL_DIRECTORY "Coati")
|
||||||
SET(CPACK_PACKAGE_VERSION ${VERSION_NUMBER})
|
SET(CPACK_PACKAGE_VERSION ${VERSION_NUMBER})
|
||||||
SET(CPACK_PACKAGE_VENDOR "Coati Software")
|
SET(CPACK_PACKAGE_VENDOR "Coati Software")
|
||||||
|
|||||||
@@ -11,19 +11,19 @@
|
|||||||
# )
|
# )
|
||||||
#
|
#
|
||||||
macro(add_files var_name)
|
macro(add_files var_name)
|
||||||
file (RELATIVE_PATH _relPath "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
|
file (RELATIVE_PATH _relPath "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
|
|
||||||
foreach (_src ${ARGN})
|
foreach (_src ${ARGN})
|
||||||
if (_relPath)
|
if (_relPath)
|
||||||
list (APPEND ${var_name} "${_relPath}/${_src}")
|
list (APPEND ${var_name} "${_relPath}/${_src}")
|
||||||
else()
|
else()
|
||||||
list (APPEND ${var_name} "${_src}")
|
list (APPEND ${var_name} "${_src}")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if (_relPath)
|
if (_relPath)
|
||||||
set(${var_name} ${${var_name}} PARENT_SCOPE)
|
set(${var_name} ${${var_name}} PARENT_SCOPE)
|
||||||
else()
|
else()
|
||||||
set(${var_name} ${${var_name}})
|
set(${var_name} ${${var_name}})
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
# upx
|
# upx
|
||||||
set(upxPath ${CMAKE_CURRENT_LIST_DIR}/../bin/app/Release)
|
set(upxPath ${CMAKE_CURRENT_LIST_DIR}/../bin/app/Release)
|
||||||
|
|
||||||
message(STATUS "upx the app")
|
message(STATUS "upx the app")
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND rm ${upxPath}/Coati_upx
|
COMMAND rm ${upxPath}/Coati_upx
|
||||||
@@ -13,6 +14,9 @@ execute_process(
|
|||||||
COMMAND upx --brute ${upxPath}/Coati_trial -o ${upxPath}/Coati_trial_upx
|
COMMAND upx --brute ${upxPath}/Coati_trial -o ${upxPath}/Coati_trial_upx
|
||||||
)
|
)
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${upxPath}/Coati -z /home/vagrant/dev/license.txt
|
||||||
|
)
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${upxPath}/Coati -f -d ${upxPath}/../data/projects/tictactoe/tictactoe.coatiproject
|
COMMAND ${upxPath}/Coati -f -d ${upxPath}/../data/projects/tictactoe/tictactoe.coatiproject
|
||||||
|
|||||||
@@ -3,21 +3,22 @@
|
|||||||
# get the current directory
|
# get the current directory
|
||||||
SOURCE="${0}"
|
SOURCE="${0}"
|
||||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
SOURCE="$(readlink "$SOURCE")"
|
SOURCE="$(readlink "$SOURCE")"
|
||||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||||
done
|
done
|
||||||
COATI_PATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
COATI_PATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
|
|
||||||
#setup data folder
|
#setup data folder
|
||||||
if [ ! -d "${HOME}/.config/coati" ]; then
|
if [ ! -d "${HOME}/.config/coati" ]; then
|
||||||
# Control will enter here if $DIRECTORY doesn't exist.
|
# Control will enter here if $DIRECTORY doesn't exist.
|
||||||
mkdir -p ${HOME}/.config/coati
|
mkdir -p ${HOME}/.config/coati
|
||||||
cp $COATI_PATH/user/* ${HOME}/.config/coati/
|
echo "First start of Coati from this user, copy default configfiles to ~/.config/coati"
|
||||||
echo "First start of Coati from this user, copy default configfiles to ~/.config/coati"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cp -rn $COATI_PATH/user/* ${HOME}/.config/coati/
|
||||||
|
|
||||||
export LD_LIBRARY_PATH="$COATI_PATH/lib:LD_LIBRARY_PATH"
|
export LD_LIBRARY_PATH="$COATI_PATH/lib:LD_LIBRARY_PATH"
|
||||||
export QT_XKB_CONFIG_ROOT="/usr/share/X11/xkb:$QT_XKB_CONFIG_ROOT"
|
export QT_XKB_CONFIG_ROOT="/usr/share/X11/xkb:$QT_XKB_CONFIG_ROOT"
|
||||||
export QT_QPA_FONTDIR="$COATI_PATH/data/fonts:$QT_QPA_FONTDIR"
|
#export QT_QPA_FONTDIR="$COATI_PATH/data/fonts:$QT_QPA_FONTDIR"
|
||||||
exec $COATI_PATH/Coati $@
|
exec $COATI_PATH/Coati $@
|
||||||
|
|||||||
@@ -3,23 +3,24 @@
|
|||||||
# get the current directory
|
# get the current directory
|
||||||
SOURCE="${0}"
|
SOURCE="${0}"
|
||||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
SOURCE="$(readlink "$SOURCE")"
|
SOURCE="$(readlink "$SOURCE")"
|
||||||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||||
done
|
done
|
||||||
COATI_PATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
COATI_PATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||||
|
|
||||||
#setup data folder
|
#setup data folder
|
||||||
echo $COATI_PATH
|
echo $COATI_PATH
|
||||||
if [ ! -d "${HOME}/.config/coatitrial" ]; then
|
if [ ! -d "${HOME}/.config/coatitrial" ]; then
|
||||||
# Control will enter here if $DIRECTORY doesn't exist.
|
# Control will enter here if $DIRECTORY doesn't exist.
|
||||||
mkdir -p ${HOME}/.config/coatitrial
|
mkdir -p ${HOME}/.config/coatitrial
|
||||||
cp $COATI_PATH/user/* ${HOME}/.config/coatitrial/
|
echo "First start of Coati from this user, copy default configfiles to ~/.config/coati"
|
||||||
echo "First start of Coati from this user, copy default configfiles to ~/.config/coati"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cp -nr $COATI_PATH/user/* ${HOME}/.config/coatitrial/
|
||||||
|
|
||||||
export LD_LIBRARY_PATH="$COATI_PATH/lib:LD_LIBRARY_PATH"
|
export LD_LIBRARY_PATH="$COATI_PATH/lib:LD_LIBRARY_PATH"
|
||||||
export QT_XKB_CONFIG_ROOT="/usr/share/X11/xkb:$QT_XKB_CONFIG_ROOT"
|
export QT_XKB_CONFIG_ROOT="/usr/share/X11/xkb:$QT_XKB_CONFIG_ROOT"
|
||||||
export QT_QPA_FONTDIR="$COATI_PATH/data/fonts:$QT_QPA_FONTDIR"
|
#export QT_QPA_FONTDIR="$COATI_PATH/data/fonts:$QT_QPA_FONTDIR"
|
||||||
exec $COATI_PATH/Coati_trial
|
exec $COATI_PATH/Coati_trial
|
||||||
|
|
||||||
|
|||||||
@@ -252,6 +252,7 @@ add_files(
|
|||||||
utility/messaging/type/MessageScrollCode.h
|
utility/messaging/type/MessageScrollCode.h
|
||||||
utility/messaging/type/MessageSearch.h
|
utility/messaging/type/MessageSearch.h
|
||||||
utility/messaging/type/MessageSearchAutocomplete.h
|
utility/messaging/type/MessageSearchAutocomplete.h
|
||||||
|
utility/messaging/type/MessageSearchFullText.h
|
||||||
utility/messaging/type/MessageShowErrors.h
|
utility/messaging/type/MessageShowErrors.h
|
||||||
utility/messaging/type/MessageShowScope.h
|
utility/messaging/type/MessageShowScope.h
|
||||||
utility/messaging/type/MessageShowStartScreen.h
|
utility/messaging/type/MessageShowStartScreen.h
|
||||||
|
|||||||
@@ -238,6 +238,15 @@ void CodeController::handleMessage(MessageShowErrors* message)
|
|||||||
showContents(message);
|
showContents(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeController::handleMessage(MessageSearchFullText* message)
|
||||||
|
{
|
||||||
|
CodeView* view = getView();
|
||||||
|
std::vector<CodeSnippetParams> snippets = getSnippetsForFullTextSearch(message->searchTerm);
|
||||||
|
view->showCodeSnippets(snippets, std::vector<Id>());
|
||||||
|
|
||||||
|
showContents(message);
|
||||||
|
}
|
||||||
|
|
||||||
void CodeController::handleMessage(MessageShowScope* message)
|
void CodeController::handleMessage(MessageShowScope* message)
|
||||||
{
|
{
|
||||||
std::shared_ptr<TokenLocationCollection> collection =
|
std::shared_ptr<TokenLocationCollection> collection =
|
||||||
@@ -362,15 +371,25 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForActiveTokenLocation
|
|||||||
return fileSnippets;
|
return fileSnippets;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(std::shared_ptr<TokenLocationFile> activeTokenLocations) const
|
std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(
|
||||||
|
std::shared_ptr<TokenLocationFile> activeTokenLocations
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
return getSnippetsForFile(activeTokenLocations, m_storageAccess->getTokenLocationsForFile(activeTokenLocations->getFilePath().str()));
|
return getSnippetsForFile(
|
||||||
|
activeTokenLocations,
|
||||||
|
m_storageAccess->getTokenLocationsForFile(activeTokenLocations->getFilePath().str())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(std::shared_ptr<TokenLocationFile> activeTokenLocations, const std::shared_ptr<TokenLocationFile> fileLocations) const
|
std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(
|
||||||
|
std::shared_ptr<TokenLocationFile> activeTokenLocations,
|
||||||
|
const std::shared_ptr<TokenLocationFile> fileLocations
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
|
|
||||||
std::shared_ptr<TextAccess> textAccess = m_storageAccess->getFileContent(activeTokenLocations->getFilePath());
|
std::shared_ptr<TextAccess> textAccess = m_storageAccess->getFileContent(activeTokenLocations->getFilePath());
|
||||||
std::shared_ptr<TokenLocationFile> scopeLocations = std::make_shared<TokenLocationFile>(activeTokenLocations->getFilePath().str());
|
std::shared_ptr<TokenLocationFile> scopeLocations
|
||||||
|
= std::make_shared<TokenLocationFile>(activeTokenLocations->getFilePath().str());
|
||||||
fileLocations->forEachStartTokenLocation(
|
fileLocations->forEachStartTokenLocation(
|
||||||
[&](TokenLocation* startLoc) -> void
|
[&](TokenLocation* startLoc) -> void
|
||||||
{
|
{
|
||||||
@@ -423,9 +442,10 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(std::shared_pt
|
|||||||
|
|
||||||
ranges = fileScopedMerger.merge(atomicRanges);
|
ranges = fileScopedMerger.merge(atomicRanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int snippetExpandRange = ApplicationSettings::getInstance()->getCodeSnippetExpandRange();
|
const int snippetExpandRange = ApplicationSettings::getInstance()->getCodeSnippetExpandRange();
|
||||||
std::vector<CodeSnippetParams> snippets;
|
std::vector<CodeSnippetParams> snippets;
|
||||||
|
|
||||||
|
std::shared_ptr<TokenLocationFile> file = m_storageAccess->getTokenLocationsForFile(activeTokenLocations->getFilePath().str());
|
||||||
for (const SnippetMerger::Range& range: ranges)
|
for (const SnippetMerger::Range& range: ranges)
|
||||||
{
|
{
|
||||||
CodeSnippetParams params;
|
CodeSnippetParams params;
|
||||||
@@ -434,8 +454,7 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(std::shared_pt
|
|||||||
params.startLineNumber = std::max<int>(1, range.start.row - (range.start.strong ? 0 : snippetExpandRange));
|
params.startLineNumber = std::max<int>(1, range.start.row - (range.start.strong ? 0 : snippetExpandRange));
|
||||||
params.endLineNumber = std::min<int>(textAccess->getLineCount(), range.end.row + (range.end.strong ? 0 : snippetExpandRange));
|
params.endLineNumber = std::min<int>(textAccess->getLineCount(), range.end.row + (range.end.strong ? 0 : snippetExpandRange));
|
||||||
|
|
||||||
std::shared_ptr<TokenLocationFile> tempFile =
|
std::shared_ptr<TokenLocationFile> tempFile = file->getFilteredByLines(params.startLineNumber, params.endLineNumber);
|
||||||
m_storageAccess->getTokenLocationsForLinesInFile(activeTokenLocations->getFilePath().str(), params.startLineNumber, params.endLineNumber);
|
|
||||||
TokenLocationLine* firstUsedLine = nullptr;
|
TokenLocationLine* firstUsedLine = nullptr;
|
||||||
for (size_t i = params.startLineNumber; i <= params.endLineNumber && firstUsedLine == nullptr; i++)
|
for (size_t i = params.startLineNumber; i <= params.endLineNumber && firstUsedLine == nullptr; i++)
|
||||||
{
|
{
|
||||||
@@ -461,7 +480,6 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(std::shared_pt
|
|||||||
params.title = activeTokenLocations->getFilePath().str();
|
params.title = activeTokenLocations->getFilePath().str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TokenLocationLine* lastUsedLine = nullptr;
|
TokenLocationLine* lastUsedLine = nullptr;
|
||||||
for (size_t i = params.endLineNumber; i >= params.startLineNumber && lastUsedLine == nullptr; i--)
|
for (size_t i = params.endLineNumber; i >= params.startLineNumber && lastUsedLine == nullptr; i--)
|
||||||
{
|
{
|
||||||
@@ -495,7 +513,11 @@ std::vector<CodeSnippetParams> CodeController::getSnippetsForFile(std::shared_pt
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SnippetMerger> CodeController::buildMergerHierarchy(
|
std::shared_ptr<SnippetMerger> CodeController::buildMergerHierarchy(
|
||||||
TokenLocation* location, std::shared_ptr<TokenLocationFile> scopeLocations, SnippetMerger& fileScopedMerger, std::map<int, std::shared_ptr<SnippetMerger>>& mergers) const
|
TokenLocation* location,
|
||||||
|
std::shared_ptr<TokenLocationFile> scopeLocations,
|
||||||
|
SnippetMerger& fileScopedMerger,
|
||||||
|
std::map<int, std::shared_ptr<SnippetMerger>>& mergers
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
const TokenLocation* currentLocation = location;
|
const TokenLocation* currentLocation = location;
|
||||||
std::shared_ptr<SnippetMerger> currentMerger = std::make_shared<SnippetMerger>(
|
std::shared_ptr<SnippetMerger> currentMerger = std::make_shared<SnippetMerger>(
|
||||||
@@ -530,7 +552,10 @@ std::shared_ptr<SnippetMerger> CodeController::buildMergerHierarchy(
|
|||||||
return currentMerger;
|
return currentMerger;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<TokenLocationFile> CodeController::getTokenLocationOfParentScope(const TokenLocation* location, std::shared_ptr<TokenLocationFile> scopeLocations) const
|
std::shared_ptr<TokenLocationFile> CodeController::getTokenLocationOfParentScope(
|
||||||
|
const TokenLocation* location,
|
||||||
|
std::shared_ptr<TokenLocationFile> scopeLocations
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
const TokenLocation* parent = location;
|
const TokenLocation* parent = location;
|
||||||
const FilePath filePath = location->getFilePath();
|
const FilePath filePath = location->getFilePath();
|
||||||
@@ -545,7 +570,8 @@ std::shared_ptr<TokenLocationFile> CodeController::getTokenLocationOfParentScope
|
|||||||
{
|
{
|
||||||
parent = tokenLocation;
|
parent = tokenLocation;
|
||||||
}
|
}
|
||||||
// since tokenLocation is a start location the > location indicates the scope that is closer to the child.
|
// since tokenLocation is a start location the > location indicates the scope
|
||||||
|
// that is closer to the child.
|
||||||
else if ((*tokenLocation) > *parent)
|
else if ((*tokenLocation) > *parent)
|
||||||
{
|
{
|
||||||
parent = tokenLocation;
|
parent = tokenLocation;
|
||||||
@@ -563,6 +589,37 @@ std::shared_ptr<TokenLocationFile> CodeController::getTokenLocationOfParentScope
|
|||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<CodeSnippetParams> CodeController::getSnippetsForFullTextSearch(
|
||||||
|
const std::string& searchTerm) const
|
||||||
|
{
|
||||||
|
std::shared_ptr<TokenLocationCollection> collection =
|
||||||
|
m_storageAccess->getFullTextSearchLocations(searchTerm);
|
||||||
|
|
||||||
|
std::vector<CodeSnippetParams> snippets;
|
||||||
|
|
||||||
|
collection->forEachTokenLocationFile(
|
||||||
|
[&](std::shared_ptr<TokenLocationFile> file) -> void
|
||||||
|
{
|
||||||
|
//if (snippets.size() < 10)
|
||||||
|
{
|
||||||
|
std::vector<CodeSnippetParams> fileSnippets = getSnippetsForFile(file);
|
||||||
|
snippets.insert(snippets.end(), fileSnippets.begin(), fileSnippets.end());
|
||||||
|
}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
//CodeSnippetParams params;
|
||||||
|
//params.locationFile = file;
|
||||||
|
//params.refCount = file->getUnscopedStartTokenLocationCount();
|
||||||
|
//params.isCollapsed = true;
|
||||||
|
//snippets.push_back(params);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
addModificationTimes(snippets);
|
||||||
|
return snippets;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<CodeSnippetParams> CodeController::getSnippetsForErrorLocations(
|
std::vector<CodeSnippetParams> CodeController::getSnippetsForErrorLocations(
|
||||||
std::vector<ErrorInfo>* errors) const
|
std::vector<ErrorInfo>* errors) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "utility/messaging/type/MessageFocusIn.h"
|
#include "utility/messaging/type/MessageFocusIn.h"
|
||||||
#include "utility/messaging/type/MessageFocusOut.h"
|
#include "utility/messaging/type/MessageFocusOut.h"
|
||||||
#include "utility/messaging/type/MessageScrollCode.h"
|
#include "utility/messaging/type/MessageScrollCode.h"
|
||||||
|
#include "utility/messaging/type/MessageSearchFullText.h"
|
||||||
#include "utility/messaging/type/MessageShowErrors.h"
|
#include "utility/messaging/type/MessageShowErrors.h"
|
||||||
#include "utility/messaging/type/MessageShowScope.h"
|
#include "utility/messaging/type/MessageShowScope.h"
|
||||||
#include "utility/types.h"
|
#include "utility/types.h"
|
||||||
@@ -35,6 +36,7 @@ class CodeController
|
|||||||
, public MessageListener<MessageFocusIn>
|
, public MessageListener<MessageFocusIn>
|
||||||
, public MessageListener<MessageFocusOut>
|
, public MessageListener<MessageFocusOut>
|
||||||
, public MessageListener<MessageScrollCode>
|
, public MessageListener<MessageScrollCode>
|
||||||
|
, public MessageListener<MessageSearchFullText>
|
||||||
, public MessageListener<MessageShowErrors>
|
, public MessageListener<MessageShowErrors>
|
||||||
, public MessageListener<MessageShowScope>
|
, public MessageListener<MessageShowScope>
|
||||||
{
|
{
|
||||||
@@ -53,6 +55,7 @@ private:
|
|||||||
virtual void handleMessage(MessageFocusIn* message);
|
virtual void handleMessage(MessageFocusIn* message);
|
||||||
virtual void handleMessage(MessageFocusOut* message);
|
virtual void handleMessage(MessageFocusOut* message);
|
||||||
virtual void handleMessage(MessageScrollCode* message);
|
virtual void handleMessage(MessageScrollCode* message);
|
||||||
|
virtual void handleMessage(MessageSearchFullText* message);
|
||||||
virtual void handleMessage(MessageShowErrors* message);
|
virtual void handleMessage(MessageShowErrors* message);
|
||||||
virtual void handleMessage(MessageShowScope* message);
|
virtual void handleMessage(MessageShowScope* message);
|
||||||
|
|
||||||
@@ -66,6 +69,7 @@ private:
|
|||||||
std::vector<CodeSnippetParams> getSnippetsForFile(
|
std::vector<CodeSnippetParams> getSnippetsForFile(
|
||||||
std::shared_ptr<TokenLocationFile> activeTokenLocations, std::shared_ptr<TokenLocationFile> fileLocations) const;
|
std::shared_ptr<TokenLocationFile> activeTokenLocations, std::shared_ptr<TokenLocationFile> fileLocations) const;
|
||||||
std::vector<CodeSnippetParams> getSnippetsForFile(std::shared_ptr<TokenLocationFile> file) const;
|
std::vector<CodeSnippetParams> getSnippetsForFile(std::shared_ptr<TokenLocationFile> file) const;
|
||||||
|
std::vector<CodeSnippetParams> getSnippetsForFullTextSearch(const std::string& searchTerm) const;
|
||||||
std::shared_ptr<SnippetMerger> buildMergerHierarchy(
|
std::shared_ptr<SnippetMerger> buildMergerHierarchy(
|
||||||
TokenLocation* location, std::shared_ptr<TokenLocationFile> context, SnippetMerger& fileScopedMerger, std::map<int, std::shared_ptr<SnippetMerger>>& mergers) const;
|
TokenLocation* location, std::shared_ptr<TokenLocationFile> context, SnippetMerger& fileScopedMerger, std::map<int, std::shared_ptr<SnippetMerger>>& mergers) const;
|
||||||
std::shared_ptr<TokenLocationFile> getTokenLocationOfParentScope(const TokenLocation* location, std::shared_ptr<TokenLocationFile> context) const;
|
std::shared_ptr<TokenLocationFile> getTokenLocationOfParentScope(const TokenLocation* location, std::shared_ptr<TokenLocationFile> context) const;
|
||||||
|
|||||||
@@ -87,6 +87,11 @@ void GraphController::handleMessage(MessageFlushUpdates* message)
|
|||||||
buildGraph(message);
|
buildGraph(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphController::handleMessage(MessageSearchFullText* message)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
void GraphController::handleMessage(MessageFocusIn* message)
|
void GraphController::handleMessage(MessageFocusIn* message)
|
||||||
{
|
{
|
||||||
getView()->focusTokenIds(message->tokenIds);
|
getView()->focusTokenIds(message->tokenIds);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "utility/messaging/type/MessageGraphNodeBundleSplit.h"
|
#include "utility/messaging/type/MessageGraphNodeBundleSplit.h"
|
||||||
#include "utility/messaging/type/MessageGraphNodeExpand.h"
|
#include "utility/messaging/type/MessageGraphNodeExpand.h"
|
||||||
#include "utility/messaging/type/MessageGraphNodeMove.h"
|
#include "utility/messaging/type/MessageGraphNodeMove.h"
|
||||||
|
#include "utility/messaging/type/MessageSearchFullText.h"
|
||||||
#include "utility/messaging/type/MessageShowErrors.h"
|
#include "utility/messaging/type/MessageShowErrors.h"
|
||||||
|
|
||||||
#include "component/controller/Controller.h"
|
#include "component/controller/Controller.h"
|
||||||
@@ -36,6 +37,7 @@ class GraphController
|
|||||||
, public MessageListener<MessageGraphNodeBundleSplit>
|
, public MessageListener<MessageGraphNodeBundleSplit>
|
||||||
, public MessageListener<MessageGraphNodeExpand>
|
, public MessageListener<MessageGraphNodeExpand>
|
||||||
, public MessageListener<MessageGraphNodeMove>
|
, public MessageListener<MessageGraphNodeMove>
|
||||||
|
, public MessageListener<MessageSearchFullText>
|
||||||
, public MessageListener<MessageShowErrors>
|
, public MessageListener<MessageShowErrors>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -51,6 +53,7 @@ private:
|
|||||||
virtual void handleMessage(MessageGraphNodeBundleSplit* message);
|
virtual void handleMessage(MessageGraphNodeBundleSplit* message);
|
||||||
virtual void handleMessage(MessageGraphNodeExpand* message);
|
virtual void handleMessage(MessageGraphNodeExpand* message);
|
||||||
virtual void handleMessage(MessageGraphNodeMove* message);
|
virtual void handleMessage(MessageGraphNodeMove* message);
|
||||||
|
virtual void handleMessage(MessageSearchFullText* message);
|
||||||
virtual void handleMessage(MessageShowErrors* message);
|
virtual void handleMessage(MessageShowErrors* message);
|
||||||
|
|
||||||
GraphView* getView() const;
|
GraphView* getView() const;
|
||||||
|
|||||||
@@ -37,6 +37,13 @@ void SearchController::handleMessage(MessageSearchAutocomplete* message)
|
|||||||
getView()->setAutocompletionList(m_storageAccess->getAutocompletionMatches(message->query));
|
getView()->setAutocompletionList(m_storageAccess->getAutocompletionMatches(message->query));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SearchController::handleMessage(MessageSearchFullText* message)
|
||||||
|
{
|
||||||
|
LOG_INFO("fulltext string: \"" + message->searchTerm + "\"");
|
||||||
|
SearchMatch match("@" + message->searchTerm);
|
||||||
|
getView()->setMatches(std::vector<SearchMatch>(1, match));
|
||||||
|
}
|
||||||
|
|
||||||
void SearchController::handleMessage(MessageShowErrors* message)
|
void SearchController::handleMessage(MessageShowErrors* message)
|
||||||
{
|
{
|
||||||
SearchMatch match = SearchMatch::createCommand(SearchMatch::COMMAND_ERROR);
|
SearchMatch match = SearchMatch::createCommand(SearchMatch::COMMAND_ERROR);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "utility/messaging/type/MessageActivateTokens.h"
|
#include "utility/messaging/type/MessageActivateTokens.h"
|
||||||
#include "utility/messaging/type/MessageFind.h"
|
#include "utility/messaging/type/MessageFind.h"
|
||||||
#include "utility/messaging/type/MessageSearchAutocomplete.h"
|
#include "utility/messaging/type/MessageSearchAutocomplete.h"
|
||||||
|
#include "utility/messaging/type/MessageSearchFullText.h"
|
||||||
#include "utility/messaging/type/MessageShowErrors.h"
|
#include "utility/messaging/type/MessageShowErrors.h"
|
||||||
|
|
||||||
class StorageAccess;
|
class StorageAccess;
|
||||||
@@ -18,6 +19,7 @@ class SearchController
|
|||||||
, public MessageListener<MessageActivateTokens>
|
, public MessageListener<MessageActivateTokens>
|
||||||
, public MessageListener<MessageFind>
|
, public MessageListener<MessageFind>
|
||||||
, public MessageListener<MessageSearchAutocomplete>
|
, public MessageListener<MessageSearchAutocomplete>
|
||||||
|
, public MessageListener<MessageSearchFullText>
|
||||||
, public MessageListener<MessageShowErrors>
|
, public MessageListener<MessageShowErrors>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -29,6 +31,7 @@ private:
|
|||||||
virtual void handleMessage(MessageActivateTokens* message);
|
virtual void handleMessage(MessageActivateTokens* message);
|
||||||
virtual void handleMessage(MessageFind* message);
|
virtual void handleMessage(MessageFind* message);
|
||||||
virtual void handleMessage(MessageSearchAutocomplete* message);
|
virtual void handleMessage(MessageSearchAutocomplete* message);
|
||||||
|
virtual void handleMessage(MessageSearchFullText* message);
|
||||||
virtual void handleMessage(MessageShowErrors* message);
|
virtual void handleMessage(MessageShowErrors* message);
|
||||||
|
|
||||||
SearchView* getView();
|
SearchView* getView();
|
||||||
|
|||||||
@@ -219,6 +219,18 @@ void UndoRedoController::handleMessage(MessageSearch* message)
|
|||||||
processCommand(command);
|
processCommand(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UndoRedoController::handleMessage(MessageSearchFullText* message)
|
||||||
|
{
|
||||||
|
if (sameMessageTypeAsLast(message))// &&
|
||||||
|
//static_cast<MessageSearchFullText*>(lastMessage())->getMatchesAsString() == message->getMatchesAsString())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Command command(std::make_shared<MessageSearchFullText>(*message), Command::ORDER_ACTIVATE);
|
||||||
|
processCommand(command);
|
||||||
|
}
|
||||||
|
|
||||||
void UndoRedoController::handleMessage(MessageShowScope* message)
|
void UndoRedoController::handleMessage(MessageShowScope* message)
|
||||||
{
|
{
|
||||||
Command command(std::make_shared<MessageShowScope>(*message), Command::ORDER_ADAPT);
|
Command command(std::make_shared<MessageShowScope>(*message), Command::ORDER_ADAPT);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "utility/messaging/type/MessageRefresh.h"
|
#include "utility/messaging/type/MessageRefresh.h"
|
||||||
#include "utility/messaging/type/MessageScrollCode.h"
|
#include "utility/messaging/type/MessageScrollCode.h"
|
||||||
#include "utility/messaging/type/MessageSearch.h"
|
#include "utility/messaging/type/MessageSearch.h"
|
||||||
|
#include "utility/messaging/type/MessageSearchFullText.h"
|
||||||
#include "utility/messaging/type/MessageShowScope.h"
|
#include "utility/messaging/type/MessageShowScope.h"
|
||||||
#include "utility/messaging/type/MessageUndo.h"
|
#include "utility/messaging/type/MessageUndo.h"
|
||||||
|
|
||||||
@@ -46,6 +47,7 @@ class UndoRedoController
|
|||||||
, public MessageListener<MessageRefresh>
|
, public MessageListener<MessageRefresh>
|
||||||
, public MessageListener<MessageScrollCode>
|
, public MessageListener<MessageScrollCode>
|
||||||
, public MessageListener<MessageSearch>
|
, public MessageListener<MessageSearch>
|
||||||
|
, public MessageListener<MessageSearchFullText>
|
||||||
, public MessageListener<MessageShowScope>
|
, public MessageListener<MessageShowScope>
|
||||||
, public MessageListener<MessageUndo>
|
, public MessageListener<MessageUndo>
|
||||||
{
|
{
|
||||||
@@ -86,6 +88,7 @@ private:
|
|||||||
virtual void handleMessage(MessageRefresh* message);
|
virtual void handleMessage(MessageRefresh* message);
|
||||||
virtual void handleMessage(MessageScrollCode* message);
|
virtual void handleMessage(MessageScrollCode* message);
|
||||||
virtual void handleMessage(MessageSearch* message);
|
virtual void handleMessage(MessageSearch* message);
|
||||||
|
virtual void handleMessage(MessageSearchFullText* message);
|
||||||
virtual void handleMessage(MessageShowScope* message);
|
virtual void handleMessage(MessageShowScope* message);
|
||||||
virtual void handleMessage(MessageUndo* message);
|
virtual void handleMessage(MessageUndo* message);
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "data/graph/Node.h"
|
#include "data/graph/Node.h"
|
||||||
#include "data/location/TokenLocation.h"
|
#include "data/location/TokenLocation.h"
|
||||||
#include "data/DefinitionType.h"
|
#include "data/DefinitionType.h"
|
||||||
|
#include "data/parser/ParseLocation.h"
|
||||||
#include "data/SqliteIndex.h"
|
#include "data/SqliteIndex.h"
|
||||||
#include "utility/logging/logging.h"
|
#include "utility/logging/logging.h"
|
||||||
#include "utility/text/TextAccess.h"
|
#include "utility/text/TextAccess.h"
|
||||||
@@ -207,7 +208,8 @@ Id SqliteStorage::addError(const std::string& message, bool fatal, const std::st
|
|||||||
|
|
||||||
m_database.execDML((
|
m_database.execDML((
|
||||||
"INSERT INTO error(message, fatal, file_path, line_number, column_number) "
|
"INSERT INTO error(message, fatal, file_path, line_number, column_number) "
|
||||||
"VALUES ('" + sanitizedMessage + "', " + std::to_string(fatal) + ", '" + filePath + "', " + std::to_string(lineNumber) + ", " + std::to_string(columnNumber) + ");"
|
"VALUES ('" + sanitizedMessage + "', " + std::to_string(fatal) + ", '" + filePath +
|
||||||
|
"', " + std::to_string(lineNumber) + ", " + std::to_string(columnNumber) + ");"
|
||||||
).c_str());
|
).c_str());
|
||||||
|
|
||||||
return m_database.lastRowId();
|
return m_database.lastRowId();
|
||||||
@@ -416,6 +418,92 @@ std::vector<StorageEdge> SqliteStorage::getEdgesByTargetType(Id targetId, int ty
|
|||||||
return edges;
|
return edges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SqliteStorage::optimizeFTSTable() const
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CppSQLite3Query q = m_database.execQuery("INSERT INTO file(file) VALUES('optimize');");
|
||||||
|
}
|
||||||
|
catch(CppSQLite3Exception e)
|
||||||
|
{
|
||||||
|
LOG_ERROR(e.errorMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<ParseLocation> SqliteStorage::getFullTextSearch(const std::string& searchTerm) const
|
||||||
|
{
|
||||||
|
std::vector<ParseLocation> matches;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CppSQLite3Query q = m_database.execQuery((
|
||||||
|
"SELECT id,offsets(file) FROM file WHERE content MATCH '\"*" + searchTerm + "*\"'"
|
||||||
|
).c_str());
|
||||||
|
|
||||||
|
while(!q.eof())
|
||||||
|
{
|
||||||
|
const Id fileId = q.getIntField(0,0);
|
||||||
|
|
||||||
|
// convert the string "0 2 0 2" to int vector
|
||||||
|
std::stringstream temp_results(q.getStringField(1,0));
|
||||||
|
std::vector<int> results((std::istream_iterator<int>(temp_results)),std::istream_iterator<int>());
|
||||||
|
|
||||||
|
ParseLocation location;
|
||||||
|
location.filePath = getFileById(fileId).filePath;
|
||||||
|
std::shared_ptr<TextAccess> file = getFileContentByPath(location.filePath.str());
|
||||||
|
|
||||||
|
int charsInPreviousLines = 0;
|
||||||
|
int lineNumber = 1;
|
||||||
|
std::string line;
|
||||||
|
// results
|
||||||
|
// i ... col
|
||||||
|
// i+1 ... term
|
||||||
|
// i+2 ... offset
|
||||||
|
// i+3 ... length
|
||||||
|
line = file->getLine(lineNumber);
|
||||||
|
for (size_t i = 0; i < results.size() ; i+=4)
|
||||||
|
{
|
||||||
|
while( ((charsInPreviousLines + (int)line.length()) < results[i+2]) && results[i+1] == 0 )
|
||||||
|
{
|
||||||
|
lineNumber++;
|
||||||
|
charsInPreviousLines += line.length();
|
||||||
|
line = file->getLine(lineNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
//only set start if its the first term of the match
|
||||||
|
if ( results[i+1] == 0 )
|
||||||
|
{
|
||||||
|
location.startLineNumber = lineNumber;
|
||||||
|
// +1 to be consistent with the rest of the codebase
|
||||||
|
location.startColumnNumber = results[i+2] - charsInPreviousLines + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while( (charsInPreviousLines + (int)line.length()) < (results[i+2] + results[i+3]) )
|
||||||
|
{
|
||||||
|
lineNumber++;
|
||||||
|
charsInPreviousLines += line.length();
|
||||||
|
line = file->getLine(lineNumber);
|
||||||
|
}
|
||||||
|
|
||||||
|
location.endLineNumber = lineNumber;
|
||||||
|
location.endColumnNumber = results[i+2] + results[i+3] - charsInPreviousLines;
|
||||||
|
|
||||||
|
// add match if the next term is the first term of a match or its the last term in the file
|
||||||
|
if ( (i+4 < results.size() && results[i+5] == 0) || i+4 >= results.size() )
|
||||||
|
{
|
||||||
|
matches.push_back(location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
q.nextRow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(CppSQLite3Exception e)
|
||||||
|
{
|
||||||
|
LOG_ERROR(e.errorMessage());
|
||||||
|
}
|
||||||
|
return matches;
|
||||||
|
}
|
||||||
|
|
||||||
StorageNode SqliteStorage::getNodeById(Id id) const
|
StorageNode SqliteStorage::getNodeById(Id id) const
|
||||||
{
|
{
|
||||||
if (id != 0)
|
if (id != 0)
|
||||||
@@ -475,6 +563,23 @@ std::vector<StorageFile> SqliteStorage::getAllFiles() const
|
|||||||
return getAllFiles("");
|
return getAllFiles("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<Id> SqliteStorage::getAllFileIds() const
|
||||||
|
{
|
||||||
|
std::vector<Id> ids;
|
||||||
|
|
||||||
|
CppSQLite3Query q = m_database.execQuery(
|
||||||
|
"SELECT id FROM file;"
|
||||||
|
);
|
||||||
|
|
||||||
|
while (!q.eof())
|
||||||
|
{
|
||||||
|
ids.push_back(q.getIntField(0,0));
|
||||||
|
q.nextRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<TextAccess> SqliteStorage::getFileContentByPath(const std::string& filePath) const
|
std::shared_ptr<TextAccess> SqliteStorage::getFileContentByPath(const std::string& filePath) const
|
||||||
{
|
{
|
||||||
CppSQLite3Query q = m_database.execQuery((
|
CppSQLite3Query q = m_database.execQuery((
|
||||||
@@ -786,16 +891,24 @@ void SqliteStorage::setupTables()
|
|||||||
"CREATE INDEX IF NOT EXISTS node_serialized_name_index ON node(serialized_name);"
|
"CREATE INDEX IF NOT EXISTS node_serialized_name_index ON node(serialized_name);"
|
||||||
);
|
);
|
||||||
|
|
||||||
m_database.execDML(
|
try
|
||||||
"CREATE TABLE IF NOT EXISTS file("
|
{
|
||||||
"id INTEGER NOT NULL, "
|
m_database.execDML(
|
||||||
"path TEXT, "
|
"CREATE VIRTUAL TABLE IF NOT EXISTS file USING fts4("
|
||||||
"modification_time TEXT, "
|
//"CREATE TABLE IF NOT EXISTS file ("
|
||||||
"content TEXT, "
|
"id INTEGER NOT NULL, "
|
||||||
"loc INTEGER, "
|
"path TEXT, "
|
||||||
"PRIMARY KEY(id), "
|
"modification_time TEXT, "
|
||||||
"FOREIGN KEY(id) REFERENCES node(id) ON DELETE CASCADE);"
|
"content TEXT, "
|
||||||
);
|
"loc INTEGER, "
|
||||||
|
"PRIMARY KEY(id), "
|
||||||
|
"FOREIGN KEY(id) REFERENCES node(id) ON DELETE CASCADE);"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch (CppSQLite3Exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << e.errorCode() << ":" << e.errorMessage() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
m_database.execDML(
|
m_database.execDML(
|
||||||
"CREATE TABLE IF NOT EXISTS local_symbol("
|
"CREATE TABLE IF NOT EXISTS local_symbol("
|
||||||
|
|||||||
@@ -9,13 +9,14 @@
|
|||||||
|
|
||||||
#include "utility/file/FilePath.h"
|
#include "utility/file/FilePath.h"
|
||||||
#include "utility/types.h"
|
#include "utility/types.h"
|
||||||
#include "data/name/NameHierarchy.h"
|
|
||||||
#include "data/location/TokenLocationFile.h"
|
#include "data/location/TokenLocationFile.h"
|
||||||
#include "data/location/TokenLocationCollection.h"
|
#include "data/location/TokenLocationCollection.h"
|
||||||
|
#include "data/name/NameHierarchy.h"
|
||||||
#include "data/StorageTypes.h"
|
#include "data/StorageTypes.h"
|
||||||
|
|
||||||
class TextAccess;
|
class TextAccess;
|
||||||
class Version;
|
class Version;
|
||||||
|
struct ParseLocation;
|
||||||
|
|
||||||
class SqliteStorage
|
class SqliteStorage
|
||||||
{
|
{
|
||||||
@@ -83,6 +84,7 @@ public:
|
|||||||
StorageFile getFileById(const Id id) const;
|
StorageFile getFileById(const Id id) const;
|
||||||
StorageFile getFileByPath(const FilePath& filePath) const;
|
StorageFile getFileByPath(const FilePath& filePath) const;
|
||||||
|
|
||||||
|
std::vector<Id> getAllFileIds() const;
|
||||||
std::vector<StorageFile> getFilesByPaths(const std::vector<FilePath>& filePaths) const;
|
std::vector<StorageFile> getFilesByPaths(const std::vector<FilePath>& filePaths) const;
|
||||||
std::vector<StorageFile> getAllFiles() const;
|
std::vector<StorageFile> getAllFiles() const;
|
||||||
std::shared_ptr<TextAccess> getFileContentByPath(const std::string& filePath) const;
|
std::shared_ptr<TextAccess> getFileContentByPath(const std::string& filePath) const;
|
||||||
@@ -100,6 +102,9 @@ public:
|
|||||||
StorageComponentAccess getComponentAccessByMemberEdgeId(Id memberEdgeId) const;
|
StorageComponentAccess getComponentAccessByMemberEdgeId(Id memberEdgeId) const;
|
||||||
std::vector<StorageComponentAccess> getComponentAccessByMemberEdgeIds(const std::vector<Id>& memberEdgeIds) const;
|
std::vector<StorageComponentAccess> getComponentAccessByMemberEdgeIds(const std::vector<Id>& memberEdgeIds) const;
|
||||||
|
|
||||||
|
std::vector<ParseLocation> getFullTextSearch(const std::string& searchTerm) const;
|
||||||
|
void optimizeFTSTable() const;
|
||||||
|
|
||||||
std::vector<StorageCommentLocation> getCommentLocationsInFile(const FilePath& filePath) const;
|
std::vector<StorageCommentLocation> getCommentLocationsInFile(const FilePath& filePath) const;
|
||||||
std::vector<StorageError> getAllErrors() const;
|
std::vector<StorageError> getAllErrors() const;
|
||||||
std::vector<StorageError> getFatalErrors() const;
|
std::vector<StorageError> getFatalErrors() const;
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ void Storage::finishParsing()
|
|||||||
{
|
{
|
||||||
buildSearchIndex();
|
buildSearchIndex();
|
||||||
buildHierarchyCache();
|
buildHierarchyCache();
|
||||||
|
optimizeFTSTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Storage::injectData(std::shared_ptr<IntermediateStorage> injectedStorage)
|
void Storage::injectData(std::shared_ptr<IntermediateStorage> injectedStorage)
|
||||||
@@ -217,6 +218,29 @@ Node::NodeType Storage::getNodeTypeForNodeWithId(Id nodeId) const
|
|||||||
return Node::intToType(m_sqliteStorage.getNodeById(nodeId).type);
|
return Node::intToType(m_sqliteStorage.getNodeById(nodeId).type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<TokenLocationCollection> Storage::getFullTextSearchLocations(const std::string& searchTerm) const
|
||||||
|
{
|
||||||
|
std::shared_ptr<TokenLocationCollection> collection = std::make_shared<TokenLocationCollection>();
|
||||||
|
|
||||||
|
std::vector<ParseLocation> parseLocations = m_sqliteStorage.getFullTextSearch(searchTerm);
|
||||||
|
size_t i = 0;
|
||||||
|
for(ParseLocation location : parseLocations)
|
||||||
|
{
|
||||||
|
collection->addTokenLocation(
|
||||||
|
i,
|
||||||
|
0,
|
||||||
|
location.filePath,
|
||||||
|
location.startLineNumber,
|
||||||
|
location.startColumnNumber,
|
||||||
|
location.endLineNumber,
|
||||||
|
location.endColumnNumber
|
||||||
|
)->setType(LOCATION_FULLTEXTSEARCH_MATCH);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return collection;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<SearchMatch> Storage::getAutocompletionMatches(const std::string& query) const
|
std::vector<SearchMatch> Storage::getAutocompletionMatches(const std::string& query) const
|
||||||
{
|
{
|
||||||
std::vector<SearchResult> commandResults = m_commandIndex.search(query, 0);
|
std::vector<SearchResult> commandResults = m_commandIndex.search(query, 0);
|
||||||
@@ -316,7 +340,8 @@ std::vector<SearchMatch> Storage::getAutocompletionMatches(const std::string& qu
|
|||||||
match.nodeType = Node::intToType(firstNode->type);
|
match.nodeType = Node::intToType(firstNode->type);
|
||||||
match.typeName = Node::getTypeString(match.nodeType);
|
match.typeName = Node::getTypeString(match.nodeType);
|
||||||
|
|
||||||
if (intToDefinitionType(firstNode->definitionType) == DEFINITION_NONE && match.nodeType != Node::NODE_UNDEFINED)
|
if (intToDefinitionType(firstNode->definitionType) == DEFINITION_NONE
|
||||||
|
&& match.nodeType != Node::NODE_UNDEFINED)
|
||||||
{
|
{
|
||||||
match.typeName = "undefined " + match.typeName;
|
match.typeName = "undefined " + match.typeName;
|
||||||
}
|
}
|
||||||
@@ -401,6 +426,7 @@ std::shared_ptr<Graph> Storage::getGraphForActiveTokenIds(const std::vector<Id>&
|
|||||||
std::vector<Id> edgeIds;
|
std::vector<Id> edgeIds;
|
||||||
bool addAggregations = false;
|
bool addAggregations = false;
|
||||||
|
|
||||||
|
//m_sqliteStorage.getFullTextSearch("const int");
|
||||||
if (tokenIds.size() == 1)
|
if (tokenIds.size() == 1)
|
||||||
{
|
{
|
||||||
const Id elementId = tokenIds[0];
|
const Id elementId = tokenIds[0];
|
||||||
@@ -575,7 +601,9 @@ std::vector<Id> Storage::getTokenIdsForMatches(const std::vector<SearchMatch>& m
|
|||||||
{
|
{
|
||||||
for (size_t i = 0; i < match.nameHierarchies.size(); i++)
|
for (size_t i = 0; i < match.nameHierarchies.size(); i++)
|
||||||
{
|
{
|
||||||
idSet.insert(m_sqliteStorage.getNodeBySerializedName(NameHierarchy::serialize(match.nameHierarchies[i])).id);
|
idSet.insert(
|
||||||
|
m_sqliteStorage.getNodeBySerializedName(NameHierarchy::serialize(match.nameHierarchies[i])).id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -638,9 +666,10 @@ std::shared_ptr<TokenLocationCollection> Storage::getTokenLocationsForTokenIds(c
|
|||||||
|
|
||||||
std::vector<Id> fileIds;
|
std::vector<Id> fileIds;
|
||||||
std::vector<Id> nonFileIds;
|
std::vector<Id> nonFileIds;
|
||||||
|
std::vector<Id> allFileIds = m_sqliteStorage.getAllFileIds();
|
||||||
for (size_t i = 0; i < tokenIds.size(); i++)
|
for (size_t i = 0; i < tokenIds.size(); i++)
|
||||||
{
|
{
|
||||||
if (m_sqliteStorage.isFile(tokenIds[i]))
|
if (std::find(allFileIds.begin(), allFileIds.end(),tokenIds[i]) != allFileIds.end())
|
||||||
{
|
{
|
||||||
fileIds.push_back(tokenIds[i]);
|
fileIds.push_back(tokenIds[i]);
|
||||||
}
|
}
|
||||||
@@ -653,7 +682,9 @@ std::shared_ptr<TokenLocationCollection> Storage::getTokenLocationsForTokenIds(c
|
|||||||
for (Id fileId: fileIds)
|
for (Id fileId: fileIds)
|
||||||
{
|
{
|
||||||
StorageFile storageFile = m_sqliteStorage.getFileById(fileId);
|
StorageFile storageFile = m_sqliteStorage.getFileById(fileId);
|
||||||
collection->addTokenLocationFileAsPlainCopy(m_sqliteStorage.getTokenLocationsForFile(storageFile.filePath).get());
|
collection->addTokenLocationFileAsPlainCopy(
|
||||||
|
m_sqliteStorage.getTokenLocationsForFile(storageFile.filePath).get()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Cache<Id, std::string> filePathCache(
|
Cache<Id, std::string> filePathCache(
|
||||||
@@ -688,7 +719,9 @@ std::shared_ptr<TokenLocationCollection> Storage::getTokenLocationsForTokenIds(c
|
|||||||
return collection;
|
return collection;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<TokenLocationCollection> Storage::getTokenLocationsForLocationIds(const std::vector<Id>& locationIds) const
|
std::shared_ptr<TokenLocationCollection> Storage::getTokenLocationsForLocationIds(
|
||||||
|
const std::vector<Id>& locationIds
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
std::shared_ptr<TokenLocationCollection> collection = std::make_shared<TokenLocationCollection>();
|
std::shared_ptr<TokenLocationCollection> collection = std::make_shared<TokenLocationCollection>();
|
||||||
|
|
||||||
@@ -925,7 +958,11 @@ void Storage::addEdgesToGraph(const std::vector<Id>& edgeIds, Graph* graph) cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Storage::addNodesWithChildrenAndEdgesToGraph(const std::vector<Id>& nodeIds, const std::vector<Id>& edgeIds, Graph* graph) const
|
void Storage::addNodesWithChildrenAndEdgesToGraph(
|
||||||
|
const std::vector<Id>& nodeIds,
|
||||||
|
const std::vector<Id>& edgeIds,
|
||||||
|
Graph* graph
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
std::set<Id> parentNodeIds;
|
std::set<Id> parentNodeIds;
|
||||||
|
|
||||||
@@ -1099,3 +1136,8 @@ void Storage::buildHierarchyCache()
|
|||||||
m_hierarchyCache.createConnection(edge.id, edge.sourceNodeId, edge.targetNodeId, isVisible);
|
m_hierarchyCache.createConnection(edge.id, edge.sourceNodeId, edge.targetNodeId, isVisible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Storage::optimizeFTSTable()
|
||||||
|
{
|
||||||
|
m_sqliteStorage.optimizeFTSTable();
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include "data/graph/token_component/TokenComponentAccess.h"
|
#include "data/graph/token_component/TokenComponentAccess.h"
|
||||||
#include "data/location/TokenLocationCollection.h"
|
#include "data/location/TokenLocationCollection.h"
|
||||||
#include "data/parser/ParserClient.h"
|
#include "data/parser/ParserClient.h"
|
||||||
|
#include "data/parser/ParseLocation.h"
|
||||||
#include "data/search/SearchIndex.h"
|
#include "data/search/SearchIndex.h"
|
||||||
#include "data/HierarchyCache.h"
|
#include "data/HierarchyCache.h"
|
||||||
#include "data/SqliteStorage.h"
|
#include "data/SqliteStorage.h"
|
||||||
@@ -54,6 +55,7 @@ public:
|
|||||||
virtual NameHierarchy getNameHierarchyForNodeWithId(Id nodeId) const;
|
virtual NameHierarchy getNameHierarchyForNodeWithId(Id nodeId) const;
|
||||||
virtual Node::NodeType getNodeTypeForNodeWithId(Id nodeId) const;
|
virtual Node::NodeType getNodeTypeForNodeWithId(Id nodeId) const;
|
||||||
|
|
||||||
|
virtual std::shared_ptr<TokenLocationCollection> getFullTextSearchLocations(const std::string& searchTerm) const;
|
||||||
virtual std::vector<SearchMatch> getAutocompletionMatches(const std::string& query) const;
|
virtual std::vector<SearchMatch> getAutocompletionMatches(const std::string& query) const;
|
||||||
virtual std::vector<SearchMatch> getSearchMatchesForTokenIds(const std::vector<Id>& elementIds) const;
|
virtual std::vector<SearchMatch> getSearchMatchesForTokenIds(const std::vector<Id>& elementIds) const;
|
||||||
|
|
||||||
@@ -69,8 +71,12 @@ public:
|
|||||||
virtual Id getTokenIdForFileNode(const FilePath& filePath) const;
|
virtual Id getTokenIdForFileNode(const FilePath& filePath) const;
|
||||||
virtual std::vector<Id> getTokenIdsForAggregationEdge(Id sourceId, Id targetId) const;
|
virtual std::vector<Id> getTokenIdsForAggregationEdge(Id sourceId, Id targetId) const;
|
||||||
|
|
||||||
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForTokenIds(const std::vector<Id>& tokenIds) const;
|
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForTokenIds(
|
||||||
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForLocationIds(const std::vector<Id>& locationIds) const;
|
const std::vector<Id>& tokenIds
|
||||||
|
) const;
|
||||||
|
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForLocationIds(
|
||||||
|
const std::vector<Id>& locationIds
|
||||||
|
) const;
|
||||||
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForFile(const std::string& filePath) const;
|
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForFile(const std::string& filePath) const;
|
||||||
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForLinesInFile(
|
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForLinesInFile(
|
||||||
const std::string& filePath, uint firstLineNumber, uint lastLineNumber
|
const std::string& filePath, uint firstLineNumber, uint lastLineNumber
|
||||||
@@ -96,13 +102,17 @@ private:
|
|||||||
|
|
||||||
void addNodesToGraph(const std::vector<Id>& nodeIds, Graph* graph) const;
|
void addNodesToGraph(const std::vector<Id>& nodeIds, Graph* graph) const;
|
||||||
void addEdgesToGraph(const std::vector<Id>& edgeIds, Graph* graph) const;
|
void addEdgesToGraph(const std::vector<Id>& edgeIds, Graph* graph) const;
|
||||||
void addNodesWithChildrenAndEdgesToGraph(const std::vector<Id>& nodeIds, const std::vector<Id>& edgeIds, Graph* graph) const;
|
void addNodesWithChildrenAndEdgesToGraph(
|
||||||
|
const std::vector<Id>& nodeIds,
|
||||||
|
const std::vector<Id>& edgeIds, Graph* graph
|
||||||
|
) const;
|
||||||
|
|
||||||
void addAggregationEdgesToGraph(const Id nodeId, Graph* graph) const;
|
void addAggregationEdgesToGraph(const Id nodeId, Graph* graph) const;
|
||||||
void addComponentAccessToGraph(Graph* graph) const;
|
void addComponentAccessToGraph(Graph* graph) const;
|
||||||
|
|
||||||
void buildSearchIndex();
|
void buildSearchIndex();
|
||||||
void buildHierarchyCache();
|
void buildHierarchyCache();
|
||||||
|
void optimizeFTSTable();
|
||||||
|
|
||||||
void log(std::string type, std::string str, const ParseLocation& location) const;
|
void log(std::string type, std::string str, const ParseLocation& location) const;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "utility/file/FileInfo.h"
|
#include "utility/file/FileInfo.h"
|
||||||
#include "utility/file/FilePath.h"
|
#include "utility/file/FilePath.h"
|
||||||
|
|
||||||
|
#include "data/parser/ParseLocation.h"
|
||||||
#include "data/graph/Node.h"
|
#include "data/graph/Node.h"
|
||||||
#include "data/search/SearchMatch.h"
|
#include "data/search/SearchMatch.h"
|
||||||
#include "data/ErrorCountInfo.h"
|
#include "data/ErrorCountInfo.h"
|
||||||
@@ -36,6 +37,8 @@ public:
|
|||||||
virtual NameHierarchy getNameHierarchyForNodeWithId(Id id) const = 0;
|
virtual NameHierarchy getNameHierarchyForNodeWithId(Id id) const = 0;
|
||||||
virtual Node::NodeType getNodeTypeForNodeWithId(Id id) const = 0;
|
virtual Node::NodeType getNodeTypeForNodeWithId(Id id) const = 0;
|
||||||
|
|
||||||
|
virtual std::shared_ptr<TokenLocationCollection> getFullTextSearchLocations(
|
||||||
|
const std::string& searchTerm) const = 0;
|
||||||
virtual std::vector<SearchMatch> getAutocompletionMatches(const std::string& query) const = 0;
|
virtual std::vector<SearchMatch> getAutocompletionMatches(const std::string& query) const = 0;
|
||||||
virtual std::vector<SearchMatch> getSearchMatchesForTokenIds(const std::vector<Id>& tokenIds) const = 0;
|
virtual std::vector<SearchMatch> getSearchMatchesForTokenIds(const std::vector<Id>& tokenIds) const = 0;
|
||||||
|
|
||||||
@@ -51,8 +54,10 @@ public:
|
|||||||
virtual Id getTokenIdForFileNode(const FilePath& filePath) const = 0;
|
virtual Id getTokenIdForFileNode(const FilePath& filePath) const = 0;
|
||||||
virtual std::vector<Id> getTokenIdsForAggregationEdge(Id sourceId, Id targetId) const = 0;
|
virtual std::vector<Id> getTokenIdsForAggregationEdge(Id sourceId, Id targetId) const = 0;
|
||||||
|
|
||||||
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForTokenIds(const std::vector<Id>& tokenIds) const = 0;
|
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForTokenIds(
|
||||||
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForLocationIds(const std::vector<Id>& locationIds) const = 0;
|
const std::vector<Id>& tokenIds) const = 0;
|
||||||
|
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForLocationIds(
|
||||||
|
const std::vector<Id>& locationIds) const = 0;
|
||||||
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForFile(const std::string& filePath) const = 0;
|
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForFile(const std::string& filePath) const = 0;
|
||||||
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForLinesInFile(
|
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForLinesInFile(
|
||||||
const std::string& filePath, uint firstLineNumber, uint lastLineNumber) const = 0;
|
const std::string& filePath, uint firstLineNumber, uint lastLineNumber) const = 0;
|
||||||
|
|||||||
@@ -93,6 +93,17 @@ std::vector<SearchMatch> StorageAccessProxy::getAutocompletionMatches(const std:
|
|||||||
return std::vector<SearchMatch>();
|
return std::vector<SearchMatch>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getFullTextSearchLocations(
|
||||||
|
const std::string &searchTerm) const
|
||||||
|
{
|
||||||
|
if (hasSubject())
|
||||||
|
{
|
||||||
|
return m_subject->getFullTextSearchLocations(searchTerm);
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::make_shared<TokenLocationCollection>();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<SearchMatch> StorageAccessProxy::getSearchMatchesForTokenIds(const std::vector<Id>& tokenIds) const
|
std::vector<SearchMatch> StorageAccessProxy::getSearchMatchesForTokenIds(const std::vector<Id>& tokenIds) const
|
||||||
{
|
{
|
||||||
if (hasSubject())
|
if (hasSubject())
|
||||||
@@ -183,7 +194,8 @@ std::vector<Id> StorageAccessProxy::getTokenIdsForAggregationEdge(Id sourceId, I
|
|||||||
return std::vector<Id>();
|
return std::vector<Id>();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getTokenLocationsForTokenIds(const std::vector<Id>& tokenIds) const
|
std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getTokenLocationsForTokenIds(
|
||||||
|
const std::vector<Id>& tokenIds) const
|
||||||
{
|
{
|
||||||
if (hasSubject())
|
if (hasSubject())
|
||||||
{
|
{
|
||||||
@@ -193,7 +205,8 @@ std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getTokenLocationsFo
|
|||||||
return std::make_shared<TokenLocationCollection>();
|
return std::make_shared<TokenLocationCollection>();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getTokenLocationsForLocationIds(const std::vector<Id>& locationIds) const
|
std::shared_ptr<TokenLocationCollection> StorageAccessProxy::getTokenLocationsForLocationIds(
|
||||||
|
const std::vector<Id>& locationIds) const
|
||||||
{
|
{
|
||||||
if (hasSubject())
|
if (hasSubject())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ public:
|
|||||||
virtual NameHierarchy getNameHierarchyForNodeWithId(Id id) const;
|
virtual NameHierarchy getNameHierarchyForNodeWithId(Id id) const;
|
||||||
virtual Node::NodeType getNodeTypeForNodeWithId(Id id) const;
|
virtual Node::NodeType getNodeTypeForNodeWithId(Id id) const;
|
||||||
|
|
||||||
|
virtual std::shared_ptr<TokenLocationCollection> getFullTextSearchLocations(const std::string& searchTerm) const;
|
||||||
virtual std::vector<SearchMatch> getAutocompletionMatches(const std::string& query) const;
|
virtual std::vector<SearchMatch> getAutocompletionMatches(const std::string& query) const;
|
||||||
virtual std::vector<SearchMatch> getSearchMatchesForTokenIds(const std::vector<Id>& tokenIds) const;
|
virtual std::vector<SearchMatch> getSearchMatchesForTokenIds(const std::vector<Id>& tokenIds) const;
|
||||||
|
|
||||||
@@ -37,8 +38,12 @@ public:
|
|||||||
virtual Id getTokenIdForFileNode(const FilePath& filePath) const;
|
virtual Id getTokenIdForFileNode(const FilePath& filePath) const;
|
||||||
virtual std::vector<Id> getTokenIdsForAggregationEdge(Id sourceId, Id targetId) const;
|
virtual std::vector<Id> getTokenIdsForAggregationEdge(Id sourceId, Id targetId) const;
|
||||||
|
|
||||||
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForTokenIds(const std::vector<Id>& tokenIds) const;
|
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForTokenIds(
|
||||||
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForLocationIds(const std::vector<Id>& locationIds) const;
|
const std::vector<Id>& tokenIds
|
||||||
|
) const;
|
||||||
|
virtual std::shared_ptr<TokenLocationCollection> getTokenLocationsForLocationIds(
|
||||||
|
const std::vector<Id>& locationIds
|
||||||
|
) const;
|
||||||
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForFile(const std::string& filePath) const;
|
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForFile(const std::string& filePath) const;
|
||||||
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForLinesInFile(
|
virtual std::shared_ptr<TokenLocationFile> getTokenLocationsForLinesInFile(
|
||||||
const std::string& filePath, uint firstLineNumber, uint lastLineNumber
|
const std::string& filePath, uint firstLineNumber, uint lastLineNumber
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ int locationTypeToInt(LocationType type)
|
|||||||
return 1;
|
return 1;
|
||||||
case LOCATION_LOCAL_SYMBOL:
|
case LOCATION_LOCAL_SYMBOL:
|
||||||
return 2;
|
return 2;
|
||||||
|
case LOCATION_FULLTEXTSEARCH_MATCH:
|
||||||
|
return 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,6 +25,8 @@ LocationType intToLocationType(int value)
|
|||||||
return LOCATION_SCOPE;
|
return LOCATION_SCOPE;
|
||||||
case 2:
|
case 2:
|
||||||
return LOCATION_LOCAL_SYMBOL;
|
return LOCATION_LOCAL_SYMBOL;
|
||||||
|
case 3:
|
||||||
|
return LOCATION_FULLTEXTSEARCH_MATCH;
|
||||||
}
|
}
|
||||||
return LOCATION_TOKEN;
|
return LOCATION_TOKEN;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ enum LocationType
|
|||||||
{
|
{
|
||||||
LOCATION_TOKEN,
|
LOCATION_TOKEN,
|
||||||
LOCATION_SCOPE,
|
LOCATION_SCOPE,
|
||||||
LOCATION_LOCAL_SYMBOL
|
LOCATION_LOCAL_SYMBOL,
|
||||||
|
LOCATION_FULLTEXTSEARCH_MATCH
|
||||||
};
|
};
|
||||||
|
|
||||||
int locationTypeToInt(LocationType type);
|
int locationTypeToInt(LocationType type);
|
||||||
|
|||||||
@@ -182,6 +182,11 @@ bool TokenLocation::isScopeTokenLocation() const
|
|||||||
return m_type == LOCATION_SCOPE;
|
return m_type == LOCATION_SCOPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TokenLocation::isFullTextSearchMatch() const
|
||||||
|
{
|
||||||
|
return m_type == LOCATION_FULLTEXTSEARCH_MATCH;
|
||||||
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& ostream, const TokenLocation& location)
|
std::ostream& operator<<(std::ostream& ostream, const TokenLocation& location)
|
||||||
{
|
{
|
||||||
if ((&location)->isStartTokenLocation())
|
if ((&location)->isStartTokenLocation())
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public:
|
|||||||
bool isEndTokenLocation() const;
|
bool isEndTokenLocation() const;
|
||||||
|
|
||||||
bool isScopeTokenLocation() const;
|
bool isScopeTokenLocation() const;
|
||||||
|
bool isFullTextSearchMatch() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Id m_id; // own id
|
const Id m_id; // own id
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#ifndef MESSAGE_SEARCH_FULLTEXT_H
|
||||||
|
#define MESSAGE_SEARCH_FULLTEXT_H
|
||||||
|
|
||||||
|
#include "utility/messaging/Message.h"
|
||||||
|
#include "utility/types.h"
|
||||||
|
|
||||||
|
class MessageSearchFullText: public Message<MessageSearchFullText>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MessageSearchFullText(const std::string& searchTerm)
|
||||||
|
: searchTerm(searchTerm)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static const std::string getStaticType()
|
||||||
|
{
|
||||||
|
return "MessageSearchFullText";
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void print(std::ostream& os) const
|
||||||
|
{
|
||||||
|
os << searchTerm;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string searchTerm;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MESSAGE_SEARCH_FULLTEXT_H
|
||||||
@@ -907,16 +907,9 @@ const QtCodeArea::AnnotationColor& QtCodeArea::getAnnotationColorForAnnotation(c
|
|||||||
if (!s_annotationColors.size())
|
if (!s_annotationColors.size())
|
||||||
{
|
{
|
||||||
ColorScheme* scheme = ColorScheme::getInstance().get();
|
ColorScheme* scheme = ColorScheme::getInstance().get();
|
||||||
std::vector<std::string> types;
|
std::vector<std::string> types = { "token", "local_symbol", "scope", "error", "fulltextmatch"};
|
||||||
types.push_back("token");
|
|
||||||
types.push_back("local_symbol");
|
|
||||||
types.push_back("scope");
|
|
||||||
types.push_back("error");
|
|
||||||
|
|
||||||
std::vector<std::string> states;
|
std::vector<std::string> states = { "normal", "focus", "active"};
|
||||||
states.push_back("normal");
|
|
||||||
states.push_back("focus");
|
|
||||||
states.push_back("active");
|
|
||||||
|
|
||||||
for (const std::string& type : types)
|
for (const std::string& type : types)
|
||||||
{
|
{
|
||||||
@@ -945,6 +938,10 @@ const QtCodeArea::AnnotationColor& QtCodeArea::getAnnotationColorForAnnotation(c
|
|||||||
{
|
{
|
||||||
i = 9;
|
i = 9;
|
||||||
}
|
}
|
||||||
|
else if (annotation.locationType == LOCATION_FULLTEXTSEARCH_MATCH)
|
||||||
|
{
|
||||||
|
i = 12;
|
||||||
|
}
|
||||||
|
|
||||||
if (annotation.isActive)
|
if (annotation.isActive)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "utility/logging/logging.h"
|
#include "utility/logging/logging.h"
|
||||||
#include "utility/messaging/type/MessageSearch.h"
|
#include "utility/messaging/type/MessageSearch.h"
|
||||||
|
#include "utility/messaging/type/MessageSearchFullText.h"
|
||||||
#include "utility/messaging/type/MessageSearchAutocomplete.h"
|
#include "utility/messaging/type/MessageSearchAutocomplete.h"
|
||||||
#include "utility/text/TextAccess.h"
|
#include "utility/text/TextAccess.h"
|
||||||
#include "utility/utility.h"
|
#include "utility/utility.h"
|
||||||
@@ -30,6 +31,11 @@ void QtSearchElement::onChecked(bool)
|
|||||||
emit wasChecked(this);
|
emit wasChecked(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QtSmartSearchBox::fullTextSearch()
|
||||||
|
{
|
||||||
|
LOG_INFO_STREAM(<< "FullTextsearch: " << text().toStdString().substr(1));
|
||||||
|
MessageSearchFullText(text().toStdString().substr(1)).dispatch();
|
||||||
|
}
|
||||||
|
|
||||||
void QtSmartSearchBox::search()
|
void QtSmartSearchBox::search()
|
||||||
{
|
{
|
||||||
@@ -144,6 +150,11 @@ void QtSmartSearchBox::keyPressEvent(QKeyEvent* event)
|
|||||||
|
|
||||||
if (event->key() == Qt::Key_Return)
|
if (event->key() == Qt::Key_Return)
|
||||||
{
|
{
|
||||||
|
if (text().startsWith('@'))
|
||||||
|
{
|
||||||
|
fullTextSearch();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!completer()->popup()->isVisible())
|
if (!completer()->popup()->isVisible())
|
||||||
{
|
{
|
||||||
search();
|
search();
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class QtSmartSearchBox
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void search();
|
void search();
|
||||||
|
void fullTextSearch();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QtSmartSearchBox(QWidget* parent);
|
QtSmartSearchBox(QWidget* parent);
|
||||||
|
|||||||