Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Watched files are now added recursively |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7474221afe0ed3dfc65f6d0f43aea259 |
User & Date: | Follpvosten 2017-03-31 12:43:11.397 |
Context
2017-04-01
| ||
10:02 | Moved tray icon code into Notizen class check-in: 14732b46cc user: Follpvosten tags: trunk | |
2017-03-31
| ||
12:43 | Watched files are now added recursively check-in: 7474221afe user: Follpvosten tags: trunk | |
10:47 | Initial code commit check-in: 45f0d315d4 user: jonas tags: trunk | |
Changes
Changes to Notizen/notizen.cpp.
1 2 3 4 5 6 7 8 9 10 11 | #include <QString> #include <QFileSystemWatcher> #include <QDebug> #include <QDir> #include "notizen.h" Notizen::Notizen(const QString &mainPath, QObject *parent) : QObject(parent) { mFileWatcher = new QFileSystemWatcher(this); connect(mFileWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(directoryChanged(QString))); connect(mFileWatcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChanged(QString))); | > < < < < | < > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #include <QString> #include <QFileSystemWatcher> #include <QDebug> #include <QDir> #include <QFileInfo> #include "notizen.h" Notizen::Notizen(const QString &mainPath, QObject *parent) : QObject(parent) { mFileWatcher = new QFileSystemWatcher(this); connect(mFileWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(directoryChanged(QString))); connect(mFileWatcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChanged(QString))); mFileWatcher->addPath(mainPath); qDebug() << mainPath; addDirsRecursively(mainPath); } void Notizen::directoryChanged(const QString &path) { qDebug() << "Directory changed: " << path << endl; } void Notizen::fileChanged(const QString &path) { qDebug() << "File changed: " << path << endl; if(!mFileWatcher->files().contains(path)) mFileWatcher->addPath(path); } void Notizen::addDirsRecursively(const QString &path) { QDir dir(path); Q_FOREACH(QFileInfo file, dir.entryInfoList()) { if(file.fileName().compare("..") != 0 && file.fileName().compare(".") != 0) { mFileWatcher->addPath(file.filePath()); qDebug() << file.filePath(); if(file.isDir()) { addDirsRecursively(file.filePath()); } } } } |
Changes to Notizen/notizen.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #ifndef NOTIZEN_H #define NOTIZEN_H #include <QObject> #include <QFileSystemWatcher> class Notizen : public QObject { Q_OBJECT public: explicit Notizen(const QString &mainPath, QObject *parent = 0); signals: public slots: void directoryChanged(const QString &path); void fileChanged(const QString &path); private: QFileSystemWatcher *mFileWatcher; }; #endif // NOTIZEN_H | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #ifndef NOTIZEN_H #define NOTIZEN_H #include <QObject> #include <QFileSystemWatcher> #include <QString> class Notizen : public QObject { Q_OBJECT public: explicit Notizen(const QString &mainPath, QObject *parent = 0); signals: public slots: void directoryChanged(const QString &path); void fileChanged(const QString &path); private: void addDirsRecursively(const QString &path); QFileSystemWatcher *mFileWatcher; }; #endif // NOTIZEN_H |