Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul of models, views, data management #3497

Merged
merged 11 commits into from
May 24, 2020

Commits on May 17, 2020

  1. Models: Persistence enhancements

    - Move ModelRefreshed signal to outer class (now a QObject subclass)
    - Move mimeData() to proxy model, where it needs to be for views
    - (This allowed dropping the inner Files and Transitions model classes
      entirely, replaced with a stock `QStandardItemModel`. All of the
      special logic is in the custom proxy model class.
    - Add a persistent QItemSelectionModel to all three models, shared by
      both views. Selection is no longer lost when switching view.
    - Track the currently visible view for 'foo' (either fooListView or
      fooTreeView) in main_window, access as `get_app().window.fooView`
    ferdnyc committed May 17, 2020
    Configuration menu
    Copy the full SHA
    1d3a4b6 View commit details
    Browse the repository at this point in the history
  2. Eliminate main_window's self.selected_files list

    - Selection is now managed completely in the Files model (outer class),
      directly from the persistent QItemSelectionModel.
    - Helper functions in both files_model and main_window ease transition
    - updateSelection() is also gone, as there's no selection cache.
      Selection data always comes live from the selection model.
    - Also greatly simplify drag-and-drop code, using proxy & selection
      models
    ferdnyc committed May 17, 2020
    Configuration menu
    Copy the full SHA
    55b9468 View commit details
    Browse the repository at this point in the history
  3. Files: Move add_file, get_image_seq() into model

    Major overhaul to the code for adding items to the file model.
    - `add_file()` is gone from both views
    - files_model's new `add_files()` (<= note the plural) takes a list of
      paths, instead of churning over them one at a time
    - Image sequence management is also consolidated into files_model
    - Two helper methods in main_window handle communication with the user
      (in the form of popup questions / message boxes) for `add_files()`
    
    Also, QPersistentModelIndex()es are stored in the custom model outer
    classes' in-memory hashes, and can be used to locate a given item's
    row for later modification (or deletion, specifically). No more
    having to iterate over all the items to find one! (This is done for
    Transitions as well, though it's currently not used there.)
    ferdnyc committed May 17, 2020
    Configuration menu
    Copy the full SHA
    1a996a5 View commit details
    Browse the repository at this point in the history

Commits on May 19, 2020

  1. Fix dragging for all views

    ferdnyc committed May 19, 2020
    Configuration menu
    Copy the full SHA
    02ee15a View commit details
    Browse the repository at this point in the history
  2. Fix "Edit Title" action

    ferdnyc committed May 19, 2020
    Configuration menu
    Copy the full SHA
    57d3229 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    ece947b View commit details
    Browse the repository at this point in the history
  4. Properties: Use main data models for context menu

    - properties_tabelview will pull data directly from files_model and
      transition_model on the get_app().window object.
    - A connection to both models' ModelRefreshed signals that forces
      a menu data reset replaces the previous update_model() calls
    ferdnyc committed May 19, 2020
    Configuration menu
    Copy the full SHA
    424f56e View commit details
    Browse the repository at this point in the history
  5. Add --test-models flag to launcher

    - When passed, OpenShot will attempt to load QAbstractItemModelTester
      into the files, emoji, effects, and transition models (base and all
      proxy models). This requires Qt 5.11 or higher.
    - By default, if the environment variable `QT_LOGGING_RULES` is not
      set, it will be set to "qt.modeltest.debug=true", which causes quite
      a lot of console spew. It can be set to something less verbose before
      launching OpenShot, e.g. "qt.modeltest.warning=true".
    ferdnyc committed May 19, 2020
    Configuration menu
    Copy the full SHA
    726e5d3 View commit details
    Browse the repository at this point in the history

Commits on May 21, 2020

  1. Configuration menu
    Copy the full SHA
    dc18a20 View commit details
    Browse the repository at this point in the history
  2. Titles: Use files model add_files(), new counter

    - Switch from TitleFileName-N for numbered filenames, to Windows-esque
      "TitleFileName (N)", because the previous value would trigger the
      image sequence import logic
    ferdnyc committed May 21, 2020
    Configuration menu
    Copy the full SHA
    a9c40d1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    da09062 View commit details
    Browse the repository at this point in the history