mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2026-04-10 06:11:54 +10:00
core/desktopentry: watch for changes and rescan entries
This commit is contained in:
parent
49646e4407
commit
59f5744f30
6 changed files with 521 additions and 153 deletions
32
src/core/desktopentrymonitor.hpp
Normal file
32
src/core/desktopentrymonitor.hpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include <qfilesystemwatcher.h>
|
||||
#include <qobject.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qtimer.h>
|
||||
|
||||
class DesktopEntryMonitor: public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DesktopEntryMonitor(QObject* parent = nullptr);
|
||||
~DesktopEntryMonitor() override = default;
|
||||
DesktopEntryMonitor(const DesktopEntryMonitor&) = delete;
|
||||
DesktopEntryMonitor& operator=(const DesktopEntryMonitor&) = delete;
|
||||
DesktopEntryMonitor(DesktopEntryMonitor&&) = delete;
|
||||
DesktopEntryMonitor& operator=(DesktopEntryMonitor&&) = delete;
|
||||
|
||||
signals:
|
||||
void desktopEntriesChanged();
|
||||
|
||||
private slots:
|
||||
void onDirectoryChanged(const QString& path);
|
||||
void processChanges();
|
||||
|
||||
private:
|
||||
void startMonitoring();
|
||||
void scanAndWatch(const QString& dirPath);
|
||||
|
||||
QFileSystemWatcher watcher;
|
||||
QTimer debounceTimer;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue