summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2012-11-08 21:12:56 +0200
committerhjk <qthjk@ovi.com>2012-11-09 15:34:50 +0100
commit10be8c9a484161242d1c19da9f3a6956672967cd (patch)
treec1f3ce428c601b32e98352b8a633f1f71b9ff4cc /src/plugins
parent192e3f81b5f0da8754bac210f544596fc2dbf1b1 (diff)
downloadqt-creator-10be8c9a484161242d1c19da9f3a6956672967cd.tar.gz
InfoBar: Use Core::Id
Change-Id: I0918fbc20027a340facbedc685938a72d117d53b Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeeditor.cpp2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.cpp2
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp6
-rw-r--r--src/plugins/coreplugin/idocument.cpp4
-rw-r--r--src/plugins/coreplugin/infobar.cpp10
-rw-r--r--src/plugins/coreplugin/infobar.h9
-rw-r--r--src/plugins/debugger/qml/qmllivetextpreview.cpp4
-rw-r--r--src/plugins/designer/formeditorfactory.cpp2
-rw-r--r--src/plugins/find/searchresultwidget.cpp16
-rw-r--r--src/plugins/texteditor/basetexteditor.cpp5
-rw-r--r--src/plugins/texteditor/plaintexteditorfactory.cpp2
11 files changed, 31 insertions, 31 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
index 685bdfd168..d770e3ee1b 100644
--- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp
@@ -84,7 +84,7 @@ void CMakeEditor::markAsChanged()
if (m_infoBarShown)
return;
m_infoBarShown = true;
- Core::InfoBarEntry info(QLatin1String("CMakeEditor.RunCMake"),
+ Core::InfoBarEntry info(Core::Id("CMakeEditor.RunCMake"),
tr("Changes to cmake files are shown in the project tree after building."));
info.setCustomButtonInfo(tr("Build now"), this, SLOT(build()));
document()->infoBar()->addInfo(info);
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index 7b6e0ed10e..a2f1fc3345 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -208,7 +208,7 @@ bool CMakeProject::parseCMakeLists()
CMakeBuildConfiguration *activeBC = static_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
foreach (Core::IEditor *editor, Core::EditorManager::instance()->openedEditors())
if (isProjectFile(editor->document()->fileName()))
- editor->document()->infoBar()->removeInfo(QLatin1String("CMakeEditor.RunCMake"));
+ editor->document()->infoBar()->removeInfo(Core::Id("CMakeEditor.RunCMake"));
// Find cbp file
QString cbpFile = CMakeManager::findCbpFile(activeBC->buildDirectory());
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index eb2a3befff..7fb9569e57 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -1711,19 +1711,19 @@ void EditorManager::updateMakeWritableWarning()
if (ww) {
// we are about to change a read-only file, warn user
if (promptVCS) {
- InfoBarEntry info(QLatin1String(kMakeWritableWarning),
+ InfoBarEntry info(Id(kMakeWritableWarning),
tr("<b>Warning:</b> This file was not opened in %1 yet.")
.arg(versionControl->displayName()));
info.setCustomButtonInfo(tr("Open"), this, SLOT(vcsOpenCurrentEditor()));
curEditor->document()->infoBar()->addInfo(info);
} else {
- InfoBarEntry info(QLatin1String(kMakeWritableWarning),
+ InfoBarEntry info(Id(kMakeWritableWarning),
tr("<b>Warning:</b> You are changing a read-only file."));
info.setCustomButtonInfo(tr("Make Writable"), this, SLOT(makeCurrentEditorWritable()));
curEditor->document()->infoBar()->addInfo(info);
}
} else {
- curEditor->document()->infoBar()->removeInfo(QLatin1String(kMakeWritableWarning));
+ curEditor->document()->infoBar()->removeInfo(Id(kMakeWritableWarning));
}
}
}
diff --git a/src/plugins/coreplugin/idocument.cpp b/src/plugins/coreplugin/idocument.cpp
index 6c1a57d56a..a55c1599ac 100644
--- a/src/plugins/coreplugin/idocument.cpp
+++ b/src/plugins/coreplugin/idocument.cpp
@@ -85,7 +85,7 @@ void IDocument::setRestoredFrom(const QString &name)
{
m_autoSaveName = name;
m_restored = true;
- InfoBarEntry info(QLatin1String(kRestoredAutoSave),
+ InfoBarEntry info(Id(kRestoredAutoSave),
tr("File was restored from auto-saved copy. "
"Select Save to confirm or Revert to Saved to discard changes."));
infoBar()->addInfo(info);
@@ -98,7 +98,7 @@ void IDocument::removeAutoSaveFile()
m_autoSaveName.clear();
if (m_restored) {
m_restored = false;
- infoBar()->removeInfo(QLatin1String(kRestoredAutoSave));
+ infoBar()->removeInfo(Id(kRestoredAutoSave));
}
}
}
diff --git a/src/plugins/coreplugin/infobar.cpp b/src/plugins/coreplugin/infobar.cpp
index d2b9c4b3f7..1aa904ce26 100644
--- a/src/plugins/coreplugin/infobar.cpp
+++ b/src/plugins/coreplugin/infobar.cpp
@@ -40,7 +40,7 @@
namespace Core {
-InfoBarEntry::InfoBarEntry(const QString &_id, const QString &_infoText)
+InfoBarEntry::InfoBarEntry(Id _id, const QString &_infoText)
: id(_id)
, infoText(_infoText)
, object(0)
@@ -77,7 +77,7 @@ void InfoBar::addInfo(const InfoBarEntry &info)
emit changed();
}
-void InfoBar::removeInfo(const QString &id)
+void InfoBar::removeInfo(Id id)
{
QMutableListIterator<InfoBarEntry> it(m_infoBarEntries);
while (it.hasNext())
@@ -88,7 +88,7 @@ void InfoBar::removeInfo(const QString &id)
}
}
-bool InfoBar::containsInfo(const QString &id) const
+bool InfoBar::containsInfo(Id id) const
{
QListIterator<InfoBarEntry> it(m_infoBarEntries);
while (it.hasNext())
@@ -183,7 +183,7 @@ void InfoBarDisplay::update()
}
QToolButton *infoWidgetCloseButton = new QToolButton;
- infoWidgetCloseButton->setProperty("infoId", info.id);
+ infoWidgetCloseButton->setProperty("infoId", info.id.uniqueIdentifier());
// need to connect to cancelObjectbefore connecting to cancelButtonClicked,
// because the latter removes the button and with it any connect
@@ -216,7 +216,7 @@ void InfoBarDisplay::widgetDestroyed()
void InfoBarDisplay::cancelButtonClicked()
{
- m_infoBar->removeInfo(sender()->property("infoId").toString());
+ m_infoBar->removeInfo(Id::fromUniqueIdentifier(sender()->property("infoId").toInt()));
}
} // namespace Core
diff --git a/src/plugins/coreplugin/infobar.h b/src/plugins/coreplugin/infobar.h
index fe74197664..b1993d8aa0 100644
--- a/src/plugins/coreplugin/infobar.h
+++ b/src/plugins/coreplugin/infobar.h
@@ -31,6 +31,7 @@
#define INFOBAR_H
#include "core_global.h"
+#include <coreplugin/id.h>
#include <QObject>
@@ -46,14 +47,14 @@ class InfoBarDisplay;
class CORE_EXPORT InfoBarEntry
{
public:
- InfoBarEntry(const QString &_id, const QString &_infoText);
+ InfoBarEntry(Id _id, const QString &_infoText);
InfoBarEntry(const InfoBarEntry &other) { *this = other; }
void setCustomButtonInfo(const QString &_buttonText, QObject *_object, const char *_member);
void setCancelButtonInfo(QObject *_object, const char *_member);
void setCancelButtonInfo(const QString &_cancelButtonText, QObject *_object, const char *_member);
private:
- QString id;
+ Id id;
QString infoText;
QString buttonText;
QObject *object;
@@ -71,8 +72,8 @@ class CORE_EXPORT InfoBar : public QObject
public:
void addInfo(const InfoBarEntry &info);
- void removeInfo(const QString &id);
- bool containsInfo(const QString &id) const;
+ void removeInfo(Id id);
+ bool containsInfo(Id id) const;
void clear();
signals:
diff --git a/src/plugins/debugger/qml/qmllivetextpreview.cpp b/src/plugins/debugger/qml/qmllivetextpreview.cpp
index b7e5a3ba04..64f6a22852 100644
--- a/src/plugins/debugger/qml/qmllivetextpreview.cpp
+++ b/src/plugins/debugger/qml/qmllivetextpreview.cpp
@@ -714,7 +714,7 @@ void QmlLiveTextPreview::showSyncWarning(
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
if (editor) {
Core::InfoBar *infoBar = editor->editorDocument()->infoBar();
- Core::InfoBarEntry info(QLatin1String(INFO_OUT_OF_SYNC), errorMessage);
+ Core::InfoBarEntry info(Core::Id(INFO_OUT_OF_SYNC), errorMessage);
BaseToolsClient *toolsClient = m_inspectorAdapter->toolsClient();
if (toolsClient && toolsClient->supportReload())
info.setCustomButtonInfo(tr("Reload QML"), this,
@@ -735,7 +735,7 @@ void QmlLiveTextPreview::removeOutofSyncInfo()
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
if (editor) {
Core::InfoBar *infoBar = editor->editorDocument()->infoBar();
- infoBar->removeInfo(QLatin1String(INFO_OUT_OF_SYNC));
+ infoBar->removeInfo(Core::Id(INFO_OUT_OF_SYNC));
}
}
}
diff --git a/src/plugins/designer/formeditorfactory.cpp b/src/plugins/designer/formeditorfactory.cpp
index 08fb224af7..5a03eb61fb 100644
--- a/src/plugins/designer/formeditorfactory.cpp
+++ b/src/plugins/designer/formeditorfactory.cpp
@@ -75,7 +75,7 @@ Core::IDocument *FormEditorFactory::open(const QString &fileName)
if (!iface)
return 0;
if (qobject_cast<FormWindowEditor *>(iface)) {
- Core::InfoBarEntry info(QLatin1String(Constants::INFO_READ_ONLY),
+ Core::InfoBarEntry info(Core::Id(Constants::INFO_READ_ONLY),
tr("This file can only be edited in <b>Design</b> mode."));
info.setCustomButtonInfo(tr("Switch mode"), this, SLOT(designerModeClicked()));
iface->document()->infoBar()->addInfo(info);
diff --git a/src/plugins/find/searchresultwidget.cpp b/src/plugins/find/searchresultwidget.cpp
index bca0ca380b..6178848e2c 100644
--- a/src/plugins/find/searchresultwidget.cpp
+++ b/src/plugins/find/searchresultwidget.cpp
@@ -222,7 +222,7 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search
updateMatchesFoundLabel();
if (firstItems) {
if (showWarningMessage()) {
- Core::InfoBarEntry info(QLatin1String(UNDO_WARNING_ID), tr("This change cannot be undone."));
+ Core::InfoBarEntry info(Core::Id(UNDO_WARNING_ID), tr("This change cannot be undone."));
info.setCustomButtonInfo(tr("Do not warn again"), this, SLOT(hideNoUndoWarning()));
m_infoBar.addInfo(info);
}
@@ -240,7 +240,7 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search
} else if (m_count > SEARCHRESULT_WARNING_LIMIT && !m_sizeWarningOverridden && !m_sizeWarningActive) {
m_sizeWarningActive = true;
emit paused(true);
- Core::InfoBarEntry info(QLatin1String(SIZE_WARNING_ID),
+ Core::InfoBarEntry info(Core::Id(SIZE_WARNING_ID),
tr("The search resulted in more than %n items, do you still want to continue?",
0, SEARCHRESULT_WARNING_LIMIT));
info.setCancelButtonInfo(tr("Cancel"), this, SLOT(cancelAfterSizeWarning()));
@@ -367,7 +367,7 @@ void SearchResultWidget::restart()
m_searchResultTreeView->clear();
m_count = 0;
if (m_sizeWarningActive)
- m_infoBar.removeInfo(QLatin1String(SIZE_WARNING_ID));
+ m_infoBar.removeInfo(Core::Id(SIZE_WARNING_ID));
m_sizeWarningActive = false;
m_sizeWarningOverridden = false;
m_cancelButton->setVisible(true);
@@ -391,7 +391,7 @@ void SearchResultWidget::setSearchAgainEnabled(bool enabled)
void SearchResultWidget::finishSearch(bool canceled)
{
if (m_sizeWarningActive)
- m_infoBar.removeInfo(QLatin1String(SIZE_WARNING_ID));
+ m_infoBar.removeInfo(Core::Id(SIZE_WARNING_ID));
m_sizeWarningActive = false;
m_sizeWarningOverridden = false;
m_replaceTextEdit->setEnabled(m_count > 0);
@@ -409,20 +409,20 @@ void SearchResultWidget::sendRequestPopup()
void SearchResultWidget::hideNoUndoWarning()
{
setShowWarningMessage(false);
- m_infoBar.removeInfo(QLatin1String(UNDO_WARNING_ID));
+ m_infoBar.removeInfo(Core::Id(UNDO_WARNING_ID));
}
void SearchResultWidget::continueAfterSizeWarning()
{
m_sizeWarningOverridden = true;
m_sizeWarningActive = false;
- m_infoBar.removeInfo(QLatin1String(SIZE_WARNING_ID));
+ m_infoBar.removeInfo(Core::Id(SIZE_WARNING_ID));
emit paused(false);
}
void SearchResultWidget::cancelAfterSizeWarning()
{
- m_infoBar.removeInfo(QLatin1String(SIZE_WARNING_ID));
+ m_infoBar.removeInfo(Core::Id(SIZE_WARNING_ID));
m_sizeWarningOverridden = true;
m_sizeWarningActive = false;
emit cancelled();
@@ -460,7 +460,7 @@ void SearchResultWidget::searchAgain()
bool SearchResultWidget::showWarningMessage() const
{
- if (m_dontAskAgainGroup.isEmpty() || m_infoBar.containsInfo(QLatin1String(UNDO_WARNING_ID)))
+ if (m_dontAskAgainGroup.isEmpty() || m_infoBar.containsInfo(Core::Id(UNDO_WARNING_ID)))
return false;
// read settings
QSettings *settings = Core::ICore::settings();
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index d22f19e45a..55d2471094 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -568,14 +568,13 @@ void BaseTextEditorWidget::updateCannotDecodeInfo()
{
setReadOnly(d->m_document->hasDecodingError());
if (d->m_document->hasDecodingError()) {
- Core::InfoBarEntry info(
- QLatin1String(Constants::SELECT_ENCODING),
+ Core::InfoBarEntry info(Core::Id(Constants::SELECT_ENCODING),
tr("<b>Error:</b> Could not decode \"%1\" with \"%2\"-encoding. Editing not possible.")
.arg(displayName()).arg(QString::fromLatin1(d->m_document->codec()->name())));
info.setCustomButtonInfo(tr("Select Encoding"), this, SLOT(selectEncoding()));
d->m_document->infoBar()->addInfo(info);
} else {
- d->m_document->infoBar()->removeInfo(QLatin1String(Constants::SELECT_ENCODING));
+ d->m_document->infoBar()->removeInfo(Core::Id(Constants::SELECT_ENCODING));
}
}
diff --git a/src/plugins/texteditor/plaintexteditorfactory.cpp b/src/plugins/texteditor/plaintexteditorfactory.cpp
index d904152d9e..3b2363dd7e 100644
--- a/src/plugins/texteditor/plaintexteditorfactory.cpp
+++ b/src/plugins/texteditor/plaintexteditorfactory.cpp
@@ -91,7 +91,7 @@ void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor)
if (!file)
return;
PlainTextEditorWidget *textEditor = static_cast<PlainTextEditorWidget *>(editorEditable->editorWidget());
- const QString infoSyntaxDefinition = QLatin1String(Constants::INFO_SYNTAX_DEFINITION);
+ Core::Id infoSyntaxDefinition(Constants::INFO_SYNTAX_DEFINITION);
if (textEditor->isMissingSyntaxDefinition() &&
!textEditor->ignoreMissingSyntaxDefinition() &&
TextEditorSettings::instance()->highlighterSettings().alertWhenNoDefinition()) {