void CppTodoItemsScanner::processDocument(CPlusPlus::Document::Ptr doc) { QList<TodoItem> itemList; CPlusPlus::TranslationUnit *translationUnit = doc->translationUnit(); for (unsigned i = 0; i < translationUnit->commentCount(); ++i) { // Get comment source CPlusPlus::Token token = doc->translationUnit()->commentAt(i); QByteArray source = doc->utf8Source().mid(token.begin(), token.length()).trimmed(); if ((token.kind() == CPlusPlus::T_COMMENT) || (token.kind() == CPlusPlus::T_DOXY_COMMENT)) { // Remove trailing "*/" source = source.left(source.length() - 2); } // Process every line of the comment // TODO: Do not create QStringList, just iterate through a string tracking line endings. const QStringList commentLines = QString::fromUtf8(source).split(QLatin1Char('\n'), QString::SkipEmptyParts); unsigned lineNumber = 0; translationUnit->getPosition(token.begin(), &lineNumber); for (int j = 0; j < commentLines.count(); ++j) { const QString &commentLine = commentLines.at(j); processCommentLine(doc->fileName(), commentLine, lineNumber + j, itemList); } } emit itemsFetched(doc->fileName(), itemList); }
void DiskLocation::onItemsFetched() { if (m_extWatcher) { m_extWatcher->setCurrentPath(m_info->absoluteFilePath()); } emit itemsFetched(); }
void QmlJsTodoItemsScanner::processDocument(QmlJS::Document::Ptr doc) { QList<TodoItem> itemList; foreach (const QmlJS::AST::SourceLocation &sourceLocation, doc->engine()->comments()) { QString source = doc->source().mid(sourceLocation.begin(), sourceLocation.length).trimmed(); // Process every line // TODO: Do not create QStringList, just iterate through a string tracking line endings. QStringList commentLines = source.split(QLatin1Char('\n'), QString::SkipEmptyParts); quint32 startLine = sourceLocation.startLine; for (int j = 0; j < commentLines.count(); ++j) { const QString &commentLine = commentLines.at(j); processCommentLine(doc->fileName(), commentLine, startLine + j, itemList); } } emit itemsFetched(doc->fileName(), itemList); }
DirModel::DirModel(QObject *parent) : DirItemAbstractListModel(parent) , mFilterDirectories(false) , mShowDirectories(true) , mAwaitingResults(false) , mIsRecursive(false) , mReadsMediaMetadata(false) , mShowHiddenFiles(false) , mOnlyAllowedPaths(false) , mSortBy(SortByName) , mSortOrder(SortAscending) , mCompareFunction(0) , mExtFSWatcher(false) , mClipboard(new Clipboard(this)) , mLocationFactory(new LocationsFactory(this)) , mCurLocation(0) , m_fsAction(new FileSystemAction(this) ) { mNameFilters = QStringList() << "*"; mSelection = new DirSelection(this, &mDirectoryContents); connect(m_fsAction, SIGNAL(progress(int,int,int)), this, SIGNAL(progress(int,int,int))); connect(m_fsAction, SIGNAL(added(DirItemInfo)), this, SLOT(onItemAdded(DirItemInfo))); connect(m_fsAction, SIGNAL(added(QString)), this, SLOT(onItemAdded(QString))); connect(m_fsAction, SIGNAL(removed(DirItemInfo)), this, SLOT(onItemRemoved(DirItemInfo))); connect(m_fsAction, SIGNAL(removed(QString)), this, SLOT(onItemRemoved(QString))); connect(m_fsAction, SIGNAL(error(QString,QString)), this, SIGNAL(error(QString,QString))); connect(this, SIGNAL(pathChanged(QString)), m_fsAction, SLOT(pathChanged(QString))); connect(mClipboard, SIGNAL(clipboardChanged()), this, SIGNAL(clipboardChanged())); connect(m_fsAction, SIGNAL(changed(DirItemInfo)), this, SLOT(onItemChanged(DirItemInfo))); connect(mClipboard, SIGNAL(clipboardChanged()), m_fsAction, SLOT(onClipboardChanged())); connect(m_fsAction, SIGNAL(recopy(QStringList,QString)), mClipboard, SLOT(copy(QStringList,QString))); setCompareAndReorder(); if (QIcon::themeName().isEmpty() && !FMUtil::hasTriedThemeName()) { FMUtil::setThemeName(); } foreach (const Location* l, mLocationFactory->availableLocations()) { connect(l, SIGNAL(itemsAdded(DirItemInfoList)), this, SLOT(onItemsAdded(DirItemInfoList))); connect(l, SIGNAL(itemsFetched()), this, SLOT(onItemsFetched())); connect(l, SIGNAL(extWatcherItemAdded(DirItemInfo)), this, SLOT(onItemAddedOutsideFm(DirItemInfo))); connect(l, SIGNAL(extWatcherItemRemoved(DirItemInfo)), this, SLOT(onItemRemovedOutSideFm(DirItemInfo))); connect(l, SIGNAL(extWatcherItemChanged(DirItemInfo)), this, SLOT(onItemChangedOutSideFm(DirItemInfo))); connect(l, SIGNAL(extWatcherChangesFetched(int)), this, SLOT(onExternalFsWorkerFinished(int))); connect(l, SIGNAL(extWatcherPathChanged(QString)), this, SLOT(onThereAreExternalChanges(QString))); connect(this, SIGNAL(enabledExternalFSWatcherChanged(bool)), l, SLOT(setUsingExternalWatcher(bool))); } }