aissia/src/shared/platform/WindowTrackerFactory.cpp
StillHammer bc3b6cbaba feat: Implement Phase 1 complete - All 6 core modules
## New Modules
- StorageModule: SQLite persistence for sessions, app usage, conversations
- MonitoringModule: Cross-platform window tracking (Win32/X11)
- AIModule: Multi-provider LLM integration with agentic tool loop
- VoiceModule: TTS/STT coordination with speak queue

## Shared Libraries
- AissiaLLM: ILLMProvider abstraction (Claude + OpenAI providers)
- AissiaPlatform: IWindowTracker abstraction (Win32 + X11)
- AissiaAudio: ITTSEngine (SAPI/espeak) + ISTTEngine (Whisper API)
- HttpClient: Header-only HTTP client with OpenSSL

## Configuration
- Added JSON configs for all modules (storage, monitoring, ai, voice)
- Multi-provider LLM config with Claude and OpenAI support

## Dependencies
- SQLite3, OpenSSL, cpp-httplib (FetchContent)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 00:42:18 +08:00

48 lines
1.4 KiB
C++

#include "IWindowTracker.hpp"
#include <spdlog/spdlog.h>
#ifdef _WIN32
#include "Win32WindowTracker.hpp"
#elif defined(__linux__)
#include "X11WindowTracker.hpp"
#endif
namespace aissia {
// Stub implementation for unsupported platforms
class StubWindowTracker : public IWindowTracker {
public:
std::string getCurrentAppName() override { return "unknown"; }
std::string getCurrentWindowTitle() override { return ""; }
bool isUserIdle(int thresholdSeconds) override { return false; }
int getIdleTimeSeconds() override { return 0; }
bool isAvailable() const override { return false; }
std::string getPlatformName() const override { return "stub"; }
};
std::unique_ptr<IWindowTracker> WindowTrackerFactory::create() {
auto logger = spdlog::get("WindowTracker");
if (!logger) {
logger = spdlog::stdout_color_mt("WindowTracker");
}
#ifdef _WIN32
auto tracker = std::make_unique<Win32WindowTracker>();
if (tracker->isAvailable()) {
logger->info("Using Win32 window tracker");
return tracker;
}
#elif defined(__linux__)
auto tracker = std::make_unique<X11WindowTracker>();
if (tracker->isAvailable()) {
logger->info("Using X11 window tracker");
return tracker;
}
#endif
logger->warn("No window tracker available, using stub");
return std::make_unique<StubWindowTracker>();
}
} // namespace aissia