From c6169a989d81d10e0b9242cb6abbf786ba96c62f Mon Sep 17 00:00:00 2001 From: Malte Langkabel Date: Tue, 23 Nov 2021 07:11:21 +0100 Subject: [PATCH] ui: changes for discontinue of Sourcetrail (#1229) * remove patreon button from start screen * change text on github button on start screen * remove outdated info from "about" dialog * replace references to website by links to github repo --- bin/app/data/gui/startscreen/patreon_icon.png | Bin 2380 -> 0 bytes cmake/licenses.cmake | 2 +- src/lib/app/Application.cpp | 3 +- .../QtProjectWizardContentPreferences.cpp | 4 +- .../content/QtProjectWizardContentSelect.cpp | 16 ++-- .../content/QtProjectWizardContentVS.cpp | 9 +- ...izardContentPathsFrameworkSearchGlobal.cpp | 9 +- ...ctWizardContentPathsHeaderSearchGlobal.cpp | 11 ++- src/lib_gui/qt/window/QtAbout.cpp | 62 ++++++------ src/lib_gui/qt/window/QtMainWindow.cpp | 14 +-- src/lib_gui/qt/window/QtStartScreen.cpp | 24 +---- src/lib_gui/qt/window/QtStartScreen.h | 1 - src/lib_gui/utility/utilityApp.cpp | 90 ++++++++++-------- src/lib_gui/utility/utilityApp.h | 2 + 14 files changed, 131 insertions(+), 116 deletions(-) delete mode 100644 bin/app/data/gui/startscreen/patreon_icon.png diff --git a/bin/app/data/gui/startscreen/patreon_icon.png b/bin/app/data/gui/startscreen/patreon_icon.png deleted file mode 100644 index 997704fdf6fae4427ab7160a48177d699ba232ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2380 zcmbVOc{mhW8$V;1VGPP(vcxp@)QmM*W}0kKhT&Qhh7cJ`)!bgbV@z zAYx@{X3rZL+a?I(^<6}-e%`=;>M;2*01cOgKY0o8e4$WF*Kh!YQQHOq*YkG)0C5d) zaEWjsTN|DX3Bq~#gn0Yn=s}@8GyukQL*6vVH^K`;526K!8`25bF9<{4d^?QCV!l8k z0tr|bG6iEA66TB1!|CEQu|xz0gE0>C@iVkHv-q~1=Mk{}5fPz=czkqpG%i{P7ZP>~ zuVr9hfY;Qu=cSvLe0gK%h z`rf|g84=+3w^DHUx3YKz;G`5&=wI>z{I z@qbI^Yo%YJyi$n>WBm7HBO_CSsxx1yxnM=4wUP=odT2EDZKyJ+K zrt&K$RHj;PnGGojA!b#H6lFe(FZP=ws+?^oyJ*kEajbqS=8|eXi-L&C%aB zUb(33E`hD1Xlj;&RD*s-yt!~S`=gHCYz#}8)l;zQwa*ro3Ht?cVB;xEjR~dKCl$EJ z^PTABRBm=Ev-PtZ1TB>_&CPM}1AH`HnI>f6xb{nK5uX@T_k|Xt-~T$~<(+ys5&Ywl zv_F1eHk`)2r<=A5OcS zanlSzVA*TFhGgXsbS(%5Fzs3o)=4o^^U9d#;15)YQ$44>sXj&r%>6b_t;lhlJlP;lr&FY3^;55o~vQy(q*1H)O+0DoW31F0!!fzES%UGOkY?8#&g zIK|kh8n5Yx*Nb@uebv%qM zAoinsqE}!w8k*axtFfFs=kEV{t_QTiikTWzdGYt&V8yQ1z0~3q?r!6XH-lYs!U-aC zUBCBHe+J}Wm5G-#L#Ld~(@wFbWe+)0+gi1UpYc`%ti7Ds;a_NX2Psc*+k%`Dc=`G% zm$lvHYx8;_;ei~`Zm<)VT!(9NG(C_^*|IIHQBOAF(}jzJ>bDJrJdj+;g*TIZQ%>VG zj{{3WSG2C7p##ISukP#}j-e%o~q^ z%&9)G`1||SxuVSqg~N$Xsfa=(S0lAu$^_RnhW<6LB5{`M1FpuxG!@vnj{X+dlzvY{ z`P37@Ny4-m^q2{F^t#2Vc8q`C9Rg!h2T+^pz8}K9^ zpOiw@-I@n&8kX~n^%D3~!)VB?N}5lH9txKRx8ANQj~wnyUax$;^&Nz zO1NXttaW{sA*Q*7&v-|NNGj1;`;I)2X_`*>R2v?0v3===QClhAUXO*zrW>MAL$Qeb zYRElR?i#l?`36I!Vk9slTZCk11HB6xT4#2RPXAa~tjgHa`Ob12C>f()BD?*wT}Ij5 zwH=f=x+XB6nx0WRehXF|W@LN5*BX4|q^py|K;l|yVKdlYoSv+4d=_2l z{PyzwH5!;76(xo)?4io3{qFC3wy0}l4T3978sdkN-b7twbCOtU6bsYjpBvz#;~-z) zUYd$@vBt)UTVwp85?4@;CbHT}Md*-&F)J3VPjU(~Dk!op>vNBLCi+ccPU0p|bxYRe zPPXJT@5{P*f?)X1z{-5yKt)8eh99;sfEHH1lRsj|&d0Kc3pdm_`~i zeH2$ptlQ4K2AZ%%fv55wWms;2gRJJoN!?jg&^UD8v;QoI4DlHN} YgP-EjF10f7?Ct-JmAQ>soeA~)U!FGYmH+?% diff --git a/cmake/licenses.cmake b/cmake/licenses.cmake index 696db62f..afdac693 100644 --- a/cmake/licenses.cmake +++ b/cmake/licenses.cmake @@ -21,7 +21,7 @@ function(AddLicense softwareName softwareVersion softwareURL licenseFile) endfunction(AddLicense) ReadLicense(${CMAKE_SOURCE_DIR}/LICENSE.txt Sourcetrail_license) -set(LICENSE_APP "LicenseInfo(\"Sourcetrail\", \"${VERSION_STRING}\", \"https://www.sourcetrail.com\", Sourcetrail_license)") +set(LICENSE_APP "LicenseInfo(\"Sourcetrail\", \"${VERSION_STRING}\", \"https://github.com/CoatiSoftware/Sourcetrail\", Sourcetrail_license)") AddLicense("Boost" "1.68" "http://www.boost.org" "${LICENSEFOLDER}/license_boost.txt") AddLicense("catch" "2.5.0" "https://github.com/catchorg/Catch2" "${LICENSEFOLDER}/license_catch.txt") diff --git a/src/lib/app/Application.cpp b/src/lib/app/Application.cpp index b5d05d3b..9ad3adac 100644 --- a/src/lib/app/Application.cpp +++ b/src/lib/app/Application.cpp @@ -510,8 +510,7 @@ bool Application::checkSharedMemory() L"There was an error accessing shared memory on your computer: " + error + L"\n\n" "Project indexing is not possible. Please restart your computer or try running " - "Sourcetrail as admin. If the " - "issue persists contact mail@sourcetrail.com"); + "Sourcetrail as admin."); return false; } diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp index 70aee685..c7f2bdc2 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentPreferences.cpp @@ -374,7 +374,9 @@ void QtProjectWizardContentPreferences::populate(QGridLayout* layout, int& row) "

Provide the location of the jvm library inside the installation of your " + javaVersionString + " runtime environment (for information on how to set this take a look at " - "" + "" "Finding Java Runtime Library Location or use the auto detection below)

") .c_str(), layout, diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSelect.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSelect.cpp index 8a1240f9..b79b2e81 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSelect.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentSelect.cpp @@ -100,13 +100,15 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row) "Create a Source Group from an existing Compilation Database file (compile_commands.json). " "It can be exported from CMake
(-DCMAKE_EXPORT_COMPILE_COMMANDS=ON) and Make projects " "or from the Qt Creator since version 4.8. Have a look at the " - "" - "documentation."; + "documentation."; m_sourceGroupTypeDescriptions[SOURCE_GROUP_CXX_VS] = "

Create a new Source Group from an existing Visual Studio Solution file.

" "

Note: Requires a running Visual Studio instance with the " - "Sourcetrail " - "Visual Studio Extension installed.

"; + "Sourcetrail Visual Studio Extension installed.

"; 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 " @@ -157,7 +159,8 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row) connect( m_languages, static_cast(&QButtonGroup::buttonClicked), - [this](QAbstractButton* button) { + [this](QAbstractButton* button) + { LanguageType selectedLanguage = LANGUAGE_UNKNOWN; bool ok = false; int languageTypeInt = button->property("language_type").toInt(&ok); @@ -230,7 +233,8 @@ void QtProjectWizardContentSelect::populate(QGridLayout* layout, int& row) connect( it.second, static_cast(&QButtonGroup::buttonClicked), - [this](QAbstractButton* button) { + [this](QAbstractButton* button) + { SourceGroupType selectedType = SOURCE_GROUP_UNKNOWN; bool ok = false; int selectedTypeInt = button->property("source_group_type").toInt(&ok); diff --git a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentVS.cpp b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentVS.cpp index 0d1c5e4c..cf0348f3 100644 --- a/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentVS.cpp +++ b/src/lib_gui/qt/project_wizard/content/QtProjectWizardContentVS.cpp @@ -1,6 +1,7 @@ #include "QtProjectWizardContentVS.h" #include "MessageIDECreateCDB.h" +#include "utilityApp.h" QtProjectWizardContentVS::QtProjectWizardContentVS(QtProjectWizardWindow* window) : QtProjectWizardContent(window) @@ -26,12 +27,12 @@ void QtProjectWizardContentVS::populate(QGridLayout* layout, int& row) layout, row); - QLabel* descriptionLabel = createFormSubLabel(QStringLiteral( + QLabel* descriptionLabel = createFormSubLabel(QString::fromStdString( "Call Visual Studio to create a Compilation Database from the loaded Solution (requires " "installed " - "Sourcetrail " - "Visual Studio " - "Extension).")); + "Sourcetrail Visual Studio Extension).")); descriptionLabel->setObjectName(QStringLiteral("description")); descriptionLabel->setOpenExternalLinks(true); descriptionLabel->setAlignment(Qt::AlignmentFlag::AlignLeft); diff --git a/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsFrameworkSearchGlobal.cpp b/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsFrameworkSearchGlobal.cpp index 2898ec02..691ca6ff 100644 --- a/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsFrameworkSearchGlobal.cpp +++ b/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsFrameworkSearchGlobal.cpp @@ -1,6 +1,7 @@ #include "QtProjectWizardContentPathsFrameworkSearchGlobal.h" #include "ApplicationSettings.h" +#include "utilityApp.h" #include "utilityPathDetection.h" QtProjectWizardContentPathsFrameworkSearchGlobal::QtProjectWizardContentPathsFrameworkSearchGlobal( @@ -12,14 +13,16 @@ QtProjectWizardContentPathsFrameworkSearchGlobal::QtProjectWizardContentPathsFra true) { setTitleString(QStringLiteral("Global Framework Search Paths")); - setHelpString( + setHelpString(QString::fromStdString( "The Global Framework Search Paths will be used in all your projects - in addition to the " "project specific " "Framework Search Paths.
" "
" "They define where MacOS framework containers (.framework) are found " - "(See " - "Finding System Header Locations or use the auto detection below)."); + "(See " + "Finding System Header Locations or use the auto detection below).")); m_pathDetector = utility::getCxxFrameworkPathDetector(); m_makePathsRelativeToProjectFileLocation = false; diff --git a/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsHeaderSearchGlobal.cpp b/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsHeaderSearchGlobal.cpp index c2439767..4a936cff 100644 --- a/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsHeaderSearchGlobal.cpp +++ b/src/lib_gui/qt/project_wizard/content/paths/QtProjectWizardContentPathsHeaderSearchGlobal.cpp @@ -16,14 +16,16 @@ QtProjectWizardContentPathsHeaderSearchGlobal::QtProjectWizardContentPathsHeader true) { setTitleString(QStringLiteral("Global Include Paths")); - setHelpString( + setHelpString(QString::fromStdString( "The Global Include Paths will be used in all your projects in addition to the project " "specific Include Paths. " "These paths are usually passed to the compiler with the '-isystem' flag.
" "
" "Use them to add system header paths (See " - "Finding System Header Locations or use the auto detection below)."); + "href=\"" + + utility::getDocumentationLink() + + "/#FindingSystemHeaderLocations\">" + "Finding System Header Locations or use the auto detection below).")); m_pathDetector = utility::getCxxHeaderPathDetector(); m_makePathsRelativeToProjectFileLocation = false; @@ -79,7 +81,8 @@ bool QtProjectWizardContentPathsHeaderSearchGlobal::check() "Your Global Include Paths contain other paths that hold C/C++ compiler headers, " "probably those of your local C/C++ compiler. They are possibly in conflict with the " "compiler headers of " - "Sourcetrail's C/C++ indexer. This can lead to compatibility errors during indexing. Do " + "Sourcetrail's C/C++ indexer. This can lead to compatibility errors during indexing. " + "Do " "you want to remove " "these paths?"); msgBox.setDetailedText(compilerHeaderPaths); diff --git a/src/lib_gui/qt/window/QtAbout.cpp b/src/lib_gui/qt/window/QtAbout.cpp index c02d19a2..13e31c8c 100644 --- a/src/lib_gui/qt/window/QtAbout.cpp +++ b/src/lib_gui/qt/window/QtAbout.cpp @@ -22,7 +22,8 @@ QSize QtAbout::sizeHint() const void QtAbout::setupAbout() { setStyleSheet( - utility::getStyleSheet(ResourcePaths::getGuiDirectoryPath().concatenate(L"about/about.css")).c_str()); + utility::getStyleSheet(ResourcePaths::getGuiDirectoryPath().concatenate(L"about/about.css")) + .c_str()); QVBoxLayout* windowLayout = new QVBoxLayout(); windowLayout->setContentsMargins(10, 10, 10, 0); @@ -68,18 +69,7 @@ void QtAbout::setupAbout() QHBoxLayout* layoutHorz1 = new QHBoxLayout(); windowLayout->addLayout(layoutHorz1); - QLabel* companyLabel = new QLabel( - QString::fromStdString("Coati Software KG
" - "Jakob-Haringer-Straße 1/127
" - "5020 Salzburg
" - "Austria
" - "support@sourcetrail.com
" - "sourcetrail.com")); - companyLabel->setOpenExternalLinks(true); - layoutHorz1->addWidget(companyLabel); - - layoutHorz1->addSpacing(120); + layoutHorz1->addStretch(); QLabel* developerLabel = new QLabel( QString::fromStdString("

" @@ -91,23 +81,41 @@ void QtAbout::setupAbout() "Andreas Stallinger
")); developerLabel->setObjectName(QStringLiteral("small")); layoutHorz1->addWidget(developerLabel); + + layoutHorz1->addStretch(); } windowLayout->addStretch(); - QLabel* acknowledgementsLabel = new QLabel(QString::fromStdString( - "Acknowledgements:
" - "Sourcetrail (aka Coati) 0.1 was created in the context of education at " - "Salzburg University " - "of Applied Sciences.
" - "Coati Software KG is member of Startup Salzburg.
" - "The development of Sourcetrail was funded by aws.")); - acknowledgementsLabel->setObjectName(QStringLiteral("small")); - acknowledgementsLabel->setWordWrap(true); - acknowledgementsLabel->setOpenExternalLinks(true); - windowLayout->addWidget(acknowledgementsLabel); + { + QLabel* acknowledgementsLabel = new QLabel(QString::fromStdString( + "Acknowledgements:
" + "Sourcetrail (aka Coati) 0.1 was created in the context of education at " + "Salzburg " + "University " + "of Applied Sciences.
" + "Coati Software KG is member of Startup Salzburg.
" + "The development of Sourcetrail was funded by aws.")); + acknowledgementsLabel->setObjectName(QStringLiteral("small")); + acknowledgementsLabel->setWordWrap(true); + acknowledgementsLabel->setOpenExternalLinks(true); + windowLayout->addWidget(acknowledgementsLabel); + windowLayout->addSpacing(10); + } - windowLayout->addSpacing(10); + { + QLabel* webLabel = new QLabel( + "Repository: github.com/CoatiSoftware/Sourcetrail", + this); + webLabel->setObjectName(QStringLiteral("small")); + webLabel->setOpenExternalLinks(true); + windowLayout->addWidget(webLabel); + windowLayout->addSpacing(10); + } } diff --git a/src/lib_gui/qt/window/QtMainWindow.cpp b/src/lib_gui/qt/window/QtMainWindow.cpp index 6a2c70bb..7f5bd999 100644 --- a/src/lib_gui/qt/window/QtMainWindow.cpp +++ b/src/lib_gui/qt/window/QtMainWindow.cpp @@ -133,9 +133,9 @@ QtMainWindow::QtMainWindow() if (utility::getOsType() != OS_MAC) { // can only be done once, because resetting the style on the QCoreApplication causes crash - app->setStyleSheet( - utility::getStyleSheet(ResourcePaths::getGuiDirectoryPath().concatenate(L"main/scrollbar.css")) - .c_str()); + app->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiDirectoryPath().concatenate( + L"main/scrollbar.css")) + .c_str()); } setupProjectMenu(); @@ -406,7 +406,8 @@ void QtMainWindow::setContentEnabled(bool enabled) void QtMainWindow::refreshStyle() { setStyleSheet( - utility::getStyleSheet(ResourcePaths::getGuiDirectoryPath().concatenate(L"main/main.css")).c_str()); + utility::getStyleSheet(ResourcePaths::getGuiDirectoryPath().concatenate(L"main/main.css")) + .c_str()); QFont tooltipFont = QToolTip::font(); tooltipFont.setPixelSize(ApplicationSettings::getInstance()->getFontSize()); @@ -508,7 +509,7 @@ void QtMainWindow::openSettings() void QtMainWindow::showDocumentation() { - QDesktopServices::openUrl(QUrl(QStringLiteral("https://sourcetrail.com/documentation/"))); + QDesktopServices::openUrl(QUrl(QString::fromStdString(utility::getDocumentationLink()))); } void QtMainWindow::showKeyboardShortcuts() @@ -543,7 +544,8 @@ void QtMainWindow::showLicenses() void QtMainWindow::showDataFolder() { QDesktopServices::openUrl(QUrl( - QString::fromStdWString(L"file:///" + UserPaths::getUserDataDirectoryPath().makeCanonical().wstr()), + QString::fromStdWString( + L"file:///" + UserPaths::getUserDataDirectoryPath().makeCanonical().wstr()), QUrl::TolerantMode)); } diff --git a/src/lib_gui/qt/window/QtStartScreen.cpp b/src/lib_gui/qt/window/QtStartScreen.cpp index 0bfd3a92..46e2086a 100644 --- a/src/lib_gui/qt/window/QtStartScreen.cpp +++ b/src/lib_gui/qt/window/QtStartScreen.cpp @@ -91,8 +91,6 @@ QtStartScreen::QtStartScreen(QWidget* parent) ResourcePaths::getGuiDirectoryPath().concatenate(L"icon/empty_icon.png").wstr())) , m_githubIcon(QString::fromStdWString( ResourcePaths::getGuiDirectoryPath().concatenate(L"startscreen/github_icon.png").wstr())) - , m_patreonIcon(QString::fromStdWString( - ResourcePaths::getGuiDirectoryPath().concatenate(L"startscreen/patreon_icon.png").wstr())) { } @@ -188,9 +186,9 @@ void QtStartScreen::setupStartScreen() versionLabel->setObjectName(QStringLiteral("boldLabel")); col->addWidget(versionLabel); - col->addSpacing(15); + col->addSpacing(20); - QPushButton* githubButton = new QPushButton(QStringLiteral("Contribute on GitHub"), this); + QPushButton* githubButton = new QPushButton(QStringLiteral("View on GitHub"), this); githubButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac githubButton->setObjectName(QStringLiteral("infoButton")); githubButton->setIcon(m_githubIcon); @@ -206,24 +204,6 @@ void QtStartScreen::setupStartScreen() }); col->addWidget(githubButton); - col->addSpacing(8); - - // QPushButton* patreonButton = new QPushButton("Support on Patreon", this); - QPushButton* patreonButton = new QPushButton(QStringLiteral("Become a Patron"), this); - patreonButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac - patreonButton->setObjectName(QStringLiteral("infoButton")); - patreonButton->setIcon(m_patreonIcon); - patreonButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - connect( - patreonButton, - &QPushButton::clicked, - []() - { - QDesktopServices::openUrl(QUrl( - QStringLiteral("https://www.patreon.com/sourcetrail"), QUrl::TolerantMode)); - }); - col->addWidget(patreonButton); - col->addSpacing(35); col->addStretch(); diff --git a/src/lib_gui/qt/window/QtStartScreen.h b/src/lib_gui/qt/window/QtStartScreen.h index ec3a7e73..dbccac0d 100644 --- a/src/lib_gui/qt/window/QtStartScreen.h +++ b/src/lib_gui/qt/window/QtStartScreen.h @@ -53,7 +53,6 @@ private: const QIcon m_javaIcon; const QIcon m_projectIcon; const QIcon m_githubIcon; - const QIcon m_patreonIcon; }; #endif // QT_START_SCREEN_H diff --git a/src/lib_gui/utility/utilityApp.cpp b/src/lib_gui/utility/utilityApp.cpp index 402527c1..a171e398 100644 --- a/src/lib_gui/utility/utilityApp.cpp +++ b/src/lib_gui/utility/utilityApp.cpp @@ -26,6 +26,11 @@ std::mutex s_runningProcessesMutex; std::set> s_runningProcesses; } // namespace utility +std::string utility::getDocumentationLink() +{ + return "https://sourcetrail.com/documentation"; +} + std::wstring utility::searchPath(const std::wstring& bin, bool& ok) { ok = false; @@ -44,19 +49,23 @@ std::wstring utility::searchPath(const std::wstring& bin) return searchPath(bin, ok); } -namespace { -template -bool safely_wait_for(boost::process::child& process, const std::chrono::duration< Rep, Period > & rel_time) +namespace +{ +template +bool safely_wait_for(boost::process::child& process, const std::chrono::duration& rel_time) { // This wrapper around boost::process::wait_for handles the following edge case: // Calling wait_for on an already exitted process will wait for the entire timeout. - if (process.running()) { + if (process.running()) + { return process.wait_for(rel_time); - } else { - return true; // The process exitted + } + else + { + return true; // The process exitted } } -} +} // namespace utility::ProcessOutput utility::executeProcess( const std::wstring& command, @@ -108,10 +117,12 @@ utility::ProcessOutput utility::executeProcess( s_runningProcesses.insert(process); } - ScopedFunctor remover([process]() { - std::lock_guard lock(s_runningProcessesMutex); - s_runningProcesses.erase(process); - }); + ScopedFunctor remover( + [process]() + { + std::lock_guard lock(s_runningProcessesMutex); + s_runningProcesses.erase(process); + }); bool outputReceived = false; std::vector buf(128); @@ -120,40 +131,41 @@ utility::ProcessOutput utility::executeProcess( std::function onStdOut = [&output, &buf, &stdOutBuffer, &ap, &onStdOut, &outputReceived, &logBuffer, logProcessOutput]( - const boost::system::error_code& ec, std::size_t size) { - std::string text; - text.reserve(size); - text.insert(text.end(), buf.begin(), buf.begin() + size); + const boost::system::error_code& ec, std::size_t size) + { + std::string text; + text.reserve(size); + text.insert(text.end(), buf.begin(), buf.begin() + size); - if (!text.empty()) - { - outputReceived = true; - } + if (!text.empty()) + { + outputReceived = true; + } - output += text; - if (logProcessOutput) + output += text; + if (logProcessOutput) + { + logBuffer += text; + const bool isEndOfLine = (logBuffer.back() == '\n'); + const std::vector lines = utility::splitToVector(logBuffer, "\n"); + for (size_t i = 0; i < lines.size() - (isEndOfLine ? 0 : 1); i++) { - logBuffer += text; - const bool isEndOfLine = (logBuffer.back() == '\n'); - const std::vector lines = utility::splitToVector(logBuffer, "\n"); - for (size_t i = 0; i < lines.size() - (isEndOfLine ? 0 : 1); i++) - { - LOG_INFO_BARE("Process output: " + lines[i]); - } - if (isEndOfLine) - { - logBuffer.clear(); - } - else - { - logBuffer = lines.back(); - } + LOG_INFO_BARE("Process output: " + lines[i]); } - if (!ec) + if (isEndOfLine) { - boost::asio::async_read(ap, stdOutBuffer, onStdOut); + logBuffer.clear(); } - }; + else + { + logBuffer = lines.back(); + } + } + if (!ec) + { + boost::asio::async_read(ap, stdOutBuffer, onStdOut); + } + }; boost::asio::async_read(ap, stdOutBuffer, onStdOut); ios.run(); diff --git a/src/lib_gui/utility/utilityApp.h b/src/lib_gui/utility/utilityApp.h index d46bbf48..4c0e3d9d 100644 --- a/src/lib_gui/utility/utilityApp.h +++ b/src/lib_gui/utility/utilityApp.h @@ -16,6 +16,8 @@ struct ProcessOutput int exitCode; }; +std::string getDocumentationLink(); + std::wstring searchPath(const std::wstring& bin, bool& ok); std::wstring searchPath(const std::wstring& bin);