Commit 6063fb84 authored by Friedemann Kleint's avatar Friedemann Kleint

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.
parent beaff082
......@@ -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()),
m_completionList(0),
m_startPosition(0),
m_checkCompletionTrigger(false),
m_editor(0),
m_completionCollector(0)
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)
{
}
CompletionSupport::CompletionSupport() :
QObject(Core::ICore::instance()), d(new CompletionSupportPrivate)
{
}
CompletionSupport::~CompletionSupport()
{
m_completionCollectors = ExtensionSystem::PluginManager::instance()
->getObjects<ICompletionCollector>();
}
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)