Videos, images, and presentations were all look at the wrong index. I
needed to look for the count - 1 in order to find the right index from
the model when switching to the editMode
I have gotten reveal.js presentations to be viewable. I'll still need
to work with how to present them, and fix the presenter piece as well,
but for now, it works.
Since the rust implementation happens on insertion of slides and
creates a property for it, it's better as we won't need to create it
on the fly. Now we'll just need to move it into a background thread so
things will load while ffmpeg creates thumbnails for us.
In order to make start and end time setting far more efficient, I
decided to create my own RangeSlider called RangedSlider. This has a
moved signal for each handle and a released signal for each
handle. This allows us to change the video playback but not set the
value until released. Meaning only one access to the database.
I've made it possible to update the properties of the videos. I'll
need to make sure title, start and end times, and paths all work as
well. Let's make videos really good and then move on to images and
presentations.
The basic functions are all working properly. Now the model works by
using diesel to connect the sql database and retrieve all the items
and organize them. Then it'll ensure any additions and deletions are
correct and happen first on the database before adding them to the
model.
There is still a C++ proxyModel inbetween QML and Rust, but
this proxyModel interfaces with the Rust model instead of the C++
SqlTableModel.
Since every slide is asking for their own, we don't need to loop
through all slides, we just use the index to put the thumbnail into
the right slides and emit data changed.
slide_model.rs activate function now properly tells of the data that
was changed so that ListViews that use it as a model will reset their
data properly on changes.
The important parts were to ensure we are using the right indexes for
top_left and bottom_right. Then also ensure the roles are correct, but
I think I had that already, just went with the implementation that
CXX-Qt used in their examples.
While the previous function technically worked, the connections
weren't setup properly. Also the row_count function wasn't running
because it requires a QModelIndex parameter. Added a simple count
function to make sure we know how many slides there are in QML.
This commit finally has a working basic slide_obj implemented in Rust!
There are likely still some things that need to be tweaked and
massaged in order for things to translate back and forth from QML to
Rust.
The key was to make the old SlideObject written in C++ to act as a
bridge between QML and Rust. QML can't seem to understand CXX-QT's
QMap_QString_QVariant type as a QVariantMap and thus didn't translate
the Javascript object properly. Having the call first go into a C++
class translated it and then was trivial to pass into Rust.