ProjectExplorer: Dis-ambiguate issues pane's "show output" action

Amends 08a86169db.

Fixes: QTCREATORBUG-27031
Change-Id: Ie6d214673f6c1c52aab1a035c84a7381f9965588
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2022-02-09 18:00:59 +01:00
parent 2eef90e86f
commit 400ada2daa
4 changed files with 24 additions and 8 deletions

View File

@@ -172,7 +172,10 @@ AppOutputPane::AppOutputPane() :
m_attachButton(new QToolButton), m_attachButton(new QToolButton),
m_settingsButton(new QToolButton), m_settingsButton(new QToolButton),
m_formatterWidget(new QWidget), m_formatterWidget(new QWidget),
m_handler(new ShowOutputTaskHandler(this)) m_handler(new ShowOutputTaskHandler(this,
tr("Show &App Output"),
tr("Show the output that generated this issue in the application output window"),
tr("A")))
{ {
ExtensionSystem::PluginManager::addObject(m_handler); ExtensionSystem::PluginManager::addObject(m_handler);

View File

@@ -116,7 +116,10 @@ CompileOutputWindow::CompileOutputWindow(QAction *cancelBuildAction) :
qRegisterMetaType<QTextCharFormat>("QTextCharFormat"); qRegisterMetaType<QTextCharFormat>("QTextCharFormat");
m_handler = new ShowOutputTaskHandler(this); m_handler = new ShowOutputTaskHandler(this,
tr("Show Compile &Output"),
tr("Show the output that generated this issue in the compile output window"),
tr("O"));
ExtensionSystem::PluginManager::addObject(m_handler); ExtensionSystem::PluginManager::addObject(m_handler);
setupContext(C_COMPILE_OUTPUT, m_outputWindow); setupContext(C_COMPILE_OUTPUT, m_outputWindow);
loadSettings(); loadSettings();

View File

@@ -30,15 +30,19 @@
#include <coreplugin/ioutputpane.h> #include <coreplugin/ioutputpane.h>
#include <coreplugin/outputwindow.h> #include <coreplugin/outputwindow.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <QAction> #include <QAction>
namespace ProjectExplorer { namespace ProjectExplorer {
namespace Internal { namespace Internal {
ShowOutputTaskHandler::ShowOutputTaskHandler(Core::IOutputPane *window) : m_window(window) ShowOutputTaskHandler::ShowOutputTaskHandler(Core::IOutputPane *window, const QString &text,
const QString &tooltip, const QString &shortcut)
: m_window(window), m_text(text), m_tooltip(tooltip), m_shortcut(shortcut)
{ {
Q_ASSERT(m_window); QTC_CHECK(m_window);
QTC_CHECK(!m_text.isEmpty());
} }
bool ShowOutputTaskHandler::canHandle(const Task &task) const bool ShowOutputTaskHandler::canHandle(const Task &task) const
@@ -64,9 +68,11 @@ void ShowOutputTaskHandler::handle(const Task &task)
QAction *ShowOutputTaskHandler::createAction(QObject *parent) const QAction *ShowOutputTaskHandler::createAction(QObject *parent) const
{ {
QAction *outputAction = new QAction(tr("Show &Output"), parent); QAction * const outputAction = new QAction(m_text, parent);
outputAction->setToolTip(tr("Show output generating this issue.")); if (!m_tooltip.isEmpty())
outputAction->setShortcut(QKeySequence(tr("O"))); outputAction->setToolTip(m_tooltip);
if (!m_shortcut.isEmpty())
outputAction->setShortcut(QKeySequence(m_shortcut));
outputAction->setShortcutContext(Qt::WidgetWithChildrenShortcut); outputAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
return outputAction; return outputAction;
} }

View File

@@ -37,7 +37,8 @@ class ShowOutputTaskHandler : public ITaskHandler
Q_OBJECT Q_OBJECT
public: public:
explicit ShowOutputTaskHandler(Core::IOutputPane *window); explicit ShowOutputTaskHandler(Core::IOutputPane *window, const QString &text,
const QString &tooltip, const QString &shortcut);
bool canHandle(const Task &) const override; bool canHandle(const Task &) const override;
void handle(const Task &task) override; void handle(const Task &task) override;
@@ -45,6 +46,9 @@ public:
private: private:
Core::IOutputPane * const m_window; Core::IOutputPane * const m_window;
const QString m_text;
const QString m_tooltip;
const QString m_shortcut;
}; };
} // namespace Internal } // namespace Internal