Skip to content

Commit f1f52cc

Browse files
authored
Fix bug in selectAll and active media indicator (#44)
* Fix bug in selectAll and active media indicator * Fix bug in selectAll and active media indicator
1 parent 0eb42ce commit f1f52cc

File tree

7 files changed

+36
-19
lines changed

7 files changed

+36
-19
lines changed

docs/user_docs/release_notes/index.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
Release Notes
55
=============
66

7-
==============
7+
===============
88
v0.11.0 (Alpha)
9-
==============
9+
===============
1010

1111
**Media**
1212

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

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

28-
==============
28+
===============
2929
v0.10.0 (Alpha)
30-
==============
30+
===============
3131

3232
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.
3333

include/xstudio/ui/qml/session_model_ui.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ class SessionModel : public caf::mixin::actor_object<JSONTreeModel> {
205205
Q_INVOKABLE void sortAlphabetically(const QModelIndex &index);
206206

207207
Q_INVOKABLE void setPlayheadTo(const QModelIndex &index);
208+
Q_INVOKABLE void setCurrentPlaylist(const QModelIndex &index);
208209

209210
Q_INVOKABLE void relinkMedia(const QModelIndexList &indexes, const QUrl &path);
210211
Q_INVOKABLE void decomposeMedia(const QModelIndexList &indexes);

src/playlist/src/playlist_actor.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,17 +385,16 @@ void PlaylistActor::init() {
385385
uuid_before);
386386
},
387387

388-
[=](add_media_atom atom,
388+
[=](add_media_atom,
389389
const std::string &name,
390390
const caf::uri &uri,
391391
const utility::Uuid &uuid_before) {
392392
delegate(
393393
actor_cast<caf::actor>(this),
394-
atom,
394+
add_media_atom_v,
395395
name,
396396
uri,
397397
FrameList(),
398-
base_.media_rate(),
399398
uuid_before);
400399
},
401400

src/plugin/data_source/dneg/ivy/src/data_source_ivy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ void IvyDataSourceActor<T>::ivy_load_version(
931931
for (const auto &i : jsn.at("data").at("versions_by_id")) {
932932
auto payload = JsonStore(i);
933933

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

936936
payload["show"] = show;
937937

src/plugin/utility/dneg/dnrun/src/dnrun.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,10 @@ template <typename T> class DNRunPluginActor : public caf::event_based_actor {
369369
if (!playlist) {
370370

371371
playlist = request_receive<caf::actor>(
372-
*sys, session, session::get_playlist_atom_v, "Ivy Media");
372+
*sys,
373+
session,
374+
session::get_playlist_atom_v,
375+
"DNRun Playlist");
373376
}
374377

375378
// third, make a new 'Ivy Media' playlist

src/ui/qml/session/src/session_model_methods_ui.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,23 @@ void SessionModel::sortAlphabetically(const QModelIndex &index) {
10631063
}
10641064
}
10651065

1066+
void SessionModel::setCurrentPlaylist(const QModelIndex &index) {
1067+
try {
1068+
if (index.isValid()) {
1069+
nlohmann::json &j = indexToData(index);
1070+
auto actor = actorFromString(system(), j.at("actor"));
1071+
auto type = j.at("type").get<std::string>();
1072+
if (session_actor_ and actor and
1073+
(type == "Subset" or type == "Playlist" or type == "Timeline")) {
1074+
scoped_actor sys{system()};
1075+
anon_send(session_actor_, session::current_playlist_atom_v, actor);
1076+
}
1077+
}
1078+
} catch (const std::exception &err) {
1079+
spdlog::warn("{} {}", __PRETTY_FUNCTION__, err.what());
1080+
}
1081+
}
1082+
10661083
void SessionModel::setPlayheadTo(const QModelIndex &index) {
10671084
try {
10681085
if (index.isValid()) {

ui/qml/xstudio/main.qml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ ApplicationWindow {
371371

372372
onCurrentChanged: {
373373
currentSource.index = currentIndex
374+
sessionModel.setCurrentPlaylist(currentSource.index)
374375
}
375376
}
376377

@@ -508,15 +509,16 @@ ApplicationWindow {
508509
// make sure we're looking in the right one..
509510
function updateMediaUuid(uuid) {
510511
let media_idx = app_window.sessionModel.search(uuid, "actorUuidRole", app_window.sessionModel.index(0,0,screenSource.index), 0)
511-
512512
if(media_idx.valid) {
513513
// get index of active source.
514514
let active = media_idx.model.get(media_idx, "imageActorUuidRole")
515+
515516
// dummy to populate..
516517
media_idx.model.get(media_idx, "audioActorUuidRole")
517518

518519
if(active != undefined) {
519-
let msi = app_window.sessionModel.search_recursive(active, "actorUuidRole", app_window.sessionModel.index(0, 0, media_idx))
520+
let msi = app_window.sessionModel.search(active, "actorUuidRole", media_idx)
521+
520522
if(mediaImageSource.index != msi)
521523
mediaImageSource.index = msi
522524

@@ -1384,14 +1386,9 @@ ApplicationWindow {
13841386
}
13851387

13861388
function selectAllMedia() {
1387-
let mi = app_window.sessionSelectionModel.currentIndex
1388-
if(mi.valid){
1389-
let type = mi.model.get(mi, "typeRole")
1390-
let smi = mi.model.index(0, 0, mi.model.index(0, 0, mi))
1391-
1392-
let matches = mediaSelectionModel.model.match(smi, "typeRole", "Media", -1)
1393-
mediaSelectionModel.select(helpers.createItemSelection(matches), ItemSelectionModel.ClearAndSelect)
1394-
}
1389+
let media_parent = currentSource.index.model.index(0, 0, currentSource.index)
1390+
let matches = mediaSelectionModel.model.search_list("Media", "typeRole", media_parent, 0, -1)
1391+
mediaSelectionModel.select(helpers.createItemSelection(matches), ItemSelectionModel.ClearAndSelect)
13951392
}
13961393

13971394
function deselectAllMedia() {

0 commit comments

Comments
 (0)