forked from qt-creator/qt-creator
Fix exported headers in Core and TextEditor.
- Unexport Core::Internal::MainWindow and remove its includes. - Move RssFetcher from Core::Internal to Core. - Unexport CopyTaskHandler. - Move TextEditor's completion support and Refactor Overlay helper classes from TextEditor::Internal to TextEditor as they are exported. - Move internal BaseTextBlockSelection into private header. - Unexport TextEditorOverlay as they are not used.
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/imode.h>
|
||||
#include <coreplugin/mainwindow.h>
|
||||
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QPainter>
|
||||
|
@@ -125,6 +125,8 @@ QWidget *GeneralSettings::createPage(QWidget *parent)
|
||||
m_page->setupUi(w);
|
||||
|
||||
QSettings* settings = Core::ICore::instance()->settings();
|
||||
Q_UNUSED(settings) // Windows
|
||||
|
||||
fillLanguageBox();
|
||||
|
||||
m_page->colorButton->setColor(StyleHelper::requestedBaseColor());
|
||||
|
@@ -30,7 +30,6 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include "core_global.h"
|
||||
#include "icontext.h"
|
||||
#include "icore.h"
|
||||
#include "dialogs/iwizard.h"
|
||||
@@ -81,7 +80,7 @@ class StatusBarManager;
|
||||
class VersionDialog;
|
||||
class SystemEditor;
|
||||
|
||||
class CORE_EXPORT MainWindow : public EventFilteringMainWindow
|
||||
class MainWindow : public EventFilteringMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include <QtCore/QSysInfo>
|
||||
#include <QtCore/QLocale>
|
||||
#include <QtCore/QEventLoop>
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtGui/QDesktopServices>
|
||||
#include <QtGui/QLineEdit>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
@@ -48,7 +49,7 @@
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
using namespace Core::Internal;
|
||||
namespace Core {
|
||||
|
||||
static const QString getOsString()
|
||||
{
|
||||
@@ -119,7 +120,7 @@ RssFetcher::RssFetcher(int maxItems)
|
||||
: QThread(0), m_maxItems(maxItems), m_items(0),
|
||||
m_requestCount(0), m_networkAccessManager(0)
|
||||
{
|
||||
qRegisterMetaType<RssItem>("RssItem");
|
||||
qRegisterMetaType<Core::RssItem>("Core::RssItem");
|
||||
moveToThread(this);
|
||||
}
|
||||
|
||||
@@ -241,3 +242,5 @@ void RssFetcher::parseXml(QIODevice *device)
|
||||
qPrintable(item.title));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
@@ -33,16 +33,15 @@
|
||||
#include "core_global.h"
|
||||
|
||||
#include <QtCore/QThread>
|
||||
#include <QtCore/QUrl>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QUrl;
|
||||
class QNetworkReply;
|
||||
class QNetworkAccessManager;
|
||||
class QIODevice;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
class CORE_EXPORT RssItem
|
||||
{
|
||||
@@ -64,7 +63,7 @@ public:
|
||||
|
||||
signals:
|
||||
void newsItemReady(const QString& title, const QString& desciption, const QString& url);
|
||||
void rssItemReady(const RssItem& item);
|
||||
void rssItemReady(const Core::RssItem& item);
|
||||
void finished(bool error);
|
||||
|
||||
public slots:
|
||||
@@ -84,7 +83,6 @@ private:
|
||||
QNetworkAccessManager* m_networkAccessManager;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
} // namespace Internal
|
||||
|
||||
#endif // RSSFETCHER_H
|
||||
|
@@ -173,7 +173,7 @@ void CppPlugin::initializeEditor(CPPEditor *editor)
|
||||
|
||||
// auto completion
|
||||
connect(editor, SIGNAL(requestAutoCompletion(TextEditor::ITextEditable*, bool)),
|
||||
TextEditor::Internal::CompletionSupport::instance(), SLOT(autoComplete(TextEditor::ITextEditable*, bool)));
|
||||
TextEditor::CompletionSupport::instance(), SLOT(autoComplete(TextEditor::ITextEditable*, bool)));
|
||||
|
||||
// quick fix
|
||||
connect(editor, SIGNAL(requestQuickFix(TextEditor::ITextEditable*)),
|
||||
@@ -400,7 +400,7 @@ void CppPlugin::quickFixNow()
|
||||
if (editor->isOutdated())
|
||||
m_quickFixTimer->start(QUICKFIX_INTERVAL);
|
||||
else
|
||||
TextEditor::Internal::CompletionSupport::instance()->quickFix(m_currentTextEditable);
|
||||
TextEditor::CompletionSupport::instance()->quickFix(m_currentTextEditable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -906,7 +906,7 @@ void FakeVimPluginPrivate::triggerCompletions()
|
||||
if (!handler)
|
||||
return;
|
||||
if (BaseTextEditor *bt = qobject_cast<BaseTextEditor *>(handler->widget()))
|
||||
TextEditor::Internal::CompletionSupport::instance()->
|
||||
TextEditor::CompletionSupport::instance()->
|
||||
autoComplete(bt->editableInterface(), false);
|
||||
// bt->triggerCompletions();
|
||||
}
|
||||
|
@@ -30,14 +30,12 @@
|
||||
#ifndef PROJECTEXPLORER_COPYTASKHANDLER_H
|
||||
#define PROJECTEXPLORER_COPYTASKHANDLER_H
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include "itaskhandler.h"
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
|
||||
class PROJECTEXPLORER_EXPORT CopyTaskHandler : public ITaskHandler
|
||||
class CopyTaskHandler : public ITaskHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@@ -37,7 +37,6 @@
|
||||
#include <utils/stylehelper.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/mainwindow.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
@@ -57,6 +56,7 @@
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QItemDelegate>
|
||||
#include <QtGui/QMainWindow>
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
|
||||
|
@@ -81,7 +81,6 @@
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/filemanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/mainwindow.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
@@ -112,6 +111,7 @@
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QMainWindow>
|
||||
|
||||
Q_DECLARE_METATYPE(Core::IEditorFactory*);
|
||||
Q_DECLARE_METATYPE(Core::IExternalEditor*);
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/dialogs/iwizard.h>
|
||||
#include <coreplugin/mainwindow.h>
|
||||
#include <coreplugin/filemanager.h>
|
||||
|
||||
#include <utils/stringutils.h>
|
||||
|
@@ -39,11 +39,11 @@
|
||||
#include "toolchaintype.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/mainwindow.h>
|
||||
#include <coreplugin/ifile.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtNetwork/QHostInfo>
|
||||
|
@@ -751,8 +751,8 @@ QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) :
|
||||
connect(m_semanticHighlighter, SIGNAL(changed(QmlJSEditor::Internal::SemanticInfo)),
|
||||
this, SLOT(updateSemanticInfo(QmlJSEditor::Internal::SemanticInfo)));
|
||||
|
||||
connect(this, SIGNAL(refactorMarkerClicked(TextEditor::Internal::RefactorMarker)),
|
||||
SLOT(onRefactorMarkerClicked(TextEditor::Internal::RefactorMarker)));
|
||||
connect(this, SIGNAL(refactorMarkerClicked(TextEditor::RefactorMarker)),
|
||||
SLOT(onRefactorMarkerClicked(TextEditor::RefactorMarker)));
|
||||
|
||||
setRequestMarkEnabled(true);
|
||||
}
|
||||
@@ -986,21 +986,21 @@ void QmlJSTextEditor::updateCursorPositionNow()
|
||||
m_contextPane->apply(editableInterface(), semanticInfo().document, LookupContext::Ptr(),newNode, false);
|
||||
if (m_contextPane->isAvailable(editableInterface(), semanticInfo().document, newNode) &&
|
||||
!m_contextPane->widget()->isVisible()) {
|
||||
QList<TextEditor::Internal::RefactorMarker> markers;
|
||||
QList<TextEditor::RefactorMarker> markers;
|
||||
if (UiObjectMember *m = newNode->uiObjectMemberCast()) {
|
||||
const int start = qualifiedTypeNameId(m)->identifierToken.begin();
|
||||
for (UiQualifiedId *q = qualifiedTypeNameId(m); q; q = q->next) {
|
||||
if (! q->next) {
|
||||
const int end = q->identifierToken.end();
|
||||
if (position() >= start && position() <= end) {
|
||||
TextEditor::Internal::RefactorMarker marker;
|
||||
TextEditor::RefactorMarker marker;
|
||||
QTextCursor tc(document());
|
||||
tc.setPosition(end);
|
||||
marker.cursor = tc;
|
||||
marker.tooltip = tr("Show Qt Quick ToolBar");
|
||||
markers.append(marker);
|
||||
} else {
|
||||
QList<TextEditor::Internal::RefactorMarker> markers;
|
||||
QList<TextEditor::RefactorMarker> markers;
|
||||
setRefactorMarkers(markers);
|
||||
}
|
||||
}
|
||||
@@ -1008,7 +1008,7 @@ void QmlJSTextEditor::updateCursorPositionNow()
|
||||
}
|
||||
setRefactorMarkers(markers);
|
||||
} else if (oldNode != newNode) {
|
||||
QList<TextEditor::Internal::RefactorMarker> markers;
|
||||
QList<TextEditor::RefactorMarker> markers;
|
||||
setRefactorMarkers(markers);
|
||||
}
|
||||
m_oldCursorPosition = position();
|
||||
@@ -1456,7 +1456,7 @@ void QmlJSTextEditor::showContextPane()
|
||||
Node *newNode = m_semanticInfo.declaringMemberNoProperties(position());
|
||||
m_contextPane->apply(editableInterface(), m_semanticInfo.document, m_semanticInfo.lookupContext(), newNode, false, true);
|
||||
m_oldCursorPosition = position();
|
||||
QList<TextEditor::Internal::RefactorMarker> markers;
|
||||
QList<TextEditor::RefactorMarker> markers;
|
||||
setRefactorMarkers(markers);
|
||||
}
|
||||
}
|
||||
@@ -1814,7 +1814,7 @@ void QmlJSTextEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
|
||||
setExtraSelections(CodeWarningsSelection, selections);
|
||||
}
|
||||
|
||||
void QmlJSTextEditor::onRefactorMarkerClicked(const TextEditor::Internal::RefactorMarker &)
|
||||
void QmlJSTextEditor::onRefactorMarkerClicked(const TextEditor::RefactorMarker &)
|
||||
{
|
||||
showContextPane();
|
||||
}
|
||||
|
@@ -278,7 +278,7 @@ private slots:
|
||||
void forceSemanticRehighlight();
|
||||
void updateSemanticInfo(const QmlJSEditor::Internal::SemanticInfo &semanticInfo);
|
||||
void onCursorPositionChanged();
|
||||
void onRefactorMarkerClicked(const TextEditor::Internal::RefactorMarker &marker);
|
||||
void onRefactorMarkerClicked(const TextEditor::RefactorMarker &marker);
|
||||
|
||||
void performQuickFix(int index);
|
||||
|
||||
|
@@ -257,7 +257,7 @@ void QmlJSEditorPlugin::initializeEditor(QmlJSEditor::Internal::QmlJSTextEditor
|
||||
|
||||
// auto completion
|
||||
connect(editor, SIGNAL(requestAutoCompletion(TextEditor::ITextEditable*, bool)),
|
||||
TextEditor::Internal::CompletionSupport::instance(), SLOT(autoComplete(TextEditor::ITextEditable*, bool)));
|
||||
TextEditor::CompletionSupport::instance(), SLOT(autoComplete(TextEditor::ITextEditable*, bool)));
|
||||
|
||||
// quick fix
|
||||
connect(editor, SIGNAL(requestQuickFix(TextEditor::ITextEditable*)),
|
||||
@@ -323,7 +323,7 @@ void QmlJSEditorPlugin::quickFixNow()
|
||||
// ### FIXME: m_quickFixTimer->start(QUICKFIX_INTERVAL);
|
||||
m_quickFixTimer->stop();
|
||||
} else {
|
||||
TextEditor::Internal::CompletionSupport::instance()->quickFix(m_currentTextEditable);
|
||||
TextEditor::CompletionSupport::instance()->quickFix(m_currentTextEditable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -34,7 +34,6 @@
|
||||
#include <coreplugin/helpmanager.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/mainwindow.h>
|
||||
#include <coreplugin/rssfetcher.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
|
||||
@@ -60,8 +59,6 @@
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QDesktopServices>
|
||||
|
||||
using namespace Core::Internal;
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -119,8 +116,8 @@ GettingStartedWelcomePageWidget::GettingStartedWelcomePageWidget(QWidget *parent
|
||||
ui->openProjectButton->setIcon(
|
||||
QIcon::fromTheme(QLatin1String("document-open"), ui->openProjectButton->icon()));
|
||||
|
||||
m_rssFetcher = new RssFetcher;
|
||||
connect (m_rssFetcher, SIGNAL(rssItemReady(const RssItem&)), SLOT(addToFeatures(const RssItem&)));
|
||||
m_rssFetcher = new Core::RssFetcher;
|
||||
connect (m_rssFetcher, SIGNAL(rssItemReady(Core::RssItem)), SLOT(addToFeatures(Core::RssItem)));
|
||||
connect (m_rssFetcher, SIGNAL(finished(bool)), SLOT(showFeature()), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(startRssFetching(QUrl)), m_rssFetcher, SLOT(fetch(QUrl)), Qt::QueuedConnection);
|
||||
m_rssFetcher->start(QThread::LowestPriority);
|
||||
@@ -486,7 +483,7 @@ QStringList GettingStartedWelcomePageWidget::tipsOfTheDay()
|
||||
return tips;
|
||||
}
|
||||
|
||||
void GettingStartedWelcomePageWidget::addToFeatures(const RssItem &feature)
|
||||
void GettingStartedWelcomePageWidget::addToFeatures(const Core::RssItem &feature)
|
||||
{
|
||||
m_featuredItems.append(feature);
|
||||
ui->nextFeatureBtn->setEnabled(true);
|
||||
@@ -503,7 +500,7 @@ void GettingStartedWelcomePageWidget::showFeature(int feature)
|
||||
m_currentFeature = rand()%m_featuredItems.count();
|
||||
}
|
||||
|
||||
RssItem item = m_featuredItems.at(m_currentFeature);
|
||||
const Core::RssItem &item = m_featuredItems.at(m_currentFeature);
|
||||
ui->featuredTextLabel->setTextFormat(Qt::RichText);
|
||||
QString text = QString::fromLatin1("<b style='color: rgb(85, 85, 85);'>%1</b><br><b>%2</b><br/><br/>%3").arg(item.category).arg(item.title).arg(item.description);
|
||||
ui->featuredTextLabel->setText(text);
|
||||
|
@@ -42,14 +42,10 @@ class QMenu;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
class RssFetcher;
|
||||
class RssItem;
|
||||
}
|
||||
class RssFetcher;
|
||||
class RssItem;
|
||||
}
|
||||
|
||||
using namespace Core::Internal;
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
@@ -98,7 +94,7 @@ private slots:
|
||||
void slotNextFeature();
|
||||
void slotPrevFeature();
|
||||
void slotCreateNewProject();
|
||||
void addToFeatures(const RssItem&);
|
||||
void addToFeatures(const Core::RssItem&);
|
||||
void showFeature(int feature = -1);
|
||||
|
||||
signals:
|
||||
@@ -111,8 +107,8 @@ private:
|
||||
Ui::GettingStartedWelcomePageWidget *ui;
|
||||
int m_currentTip;
|
||||
int m_currentFeature;
|
||||
QList<Core::Internal::RssItem> m_featuredItems;
|
||||
Core::Internal::RssFetcher *m_rssFetcher;
|
||||
QList<Core::RssItem> m_featuredItems;
|
||||
Core::RssFetcher *m_rssFetcher;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -38,7 +38,7 @@
|
||||
#include "ui_qt4projectconfigwidget.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/mainwindow.h>
|
||||
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
|
@@ -5655,10 +5655,10 @@ QString BaseTextEditorEditable::contextHelpId() const
|
||||
|
||||
void BaseTextEditor::setRefactorMarkers(const Internal::RefactorMarkers &markers)
|
||||
{
|
||||
foreach (const Internal::RefactorMarker &marker, d->m_refactorOverlay->markers())
|
||||
foreach (const RefactorMarker &marker, d->m_refactorOverlay->markers())
|
||||
requestBlockUpdate(marker.cursor.block());
|
||||
d->m_refactorOverlay->setMarkers(markers);
|
||||
foreach (const Internal::RefactorMarker &marker, markers)
|
||||
foreach (const RefactorMarker &marker, markers)
|
||||
requestBlockUpdate(marker.cursor.block());
|
||||
}
|
||||
|
||||
|
@@ -50,36 +50,13 @@ namespace Utils {
|
||||
|
||||
namespace TextEditor {
|
||||
class TabSettings;
|
||||
class RefactorOverlay;
|
||||
struct RefactorMarker;
|
||||
|
||||
namespace Internal {
|
||||
class BaseTextEditorPrivate;
|
||||
class TextEditorOverlay;
|
||||
class RefactorOverlay;
|
||||
struct RefactorMarker;
|
||||
typedef QList<RefactorMarker> RefactorMarkers;
|
||||
|
||||
class TEXTEDITOR_EXPORT BaseTextBlockSelection
|
||||
{
|
||||
public:
|
||||
|
||||
bool isValid() const{ return !firstBlock.isNull() && !lastBlock.isNull(); }
|
||||
void clear() { firstBlock = lastBlock = QTextCursor(); }
|
||||
|
||||
QTextCursor firstBlock; // defines the first block
|
||||
QTextCursor lastBlock; // defines the last block
|
||||
int firstVisualColumn; // defines the first visual column of the selection
|
||||
int lastVisualColumn; // defines the last visual column of the selection
|
||||
enum Anchor {TopLeft = 0, TopRight, BottomLeft, BottomRight} anchor;
|
||||
BaseTextBlockSelection():firstVisualColumn(0), lastVisualColumn(0), anchor(BottomRight){}
|
||||
void moveAnchor(int blockNumber, int visualColumn);
|
||||
inline int anchorColumnNumber() const { return (anchor % 2) ? lastVisualColumn : firstVisualColumn; }
|
||||
inline int anchorBlockNumber() const {
|
||||
return (anchor <= TopRight ? firstBlock.blockNumber() : lastBlock.blockNumber()); }
|
||||
QTextCursor selection(const TabSettings &ts) const;
|
||||
void fromSelection(const TabSettings &ts, const QTextCursor &selection);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
class ITextMarkable;
|
||||
@@ -351,7 +328,7 @@ private:
|
||||
Internal::BaseTextEditorPrivate *d;
|
||||
friend class Internal::BaseTextEditorPrivate;
|
||||
friend class Internal::TextEditorOverlay;
|
||||
friend class Internal::RefactorOverlay;
|
||||
friend class RefactorOverlay;
|
||||
|
||||
public:
|
||||
QWidget *extraArea() const;
|
||||
@@ -387,7 +364,7 @@ public:
|
||||
|
||||
void setRefactorMarkers(const Internal::RefactorMarkers &markers);
|
||||
signals:
|
||||
void refactorMarkerClicked(const TextEditor::Internal::RefactorMarker &marker);
|
||||
void refactorMarkerClicked(const TextEditor::RefactorMarker &marker);
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -53,6 +53,27 @@ class TextEditorActionHandler;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class TEXTEDITOR_EXPORT BaseTextBlockSelection
|
||||
{
|
||||
public:
|
||||
|
||||
bool isValid() const{ return !firstBlock.isNull() && !lastBlock.isNull(); }
|
||||
void clear() { firstBlock = lastBlock = QTextCursor(); }
|
||||
|
||||
QTextCursor firstBlock; // defines the first block
|
||||
QTextCursor lastBlock; // defines the last block
|
||||
int firstVisualColumn; // defines the first visual column of the selection
|
||||
int lastVisualColumn; // defines the last visual column of the selection
|
||||
enum Anchor {TopLeft = 0, TopRight, BottomLeft, BottomRight} anchor;
|
||||
BaseTextBlockSelection():firstVisualColumn(0), lastVisualColumn(0), anchor(BottomRight){}
|
||||
void moveAnchor(int blockNumber, int visualColumn);
|
||||
inline int anchorColumnNumber() const { return (anchor % 2) ? lastVisualColumn : firstVisualColumn; }
|
||||
inline int anchorBlockNumber() const {
|
||||
return (anchor <= TopRight ? firstBlock.blockNumber() : lastBlock.blockNumber()); }
|
||||
QTextCursor selection(const TabSettings &ts) const;
|
||||
void fromSelection(const TabSettings &ts, const QTextCursor &selection);
|
||||
};
|
||||
|
||||
//========== Pointers with reference count ==========
|
||||
|
||||
template <class T> class QRefCountData : public QSharedData
|
||||
|
@@ -40,11 +40,7 @@
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QList>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace TextEditor;
|
||||
using namespace TextEditor::Internal;
|
||||
|
||||
namespace TextEditor {
|
||||
|
||||
CompletionSupport *CompletionSupport::instance()
|
||||
{
|
||||
@@ -54,48 +50,68 @@ CompletionSupport *CompletionSupport::instance()
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
CompletionSupport::CompletionSupport()
|
||||
: QObject(Core::ICore::instance()),
|
||||
class CompletionSupportPrivate {
|
||||
public:
|
||||
CompletionSupportPrivate();
|
||||
|
||||
Internal::CompletionWidget *m_completionList;
|
||||
int m_startPosition;
|
||||
bool m_checkCompletionTrigger; // Whether to check for completion trigger after cleanup
|
||||
ITextEditable *m_editor;
|
||||
const QList<ICompletionCollector *> m_completionCollectors;
|
||||
ICompletionCollector *m_completionCollector;
|
||||
};
|
||||
|
||||
CompletionSupportPrivate::CompletionSupportPrivate() :
|
||||
m_completionList(0),
|
||||
m_startPosition(0),
|
||||
m_checkCompletionTrigger(false),
|
||||
m_editor(0),
|
||||
m_completionCollectors(ExtensionSystem::PluginManager::instance()
|
||||
->getObjects<ICompletionCollector>()),
|
||||
m_completionCollector(0)
|
||||
{
|
||||
m_completionCollectors = ExtensionSystem::PluginManager::instance()
|
||||
->getObjects<ICompletionCollector>();
|
||||
}
|
||||
|
||||
CompletionSupport::CompletionSupport() :
|
||||
QObject(Core::ICore::instance()), d(new CompletionSupportPrivate)
|
||||
{
|
||||
}
|
||||
|
||||
CompletionSupport::~CompletionSupport()
|
||||
{
|
||||
}
|
||||
|
||||
void CompletionSupport::performCompletion(const CompletionItem &item)
|
||||
{
|
||||
item.collector->complete(item, m_completionList->typedChar());
|
||||
m_checkCompletionTrigger = true;
|
||||
item.collector->complete(item, d->m_completionList->typedChar());
|
||||
d->m_checkCompletionTrigger = true;
|
||||
}
|
||||
|
||||
void CompletionSupport::cleanupCompletions()
|
||||
{
|
||||
if (m_completionList)
|
||||
disconnect(m_completionList, SIGNAL(destroyed(QObject*)),
|
||||
if (d->m_completionList)
|
||||
disconnect(d->m_completionList, SIGNAL(destroyed(QObject*)),
|
||||
this, SLOT(cleanupCompletions()));
|
||||
|
||||
if (m_checkCompletionTrigger)
|
||||
m_checkCompletionTrigger = m_completionCollector->shouldRestartCompletion();
|
||||
if (d->m_checkCompletionTrigger)
|
||||
d->m_checkCompletionTrigger = d->m_completionCollector->shouldRestartCompletion();
|
||||
|
||||
m_completionList = 0;
|
||||
m_completionCollector->cleanup();
|
||||
d->m_completionList = 0;
|
||||
d->m_completionCollector->cleanup();
|
||||
|
||||
if (m_checkCompletionTrigger) {
|
||||
m_checkCompletionTrigger = false;
|
||||
if (d->m_checkCompletionTrigger) {
|
||||
d->m_checkCompletionTrigger = false;
|
||||
|
||||
// Only check for completion trigger when some text was entered
|
||||
if (m_editor->position() > m_startPosition)
|
||||
autoComplete(m_editor, false);
|
||||
if (d->m_editor->position() > d->m_startPosition)
|
||||
autoComplete(d->m_editor, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool CompletionSupport::isActive() const
|
||||
{
|
||||
return m_completionList != 0;
|
||||
return d->m_completionList != 0;
|
||||
}
|
||||
|
||||
void CompletionSupport::autoComplete(ITextEditable *editor, bool forced)
|
||||
@@ -113,68 +129,68 @@ void CompletionSupport::quickFix(ITextEditable *editor)
|
||||
void CompletionSupport::autoComplete_helper(ITextEditable *editor, bool forced,
|
||||
bool quickFix)
|
||||
{
|
||||
m_completionCollector = 0;
|
||||
d->m_completionCollector = 0;
|
||||
|
||||
foreach (ICompletionCollector *collector, m_completionCollectors) {
|
||||
foreach (ICompletionCollector *collector, d->m_completionCollectors) {
|
||||
if (quickFix)
|
||||
collector = qobject_cast<IQuickFixCollector *>(collector);
|
||||
|
||||
if (collector && collector->supportsEditor(editor)) {
|
||||
m_completionCollector = collector;
|
||||
d->m_completionCollector = collector;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_completionCollector)
|
||||
if (!d->m_completionCollector)
|
||||
return;
|
||||
|
||||
m_editor = editor;
|
||||
d->m_editor = editor;
|
||||
QList<CompletionItem> completionItems;
|
||||
|
||||
int currentIndex = 0;
|
||||
|
||||
if (!m_completionList) {
|
||||
if (!d->m_completionList) {
|
||||
if (!forced) {
|
||||
const CompletionSettings &completionSettings = m_completionCollector->completionSettings();
|
||||
const CompletionSettings &completionSettings = d->m_completionCollector->completionSettings();
|
||||
if (completionSettings.m_completionTrigger == ManualCompletion)
|
||||
return;
|
||||
if (!m_completionCollector->triggersCompletion(editor))
|
||||
if (!d->m_completionCollector->triggersCompletion(editor))
|
||||
return;
|
||||
}
|
||||
|
||||
m_startPosition = m_completionCollector->startCompletion(editor);
|
||||
d->m_startPosition = d->m_completionCollector->startCompletion(editor);
|
||||
completionItems = getCompletions();
|
||||
|
||||
QTC_ASSERT(!(m_startPosition == -1 && completionItems.size() > 0), return);
|
||||
QTC_ASSERT(!(d->m_startPosition == -1 && completionItems.size() > 0), return);
|
||||
|
||||
if (completionItems.isEmpty()) {
|
||||
cleanupCompletions();
|
||||
return;
|
||||
}
|
||||
|
||||
m_completionList = new CompletionWidget(this, editor);
|
||||
m_completionList->setQuickFix(quickFix);
|
||||
d->m_completionList = new Internal::CompletionWidget(this, editor);
|
||||
d->m_completionList->setQuickFix(quickFix);
|
||||
|
||||
connect(m_completionList, SIGNAL(itemSelected(TextEditor::CompletionItem)),
|
||||
connect(d->m_completionList, SIGNAL(itemSelected(TextEditor::CompletionItem)),
|
||||
this, SLOT(performCompletion(TextEditor::CompletionItem)));
|
||||
connect(m_completionList, SIGNAL(completionListClosed()),
|
||||
connect(d->m_completionList, SIGNAL(completionListClosed()),
|
||||
this, SLOT(cleanupCompletions()));
|
||||
|
||||
// Make sure to clean up the completions if the list is destroyed without
|
||||
// emitting completionListClosed (can happen when no focus out event is received,
|
||||
// for example when switching applications on the Mac)
|
||||
connect(m_completionList, SIGNAL(destroyed(QObject*)),
|
||||
connect(d->m_completionList, SIGNAL(destroyed(QObject*)),
|
||||
this, SLOT(cleanupCompletions()));
|
||||
} else {
|
||||
completionItems = getCompletions();
|
||||
|
||||
if (completionItems.isEmpty()) {
|
||||
m_completionList->closeList();
|
||||
d->m_completionList->closeList();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_completionList->explicitlySelected()) {
|
||||
const int originalIndex = m_completionList->currentCompletionItem().originalIndex;
|
||||
if (d->m_completionList->explicitlySelected()) {
|
||||
const int originalIndex = d->m_completionList->currentCompletionItem().originalIndex;
|
||||
|
||||
for (int index = 0; index < completionItems.size(); ++index) {
|
||||
if (completionItems.at(index).originalIndex == originalIndex) {
|
||||
@@ -185,24 +201,26 @@ void CompletionSupport::autoComplete_helper(ITextEditable *editor, bool forced,
|
||||
}
|
||||
}
|
||||
|
||||
m_completionList->setCompletionItems(completionItems);
|
||||
d->m_completionList->setCompletionItems(completionItems);
|
||||
|
||||
if (currentIndex)
|
||||
m_completionList->setCurrentIndex(currentIndex);
|
||||
d->m_completionList->setCurrentIndex(currentIndex);
|
||||
|
||||
// Partially complete when completion was forced
|
||||
if (forced && m_completionCollector->partiallyComplete(completionItems)) {
|
||||
m_checkCompletionTrigger = true;
|
||||
m_completionList->closeList();
|
||||
if (forced && d->m_completionCollector->partiallyComplete(completionItems)) {
|
||||
d->m_checkCompletionTrigger = true;
|
||||
d->m_completionList->closeList();
|
||||
} else {
|
||||
m_completionList->showCompletions(m_startPosition);
|
||||
d->m_completionList->showCompletions(d->m_startPosition);
|
||||
}
|
||||
}
|
||||
|
||||
QList<CompletionItem> CompletionSupport::getCompletions() const
|
||||
{
|
||||
if (m_completionCollector)
|
||||
return m_completionCollector->getCompletions();
|
||||
if (d->m_completionCollector)
|
||||
return d->m_completionCollector->getCompletions();
|
||||
|
||||
return QList<CompletionItem>();
|
||||
}
|
||||
|
||||
} // namespace TextEditor
|
||||
|
@@ -40,9 +40,7 @@ class CompletionItem;
|
||||
class ICompletionCollector;
|
||||
class ITextEditable;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class CompletionWidget;
|
||||
class CompletionSupportPrivate;
|
||||
|
||||
/* Completion support is responsible for querying the list of completion collectors
|
||||
and popping up the CompletionWidget with the available completions.
|
||||
@@ -52,7 +50,7 @@ class TEXTEDITOR_EXPORT CompletionSupport : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CompletionSupport();
|
||||
virtual ~CompletionSupport();
|
||||
|
||||
static CompletionSupport *instance();
|
||||
|
||||
@@ -67,18 +65,14 @@ private slots:
|
||||
void cleanupCompletions();
|
||||
|
||||
private:
|
||||
CompletionSupport();
|
||||
|
||||
QList<CompletionItem> getCompletions() const;
|
||||
void autoComplete_helper(ITextEditable *editor, bool forced, bool quickFix);
|
||||
|
||||
CompletionWidget *m_completionList;
|
||||
int m_startPosition;
|
||||
bool m_checkCompletionTrigger; // Whether to check for completion trigger after cleanup
|
||||
ITextEditable *m_editor;
|
||||
QList<ICompletionCollector *> m_completionCollectors;
|
||||
ICompletionCollector *m_completionCollector;
|
||||
QScopedPointer<CompletionSupportPrivate> d;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace TextEditor
|
||||
|
||||
#endif // COMPLETIONSUPPORT_H
|
||||
|
@@ -38,11 +38,11 @@ namespace TextEditor {
|
||||
|
||||
class CompletionItem;
|
||||
class ITextEditable;
|
||||
class CompletionSupport;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class AutoCompletionModel;
|
||||
class CompletionSupport;
|
||||
class CompletionListView;
|
||||
class CompletionInfoFrame;
|
||||
|
||||
|
@@ -1,10 +1,42 @@
|
||||
#include "refactoroverlay.h"
|
||||
#include <QPainter>
|
||||
#include <QTextBlock>
|
||||
#include "basetextdocumentlayout.h"
|
||||
#include <QDebug>
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
using namespace TextEditor::Internal;
|
||||
#include "refactoroverlay.h"
|
||||
#include "basetextdocumentlayout.h"
|
||||
#include "basetexteditor.h"
|
||||
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QTextBlock>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
namespace TextEditor {
|
||||
|
||||
RefactorOverlay::RefactorOverlay(TextEditor::BaseTextEditor *editor) :
|
||||
QObject(editor),
|
||||
@@ -62,4 +94,4 @@ void RefactorOverlay::paintMarker(const RefactorMarker& marker, QPainter *painte
|
||||
m_maxWidth = qMax((qreal)m_maxWidth, x + sz.width() - offset.x());
|
||||
}
|
||||
|
||||
|
||||
} // namespace TextEditor
|
||||
|
@@ -1,13 +1,42 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef REFACTOROVERLAY_H
|
||||
#define REFACTOROVERLAY_H
|
||||
|
||||
#include "basetexteditor.h"
|
||||
#include "texteditor_global.h"
|
||||
|
||||
#include <QtGui/QTextCursor>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
namespace TextEditor {
|
||||
namespace Internal {
|
||||
class BaseTextEditor;
|
||||
|
||||
struct TEXTEDITOR_EXPORT RefactorMarker {
|
||||
inline bool isValid() const { return !cursor.isNull(); }
|
||||
@@ -41,11 +70,9 @@ private:
|
||||
RefactorMarkers m_markers;
|
||||
BaseTextEditor *m_editor;
|
||||
int m_maxWidth;
|
||||
QIcon m_icon;
|
||||
|
||||
const QIcon m_icon;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} // namespace TextEditor
|
||||
|
||||
#endif // REFACTOROVERLAY_H
|
||||
|
@@ -28,6 +28,7 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "texteditoroverlay.h"
|
||||
#include "basetexteditor.h"
|
||||
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QTextBlock>
|
||||
@@ -35,8 +36,6 @@
|
||||
using namespace TextEditor;
|
||||
using namespace TextEditor::Internal;
|
||||
|
||||
|
||||
|
||||
TextEditorOverlay::TextEditorOverlay(BaseTextEditor *editor)
|
||||
:QObject(editor) {
|
||||
m_visible = false;
|
||||
|
@@ -30,13 +30,20 @@
|
||||
#ifndef TEXTEDITOROVERLAY_H
|
||||
#define TEXTEDITOROVERLAY_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include "basetexteditor.h"
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include <QtGui/QTextCursor>
|
||||
#include <QtGui/QColor>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QWidget)
|
||||
|
||||
namespace TextEditor {
|
||||
class BaseTextEditor;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
struct TEXTEDITOR_EXPORT OverlaySelection {
|
||||
struct OverlaySelection
|
||||
{
|
||||
OverlaySelection():m_fixedLength(-1), m_dropShadow(false){}
|
||||
QTextCursor m_cursor_begin;
|
||||
QTextCursor m_cursor_end;
|
||||
@@ -44,22 +51,22 @@ struct TEXTEDITOR_EXPORT OverlaySelection {
|
||||
QColor m_bg;
|
||||
int m_fixedLength;
|
||||
bool m_dropShadow;
|
||||
};
|
||||
};
|
||||
|
||||
class TEXTEDITOR_EXPORT TextEditorOverlay : public QObject
|
||||
class TextEditorOverlay : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
BaseTextEditor *m_editor;
|
||||
QWidget *m_viewport;
|
||||
Q_OBJECT
|
||||
BaseTextEditor *m_editor;
|
||||
QWidget *m_viewport;
|
||||
|
||||
public:
|
||||
QList<OverlaySelection> m_selections;
|
||||
private:
|
||||
QList<OverlaySelection> m_selections;
|
||||
|
||||
bool m_visible;
|
||||
int m_borderWidth;
|
||||
int m_dropShadowWidth;
|
||||
bool m_alpha;
|
||||
private:
|
||||
bool m_visible;
|
||||
int m_borderWidth;
|
||||
int m_dropShadowWidth;
|
||||
bool m_alpha;
|
||||
|
||||
public:
|
||||
TextEditorOverlay(BaseTextEditor *editor);
|
||||
@@ -103,7 +110,6 @@ private:
|
||||
QPainterPath createSelectionPath(const QTextCursor &begin, const QTextCursor &end, const QRect& clip);
|
||||
void paintSelection(QPainter *painter, const OverlaySelection &selection);
|
||||
void fillSelection(QPainter *painter, const OverlaySelection &selection, const QColor &color);
|
||||
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -37,8 +37,6 @@
|
||||
#include <QtGui/QDesktopServices>
|
||||
#include <QtGui/QTreeWidgetItem>
|
||||
|
||||
using namespace Core::Internal;
|
||||
|
||||
struct Site {
|
||||
const char *description;
|
||||
const char *url;
|
||||
@@ -82,7 +80,7 @@ static inline void populateWelcomeTreeWidget(const Site *sites, int count, Utils
|
||||
|
||||
CommunityWelcomePageWidget::CommunityWelcomePageWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_rssFetcher(new RssFetcher(7)),
|
||||
m_rssFetcher(new Core::RssFetcher(7)),
|
||||
ui(new Ui::CommunityWelcomePageWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@@ -37,9 +37,7 @@ class QUrl;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core{
|
||||
namespace Internal {
|
||||
class RssFetcher;
|
||||
}
|
||||
class RssFetcher;
|
||||
}
|
||||
|
||||
namespace Welcome {
|
||||
@@ -65,7 +63,7 @@ private slots:
|
||||
|
||||
|
||||
private:
|
||||
Core::Internal::RssFetcher *m_rssFetcher;
|
||||
Core::RssFetcher *m_rssFetcher;
|
||||
Ui::CommunityWelcomePageWidget *ui;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user