1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-23 00:04:06 +00:00
transmission/qt/InteropHelper.cc
Charles Kerr 1cc9da26ba
fix: sonarcloud (#2865)
* refactor: implement FileTreeItem::children_ with a std::vector

* fix: std::move should not be called on forwarding reference

* fix: uninitialized scalar variable

* fix: unchecked return value from library

* fix: dereference before null check

* fix: unchecked return value from library

* fix: unchecked return value from library

* fixup! refactor: implement FileTreeItem::children_ with a std::vector

* fix: signed-unsigned comparison in libtransmission tests

* fix: avoid unnecessary copy by using const reference

* fix: function should be declared const

* refactor: use fmt::format to build log timestamps

* fix: use init-statement to reduce variable scope

* fixup! refactor: use fmt::format to build log timestamps

* fix: remove tau_tracker destructor for rule-of-zero

* fix: remove tr_peerIo destructor for rule-of-zero

* Revert "fix: dereference before null check"

This reverts commit cd78967815.

* fix: signed-unsigned comparison in libtransmission tests

* fix: use init-statement to reduce variable scope

* fix: extract nested code block into separate method

* fix: extract nested code block into separate method

* fix: extract nested code block into separate method

* fix: use init-statement to reduce variable scope

* fix: extract nested code block into separate method

* fix: signed-unsigned comparison in libtransmission tests

* fixup! fix: extract nested code block into separate method

* fix: mark possibly-unused as [[maybe_unused]]

* fix: invalid stack memory reference in tr_found_file_t

* fix: signed-unsigned comparison in libtransmission tests
2022-04-02 09:06:02 -05:00

68 lines
1.4 KiB
C++

// This file Copyright © 2015-2022 Mnemosyne LLC.
// It may be used under GPLv2 (SPDX: GPL-2.0-only), GPLv3 (SPDX: GPL-3.0-only),
// or any future license endorsed by Mnemosyne LLC.
// License text can be found in the licenses/ folder.
#include <QVariant>
#include "InteropHelper.h"
bool InteropHelper::isConnected() const
{
#if defined(ENABLE_DBUS_INTEROP) && defined(ENABLE_COM_INTEROP)
return dbus_client_.isConnected() || com_client_.isConnected();
#elif defined(ENABLE_DBUS_INTEROP)
return dbus_client_.isConnected();
#elif defined(ENABLE_COM_INTEROP)
return com_client_.isConnected();
#else
return false;
#endif
}
bool InteropHelper::addMetainfo(QString const& metainfo) const
{
#if defined(ENABLE_DBUS_INTEROP) && defined(ENABLE_COM_INTEROP)
return dbus_client_.addMetainfo(metainfo).toBool() || com_client_.addMetainfo(metainfo).toBool();
#elif defined(ENABLE_DBUS_INTEROP)
return dbus_client_.addMetainfo(metainfo).toBool();
#elif defined(ENABLE_COM_INTEROP)
return com_client_.addMetainfo(metainfo).toBool();
#else
return false;
#endif
}
void InteropHelper::initialize()
{
#ifdef ENABLE_COM_INTEROP
ComInteropHelper::initialize();
#endif
}
void InteropHelper::registerObject(QObject* parent)
{
#ifdef ENABLE_DBUS_INTEROP
DBusInteropHelper::registerObject(parent);
#endif
#ifdef ENABLE_COM_INTEROP
ComInteropHelper::registerObject(parent);
#endif
}