refactor: appconfig is no longer a iAppConfig subclass

This commit is contained in:
sithlord48
2025-03-11 18:49:41 -04:00
committed by Nick Bolton
parent 362b2e1477
commit 5a7284fd6a
6 changed files with 6 additions and 60 deletions

View File

@ -20,6 +20,7 @@
#include "gui/config/ConfigScopes.h"
#include "gui/constants.h"
#include "gui/core/CoreProcess.h"
#include "gui/core/CoreTool.h"
#include "gui/diagnostic.h"
#include "gui/ipc/DaemonIpcClient.h"
#include "gui/messages.h"

View File

@ -36,7 +36,6 @@ add_library(${target} STATIC
config/AppConfig.h
config/ConfigScopes.cpp
config/ConfigScopes.h
config/IAppConfig.h
config/IConfigScopes.h
config/IServerConfig.h
config/Screen.cpp

View File

@ -12,13 +12,6 @@
#include "ConfigScopes.h"
#include <QApplication>
#include <QMessageBox>
#include <QPushButton>
#include <QVariant>
#include <functional>
using namespace deskflow::gui;
AppConfig::AppConfig(deskflow::gui::IConfigScopes &scopes, std::shared_ptr<Deps> deps) : m_Scopes(scopes), m_pDeps(deps)

View File

@ -8,18 +8,9 @@
#pragma once
#include "IAppConfig.h"
#include "IConfigScopes.h"
#include "common/constants.h"
#include "gui/paths.h"
#include <QDir>
#include <QObject>
#include <QPoint>
#include <QSize>
#include <QString>
#include <QVariant>
#include <optional>
/**
* @brief Simply reads and writes app settings.
@ -29,7 +20,7 @@
* instance is widely accessible, but that has previously led to this class
* becoming a god object.
*/
class AppConfig : public QObject, public deskflow::gui::IAppConfig
class AppConfig : public QObject
{
Q_OBJECT
using IConfigScopes = deskflow::gui::IConfigScopes;
@ -44,16 +35,16 @@ public:
void determineScope();
IConfigScopes &scopes() const override;
bool isActiveScopeWritable() const override;
bool isActiveScopeSystem() const override;
IConfigScopes &scopes() const;
bool isActiveScopeWritable() const;
bool isActiveScopeSystem() const;
/// @brief Sets the user preference to load from SystemScope.
/// @param [in] value
/// True - This will set the variable and load the global scope
/// settings. False - This will set the variable and load the user
/// scope settings.
void setLoadFromSystemScope(bool value) override;
void setLoadFromSystemScope(bool value);
private:
/// @brief This method loads config from specified scope

View File

@ -1,37 +0,0 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2024 Symless Ltd.
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
#pragma once
#include "gui/config/IConfigScopes.h"
#include <QString>
namespace deskflow::gui {
class IAppConfig
{
using IConfigScopes = deskflow::gui::IConfigScopes;
public:
virtual ~IAppConfig() = default;
//
// Getters
//
virtual IConfigScopes &scopes() const = 0;
virtual bool isActiveScopeSystem() const = 0;
virtual bool isActiveScopeWritable() const = 0;
//
// Setters
//
virtual void setLoadFromSystemScope(bool loadFromSystemScope) = 0;
};
} // namespace deskflow::gui

View File

@ -5,7 +5,6 @@
*/
#include "common/Settings.h"
#include "gui/config/IAppConfig.h"
#include "gui/core/CoreProcess.h"
#include "gui/proxy/QProcessProxy.h"
#include "shared/gui/mocks/ServerConfigMock.h"