summaryrefslogtreecommitdiffstats
path: root/mappingtreemodel.h
Commit message (Collapse)AuthorAgeFilesLines
* Make it run with Qt6Arno2022-04-151-2/+2
| | | | | | | | | 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...
* Various clang warning fixesArno2019-01-121-1/+1
| | | | | Mostly nullptr, one missing include that wasn't really missed, and a stray ;
* Add copyActor for new picsArno2018-12-031-0/+1
| | | | | | If we already have an actor, get all mappings for all pics and fill the result view. This only makes sense for actors, but should also work for other items.
* More code churnArno2018-07-201-46/+0
| | | | | Create separate files for MappingData and MappingTreeResultModel. Hopefully no functional changes.
* Implement presets for NewPicsDialogArno2015-04-081-0/+13
| | | | A set of attributes can now be saved and loaded in NewPicsDialog.
* Fix commit dc7cc269a4fffe43bdac2ae2dc6548fbd1e3bb5eArno2014-07-091-0/+1
| | | | | | | | Since that commit we not only recorded leaves for Mappings, but also the nodes. This is plain wrong, since we build the path/tree ourselves where it matters (e.g. MappingTreeItem). Fix it by checking recursively if the MappingItem has children.
* Fix MappingTreeResultModel for goodArno2014-07-081-0/+1
| | | | | removeRows and insertRows is buggy. Unfortunately I can't figure out how... So make it easy and reset the model on inserts and removals.
* Major rework of MappingTreeResultView + ModelArno2014-06-291-12/+5
| | | | | | | Well, I hope this fixes the crashes for good. String comparison for looking up the parents really wasn't a prudent thing to do... Use the ParentIds instead.
* Fix Display of mappingsArno2014-06-191-4/+0
| | | | | MappingTreeModel::treeFromPath() never worked as intended, so replace it by displaying mappings in a QTextTable.
* Fix renaming mapping items for picsArno2013-10-131-0/+1
| | | | | | With some GNOME themes the edit trigger for SmTreeModel is borked. The current name is mixed with the new one, and one can't recognize anything. Use a QInputDialog instead.
* Fix MappingTreeModel for goodArno2013-08-211-8/+1
| | | | | | | * Again: remove the transaction madness besides almost everywhere leaving one instance where it is actually useful. * Hide the buttons to add and delete mapping types. Haven't thought that through complete. What should be deleted on cascade? Do we really want/
* Fix NewPicsDialog + NewPicFilesModelArno2013-08-161-5/+0
| | | | | | | * remove some of the Transaction madness * make it possible to archive pics again It's far from finished....
* Cleanup closeEventArno2013-07-271-1/+0
| | | | | | | | | | 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...
* Fix editing of MappingTreeModelArno2013-04-111-1/+3
| | | | | | Renaming/Editing of an item didn't work, because database restrictions hadn't been taken into account. tdescription_name is unique, so update the description_id if it already exists.
* Yet another MappingTreeModel fixArno2012-11-171-3/+3
| | | | | Forgot to fix/rename MappingTreeResultModel... Adding pictures works again :)
* Finally { fix MappingTreeModel }!!!Arno2012-11-171-2/+1
| | | | | | | I think I did it! Fixed MappingTreeModel to make it usable, avoid all the traps with the insane column and variable names! Now we can actually have the same mapping with different parents! Yay! Hope it won't come back and bite me!
* More renaming: mappings_parentsArno2012-11-161-2/+2
| | | | | | | | | | | Rename: * drop table mappings_parents * rename mappings_parents2 to mapping_parents * drop the s after mapping on column names * rename FK imapping_id to idescription_id * rename ParentId(Role) to MappingParentId(Role) Well, it still works (tm) :)
* Renaming continued!Arno2012-11-161-2/+2
| | | | Rename enum also! _THAT_ should help, I hope!
* Rename table mappings to more fitting mapping_descriptionArno2012-11-161-3/+3
| | | | | | | | | | | | Well, many errors are a result of the very confusing naming scheme. We have tables: * mappings, more correctly mapping_descriptions * mapping_parents2, mapping_parents will be eliminated * mapping_types, maybe right, not sure. This commit renames mappings (_the_ mapping table) to mapping_descriptions. Hope I didn't miss anything. No functional change, BTW.
* Bugfixes: don't select dirs and don't crash on write settingsArno2012-10-271-0/+2
| | | | | | | Only select files when archiving pics from filemanager. While at it, I noticed a crash on close when no item is selected in PicturesWidget. So check if MappingData is valid on writing settings. Best way is MappingData::isValid(), and for that I needed a explicit constructor.
* Fix archiving picturesArno2012-10-271-7/+9
| | | | | | Well, what can I say. Lost in recursion and parent pointers. This commit actually boils down to using the proper database tables and inserting the right values. 'Nuff said...
* Fix MappingTreeModelArno2012-10-061-3/+4
| | | | | | | | | * Don't recurse ad infinitum when having nodes with the same name. * Add all relevant data to the model. There's still one quirk left: you can't do something like this blub -> blub2 if bla -> blub ->blub2 already exists, but that's something I can live with.
* More fixes to MappingTreeModelArno2012-10-061-3/+3
| | | | | | | | | | Fix move, addChild and such. Rename Fields and Roles to more speaking names, but that revealed a much deeper bug: the ParentID isn't really the parent_id, but the mapping_id. That could explain a lot. Nevertheless, it's still faster to repopulate the model after moving oder adding children instead of calling removeRows and insertRows. Another non-working commit... :(
* Code cleanup on MappingTreeModelArno2012-10-051-7/+0
| | | | Remove unused functions, members and queries.
* Fix deleting children in MappingTreeModelArno2012-10-051-0/+3
| | | | | Deleting children tried to remove it from mappings instead of mappings_parents2. The mapping itself should not be deleted.
* Fix Mappings in PictureViewer2Arno2012-10-041-5/+4
| | | | | | | | | | Another fix for the new MappingTreeModel database layout: Make the mappings display correctly when showing an archived picture. For performance reasons I had to make PicFilesModel global and put it into a separate file. Also clean up MappingTreeModel: remove comments and unused functions.
* Foremost a fix for SmTreeModelArno2012-09-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not working again, but I eventually have to commit the changes. Fixes to SmTreeModel: * Fix SmTreeModel::index(). The previous comment was quite valid. I'm surprised that it worked at all. I have no clue why to return an invalid QModelIndex if the column isn't 0. Now an index with any valid column number can be created. * Fix SmTreeModel::parent(). Again, why shouldn't we create a parent index with a column other than 0? No idea... * Fix SmTreeModel::headerData(). Add some sanity checks. * Fix SmTreeModel::findRecursive(). Well, what is there to say. It never worked for models with a depth > 1, but obviously it didn't really matter until now. To make it work I had to change SmTreeItem as well. SmTreeItem::next() returns the next valid parent/sibling, or 0 if there isn't one. There may be some fallout from these changes, but they're yet to be seen. Changes to PictureView: * fix selecting an item according to the new datasbase layout * same goes for editing items. If an update actually works has to be checked. Overall, it's an intermediate commit that should have been a sane series of commits. Can't be changed now...
* MappingTreeModel Fix: Select pictures from pics_mappings2Arno2012-09-221-2/+2
| | | | | Select pictures referencing pics_mappings2 instead of broken pics_mappings. This just fixes the selection, nothing else!
* MappingTreeModel Fix: repair parent <-> child relationshipArno2012-09-221-5/+9
| | | | | | | | | | | | Warning: this commit seems to work, but it doesn't! Introduce two new tables: mappings_parents2 and pics_mappings2 to create a real parent-child relationship. The pics_mappings need to reference a unique mappings_parents_id so the same mapping can be a child of different parents. For now only the MappingTree references the new tables. Everything else uses the old ones. Hence the warning!
* Show mappings in PictureViewer2Arno2012-03-241-0/+6
| | | | | | | | | | | Hell, this was one heck of a bitch. Lots of changes just to show the mapping tree in PictureViewer2. Did I mention that I hate recursion? Added a function for fetching a SmTreeItem * from MappingTreeModel for paths, just to turn it into a QTextDocument in PictureViewer2. Of course everything is recursive. Did I say that I hate recursion? Well, as said in the comments, one recursion function seems fishy, but it works (tm).
* Save settings for PicturesWidgetArno2012-03-181-1/+1
| | | | Remember selected node in PicturesWidget.
* Fix some severe braindamageArno2012-03-181-1/+0
| | | | | | | | | | | | | | It started as a buxfix session, but the more I dug into some ancient code, the more I had to change. Well, first and foremost, this fixes a crash in PicturesWidget. Trying to display the mappings of the selected picture in a different color never was a good idea. Show them in the statusbar instead. While looking at the statusBar code, make PictureWidget emit signals to show the total size and number of selected items. Then I noticed some really, really braindamaged connection madness in the Shemov constructor. Instead of doing all the work in SheMov itself, have the widgets emit signals. This should have been several commits, but one lead to another...
* Make nodes with children selectable in picture widgetArno2012-03-171-0/+2
| | | | | | | | | This was a tough one. Lost in recursion. When selecting nodes with children in the picture widget, all files having this node as mapping parent are shown. Had to make some changes to SmTreeModel::findRecursive for this. I hope I didn't break anything. If I did, I'll fix it :) Also disposed of some comments and unused member variables.
* Fix brute forcing of colorsArno2012-03-031-1/+1
| | | | | Don't brute force coloring MappingTree by calling (begin| it keeps the focus.
* Impement editing of picture mappingsArno2012-03-031-0/+1
| | | | Make it possible to edit picture mappings on archived pictures.
* Fix MappingTreeModel::addChild()Arno2012-03-021-1/+2
| | | | | Catch illegal separator in value before making a database entry and insertRows()
* Make it possible to move mappingsArno2012-03-021-0/+7
| | | | | | | | | | | | | Move mappings by context menu. Select new parent by QComboBox with available paths, items separated by "/". Note that hell will break loose if a mapping name contains "/". Will be fixed later. Since mapping views don't have setSortingEnabled(), make SmTreeModel::addRow() sort items. This fixes a long standing bug in SmTreeModel::reparent(): Since it alters the model, newParent has to be a QPersistentModelIndex to stay consistent.
* Mark active MappingsArno2012-02-261-0/+5
| | | | | When selecting pictures, mark the active mappings with a different color.
* Implement PicturesWidgetArno2012-02-261-0/+1
| | | | | | | | Create a tab to show the archived pictures. It's far from complete, but it already does: * show pictures * hover * delete pictures from archive
* Make NewPicsDialog archive picturesArno2012-02-251-5/+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.
* Implemented mapping widget for NewPicsDialogArno2012-02-251-0/+29
| | | | | | | Make it possible to add mappings to new pictures. This actually was a tough one. Maybe I shouldn't drink and code. Next: make NewPicsDialog actually do something.
* Implement MappingTreeWidgetArno2012-02-241-1/+1
| | | | | | | | | | | | | | | This is a rather large commit. It implements MappingTreeWidget using MappingTreeModel unsurprisingly this uncovered some exciting bugs. Fixes the following bugs in MappingTreeModel: * use insertRows() and removeRows() when addings children, because dataChanged() won't do it. * don't use a prepared QSqlQuery when fetching children recursively. This won't work because the query is still active when we invoke ourselves again. Put the query on the stack instead * Keep the model sorted. Also add an entry for a MappingTreeEditor to the File-Menu.
* First shot at MappingTreeModelArno2012-02-241-0/+72
MappingTreeModel is a generic approach at mappings files to generic data, eg atttributes, actors or themes. It compiles, but nothing more. So expect many exciting bugs and SegFaults.