refactor: remove IAppUtil. AppUtil is the base class now

This commit is contained in:
sithlord48 2025-08-17 11:41:08 -04:00 committed by Nick Bolton
parent 347cb46f15
commit c3f2c04a28
3 changed files with 15 additions and 32 deletions

View file

@ -1,5 +1,6 @@
/* /*
* Deskflow -- mouse and keyboard sharing utility * Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2025 Deskflow Developers
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd. * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
@ -8,16 +9,19 @@
#pragma once #pragma once
#include "deskflow/DeskflowException.h" #include "deskflow/DeskflowException.h"
#include "deskflow/IAppUtil.h" #include "deskflow/IApp.h"
class AppUtil : public IAppUtil #include <string>
#include <vector>
class AppUtil
{ {
public: public:
AppUtil(); AppUtil();
~AppUtil() override = default; virtual ~AppUtil() = default;
void adoptApp(IApp *app) override; void adoptApp(IApp *app);
IApp &app() const override; IApp &app() const;
virtual void exitApp(int code) virtual void exitApp(int code)
{ {
throw ExitAppException(code); throw ExitAppException(code);
@ -29,6 +33,12 @@ public:
instance().exitApp(code); instance().exitApp(code);
} }
// Virtual Methods subclasses can impliment
virtual int run(int argc, char **argv) = 0;
virtual void startNode() = 0;
virtual std::vector<std::string> getKeyboardLayoutList() = 0;
virtual std::string getCurrentLanguageCode() = 0;
private: private:
IApp *m_app = nullptr; IApp *m_app = nullptr;
static AppUtil *s_instance; static AppUtil *s_instance;

View file

@ -89,7 +89,6 @@ add_library(${lib_name} STATIC ${PLATFORM_CODE}
DeskflowException.h DeskflowException.h
DisplayInvalidException.h DisplayInvalidException.h
IApp.h IApp.h
IAppUtil.h
IClient.h IClient.h
IClipboard.cpp IClipboard.cpp
IClipboard.h IClipboard.h

View file

@ -1,26 +0,0 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2025 Deskflow Developers
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
#pragma once
#include "deskflow/IApp.h"
#include <string>
#include <vector>
class IAppUtil
{
public:
virtual ~IAppUtil() = default;
virtual void adoptApp(IApp *app) = 0;
virtual IApp &app() const = 0;
virtual int run(int argc, char **argv) = 0;
virtual void startNode() = 0;
virtual std::vector<std::string> getKeyboardLayoutList() = 0;
virtual std::string getCurrentLanguageCode() = 0;
};