From 7b514173c38bcbbf5a03f405dc87bedd3d2013c4 Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Tue, 9 Apr 2019 10:36:45 +0200 Subject: [PATCH] ui: print version number of used SourcetrailPythonIndexer in sourcegroup selection ui --- .../QtProjectWizzardContentSelect.cpp | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp index f6cb0f34..3c844cb0 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentSelect.cpp @@ -1,5 +1,7 @@ #include "QtProjectWizzardContentSelect.h" +#include + #include #include #include @@ -11,6 +13,7 @@ #include "ResourcePaths.h" #include "SqliteIndexStorage.h" #include "utilityString.h" +#include "utilityApp.h" QtProjectWizzardContentSelect::QtProjectWizzardContentSelect( QtProjectWizzardWindow* window @@ -21,6 +24,18 @@ QtProjectWizzardContentSelect::QtProjectWizzardContentSelect( void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row) { + std::string pythonIndexerVersion = " "; + { + std::string str = utility::executeProcess("\"" + ResourcePaths::getPythonPath().str() + "SourcetrailPythonIndexer\" --version", FilePath(), 5000); + std::regex regex("v\\d*\\.db\\d*\\.p\\d*"); // "\\d" matches any digit; "\\." matches the "." character + std::smatch matches; + std::regex_search(str, matches, regex); + if (!matches.empty()) + { + pythonIndexerVersion = matches.str(0) + " "; + } + } + struct SourceGroupInfo { SourceGroupInfo(SourceGroupType type, bool recommended = false) @@ -65,8 +80,8 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row) m_sourceGroupTypeIconName[SOURCE_GROUP_CUSTOM_COMMAND] = L"empty_icon"; // define descriptions for each kind of Source Group - m_sourceGroupTypeDescriptions[SOURCE_GROUP_C_EMPTY] = "Create a new Sourcetrail Source Group by defining which C files will be indexed."; - m_sourceGroupTypeDescriptions[SOURCE_GROUP_CPP_EMPTY] = "Create a new Sourcetrail Source Group by defining which C++ files will be indexed."; + m_sourceGroupTypeDescriptions[SOURCE_GROUP_C_EMPTY] = "Create a new Source Group by defining which C files will be indexed."; + m_sourceGroupTypeDescriptions[SOURCE_GROUP_CPP_EMPTY] = "Create a new Source Group by defining which C++ files will be indexed."; m_sourceGroupTypeDescriptions[SOURCE_GROUP_CXX_CDB] = "Create a Source Group from an existing Compilation Database file (compile_commands.json). " "It can be exported from CMake
(-DCMAKE_EXPORT_COMPILE_COMMANDS=1) and Make projects or from the Qt Creator since version 4.8. Have a look at the " @@ -82,13 +97,18 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row) m_sourceGroupTypeDescriptions[SOURCE_GROUP_CXX_CODEBLOCKS] = "

Create a new Source Group from an existing Code::Blocks project file.

" "

Note: A \".cbp\" file will also get generated by the Qt Creator if a CMakeLists file is imported.

"; - m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_EMPTY] = "Create a new Sourcetrail Source Group by defining which Java files will be indexed."; + m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_EMPTY] = "Create a new Source Group by defining which Java files will be indexed."; m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_MAVEN] = "Create a new Source Group from an existing Maven project."; m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_GRADLE] = "Create a new Source Group from an existing Gradle project."; m_sourceGroupTypeDescriptions[SOURCE_GROUP_JAVA_SONARGRAPH] = "Create a new Source Group from an existing Sonargraph project file."; - m_sourceGroupTypeDescriptions[SOURCE_GROUP_PYTHON_EMPTY] = "Create a new Sourcetrail Source Group by defining which Python files will be indexed. Note " - "that this Source Group type uses the SourcetrailPythonIndexer in the background."; + m_sourceGroupTypeDescriptions[SOURCE_GROUP_PYTHON_EMPTY] = + "

Create a new Source Group by defining which Python files will be indexed. This Source Group type uses the " + "SourcetrailPythonIndexer " + pythonIndexerVersion + "in the " + "background.

" + "

Note: Python support is still in its beta phase. If you want to update the version of the SourcetrailPythonIndexer which is used " + "by Sourcetrail, download the latest release package for your operating system from the linked repository and completely replace the contents of your " + "\"Sourcetrail/data/python\" folder with the contents of the downloaded package.

"; m_sourceGroupTypeDescriptions[SOURCE_GROUP_CUSTOM_COMMAND] = "Create a new Source Group executing a custom command on each source file. " "This Source Group type can be used on SourcetrailDB binaries that add " "custom language support to Sourcetrail.

Current Database Version: " + std::to_string(SqliteIndexStorage::getStorageVersion());