NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxHelpSearchWidget.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #include "cxHelpSearchWidget.h"
13 
14 #include <QVBoxLayout>
15 #include <QHelpEngine>
16 #include <QHelpSearchEngine>
17 #include <QHelpSearchQueryWidget>
18 #include <QHelpSearchResultWidget>
19 #include <iostream>
20 #include "cxTypeConversions.h"
21 #include "cxHelpEngine.h"
22 
23 namespace cx
24 {
25 
27  QWidget(parent),
28  mVerticalLayout(new QVBoxLayout(this)),
29  mEngine(engine)
30 {
31  this->setLayout(mVerticalLayout);
32  mVerticalLayout->setMargin(0);
33 
34  helpSearchEngine = new QHelpSearchEngine(mEngine->engine());
35  connect(helpSearchEngine, SIGNAL(indexingStarted()), this, SLOT(indexingStarted()));
36  connect(helpSearchEngine, SIGNAL(indexingFinished()), this, SLOT(indexingFinished()));
37  connect(helpSearchEngine, SIGNAL(searchingStarted()), this, SLOT(searchingIsStarted()));
38  connect(helpSearchEngine, SIGNAL(searchingFinished(int)), this, SLOT(searchingIsFinished(int)));
39 
40  mVerticalLayout->addWidget(helpSearchEngine->queryWidget());
41  mVerticalLayout->addWidget(helpSearchEngine->resultWidget());
42 
43  connect(helpSearchEngine->queryWidget(), SIGNAL(search()), this, SLOT(search()));
44 
45  helpSearchEngine->reindexDocumentation();
46 
47  connect(helpSearchEngine->resultWidget(),
48  SIGNAL(requestShowLink(const QUrl&)),
49  this, SIGNAL(requestShowLink(const QUrl&)));
50 }
51 
53 {
54  QList<QHelpSearchQuery> query = helpSearchEngine->queryWidget()->query();
55  helpSearchEngine->search(query);
56 }
57 
59 {
60 // std::cout << "start indexing: " << std::endl;
61 }
62 
64 {
65 // std::cout << "stop indexing: " << std::endl;
66 }
67 
69 {
70 // std::cout << "started search: " << std::endl;
71 }
73 {
74 // std::cout << "finished search: " << i << std::endl;
75 }
76 
77 }//end namespace cx
cx::HelpSearchWidget::HelpSearchWidget
HelpSearchWidget(HelpEnginePtr engine, QWidget *parent=NULL)
Definition: cxHelpSearchWidget.cpp:26
cx::HelpSearchWidget::indexingFinished
void indexingFinished()
Definition: cxHelpSearchWidget.cpp:63
cx::HelpEnginePtr
boost::shared_ptr< HelpEngine > HelpEnginePtr
Definition: cxHelpEngine.h:61
cx::HelpSearchWidget::searchingIsFinished
void searchingIsFinished(int val)
Definition: cxHelpSearchWidget.cpp:72
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxHelpEngine.h
cx::HelpSearchWidget::searchingIsStarted
void searchingIsStarted()
Definition: cxHelpSearchWidget.cpp:68
cxHelpSearchWidget.h
cxTypeConversions.h
cx::HelpSearchWidget::indexingStarted
void indexingStarted()
Definition: cxHelpSearchWidget.cpp:58
cx::HelpSearchWidget::requestShowLink
void requestShowLink(const QUrl &)
cx::HelpSearchWidget::search
void search()
Definition: cxHelpSearchWidget.cpp:52