Skip to content

Commit 335cf4f

Browse files
authored
Merge pull request #38771 from mantidproject/37248-PHW-cppcheck-suppressions-ornl-next
Road to removing qtassistant (documentation) --> Cppcheck suppressions removal for HelpWindow - ornl-next
2 parents edaf021 + 2a806f0 commit 335cf4f

File tree

3 files changed

+18
-26
lines changed

3 files changed

+18
-26
lines changed

buildconfig/CMake/CppCheck_Suppressions.txt.in

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,18 +1245,6 @@ constVariableReference:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/ImageInfoModelM
12451245
passedByValue:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/ImageInfoPresenter.cpp:33
12461246
constVariableReference:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/InstrumentSelector.cpp:38
12471247
constVariableReference:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/ListPropertyWidget.cpp:46
1248-
constParameterReference:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:301
1249-
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:318
1250-
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:320
1251-
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:329
1252-
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:331
1253-
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:342
1254-
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:343
1255-
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:344
1256-
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:354
1257-
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:355
1258-
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:356
1259-
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:357
12601248
iterateByValue:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidTreeModel.cpp:35
12611249
useStlAlgorithm:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidTreeModel.cpp:36
12621250
iterateByValue:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidTreeWidget.cpp:171

qt/widgets/common/inc/MantidQtWidgets/Common/MantidHelpWindow.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class EXPORT_OPT_MANTIDQT_COMMON MantidHelpWindow : public API::MantidHelpInterf
2525
Q_OBJECT
2626

2727
public:
28-
static bool helpWindowExists() { return !g_helpWindow.isNull(); }
28+
static bool helpWindowExists();
2929

3030
MantidHelpWindow(const Qt::WindowFlags &flags = Qt::WindowFlags());
3131

@@ -55,7 +55,7 @@ class EXPORT_OPT_MANTIDQT_COMMON MantidHelpWindow : public API::MantidHelpInterf
5555
/// Whether this is the very first startup of the helpwindow.
5656
bool m_firstRun;
5757

58-
void findCollectionFile(std::string &binDir);
58+
void findCollectionFile(const std::string &binDir);
5959
void determineFileLocs();
6060

6161
public slots:

qt/widgets/common/src/MantidHelpWindow.cpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ namespace MantidQt::MantidWidgets {
3636
using std::string;
3737
using namespace MantidQt::API;
3838

39+
#ifdef DOCS_QTHELP
3940
REGISTER_HELPWINDOW(MantidHelpWindow)
41+
#endif
4042

4143
namespace {
4244
/// static logger
@@ -63,6 +65,8 @@ const QString HTML_BASE_PATH("/");
6365
/// Page to display if nothing provided
6466
const QString DEFAULT_PAGENAME("index");
6567

68+
bool MantidHelpWindow::helpWindowExists() { return !g_helpWindow.isNull(); }
69+
6670
/**
6771
* Default constructor shows the base index page.
6872
*/
@@ -298,7 +302,7 @@ void MantidHelpWindow::shutdown() {
298302
*
299303
* @param binDir The location of the mantid executable.
300304
*/
301-
void MantidHelpWindow::findCollectionFile(std::string &binDir) {
305+
void MantidHelpWindow::findCollectionFile(const std::string &binDir) {
302306
// this being empty notes the feature being disabled
303307
m_collectionFile = "";
304308

@@ -315,9 +319,9 @@ void MantidHelpWindow::findCollectionFile(std::string &binDir) {
315319
}
316320

317321
// try where the builds will put it for a single configuration build
318-
searchDir.cdUp();
322+
UNUSED_ARG(searchDir.cdUp());
319323
if (searchDir.cd("docs")) {
320-
searchDir.cd("qthelp");
324+
UNUSED_ARG(searchDir.cd("qthelp"));
321325
path = searchDir.absoluteFilePath(COLLECTION_FILE);
322326
g_log.debug() << "Trying \"" << path.toStdString() << "\"\n";
323327
if (searchDir.exists(COLLECTION_FILE)) {
@@ -326,9 +330,9 @@ void MantidHelpWindow::findCollectionFile(std::string &binDir) {
326330
}
327331
}
328332
// try where the builds will put it for a multi-configuration build
329-
searchDir.cdUp();
333+
UNUSED_ARG(searchDir.cdUp());
330334
if (searchDir.cd("docs")) {
331-
searchDir.cd("qthelp");
335+
UNUSED_ARG(searchDir.cd("qthelp"));
332336
path = searchDir.absoluteFilePath(COLLECTION_FILE);
333337
g_log.debug() << "Trying \"" << path.toStdString() << "\"\n";
334338
if (searchDir.exists(COLLECTION_FILE)) {
@@ -339,9 +343,9 @@ void MantidHelpWindow::findCollectionFile(std::string &binDir) {
339343

340344
// try in windows/linux install location
341345
searchDir = QDir(QString::fromStdString(binDir));
342-
searchDir.cdUp();
343-
searchDir.cd("share");
344-
searchDir.cd("doc");
346+
UNUSED_ARG(searchDir.cdUp());
347+
UNUSED_ARG(searchDir.cd("share"));
348+
UNUSED_ARG(searchDir.cd("doc"));
345349
path = searchDir.absoluteFilePath(COLLECTION_FILE);
346350
g_log.debug() << "Trying \"" << path.toStdString() << "\"\n";
347351
if (searchDir.exists(COLLECTION_FILE)) {
@@ -351,10 +355,10 @@ void MantidHelpWindow::findCollectionFile(std::string &binDir) {
351355

352356
// try a special place for mac/osx
353357
searchDir = QDir(QString::fromStdString(binDir));
354-
searchDir.cdUp();
355-
searchDir.cdUp();
356-
searchDir.cd("share");
357-
searchDir.cd("doc");
358+
UNUSED_ARG(searchDir.cdUp());
359+
UNUSED_ARG(searchDir.cdUp());
360+
UNUSED_ARG(searchDir.cd("share"));
361+
UNUSED_ARG(searchDir.cd("doc"));
358362
path = searchDir.absoluteFilePath(COLLECTION_FILE);
359363
g_log.debug() << "Trying \"" << path.toStdString() << "\"\n";
360364
if (searchDir.exists(COLLECTION_FILE)) {

0 commit comments

Comments
 (0)