diff --git a/src/plugins/coreplugin/fancyactionbar.cpp b/src/plugins/coreplugin/fancyactionbar.cpp index 6b7bbe07896f3cdea0006b57a3c0a5ec88ad5b93..9d3d1c3696c6743f3f8af036ac8fea9bed7579f2 100644 --- a/src/plugins/coreplugin/fancyactionbar.cpp +++ b/src/plugins/coreplugin/fancyactionbar.cpp @@ -34,7 +34,6 @@ #include <coreplugin/icore.h> #include <coreplugin/imode.h> -#include <coreplugin/mainwindow.h> #include <QtGui/QHBoxLayout> #include <QtGui/QPainter> diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index f3118962868115a72f41be4d8725854a1ed0a1e5..7904199b8fdd811317a21e2323428ffb36f579aa 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -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()); diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index bd1708607e182d2257c7363f4b8f00292072eee6..8f29d03a0ef65740a3a39f09576577068d9fe197 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -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 diff --git a/src/plugins/coreplugin/rssfetcher.cpp b/src/plugins/coreplugin/rssfetcher.cpp index 114c6df41abb324d2e5ae125c0ee746f78aec7c4..dd9c013faaafba58cd8f1eab00da967ea9d2a363 100644 --- a/src/plugins/coreplugin/rssfetcher.cpp +++ b/src/plugins/coreplugin/rssfetcher.cpp @@ -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 diff --git a/src/plugins/coreplugin/rssfetcher.h b/src/plugins/coreplugin/rssfetcher.h index 87d0936c9909b4388c027c3542c4cfcd4a70f8a0..623e437254d723386cefc76e11c25c65665fb43e 100644 --- a/src/plugins/coreplugin/rssfetcher.h +++ b/src/plugins/coreplugin/rssfetcher.h @@ -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 diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index 3d11283627515850fb960aaabd2b9bc6ef933977..d5ab7774773ff41b7745895accf2d2be0e372469 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -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); } } } diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index c30a9d01c4616a762d3adf8f6348ecb52cb9db6c..481020581ac7c33ccc38d39bd9e5915214109d23 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -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(); } diff --git a/src/plugins/projectexplorer/copytaskhandler.h b/src/plugins/projectexplorer/copytaskhandler.h index 27e6beb465c0cd336447d005c1716313bf9381a6..578bdcefa5832107dbadaa817b724411bb73518e 100644 --- a/src/plugins/projectexplorer/copytaskhandler.h +++ b/src/plugins/projectexplorer/copytaskhandler.h @@ -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 diff --git a/src/plugins/projectexplorer/miniprojecttargetselector.cpp b/src/plugins/projectexplorer/miniprojecttargetselector.cpp index 9af697a0d64873aa372d9483083ef8314eae532f..d07fc0669830d7bb26cf067c30f8d5d15e3725bc 100644 --- a/src/plugins/projectexplorer/miniprojecttargetselector.cpp +++ b/src/plugins/projectexplorer/miniprojecttargetselector.cpp @@ -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> diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 983cd10f03eea7c5d6b38c52a2f7251b6bdb5ce5..5b521952198bd4947abe76f41a4b1e259e1fe353 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -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*); diff --git a/src/plugins/projectexplorer/projectwelcomepagewidget.cpp b/src/plugins/projectexplorer/projectwelcomepagewidget.cpp index 22cfd95d2b70d58b0f833444265241e99241690b..8530ec3609d77a75568f240fe5c4a88665b62144 100644 --- a/src/plugins/projectexplorer/projectwelcomepagewidget.cpp +++ b/src/plugins/projectexplorer/projectwelcomepagewidget.cpp @@ -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> diff --git a/src/plugins/projectexplorer/userfileaccessor.cpp b/src/plugins/projectexplorer/userfileaccessor.cpp index bee5edfc7413ed4ebfd08024dd58869ad1233474..625e80e1d6a72568498c403b80568f3761753e95 100644 --- a/src/plugins/projectexplorer/userfileaccessor.cpp +++ b/src/plugins/projectexplorer/userfileaccessor.cpp @@ -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> diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index c621d81010911ccb18f5dfd9d3a9aca3a7b0374d..54cf860b63545c511f7ab9919c2cc3793a9015f7 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -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(); } diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h index e0082c371d1e9a60f36a264f2919dd3c92cefbc0..4c625cf60c6c0dc7808e171e7b1e1dbf5efe3989 100644 --- a/src/plugins/qmljseditor/qmljseditor.h +++ b/src/plugins/qmljseditor/qmljseditor.h @@ -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); diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 6268ee4973449b2a70dd3d173ce835924ce07220..0b1cc3f39a718fea0e68f743b237fba9a35ce1d1 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -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); } } } diff --git a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp index c7b7c7a127bc0001c34f83532d6e27b1d6af4478..d4a27a5147267be4cbe08a7ba71cd1fd65d9d367 100644 --- a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp +++ b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp @@ -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); diff --git a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.h b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.h index 461d24e88cb1e84a8123f8258201cc7c8c7cc1b7..be3064d20c7dab3888f49d1e2a21d57bcc0a67bc 100644 --- a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.h +++ b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.h @@ -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 diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp index a22ab0473a2b6cbd588667ab71252c1951773ecb..081a20d2ae23d9fef29934febd0bd2717be64714 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp @@ -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> diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 7a6d6f97df59ad7d0d92a0d73b93a73f020e2c4d..e96298cf03e95d28513235ba4346a5bd5a1b97c0 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -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()); } diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index c544e23b6b13c8bd7dc4e4708298e5a95de549d7..ec51a3f86b89884bdcafdad3612d1eb26c3d9043 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -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: diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h index b15f15c53c38d0b275db2932111d3c95023a7c0c..ccdae6c4d069962bc8bb51467af87dc3602e3a1c 100644 --- a/src/plugins/texteditor/basetexteditor_p.h +++ b/src/plugins/texteditor/basetexteditor_p.h @@ -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 diff --git a/src/plugins/texteditor/completionsupport.cpp b/src/plugins/texteditor/completionsupport.cpp index 8feb4bbd60eff19ca85dfeecf80e2709b7bbea8e..748d0f6c81bfa9d1b3e368ab86cca6eb7dfa1a80 100644 --- a/src/plugins/texteditor/completionsupport.cpp +++ b/src/plugins/texteditor/completionsupport.cpp @@ -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) 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 diff --git a/src/plugins/texteditor/completionsupport.h b/src/plugins/texteditor/completionsupport.h index ec83e49aed432f42faf92791d5945019bd5ab86b..5c841d1bbd62cabab83d8994126350b7424b8b33 100644 --- a/src/plugins/texteditor/completionsupport.h +++ b/src/plugins/texteditor/completionsupport.h @@ -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 diff --git a/src/plugins/texteditor/completionwidget.h b/src/plugins/texteditor/completionwidget.h index a550b3c1e23f95a99dc6a7776b628d0f32a2c584..b10392c3f531771213e19f99838047b7c6e280e9 100644 --- a/src/plugins/texteditor/completionwidget.h +++ b/src/plugins/texteditor/completionwidget.h @@ -38,11 +38,11 @@ namespace TextEditor { class CompletionItem; class ITextEditable; +class CompletionSupport; namespace Internal { class AutoCompletionModel; -class CompletionSupport; class CompletionListView; class CompletionInfoFrame; diff --git a/src/plugins/texteditor/refactoroverlay.cpp b/src/plugins/texteditor/refactoroverlay.cpp index 07bd35bc6b8264344bfb37d37a4deae80e9cc0dc..68d0f22a1715915339f74c18a25c6a3f13eda251 100644 --- a/src/plugins/texteditor/refactoroverlay.cpp +++ b/src/plugins/texteditor/refactoroverlay.cpp @@ -1,10 +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. +** +**************************************************************************/ + #include "refactoroverlay.h" -#include <QPainter> -#include <QTextBlock> #include "basetextdocumentlayout.h" -#include <QDebug> +#include "basetexteditor.h" + +#include <QtGui/QPainter> +#include <QtGui/QTextBlock> -using namespace TextEditor::Internal; +#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 diff --git a/src/plugins/texteditor/refactoroverlay.h b/src/plugins/texteditor/refactoroverlay.h index 6e4c3898b5d7c59cd9aa52a2df33c50d80169ab3..8f2255ff31c46d1447910be7212010ea066c1574 100644 --- a/src/plugins/texteditor/refactoroverlay.h +++ b/src/plugins/texteditor/refactoroverlay.h @@ -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 diff --git a/src/plugins/texteditor/texteditoroverlay.cpp b/src/plugins/texteditor/texteditoroverlay.cpp index 7ee11757cdf86d3a8e23a5eb2a5c8632a9848b92..0be9d60adadd482f5a6ca5ccbfdf9306fc41c14b 100644 --- a/src/plugins/texteditor/texteditoroverlay.cpp +++ b/src/plugins/texteditor/texteditoroverlay.cpp @@ -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; diff --git a/src/plugins/texteditor/texteditoroverlay.h b/src/plugins/texteditor/texteditoroverlay.h index 59fa6ed7cf2847ef450c0cbf5549a68c9b7078bf..f64bb08baeb41522831f4f3efc44e2514a46793e 100644 --- a/src/plugins/texteditor/texteditoroverlay.h +++ b/src/plugins/texteditor/texteditoroverlay.h @@ -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 diff --git a/src/plugins/welcome/communitywelcomepagewidget.cpp b/src/plugins/welcome/communitywelcomepagewidget.cpp index ac80277d91d35993c3fd52d5a78682f06088f64d..b738d2aeba1adca8e71725085a54443a54978690 100644 --- a/src/plugins/welcome/communitywelcomepagewidget.cpp +++ b/src/plugins/welcome/communitywelcomepagewidget.cpp @@ -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); diff --git a/src/plugins/welcome/communitywelcomepagewidget.h b/src/plugins/welcome/communitywelcomepagewidget.h index ff088e692c3961d76fdee6c94e92caf20b752a0a..9e57ca6c07e0c25f1d39fe0638f1431db1dfdd62 100644 --- a/src/plugins/welcome/communitywelcomepagewidget.h +++ b/src/plugins/welcome/communitywelcomepagewidget.h @@ -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; };