summaryrefslogtreecommitdiffstats
path: root/helper.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Catch Magick::ExceptionArno2024-08-311-4/+6
| | | | | | | | | | | | Prevent crash when trying to convert a file to png. This was a hard one. After checking into detached QT-Containers I finally realized that convertArchivefileToPng was the culprit, because ImageMagick::read exited with an "Unsupported marker type 0x09" execption. After some more investigation with convert, or magick convert these days, I found out that they could be ignored. Yes, it's a big hammer, but if it still fails after trying to convert, just return if still don't have a valid image.
* Fix crash when trying to read an invalid imageArno2024-06-171-3/+7
| | | | | | Helper::picSize assumed that all data passed to it is a valid image and thus crashed with an exception. Wrap it into try - catch and return QVariant() when the pic is invalid.
* Fix brainfart in durationFromSecsArno2023-03-041-2/+1
| | | | | Use QString::arg() instead of ::snprintf because of a comiler truncation warning.
* Fix deprecation warning about addData()Arno2023-03-041-2/+2
| | | | | QCryptgraphicHash::addData() now expects an QByteArrayView instead of an QByteArray, so please it...
* Make it run with Qt6Arno2022-04-151-13/+5
| | | | | | | | | This is a huge commit. Changes: * Obviously, make it compile * Make it run (only scarcely tested) * get rid of most of clang's warnings Let's see what surprises are in store...
* Fix previewArno2019-11-221-1/+1
| | | | | ffmpeg returns a float in duration. QVariant::toInt() can't parse it (any more?), so use toFloat() and static_cast it to int.
* Fix deprecation warningsArno2019-11-221-1/+1
|
* Use QMime* instead of libmagicArno2019-11-221-22/+5
| | | | | One more step to make it compile with Windows. And once again, it makes the code much neater and more readable.
* Improve MovieInfoPageArno2018-11-241-0/+3
| | | | | | Replace QPushButtons with a QToolbar and appropriate unicode symbols. While at at, return from Helper::fuzzyCheck when the search string is empty. Prevents false positives.
* Add icons to MappingTreeWidget actionsArno2018-11-241-1/+0
| | | | | While at it: They don't have to be members, so create them on the heap. Also fix a nullptr warning.
* Fix durationFromSecsArno2018-11-241-1/+1
| | | | | commit e5274f4c27f847bedaa910a84ed3468d1aba32e1 introduced a double colon and removed leading zeros. Make snprintf pretty again.
* Dark theme GUI changesArno2018-11-241-2/+3
| | | | | | | | Add icons better suited for dark themes and don't draw an ellipse around the letter when calling Helper::icon and use the theme's text color to better match the desktop theme. Just be a good tenant and respect the user's choices where applicable.
* Fix helper warningsArno2018-11-231-19/+24
| | | | | | Sprinkle some static_casts here and there and fix auto conversions. Also introduce const ints for what to read for calculating the MD5-Sum of a file... Seems to work fine.
* Move fuzzyCheck to Helper namespaceArno2018-11-031-0/+14
|
* Fix font usageArno2018-09-291-1/+1
| | | | Use Monospace only where applicable, mostly MD5Sum and numbers.
* Add a menu with global actions to SmGlobalsArno2018-04-031-3/+5
| | | | | | | Use it in the toolbar for FSWidge and hide the menuBar. Change Helper::icon to accept different foreground colors and wether to draw the ellipse.
* Add context menu to FSWidgetArno2018-03-311-0/+7
| | | | Also create a helper function to create separator actions.
* Make FSWidget prettierArno2018-03-311-0/+18
| | | | | | * add programmatically rendered icons * make text Qt::black * set rootIsDecorated to false
* Play movies from USB if availableArno2016-03-051-0/+15
| | | | | If USB-Storage is mounted and available, search it for already archived movies. If found, play it.
* Make convertArchivefileToPng a transactionArno2015-10-241-0/+6
| | | | | Delete the original file if we converted a pic to PNG, but only if the database transaction succeeded.
* Fix convert to PNG messArno2015-10-241-1/+1
| | | | | | | | | | Automatically converting a damaged file to PNG and updating the archive is fine as long as we're *in* the archive, but it totally messes things up if we're browsing the file system. So check if the image is in the archive path, and only then consider auto-converting it. Also show a notice in the InfoItem if the file has been converted.
* Change image size calculationArno2015-10-111-6/+4
| | | | | Use ImageMagick::Image::ping to determine the size of an image, but only if the file size is < 400kb to prevent the impression of a deadlock.
* Automatically convert invalid jpg picsArno2015-07-181-0/+51
| | | | | | | | Well, seems that's Qt's ImageReader got pickier regarding jpeg-files. If the resulting QPixmap is null and void, try to convert them to png. This introduces a new dependency to ImageMagic++. I don't like it, but it works, kinda... I saw random crashes while testing...
* Fix Style issuesArno2013-10-121-1/+1
| | | | | | * Change fixed width front from "courier" to "Monospace" * Remove foregroundcolor from SmTreeItem. Wasn't used nor needed, quite the opposite: it made SheMov deviate from the default style.
* Switch to QRunnable + QThreadPoolArno2013-09-031-3/+3
| | | | | | | | | | | 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...)
* Enhance previewArno2013-08-221-5/+19
| | | | | | * Show time when snapshot was taken. * Align the snapshots properly. * Show BusyCursor when generating preview.
* Give Pictures some love!Arno2013-08-221-0/+9
| | | | | | * Show and archive size of pictures * Fix SqlQueries in PicFilesModel: removeFiles and changeMappings * use delegate in PictureView
* Implement previewArno2013-08-111-0/+40
| | | | Show 4 frames of the selected movie in PictureViewer2.
* Implement file properties dialogArno2013-07-281-1/+15
| | | | | | | | Show file properties in Filemanager and Archive, if the file is available. Also get rid of the palette stuff in SmGlobals. Just call setPalette() early enough and set it in SmTreeView.
* Read JSON from ffprobeArno2013-07-271-22/+14
| | | | | | | | | | | | | | | | 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.
* Make new archive workArno2013-07-081-0/+6
| | | | | | | | | | Well, this is a huge commit. Should be severals, but who knew... First and foremost feature: Make NewMovieWizard work with the experimental model. This change obsoleted a lot of code. Also, the old archive won't work with with the new Wizward... There are most probably many other features I forgot about.
* Lots of Display ChangesArno2013-07-061-0/+13
| | | | | | | | | * Save header states * Implement delegates for columns * unify size and duration to 1 column * colorize View ... and lots of other things I forgot :)
* Show duration in statusBarArno2013-03-221-2/+32
| | | | | Show total duration of selected Movies in FileView. Created a new class Helper::Duration for this and declared it as QMetaType.
* Another fix for Helper::md5sumArno2013-03-211-1/+5
| | | | Don't crash harder on read failure :)
* Final inotify!Arno2013-03-211-4/+6
| | | | | | | | | | | | | | | | | | | | 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...
* First shot at SmDirModelArno2013-03-161-0/+29
| | | | | | | | 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...
* Port to Qt5Arno2013-03-031-4/+4
| | | | | | | | * Change #include to qt5 * Fix missing QX11Info * use explicit constructor for QVariant(QColor) * use beginResetModel() and endResetModel() instead of reset(). The latter was removed. Hopefully it still works :)
* Make PictureViewer2 size configurableArno2012-10-201-1/+1
| | | | | | | | Several bug fixes on the way: * set fixed size policy for PictureViewer2 -> makes resizing much easier * don't set Y-offset when showing a pic. The scene takes care of it * don't deliver SIGNAL configChanged() twice to PictureViewer2 * center Widget on current screen when calling Helper::centerWidget
* Keep current Pic when adding files to PicViewer2Arno2012-10-191-8/+0
| | | | | | | Try to get the position of the current picture after adding and clearing the file list of PictureViewer2. While thinking of using std::find for this I realized that the operator()-functions in Helper:: weren't used any more, so remove them and the <algorithm> includes.
* fix matroska detectionArno2012-07-141-1/+1
| | | | Make mkv detection more reliable.
* Make NewPicsDialog archive picturesArno2012-02-251-2/+7
| | | | | | Finally NewPicsDialog actually does something. Added another parameter to Helper::moveToArchive. If set to true, files will only be copied instead of moved. Default is false, not changing the expected behavior.
* Center Dialogs on screenArno2011-08-171-0/+10
| | | | | | Since I'm now using a tiling window manager dialogs have to center themselves on the screen. Otherwise they end up at QPoint(0,0). Not very nice. Subclassed QDialog to SmDialog and converted all dialogs.
* Show metadata in ArchiveViewArno2011-02-201-0/+6
| | | | | Added a widget to display metadata beside actors and genres when available
* Finished metadataArno2011-01-271-0/+8
| | | | | Created a modes for metadata, revamped NewMovieWizard to use the model and created a MetadataWidget to edit and display metadata.
* Enhance filters in SeriesTreeWidget a little moreArno2010-12-301-0/+13
| | | | | | | | | | | Allow operators in filter. Operators are only valid if it's a NumericQuery. Operators are <>=. Also allow postfixes for numbers: k, m, g for kilobytes, megabytes and gigabytes. Also fix a little usability bug when filtering. If the result set was empty, the root item was collapsed. On the next search with a result, the root item was still collapsed. Since it wasn't shown there was no way to expand it.
* Cache for frame grabbingArno2010-12-161-21/+0
| | | | | | | | | Implemetented a cache for hovering over movies, saving the pictures from ffmpeg. For that SmGlobals got a new member *frameCache, handling all the dirty file access. I first tried to implement it as a helper, but that produced too much duplicate code.
* Implement hover over moviesArno2010-12-111-1/+25
| | | | | | | | | | | | | | | | | | | | What started as an attempt to show a frame from a movie when hovering over it, ended in a huge bugfix commit for hover related stuff. This commit is definitely not atomic. When hovering over a movie present on the filesytem a frame is shown. The time frame is configurable. While digging into the code I noticed some bugs. Bugfixes: * fix label for hove archive action. It was labeled for hovering over directories in FSWidget. * Hovering over directories didn't have an action. Also read the appropriate value from QSettings. Other: * add icons for hovering over directories and hovering over movies * replace SheMov::toggleHover(pics|some other) with a QSignalMapper
* Code cleanupArno2010-12-051-4/+0
| | | | | | Remove debug statements from FileSystemWidget. Also remove useless helper func StringListContains. That was a goodie. I guess I was quite drunk when I wrote that...
* Implement FilePropertiesDialogArno2010-07-311-0/+17
| | | | | | | | | | | Implemented a dialog for file properties. When the mime type says it's a video, fork ffprobe to read the properties of all streams and show them in a QTreeView powered by a SmTreeModel. If the mime type is image, use QImage to read some properties and show them in the same dialog. This commit introduces the new class FilePropertiesDialog. I also had to implement a copy constructor for SmTreeItem. It obsoletes classes ActorWidget, ActorModel and MoviePropertiesDialog.
* Bugfix commitArno2010-07-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The journey through the internals of SheMov started by fixing SeriesTreeWidget::readSettings(). The selected index didn't really get selected on startup because only QItemSelectionModel::setCurrendt() was called. Replace it with QItemSelectionModel::select() and QTreeView::setCurrent(). Also fix SeriesTreeWidget::writeSettings() to only write selected items to QSettings() when something is selected. While working on selections I realized that there is a serious bug in Helper::moveToArchive. The destination directory in the archive must be created if it doesn't exist. For a testcase I needed an easy way to move files back from the archive to incoming directory, so I added FilesTreeWiget::moveToDirectory(). This lets you move files from the FilesTreeWidget to any directory. During testing I realized that SeriesTreeWidget::deleteFromSeries() QMessageBox() doesn't show files when deleting a series part. Fixed that by adding SeriesParts to file list. Finally a newly added SeriesPart gets selected and selected by expanding it first and then calling QItemSelectionModel::select() To make a long story short: 1. fix SeriesTreeWidget::{read,write}Settings 2. add FilesTreeWidget::moveToDirectory() 3. fix SeriesTreeWidget::deleteFromSeries() QMessageBox 4. fix selecting newly added SeriesParts