summaryrefslogtreecommitdiffstats
path: root/smdirwatcher.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Switch to QRunnable + QThreadPoolArno2013-09-031-137/+118
| | | | | | | | | | | Get rid of SmDataCollector and do its job in small, QRunnable tasks and let QThreadPool manage the treads. Works well with a local Filesystem. Yet to see how it works over networked Filesystems. Ah, before I forget: NEVER, EVER USE QPixmap in THREADS -> Random crashes! (Yes, I know, it's documented...)
* Revert "Don't show progress dialog when we're polling"Arno2013-08-301-7/+3
| | | | | This reverts commit 2cc92200386c55818cbe9bcb7d2e488170317d70. Wrong, non-working solution for this problem.
* Don't show progress dialog when we're pollingArno2013-08-281-3/+7
|
* Add a progress dialog to FilesystemWidget1.2.0Arno2013-08-281-0/+2
| | | | Show a progress dialog when gathering data from the filesystem.
* Fix crashes in SmDirWatcher (again)Arno2013-08-281-5/+11
| | | | | | | | | | | | | | | This reverts commit dbfc4f7bf395bf20aa21058372d47d17d040f553. It was totally and utterly wrong. This is what really happened, hopefully: Since a Semaphore can guard more than a single resource, it could happen that both mSemUsed and mSemFree were available at the same time. So it could happen that both the watcher and the datacollector tried to access the dataqueue at the same time. Since ->dequeue() is not atomic, this could throw of the internal iterator from the QList, resulting in a crash. The solution is simple: Guard it with a shared Mutex.
* Don't enqueue equal events twiceArno2013-08-271-1/+3
| | | | | | | | | Fix a race condition. This is what happened: A file gets closes shortly after the last write, so it gets enqueued twice. Since QQueue is a decendant of QList, calling erase on the iterator makes the loop crash with SIGSEGV. So check if the file is already in the queue before enqueuing.
* Give Pictures some love!Arno2013-08-221-2/+1
| | | | | | * Show and archive size of pictures * Fix SqlQueries in PicFilesModel: removeFiles and changeMappings * use delegate in PictureView
* Bugfix SmDirWatcherArno2013-08-101-5/+7
| | | | | Don't enqueue anything if the INOTIFY_MASK doesn't match. Could be the reason for random crashes...
* Revert "Prevent datacollector from running when operating on files"Arno2013-07-291-1/+0
| | | | | | | This reverts commit 06cfadc8386aec27b9c7c43486fc0b057e9fb022. Turns out that this was not the root cause for the crashes. Still stumped.
* Prevent datacollector from running when operating on filesArno2013-07-291-0/+1
| | | | | | | This stuff was racy from the beginning. It could happen that the model got reset after we fetched the selected indexes. Add a mutex and lock it before operating on the file view. Hopefully this will many, if not all random crashes.
* Cleanup closeEventArno2013-07-271-1/+17
| | | | | | | | | | Don't try to delete all the prepared statements manually. Get rid of the ~destructors and just close the QSqlDatabase. close() deletes all Statements. Also, quit() all QThreads on closeEvent() except CompleterProducer. When the experimental archive view gets merged, that QThread is gone. No need to bother...
* Read JSON from ffprobeArno2013-07-271-1/+3
| | | | | | | | | | | | | | | | Use JSON output from ffprobe instead of string parsing to get some kind of type safety. For doing that, some changes were needed in FileView: Use delegates for displaying Duration and Bitrate instead of mangling output in Qt::Displayrole. To reuse code, move all delegates from the new Archive to a separate file. And, of course, the initial objective: Show the accumulated size and duration of selected files in the status bar from the experimental archive.
* Fix crashes in SmDirWatcherArno2013-07-081-1/+2
| | | | | | | Finally! Return a copy of the file tree instead of the working item! Hopefully this fixes a lot of crashes. Threading is a bitch...
* Don't clean up after ourselvesArno2013-06-011-9/+0
| | | | | Don't delete threads and stuff in destructors. It leads to SIGARBRT when debugging. Now we get a warning on close, but who cares?
* SmDirModel: check if file already is in databaseArno2013-04-061-2/+37
| | | | | Indicate if we already have a file by coloring the filename darkGreen when browsing the filesystem.
* Put duration and size in one Field (SmDirModel)Arno2013-04-061-5/+3
| | | | | Consolidate duration and size in one Field, like in the archive, to be consistent. Also rename the Role and Field accordingly.
* Show pic size in SmDirModelArno2013-04-061-2/+8
| | | | | | If file is an image, grab the size and add it to the model. Also, remove some leftover debug statements from SmTreeView.
* Implement auto refreshArno2013-03-211-0/+2
| | | | | Since inotify isn't completely implemented for cifs mounts, implement auto refresh for FileView. Default is 5 seconds.
* Final inotify!Arno2013-03-211-51/+56
| | | | | | | | | | | | | | | | | | | | A huge commit, I know, but it was definitely worth it! It makes the homebrew FilesystemModel work! It's divided up into two threads: 1. The Watcher: it reacts on inotify events and dispatches them to: 2. The Collector: this thread gathers the data and emits the SIGNALS to the the view. Now we can actually refresh the View, not possible with QFileSystemModel, and the data reloads in almost real time without blocking the GUI. Unfortunately this uncovered some bugs I had to fix: 1. Helper::md5sum: Don't crash if read fails with -1 2. SmTreeModel::addRow is broken. Even after 5h I couldn't figure out how or why, so I brute forced it. Reset the moded when a file is added. 3. Get rid of a lot of unneeded #include's I guess that's about it...
* Use a Thread for collecting file dataArno2013-03-201-19/+77
| | | | | | blocking the GUI isn't nice, so use a separate Thread to gather all the data for SmDirModel. Populating and changing directory works, but modifying a file is most likely broken.
* Make SmDirModel/SmDirWatcher do somethingArno2013-03-171-9/+10
| | | | I think I got it working! It does what I want it to do :)
* First shot at SmDirModelArno2013-03-161-0/+84
Gotta take a break here. Hopefully this will end up in a custom QFilesystemModel, but I'm hitting so many bugs on the way. Some things haven't worked for ages, I guess. Anyway, the watcher doesn't do anythying right now, still fixing bugs...