Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split AddonFactory into a separate file #126

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set(RIME_SOURCES
rimecandidate.cpp
rimesession.cpp
rimeaction.cpp
rimefactory.cpp
)

set(RIME_LINK_LIBRARIES
Expand Down
2 changes: 0 additions & 2 deletions src/rimeengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,5 +793,3 @@ PropertyPropagatePolicy RimeEngine::getSharedStatePolicy() {
}

} // namespace fcitx

FCITX_ADDON_FACTORY(fcitx::RimeEngineFactory)
9 changes: 0 additions & 9 deletions src/rimeengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <fcitx-utils/standardpath.h>
#include <fcitx-utils/stringutils.h>
#include <fcitx/action.h>
#include <fcitx/addonfactory.h>
#include <fcitx/addoninstance.h>
#include <fcitx/addonmanager.h>
#include <fcitx/event.h>
Expand Down Expand Up @@ -234,14 +233,6 @@ class RimeEngine final : public InputMethodEngineV2 {
std::thread::id mainThreadId_ = std::this_thread::get_id();
RimeState *currentKeyEventState_ = nullptr;
};

class RimeEngineFactory : public AddonFactory {
public:
AddonInstance *create(AddonManager *manager) override {
registerDomain("fcitx5-rime", FCITX_INSTALL_LOCALEDIR);
return new RimeEngine(manager->instance());
}
};
} // namespace fcitx

FCITX_DECLARE_LOG_CATEGORY(rime);
Expand Down
20 changes: 20 additions & 0 deletions src/rimefactory.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* SPDX-FileCopyrightText: 2024-2024 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/

#include "rimefactory.h"
#include "rimeengine.h"
#include <fcitx-utils/i18n.h>

namespace fcitx {

AddonInstance *RimeEngineFactory::create(AddonManager *manager) {
registerDomain("fcitx5-rime", FCITX_INSTALL_LOCALEDIR);
return new RimeEngine(manager->instance());
}

} // namespace fcitx

FCITX_ADDON_FACTORY(fcitx::RimeEngineFactory)
20 changes: 20 additions & 0 deletions src/rimefactory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* SPDX-FileCopyrightText: 2024-2024 CSSlayer <wengxt@gmail.com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef _FCITX_RIMEFACTORY_H_
#define _FCITX_RIMEFACTORY_H_

#include <fcitx/addonfactory.h>

namespace fcitx {

class RimeEngineFactory : public AddonFactory {
public:
AddonInstance *create(AddonManager *manager) override;
};

} // namespace fcitx

#endif
Loading