| 133 | } |
| 134 | |
| 135 | QWidget* ProjectFileData::expandingWidget() const |
| 136 | { |
| 137 | const QUrl url = m_file.path.toUrl(); |
| 138 | DUChainReadLocker lock; |
| 139 | |
| 140 | ///Find a du-chain for the document |
| 141 | const QList<TopDUContext*> contexts = DUChain::self()->chainsForDocument(url); |
| 142 | |
| 143 | ///Pick a non-proxy context |
| 144 | TopDUContext* chosen = nullptr; |
| 145 | for (TopDUContext* ctx : contexts) { |
| 146 | if (!(ctx->parsingEnvironmentFile() && ctx->parsingEnvironmentFile()->isProxyContext())) { |
| 147 | chosen = ctx; |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | if (chosen) { |
| 152 | // TODO: show project name, by introducing a generic wrapper widget that supports QuickOpenEmbeddedWidgetInterface |
| 153 | return chosen->createNavigationWidget(); |
| 154 | } else { |
| 155 | auto* ret = new QTextBrowser(); |
| 156 | ret->resize(400, 100); |
| 157 | ret->setText( |
| 158 | QLatin1String("<small><small>") |
| 159 | + i18nc("%1: project name", "Project %1", project()) |
| 160 | + QLatin1String("<br>") + i18n("Not parsed yet") |
| 161 | + QLatin1String("</small></small>")); |
| 162 | return ret; |
| 163 | } |
| 164 | |
| 165 | return nullptr; |
| 166 | } |
| 167 | |
| 168 | QIcon ProjectFileData::icon() const |
| 169 | { |
no test coverage detected