Skip to content

Commit

Permalink
Fix bug in selectAll and active media indicator (#44)
Browse files Browse the repository at this point in the history
* Fix bug in selectAll and active media indicator

* Fix bug in selectAll and active media indicator
  • Loading branch information
alatdneg authored Jul 19, 2023
1 parent 0eb42ce commit f1f52cc
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 19 deletions.
8 changes: 4 additions & 4 deletions docs/user_docs/release_notes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
Release Notes
=============

==============
===============
v0.11.0 (Alpha)
==============
===============

**Media**

Expand All @@ -25,9 +25,9 @@ v0.11.0 (Alpha)

- Refactor of QML/Qt layer to support future developments.

==============
===============
v0.10.0 (Alpha)
==============
===============

This intial open source version of xSTUDIO should be considered as a 'preview' release as the development team get to grips with maintaining the code base on a public repo. There are still some major features under development so we expect some parts of the code to change and expand considerably.

Expand Down
1 change: 1 addition & 0 deletions include/xstudio/ui/qml/session_model_ui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ class SessionModel : public caf::mixin::actor_object<JSONTreeModel> {
Q_INVOKABLE void sortAlphabetically(const QModelIndex &index);

Q_INVOKABLE void setPlayheadTo(const QModelIndex &index);
Q_INVOKABLE void setCurrentPlaylist(const QModelIndex &index);

Q_INVOKABLE void relinkMedia(const QModelIndexList &indexes, const QUrl &path);
Q_INVOKABLE void decomposeMedia(const QModelIndexList &indexes);
Expand Down
5 changes: 2 additions & 3 deletions src/playlist/src/playlist_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,17 +385,16 @@ void PlaylistActor::init() {
uuid_before);
},

[=](add_media_atom atom,
[=](add_media_atom,
const std::string &name,
const caf::uri &uri,
const utility::Uuid &uuid_before) {
delegate(
actor_cast<caf::actor>(this),
atom,
add_media_atom_v,
name,
uri,
FrameList(),
base_.media_rate(),
uuid_before);
},

Expand Down
2 changes: 1 addition & 1 deletion src/plugin/data_source/dneg/ivy/src/data_source_ivy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ void IvyDataSourceActor<T>::ivy_load_version(
for (const auto &i : jsn.at("data").at("versions_by_id")) {
auto payload = JsonStore(i);

spdlog::warn("ivy_load_version {}", payload.dump(2));
// spdlog::warn("ivy_load_version {}", payload.dump(2));

payload["show"] = show;

Expand Down
5 changes: 4 additions & 1 deletion src/plugin/utility/dneg/dnrun/src/dnrun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,10 @@ template <typename T> class DNRunPluginActor : public caf::event_based_actor {
if (!playlist) {

playlist = request_receive<caf::actor>(
*sys, session, session::get_playlist_atom_v, "Ivy Media");
*sys,
session,
session::get_playlist_atom_v,
"DNRun Playlist");
}

// third, make a new 'Ivy Media' playlist
Expand Down
17 changes: 17 additions & 0 deletions src/ui/qml/session/src/session_model_methods_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,23 @@ void SessionModel::sortAlphabetically(const QModelIndex &index) {
}
}

void SessionModel::setCurrentPlaylist(const QModelIndex &index) {
try {
if (index.isValid()) {
nlohmann::json &j = indexToData(index);
auto actor = actorFromString(system(), j.at("actor"));
auto type = j.at("type").get<std::string>();
if (session_actor_ and actor and
(type == "Subset" or type == "Playlist" or type == "Timeline")) {
scoped_actor sys{system()};
anon_send(session_actor_, session::current_playlist_atom_v, actor);
}
}
} catch (const std::exception &err) {
spdlog::warn("{} {}", __PRETTY_FUNCTION__, err.what());
}
}

void SessionModel::setPlayheadTo(const QModelIndex &index) {
try {
if (index.isValid()) {
Expand Down
17 changes: 7 additions & 10 deletions ui/qml/xstudio/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ ApplicationWindow {

onCurrentChanged: {
currentSource.index = currentIndex
sessionModel.setCurrentPlaylist(currentSource.index)
}
}

Expand Down Expand Up @@ -508,15 +509,16 @@ ApplicationWindow {
// make sure we're looking in the right one..
function updateMediaUuid(uuid) {
let media_idx = app_window.sessionModel.search(uuid, "actorUuidRole", app_window.sessionModel.index(0,0,screenSource.index), 0)

if(media_idx.valid) {
// get index of active source.
let active = media_idx.model.get(media_idx, "imageActorUuidRole")

// dummy to populate..
media_idx.model.get(media_idx, "audioActorUuidRole")

if(active != undefined) {
let msi = app_window.sessionModel.search_recursive(active, "actorUuidRole", app_window.sessionModel.index(0, 0, media_idx))
let msi = app_window.sessionModel.search(active, "actorUuidRole", media_idx)

if(mediaImageSource.index != msi)
mediaImageSource.index = msi

Expand Down Expand Up @@ -1384,14 +1386,9 @@ ApplicationWindow {
}

function selectAllMedia() {
let mi = app_window.sessionSelectionModel.currentIndex
if(mi.valid){
let type = mi.model.get(mi, "typeRole")
let smi = mi.model.index(0, 0, mi.model.index(0, 0, mi))

let matches = mediaSelectionModel.model.match(smi, "typeRole", "Media", -1)
mediaSelectionModel.select(helpers.createItemSelection(matches), ItemSelectionModel.ClearAndSelect)
}
let media_parent = currentSource.index.model.index(0, 0, currentSource.index)
let matches = mediaSelectionModel.model.search_list("Media", "typeRole", media_parent, 0, -1)
mediaSelectionModel.select(helpers.createItemSelection(matches), ItemSelectionModel.ClearAndSelect)
}

function deselectAllMedia() {
Expand Down

0 comments on commit f1f52cc

Please sign in to comment.