Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
e25c8b39
Commit
e25c8b39
authored
Feb 27, 2021
by
Dominik Haumann
Browse files
Simplify Output message when running external tools
Also, hide the return value if it is zero.
parent
d05f7728
Changes
1
Hide whitespace changes
Inline
Side-by-side
addons/externaltools/externaltoolsplugin.cpp
View file @
e25c8b39
...
...
@@ -172,22 +172,24 @@ void KateExternalToolsPlugin::runTool(const KateExternalTool &tool, KTextEditor:
auto
pluginView
=
viewForMainWindow
(
mw
);
pluginView
->
clearToolView
();
// expand macros
auto
editor
=
KTextEditor
::
Editor
::
instance
();
editor
->
expandText
(
copy
->
executable
,
view
,
copy
->
executable
);
editor
->
expandText
(
copy
->
arguments
,
view
,
copy
->
arguments
);
editor
->
expandText
(
copy
->
workingDir
,
view
,
copy
->
workingDir
);
editor
->
expandText
(
copy
->
input
,
view
,
copy
->
input
);
const
QString
messageText
=
copy
->
input
.
isEmpty
()
?
i18n
(
"Running %1: %2 %3"
,
copy
->
name
,
copy
->
executable
,
copy
->
arguments
)
:
i18n
(
"Running %1: %2 %3 with input %4"
,
copy
->
name
,
copy
->
executable
,
copy
->
arguments
,
tool
.
input
);
// use generic output view for status
QVariantMap
genericMessage
;
genericMessage
.
insert
(
QStringLiteral
(
"type"
),
QStringLiteral
(
"Info"
));
genericMessage
.
insert
(
QStringLiteral
(
"category"
),
i18n
(
"External Tools"
));
genericMessage
.
insert
(
QStringLiteral
(
"categoryIcon"
),
QIcon
::
fromTheme
(
QStringLiteral
(
"system-run"
)));
genericMessage
.
insert
(
QStringLiteral
(
"text"
),
i18n
(
"Running external tool: %1
\n
- Executable: %2
\n
- Arguments: %3
\n
- Input: %4"
,
copy
->
name
,
copy
->
executable
,
copy
->
arguments
,
copy
->
input
));
genericMessage
.
insert
(
QStringLiteral
(
"text"
),
messageText
);
Q_EMIT
pluginView
->
message
(
genericMessage
);
// expand macros
auto
editor
=
KTextEditor
::
Editor
::
instance
();
editor
->
expandText
(
copy
->
executable
,
view
,
copy
->
executable
);
editor
->
expandText
(
copy
->
arguments
,
view
,
copy
->
arguments
);
editor
->
expandText
(
copy
->
workingDir
,
view
,
copy
->
workingDir
);
editor
->
expandText
(
copy
->
input
,
view
,
copy
->
input
);
// Allocate runner on heap such that it lives as long as the child
// process is running and does not block the main thread.
...
...
@@ -273,9 +275,9 @@ void KateExternalToolsPlugin::handleToolFinished(KateToolRunner *runner, int exi
// print crash or exit code
if
(
crashed
)
{
messageBody
+=
i18n
(
"
Warning: External tool crashed."
);
}
else
{
messageBody
+=
i18n
(
"
F
inished with exit code
:
%
1"
,
exitCode
);
messageBody
+=
i18n
(
"
%1 crashed"
,
runner
->
tool
()
->
translatedName
()
);
}
else
if
(
exitCode
!=
0
)
{
messageBody
+=
i18n
(
"
%1 f
inished with exit code %
2"
,
runner
->
tool
()
->
translatedName
()
,
exitCode
);
}
// use generic output view for status
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment