forked from qt-creator/qt-creator
OutputPane: Add an id() for the settings
It was using the displayName for the key in the settings (visibility and shortcut), which is annoying when changing the language. Change-Id: Iffa784347c59389599c90f468dcba15834599c39 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -363,6 +363,7 @@ SearchResultWindow *SearchResultWindow::m_instance = nullptr;
|
||||
SearchResultWindow::SearchResultWindow(QWidget *newSearchPanel)
|
||||
: d(new SearchResultWindowPrivate(this, newSearchPanel))
|
||||
{
|
||||
setId("SearchResults");
|
||||
setDisplayName(Tr::tr("Search Results"));
|
||||
m_instance = this;
|
||||
readSettings();
|
||||
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
|
||||
virtual QWidget *outputWidget(QWidget *parent) = 0;
|
||||
virtual QList<QWidget *> toolBarWidgets() const;
|
||||
Utils::Id id() const;
|
||||
QString displayName() const;
|
||||
virtual const QList<OutputWindow *> outputWindows() const { return {}; }
|
||||
virtual void ensureWindowVisible(OutputWindow *) { }
|
||||
@@ -81,6 +82,7 @@ signals:
|
||||
void fontChanged(const QFont &font);
|
||||
|
||||
protected:
|
||||
void setId(const Utils::Id &id);
|
||||
void setDisplayName(const QString &name);
|
||||
|
||||
void setupFilterUi(const Utils::Key &historyKey);
|
||||
@@ -106,6 +108,7 @@ private:
|
||||
Utils::Id filterCaseSensitivityActionId() const;
|
||||
Utils::Id filterInvertedActionId() const;
|
||||
|
||||
Utils::Id m_id;
|
||||
QString m_displayName;
|
||||
Core::CommandButton * const m_zoomInButton;
|
||||
Core::CommandButton * const m_zoomOutButton;
|
||||
|
||||
@@ -20,6 +20,7 @@ const char zoomSettingsKey[] = "Core/MessageOutput/Zoom";
|
||||
|
||||
MessageOutputWindow::MessageOutputWindow()
|
||||
{
|
||||
setId("GeneralMessages");
|
||||
setDisplayName(Tr::tr("General Messages"));
|
||||
m_widget = new OutputWindow(Context(Constants::C_GENERAL_OUTPUT_PANE), zoomSettingsKey);
|
||||
m_widget->setReadOnly(true);
|
||||
|
||||
@@ -103,6 +103,23 @@ QList<QWidget *> IOutputPane::toolBarWidgets() const
|
||||
return widgets << m_zoomInButton << m_zoomOutButton;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the ID of the output pane.
|
||||
*/
|
||||
Id IOutputPane::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the ID of the output pane to \a id.
|
||||
This is used for persisting the visibility state.
|
||||
*/
|
||||
void IOutputPane::setId(const Utils::Id &id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the translated display name of the output pane.
|
||||
*/
|
||||
@@ -481,9 +498,7 @@ void OutputPaneManager::initialize()
|
||||
|
||||
minTitleWidth = qMax(minTitleWidth, titleFm.horizontalAdvance(outPane->displayName()));
|
||||
|
||||
QString suffix = outPane->displayName().simplified();
|
||||
suffix.remove(QLatin1Char(' '));
|
||||
data.id = baseId.withSuffix(suffix);
|
||||
data.id = baseId.withSuffix(outPane->id().toString());
|
||||
data.action = new QAction(outPane->displayName(), m_instance);
|
||||
Command *cmd = ActionManager::registerAction(data.action, data.id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user