Diffusion Krita 500f574cfb69

KoSectionModel instead of KoSectionManager implemented

Authored by deniskuplyakov on Sep 1 2015, 12:07 PM.

Description

KoSectionModel instead of KoSectionManager implemented

Summary:
The main goal. Why it is done?
We need to store and maintain section tree in document. KoSectionManager were doing it lazy way: some changes can destroy its data and in that case you should call from code a special method to rebuild entirely whole tree of a document. This way comes more uncomfortable when we are going to visualize section tree (Author's outliner for example), as in that case you need to update widget by timer and in case of big documents such method will require high amount of computing.

So I decided to use Qts model as a base for the new KoSectionModel. New main aim: tree should be up-to-date always, and should be updated only by commiting local changes to it instead or rebuilding. Another pro of using Qt model that it is now super easy to show tree in UI with any data you want (check now QIdentityModel using with this in ConfigureSectionDialog).

Other changes

  1. I've found some bugs in handling of sections during deletion, unit-test reference data;
  2. Added more unit-tests for other types of sections operation, now also testing KoSectionModel;
  3. Small rewrites in a few places;
  4. Putted a detailed documentation on how sections handling now done to KoSectionModel.h;
  5. Introduced SplitSectionsCommand and corresponding tool that allows to insert paragraphs between directly nested sections, with that options user can create any section structure;

That's all that I remember, look at commit messages for details.

Connected future plans
I think that that SplitSections dialog UI should be reworked, some tips should be added to user about "why I need this?". Unfortunately, there is no place to look how it can be done, as LO doesn't allow such operation and there is no sections analog in MSO.

And good luck to reviewers: change is big enough ;)

Test Plan:
What I have done

  • testKoTextEditor unit-test passing;
  • Manually checked split sections functionality.

What I want to reviewers make attention
There is a bunch of FIXME and TODO in code. Personally to boud: there is some unit-test I have commented in KoTextEditor, it is pointed with FIXME, check it plz.

Reviewers: boemann, rempt, staniek

Reviewed By: staniek

Subscribers: staniek, #calligra:_3.0

Projects: #calligra:_3.0

Differential Revision: https://phabricator.kde.org/D235

Details

Committed
deniskuplyakovSep 1 2015, 12:07 PM
Reviewer
staniek
Differential Revision
D235: KoSectionModel instead of KoSectionManager implemented
Parents
R37:df7d29aa95e6: use Q_SLOTS and Q_SIGNALS
Branches
Unknown
Tags
Unknown