forked from qt-creator/qt-creator
TextEditor: move Link class to separate header in Utils
Link is a common class and is used across the plugins. Change-Id: Id92e47e1b8604316ca8b970804e57abaf404ec28 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -246,7 +246,7 @@ void CppEditorOutline::gotoSymbolInEditor()
|
||||
if (!symbol)
|
||||
return;
|
||||
|
||||
const TextEditor::TextEditorWidget::Link &link = CppTools::linkToSymbol(symbol);
|
||||
const Utils::Link &link = CppTools::linkToSymbol(symbol);
|
||||
if (!link.hasValidTarget())
|
||||
return;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
using namespace CPlusPlus;
|
||||
using namespace TextEditor;
|
||||
|
||||
typedef TextEditorWidget::Link Link;
|
||||
using Link = Utils::Link;
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
|
||||
@@ -230,12 +230,10 @@ const Macro *findCanonicalMacro(const QTextCursor &cursor, Document::Ptr documen
|
||||
return 0;
|
||||
}
|
||||
|
||||
TextEditor::TextEditorWidget::Link linkToSymbol(Symbol *symbol)
|
||||
Utils::Link linkToSymbol(Symbol *symbol)
|
||||
{
|
||||
typedef TextEditor::TextEditorWidget::Link Link;
|
||||
|
||||
if (!symbol)
|
||||
return Link();
|
||||
return Utils::Link();
|
||||
|
||||
const QString filename = QString::fromUtf8(symbol->fileName(),
|
||||
symbol->fileNameLength());
|
||||
@@ -249,7 +247,7 @@ TextEditor::TextEditorWidget::Link linkToSymbol(Symbol *symbol)
|
||||
if (symbol->isGenerated())
|
||||
column = 0;
|
||||
|
||||
return Link(filename, line, column);
|
||||
return Utils::Link(filename, line, column);
|
||||
}
|
||||
|
||||
QSharedPointer<CppCodeModelSettings> codeModelSettings()
|
||||
|
||||
@@ -58,7 +58,7 @@ bool CPPTOOLS_EXPORT isValidFirstIdentifierChar(const QChar &ch);
|
||||
bool CPPTOOLS_EXPORT isValidIdentifierChar(const QChar &ch);
|
||||
bool CPPTOOLS_EXPORT isValidIdentifier(const QString &s);
|
||||
|
||||
TextEditor::TextEditorWidget::Link CPPTOOLS_EXPORT linkToSymbol(CPlusPlus::Symbol *symbol);
|
||||
Utils::Link CPPTOOLS_EXPORT linkToSymbol(CPlusPlus::Symbol *symbol);
|
||||
|
||||
QString CPPTOOLS_EXPORT identifierUnderCursor(QTextCursor *cursor);
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
{
|
||||
QTC_ASSERT(m_params.function, return 0);
|
||||
|
||||
auto *hintItem = new VirtualFunctionProposalItem(TextEditorWidget::Link());
|
||||
auto *hintItem = new VirtualFunctionProposalItem(Utils::Link());
|
||||
hintItem->setText(QCoreApplication::translate("VirtualFunctionsAssistProcessor",
|
||||
"...searching overrides"));
|
||||
hintItem->setOrder(-1000);
|
||||
@@ -173,7 +173,7 @@ private:
|
||||
|
||||
VirtualFunctionProposalItem *itemFromFunction(Function *func) const
|
||||
{
|
||||
const TextEditorWidget::Link link = CppTools::linkToSymbol(maybeDefinitionFor(func));
|
||||
const Utils::Link link = CppTools::linkToSymbol(maybeDefinitionFor(func));
|
||||
QString text = m_overview.prettyName(LookupContext::fullyQualifiedName(func));
|
||||
if (func->isPureVirtual())
|
||||
text += QLatin1String(" = 0");
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
namespace CppTools {
|
||||
|
||||
VirtualFunctionProposalItem::VirtualFunctionProposalItem(
|
||||
const TextEditor::TextEditorWidget::Link &link, bool openInSplit)
|
||||
const Utils::Link &link, bool openInSplit)
|
||||
: m_link(link), m_openInSplit(openInSplit)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -35,15 +35,15 @@ namespace CppTools {
|
||||
class CPPTOOLS_EXPORT VirtualFunctionProposalItem final : public TextEditor::AssistProposalItem
|
||||
{
|
||||
public:
|
||||
VirtualFunctionProposalItem(const TextEditor::TextEditorWidget::Link &link,
|
||||
VirtualFunctionProposalItem(const Utils::Link &link,
|
||||
bool openInSplit = true);
|
||||
~VirtualFunctionProposalItem() Q_DECL_NOEXCEPT {}
|
||||
void apply(TextEditor::TextDocumentManipulatorInterface &manipulator,
|
||||
int basePosition) const override;
|
||||
TextEditor::TextEditorWidget::Link link() const { return m_link; } // Exposed for tests
|
||||
Utils::Link link() const { return m_link; } // Exposed for tests
|
||||
|
||||
private:
|
||||
TextEditor::TextEditorWidget::Link m_link;
|
||||
Utils::Link m_link;
|
||||
bool m_openInSplit;
|
||||
};
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class SymbolFinder;
|
||||
class CPPTOOLS_EXPORT FollowSymbolInterface
|
||||
{
|
||||
public:
|
||||
using Link = TextEditor::TextEditorWidget::Link;
|
||||
using Link = Utils::Link;
|
||||
|
||||
virtual ~FollowSymbolInterface() {}
|
||||
virtual Link findLink(const CursorInEditor &data,
|
||||
|
||||
Reference in New Issue
Block a user