summaryrefslogtreecommitdiffstats
path: root/mappingtreemodel.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove presets from NewPicsDialogArno2016-03-301-0/+1
| | | | | | | | and replace them with write/readSettings. It was a useless feature anyway, don't even remember what it was good for. Also fix another bug in MappingTreeResultModel: Clear mCurrentData too, when clearData is called.
* Save mappings from slide dialogArno2016-03-301-1/+14
| | | | | Also fix a long standing bug in MappingTreeModel: also remove item from mCurrentData when the removed item is a parent of one of the items.
* Implement presets for NewPicsDialogArno2015-04-081-16/+56
| | | | A set of attributes can now be saved and loaded in NewPicsDialog.
* Fix commit dc7cc269a4fffe43bdac2ae2dc6548fbd1e3bb5eArno2014-07-091-0/+13
| | | | | | | | 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-8/+19
| | | | | 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-108/+79
| | | | | | | 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-31/+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/+16
| | | | | | 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-55/+44
| | | | | | | * 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-71/+20
| | | | | | | * remove some of the Transaction madness * make it possible to archive pics again It's far from finished....
* Cleanup closeEventArno2013-07-271-14/+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-17/+57
| | | | | | 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.
* More fallout from the MappingTreeModel fixArno2012-11-171-1/+1
| | | | | Forgot to fix the Edit widget... While at it, refresh the view if mappings changed in PicturesWidget.
* Yet another MappingTreeModel fixArno2012-11-171-7/+7
| | | | | Forgot to fix/rename MappingTreeResultModel... Adding pictures works again :)
* Finally { fix MappingTreeModel }!!!Arno2012-11-171-14/+9
| | | | | | | 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-7/+7
| | | | | | | | | | | 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-14/+14
| | | | Rename enum also! _THAT_ should help, I hope!
* Rename table mappings to more fitting mapping_descriptionArno2012-11-161-23/+23
| | | | | | | | | | | | 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-1/+7
| | | | | | | 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-17/+36
| | | | | | 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...
* Keep current Pic when adding files to PicViewer2Arno2012-10-191-3/+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 MappingTreeModelArno2012-10-061-38/+17
| | | | | | | | | * 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-41/+57
| | | | | | | | | | 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-58/+0
| | | | Remove unused functions, members and queries.
* Fixed adding and deleting children from MappingTreeModelArno2012-10-051-2/+14
| | | | | | | | | | | | | | | | | Another fix to MappingTreeModel's new database layout. I think we're getting there... Insert the mappings into mapping_parents2 and add the MapParentId to the newly created index in the model. For now, the added date remains invalid. Make it possible (again?) to add root items to MappingTreeModel. For this I had to design a new QDialog with a checkbox. This one fixes another bug in SmTreeModel: Don't call parent() on a null pointer. Sometimes I'm getting random SIGBUS-Signals, but maybe that's because of the debug build of qt I'm using. Couldn't track it down yet...
* Fix deleting children in MappingTreeModelArno2012-10-051-3/+4
| | | | | 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-83/+22
| | | | | | | | | | 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.
* Fix MappEditDialgArno2012-10-031-1/+1
| | | | | Convert to new mapping DB layout. Return the parent ID where necessary instead of the mapping ID.
* Foremost a fix for SmTreeModelArno2012-09-301-3/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+6
| | | | | 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-26/+91
| | | | | | | | | | | | 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/+45
| | | | | | | | | | | 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-22/+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-1/+26
| | | | | | | | | 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-10/+17
| | | | | Don't brute force coloring MappingTree by calling (begin| it keeps the focus.
* Customize menus and toolbar for PictureViewArno2012-03-031-0/+1
| | | | | | | * Added 4 new icons for PictureView-actions. * simplified SheMov::tabChanged(int) * fix long standing bug with QActionGroups in SheMov. Enable and disable all actions according to the active tab
* Impement editing of picture mappingsArno2012-03-031-0/+4
| | | | Make it possible to edit picture mappings on archived pictures.
* Fix MappingTreeModel::addChild()Arno2012-03-021-6/+7
| | | | | Catch illegal separator in value before making a database entry and insertRows()
* Make add mapping item a context menu entryArno2012-03-021-1/+3
| | | | | | Remove the QLineEdit and QPushButtons from the bottom of MappingTreeWidget and make adding mapping items available in the context menu.
* Prevent usage of "/" in MappingTreeModelArno2012-03-021-0/+8
| | | | | Since "/" is used as path separator, reject any SmTreeModel::Name containing it.
* Make it possible to move mappingsArno2012-03-021-0/+74
| | | | | | | | | | | | | 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/+56
| | | | | 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-3/+40
| | | | | | 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/+58
| | | | | | | 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.
* Implemented NewPicsDialogArno2012-02-241-1/+1
| | | | | Version 1 of NewPicsDialog. Just one single tab for adding files. Does nothing yet besides adding and removing files.
* Implement MappingTreeWidgetArno2012-02-241-28/+50
| | | | | | | | | | | | | | | 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/+244
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.