Skip to content

Commit

Permalink
Merge pull request #38771 from mantidproject/37248-PHW-cppcheck-suppr…
Browse files Browse the repository at this point in the history
…essions-ornl-next

Road to removing qtassistant (documentation) --> Cppcheck suppressions removal for HelpWindow - ornl-next
  • Loading branch information
darshdinger authored Jan 31, 2025
2 parents edaf021 + 2a806f0 commit 335cf4f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
12 changes: 0 additions & 12 deletions buildconfig/CMake/CppCheck_Suppressions.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -1245,18 +1245,6 @@ constVariableReference:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/ImageInfoModelM
passedByValue:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/ImageInfoPresenter.cpp:33
constVariableReference:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/InstrumentSelector.cpp:38
constVariableReference:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/ListPropertyWidget.cpp:46
constParameterReference:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:301
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:318
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:320
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:329
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:331
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:342
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:343
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:344
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:354
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:355
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:356
ignoredReturnErrorCode:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidHelpWindow.cpp:357
iterateByValue:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidTreeModel.cpp:35
useStlAlgorithm:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidTreeModel.cpp:36
iterateByValue:${CMAKE_SOURCE_DIR}/qt/widgets/common/src/MantidTreeWidget.cpp:171
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class EXPORT_OPT_MANTIDQT_COMMON MantidHelpWindow : public API::MantidHelpInterf
Q_OBJECT

public:
static bool helpWindowExists() { return !g_helpWindow.isNull(); }
static bool helpWindowExists();

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

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

void findCollectionFile(std::string &binDir);
void findCollectionFile(const std::string &binDir);
void determineFileLocs();

public slots:
Expand Down
28 changes: 16 additions & 12 deletions qt/widgets/common/src/MantidHelpWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ namespace MantidQt::MantidWidgets {
using std::string;
using namespace MantidQt::API;

#ifdef DOCS_QTHELP
REGISTER_HELPWINDOW(MantidHelpWindow)
#endif

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

bool MantidHelpWindow::helpWindowExists() { return !g_helpWindow.isNull(); }

/**
* Default constructor shows the base index page.
*/
Expand Down Expand Up @@ -298,7 +302,7 @@ void MantidHelpWindow::shutdown() {
*
* @param binDir The location of the mantid executable.
*/
void MantidHelpWindow::findCollectionFile(std::string &binDir) {
void MantidHelpWindow::findCollectionFile(const std::string &binDir) {
// this being empty notes the feature being disabled
m_collectionFile = "";

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

// try where the builds will put it for a single configuration build
searchDir.cdUp();
UNUSED_ARG(searchDir.cdUp());
if (searchDir.cd("docs")) {
searchDir.cd("qthelp");
UNUSED_ARG(searchDir.cd("qthelp"));
path = searchDir.absoluteFilePath(COLLECTION_FILE);
g_log.debug() << "Trying \"" << path.toStdString() << "\"\n";
if (searchDir.exists(COLLECTION_FILE)) {
Expand All @@ -326,9 +330,9 @@ void MantidHelpWindow::findCollectionFile(std::string &binDir) {
}
}
// try where the builds will put it for a multi-configuration build
searchDir.cdUp();
UNUSED_ARG(searchDir.cdUp());
if (searchDir.cd("docs")) {
searchDir.cd("qthelp");
UNUSED_ARG(searchDir.cd("qthelp"));
path = searchDir.absoluteFilePath(COLLECTION_FILE);
g_log.debug() << "Trying \"" << path.toStdString() << "\"\n";
if (searchDir.exists(COLLECTION_FILE)) {
Expand All @@ -339,9 +343,9 @@ void MantidHelpWindow::findCollectionFile(std::string &binDir) {

// try in windows/linux install location
searchDir = QDir(QString::fromStdString(binDir));
searchDir.cdUp();
searchDir.cd("share");
searchDir.cd("doc");
UNUSED_ARG(searchDir.cdUp());
UNUSED_ARG(searchDir.cd("share"));
UNUSED_ARG(searchDir.cd("doc"));
path = searchDir.absoluteFilePath(COLLECTION_FILE);
g_log.debug() << "Trying \"" << path.toStdString() << "\"\n";
if (searchDir.exists(COLLECTION_FILE)) {
Expand All @@ -351,10 +355,10 @@ void MantidHelpWindow::findCollectionFile(std::string &binDir) {

// try a special place for mac/osx
searchDir = QDir(QString::fromStdString(binDir));
searchDir.cdUp();
searchDir.cdUp();
searchDir.cd("share");
searchDir.cd("doc");
UNUSED_ARG(searchDir.cdUp());
UNUSED_ARG(searchDir.cdUp());
UNUSED_ARG(searchDir.cd("share"));
UNUSED_ARG(searchDir.cd("doc"));
path = searchDir.absoluteFilePath(COLLECTION_FILE);
g_log.debug() << "Trying \"" << path.toStdString() << "\"\n";
if (searchDir.exists(COLLECTION_FILE)) {
Expand Down

0 comments on commit 335cf4f

Please sign in to comment.