MCPcopy Create free account
hub / github.com/KDE/kdevelop / ManPageDocumentationWidget

Method ManPageDocumentationWidget

plugins/manpage/manpagedocumentationwidget.cpp:19–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17#include <QTreeView>
18
19ManPageDocumentationWidget::ManPageDocumentationWidget(QWidget *parent)
20 : QStackedWidget(parent)
21 , m_loadingWidget(nullptr)
22{
23 ManPageModel* model = ManPageDocumentation::s_provider->model();
24 m_treeView = new QTreeView(this);
25 m_treeView->viewport()->installEventFilter(this);
26 m_treeView->header()->setVisible(false);
27 connect(m_treeView, &QTreeView::clicked, model, &ManPageModel::showItem);
28 addWidget(m_treeView);
29 if(!model->isLoaded()){
30 m_loadingWidget = new QWidget(this);
31 m_progressBar = new QProgressBar(m_loadingWidget);
32 m_statusLabel = new QLabel(i18n("Loading man pages..."));
33 if(model->sectionCount() == 0){
34 connect(model, &ManPageModel::sectionListUpdated, this, &ManPageDocumentationWidget::sectionListUpdated );
35 } else {
36 sectionListUpdated();
37 }
38 connect(model, &ManPageModel::sectionParsed, this, &ManPageDocumentationWidget::sectionParsed );
39 connect(model, &ManPageModel::manPagesLoaded, this, &ManPageDocumentationWidget::manIndexLoaded);
40 connect(model, &ManPageModel::error, this, &ManPageDocumentationWidget::handleError);
41 m_statusLabel->setAlignment(Qt::AlignHCenter);
42 auto* layout = new QVBoxLayout();
43 layout->addWidget(m_statusLabel);
44 layout->addWidget(m_progressBar);
45 layout->addStretch();
46 m_loadingWidget->setLayout(layout);
47 addWidget(m_loadingWidget);
48 setCurrentWidget(m_loadingWidget);
49 if(model->hasError())
50 handleError(model->errorString());
51 } else {
52 manIndexLoaded();
53 }
54
55}
56
57void ManPageDocumentationWidget::manIndexLoaded()
58{

Callers

nothing calls this directly

Calls 8

headerMethod · 0.80
sectionCountMethod · 0.80
modelMethod · 0.45
setVisibleMethod · 0.45
isLoadedMethod · 0.45
addWidgetMethod · 0.45
hasErrorMethod · 0.45
errorStringMethod · 0.45

Tested by

no test coverage detected