Skip to content

Commit

Permalink
feat: temporarily disable compatibility mode
Browse files Browse the repository at this point in the history
- Add DISABLE_COMPATIBLE macro to disable compatibility mode features
- Mark CompatibleBackend class with deprecation warning
- Simplify compatibility check functions to return false when disabled
- Retain original code for potential future re-enablement

Note: Changes are temporary, module may be re-enabled in future releases.

Log: Temporarily disable compatibility mode.
  • Loading branch information
rb-union committed Nov 11, 2024
1 parent 16c5962 commit 2e37132
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/deb-installer/compatible/compatible_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ CompatibleBackend *CompatibleBackend::instance()
return &ins;
}

#ifndef DISABLE_COMPATIBLE
bool CompatibleBackend::compatibleValid() const
{
return m_init && !m_rootfsList.isEmpty();
Expand All @@ -54,6 +55,7 @@ bool CompatibleBackend::recheckCompatibleExists()

return m_compatibleExists;
}
#endif

QList<RootfsInfo::Ptr> CompatibleBackend::rootfsList() const
{
Expand Down Expand Up @@ -164,6 +166,10 @@ QHash<QString, CompPkgInfo::Ptr> CompatibleBackend::parseAppListFromRawOutput(co

void CompatibleBackend::initBackend(bool async)
{
if (!compatibleExists()) {

Check warning on line 169 in src/deb-installer/compatible/compatible_backend.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Condition '!compatibleExists()' is always true

Check warning on line 169 in src/deb-installer/compatible/compatible_backend.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Condition '!compatibleExists()' is always true
return;
}

static std::once_flag kCompInitFlag;
std::call_once(kCompInitFlag, [this, async]() {
if (async) {
Expand Down
19 changes: 18 additions & 1 deletion src/deb-installer/compatible/compatible_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,37 @@ class QProcess;

namespace Compatible {

/*
Warning: Compatibility mode is temporary deprecated, this class is invalid forever. see macro DISABLE_COMPATIBLE.
However, there is still a high probability that this module will be enabled later, so the code is retained.
To restore it, remove the DISABLE_COMPATIBLE macro.
*/
#define DISABLE_COMPATIBLE

// Backend for comaptible mode package manage.
#ifdef DISABLE_COMPATIBLE
class QT_DEPRECATED_X("Temporary disable compatibility mode!") CompatibleBackend : public QObject
#else
class CompatibleBackend : public QObject
#endif
{
Q_OBJECT

public:
static CompatibleBackend *instance();

void initBackend(bool async = true);
[[nodiscard]] bool compatibleValid() const;
Q_SIGNAL void compatibleInitFinished();

#ifdef DISABLE_COMPATIBLE
[[nodiscard]] bool compatibleValid() const { return false; }
[[nodiscard]] bool compatibleExists() const { return false; }
bool recheckCompatibleExists() { return false; }
#else
[[nodiscard]] bool compatibleValid() const;
[[nodiscard]] bool compatibleExists() const;
bool recheckCompatibleExists();
#endif

[[nodiscard]] QList<RootfsInfo::Ptr> rootfsList() const;

Check warning on line 48 in src/deb-installer/compatible/compatible_backend.h

View workflow job for this annotation

GitHub Actions / cppcheck

Local variable 'rootfsList' shadows outer function

Check warning on line 48 in src/deb-installer/compatible/compatible_backend.h

View workflow job for this annotation

GitHub Actions / cppcheck

Local variable 'rootfsList' shadows outer function

Check warning on line 48 in src/deb-installer/compatible/compatible_backend.h

View workflow job for this annotation

GitHub Actions / static-check / static-check

Local variable 'rootfsList' shadows outer function

Check warning on line 48 in src/deb-installer/compatible/compatible_backend.h

View workflow job for this annotation

GitHub Actions / static-check / static-check

Local variable 'rootfsList' shadows outer function
[[nodiscard]] QString osName(const QString &rootfsName) const;
Expand Down

0 comments on commit 2e37132

Please sign in to comment.