forked from qt-creator/qt-creator
Core: Use std::function for info bar callbacks
Change-Id: Iae7cbef053bfe86a7692e09f66af91117815d2a6 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -713,7 +713,9 @@ void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int
|
|||||||
else
|
else
|
||||||
text = tr("%2: Could not parse file: \"%1\".").arg(errorMessage).arg(line);
|
text = tr("%2: Could not parse file: \"%1\".").arg(errorMessage).arg(line);
|
||||||
Core::InfoBarEntry infoBarEntry(infoBarId, text);
|
Core::InfoBarEntry infoBarEntry(infoBarId, text);
|
||||||
infoBarEntry.setCustomButtonInfo(tr("Goto error"), this, SLOT(gotoError()));
|
infoBarEntry.setCustomButtonInfo(tr("Goto error"), [this]() {
|
||||||
|
m_textEditorWidget->gotoLine(m_errorLine, m_errorColumn);
|
||||||
|
});
|
||||||
infoBar->removeInfo(infoBarId);
|
infoBar->removeInfo(infoBarId);
|
||||||
infoBar->addInfo(infoBarEntry);
|
infoBar->addInfo(infoBarEntry);
|
||||||
|
|
||||||
@@ -729,11 +731,6 @@ void AndroidManifestEditorWidget::hideInfoBar()
|
|||||||
m_timerParseCheck.stop();
|
m_timerParseCheck.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidManifestEditorWidget::gotoError()
|
|
||||||
{
|
|
||||||
m_textEditorWidget->gotoLine(m_errorLine, m_errorColumn);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setApiLevel(QComboBox *box, const QDomElement &element, const QString &attribute)
|
void setApiLevel(QComboBox *box, const QDomElement &element, const QString &attribute)
|
||||||
{
|
{
|
||||||
if (!element.isNull() && element.hasAttribute(attribute)) {
|
if (!element.isNull() && element.hasAttribute(attribute)) {
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ private slots:
|
|||||||
void updateAddRemovePermissionButtons();
|
void updateAddRemovePermissionButtons();
|
||||||
void setAppName();
|
void setAppName();
|
||||||
void setPackageName();
|
void setPackageName();
|
||||||
void gotoError();
|
|
||||||
void updateInfoBar();
|
void updateInfoBar();
|
||||||
void updateSdkVersions();
|
void updateSdkVersions();
|
||||||
void startParseCheck();
|
void startParseCheck();
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
using namespace ProjectExplorer;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
namespace CMakeProjectManager {
|
namespace CMakeProjectManager {
|
||||||
@@ -80,24 +81,20 @@ void CMakeEditor::finalizeInitialization()
|
|||||||
InfoBarEntry info(infoRunCmake,
|
InfoBarEntry info(infoRunCmake,
|
||||||
tr("Changes to cmake files are shown in the project tree after building."),
|
tr("Changes to cmake files are shown in the project tree after building."),
|
||||||
InfoBarEntry::GlobalSuppressionEnabled);
|
InfoBarEntry::GlobalSuppressionEnabled);
|
||||||
info.setCustomButtonInfo(tr("Build now"), this, SLOT(build()));
|
info.setCustomButtonInfo(tr("Build now"), [document]() {
|
||||||
|
foreach (Project *p, SessionManager::projects()) {
|
||||||
|
if (CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p)) {
|
||||||
|
if (cmakeProject->isProjectFile(document->filePath())) {
|
||||||
|
ProjectExplorerPlugin::instance()->buildProject(cmakeProject);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
infoBar->addInfo(info);
|
infoBar->addInfo(info);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeEditor::build()
|
|
||||||
{
|
|
||||||
foreach (ProjectExplorer::Project *p, ProjectExplorer::SessionManager::projects()) {
|
|
||||||
CMakeProject *cmakeProject = qobject_cast<CMakeProject *>(p);
|
|
||||||
if (cmakeProject) {
|
|
||||||
if (cmakeProject->isProjectFile(document()->filePath())) {
|
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance()->buildProject(cmakeProject);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CMakeEditor::contextHelpId() const
|
QString CMakeEditor::contextHelpId() const
|
||||||
{
|
{
|
||||||
int pos = position();
|
int pos = position();
|
||||||
|
|||||||
@@ -49,9 +49,6 @@ public:
|
|||||||
QString contextHelpId() const;
|
QString contextHelpId() const;
|
||||||
|
|
||||||
friend class CMakeEditorWidget;
|
friend class CMakeEditorWidget;
|
||||||
|
|
||||||
public slots:
|
|
||||||
void build();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMakeEditorFactory : public TextEditor::BaseTextEditorFactory
|
class CMakeEditorFactory : public TextEditor::BaseTextEditorFactory
|
||||||
|
|||||||
@@ -1269,12 +1269,12 @@ void EditorManagerPrivate::updateMakeWritableWarning()
|
|||||||
InfoBarEntry info(Id(kMakeWritableWarning),
|
InfoBarEntry info(Id(kMakeWritableWarning),
|
||||||
tr("<b>Warning:</b> This file was not opened in %1 yet.")
|
tr("<b>Warning:</b> This file was not opened in %1 yet.")
|
||||||
.arg(versionControl->displayName()));
|
.arg(versionControl->displayName()));
|
||||||
info.setCustomButtonInfo(tr("Open"), d, SLOT(vcsOpenCurrentEditor()));
|
info.setCustomButtonInfo(tr("Open"), &vcsOpenCurrentEditor);
|
||||||
document->infoBar()->addInfo(info);
|
document->infoBar()->addInfo(info);
|
||||||
} else {
|
} else {
|
||||||
InfoBarEntry info(Id(kMakeWritableWarning),
|
InfoBarEntry info(Id(kMakeWritableWarning),
|
||||||
tr("<b>Warning:</b> You are changing a read-only file."));
|
tr("<b>Warning:</b> You are changing a read-only file."));
|
||||||
info.setCustomButtonInfo(tr("Make Writable"), d, SLOT(makeCurrentEditorWritable()));
|
info.setCustomButtonInfo(tr("Make Writable"), &makeCurrentEditorWritable);
|
||||||
document->infoBar()->addInfo(info);
|
document->infoBar()->addInfo(info);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -110,11 +110,12 @@ public:
|
|||||||
|
|
||||||
static void updateWindowTitleForDocument(IDocument *document, QWidget *window);
|
static void updateWindowTitleForDocument(IDocument *document, QWidget *window);
|
||||||
|
|
||||||
|
static void vcsOpenCurrentEditor();
|
||||||
|
static void makeCurrentEditorWritable();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
static bool saveDocument(Core::IDocument *document);
|
static bool saveDocument(Core::IDocument *document);
|
||||||
static bool saveDocumentAs(Core::IDocument *document);
|
static bool saveDocumentAs(Core::IDocument *document);
|
||||||
static void makeCurrentEditorWritable();
|
|
||||||
static void vcsOpenCurrentEditor();
|
|
||||||
|
|
||||||
static void split(Qt::Orientation orientation);
|
static void split(Qt::Orientation orientation);
|
||||||
static void removeAllSplits();
|
static void removeAllSplits();
|
||||||
|
|||||||
@@ -260,8 +260,8 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search
|
|||||||
Core::InfoBarEntry info(sizeWarningId,
|
Core::InfoBarEntry info(sizeWarningId,
|
||||||
tr("The search resulted in more than %n items, do you still want to continue?",
|
tr("The search resulted in more than %n items, do you still want to continue?",
|
||||||
0, SEARCHRESULT_WARNING_LIMIT));
|
0, SEARCHRESULT_WARNING_LIMIT));
|
||||||
info.setCancelButtonInfo(tr("Cancel"), this, SLOT(cancelAfterSizeWarning()));
|
info.setCancelButtonInfo(tr("Cancel"), [this]() { cancelAfterSizeWarning(); });
|
||||||
info.setCustomButtonInfo(tr("Continue"), this, SLOT(continueAfterSizeWarning()));
|
info.setCustomButtonInfo(tr("Continue"), [this]() { continueAfterSizeWarning(); });
|
||||||
m_infoBar.addInfo(info);
|
m_infoBar.addInfo(info);
|
||||||
emit requestPopup(false/*no focus*/);
|
emit requestPopup(false/*no focus*/);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,14 +110,15 @@ signals:
|
|||||||
void navigateStateChanged();
|
void navigateStateChanged();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void continueAfterSizeWarning();
|
|
||||||
void cancelAfterSizeWarning();
|
|
||||||
void handleJumpToSearchResult(const SearchResultItem &item);
|
void handleJumpToSearchResult(const SearchResultItem &item);
|
||||||
void handleReplaceButton();
|
void handleReplaceButton();
|
||||||
void cancel();
|
void cancel();
|
||||||
void searchAgain();
|
void searchAgain();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void continueAfterSizeWarning();
|
||||||
|
void cancelAfterSizeWarning();
|
||||||
|
|
||||||
QList<SearchResultItem> checkedItems() const;
|
QList<SearchResultItem> checkedItems() const;
|
||||||
void updateMatchesFoundLabel();
|
void updateMatchesFoundLabel();
|
||||||
|
|
||||||
|
|||||||
@@ -46,32 +46,25 @@ QSet<Id> InfoBar::globallySuppressed;
|
|||||||
InfoBarEntry::InfoBarEntry(Id _id, const QString &_infoText, GlobalSuppressionMode _globalSuppression)
|
InfoBarEntry::InfoBarEntry(Id _id, const QString &_infoText, GlobalSuppressionMode _globalSuppression)
|
||||||
: id(_id)
|
: id(_id)
|
||||||
, infoText(_infoText)
|
, infoText(_infoText)
|
||||||
, object(0)
|
|
||||||
, buttonPressMember(0)
|
|
||||||
, cancelObject(0)
|
|
||||||
, cancelButtonPressMember(0)
|
|
||||||
, globalSuppression(_globalSuppression)
|
, globalSuppression(_globalSuppression)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoBarEntry::setCustomButtonInfo(const QString &_buttonText, QObject *_object, const char *_member)
|
void InfoBarEntry::setCustomButtonInfo(const QString &_buttonText, CallBack callBack)
|
||||||
{
|
{
|
||||||
buttonText = _buttonText;
|
buttonText = _buttonText;
|
||||||
object = _object;
|
m_buttonCallBack = callBack;
|
||||||
buttonPressMember = _member;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoBarEntry::setCancelButtonInfo(QObject *_object, const char *_member)
|
void InfoBarEntry::setCancelButtonInfo(CallBack callBack)
|
||||||
{
|
{
|
||||||
cancelObject = _object;
|
m_cancelButtonCallBack = callBack;
|
||||||
cancelButtonPressMember = _member;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoBarEntry::setCancelButtonInfo(const QString &_cancelButtonText, QObject *_object, const char *_member)
|
void InfoBarEntry::setCancelButtonInfo(const QString &_cancelButtonText, CallBack callBack)
|
||||||
{
|
{
|
||||||
cancelButtonText = _cancelButtonText;
|
cancelButtonText = _cancelButtonText;
|
||||||
cancelObject = _object;
|
m_cancelButtonCallBack = callBack;
|
||||||
cancelButtonPressMember = _member;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -226,7 +219,7 @@ void InfoBarDisplay::update()
|
|||||||
if (!info.buttonText.isEmpty()) {
|
if (!info.buttonText.isEmpty()) {
|
||||||
QToolButton *infoWidgetButton = new QToolButton;
|
QToolButton *infoWidgetButton = new QToolButton;
|
||||||
infoWidgetButton->setText(info.buttonText);
|
infoWidgetButton->setText(info.buttonText);
|
||||||
connect(infoWidgetButton, SIGNAL(clicked()), info.object, info.buttonPressMember);
|
connect(infoWidgetButton, &QAbstractButton::clicked, [info]() { info.m_buttonCallBack(); });
|
||||||
|
|
||||||
hbox->addWidget(infoWidgetButton);
|
hbox->addWidget(infoWidgetButton);
|
||||||
}
|
}
|
||||||
@@ -244,9 +237,8 @@ void InfoBarDisplay::update()
|
|||||||
|
|
||||||
// need to connect to cancelObjectbefore connecting to cancelButtonClicked,
|
// need to connect to cancelObjectbefore connecting to cancelButtonClicked,
|
||||||
// because the latter removes the button and with it any connect
|
// because the latter removes the button and with it any connect
|
||||||
if (info.cancelObject)
|
if (info.m_cancelButtonCallBack)
|
||||||
connect(infoWidgetCloseButton, SIGNAL(clicked()),
|
connect(infoWidgetCloseButton, &QAbstractButton::clicked, info.m_cancelButtonCallBack);
|
||||||
info.cancelObject, info.cancelButtonPressMember);
|
|
||||||
connect(infoWidgetCloseButton, SIGNAL(clicked()), SLOT(cancelButtonClicked()));
|
connect(infoWidgetCloseButton, SIGNAL(clicked()), SLOT(cancelButtonClicked()));
|
||||||
|
|
||||||
if (info.cancelButtonText.isEmpty()) {
|
if (info.cancelButtonText.isEmpty()) {
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QBoxLayout;
|
class QBoxLayout;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
@@ -56,19 +58,19 @@ public:
|
|||||||
|
|
||||||
InfoBarEntry(Id _id, const QString &_infoText, GlobalSuppressionMode _globalSuppression = GlobalSuppressionDisabled);
|
InfoBarEntry(Id _id, const QString &_infoText, GlobalSuppressionMode _globalSuppression = GlobalSuppressionDisabled);
|
||||||
InfoBarEntry(const InfoBarEntry &other) { *this = other; }
|
InfoBarEntry(const InfoBarEntry &other) { *this = other; }
|
||||||
void setCustomButtonInfo(const QString &_buttonText, QObject *_object, const char *_member);
|
|
||||||
void setCancelButtonInfo(QObject *_object, const char *_member);
|
typedef std::function<void()> CallBack;
|
||||||
void setCancelButtonInfo(const QString &_cancelButtonText, QObject *_object, const char *_member);
|
void setCustomButtonInfo(const QString &_buttonText, CallBack callBack);
|
||||||
|
void setCancelButtonInfo(CallBack callBack);
|
||||||
|
void setCancelButtonInfo(const QString &_cancelButtonText, CallBack callBack);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Id id;
|
Id id;
|
||||||
QString infoText;
|
QString infoText;
|
||||||
QString buttonText;
|
QString buttonText;
|
||||||
QObject *object;
|
CallBack m_buttonCallBack;
|
||||||
const char *buttonPressMember;
|
|
||||||
QString cancelButtonText;
|
QString cancelButtonText;
|
||||||
QObject *cancelObject;
|
CallBack m_cancelButtonCallBack;
|
||||||
const char *cancelButtonPressMember;
|
|
||||||
GlobalSuppressionMode globalSuppression;
|
GlobalSuppressionMode globalSuppression;
|
||||||
friend class InfoBar;
|
friend class InfoBar;
|
||||||
friend class InfoBarDisplay;
|
friend class InfoBarDisplay;
|
||||||
|
|||||||
@@ -329,8 +329,12 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
|
|||||||
.arg(versionControl->displayName()),
|
.arg(versionControl->displayName()),
|
||||||
InfoBarEntry::GlobalSuppressionEnabled);
|
InfoBarEntry::GlobalSuppressionEnabled);
|
||||||
d->m_unconfiguredVcs = versionControl;
|
d->m_unconfiguredVcs = versionControl;
|
||||||
info.setCustomButtonInfo(Core::ICore::msgShowOptionsDialog(), m_instance,
|
info.setCustomButtonInfo(Core::ICore::msgShowOptionsDialog(), []() {
|
||||||
SLOT(configureVcs()));
|
QTC_ASSERT(d->m_unconfiguredVcs, return);
|
||||||
|
ICore::showOptionsDialog(Id(VcsBase::Constants::VCS_SETTINGS_CATEGORY),
|
||||||
|
d->m_unconfiguredVcs->id());
|
||||||
|
});
|
||||||
|
|
||||||
infoBar->addInfo(info);
|
infoBar->addInfo(info);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@@ -477,13 +481,6 @@ void VcsManager::clearVersionControlCache()
|
|||||||
emit m_instance->repositoryChanged(repo);
|
emit m_instance->repositoryChanged(repo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VcsManager::configureVcs()
|
|
||||||
{
|
|
||||||
QTC_ASSERT(d->m_unconfiguredVcs, return);
|
|
||||||
ICore::showOptionsDialog(Id(VcsBase::Constants::VCS_SETTINGS_CATEGORY),
|
|
||||||
d->m_unconfiguredVcs->id());
|
|
||||||
}
|
|
||||||
|
|
||||||
void VcsManager::handleConfigurationChanges()
|
void VcsManager::handleConfigurationChanges()
|
||||||
{
|
{
|
||||||
d->m_cachedAdditionalToolsPathsDirty = true;
|
d->m_cachedAdditionalToolsPathsDirty = true;
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ public slots:
|
|||||||
static void clearVersionControlCache();
|
static void clearVersionControlCache();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
static void configureVcs();
|
|
||||||
void handleConfigurationChanges();
|
void handleConfigurationChanges();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -718,19 +718,15 @@ void QmlLiveTextPreview::showSyncWarning(
|
|||||||
Core::InfoBarEntry info(Core::Id(INFO_OUT_OF_SYNC), errorMessage);
|
Core::InfoBarEntry info(Core::Id(INFO_OUT_OF_SYNC), errorMessage);
|
||||||
BaseToolsClient *toolsClient = m_inspectorAdapter->toolsClient();
|
BaseToolsClient *toolsClient = m_inspectorAdapter->toolsClient();
|
||||||
if (toolsClient && toolsClient->supportReload())
|
if (toolsClient && toolsClient->supportReload())
|
||||||
info.setCustomButtonInfo(tr("Reload QML"), this,
|
info.setCustomButtonInfo(tr("Reload QML"), [this]() {
|
||||||
SLOT(reloadQml()));
|
removeOutofSyncInfo();
|
||||||
|
emit reloadRequest();
|
||||||
|
});
|
||||||
infoBar->addInfo(info);
|
infoBar->addInfo(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlLiveTextPreview::reloadQml()
|
|
||||||
{
|
|
||||||
removeOutofSyncInfo();
|
|
||||||
emit reloadRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QmlLiveTextPreview::removeOutofSyncInfo()
|
void QmlLiveTextPreview::removeOutofSyncInfo()
|
||||||
{
|
{
|
||||||
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
|
foreach (TextEditor::BaseTextEditorWidget *editor, m_editors) {
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ signals:
|
|||||||
public slots:
|
public slots:
|
||||||
void setApplyChangesToQmlInspector(bool applyChanges);
|
void setApplyChangesToQmlInspector(bool applyChanges);
|
||||||
void updateDebugIds();
|
void updateDebugIds();
|
||||||
void reloadQml();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void changeSelectedElements(const QList<QmlJS::AST::UiObjectMember *> offsets,
|
void changeSelectedElements(const QList<QmlJS::AST::UiObjectMember *> offsets,
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
using namespace Core;
|
||||||
using namespace Designer::Constants;
|
using namespace Designer::Constants;
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
@@ -62,16 +63,11 @@ Core::IEditor *FormEditorFactory::createEditor()
|
|||||||
if (data.formWindowEditor) {
|
if (data.formWindowEditor) {
|
||||||
Core::InfoBarEntry info(Core::Id(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."));
|
tr("This file can only be edited in <b>Design</b> mode."));
|
||||||
info.setCustomButtonInfo(tr("Switch Mode"), this, SLOT(designerModeClicked()));
|
info.setCustomButtonInfo(tr("Switch Mode"), []() { ModeManager::activateMode(Core::Constants::MODE_DESIGN); });
|
||||||
data.formWindowEditor->document()->infoBar()->addInfo(info);
|
data.formWindowEditor->document()->infoBar()->addInfo(info);
|
||||||
}
|
}
|
||||||
return data.formWindowEditor;
|
return data.formWindowEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormEditorFactory::designerModeClicked()
|
|
||||||
{
|
|
||||||
Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Designer
|
} // namespace Designer
|
||||||
|
|||||||
@@ -43,9 +43,6 @@ public:
|
|||||||
FormEditorFactory();
|
FormEditorFactory();
|
||||||
|
|
||||||
Core::IEditor *createEditor();
|
Core::IEditor *createEditor();
|
||||||
|
|
||||||
private slots:
|
|
||||||
void designerModeClicked();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -536,8 +536,12 @@ static void updateEditorInfoBar(BaseTextEditorWidget *widget)
|
|||||||
BaseTextEditor::tr("A highlight definition was not found for this file. "
|
BaseTextEditor::tr("A highlight definition was not found for this file. "
|
||||||
"Would you like to try to find one?"),
|
"Would you like to try to find one?"),
|
||||||
InfoBarEntry::GlobalSuppressionEnabled);
|
InfoBarEntry::GlobalSuppressionEnabled);
|
||||||
info.setCustomButtonInfo(BaseTextEditor::tr("Show Highlighter Options..."),
|
info.setCustomButtonInfo(BaseTextEditor::tr("Show Highlighter Options..."), [widget]() {
|
||||||
widget, SLOT(acceptMissingSyntaxDefinitionInfo()));
|
ICore::showOptionsDialog(Constants::TEXT_EDITOR_SETTINGS_CATEGORY,
|
||||||
|
Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS,
|
||||||
|
widget);
|
||||||
|
});
|
||||||
|
|
||||||
infoBar->addInfo(info);
|
infoBar->addInfo(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -943,7 +947,7 @@ void BaseTextEditorWidgetPrivate::updateCannotDecodeInfo()
|
|||||||
InfoBarEntry info(selectEncodingId,
|
InfoBarEntry info(selectEncodingId,
|
||||||
BaseTextEditorWidget::tr("<b>Error:</b> Could not decode \"%1\" with \"%2\"-encoding. Editing not possible.")
|
BaseTextEditorWidget::tr("<b>Error:</b> Could not decode \"%1\" with \"%2\"-encoding. Editing not possible.")
|
||||||
.arg(m_document->displayName()).arg(QString::fromLatin1(m_document->codec()->name())));
|
.arg(m_document->displayName()).arg(QString::fromLatin1(m_document->codec()->name())));
|
||||||
info.setCustomButtonInfo(BaseTextEditorWidget::tr("Select Encoding"), q, SLOT(selectEncoding()));
|
info.setCustomButtonInfo(BaseTextEditorWidget::tr("Select Encoding"), [this]() { q->selectEncoding(); });
|
||||||
infoBar->addInfo(info);
|
infoBar->addInfo(info);
|
||||||
} else {
|
} else {
|
||||||
infoBar->removeInfo(selectEncodingId);
|
infoBar->removeInfo(selectEncodingId);
|
||||||
@@ -7139,13 +7143,6 @@ bool BaseTextEditorWidget::isMissingSyntaxDefinition() const
|
|||||||
return d->m_isMissingSyntaxDefinition;
|
return d->m_isMissingSyntaxDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditorWidget::acceptMissingSyntaxDefinitionInfo()
|
|
||||||
{
|
|
||||||
ICore::showOptionsDialog(Constants::TEXT_EDITOR_SETTINGS_CATEGORY,
|
|
||||||
Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS,
|
|
||||||
this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The remnants of PlainTextEditor.
|
// The remnants of PlainTextEditor.
|
||||||
void BaseTextEditorWidget::setupAsPlainEditor()
|
void BaseTextEditorWidget::setupAsPlainEditor()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -468,8 +468,6 @@ public:
|
|||||||
/// Abort code assistant if it is running.
|
/// Abort code assistant if it is running.
|
||||||
void abortAssist();
|
void abortAssist();
|
||||||
|
|
||||||
Q_INVOKABLE void acceptMissingSyntaxDefinitionInfo(); // used internally
|
|
||||||
|
|
||||||
void configureMimeType(const QString &mimeType);
|
void configureMimeType(const QString &mimeType);
|
||||||
void configureMimeType(const Core::MimeType &mimeType);
|
void configureMimeType(const Core::MimeType &mimeType);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user