Refactor KPhotoAlbum
Open, NormalPublic

Description

I'd like to do something along the following lines:

  • DB
    • Merge XMLDB into DB ( but isolate XML reader stuff and keep that separate)
    • Remove cruft from SQL backend (saveLater etc.)
    • markDirty should be done using signals
    • undo could be implemented at DB level
  • File organisation
    • Have core and GUI folders; no UI deps in core
    • Disentangle Utils; split Utilities.cpp
johanneszarl triaged this task as Normal priority.
johanneszarl added a comment.EditedOct 7 2018, 9:02 PM

Here are my personal notes on this so that they don't get lost:


Prerequisites

Tasks to ensure clean(er) workflow.

  • Fix trailing whitespace for all source files
  • Code-formatting using clang-format

First milestone

Goals:

  • Separate GUI from non-UI stuff
  • create kpacore library for non-UI stuff

Tasks:

  • extract core Logging components
  • extract core enums → breaks dependency of SettingsData on other components
  • break dependency on MainWindow in DB
  • extract minimal usable units from Util.cpp
  • merge XMLDB into DB
  • break out non-UI parts of components into core libraries
    • DB, XMLDB
    • Settings/SettingsData
    • Exif database
    • thumbnail database
  • break dependency on BrowserWidget in ImageDB::currentScope()

Second milestone

Goals:

  • make core libraries independently usable without GUI stack

Tasks:

  • break dependencies on:
    • KF5::IconThemes
    • KF5::WidgetsAddons
    • Qt5::Gui
  • create UI-independent ways to convey messages to the user (i.e. don't create a message box in some XMLDB-related code or stuff like that)

Third milestone

This is not very concise yet - basically these are my (jzarl) long-term plans code-wise...

Goals:

  • modernize database component
    • separate XML parts from core database (i.e.: allow alternative readers/writers (e.g. for digikam databases); allow us to change innards of database without introducing bugs into the xml reader/writer)
    • undo the DB/XMLDB separation (this was done for the foray into an sql database backend)
    • investigate cost/benefit for "Qtifying" the DB api using signals/slots
    • investigate options to snapshot the database state (for multi-level undo)
    • investigate cost/benefit of using an in-memory SQLite DB after reading in the XML database
  • create syntax for describing searches textually (this allows for bookmarks or for starting KPA at a given starting point)

Update: there's now DB::UIDelegate which helps breaking dependencies on MainWindow/KMessageBox.

johanneszarl moved this task from Backlog to In Progress on the KPhotoAlbum board.Apr 14 2019, 1:31 PM

Two core libraries (kpabase, kpathumbnails) have been created.