#include "FileController.hpp" #include #include #include #include #include FileController::FileController( ) { #ifdef _WIN32 m_fmWorker = std::make_shared( std::filesystem::path(std::getenv("USERPROFILE")), std::chrono::milliseconds(1000)); #else m_fmWorker = std::make_shared( std::filesystem::path("/home/crylia/Dokumente"), std::chrono::milliseconds(1000)); #endif m_fmWorker->moveToThread(&m_fsThread); connect(this, &FileController::operate, m_fmWorker.get( ), &FileMonitor::start); connect(m_fmWorker.get( ), &FileMonitor::fileHappened, this, &FileController::update); connect(m_fmWorker.get( ), &FileMonitor::pathChanged, this, &FileController::newPath); connect(this, &FileController::updatePath, m_fmWorker.get( ), &FileMonitor::SetPath); m_fsThread.start( ); emit operate( ); } FileController::~FileController( ) { m_fsThread.quit( ); m_fsThread.wait( ); } void FileController::newPath( std::unordered_map path) { std::cout << "bruh" << std::endl; emit pathChanged(path); } void FileController::update(const std::filesystem::path path, const FileEvent event) { emit contentChanged(path, event); }