multiple things

This commit is contained in:
Crylia
2024-06-26 11:06:09 +02:00
parent df5e9bdfa9
commit 5c9a49e634
68 changed files with 77165 additions and 90 deletions

View File

@@ -5,45 +5,45 @@
#include <memory>
#include <unordered_map>
FileController::FileController() {
FileController::FileController( ) {
#ifdef _WIN32
m_fmWorker = std::make_shared<FileMonitor>(
std::filesystem::path(std::getenv("USERPROFILE")),
std::chrono::milliseconds(1000));
std::filesystem::path(std::getenv("USERPROFILE")),
std::chrono::milliseconds(1000));
#else
m_fmWorker = std::make_shared<FileMonitor>(
std::filesystem::path("/home/crylia/Dokumente"),
std::chrono::milliseconds(1000));
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::fileCreated, this,
&FileController::update);
connect(m_fmWorker.get(), &FileMonitor::pathChanged, this,
&FileController::newPath);
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();
m_fsThread.start( );
emit operate();
emit operate( );
}
FileController::~FileController() {
m_fsThread.quit();
m_fsThread.wait();
FileController::~FileController( ) {
m_fsThread.quit( );
m_fsThread.wait( );
}
void FileController::newPath(
std::unordered_map<std::filesystem::path, std::filesystem::file_time_type>
path) {
std::cout << "test" << std::endl;
std::unordered_map<std::filesystem::path, std::filesystem::file_time_type>
path) {
std::cout << "bruh" << std::endl;
emit pathChanged(path);
}
void FileController::update(const std::filesystem::path path,
const FileEvent event) {
std::cout << "bruh" << std::endl;
std::cout << path.string() << std::endl;
const FileEvent event) {
emit contentChanged(path, event);
}