Compare commits

...
35 Commits
Author SHA1 Message Date
Malte LangkabelandGitHub d0f9056f15 ui: move "Save Graph as Image..." up in "Edit" menu to keep "Preferences..." at the bottom (#1124)
This is done because users may already be used to "preferences" being the bottom-most button and may accidentally click "Save Graph as Image..." when they actually want to open the preferences screen.
2020-12-31 18:39:07 +01:00
Malte Langkabel a087ef9454 build: fix warning (treated as error on windows) 2020-12-31 16:27:52 +01:00
Eberhard Graether 989f174678 res: Changelog for 2020.4.32 (beta) 2020-12-16 22:50:44 +01:00
mlangkabel 3be856b1f9 build: update windows build scripts to new code signing mechanism 2020-12-14 21:01:58 +01:00
Eberhard Graether cf9534d795 res: Updated SPONSORS.md - December 2020 2020-12-08 18:58:04 +01:00
Frédéric SimonisandGitHub f70e9ecbc4 build: Add compatibility layer for Qt versions (#1118) 2020-12-07 15:34:14 +01:00
Malte LangkabelandGitHub 5cae072a02 build: Update to LLVM 11.0.0 (issue #1088) (#1116) 2020-12-01 07:53:20 +01:00
mlangkabel 1a0b564b1e ui: change text of error message if Java could not be loaded to be less narrow regarding the cause 2020-11-30 16:12:04 +01:00
Malte LangkabelandGitHub efc80fde57 logic: check if clang NamedDecl really has a name before asking for it to prevent assert (issue #1075) (#1112) 2020-11-18 19:25:12 +01:00
mlangkabel fcd2f33304 fix escaping in mvn path detector (necessary after 8b8c1866) 2020-11-18 17:44:32 +01:00
mlangkabel d3873213f1 logic: add another codeblocks related null check 2020-11-18 17:11:03 +01:00
William WoldandGitHub 4b6b58de86 logic: fix crash when using codeblocks project (issue #1109) (#1110) 2020-11-18 16:47:14 +01:00
miltolstoyandGitHub 8990eb320d logic: add menu action for graph 'save as image' (issue #426) (#1104) 2020-11-18 16:19:27 +01:00
Frédéric SimonisandGitHub 8b8c186697 src: Migrate QProcess::start() to QStringList (#1107)
The non-QStringList variant of QProcess::start() was removed in Qt 5.15.
The adapted method handles escaping of the arguments, which simplifies
code in some locations.
2020-11-18 15:45:38 +01:00
mlangkabel 4277bcc47d docs: mention PyCharm and CLion in Editor Plugins section 2020-11-18 15:30:43 +01:00
Eberhard Graether 73772365ad res: Updated SPONSORS.md - November 2020 2020-11-04 22:39:47 +01:00
miltolstoyandGitHub ad9d8d7930 logic: remember graph zoom level on restart (issue #801) (#1099) 2020-10-23 19:25:44 +02:00
Eberhard Graether a37681e58b res: Updated SPONSORS.md - October 2020 2020-10-19 22:11:42 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
3e9fd2306b build(deps-dev): bump junit (#1097)
Bumps [junit](https://github.com/junit-team/junit4) from 3.8.1 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/commits/r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-19 13:26:26 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
b86e237c0b build(deps-dev): bump junit (#1096)
Bumps [junit](https://github.com/junit-team/junit4) from 3.8.1 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/commits/r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-19 13:26:14 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
404511603d build(deps-dev): bump junit (#1095)
Bumps [junit](https://github.com/junit-team/junit4) from 3.8.1 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/commits/r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-19 13:26:03 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
744b8e3186 build(deps-dev): bump junit (#1094)
Bumps [junit](https://github.com/junit-team/junit4) from 3.8.1 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/commits/r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-19 13:25:09 +02:00
Malte LangkabelandGitHub 5795114561 build: fix compiler issue when CMAKE_CXX_COMPILER_LAUNCHER was set to ccache (issue #1081) (#1093) 2020-10-19 13:05:33 +02:00
Malte LangkabelandGitHub b54b1a6e02 data: update python indexer to v1.db25.p5 (#1087) 2020-10-05 10:02:05 +02:00
Malte LangkabelandGitHub 7dd45b586b build: replace winrar dependency by 7z (#1077) 2020-09-08 18:36:40 +02:00
Eberhard Graether a26679d6d3 res: Updated SPONSORS.md - September 2020 2020-09-08 00:04:56 +02:00
midchildanandGitHub 85329174ba test: fix expected output for c sourcegroup tests on unix (#1073)
follow-up of f3614a37 and 0294589f
2020-08-23 00:33:30 +02:00
midchildanandGitHub d079d1787c logic: explicitly add u+w permission when copying initial user data on Linux (#1072) 2020-08-23 00:31:48 +02:00
bam80andGitHub 7d51b7d917 build: fixed duplicating Sourcetrail icon on run on Linux (#1071)
fixes #1068
2020-08-21 23:58:20 +02:00
mlangkabel f3614a3745 fixed expected output for c sourcegroup tests 2020-08-17 13:41:39 +02:00
Sergei NikulovandGitHub 8e30c8b633 build: fixed issue with clang includes detection (issue #1058) (#1064) 2020-08-17 10:26:03 +02:00
Eberhard Graether cffdf6b57f res: Updated SPONSORS.md - August 2020 2020-08-10 08:17:47 +02:00
Malte LangkabelandGitHub e946c475c4 Qt 5.12 deprecation fixes (#1003) 2020-08-04 18:13:18 +02:00
Eberhard Graether ca890978ab linux: Prevent word splitting within arguments passed to Sourcetrail.sh (#1057)
closes #1057
2020-07-07 21:21:39 +02:00
5536613411 build: Support linking with LLVM/Clang Dylib instead of individual components (#1044)
Co-authored-by: serge-sans-paille <sguelton@redhat.com>
2020-07-07 10:02:28 +02:00
78 changed files with 494 additions and 285 deletions
+17
View File
@@ -1,5 +1,22 @@
### Changelog
#### 2020.4.32 (beta)
released 2020-12-16
* Build: Add compatibility layer for Qt versions ([#1118](https://github.com/CoatiSoftware/Sourcetrail/issues/1118))
* C/C++: Updated to LLVM/Clang 11.0.0 (issue [#1088](https://github.com/CoatiSoftware/Sourcetrail/issues/1088)) ([#1116](https://github.com/CoatiSoftware/Sourcetrail/issues/1116))
* C/C++: fix crash when using codeblocks project (issue [#1109](https://github.com/CoatiSoftware/Sourcetrail/issues/1109)) ([#1110](https://github.com/CoatiSoftware/Sourcetrail/issues/1110))
* Graph: add menu action for graph 'save as image' (issue [#426](https://github.com/CoatiSoftware/Sourcetrail/issues/426)) ([#1104](https://github.com/CoatiSoftware/Sourcetrail/issues/1104))
* Graph: remember graph zoom level on restart (issue [#801](https://github.com/CoatiSoftware/Sourcetrail/issues/801)) ([#1099](https://github.com/CoatiSoftware/Sourcetrail/issues/1099))
* Build: fix compiler issue when CMAKE_CXX_COMPILER_LAUNCHER was set to ccache (issue [#1081](https://github.com/CoatiSoftware/Sourcetrail/issues/1081)) ([#1093](https://github.com/CoatiSoftware/Sourcetrail/issues/1093))
* Python: update python indexer to v1.db25.p5 ([#1087](https://github.com/CoatiSoftware/Sourcetrail/issues/1087))
* Linux: explicitly add u+w permission when copying initial user data ([#1072](https://github.com/CoatiSoftware/Sourcetrail/issues/1072))
* Linux: Fixed duplicating Sourcetrail icon on run ([#1071](https://github.com/CoatiSoftware/Sourcetrail/issues/1071))
* Build: Qt 5.12 deprecation fixes ([#1003](https://github.com/CoatiSoftware/Sourcetrail/issues/1003))
* Linux: Prevent word splitting within arguments passed to Sourcetrail.sh ([#1057](https://github.com/CoatiSoftware/Sourcetrail/issues/1057))
* C/C++: Support linking with LLVM/Clang Dylib instead of individual components ([#1044](https://github.com/CoatiSoftware/Sourcetrail/issues/1044))
#### 2020.2.43
released 2020-06-29
+74 -42
View File
@@ -24,16 +24,16 @@ if (${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
message(FATAL_ERROR "Please create a separate build directory and call CMake again")
endif()
# speed up recompiling on unix with ccache
find_program(CCACHE_PROGRAM ccache)
if (CCACHE_PROGRAM)
message(STATUS "ccache found")
# Support Unix Makefiles and Ninja
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
if(NOT DEFINED CMAKE_CXX_COMPILER_LAUNCHER)
# speed up recompiling on unix with ccache
find_program(CCACHE_PROGRAM ccache)
if (CCACHE_PROGRAM)
message(STATUS "ccache found")
# Support Unix Makefiles and Ninja
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE STRING "Compiler launcher for CXX")
endif()
endif()
# Variables --------------------------------------------------------------------
set(PROJECT_NAME Sourcetrail)
@@ -138,7 +138,17 @@ if (BUILD_CXX_LANGUAGE_PACKAGE)
set (CLANG_COMPILER_HEADER_SEARCH_PATH "")
foreach(LLVM_CONFIGURATION_TYPE ${LLVM_CONFIGURATION_TYPES})
if (CLANG_COMPILER_HEADER_SEARCH_PATH STREQUAL "")
set (CLANG_COMPILER_HEADER_SEARCH_PATH "${LLVM_BINARY_DIR}/${LLVM_CONFIGURATION_TYPE}/lib/clang/${LLVM_VERSION}/include")
set (_CLANG_HEADERS_SEARCH_LIST
"${LLVM_BINARY_DIR}/${LLVM_CONFIGURATION_TYPE}/lib/clang/${LLVM_VERSION}/include"
"${LLVM_BINARY_DIR}/${LLVM_CONFIGURATION_TYPE}/lib64/clang/${LLVM_VERSION}/include"
)
foreach (_CLANG_HEADER_PATH ${_CLANG_HEADERS_SEARCH_LIST})
if (EXISTS ${_CLANG_HEADER_PATH})
set (CLANG_COMPILER_HEADER_SEARCH_PATH ${_CLANG_HEADER_PATH})
break ()
endif ()
endforeach ()
message (STATUS "Trying to find Clang compiler headers in '${LLVM_CONFIGURATION_TYPE}' build config in directory '${CLANG_COMPILER_HEADER_SEARCH_PATH}'.")
if (EXISTS ${CLANG_COMPILER_HEADER_SEARCH_PATH})
message (STATUS "Found headers for '${LLVM_CONFIGURATION_TYPE}' build config.")
@@ -170,10 +180,12 @@ find_package(Boost 1.67 COMPONENTS system program_options filesystem date_time R
# Qt ---------------------------------------------------------------------------
find_package(Qt5 COMPONENTS Widgets PrintSupport Network Svg REQUIRED)
set (QT_MIN_VERSION "5.12.0")
set (QT_MIN_VERSION_HEX 0x051200)
find_package(Qt5 ${QT_MIN_VERSION} COMPONENTS Widgets PrintSupport Network Svg REQUIRED)
if (WIN32)
find_package(Qt5 COMPONENTS WinExtras REQUIRED)
find_package(Qt5 ${QT_MIN_VERSION} COMPONENTS WinExtras REQUIRED)
endif()
if(Qt5Widgets_FOUND)
@@ -183,6 +195,18 @@ if(Qt5Widgets_FOUND)
if (Qt5_POSITION_INDEPENDENT_CODE)
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
add_definitions (-DQT_DEPRECATED_WARNINGS)
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=${QT_MIN_VERSION_HEX} # disables all the APIs deprecated at or before the specified Qt version
add_definitions (-DQT_DISABLE_DEPRECATED_BEFORE=${QT_MIN_VERSION_HEX})
endif()
@@ -359,38 +383,46 @@ if (BUILD_CXX_LANGUAGE_PACKAGE)
link_directories(${LLVM_LIBRARY_DIRS} ${CLANG_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS})
llvm_map_components_to_libnames(REQ_LLVM_LIBS
support core libdriver passes option
)
foreach(LLVM_TARGET ${LLVM_TARGETS_TO_BUILD})
get_property(lib_deps GLOBAL PROPERTY "LLVMBUILD_LIB_DEPS_LLVM${LLVM_TARGET}CodeGen")
list(APPEND REQ_LLVM_LIBS "LLVM${LLVM_TARGET}CodeGen")
list(APPEND REQ_LLVM_LIBS "${lib_deps}")
get_property(lib_deps GLOBAL PROPERTY "LLVMBUILD_LIB_DEPS_LLVM${LLVM_TARGET}AsmParser")
if (NOT "${lib_deps}" STREQUAL "")
list(APPEND REQ_LLVM_LIBS "LLVM${LLVM_TARGET}AsmParser")
list(APPEND REQ_LLVM_LIBS "${lib_deps}")
endif()
endforeach()
if(LLVM_LINK_LLVM_DYLIB)
set(REQ_LLVM_LIBS LLVM)
else()
llvm_map_components_to_libnames(REQ_LLVM_LIBS
support core libdriver passes option
)
foreach(LLVM_TARGET ${LLVM_TARGETS_TO_BUILD})
get_property(lib_deps GLOBAL PROPERTY "LLVMBUILD_LIB_DEPS_LLVM${LLVM_TARGET}CodeGen")
list(APPEND REQ_LLVM_LIBS "LLVM${LLVM_TARGET}CodeGen")
list(APPEND REQ_LLVM_LIBS "${lib_deps}")
get_property(lib_deps GLOBAL PROPERTY "LLVMBUILD_LIB_DEPS_LLVM${LLVM_TARGET}AsmParser")
if (NOT "${lib_deps}" STREQUAL "")
list(APPEND REQ_LLVM_LIBS "LLVM${LLVM_TARGET}AsmParser")
list(APPEND REQ_LLVM_LIBS "${lib_deps}")
endif()
endforeach()
endif()
set(CLANG_LIBRARIES
clangASTMatchers
clangFrontend
clangSerialization
clangDriver
clangTooling
clangParse
clangSema
clangStaticAnalyzerFrontend
clangStaticAnalyzerCheckers
clangStaticAnalyzerCore
clangAnalysis
clangRewriteFrontend
clangEdit
clangAST
clangLex
clangBasic
)
if(LLVM_LINK_LLVM_DYLIB) # Should be CLANG_LINK_CLANG_DYLIB in future LLVM release
set(CLANG_LIBRARIES clang-cpp)
else()
set(CLANG_LIBRARIES
clangASTMatchers
clangFrontend
clangSerialization
clangDriver
clangTooling
clangParse
clangSema
clangStaticAnalyzerFrontend
clangStaticAnalyzerCheckers
clangStaticAnalyzerCore
clangAnalysis
clangRewriteFrontend
clangEdit
clangAST
clangLex
clangBasic
)
endif()
target_link_libraries(${LIB_CXX_PROJECT_NAME} ${LIB_UTILITY_PROJECT_NAME} ${CLANG_LIBRARIES} ${REQ_LLVM_LIBS})
+3 -3
View File
@@ -142,9 +142,9 @@ Building Sourcetrail requires several dependencies to be in place on your machin
### Required dependencies
* __LLVM/Clang 10.0.0__
* __LLVM/Clang 11.0.0__
* __Reason__: Used for running the preprocessor on the indexedes source code, building and traversing an Abstract Syntax Tree and generating error messages.
* __Building__: Make sure to check out the correct tag: `git checkout llvmorg-10.0.0`
* __Building__: Make sure to check out the correct tag: `git checkout llvmorg-11.0.0`
* __Building for Windows__: Follow [these steps](https://clang.llvm.org/get_started.html) to build the project. Run the cmake command exactly as described.
* __Building for Unix__: Follow this [installation guide](http://clang.llvm.org/docs/LibASTMatchersTutorial.html) to build the project. Make sure to build with `-DLLVM_ENABLE_RTTI=ON`.
@@ -188,7 +188,7 @@ Building Sourcetrail requires several dependencies to be in place on your machin
### Required Tools
* __WinRAR (required for Windows)__
* __7z (required for Windows)__
* __REASON__: Used to extract the prebuilt SourcetrailPythonIndexer which is downloaded automatically during build execution.
### Building
+14 -8
View File
@@ -11,11 +11,11 @@ Sponsors [via Patreon](https://www.patreon.com/sourcetrail).
## Super Coatis
* Alexis Jeandet
* Anthony Marchini
* Anshu Mathur
* Chris Morley
* Konstantin Kirenko
* Louis St-Amour
* Mario Lioni
* Simon Pintarelli
* William Wold
## Regular Coatis
@@ -23,20 +23,26 @@ Sponsors [via Patreon](https://www.patreon.com/sourcetrail).
* Andreas
* Anton
* Bicakci, Inc.
* BJ
* Dio Lee
* Ferenc Fejes
* Frederic Simonis
* Friedrich Hunstock
* Graydon Hoare
* IndustrialRobot
* Jason Stevens
* John Borland
* kagusanto
* kale
* Kikuchi Takanori
* MangerDesPates
* Matěj Týč
* Max Bruckner
* Michael F. Schönitzer
* Nakul Dhotre
* Nathan
* Nathan Loofbourrow
* Neil Horlock
* Nick Moore
* Nils Moehrle
* Pierre Fransson
* Rémi Cohen-Scali
* Rui Pires
* Ryo Koyama
* Simon
@@ -46,9 +52,9 @@ Sponsors [via Patreon](https://www.patreon.com/sourcetrail).
* Tomi Joki-Korpela
* Tony Hong
* Werner de Groot
* X. Xu
* Yacob Cohen-Arazi
* Yang, Wenbo
* 勇男 金子
* 郝晨煜
_Note: This file will be updated at the beginning of each month._
-2
View File
@@ -12,8 +12,6 @@ install:
- ninja --version
before_build:
- choco install winrar -y
- SET "PATH=%PATH%;C:\Program Files\WinRAR"
- mkdir build
- cd build
- mkdir temp
@@ -2,6 +2,8 @@ SourceFilePath: "src/Test.c"
IndexedPath: "src"
CompilerFlag: "--target=test_arch-test_vendor-test_sys-test_abi"
CompilerFlag: "-std=c11"
CompilerFlag: "-x"
CompilerFlag: "c"
CompilerFlag: "-isystem"
CompilerFlag: "src"
CompilerFlag: "-isystem"
@@ -2,6 +2,8 @@ SourceFilePath: "src/Test.c"
IndexedPath: "src"
CompilerFlag: "--target=test_arch-test_vendor-test_sys-test_abi"
CompilerFlag: "-std=c11"
CompilerFlag: "-x"
CompilerFlag: "c"
CompilerFlag: "-isystem"
CompilerFlag: "data/cxx/include/"
CompilerFlag: "-isystem"
@@ -11,7 +11,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -18,7 +18,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -18,7 +18,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -11,7 +11,7 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -55,7 +55,7 @@ make -j8 && \
make -j8 install && rm -Rf /qt
# LLVM/Clang
ARG LLVM_VERSION=10.0.0
ARG LLVM_VERSION=11.0.0
RUN mkdir -p /llvm && cd /llvm && \
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.tar.xz && \
tar xvf llvm-project-${LLVM_VERSION}.tar.xz && \
@@ -6,7 +6,7 @@ based on our gcc Docker images
Software
--------
* Qt 5.9.1
* LLVM/Clang 5.0.0
* Boost 1.64.0
* Qt 5.12.6
* LLVM/Clang 10.0.0
* Boost 1.67.0
* Ninja
@@ -1,7 +1,7 @@
Base 64 bit Image for Sourcetrail
=================================
Based on centos:6
Based on centos:7
Software
--------
@@ -1,4 +1,4 @@
FROM coatisoftware/centos7_64_qt_llvm:qt5126-llvm1000
FROM coatisoftware/centos7_64_qt_llvm:qt5126-llvm1100
COPY entrypoint.sh /entrypoint.sh
+1 -1
View File
@@ -21,7 +21,7 @@ VERSION_STRING="${VERSION_STRING//_/.}"
VERSION_STRING="${VERSION_STRING:2}"
echo "installer version is $VERSION_STRING"
PRODUCT_GUID=$(cmd.exe /c "uuidgen")
PRODUCT_GUID=$("uuidgen")
if [ -z "$PRODUCT_GUID" ]; then
echo "Unable to generate GUID. Make sure to run this script from the Visual Studio command propmt. Aborting now."
exit 1
+1 -1
View File
@@ -2637,7 +2637,7 @@
<li>CLion</li>
<li>Eclipse</li>
<li>Emacs</li>
<li>IntelliJ IDEA</li>
<li>IntelliJ IDEA (PyCharm, CLion, etc.)</li>
<li>Qt Creator</li>
<li>Sublime Text 2</li>
<li>Sublime Text 3</li>
+6 -11
View File
@@ -59,13 +59,8 @@ DOTTED_VERSION_STRING="${VERSION_STRING//_/.}"
if [ $RUN_CODE_SIGNING = true ]; then
echo -e "$INFO Code signing is enabled. provide the key file path >"
read CODE_SIGNING_KEY_FILE
fi
if [ $RUN_CODE_SIGNING = true ]; then
echo -e "$INFO Code signing is enabled. Please enter your password >"
read CODE_SIGNING_PASSWORD
echo -e "$INFO Code signing is enabled. provide the key's sh1 thumbprint >"
read CODE_SIGNING_THUMBPRINT
fi
@@ -94,13 +89,13 @@ echo -e "$INFO Building the project"
if [ $RUN_CODE_SIGNING = true ]; then
echo -e "$INFO Signing the app"
signtool.exe sign //f $CODE_SIGNING_KEY_FILE //p $CODE_SIGNING_PASSWORD //t "http://timestamp.verisign.com/scripts/timstamp.dll" //d "Sourcetrail ${DOTTED_VERSION_STRING}" //du "https://www.sourcetrail.com/" //v build/Release/app/Sourcetrail.exe
signtool.exe sign //sha1 $CODE_SIGNING_THUMBPRINT //fd sha256 //t "http://timestamp.verisign.com/scripts/timstamp.dll" //d "Sourcetrail ${DOTTED_VERSION_STRING}" //du "https://www.sourcetrail.com/" //v build/Release/app/Sourcetrail.exe
echo -e "$INFO Signing the indexer"
signtool.exe sign //f $CODE_SIGNING_KEY_FILE //p $CODE_SIGNING_PASSWORD //t "http://timestamp.verisign.com/scripts/timstamp.dll" //d "Sourcetrail Indexer ${DOTTED_VERSION_STRING}" //du "https://www.sourcetrail.com/" //v build/Release/app/sourcetrail_indexer.exe
signtool.exe sign //sha1 $CODE_SIGNING_THUMBPRINT //fd sha256 //t "http://timestamp.verisign.com/scripts/timstamp.dll" //d "Sourcetrail Indexer ${DOTTED_VERSION_STRING}" //du "https://www.sourcetrail.com/" //v build/Release/app/sourcetrail_indexer.exe
echo -e "$INFO Signing the Python indexer"
signtool.exe sign //f $CODE_SIGNING_KEY_FILE //p $CODE_SIGNING_PASSWORD //t "http://timestamp.verisign.com/scripts/timstamp.dll" //d "Sourcetrail Python Indexer" //du "https://github.com/CoatiSoftware/SourcetrailPythonIndexer" //v bin/app/data/python/SourcetrailPythonIndexer.exe
signtool.exe sign //sha1 $CODE_SIGNING_THUMBPRINT //fd sha256 //t "http://timestamp.verisign.com/scripts/timstamp.dll" //d "Sourcetrail Python Indexer" //du "https://github.com/CoatiSoftware/SourcetrailPythonIndexer" //v bin/app/data/python/SourcetrailPythonIndexer.exe
fi
@@ -156,7 +151,7 @@ cd ../../..
if [ $RUN_CODE_SIGNING = true ]; then
echo -e "$INFO Signing the 64 bit windows installer"
signtool.exe sign //f $CODE_SIGNING_KEY_FILE //p $CODE_SIGNING_PASSWORD //t "http://timestamp.verisign.com/scripts/timstamp.dll" //d "Sourcetrail ${DOTTED_VERSION_STRING} Installer" //du "https://www.sourcetrail.com/" //v deployment/windows/wixSetup/bin/sourcetrail.msi
signtool.exe sign //sha1 $CODE_SIGNING_THUMBPRINT //fd sha256 //t "http://timestamp.verisign.com/scripts/timstamp.dll" //d "Sourcetrail ${DOTTED_VERSION_STRING} Installer" //du "https://www.sourcetrail.com/" //v deployment/windows/wixSetup/bin/sourcetrail.msi
fi
+2 -2
View File
@@ -1,6 +1,6 @@
#!/bin/bash
SOURCETRAIL_PYTHON_INDEXER_VERSION="v1_db25_p4"
SOURCETRAIL_PYTHON_INDEXER_VERSION="v1_db25_p5"
# Determine current platform
PLATFORM='unknown'
@@ -87,7 +87,7 @@ if [ $PLATFORM == "linux" ]; then
elif [ $PLATFORM == "osx" ]; then
unzip -d $TEMP_PATH $TEMP_PATH/$PACKAGE_FILE_NAME
elif [ $PLATFORM == "windows" ]; then
winrar x $TEMP_PATH/$PACKAGE_FILE_NAME $TEMP_PATH
7z x $TEMP_PATH/$PACKAGE_FILE_NAME -o$TEMP_PATH
fi
+1 -1
View File
@@ -19,4 +19,4 @@ export QT_QPA_FONTDIR="$SOURCETRAIL_PATH/data/fonts:$QT_QPA_FONTDIR"
export SOURCETRAIL_VIA_SCRIPT=1
export OPENSSL_CONF=/etc/ssl/
exec "$SOURCETRAIL_PATH/bin/sourcetrail" $@
exec "$SOURCETRAIL_PATH/bin/sourcetrail" "$@"
+1
View File
@@ -10,3 +10,4 @@ Type=Application
MimeType=application/x-sourcetrail;
Categories=Development;
StartupNotify=true
StartupWMClass=Sourcetrail
+1
View File
@@ -489,6 +489,7 @@ add_files(
utility/messaging/type/graph/MessageGraphNodeHide.h
utility/messaging/type/graph/MessageGraphNodeMove.h
utility/messaging/type/graph/MessageScrollGraph.h
utility/messaging/type/graph/MessageSaveAsImage.h
utility/messaging/type/history/MessageHistoryToPosition.h
utility/messaging/type/history/MessageHistoryRedo.h
+4 -4
View File
@@ -188,16 +188,16 @@ void TaskBuildIndex::runIndexerProcess(int processId, const std::wstring& logFil
return;
}
const std::wstring commandPath = L"\"" + indexerProcessPath.wstr() + L"\"";
const std::wstring commandPath = indexerProcessPath.wstr();
std::vector<std::wstring> commandArguments;
commandArguments.push_back(std::to_wstring(processId));
commandArguments.push_back(utility::decodeFromUtf8(m_appUUID));
commandArguments.push_back(L"\"" + AppPath::getSharedDataPath().getAbsolute().wstr() + L"\"");
commandArguments.push_back(L"\"" + UserPaths::getUserDataPath().getAbsolute().wstr() + L"\"");
commandArguments.push_back(AppPath::getSharedDataPath().getAbsolute().wstr());
commandArguments.push_back(UserPaths::getUserDataPath().getAbsolute().wstr());
if (!logFilePath.empty())
{
commandArguments.push_back(L"\"" + logFilePath + L"\"");
commandArguments.push_back(logFilePath);
}
int result = 1;
+10
View File
@@ -678,6 +678,16 @@ void ApplicationSettings::setLastFilepickerLocation(const FilePath& path)
setValue<std::wstring>("user/last_filepicker_location", path.wstr());
}
float ApplicationSettings::getGraphZoomLevel() const
{
return getValue<float>("user/graph_zoom_level", 1.0f);
}
void ApplicationSettings::setGraphZoomLevel(float zoomLevel)
{
setValue<float>("user/graph_zoom_level", zoomLevel);
}
int ApplicationSettings::getPluginPort() const
{
return getValue<int>("network/plugin_port", 6666);
+3
View File
@@ -181,6 +181,9 @@ public:
FilePath getLastFilepickerLocation() const;
void setLastFilepickerLocation(const FilePath& path);
float getGraphZoomLevel() const;
void setGraphZoomLevel(float zoomLevel);
// network
int getPluginPort() const;
void setPluginPort(const int pluginPort);
-10
View File
@@ -426,16 +426,6 @@ std::wstring FilePath::wstr() const
return m_path->generic_wstring();
}
std::string FilePath::getBackslashedString() const
{
return utility::replace(str(), "/", "\\");
}
std::wstring FilePath::getBackslashedWString() const
{
return utility::replace(wstr(), L"/", L"\\");
}
std::wstring FilePath::fileName() const
{
return m_path->filename().generic_wstring();
-2
View File
@@ -52,8 +52,6 @@ public:
std::string str() const;
std::wstring wstr() const;
std::string getBackslashedString() const;
std::wstring getBackslashedWString() const;
std::wstring fileName() const;
std::wstring extension() const;
@@ -0,0 +1,20 @@
#ifndef MESSAGE_SAVE_AS_IMAGE_H
#define MESSAGE_SAVE_AS_IMAGE_H
#include "Message.h"
class MessageSaveAsImage: public Message<MessageSaveAsImage>
{
public:
MessageSaveAsImage(QString path) : path(path) {}
static const std::string getStaticType()
{
return "MessageSaveAsImage";
}
QString path;
};
#endif /* MESSAGE_SAVE_AS_IMAGE_H */
+6 -5
View File
@@ -1,6 +1,7 @@
#ifndef UTILITY_LIBRARY_H
#define UTILITY_LIBRARY_H
#include <QDir>
#include <functional>
#include <iostream>
#include <sstream>
@@ -23,8 +24,8 @@ std::function<Ret(Args...)> loadFunctionFromLibrary(
const FilePath& libraryPath, const std::string& functionName, std::string& errorString)
{
#ifdef _WIN32
const std::string libraryPathString = libraryPath.getBackslashedString();
HINSTANCE handle = LoadLibrary(libraryPathString.c_str());
QString libraryPathString = QDir::toNativeSeparators(QString::fromStdWString(libraryPath.wstr()));
HINSTANCE handle = LoadLibrary(libraryPathString.toStdString().c_str());
if (handle == nullptr)
{
DWORD errorCode = GetLastError();
@@ -53,8 +54,8 @@ std::function<Ret(Args...)> loadFunctionFromLibrary(
LocalFree(messageBuffer);
errorString = "Could not load library \"" + libraryPathString + "\" because of " +
errorReasonString;
errorString = "Could not load library \"" + libraryPathString.toStdString() +
"\" because of " + errorReasonString;
return std::function<Ret(Args...)>();
}
@@ -63,7 +64,7 @@ std::function<Ret(Args...)> loadFunctionFromLibrary(
if (!functionId)
{
errorString = "Could not locate the function \"" + functionName + "\" in library\"" +
libraryPathString + "\"";
libraryPathString.toStdString() + "\"";
return std::function<Ret(Args...)>();
}
#else
@@ -320,7 +320,9 @@ void CxxAstVisitorComponentIndexer::visitFieldDecl(clang::FieldDecl* d)
{
for (clang::FieldDecl* templateFieldDecl: declaringRecordTemplateDecl->fields())
{
if (d->getName() == templateFieldDecl->getName())
if (d->getDeclName().isIdentifier() &&
templateFieldDecl->getDeclName().isIdentifier() &&
d->getName() == templateFieldDecl->getName())
{
Id templateFieldId = getOrCreateSymbolId(templateFieldDecl);
m_client->recordSymbolKind(templateFieldId, SYMBOL_FIELD);
@@ -377,9 +379,12 @@ void CxxAstVisitorComponentIndexer::visitFunctionDecl(clang::FunctionDecl* d)
clang::dyn_cast_or_null<clang::FunctionTemplateDecl>(
templateMethodDecl))
{
if (d->getName() == functionTemplateDecl->getName())
if (d->getDeclName().isIdentifier() &&
functionTemplateDecl->getDeclName().isIdentifier() &&
d->getName() == functionTemplateDecl->getName())
{
Id templateMethodId = getOrCreateSymbolId(functionTemplateDecl);
const Id templateMethodId = getOrCreateSymbolId(
functionTemplateDecl);
m_client->recordSymbolKind(templateMethodId, SYMBOL_METHOD);
m_client->recordReference(
REFERENCE_TEMPLATE_SPECIALIZATION,
@@ -567,7 +572,7 @@ void CxxAstVisitorComponentIndexer::visitUsingDecl(clang::UsingDecl* d)
void CxxAstVisitorComponentIndexer::visitNonTypeTemplateParmDecl(clang::NonTypeTemplateParmDecl* d)
{
if (getAstVisitor()->shouldVisitDecl(d) &&
if (getAstVisitor()->shouldVisitDecl(d) && d->getDeclName().isIdentifier() &&
!d->getName().empty()) // We don't create symbols for unnamed template parameters.
{
m_client->recordLocalSymbol(
@@ -577,7 +582,7 @@ void CxxAstVisitorComponentIndexer::visitNonTypeTemplateParmDecl(clang::NonTypeT
void CxxAstVisitorComponentIndexer::visitTemplateTypeParmDecl(clang::TemplateTypeParmDecl* d)
{
if (getAstVisitor()->shouldVisitDecl(d) &&
if (getAstVisitor()->shouldVisitDecl(d) && d->getDeclName().isIdentifier() &&
!d->getName().empty()) // We don't create symbols for unnamed template parameters.
{
m_client->recordLocalSymbol(
@@ -587,7 +592,7 @@ void CxxAstVisitorComponentIndexer::visitTemplateTypeParmDecl(clang::TemplateTyp
void CxxAstVisitorComponentIndexer::visitTemplateTemplateParmDecl(clang::TemplateTemplateParmDecl* d)
{
if (getAstVisitor()->shouldVisitDecl(d) &&
if (getAstVisitor()->shouldVisitDecl(d) && d->getDeclName().isIdentifier() &&
!d->getName().empty()) // We don't create symbols for unnamed template parameters.
{
m_client->recordLocalSymbol(
@@ -225,32 +225,32 @@ std::vector<std::shared_ptr<IndexerCommandCxx>> Project::getIndexerCommands(
sourceGroupSettings->getFrameworkSearchPathsExpandedAndAbsolute(),
appSettings->getFrameworkSearchPathsExpanded());
OrderedCache<std::wstring, std::vector<std::wstring>> optionsCache(
[&](const std::wstring& targetName) {
std::vector<std::wstring> compilerFlags;
for (std::shared_ptr<Target> target: m_targets)
OrderedCache<std::wstring, std::vector<std::wstring>> optionsCache([&](const std::wstring& targetName) {
std::vector<std::wstring> compilerFlags;
for (std::shared_ptr<Target> target: m_targets)
{
if (target && target->getTitle() == targetName)
{
if (target->getTitle() == targetName)
if (std::shared_ptr<const Compiler> compiler = target->getCompiler())
{
compilerFlags = utility::concat(
IndexerCommandCxx::getCompilerFlagsForSystemHeaderSearchPaths(
utility::convert<std::wstring, FilePath>(
target->getCompiler()->getDirectories())),
target->getCompiler()->getOptions());
utility::convert<std::wstring, FilePath>(compiler->getDirectories())),
compiler->getOptions());
break;
}
}
}
utility::append(
compilerFlags,
IndexerCommandCxx::getCompilerFlagsForSystemHeaderSearchPaths(
systemHeaderSearchPaths));
utility::append(
compilerFlags,
IndexerCommandCxx::getCompilerFlagsForFrameworkSearchPaths(frameworkSearchPaths));
utility::append(compilerFlags, sourceGroupSettings->getCompilerFlags());
return compilerFlags;
});
utility::append(
compilerFlags,
IndexerCommandCxx::getCompilerFlagsForSystemHeaderSearchPaths(systemHeaderSearchPaths));
utility::append(
compilerFlags,
IndexerCommandCxx::getCompilerFlagsForFrameworkSearchPaths(frameworkSearchPaths));
utility::append(compilerFlags, sourceGroupSettings->getCompilerFlags());
return compilerFlags;
});
std::vector<std::shared_ptr<IndexerCommandCxx>> indexerCommands;
std::vector<std::shared_ptr<IndexerCommandCxx>> nonTargetIndexerCommands;
@@ -58,7 +58,12 @@ std::shared_ptr<Target> Target::create(const TiXmlElement* element)
{
const TiXmlElement* compilerElement = element->FirstChildElement(
Compiler::getXmlElementName().c_str());
target->m_compiler = Compiler::create(compilerElement);
std::shared_ptr<Compiler> compiler = Compiler::create(compilerElement);
if (!compiler)
{
return std::shared_ptr<Target>();
}
target->m_compiler = compiler;
}
return target;
+2
View File
@@ -186,6 +186,8 @@ add_files(
qt/project_wizard/QtProjectWizardWindow.cpp
qt/project_wizard/QtProjectWizardWindow.h
qt/utility/compatibilityQt.cpp
qt/utility/compatibilityQt.h
qt/utility/QtContextMenu.cpp
qt/utility/QtContextMenu.h
qt/utility/QtDeviceScaledPixmap.cpp
@@ -3,6 +3,7 @@
#include <QCoreApplication>
#include <QDir>
#include <QDirIterator>
#include "AppPath.h"
#include "FilePath.h"
@@ -70,6 +71,13 @@ void setupApp(int argc, char* argv[])
utility::copyNewFilesFromDirectory(
QString::fromStdWString(AppPath::getSharedDataPath().concatenate(L"user/").wstr()),
userDataPath);
// Add u+w permissions because the source files may be marked read-only in some distros
QDirIterator it(userDataPath, QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext()) {
QFile f(it.next());
f.setPermissions(f.permissions() | QFile::WriteOwner);
}
}
#endif // INCLUDES_DEFAULT_H
+1 -1
View File
@@ -134,7 +134,7 @@ void QtStatusBar::setErrorCount(ErrorCountInfo errorCount)
: QLatin1String("")));
m_errorButton.setMinimumWidth(
m_errorButton.fontMetrics().width(QString(m_errorButton.text().size(), 'a')));
m_errorButton.fontMetrics().boundingRect(QString(m_errorButton.text().size(), 'a')).width());
if (errorCount.fatal > 0)
{
+6 -3
View File
@@ -28,6 +28,7 @@
#include "QtContextMenu.h"
#include "SourceLocationFile.h"
#include "TextCodec.h"
#include "compatibilityQt.h"
#include "utility.h"
#include "utilityApp.h"
#include "utilityString.h"
@@ -40,7 +41,8 @@ bool MouseWheelOverScrollbarFilter::eventFilter(QObject* obj, QEvent* event)
if (event->type() == QEvent::Wheel && scrollbar)
{
QRect scrollbarArea(scrollbar->pos(), scrollbar->size());
QPoint globalMousePos = dynamic_cast<QWheelEvent*>(event)->globalPos();
QPoint globalMousePos = utility::compatibility::QWheelEvent_globalPos(
*dynamic_cast<QWheelEvent*>(event));
QPoint localMousePos = scrollbar->mapFromGlobal(globalMousePos);
// instead of "scrollbar->underMouse()" we need this check implemented here because
@@ -294,7 +296,7 @@ int QtCodeArea::lineNumberAreaWidth() const
{
if (m_showLineNumbers)
{
return fontMetrics().width(QLatin1Char('9')) * m_digits + 30;
return fontMetrics().boundingRect(QLatin1Char('9')).width() * m_digits + 30;
}
return 0;
@@ -643,7 +645,8 @@ bool QtCodeArea::moveFocusToLine(int lineNumber, int targetColumn, bool up)
{
while (true)
{
if (lineNumber < getStartLineNumber() || lineNumber > getEndLineNumber())
if (static_cast<size_t>(lineNumber) < getStartLineNumber() ||
static_cast<size_t>(lineNumber) > getEndLineNumber())
{
break;
}
+10 -10
View File
@@ -97,7 +97,7 @@ QtCodeField::QtCodeField(
QFont font(appSettings->getFontName().c_str());
font.setPixelSize(appSettings->getFontSize());
setFont(font);
setTabStopWidth(appSettings->getCodeTabWidth() * fontMetrics().width('9'));
setTabStopDistance(appSettings->getCodeTabWidth() * fontMetrics().boundingRect('9').width());
m_openInTabAction = new QAction(
QStringLiteral("Open in New Tab (Ctrl + Shift + Left Click)"), this);
@@ -123,15 +123,15 @@ QSize QtCodeField::sizeHint() const
QRectF rect = blockBoundingGeometry(block);
height += rect.height();
int blockWidth = fm.boundingRect(
0,
0,
1000000,
1000000,
Qt::AlignLeft | Qt::AlignTop | Qt::TextExpandTabs,
block.text(),
tabStopWidth())
.width();
const int blockWidth = fm.boundingRect(
0,
0,
1000000,
1000000,
Qt::AlignLeft | Qt::AlignTop | Qt::TextExpandTabs,
block.text(),
static_cast<int>(tabStopDistance()))
.width();
width = std::max(blockWidth, width);
}
+1 -1
View File
@@ -17,7 +17,7 @@ QtCodeFile::QtCodeFile(const FilePath& filePath, QtCodeNavigator* navigator, boo
setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
layout->setAlignment(Qt::AlignTop);
setLayout(layout);
@@ -36,7 +36,7 @@ QtCodeFileSingle::QtCodeFileSingle(QtCodeNavigator* navigator, QWidget* parent)
m_areaWrapper->setSizePolicy(
m_areaWrapper->sizePolicy().horizontalPolicy(), QSizePolicy::Expanding);
m_areaWrapper->setLayout(new QVBoxLayout());
m_areaWrapper->layout()->setMargin(0);
m_areaWrapper->layout()->setContentsMargins(0, 0, 0, 0);
m_areaWrapper->layout()->setSpacing(0);
layout()->addWidget(m_areaWrapper);
}
@@ -25,7 +25,7 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is
}
QHBoxLayout* titleLayout = new QHBoxLayout();
titleLayout->setMargin(0);
titleLayout->setContentsMargins(0, 0, 0, 0);
titleLayout->setSpacing(0);
titleLayout->setAlignment(Qt::AlignLeft);
setLayout(titleLayout);
@@ -219,8 +219,8 @@ void QtCodeNavigator::updateReferenceCount(
}
m_refLabel->setMinimumWidth(
m_refLabel->fontMetrics().width(
QString(QString::number(referenceCount).size() * 2, 'a') + "/ references") +
m_refLabel->fontMetrics().boundingRect(
QString(QString::number(referenceCount).size() * 2, 'a') + "/ references").width() +
30);
m_prevReferenceButton->setEnabled(referenceCount > 1);
@@ -239,8 +239,8 @@ void QtCodeNavigator::updateReferenceCount(
}
m_localRefLabel->setMinimumWidth(
m_localRefLabel->fontMetrics().width(
QString(QString::number(localReferenceCount).size() * 2, 'a') + "/ local references") +
m_localRefLabel->fontMetrics().boundingRect(
QString(QString::number(localReferenceCount).size() * 2, 'a') + "/ local references").width() +
30);
m_nextLocalReferenceButton->setVisible(localReferenceCount > 1);
@@ -24,7 +24,7 @@ QtCodeSnippet::QtCodeSnippet(const CodeSnippetParams& params, QtCodeNavigator* n
setObjectName(QStringLiteral("code_snippet"));
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
layout->setAlignment(Qt::AlignTop);
setLayout(layout);
@@ -268,7 +268,7 @@ void QtCodeSnippet::clickedFooter()
QtHoverButton* QtCodeSnippet::createScopeLine(QBoxLayout* layout)
{
QHBoxLayout* lineLayout = new QHBoxLayout();
lineLayout->setMargin(0);
lineLayout->setContentsMargins(0, 0, 0, 0);
lineLayout->setSpacing(0);
lineLayout->setAlignment(Qt::AlignLeft);
layout->addLayout(lineLayout);
@@ -22,7 +22,7 @@ QtNewsWidget::QtNewsWidget(QWidget* parent): QWidget(parent)
m_text = new QtTextEdit();
m_text->setObjectName(QStringLiteral("textField"));
m_text->setReadOnly(true);
m_text->setTabStopWidth(8 * m_text->fontMetrics().width('9'));
m_text->setTabStopDistance(8 * m_text->fontMetrics().boundingRect('9').width());
m_text->setViewportMargins(6, 4, 16, 4);
m_text->setOpenExternalLinks(true);
layout->addWidget(m_text);
@@ -80,7 +80,8 @@ QtHistoryItem::QtHistoryItem(const SearchMatch& match, size_t index, bool isCurr
QSize QtHistoryItem::getSizeHint() const
{
return QSize(
m_name->fontMetrics().width(m_name->text()) + 40, m_name->fontMetrics().height() + 8);
m_name->fontMetrics().boundingRect(m_name->text()).width() + 40,
m_name->fontMetrics().height() + 8);
}
const SearchMatch& QtHistoryItem::getMatch() const
@@ -336,7 +336,7 @@ void QtAutocompletionDelegate::calculateCharSizes(QFont font)
m_font1 = font;
QFontMetrics metrics1(font);
m_charWidth1 = metrics1.width(QStringLiteral(
m_charWidth1 = metrics1.boundingRect(QStringLiteral(
"---------------------------------------------------------------------------"
"-------------------------"
"---------------------------------------------------------------------------"
@@ -346,7 +346,8 @@ void QtAutocompletionDelegate::calculateCharSizes(QFont font)
"---------------------------------------------------------------------------"
"-------------------------"
"---------------------------------------------------------------------------"
"-------------------------")) /
"-------------------------"))
.width() /
500.0f;
m_charHeight1 = static_cast<float>(metrics1.height());
@@ -354,7 +355,7 @@ void QtAutocompletionDelegate::calculateCharSizes(QFont font)
m_font2 = font;
QFontMetrics metrics2(font);
m_charWidth2 = metrics2.width(QStringLiteral(
m_charWidth2 = metrics2.boundingRect(QStringLiteral(
"---------------------------------------------------------------------------"
"-------------------------"
"---------------------------------------------------------------------------"
@@ -364,7 +365,8 @@ void QtAutocompletionDelegate::calculateCharSizes(QFont font)
"---------------------------------------------------------------------------"
"-------------------------"
"---------------------------------------------------------------------------"
"-------------------------")) /
"-------------------------"))
.width() /
500.0f;
m_charHeight2 = static_cast<float>(metrics2.height());
@@ -901,7 +901,7 @@ void QtSmartSearchBox::layoutElements()
if (!hasSelected && i == m_cursorIndex)
{
editX = x - 5;
x += fontMetrics().width(text());
x += fontMetrics().horizontalAdvance(text());
}
if (i < m_elements.size())
@@ -923,7 +923,7 @@ void QtSmartSearchBox::layoutElements()
}
}
int cursorX = fontMetrics().width(text().left(cursorPosition()));
int cursorX = fontMetrics().horizontalAdvance(text().left(cursorPosition()));
int offsetX = m_oldLayoutOffset;
if (x < width())
+19 -4
View File
@@ -37,7 +37,7 @@
QtGraphicsView::QtGraphicsView(GraphFocusHandler* focusHandler, QWidget* parent)
: QGraphicsView(parent)
, m_focusHandler(focusHandler)
, m_zoomFactor(1.0f)
, m_zoomFactor(ApplicationSettings::getInstance()->getGraphZoomLevel())
, m_appZoomFactor(1.0f)
, m_zoomInButtonSpeed(20.0f)
, m_zoomOutButtonSpeed(-20.0f)
@@ -166,6 +166,8 @@ QtGraphicsView::QtGraphicsView(GraphFocusHandler* focusHandler, QWidget* parent)
m_legendButton->setObjectName(QStringLiteral("legend_button"));
m_legendButton->setToolTip(QStringLiteral("show legend"));
connect(m_legendButton, &QPushButton::clicked, this, &QtGraphicsView::legendClicked);
m_tabId = TabId::currentTab();
}
float QtGraphicsView::getZoomFactor() const
@@ -183,6 +185,8 @@ void QtGraphicsView::setSceneRect(const QRectF& rect)
{
QGraphicsView::setSceneRect(rect);
scene()->setSceneRect(rect);
m_imageCached = toQImage();
m_tabId = TabId::currentTab();
}
QtGraphNode* QtGraphicsView::getNodeAtCursorPosition() const
@@ -473,9 +477,9 @@ void QtGraphicsView::wheelEvent(QWheelEvent* event)
if (zoomDefault != (shiftPressed | ctrlPressed))
{
if (event->delta() != 0.0f)
if (event->angleDelta().y() != 0.0f)
{
updateZoom(static_cast<float>(event->delta()));
updateZoom(static_cast<float>(event->angleDelta().y()));
}
}
else
@@ -724,7 +728,6 @@ void QtGraphicsView::exportGraph()
QStringLiteral("PNG (*.png);;JPEG (*.JPEG);;BMP Files (*.bmp);;SVG (*.svg)"))
.toStdWString());
if (filePath.extension() == L".svg")
{
QSvgGenerator svgGen;
@@ -835,6 +838,10 @@ void QtGraphicsView::setZoomFactor(float zoomFactor)
{
m_zoomFactor = zoomFactor;
std::shared_ptr<ApplicationSettings> settings = ApplicationSettings::getInstance();
settings->setGraphZoomLevel(zoomFactor);
settings->save();
m_zoomState->setText(QString::number(int(m_zoomFactor * 100)) + "%");
updateTransform();
@@ -848,3 +855,11 @@ void QtGraphicsView::updateTransform()
float zoomFactor = m_appZoomFactor * m_zoomFactor;
setTransform(QTransform(zoomFactor, 0, 0, zoomFactor, 0, 0));
}
void QtGraphicsView::handleMessage(MessageSaveAsImage* message)
{
if ( (message->getSchedulerId() == getSchedulerId()) && !m_imageCached.isNull() )
{
m_imageCached.save(message->path);
}
}
+14 -1
View File
@@ -6,6 +6,9 @@
#include <QGraphicsView>
#include "types.h"
#include "MessageListener.h"
#include "MessageSaveAsImage.h"
class GraphFocusHandler;
class QPushButton;
@@ -14,7 +17,7 @@ class QtGraphEdge;
class QtGraphNode;
class QtSelfRefreshIconButton;
class QtGraphicsView: public QGraphicsView
class QtGraphicsView: public QGraphicsView, public MessageListener<MessageSaveAsImage>
{
Q_OBJECT
@@ -33,6 +36,11 @@ public:
void updateZoom(float delta);
Id getSchedulerId() const override
{
return m_tabId;
}
protected:
void resizeEvent(QResizeEvent* event);
@@ -90,6 +98,8 @@ private:
void setZoomFactor(float zoomFactor);
void updateTransform();
void handleMessage(MessageSaveAsImage* message) override;
GraphFocusHandler* m_focusHandler;
QPoint m_last;
@@ -141,6 +151,9 @@ private:
float m_zoomInButtonSpeed;
float m_zoomOutButtonSpeed;
QImage m_imageCached;
Id m_tabId;
};
#endif // QT_GRAPHICS_VIEW_H
@@ -24,7 +24,7 @@ QtCountCircleItem::~QtCountCircleItem() {}
void QtCountCircleItem::setPosition(const Vec2f& pos)
{
qreal width = QFontMetrics(m_number->font()).width(m_number->text());
qreal width = QFontMetrics(m_number->font()).boundingRect(m_number->text()).width();
qreal height = QFontMetrics(m_number->font()).height();
this->setRadius(height / 2 + 1);
@@ -693,7 +693,7 @@ void QtGraphNode::setStyle(const GraphViewStyle::NodeStyle& style)
static_cast<qreal>(style.textOffset.y));
const float charWidth =
QFontMetrics(font).width(QStringLiteral("QtGraphNode::QtGraphNode::QtGraphNode")) / 37.0f;
QFontMetrics(font).boundingRect(QStringLiteral("QtGraphNode::QtGraphNode::QtGraphNode")).width() / 37.0f;
const float charHeight = static_cast<float>(QFontMetrics(font).height());
m_matchRect->setRect(
static_cast<qreal>(
@@ -69,7 +69,7 @@ void QtGraphNodeExpandToggle::updateStyle()
setStyle(style);
float textX = static_cast<float>(
(m_rect->rect().width() / 2) - (QFontMetrics(m_text->font()).width(m_text->text()) / 2));
(m_rect->rect().width() / 2) - (QFontMetrics(m_text->font()).boundingRect(m_text->text()).width() / 2));
const float textY = static_cast<float>(
m_rect->rect().height() / 2 - QFontMetrics(m_text->font()).height() / 1.8f);
@@ -38,7 +38,7 @@ bool QtGraphNodeQualifier::isQualifierNode() const
bool QtGraphNodeQualifier::setPosition(const Vec2i& pos)
{
const int width = QFontMetrics(m_name->font()).width(m_name->text()) + 10;
const int width = QFontMetrics(m_name->font()).boundingRect(m_name->text()).width() + 10;
const int height = QFontMetrics(m_name->font()).height() + 2;
const int arrowWidth = static_cast<int>(height * 0.85);
@@ -109,7 +109,7 @@ void QtGraphNodeQualifier::updateStyle()
void QtGraphNodeQualifier::hoverEnterEvent(QGraphicsSceneHoverEvent* event)
{
const int width = QFontMetrics(m_name->font()).width(m_name->text()) + 10;
const int width = QFontMetrics(m_name->font()).boundingRect(m_name->text()).width() + 10;
const int height = QFontMetrics(m_name->font()).height() + 2;
const int arrowWidth = static_cast<int>(height * 0.85);
const float smallFactor = 0.5f;
@@ -425,16 +425,13 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row)
// maven path
m_mavenPath = new QtLocationPicker(this);
if (QSysInfo::windowsVersion() != QSysInfo::WV_None)
{
m_mavenPath->setFileFilter(QStringLiteral("Maven command (mvn.cmd)"));
m_mavenPath->setPlaceholderText(QStringLiteral("<maven_path>/bin/mvn.cmd"));
}
else
{
m_mavenPath->setFileFilter(QStringLiteral("Maven command (mvn)"));
m_mavenPath->setPlaceholderText(QStringLiteral("<binarypath>/mvn"));
}
#ifdef WIN32
m_mavenPath->setFileFilter(QStringLiteral("Maven command (mvn.cmd)"));
m_mavenPath->setPlaceholderText(QStringLiteral("<maven_path>/bin/mvn.cmd"));
#else
m_mavenPath->setFileFilter(QStringLiteral("Maven command (mvn)"));
m_mavenPath->setPlaceholderText(QStringLiteral("<binarypath>/mvn"));
#endif
addLabelAndWidget(QStringLiteral("Maven Path"), m_mavenPath, layout, row);
@@ -25,8 +25,8 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row)
std::string pythonIndexerVersion = " ";
{
std::string str = utility::executeProcess(
"\"" + ResourcePaths::getPythonPath().str() +
"SourcetrailPythonIndexer\" --version",
ResourcePaths::getPythonPath().wstr().append(L"SourcetrailPythonIndexer"),
std::vector<std::wstring>{L"--version"},
FilePath(),
5000)
.second;
@@ -63,12 +63,13 @@ void QtProjectWizardContentPathPythonEnvironment::onTextChanged(const QString& t
m_resultLabel->setText("Checking validity of Python environment...");
std::thread([=]() {
std::pair<int, std::string> out = utility::executeProcess(
"\"" + ResourcePaths::getPythonPath().str() +
"SourcetrailPythonIndexer\" check-environment " + "--environment-path \"" +
utility::getExpandedAndAbsolutePath(
ResourcePaths::getPythonPath().wstr().append(L"SourcetrailPythonIndexer"),
std::vector<std::wstring>{
L"check-environment",
L"--environment-path " + utility::getExpandedAndAbsolutePath(
FilePath(text.toStdWString()), m_settings->getProjectDirectoryPath())
.str() +
"\"",
.wstr()
},
FilePath(),
5000);
m_onQtThread([=]() {
+3 -4
View File
@@ -4,6 +4,7 @@
#include <QClipboard>
#include <QContextMenuEvent>
#include <QDesktopServices>
#include <QDir>
#include <QUrl>
#include "MessageHistoryRedo.h"
@@ -118,10 +119,8 @@ void QtContextMenu::redoActionTriggered()
void QtContextMenu::copyFullPathActionTriggered()
{
const std::wstring pathString = (QSysInfo::windowsVersion() != QSysInfo::WV_None)
? s_filePath.getBackslashedWString()
: s_filePath.wstr();
QApplication::clipboard()->setText(QString::fromStdWString(pathString));
QApplication::clipboard()->setText(
QDir::toNativeSeparators(QString::fromStdWString(s_filePath.wstr())));
}
void QtContextMenu::openContainingFolderActionTriggered()
+5 -2
View File
@@ -76,7 +76,7 @@ QLayoutItem* QtFlowLayout::takeAt(int index)
Qt::Orientations QtFlowLayout::expandingDirections() const
{
return 0;
return Qt::Orientation::Horizontal | Qt::Orientation::Vertical;
}
bool QtFlowLayout::hasHeightForWidth() const
@@ -110,7 +110,10 @@ QSize QtFlowLayout::minimumSize() const
size = size.expandedTo(item->minimumSize());
}
size += QSize(2 * margin(), 2 * margin());
int left, top, right, bottom;
getContentsMargins(&left, &top, &right, &bottom);
size += QSize(left + right, top + bottom);
return size;
}
@@ -0,0 +1,18 @@
#include "compatibilityQt.h"
#include <QtGlobal>
namespace utility
{
namespace compatibility
{
QPoint QWheelEvent_globalPos(const QWheelEvent& event)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
return event.globalPosition().toPoint();
#else
return event.globalPos();
#endif
}
} // namespace compatibility
} // namespace utility
+17
View File
@@ -0,0 +1,17 @@
#ifndef COMPATIBILITY_QT_H
#define COMPATIBILITY_QT_H
#include <QWheelEvent>
namespace utility
{
namespace compatibility
{
// Extracts the global position from a QWheelEvent.
// This compatibility wrapper bridges Qt 5.12 and Qt 5.14
QPoint QWheelEvent_globalPos(const QWheelEvent& event);
} // namespace compatibility
} // namespace utility
#endif // COMPATIBILITY_QT_H
+1 -1
View File
@@ -9,7 +9,7 @@
float QtGraphViewStyleImpl::getCharWidth(const std::string& fontName, size_t fontSize)
{
return QFontMetrics(getFontForStyleType(fontName, fontSize))
.width(QStringLiteral("QtGraphNode::QtGraphNode::QtGraphNode")) /
.boundingRect(QStringLiteral("QtGraphNode::QtGraphNode::QtGraphNode")).width() /
37.0f;
}
+3 -3
View File
@@ -65,7 +65,7 @@ void QtBookmarkBrowser::setupBookmarkBrowser()
connect(
m_filterComboBox,
QOverload<const QString&>::of(&QComboBox::currentIndexChanged),
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
&QtBookmarkBrowser::filterOrOrderChanged);
@@ -91,7 +91,7 @@ void QtBookmarkBrowser::setupBookmarkBrowser()
connect(
m_orderComboBox,
QOverload<const QString&>::of(&QComboBox::currentIndexChanged),
QOverload<int>::of(&QComboBox::currentIndexChanged),
this,
&QtBookmarkBrowser::filterOrOrderChanged);
}
@@ -188,7 +188,7 @@ void QtBookmarkBrowser::handleNext()
close();
}
void QtBookmarkBrowser::filterOrOrderChanged(const QString& text)
void QtBookmarkBrowser::filterOrOrderChanged(int index)
{
Bookmark::BookmarkFilter filter = getSelectedFilter();
Bookmark::BookmarkOrder order = getSelectedOrder();
+1 -1
View File
@@ -30,7 +30,7 @@ protected:
virtual void handleNext() override;
private slots:
void filterOrOrderChanged(const QString& text);
void filterOrOrderChanged(int index);
void treeItemClicked(QTreeWidgetItem* item, int column);
private:
+25 -1
View File
@@ -33,6 +33,7 @@
#include "MessageRefresh.h"
#include "MessageRefreshUI.h"
#include "MessageResetZoom.h"
#include "MessageSaveAsImage.h"
#include "MessageTabClose.h"
#include "MessageTabOpen.h"
#include "MessageTabSelect.h"
@@ -710,6 +711,19 @@ void QtMainWindow::forceRefresh()
MessageRefresh().refreshAll().dispatch();
}
void QtMainWindow::saveAsImage()
{
QString filePath = QtFileDialog::showSaveFileDialog(
this, tr("Save as Image"), FilePath(), "PNG (*.png);;JPEG (*.JPEG);;BMP Files (*.bmp)");
if (filePath.isNull())
{
return;
}
MessageSaveAsImage m(filePath);
m.setSchedulerId(TabId::currentTab());
m.dispatch();
}
void QtMainWindow::undo()
{
MessageHistoryUndo().dispatch();
@@ -919,6 +933,14 @@ void QtMainWindow::setupEditMenu()
menu->addSeparator();
menu->addAction(
tr("&Save Graph as Image..."),
this,
&QtMainWindow::saveAsImage,
QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_S));
menu->addSeparator();
menu->addAction(
tr("Preferences..."),
this,
@@ -1134,7 +1156,9 @@ void QtMainWindow::setShowDockWidgetTitleBars(bool showTitleBars)
{
if (showTitleBars)
{
dock.widget->setFeatures(QDockWidget::AllDockWidgetFeatures);
dock.widget->setFeatures(
QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable |
QDockWidget::DockWidgetFloatable);
dock.widget->setTitleBarWidget(nullptr);
}
else
+1
View File
@@ -150,6 +150,7 @@ public slots:
void updateRecentProjectsMenu();
void toggleView(View* view, bool fromMenu);
void saveAsImage();
private slots:
void toggleShowDockWidgetTitleBars();
@@ -57,14 +57,14 @@ void QtSelectPathsDialog::setPathsList(
if (!s.exists())
{
item->setTextColor(Qt::red);
item->setForeground(Qt::red);
item->setToolTip(QStringLiteral("Path does not exist"));
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
item->setCheckState(Qt::Unchecked);
}
else
{
item->setTextColor(Qt::black);
item->setForeground(Qt::black);
}
}
}
+2 -2
View File
@@ -139,7 +139,7 @@ void QtStartScreen::updateButtons()
button->setIcon(m_projectIcon);
break;
}
button->setFixedWidth(button->fontMetrics().width(button->text()) + 45);
button->setFixedWidth(button->fontMetrics().boundingRect(button->text()).width() + 45);
connect(
button,
&QtRecentProjectButton::clicked,
@@ -274,7 +274,7 @@ void QtStartScreen::setupStartScreen()
button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
button->setIcon(m_projectIcon);
button->setIconSize(QSize(30, 30));
button->setMinimumSize(button->fontMetrics().width(button->text()) + 45, 40);
button->setMinimumSize(button->fontMetrics().boundingRect(button->text()).width() + 45, 40);
button->setObjectName(QStringLiteral("recentButtonMissing"));
button->minimumSizeHint(); // force font loading
m_recentProjectsButtons.push_back(button);
+1 -1
View File
@@ -50,7 +50,7 @@ void QtTextEditDialog::populateWindow(QWidget* widget)
m_text = new QPlainTextEdit();
m_text->setObjectName(QStringLiteral("textField"));
m_text->setLineWrapMode(QPlainTextEdit::NoWrap);
m_text->setTabStopWidth(8 * m_text->fontMetrics().width('9'));
m_text->setTabStopDistance(8 * m_text->fontMetrics().boundingRect('9').width());
layout->addWidget(m_text);
widget->setLayout(layout);
+1 -1
View File
@@ -12,8 +12,8 @@ QtWindowBase::QtWindowBase(bool isSubWindow, QWidget* parent)
, m_isSubWindow(isSubWindow)
, m_window(nullptr)
, m_content(nullptr)
, m_sizeGrip(nullptr)
, m_mousePressedInWindow(false)
, m_sizeGrip(nullptr)
{
if (isSubWindow)
{
@@ -20,11 +20,10 @@ std::vector<FilePath> CxxVs15HeaderPathDetector::doGetPaths() const
.expandEnvironmentVariables();
if (!expandedPaths.empty())
{
const std::string command = "\"" + expandedPaths[0].str() +
"\" -latest -property installationPath";
const std::string command2 =
"\"C:/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe\"";
const std::string output = utility::executeProcess(command, FilePath(), 10000).second;
const std::string output =
utility::executeProcess(
expandedPaths[0].wstr(), std::vector<std::wstring> {L"-latest", L"-property installationPath"}, FilePath(), 10000)
.second;
const FilePath vsInstallPath(output);
if (vsInstallPath.exists())
@@ -12,7 +12,10 @@ namespace utility
std::vector<std::string> getCxxHeaderPaths(const std::string& compilerName)
{
std::string command = compilerName + " -x c++ -v -E /dev/null";
std::string clangOutput = utility::executeProcess(command.c_str()).second;
std::string clangOutput = utility::executeProcess(
utility::decodeFromUtf8(compilerName),
std::vector<std::wstring> {L"-x c++", L"-v", L"-E /dev/null"})
.second;
std::string standardHeaders = utility::substrBetween<std::string>(
clangOutput, "#include <...> search starts here:\n", "\nEnd of search list");
std::vector<std::string> paths;
@@ -54,8 +54,7 @@ std::vector<FilePath> JavaPathDetectorLinux::doGetPaths() const
FilePath JavaPathDetectorLinux::getJavaInPath() const
{
std::string command = "which java";
std::string output = utility::executeProcess(command.c_str()).second;
std::string output = utility::executeProcess(L"which", std::vector<std::wstring>{L"java"}).second;
if (!output.empty())
{
@@ -73,8 +72,7 @@ FilePath JavaPathDetectorLinux::getJavaInPath() const
FilePath JavaPathDetectorLinux::readLink(const FilePath& path) const
{
std::string command = "readlink -f " + path.str();
FilePath javaPath(utility::executeProcess(command.c_str()).second);
FilePath javaPath(utility::executeProcess(L"readlink", std::vector<std::wstring>{L"-f " + path.wstr()}).second);
if (!javaPath.empty())
{
return javaPath;
@@ -115,8 +113,7 @@ FilePath JavaPathDetectorLinux::getJavaInJavaHome() const
bool JavaPathDetectorLinux::checkVersion(const FilePath& path) const
{
std::string command = path.str() + " -version";
std::string output = utility::executeProcess(command.c_str()).second;
std::string output = utility::executeProcess(path.wstr(), std::vector<std::wstring>{L"-version"}).second;
return output.find(m_javaVersion) != std::string::npos;
}
@@ -14,8 +14,7 @@ std::vector<FilePath> JavaPathDetectorMac::doGetPaths() const
std::vector<FilePath> paths;
FilePath javaPath;
std::string command = "/usr/libexec/java_home";
std::string output = utility::executeProcess(command.c_str()).second;
std::string output = utility::executeProcess(L"/usr/libexec/java_home", std::vector<std::wstring>{}).second;
if (!output.empty())
{
@@ -7,8 +7,7 @@ MavenPathDetectorUnix::MavenPathDetectorUnix(): PathDetector("Maven for Unix") {
std::vector<FilePath> MavenPathDetectorUnix::doGetPaths() const
{
std::string command = "which mvn";
FilePath mavenPath(utility::executeProcess(command.c_str()).second);
FilePath mavenPath(utility::executeProcess(L"which", std::vector<std::wstring>{L"mvn"}).second);
std::vector<FilePath> paths;
if (mavenPath.exists())
@@ -7,8 +7,9 @@ MavenPathDetectorWindows::MavenPathDetectorWindows(): PathDetector("Maven for Wi
std::vector<FilePath> MavenPathDetectorWindows::doGetPaths() const
{
std::string command = "cmd /c where mvn.cmd && exit";
FilePath mavenPath(utility::executeProcess(command.c_str()).second);
FilePath mavenPath(
utility::executeProcess(L"cmd", std::vector<std::wstring> {L"\"/c where mvn.cmd && exit\""})
.second);
std::vector<FilePath> paths;
if (mavenPath.exists())
+29 -40
View File
@@ -48,6 +48,16 @@ void logProcessStreams(QProcess& process, std::wstring& outputBuffer, std::wstri
errorBuffer = errorLines.back();
}
}
QStringList toQStringList(const std::vector<std::wstring>& strings)
{
QStringList result;
for (const std::wstring& next: strings)
{
result += QString::fromStdWString(next);
}
return result;
}
} // namespace
namespace utility
@@ -57,7 +67,10 @@ std::set<QProcess*> s_runningProcesses;
} // namespace utility
std::pair<int, std::string> utility::executeProcess(
const std::string& command, const FilePath& workingDirectory, const int timeout)
const std::wstring& commandPath,
const std::vector<std::wstring>& commandArguments,
const FilePath& workingDirectory,
const int timeout)
{
QProcess process;
process.setProcessChannelMode(QProcess::MergedChannels);
@@ -67,6 +80,9 @@ std::pair<int, std::string> utility::executeProcess(
process.setWorkingDirectory(QString::fromStdWString(workingDirectory.wstr()));
}
QString command = QString::fromStdWString(commandPath);
QStringList arguments = toQStringList(commandArguments);
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QStringList envlist = env.toStringList();
envlist.replaceInStrings(
@@ -76,7 +92,7 @@ std::pair<int, std::string> utility::executeProcess(
{
std::lock_guard<std::mutex> lock(s_runningProcessesMutex);
process.start(command.c_str());
process.start(command, arguments);
s_runningProcesses.insert(&process);
}
@@ -96,7 +112,10 @@ std::pair<int, std::string> utility::executeProcess(
}
std::string utility::executeProcessUntilNoOutput(
const std::string& command, const FilePath& workingDirectory, const int waitTime)
const std::wstring& commandPath,
const std::vector<std::wstring>& commandArguments,
const FilePath& workingDirectory,
const int waitTime)
{
QProcess process;
process.setProcessChannelMode(QProcess::MergedChannels);
@@ -106,6 +125,9 @@ std::string utility::executeProcessUntilNoOutput(
process.setWorkingDirectory(QString::fromStdWString(workingDirectory.wstr()));
}
QString command = QString::fromStdWString(commandPath);
QStringList arguments = toQStringList(commandArguments);
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QStringList envlist = env.toStringList();
envlist.replaceInStrings(
@@ -115,7 +137,7 @@ std::string utility::executeProcessUntilNoOutput(
{
std::lock_guard<std::mutex> lock(s_runningProcessesMutex);
process.start(command.c_str());
process.start(command, arguments);
s_runningProcesses.insert(&process);
}
@@ -161,9 +183,7 @@ int utility::executeProcessAndGetExitCode(
QProcess process;
QObject::connect(
&process,
&QProcess::errorOccurred,
[&finished, errorMessage, commandPath](QProcess::ProcessError error) {
&process, &QProcess::errorOccurred, [&finished, errorMessage](QProcess::ProcessError error) {
finished = true;
if (errorMessage != nullptr)
{
@@ -203,10 +223,7 @@ int utility::executeProcessAndGetExitCode(
}
QString command = QString::fromStdWString(commandPath);
for (const std::wstring& commandArgument: commandArguments)
{
command += " " + QString::fromStdWString(commandArgument);
}
QStringList arguments = toQStringList(commandArguments);
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QStringList envlist = env.toStringList();
@@ -217,7 +234,7 @@ int utility::executeProcessAndGetExitCode(
{
std::lock_guard<std::mutex> lock(s_runningProcessesMutex);
process.start(command);
process.start(command, arguments);
s_runningProcesses.insert(&process);
}
@@ -276,23 +293,6 @@ int utility::getIdealThreadCount()
return std::max(1, threadCount);
}
OsType utility::getOsType()
{
if (QSysInfo::windowsVersion() != QSysInfo::WV_None)
{
return OS_WINDOWS;
}
else if (QSysInfo::macVersion() != QSysInfo::MV_None)
{
return OS_MAC;
}
else
{
return OS_LINUX;
}
return OS_UNKNOWN;
}
std::string utility::getOsTypeString()
{
// WARNING: Don't change these string. The server API relies on them.
@@ -309,14 +309,3 @@ std::string utility::getOsTypeString()
}
return "unknown";
}
ApplicationArchitectureType utility::getApplicationArchitectureType()
{
#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) || \
defined(WIN64)
return APPLICATION_ARCHITECTURE_X86_64;
#else
return APPLICATION_ARCHITECTURE_X86_32;
#endif
return APPLICATION_ARCHITECTURE_UNKNOWN;
}
+30 -4
View File
@@ -10,11 +10,15 @@
namespace utility
{
std::pair<int, std::string> executeProcess(
const std::string& command,
const std::wstring& commandPath,
const std::vector<std::wstring>& commandArguments,
const FilePath& workingDirectory = FilePath(),
const int timeout = 30000);
std::string executeProcessUntilNoOutput(
const std::string& command, const FilePath& workingDirectory, int waitTime = 10000);
const std::wstring& commandPath,
const std::vector<std::wstring>& commandArguments,
const FilePath& workingDirectory,
int waitTime = 10000);
int executeProcessAndGetExitCode(
const std::wstring& commandPath,
const std::vector<std::wstring>& commandArguments,
@@ -26,9 +30,31 @@ int executeProcessAndGetExitCode(
void killRunningProcesses();
int getIdealThreadCount();
OsType getOsType();
constexpr OsType getOsType()
{
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
return OS_WINDOWS;
#elif defined(__APPLE__)
return OS_MAC;
#elif defined(__linux) || defined(__linux__) || defined(linux)
return OS_LINUX;
#else
return OS_UNKNOWN;
#endif
}
std::string getOsTypeString();
ApplicationArchitectureType getApplicationArchitectureType();
constexpr ApplicationArchitectureType getApplicationArchitectureType()
{
#if defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) || \
defined(WIN64)
return APPLICATION_ARCHITECTURE_X86_64;
#else
return APPLICATION_ARCHITECTURE_X86_32;
#endif
return APPLICATION_ARCHITECTURE_UNKNOWN;
}
} // namespace utility
#endif // UTILITY_APP_H
+1 -1
View File
@@ -82,7 +82,7 @@ bool prepareJavaEnvironmentAndDisplayOccurringErrors()
if (!JavaEnvironmentFactory::getInstance())
{
std::wstring dialogMessage =
L"Sourcetrail was unable to locate Java on this machine.\n"
L"Sourcetrail was unable to initialize Java environment on this machine.\n"
"Please make sure to provide the correct Java Path in the preferences.";
if (!errorString.empty())
+25 -19
View File
@@ -82,20 +82,14 @@ std::wstring getErrorMessageFromMavenOutput(std::shared_ptr<const TextAccess> ma
return errorMessage;
}
std::string getMavenArgsString(const FilePath& settingsFilePath)
std::vector<std::wstring> getMavenArgs(const FilePath& settingsFilePath)
{
std::vector<std::string> args;
std::vector<std::wstring> args;
if (!settingsFilePath.empty() && settingsFilePath.exists())
{
args.push_back("--settings \"" + settingsFilePath.str() + "\"");
args.push_back(L"--settings \"" + settingsFilePath.wstr() + L"\"");
}
std::string ret = "";
for (const std::string& arg: args)
{
ret += arg + " ";
}
return ret;
return args;
}
} // namespace
@@ -107,9 +101,13 @@ std::wstring mavenGenerateSources(
{
utility::setJavaHomeVariableIfNotExists();
auto args = getMavenArgs(settingsFilePath);
args.push_back(L"generate-sources");
std::shared_ptr<TextAccess> outputAccess = TextAccess::createFromString(
utility::executeProcessUntilNoOutput(
"\"" + mavenPath.str() + "\" " + getMavenArgsString(settingsFilePath) + "generate-sources",
mavenPath.wstr(),
args,
projectDirectoryPath,
60000));
@@ -130,11 +128,15 @@ bool mavenCopyDependencies(
{
utility::setJavaHomeVariableIfNotExists();
auto args = getMavenArgs(settingsFilePath);
args.push_back(L"dependency:copy-dependencies");
args.push_back(L"-DoutputDirectory=" + outputDirectoryPath.wstr());
std::shared_ptr<TextAccess> outputAccess = TextAccess::createFromString(
utility::executeProcessUntilNoOutput(
"\"" + mavenPath.str() + "\" " + getMavenArgsString(settingsFilePath) +
"dependency:copy-dependencies -DoutputDirectory=" + outputDirectoryPath.str(),
projectDirectoryPath,
utility::executeProcessUntilNoOutput(
mavenPath.wstr(),
args,
projectDirectoryPath,
60000));
const std::wstring errorMessage = getErrorMessageFromMavenOutput(outputAccess);
@@ -159,11 +161,15 @@ std::vector<FilePath> mavenGetAllDirectoriesFromEffectivePom(
FilePath outputPath = outputDirectoryPath.getConcatenated(FilePath("/effective-pom.xml"));
auto args = getMavenArgs(settingsFilePath);
args.push_back(L"help:effective-pom");
args.push_back(L"-Doutput=" + outputPath.wstr());
std::shared_ptr<TextAccess> outputAccess = TextAccess::createFromString(
utility::executeProcessUntilNoOutput(
"\"" + mavenPath.str() + "\" " + getMavenArgsString(settingsFilePath) +
"help:effective-pom -Doutput=\"" + outputPath.str(),
projectDirectoryPath,
utility::executeProcessUntilNoOutput(
mavenPath.wstr(),
args,
projectDirectoryPath,
60000));
const std::wstring errorMessage = getErrorMessageFromMavenOutput(outputAccess);