diff options
author | Leena Miettinen <riitta-leena.miettinen@digia.com> | 2013-05-24 17:35:14 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@digia.com> | 2013-05-29 14:32:07 +0200 |
commit | 3f843aca67b70fde29934061552860c45b5678b1 (patch) | |
tree | 44328fd0dee4a786eae59235216cc7a7f5b95de5 /src/plugins | |
parent | 5b268822cf8db18ec2e3eb8d57296c549378a971 (diff) | |
download | qt-creator-3f843aca67b70fde29934061552860c45b5678b1.tar.gz |
Doc: move Class View plugin docs to .cpp files.
QDoc does not find docs in the .h files.
Use \brief only for namespaces, classes, enums, and properties.
Use standard wording for \brief and \fn.
Use \a and \c according to guidelines.
Fix grammar and style.
Change-Id: Ib685a03c97ef38661ecc156f61d70085514357fc
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins')
20 files changed, 610 insertions, 492 deletions
diff --git a/src/plugins/classview/classviewmanager.cpp b/src/plugins/classview/classviewmanager.cpp index d2d718b1d4..7cd708f898 100644 --- a/src/plugins/classview/classviewmanager.cpp +++ b/src/plugins/classview/classviewmanager.cpp @@ -58,11 +58,89 @@ namespace Internal { static Manager *managerInstance = 0; /*! - \struct ManagerPrivate + \class ClassView::Internal::Manager + + \brief The Manager class implements a class view manager that interacts with + other \QC plugins and acts as a proxy between them and the parser. + + The parser is moved to a separate thread and is connected to the manager by + using signals and slots. Manager's signals starting with 'request' are for + the parser. +*/ + +/*! + \fn explicit ClassView::Internal::Manager(QObject *parent = 0) + + Creates a shared instance of a \a parent object. +*/ + +/*! + \fn void ClassView::Internal::Manager::stateChanged(bool state) + + Changes the internal manager state. \a state returns true if manager is + enabled, otherwise false. + + \sa setState, state +*/ + +/*! + \fn void ClassView::Internal::Manager::treeDataUpdate(QSharedPointer<QStandardItem> result) + + Emits a signal about a tree data update (to tree view). \a result holds the + item with the current tree. +*/ + +/*! + \fn void ClassView::Internal::Manager::requestTreeDataUpdate() + + Emits a signal that a request for sending the tree view has to be handled by + listeners (the parser). + + \sa onRequestTreeDataUpdate +*/ + +/*! + \fn void ClassView::Internal::Manager::requestDocumentUpdated(CPlusPlus::Document::Ptr doc) + + Emits a signal that \a doc was updated and has to be reparsed. + + \sa onDocumentUpdated +*/ + +/*! + \fn void ClassView::Internal::Manager::requestResetCurrentState() + + Emits a signal that the parser has to reset its internal state to the + current state from the code manager. +*/ + +/*! + \fn void ClassView::Internal::Manager::requestClearCache() + + Requests the parser to clear a cache. +*/ + +/*! + \fn void ClassView::Internal::Manager::requestClearCacheAll() + + Requests the parser to clear a full cache. +*/ + +/*! + \fn void ClassView::Internal::Manager::requestSetFlatMode(bool flat) + + Requests the manager to set the flat mode without subprojects. Set \a flat + to \c true to enable flat mode and to false to disable it. +*/ + +/*! + \class ManagerPrivate \internal - \brief Private class data for \a Manager + \brief The ManagerPrivate class contains private class data for the Manager + class. \sa Manager - */ +*/ + class ManagerPrivate { public: @@ -118,11 +196,20 @@ Manager *Manager::instance() return managerInstance; } +/*! + Checks \a item for lazy data population of a QStandardItemModel. +*/ + bool Manager::canFetchMore(QStandardItem *item) const { return d->parser.canFetchMore(item); } +/*! + Checks \a item for lazy data population of a QStandardItemModel. + \a skipRoot item is needed for the manual update, call not from model. +*/ + void Manager::fetchMore(QStandardItem *item, bool skipRoot) { d->parser.fetchMore(item, skipRoot); @@ -193,11 +280,27 @@ void Manager::initialize() &d->parser, SLOT(removeFiles(QStringList)), Qt::QueuedConnection); } +/*! + Gets the internal manager state. If it is disabled, does not emit signals + about parsing requests. If enabled, does parsing in the background even if + the navigation pane is not visible. Returns true if the manager is enabled, + false otherwise. + + \sa setState, stateChanged +*/ + bool Manager::state() const { return d->state; } +/*! + Sets the internal manager \a state to \c true if the manager has to be + enabled, otherwise sets it to \c false. + + \sa state, stateChanged +*/ + void Manager::setState(bool state) { QMutexLocker locker(&d->mutexState); @@ -211,11 +314,24 @@ void Manager::setState(bool state) emit stateChanged(d->state); } +/*! + Reacts to the widget factory creating a widget. + + \sa setState, state +*/ + void Manager::onWidgetIsCreated() { // do nothing - continue to sleep } +/*! + Reacts to the \a visibility of one navigation pane widget being changed + (there might be a lot of them). + + \sa setState, state +*/ + void Manager::onWidgetVisibilityIsChanged(bool visibility) { // activate data handling - when 1st time 'Class View' will be open @@ -223,6 +339,13 @@ void Manager::onWidgetVisibilityIsChanged(bool visibility) setState(true); } +/*! + Reacts to the state changed signal for the current manager \a state. + For example, requests the currect code snapshot if needed. + + \sa setState, state, stateChanged +*/ + void Manager::onStateChanged(bool state) { if (state) { @@ -234,6 +357,11 @@ void Manager::onStateChanged(bool state) } } +/*! + Reacts to the project list being changed by updating the navigation pane + visibility if necessary. +*/ + void Manager::onProjectListChanged() { // do nothing if Manager is disabled @@ -244,6 +372,13 @@ void Manager::onProjectListChanged() requestTreeDataUpdate(); } +/*! + Handles parse tasks started by the progress manager. \a type holds the + task index, which should be \c CppTools::Constants::TASK_INDEX. + + \sa CppTools::Constants::TASK_INDEX +*/ + void Manager::onTaskStarted(const QString &type) { if (type != QLatin1String(CppTools::Constants::TASK_INDEX)) @@ -253,6 +388,13 @@ void Manager::onTaskStarted(const QString &type) d->disableCodeParser = true; } +/*! + Handles parse tasks finished by the progress manager.\a type holds the + task index, which should be \c CppTools::Constants::TASK_INDEX. + + \sa CppTools::Constants::TASK_INDEX +*/ + void Manager::onAllTasksFinished(const QString &type) { if (type != QLatin1String(CppTools::Constants::TASK_INDEX)) @@ -272,6 +414,13 @@ void Manager::onAllTasksFinished(const QString &type) emit requestResetCurrentState(); } +/*! + Emits the signal \c documentUpdated when the code model manager state is + changed for \a doc. + + \sa documentUpdated +*/ + void Manager::onDocumentUpdated(CPlusPlus::Document::Ptr doc) { // do nothing if Manager is disabled @@ -285,6 +434,11 @@ void Manager::onDocumentUpdated(CPlusPlus::Document::Ptr doc) emit requestDocumentUpdated(doc); } +/*! + Opens the text editor for the file \a fileName on \a line (1-based) and + \a column (1-based). +*/ + void Manager::gotoLocation(const QString &fileName, int line, int column) { bool newEditor = false; @@ -293,6 +447,12 @@ void Manager::gotoLocation(const QString &fileName, int line, int column) &newEditor); } +/*! + Opens the text editor for any of the symbol locations in the \a list. + + \sa Manager::gotoLocations +*/ + void Manager::gotoLocations(const QList<QVariant> &list) { QSet<SymbolLocation> locations = Utils::roleToLocations(list); @@ -344,6 +504,13 @@ void Manager::gotoLocations(const QList<QVariant> &list) gotoLocation(loc.fileName(), loc.line(), loc.column()); } +/*! + Emits the signal \c requestTreeDataUpdate if the latest tree info is + requested and if parsing is enabled. + + \sa requestTreeDataUpdate, NavigationWidget::requestDataUpdate +*/ + void Manager::onRequestTreeDataUpdate() { // do nothing if Manager is disabled @@ -353,11 +520,20 @@ void Manager::onRequestTreeDataUpdate() emit requestTreeDataUpdate(); } +/*! + Switches to flat mode (without subprojects) if \a flat is set to \c true. +*/ + void Manager::setFlatMode(bool flat) { emit requestSetFlatMode(flat); } +/*! + Sends a new tree data update to a tree view. \a result holds the item with + the current tree. +*/ + void Manager::onTreeDataUpdate(QSharedPointer<QStandardItem> result) { // do nothing if Manager is disabled diff --git a/src/plugins/classview/classviewmanager.h b/src/plugins/classview/classviewmanager.h index 51a922d0a3..4194dfa913 100644 --- a/src/plugins/classview/classviewmanager.h +++ b/src/plugins/classview/classviewmanager.h @@ -41,25 +41,11 @@ namespace Internal { class ManagerPrivate; -/*! - \class Manager - \brief Class View manager - - Class View Manager. Interacts with other Qt Creator plugins - this is a proxy between them and - parser. - \a Parser is moved to a separate thread and is connected to \a Manager by signal/slots. - Manager's signals starting with 'request' are for Parser. - */ - class Manager : public QObject { Q_OBJECT public: - /*! - \brief Creates shared instance - \param parent Parent object - */ explicit Manager(QObject *parent = 0); virtual ~Manager(); @@ -67,169 +53,59 @@ public: //! Get an instance of Manager static Manager *instance(); - /*! - \brief Lazy data population for a \a QStandardItemModel - \param item Item with has to be checked - */ bool canFetchMore(QStandardItem *item) const; - /*! - \brief Lazy data population for a \a QStandardItemModel - \param item Item with has to be checked - \param skipRoot Skip root item (is needed for the manual update, call not from model) - */ void fetchMore(QStandardItem *item, bool skipRoot = false); signals: - /*! - \brief Internal Manager state is changed. - \param state true if Manager is enabled, false otherwise - \sa setState, state - */ void stateChanged(bool state); - /*! - \brief Signal about a tree data update (to tree view). - \param result Item with the current tree - */ void treeDataUpdate(QSharedPointer<QStandardItem> result); - /*! - \brief Signal that a request for sending tree view has to be handled by listeners (parser). - \sa onRequestTreeDataUpdate - */ void requestTreeDataUpdate(); - /*! - \brief Signal that document is updated (and has to be reparsed) - \param doc Updated document - \sa onDocumentUpdated - */ void requestDocumentUpdated(CPlusPlus::Document::Ptr doc); - /*! - \brief Signal that parser has to reset its internal state to the current (from code manager). - */ void requestResetCurrentState(); - /*! - \brief Request to clear a cache by parser. - */ void requestClearCache(); - /*! - \brief Request to clear a full cache by parser. - */ void requestClearCacheAll(); - /*! - \brief Request to set the flat mode (without subprojects) - \param flat True to enable flat mode, false to disable - */ void requestSetFlatMode(bool flat); public slots: - /*! - \brief Open text editor for file \a fileName on line \a lineNumber and column \a column. - \param fileName File which has to be open - \param line Line number, 1-based - \param column Column, 1-based - */ void gotoLocation(const QString &fileName, int line = 0, int column = 0); - /*! - \brief Open text editor for any of location in the list (correctly) - \param locations Symbol locations - \sa Manager::gotoLocations - */ void gotoLocations(const QList<QVariant> &locations); - /*! - \brief If somebody wants to receive the latest tree info, if a parsing is enabled then - a signal \a requestTreeDataUpdate will be emitted. - \sa requestTreeDataUpdate, NavigationWidget::requestDataUpdate - */ void onRequestTreeDataUpdate(); - /*! - \brief Switch to flat mode (without subprojects) - \param flat True to enable flat mode, false to disable - */ void setFlatMode(bool flat); protected slots: - /*! - \brief Widget factory creates a widget, handle this situation. - \sa setState, state - */ void onWidgetIsCreated(); - /*! - \brief Widget visibility is changed - \param visibility Visibility (for just 1 navi pane widget, there might be a lot of them) - \sa setState, state - */ void onWidgetVisibilityIsChanged(bool visibility); - /*! - \brief Reacts to the state changed signal, e.g. request currect code snapshot if needed etc. - \param state Current Manager state - \sa setState, state, stateChanged - */ void onStateChanged(bool state); - /*! - \brief Project list is changed (navigation pane visibility might be needed to update). - */ void onProjectListChanged(); - /*! - \brief This slot should called when the code model manager state is changed for \a doc. - It will emit a signal \a documentUpdated if - \param doc Updated document. - \sa documentUpdated - */ void onDocumentUpdated(CPlusPlus::Document::Ptr doc); - /*! - \brief Progress manager started a task. Do what is needed if it is a parse task. - \param type Task index, should be CppTools::Constants::TASK_INDEX for us - \sa CppTools::Constants::TASK_INDEX - */ void onTaskStarted(const QString &type); - /*! - \brief Progress manager finished all task with specified type. - Do what is needed if it is a parse task. - \param type Task index, should be CppTools::Constants::TASK_INDEX for us - \sa CppTools::Constants::TASK_INDEX - */ void onAllTasksFinished(const QString &type); - /*! - \brief New tree data update (has to be sent to a tree view). - \param result Item with the current tree - */ void onTreeDataUpdate(QSharedPointer<QStandardItem> result); protected: //! Perform an initialization void initialize(); - /*! - \brief Get internal Manager state. If it is disabled, signals about parsing request has not - to be emitted at all, if enabled - do parsing in the background even if navi pane - is not visible. - \return true if Manager is enabled, false otherwise - \sa setState, stateChanged - */ inline bool state() const; - /*! - \brief Set internal Manager state. - \param state true if Manager has to be enabled, false otherwise - \sa state, stateChanged - */ void setState(bool state); private: diff --git a/src/plugins/classview/classviewnavigationwidget.cpp b/src/plugins/classview/classviewnavigationwidget.cpp index 9dbedd3934..846a210281 100644 --- a/src/plugins/classview/classviewnavigationwidget.cpp +++ b/src/plugins/classview/classviewnavigationwidget.cpp @@ -49,8 +49,10 @@ namespace Internal { ///////////////////////////////// NavigationWidgetPrivate ////////////////////////////////// /*! - \struct NavigationWidgetPrivate - \brief Internal data structures / methods for NavigationWidget + \class NavigationWidgetPrivate + + The NavigationWidgetPrivate class provides internal data structures and + methods for NavigationWidget. */ class NavigationWidgetPrivate @@ -70,6 +72,47 @@ public: ///////////////////////////////// NavigationWidget ////////////////////////////////// +/*! + \class NavigationWidget + + The NavigationWidget class is a widget for the class view tree. +*/ + + +/*! + \fn void NavigationWidget::visibilityChanged(bool visibility) + + Emits a signal when the widget visibility is changed. \a visibility returns + true if plugin becames visible, otherwise it returns false. +*/ + +/*! + \fn void NavigationWidget::requestGotoLocation(const QString &name, + int line, + int column) + + Emits a signal that requests to open the file with \a name at \a line + and \a column. + + \sa Manager::gotoLocation +*/ + +/*! + \fn void NavigationWidget::requestGotoLocations(const QList<QVariant> &locations) + + Emits a signal to request to go to any of the Symbol \a locations in the + list. + + \sa Manager::gotoLocations +*/ + +/*! + \fn void NavigationWidget::requestTreeDataUpdate() + + Emits a signal that the widget wants to receive the latest tree info. + + \sa Manager::onRequestTreeDataUpdate +*/ NavigationWidget::NavigationWidget(QWidget *parent) : QWidget(parent), @@ -128,6 +171,14 @@ void NavigationWidget::showEvent(QShowEvent *event) QWidget::showEvent(event); } +/*! + Creates QToolbuttons for the Navigation Pane widget. + + Returns the list of created QToolButtons. + + \sa NavigationWidgetFactory::createWidget +*/ + QList<QToolButton *> NavigationWidget::createToolButtons() { QList<QToolButton *> list; @@ -154,6 +205,10 @@ QList<QToolButton *> NavigationWidget::createToolButtons() return list; } +/*! + Returns flat mode state. +*/ + bool NavigationWidget::flatMode() const { QTC_ASSERT(d->fullProjectsModeButton, return false); @@ -162,6 +217,10 @@ bool NavigationWidget::flatMode() const return !d->fullProjectsModeButton->isChecked(); } +/*! + Sets the flat mode state to \a flatMode. +*/ + void NavigationWidget::setFlatMode(bool flatMode) { QTC_ASSERT(d->fullProjectsModeButton, return); @@ -170,12 +229,21 @@ void NavigationWidget::setFlatMode(bool flatMode) d->fullProjectsModeButton->setChecked(!flatMode); } +/*! + Full projects mode button has been toggled. \a state holds the full + projects mode. +*/ + void NavigationWidget::onFullProjectsModeToggled(bool state) { // button is 'full projects mode' - so it has to be inverted Manager::instance()->setFlatMode(!state); } +/*! + Activates the item with the \a index in the tree view. +*/ + void NavigationWidget::onItemActivated(const QModelIndex &index) { if (!index.isValid()) @@ -186,6 +254,11 @@ void NavigationWidget::onItemActivated(const QModelIndex &index) emit requestGotoLocations(list); } +/*! + Receives new data for the tree. \a result is a pointer to the Class View + model root item. The method does nothing if null is passed. +*/ + void NavigationWidget::onDataUpdate(QSharedPointer<QStandardItem> result) { if (result.isNull()) @@ -213,6 +286,11 @@ void NavigationWidget::onDataUpdate(QSharedPointer<QStandardItem> result) << "TreeView is updated in" << timer.elapsed() << "msecs"; } +/*! + Fetches data for expanded items to make sure that the content will exist. + \a item and \a target do nothing if null is passed. +*/ + void NavigationWidget::fetchExpandedItems(QStandardItem *item, const QStandardItem *target) const { if (!item || !target) diff --git a/src/plugins/classview/classviewnavigationwidget.h b/src/plugins/classview/classviewnavigationwidget.h index 9b64aec103..98cc9ce649 100644 --- a/src/plugins/classview/classviewnavigationwidget.h +++ b/src/plugins/classview/classviewnavigationwidget.h @@ -42,11 +42,6 @@ namespace Internal { class NavigationWidgetPrivate; -/*! - \class NavigationWidget - \brief A widget for the class view tree - */ - class NavigationWidget : public QWidget { Q_OBJECT @@ -55,79 +50,29 @@ public: explicit NavigationWidget(QWidget *parent = 0); ~NavigationWidget(); - /*! - \brief Create QToolbuttons for Navigation Pane Widget - \return List with created QToolButtons - \sa NavigationWidgetFactory::createWidget - */ QList<QToolButton *> createToolButtons(); - /*! - \brief Get flat mode state - \return Flat mode state - */ bool flatMode() const; - /*! - \brief Set flat mode state - \param flatMode Flat mode state - */ void setFlatMode(bool flatMode); signals: - /*! - \brief Widget visibility is changed - \param visibility true is plugin becames visible, false otherwise - */ void visibilityChanged(bool visibility); - /*! - \brief Signal to request to go to location - \param name File which has to be open - \param line Line - \param column Column - \sa Manager::gotoLocation - */ void requestGotoLocation(const QString &name, int line, int column); - /*! - \brief Signal to request to go to any of location in the list - \param locations Symbol locations - \sa Manager::gotoLocations - */ void requestGotoLocations(const QList<QVariant> &locations); - /*! - \brief Signal that the widget wants to receive the latest tree info - \sa Manager::onRequestTreeDataUpdate - */ void requestTreeDataUpdate(); public slots: - /*! - \brief Item is activated in the tree view - \param index Item index - */ void onItemActivated(const QModelIndex &index); - /*! - \brief Receive a new data for the tree - \param result Pointer to the Class View model root item, method does nothing if null passed - */ void onDataUpdate(QSharedPointer<QStandardItem> result); - /*! - \brief Full projects' mode button has been toggled - \param state Full projects' mode - */ void onFullProjectsModeToggled(bool state); protected: - /*! - \brief Fetch data for expanded items - to be sure that content will exist - \param item - does nothing if null - \param target - does nothing if null - */ void fetchExpandedItems(QStandardItem *item, const QStandardItem *target) const; //! implements QWidget::hideEvent diff --git a/src/plugins/classview/classviewnavigationwidgetfactory.cpp b/src/plugins/classview/classviewnavigationwidgetfactory.cpp index 7b19e0144f..bc3664b9a5 100644 --- a/src/plugins/classview/classviewnavigationwidgetfactory.cpp +++ b/src/plugins/classview/classviewnavigationwidgetfactory.cpp @@ -45,6 +45,23 @@ static NavigationWidgetFactory *factoryInstance; ///////////////////////////////// NavigationWidgetFactory ////////////////////////////////// +/*! + \class NavigationWidgetFactory + \brief The NavigationWidgetFactory class implements a singleton instance of + the INavigationWidgetFactory for the Class View. + + Supports the \c setState public slot for adding the widget factory to or + removing it from \c ExtensionSystem::PluginManager. + + Also supports the \c widgetIsCreated and \c stateChanged signals. +*/ + +/*! + \fn void NavigationWidgetFactory::widgetIsCreated() + + Informs that the widget factory created a widget. +*/ + NavigationWidgetFactory::NavigationWidgetFactory() { factoryInstance = this; @@ -92,10 +109,8 @@ Core::NavigationView NavigationWidgetFactory::createWidget() /*! - \brief Get a settings prefix for the specified position - \param position Position - \return Settings prefix - */ + Returns a settings prefix for \a position. +*/ static QString settingsPrefix(int position) { return QString::fromLatin1("ClassView/Treewidget.%1/FlatMode").arg(position); diff --git a/src/plugins/classview/classviewnavigationwidgetfactory.h b/src/plugins/classview/classviewnavigationwidgetfactory.h index 5d623e8f3b..5ee1314fba 100644 --- a/src/plugins/classview/classviewnavigationwidgetfactory.h +++ b/src/plugins/classview/classviewnavigationwidgetfactory.h @@ -35,15 +35,6 @@ namespace ClassView { namespace Internal { -/*! - \class NavigationWidgetFactory - \brief INavigationWidgetFactory implementation for Class View - - INavigationWidgetFactory implementation for Class View. Singleton instance. - Supports \a setState publc slot to add/remove factory to \a ExtensionSystem::PluginManager. - Also supports some additional signals, \a widgetIsCreated and \a stateChanged. - */ - class NavigationWidgetFactory : public Core::INavigationWidgetFactory { Q_OBJECT @@ -81,9 +72,6 @@ public: void restoreSettings(int position, QWidget *widget); signals: - /*! - \brief Signal which informs that the widget factory creates a widget. - */ void widgetIsCreated(); }; diff --git a/src/plugins/classview/classviewparser.cpp b/src/plugins/classview/classviewparser.cpp index e312696faa..fdb9baf2f4 100644 --- a/src/plugins/classview/classviewparser.cpp +++ b/src/plugins/classview/classviewparser.cpp @@ -65,10 +65,31 @@ namespace Internal { // ----------------------------- ParserPrivate --------------------------------- /*! - \struct ParserPrivate - \brief Private class data for \a Parser + \class ParserPrivate + \brief The ParserPrivate class defines private class data for the Parser + class. \sa Parser */ + +/*! + \class Parser + \brief The Parser class parses C++ information. Multithreading is supported. +*/ + +/*! + \fn void Parser::treeDataUpdate(QSharedPointer<QStandardItem> result) + + Emits a signal about a tree data update. +*/ + +/*! + \fn void Parser::resetDataDone() + + Emits a signal that internal data is reset. + + \sa resetData, resetDataToCurrentState +*/ + class ParserPrivate { public: @@ -132,6 +153,10 @@ CPlusPlus::Document::Ptr ParserPrivate::document(const QString &fileName) const // ----------------------------- Parser --------------------------------- +/*! + Constructs the parser object. +*/ + Parser::Parser(QObject *parent) : QObject(parent), d(new ParserPrivate()) @@ -147,11 +172,19 @@ Parser::Parser(QObject *parent) connect(d->timer, SIGNAL(timeout()), SLOT(requestCurrentState()), Qt::QueuedConnection); } +/*! + Destructs the parser object. +*/ + Parser::~Parser() { delete d; } +/*! + Checks \a item for lazy data population of a QStandardItemModel. +*/ + bool Parser::canFetchMore(QStandardItem *item) const { ParserTreeItem::ConstPtr ptr = findItemByRoot(item); @@ -160,6 +193,11 @@ bool Parser::canFetchMore(QStandardItem *item) const return ptr->canFetchMore(item); } +/*! + Checks \a item for lazy data population of a QStandardItemModel. + \a skipRoot skips the root item. +*/ + void Parser::fetchMore(QStandardItem *item, bool skipRoot) const { ParserTreeItem::ConstPtr ptr = findItemByRoot(item, skipRoot); @@ -168,6 +206,10 @@ void Parser::fetchMore(QStandardItem *item, bool skipRoot) const ptr->fetchMore(item); } +/*! + Switches to flat mode (without subprojects) if \a flat returns \c true. +*/ + void Parser::setFlatMode(bool flatMode) { if (flatMode == d->flatMode) @@ -180,6 +222,11 @@ void Parser::setFlatMode(bool flatMode) emitCurrentTree(); } +/*! + Returns the internal tree item for \a item. \a skipRoot skips the root + item. +*/ + ParserTreeItem::ConstPtr Parser::findItemByRoot(const QStandardItem *item, bool skipRoot) const { if (!item) @@ -213,6 +260,12 @@ ParserTreeItem::ConstPtr Parser::findItemByRoot(const QStandardItem *item, bool return internal; } +/*! + Parses the class and produces a new tree. + + \sa addProject +*/ + ParserTreeItem::ConstPtr Parser::parse() { QTime time; @@ -257,6 +310,11 @@ ParserTreeItem::ConstPtr Parser::parse() return rootItem; } +/*! + Parses the project with the \a projectId and adds the documents + from the \a fileList to the tree item \a item. +*/ + void Parser::addProject(const ParserTreeItem::Ptr &item, const QStringList &fileList, const QString &projectId) { @@ -269,6 +327,10 @@ void Parser::addProject(const ParserTreeItem::Ptr &item, const QStringList &file item->copy(prj); } +/*! + Parses \a symbol and adds the results to \a item (as a parent). +*/ + void Parser::addSymbol(const ParserTreeItem::Ptr &item, const CPlusPlus::Symbol *symbol) { if (item.isNull() || !symbol) @@ -350,6 +412,10 @@ void Parser::addSymbol(const ParserTreeItem::Ptr &item, const CPlusPlus::Symbol item->appendChild(itemAdd, information); } +/*! + Creates a flat tree from the list of projects specified by \a projectList. +*/ + ParserTreeItem::Ptr Parser::createFlatTree(const QStringList &projectList) { QReadLocker locker(&d->prjLocker); @@ -364,6 +430,12 @@ ParserTreeItem::Ptr Parser::createFlatTree(const QStringList &projectList) return item; } +/*! + Parses the project with the \a projectId and adds the documents from the + \a fileList to the project. Updates the internal cached tree for this + project. +*/ + ParserTreeItem::Ptr Parser::getParseProjectTree(const QStringList &fileList, const QString &projectId) { @@ -397,6 +469,12 @@ ParserTreeItem::Ptr Parser::getParseProjectTree(const QStringList &fileList, return item; } +/*! + Gets the project with \a projectId from the cache if it is valid or parses + the project and adds the documents from the \a fileList to the project. + Updates the internal cached tree for this project. +*/ + ParserTreeItem::Ptr Parser::getCachedOrParseProjectTree(const QStringList &fileList, const QString &projectId) { @@ -424,6 +502,13 @@ ParserTreeItem::Ptr Parser::getCachedOrParseProjectTree(const QStringList &fileL return getParseProjectTree(fileList, projectId); } +/*! + Parses the document \a doc if it is in the project files and adds a tree to + the internal storage. Updates the internal cached tree for this document. + + \sa parseDocument +*/ + ParserTreeItem::ConstPtr Parser::getParseDocumentTree(const CPlusPlus::Document::Ptr &doc) { if (doc.isNull()) @@ -448,6 +533,13 @@ ParserTreeItem::ConstPtr Parser::getParseDocumentTree(const CPlusPlus::Document: return itemPtr; } +/*! + Gets the document \a doc from the cache or parses it if it is in the project + files and adds a tree to the internal storage. + + \sa parseDocument +*/ + ParserTreeItem::ConstPtr Parser::getCachedOrParseDocumentTree(const CPlusPlus::Document::Ptr &doc) { if (doc.isNull()) @@ -465,6 +557,11 @@ ParserTreeItem::ConstPtr Parser::getCachedOrParseDocumentTree(const CPlusPlus::D return getParseDocumentTree(doc); } +/*! + Parses the document \a doc if it is in the project files and adds a tree to + the internal storage. +*/ + void Parser::parseDocument(const CPlusPlus::Document::Ptr &doc) { if (doc.isNull()) @@ -485,6 +582,10 @@ void Parser::parseDocument(const CPlusPlus::Document::Ptr &doc) return; } +/*! + Requests to clear full internal stored data. +*/ + void Parser::clearCacheAll() { d->docLocker.lockForWrite(); @@ -498,6 +599,11 @@ void Parser::clearCacheAll() clearCache(); } +/*! + Requests to clear internal stored data. The data has to be regenerated on + the next request. +*/ + void Parser::clearCache() { QWriteLocker locker(&d->prjLocker); @@ -511,12 +617,21 @@ void Parser::clearCache() d->cachedPrjTreesRevision.clear(); } +/*! + Specifies the files that must be allowed for the parsing as a \a fileList. + Files outside of this list will not be in any tree. +*/ + void Parser::setFileList(const QStringList &fileList) { d->fileList.clear(); d->fileList = QSet<QString>::fromList(fileList); } +/*! + Removes the files defined in the \a fileList from the parsing. +*/ + void Parser::removeFiles(const QStringList &fileList) { if (fileList.count() == 0) @@ -536,6 +651,10 @@ void Parser::removeFiles(const QStringList &fileList) emit filesAreRemoved(); } +/*! + Fully resets the internal state of the code parser to \a snapshot. +*/ + void Parser::resetData(const CPlusPlus::Snapshot &snapshot) { // clear internal cache @@ -565,6 +684,12 @@ void Parser::resetData(const CPlusPlus::Snapshot &snapshot) emit resetDataDone(); } +/*! + Fully resets the internal state of the code parser to the current state. + + \sa resetData +*/ + void Parser::resetDataToCurrentState() { // get latest data @@ -573,17 +698,31 @@ void Parser::resetDataToCurrentState() resetData(codeModel->snapshot()); } +/*! + Regenerates the tree when internal data changes. + + \sa resetDataDone +*/ + void Parser::onResetDataDone() { // internal data is reset, update a tree and send it back emitCurrentTree(); } +/*! + Requests to emit a signal with the current tree state. +*/ + void Parser::requestCurrentState() { emitCurrentTree(); } +/*! + Sends the current tree to listeners. +*/ + void Parser::emitCurrentTree() { // stop timer if it is active right now @@ -601,6 +740,10 @@ void Parser::emitCurrentTree() emit treeDataUpdate(std); } +/*! + Generates a project node file list for the root node \a node. +*/ + QStringList Parser::projectNodeFileList(const ProjectExplorer::FolderNode *node) const { QStringList list; @@ -627,6 +770,13 @@ QStringList Parser::projectNodeFileList(const ProjectExplorer::FolderNode *node) return list; } +/*! + Generates projects like the Project Explorer. + \a item specifies the item and \a node specifies the root node. + + Returns a list of projects which were added to the item. +*/ + QStringList Parser::addProjectNode(const ParserTreeItem::Ptr &item, const ProjectExplorer::ProjectNode *node) { @@ -670,6 +820,10 @@ QStringList Parser::addProjectNode(const ParserTreeItem::Ptr &item, return projectList; } +/*! + Returns the current project list. +*/ + QList<ProjectExplorer::Project *> Parser::getProjectList() const { QList<ProjectExplorer::Project *> list; diff --git a/src/plugins/classview/classviewparser.h b/src/plugins/classview/classviewparser.h index b8ab34dde8..a8151cb8d2 100644 --- a/src/plugins/classview/classviewparser.h +++ b/src/plugins/classview/classviewparser.h @@ -50,208 +50,76 @@ namespace Internal { class ParserPrivate; -/*! - \class Parser - \brief Parse cpp information. Multithreading is supported. - */ - class Parser : public QObject { Q_OBJECT public: - /*! - \brief Constructor - */ explicit Parser(QObject *parent = 0); ~Parser(); - /*! - \brief Lazy data population for a \a QStandardItemModel - \param item Item which has to be checked - */ bool canFetchMore(QStandardItem *item) const; - /*! - \brief Lazy data population for a \a QStandardItemModel - \param item Item which will be populated (if needed) - \param skipRoot Skip root item - */ void fetchMore(QStandardItem *item, bool skipRoot = false) const; signals: //! File list is changed void filesAreRemoved(); - /*! - \brief Signal about a tree data update - */ void treeDataUpdate(QSharedPointer<QStandardItem> result); - /*! - \brief Signal that internal data - \sa resetData, resetDataToCurrentState - */ void resetDataDone(); public slots: - /*! - \brief Request to clear full internal stored data. - */ void clearCacheAll(); - /*! - \brief Request to clear internal stored data, it has to be regenerated on the next request. - */ void clearCache(); - /*! - \brief Request to emit a signal with the current tree state - */ void requestCurrentState(); - /*! - \brief Set file list for the parsing, files outside of this list will not be in any tree. - \param fileList Files which must be allowed for the parsing - */ void setFileList(const QStringList &fileList); - /*! - \brief Remove some files from the file list for the parsing. - \param fileList Files which must be removed from the parsing - */ void removeFiles(const QStringList &fileList); - /*! - \brief Fully reset internal state - \param snapshot Code parser snapshot - */ void resetData(const CPlusPlus::Snapshot &snapshot); - /*! - \brief Fully reset internal state - to the current state - \sa resetData - */ void resetDataToCurrentState(); - /*! - \brief Parse document if it is in the project files and add a tree to the internal storage - \param doc Document which has to be parsed - */ void parseDocument(const CPlusPlus::Document::Ptr &doc); - /*! - \brief Switch to flat mode (without subprojects) - \param flat True to enable flat mode, false to disable - */ void setFlatMode(bool flat); protected slots: - /*! - \brief Internal data is changed, regenerate the tree - \sa resetDataDone - */ void onResetDataDone(); protected: - /*! - \brief Parse one particular project and add result to the tree item - \param item Item where parsed project has to be stored - \param fileList Files - \param projectId Project id, is needed for prj cache - */ void addProject(const ParserTreeItem::Ptr &item, const QStringList &fileList, const QString &projectId = QString()); - /*! - \brief Parse one particular symbol and add result to the tree item (as a parent) - \param item Item where parsed symbol has to be stored - \param symbol Symbol which has to be used as a source - */ void addSymbol(const ParserTreeItem::Ptr &item, const CPlusPlus::Symbol *symbol); - /*! - \brief Parse document if it is in the project files and add a tree to the internal storage. - Update internal cached tree for this document. - \param doc Document which has to be parsed - \return A tree - \sa parseDocument - */ ParserTreeItem::ConstPtr getParseDocumentTree(const CPlusPlus::Document::Ptr &doc); - /*! - \brief Get from the cache or parse document if it is in the project files - and add a tree to the internal storage - \param doc Document which has to be parsed - \return A tree - \sa parseDocument - */ ParserTreeItem::ConstPtr getCachedOrParseDocumentTree(const CPlusPlus::Document::Ptr &doc); - /*! - \brief Parse project and add a tree to the internal storage. - Update internal cached tree for this project. - \param fileList Documents which has to be added to the project - \param projectId Project id - \return A tree - */ ParserTreeItem::Ptr getParseProjectTree(const QStringList &fileList, const QString &projectId); - /*! - \brief Get from the cache (if valid) or parse project and add a tree to the internal storage. - Update internal cached tree for this project. - \param fileList Documents which has to be added to the project - \param projectId Project id - \return A tree - */ ParserTreeItem::Ptr getCachedOrParseProjectTree(const QStringList &fileList, const QString &projectId); - /*! - \brief Send a current tree to listeners - */ void emitCurrentTree(); - /*! - \brief Parse the class and produce a new tree - \sa addProject - */ ParserTreeItem::ConstPtr parse(); - /*! - \brief Find internal node for the specified UI item - \param item Item which has to be found - \param skipRoot Skip root item - \return Found internal node - */ ParserTreeItem::ConstPtr findItemByRoot(const QStandardItem *item, bool skipRoot = false) const; - /*! - \brief Generate projects like Project Explorer - \param item Item - \param node Root node - \return List of projects which were added to the item - */ QStringList addProjectNode(const ParserTreeItem::Ptr &item, const ProjectExplorer::ProjectNode *node); - /*! - \brief Generate project node file list - \param node Root node - */ QStringList projectNodeFileList(const ProjectExplorer::FolderNode *node) const; - /*! - \brief Get the current project list - \return Project list - */ QList<ProjectExplorer::Project *> getProjectList() const; - /*! - \brief Create flat tree from different projects - \param projectList List of projects - \return Flat tree - */ ParserTreeItem::Ptr createFlatTree(const QStringList &projectList); private: diff --git a/src/plugins/classview/classviewparsertreeitem.cpp b/src/plugins/classview/classviewparsertreeitem.cpp index 5c73e263b4..f46a5ce130 100644 --- a/src/plugins/classview/classviewparsertreeitem.cpp +++ b/src/plugins/classview/classviewparsertreeitem.cpp @@ -49,8 +49,9 @@ namespace Internal { ///////////////////////////////// ParserTreeItemPrivate ////////////////////////////////// /*! - \struct ParserTreeItemPrivate - \brief Private class data for \a ParserTreeItem + \class ParserTreeItemPrivate + \brief The ParserTreeItemPrivate class defines private class data for + the ParserTreeItem class. \sa ParserTreeItem */ class ParserTreeItemPrivate @@ -68,6 +69,13 @@ public: ///////////////////////////////// ParserTreeItem ////////////////////////////////// +/*! + \class ParserTreeItem + \brief The ParserTreeItem class is an item for the internal Class View tree. + + Not virtual - to speed up its work. +*/ + ParserTreeItem::ParserTreeItem() : d(new ParserTreeItemPrivate()) { @@ -86,6 +94,11 @@ ParserTreeItem &ParserTreeItem::operator=(const ParserTreeItem &other) return *this; } +/*! + Copies a parser tree item from the location specified by \a from to this + item. +*/ + void ParserTreeItem::copy(const ParserTreeItem::ConstPtr &from) { if (from.isNull()) @@ -96,6 +109,12 @@ void ParserTreeItem::copy(const ParserTreeItem::ConstPtr &from) d->symbolInformations = from->d->symbolInformations; } +/*! + \fn void copyTree(const ParserTreeItem::ConstPtr &from) + Copies a parser tree item with children from the location specified by + \a from to this item. +*/ + void ParserTreeItem::copyTree(const ParserTreeItem::ConstPtr &target) { if (target.isNull()) @@ -123,31 +142,60 @@ void ParserTreeItem::copyTree(const ParserTreeItem::ConstPtr &target) } } +/*! + Adds information about symbol location from a \location. + \sa SymbolLocation, removeSymbolLocation, symbolLocations +*/ + void ParserTreeItem::addSymbolLocation(const SymbolLocation &location) { d->symbolLocations.insert(location); } +/*! + Adds information about symbol locations from \a locations. + \sa SymbolLocation, removeSymbolLocation, symbolLocations +*/ + void ParserTreeItem::addSymbolLocation(const QSet<SymbolLocation> &locations) { d->symbolLocations.unite(locations); } +/*! + Removes information about \a location. + \sa SymbolLocation, addSymbolLocation, symbolLocations +*/ + void ParserTreeItem::removeSymbolLocation(const SymbolLocation &location) { d->symbolLocations.remove(location); } +/*! + Removes information about \a locations. + \sa SymbolLocation, addSymbolLocation, symbolLocations +*/ + void ParserTreeItem::removeSymbolLocations(const QSet<SymbolLocation> &locations) { d->symbolLocations.subtract(locations); } +/*! + Gets information about symbol positions. + \sa SymbolLocation, addSymbolLocation, removeSymbolLocation +*/ + QSet<SymbolLocation> ParserTreeItem::symbolLocations() const { return d->symbolLocations; } +/*! + Appends the child item \a item to \a inf symbol information. +*/ + void ParserTreeItem::appendChild(const ParserTreeItem::Ptr &item, const SymbolInformation &inf) { // removeChild must be used to remove an item @@ -157,11 +205,19 @@ void ParserTreeItem::appendChild(const ParserTreeItem::Ptr &item, const SymbolIn d->symbolInformations[inf] = item; } +/*! + Removes the \a inf symbol information. +*/ + void ParserTreeItem::removeChild(const SymbolInformation &inf) { d->symbolInformations.remove(inf); } +/*! + Returns the child item specified by \a inf symbol information. +*/ + ParserTreeItem::Ptr ParserTreeItem::child(const SymbolInformation &inf) const { if (!d->symbolInformations.contains(inf)) @@ -169,21 +225,38 @@ ParserTreeItem::Ptr ParserTreeItem::child(const SymbolInformation &inf) const return d->symbolInformations[inf]; } +/*! + Returns the amount of children of the tree item. +*/ + int ParserTreeItem::childCount() const { return d->symbolInformations.count(); } +/*! + \property QIcon::icon + \brief the icon assigned to the tree item +*/ + QIcon ParserTreeItem::icon() const { return d->icon; } +/*! + Sets the \a icon for the tree item. + */ void ParserTreeItem::setIcon(const QIcon &icon) { d->icon = icon; } +/*! + Adds an internal state with \a target, which contains the correct current + state. +*/ + void ParserTreeItem::add(const ParserTreeItem::ConstPtr &target) { if (target.isNull()) @@ -221,6 +294,10 @@ void ParserTreeItem::add(const ParserTreeItem::ConstPtr &target) } } +/*! + Subtracts an internal state with \a target, which contains the subtrahend. +*/ + void ParserTreeItem::subtract(const ParserTreeItem::ConstPtr &target) { if (target.isNull()) @@ -246,6 +323,12 @@ void ParserTreeItem::subtract(const ParserTreeItem::ConstPtr &target) } } +/*! + Appends this item to the QStandardIten item \a item. + \a recursive does it recursively for the tree items (might be needed for + lazy data population. +*/ + void ParserTreeItem::convertTo(QStandardItem *item, bool recursive) const { if (!item) @@ -288,6 +371,10 @@ void ParserTreeItem::convertTo(QStandardItem *item, bool recursive) const } } +/*! + Checks \a item in a QStandardItemModel for lazy data population. +*/ + bool ParserTreeItem::canFetchMore(QStandardItem *item) const { if (!item) @@ -327,6 +414,10 @@ bool ParserTreeItem::canFetchMore(QStandardItem *item) const return false; } +/*! + Performs lazy data population for \a item in a QStandardItemModel if needed. +*/ + void ParserTreeItem::fetchMore(QStandardItem *item) const { if (!item) @@ -353,6 +444,10 @@ void ParserTreeItem::fetchMore(QStandardItem *item) const } } +/*! + Debug dump. +*/ + void ParserTreeItem::debugDump(int ident) const { QHash<SymbolInformation, ParserTreeItem::Ptr>::const_iterator curHash = diff --git a/src/plugins/classview/classviewparsertreeitem.h b/src/plugins/classview/classviewparsertreeitem.h index bda9c8609f..cbdb9a277b 100644 --- a/src/plugins/classview/classviewparsertreeitem.h +++ b/src/plugins/classview/classviewparsertreeitem.h @@ -42,14 +42,6 @@ namespace Internal { class ParserTreeItemPrivate; -/*! - \class ParserTreeItem - \brief Item for the internal Class View Tree - - Item for Class View Tree. - Not virtual - to speed up its work. - */ - class ParserTreeItem { public: @@ -60,85 +52,28 @@ public: ParserTreeItem(); ~ParserTreeItem(); - /*! - \brief Copy content of \a from item with children to this one. - \param from 'From' item - */ void copyTree(const ParserTreeItem::ConstPtr &from); - /*! - \brief Copy of \a from item to this one. - \param from 'From' item - */ void copy(const ParserTreeItem::ConstPtr &from); - /*! - \brief Add information about symbol location - \param location Filled \a SymbolLocation struct with a correct information - \sa SymbolLocation, removeSymbolLocation, symbolLocations - */ void addSymbolLocation(const SymbolLocation &location); - /*! - \brief Add information about symbol locations - \param locations Filled \a SymbolLocation struct with a correct information - \sa SymbolLocation, removeSymbolLocation, symbolLocations - */ void addSymbolLocation(const QSet<SymbolLocation> &locations); - /*! - \brief Remove information about symbol location - \param location Filled \a SymbolLocation struct with a correct information - \sa SymbolLocation, addSymbolLocation, symbolLocations - */ void removeSymbolLocation(const SymbolLocation &location); - /*! - \brief Remove information about symbol locations - \param locations Filled \a SymbolLocation struct with a correct information - \sa SymbolLocation, addSymbolLocation, symbolLocations - */ void removeSymbolLocations(const QSet<SymbolLocation> &locations); - /*! - \brief Get information about symbol positions - \sa SymbolLocation, addSymbolLocation, removeSymbolLocation - */ QSet<SymbolLocation> symbolLocations() const; - /*! - \brief Append child - \param item Child item - \param inf Symbol information - */ void appendChild(const ParserTreeItem::Ptr &item, const SymbolInformation &inf); - /*! - \brief Remove child - \param inf SymbolInformation which has to be removed - */ void removeChild(const SymbolInformation &inf); - /*! - \brief Get an item - \param inf Symbol information about needed child - \return Found child - */ ParserTreeItem::Ptr child(const SymbolInformation &inf) const; - /*! - \brief How many children - \return Amount of chilren - */ int childCount() const; - /*! - \brief Append this item to the \a QStandardIten item - \param item QStandardItem - \param recursive Do it recursively for the tree items or not (might be needed for - the lazy data population - - */ void convertTo(QStandardItem *item, bool recursive = true) const; // additional properties @@ -148,33 +83,14 @@ public: //! Set an icon for this tree node void setIcon(const QIcon &icon); - /*! - \brief Add an internal state with \a target. - \param target Item which contains the correct current state - */ void add(const ParserTreeItem::ConstPtr &target); - /*! - \brief Subtract an internal state with \a target. - \param target Item which contains the subtrahend - */ void subtract(const ParserTreeItem::ConstPtr &target); - /*! - \brief Lazy data population for a \a QStandardItemModel - \param item Item which has to be checked - */ bool canFetchMore(QStandardItem *item) const; - /*! - \brief Lazy data population for a \a QStandardItemModel - \param item Item which will be populated (if needed) - */ void fetchMore(QStandardItem *item) const; - /*! - \brief Debug dump - */ void debugDump(int ident = 0) const; protected: diff --git a/src/plugins/classview/classviewplugin.cpp b/src/plugins/classview/classviewplugin.cpp index d5f552f7a6..db233e7954 100644 --- a/src/plugins/classview/classviewplugin.cpp +++ b/src/plugins/classview/classviewplugin.cpp @@ -38,6 +38,14 @@ namespace Internal { ///////////////////////////////// Plugin ////////////////////////////////// +/*! + \class Plugin + \brief The Plugin class is the base class for the Class View plugin. + + The Class View shows the namespace and class hierarchy of the currently open + projects in the sidebar. +*/ + bool Plugin::initialize(const QStringList &arguments, QString *errorMessage) { Q_UNUSED(arguments) diff --git a/src/plugins/classview/classviewplugin.h b/src/plugins/classview/classviewplugin.h index b3898d30f2..ea6dd39bba 100644 --- a/src/plugins/classview/classviewplugin.h +++ b/src/plugins/classview/classviewplugin.h @@ -35,11 +35,6 @@ namespace ClassView { namespace Internal { -/*! - \class Plugin - \brief Base class for Class View plugin (class/namespaces in the navigation pane) - */ - class Plugin : public ExtensionSystem::IPlugin { Q_OBJECT diff --git a/src/plugins/classview/classviewsymbolinformation.cpp b/src/plugins/classview/classviewsymbolinformation.cpp index a38997ce91..3eb9e1efc8 100644 --- a/src/plugins/classview/classviewsymbolinformation.cpp +++ b/src/plugins/classview/classviewsymbolinformation.cpp @@ -36,6 +36,12 @@ namespace ClassView { namespace Internal { +/*! + \class SymbolInformation + \brief The SymbolInformation class provides the name, type, and icon for a + single item in the Class View tree. +*/ + SymbolInformation::SymbolInformation() : m_iconType(INT_MIN), m_hash(0) @@ -52,6 +58,11 @@ SymbolInformation::SymbolInformation(const QString &valueName, const QString &va m_hash = qHash(qMakePair(m_iconType, qMakePair(m_name, m_type))); } +/*! + Returns an icon type sort order number. It is not pre-calculated, as it is + needed for converting to standard item only. +*/ + int SymbolInformation::iconTypeSortOrder() const { return Utils::iconTypeSortOrder(m_iconType); diff --git a/src/plugins/classview/classviewsymbolinformation.h b/src/plugins/classview/classviewsymbolinformation.h index d7331347a6..ecae8c8110 100644 --- a/src/plugins/classview/classviewsymbolinformation.h +++ b/src/plugins/classview/classviewsymbolinformation.h @@ -38,11 +38,6 @@ namespace ClassView { namespace Internal { -/*! - \class SymbolInformation - \brief Provides name, type and icon for single item in Class View tree - */ - class SymbolInformation { public: @@ -61,11 +56,6 @@ public: && type() == other.type(); } - /*! - \brief Get an icon type sort order. Not pre-calculated - is needed for converting - to Standard Item only. - \return Sort order number. - */ int iconTypeSortOrder() const; private: diff --git a/src/plugins/classview/classviewsymbollocation.cpp b/src/plugins/classview/classviewsymbollocation.cpp index c1fb4bd8ae..8db565577e 100644 --- a/src/plugins/classview/classviewsymbollocation.cpp +++ b/src/plugins/classview/classviewsymbollocation.cpp @@ -34,6 +34,14 @@ namespace ClassView { namespace Internal { +/*! + \class SymbolLocation + \brief The SymbolLocation class stores information about symbol location + to know the exact location to open when the user clicks on a tree item. + + This class might be used in QSet and QHash. +*/ + SymbolLocation::SymbolLocation() : m_line(0), m_column(0), diff --git a/src/plugins/classview/classviewsymbollocation.h b/src/plugins/classview/classviewsymbollocation.h index 121b2ef3f6..8bc4c95b94 100644 --- a/src/plugins/classview/classviewsymbollocation.h +++ b/src/plugins/classview/classviewsymbollocation.h @@ -36,11 +36,6 @@ namespace ClassView { namespace Internal { -/*! - \class SymbolLocation - \brief Special struct to store information about symbol location (to find which exactly location - has to be open when the user clicks on any tree item. It might be used in QSet/QHash. - */ class SymbolLocation { public: diff --git a/src/plugins/classview/classviewtreeitemmodel.cpp b/src/plugins/classview/classviewtreeitemmodel.cpp index 1cfc1a1dad..7d8dc1ebc2 100644 --- a/src/plugins/classview/classviewtreeitemmodel.cpp +++ b/src/plugins/classview/classviewtreeitemmodel.cpp @@ -40,8 +40,9 @@ namespace Internal { ///////////////////////////////// TreeItemModelPrivate ////////////////////////////////// /*! - \struct TreeItemModelPrivate - \brief Private class data for \a TreeItemModel + \class TreeItemModelPrivate + \brief The TreeItemModelPrivate class contains private class data for + the TreeItemModel class. \sa TreeItemModel */ class TreeItemModelPrivate @@ -53,6 +54,11 @@ public: ///////////////////////////////// TreeItemModel ////////////////////////////////// +/*! + \class TreeItemModel + \brief The TreeItemModel class provides a model for the Class View tree. +*/ + TreeItemModel::TreeItemModel(QObject *parent) : QStandardItemModel(parent), d(new TreeItemModelPrivate()) @@ -118,6 +124,10 @@ void TreeItemModel::fetchMore(const QModelIndex &parent) return Manager::instance()->fetchMore(itemFromIndex(parent)); } +/*! + Moves the root item to the \a target item. +*/ + void TreeItemModel::moveRootToTarget(const QStandardItem *target) { emit layoutAboutToBeChanged(); diff --git a/src/plugins/classview/classviewtreeitemmodel.h b/src/plugins/classview/classviewtreeitemmodel.h index 59e911bd8e..b4a8407f67 100644 --- a/src/plugins/classview/classviewtreeitemmodel.h +++ b/src/plugins/classview/classviewtreeitemmodel.h @@ -37,11 +37,6 @@ namespace Internal { class TreeItemModelPrivate; -/*! - \class TreeItemModel - \brief Model for Class View Tree - */ - class TreeItemModel : public QStandardItemModel { Q_OBJECT @@ -50,10 +45,6 @@ public: explicit TreeItemModel(QObject *parent=0); virtual ~TreeItemModel(); - /*! - \brief move root item to the target - \param target Target item - */ void moveRootToTarget(const QStandardItem *target); //! \implements QStandardItemModel::data diff --git a/src/plugins/classview/classviewutils.cpp b/src/plugins/classview/classviewutils.cpp index 70d7e12f01..efa13edb05 100644 --- a/src/plugins/classview/classviewutils.cpp +++ b/src/plugins/classview/classviewutils.cpp @@ -40,6 +40,11 @@ namespace ClassView { namespace Constants { +/*! + \class Utils + \brief The Utils class provides some common utilities. +*/ + //! Default icon sort order const int IconSortOrder[] = { CPlusPlus::Icons::NamespaceIconType, @@ -69,6 +74,13 @@ Utils::Utils() { } +/*! + Converts internal location container to QVariant compatible. + \a locations specifies a set of symbol locations. + Returns a list of variant locations that can be added to the data of an + item. +*/ + QList<QVariant> Utils::locationsToRole(const QSet<SymbolLocation> &locations) { QList<QVariant> locationsVar; @@ -78,6 +90,13 @@ QList<QVariant> Utils::locationsToRole(const QSet<SymbolLocation> &locations) return locationsVar; } +/*! + Converts QVariant location container to internal. + \a locationsVar contains a list of variant locations from the data of an + item. + Returns a set of symbol locations. + */ + QSet<SymbolLocation> Utils::roleToLocations(const QList<QVariant> &locationsVar) { QSet<SymbolLocation> locations; @@ -89,6 +108,10 @@ QSet<SymbolLocation> Utils::roleToLocations(const QList<QVariant> &locationsVar) return locations; } +/*! + Returns sort order value for the \a icon. +*/ + int Utils::iconTypeSortOrder(int icon) { static QHash<int, int> sortOrder; @@ -107,6 +130,12 @@ int Utils::iconTypeSortOrder(int icon) return sortOrder[icon]; } +/*! + Sets symbol information specified by \a information to \a item. + \a information provides the name, type, and icon for the item. + Returns the filled item. +*/ + QStandardItem *Utils::setSymbolInformationToItem(const SymbolInformation &information, QStandardItem *item) { @@ -119,6 +148,10 @@ QStandardItem *Utils::setSymbolInformationToItem(const SymbolInformation &inform return item; } +/*! + Returns symbol information for \a item. +*/ + SymbolInformation Utils::symbolInformationFromItem(const QStandardItem *item) { Q_ASSERT(item); @@ -141,6 +174,10 @@ SymbolInformation Utils::symbolInformationFromItem(const QStandardItem *item) return SymbolInformation(name, type, iconType); } +/*! + Updates \a item to \a target, so that it is sorted and can be fetched. +*/ + void Utils::fetchItemToTarget(QStandardItem *item, const QStandardItem *target) { if (!item || !target) @@ -178,6 +215,9 @@ void Utils::fetchItemToTarget(QStandardItem *item, const QStandardItem *target) } } +/*! + Moves \a item to \a target (sorted). +*/ void Utils::moveItemToTarget(QStandardItem *item, const QStandardItem *target) { if (!item || !target) diff --git a/src/plugins/classview/classviewutils.h b/src/plugins/classview/classviewutils.h index 78bc793a2a..789a51bece 100644 --- a/src/plugins/classview/classviewutils.h +++ b/src/plugins/classview/classviewutils.h @@ -41,66 +41,25 @@ QT_FORWARD_DECLARE_CLASS(QStandardItem) namespace ClassView { namespace Internal { -/*! - \class Utils - \brief Some common utils - */ - class Utils { //! Private constructor Utils(); public: - /*! - \brief convert internal location container to QVariant compatible - \param locations Set of SymbolLocations - \return List of variant locations (can be added to an item's data) - */ static QList<QVariant> locationsToRole(const QSet<SymbolLocation> &locations); - /*! - \brief convert QVariant location container to internal - \param locations List of variant locations (from an item's data) - \return Set of SymbolLocations - */ static QSet<SymbolLocation> roleToLocations(const QList<QVariant> &locations); - /*! - \brief Returns sort order value for the icon type - \param iconType Icon type - \return Sort order value for the provided icon type - */ static int iconTypeSortOrder(int iconType); - /*! - \brief Get symbol information for the \a QStandardItem - \param item Item - \return Filled symbol information. - */ static SymbolInformation symbolInformationFromItem(const QStandardItem *item); - /*! - \brief Set symbol information to the \a QStandardItem - \param information Provides name, type and icon - \param item Item - \return Filled item - */ static QStandardItem *setSymbolInformationToItem(const SymbolInformation &information, QStandardItem *item); - /*! - \brief Update an item to the target. (sorted, for fetching) - \param item Source item - \param target Target item - */ static void fetchItemToTarget(QStandardItem *item, const QStandardItem *target); - /*! - \brief Move an item to the target. (sorted) - \param item Source item - \param target Target item - */ static void moveItemToTarget(QStandardItem *item, const QStandardItem *target); }; |