Bug 32581 - [EDITING] Add the possibility to retrieve the filename of a movie or sound inserted in a document
Summary: [EDITING] Add the possibility to retrieve the filename of a movie or sound in...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: abhilash300singh
URL:
Whiteboard: target:5.3.0
Keywords:
: 33860 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-12-22 12:08 UTC by Jean-Baptiste Faure
Modified: 2016-09-06 04:57 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Baptiste Faure 2010-12-22 12:08:53 UTC
When you insert a movie in a slideshow by Insert > Movie and Sound there is a small problem: it is impossible to retrieve the path of the inserted file. It is not listed in Edit > Links...
That is very annoying: for example if you want to move the slideshow to another location you need to move such files too. That may be difficult if you have several files in the directory and if you have forgot which file you inserted.

Please, add this information somewhere.

Best regards. JBF
Comment 1 Thorsten Behrens (CIB) 2011-01-10 08:04:47 UTC
There's work-in-progress around embedding sound/video files into the ODF container, see here: http://cgit.freedesktop.org/libreoffice/build/tree/patches/dev300/impressmedia-features.diff
Comment 2 Christopher M. Penalver 2011-02-04 20:44:23 UTC
*** Bug 33860 has been marked as a duplicate of this bug. ***
Comment 3 Rainer Bielefeld Retired 2011-02-05 00:52:19 UTC
Not only a Presentation problem, please see Bug 33156!
Comment 4 Aleksey 2011-04-13 09:47:05 UTC
I found that video fails to work in presentation only if there's Cyrillic letters in the path to the video. In case when there are only Latin letters video is played normally.
Comment 5 Florian Reisinger 2012-05-18 09:53:24 UTC
Deleted "Easyhack" from summary.
Comment 6 Thorsten Behrens (CIB) 2013-09-12 16:14:52 UTC
Apologies for not having gotten around fixing this bug yet; unfortunately in future I'll have even less time at my disposal for this, so I'm freeing up ownership for other volunteers to take over.
Comment 7 Björn Michaelsen 2013-10-04 18:48:00 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 8 QA Administrators 2014-10-23 17:32:11 UTC Comment hidden (obsolete)
Comment 9 Jean-Baptiste Faure 2014-10-26 08:01:11 UTC
It is still impossible to retrieve the filename and the path of a video inserted as a link.
It is less uncomfortable when the video is embedded but the problem is the same, once the video has been inserted you can't know where the file comes from.

Tested with the current master. Version: 4.4.0.0.alpha1+
Build ID: 3e2dfde73b46526b901c0c38b1e9b2a4872761ac

Best regards. JBF
Comment 10 Robinson Tryon (qubit) 2015-12-14 06:18:14 UTC Comment hidden (obsolete)
Comment 11 Michael Stahl (CIB) 2016-01-26 17:16:43 UTC
this easy-hack does not have code pointers...

the embedded media objects are represented by:

class SdrMediaObj (include/svx/svdomedia.hxx svx/source/svdraw/svdomedia.cxx)

there is a avmedia::MediaItem which stores the URL.

include/avmedia/mediaitem.hxx avmedia/source/framework/mediaitem.cxx

the context menu of the media object is apparently defined at Media_POPUP in
sd/source/ui/app/popup2_tmpl.src

so i guess there a context menu "Edit Link" could be added.

... then ask somebody who knows how UI code works where the c++ code is for the menu :)
Comment 12 Arnold Dumas 2016-02-19 16:23:30 UTC
Hello, I would like to work on this bug, is it enough when I assign myself to the bug?
Comment 13 jani 2016-02-19 18:18:54 UTC
In short yes, and please follow the guidelines from our wiki (Development/GetInvolved)
Comment 14 jani 2016-02-19 18:18:54 UTC Comment hidden (obsolete)
Comment 15 zinph 2016-04-04 15:34:06 UTC
Hello,

Me and my colleague are interested in working on this bug for a class project. For those currently working on this, have you made any progresses yet? If so, could you please share some info that you have gathered on this request? Thanks!

Warm regards,
Phyo Phyo
Comment 16 jani 2016-04-04 15:44:11 UTC
(In reply to zinph from comment #15)
> Hello,
> 
> Me and my colleague are interested in working on this bug for a class
> project. For those currently working on this, have you made any progresses
> yet? If so, could you please share some info that you have gathered on this
> request? Thanks!
> 
> Warm regards,
> Phyo Phyo

It is not polite to invade a bug like this. Arnold assigned this bug to himself a short while ago, so I assume he will solve the bug shortly.

Arnold@ the bug is yours and we look forward to your patch. Should you prefer not to solve it, then please unassign it.

Phyo@ you are of course free to use the bug for your class project.

Happy hacking.
rgds
jan i
Comment 17 zinph 2016-04-06 14:51:35 UTC
We will be working on it locally for our class and to gain experience with the project. But after we attempt to fix it, we won't upload our codes unless he decides to drop it.
Comment 18 Arnold Dumas 2016-04-12 08:28:25 UTC
I am sorry but because of the university, I won't have the time to fix this bug in the coming weeks. I deassigned myself from the bug.
Comment 19 kush singh 2016-06-21 06:23:38 UTC
hello , i wish to solve this bug as my first easy hack. I understand the problem , unfortunately cant understand where to begin . How is viewing links implemented for images ?

-thanks
Comment 20 jani 2016-06-21 09:15:05 UTC
l(In reply to kush singh from comment #19)
> hello , i wish to solve this bug as my first easy hack. I understand the
> problem , unfortunately cant understand where to begin . How is viewing
> links implemented for images ?
> 
> -thanks

Hi

We have made a step by step guide to help you get started:
https://wiki.documentfoundation.org/Development/GetInvolved

Comment 1 and 11 contains the code pointers you need.

Looking forward to see your patch.
Comment 21 kush singh 2016-06-25 00:05:46 UTC
@jan hi , i have build libreoffice and created a new branch as directed in the tutorial , but i am having trouble understanding the code even after two three days . any suggestions how i should tinker with the code to understand it better as documentation(readme) is not enough for a beginner like me . pls help

-thanks
Comment 22 jani 2016-06-28 07:01:31 UTC
(In reply to kush singh from comment #21)
> @jan hi , i have build libreoffice and created a new branch as directed in
> the tutorial , but i am having trouble understanding the code even after two
> three days . any suggestions how i should tinker with the code to understand
> it better as documentation(readme) is not enough for a beginner like me .
> pls help
> 
> -thanks

Understanding the whole code is not possible even for core developers, who have been around for decades.

Especially comment#11 point you to the classes you need to modify, I do not know how to help with this bug without solving it.

however if you find it too complicated (for a first bug), do assign yourself to another one. This is not the easiest easyhack, and there are others who are far easier to understand.
Comment 23 Katarina Behrens (CIB) 2016-07-01 10:07:43 UTC
I came to this bug b/c I wanted to provide some more detailed code pointers, potentially mentor some1 interested in solving it and it is totally unclear to me, what the desired resolution would be.

Is this mainly about not seeing the location of the file? If so, then the filename could be added e.g. to media playback toolbar or status bar

Or is it more about the possibility to edit such a link (iow, quick way to change the location of the file behind the media object)? In that case, perhaps some kind of Change Media ... (analogous to Change Image ...) context menu could be added

Moreover, if a media file is inserted as link ( Insert > Media > Audio or Video, then check 'Insert as link' checkbox), should it appear in the list of links as seen in Edit > Links ? (this is probably no longer an easy hack then)

Or is it all of the above *grin* ?
Comment 24 jani 2016-07-01 12:01:11 UTC
(In reply to Katarina Behrens (CIB) from comment #23)
> I came to this bug b/c I wanted to provide some more detailed code pointers,
> potentially mentor some1 interested in solving it and it is totally unclear
> to me, what the desired resolution would be.
> 
> Is this mainly about not seeing the location of the file? If so, then the
> filename could be added e.g. to media playback toolbar or status bar

That alone would be a drastic improvement
> 
> Or is it more about the possibility to edit such a link (iow, quick way to
> change the location of the file behind the media object)? In that case,
> perhaps some kind of Change Media ... (analogous to Change Image ...)
> context menu could be added
There are no real need for this, but of course that would be the stellar solution.

> 
> Moreover, if a media file is inserted as link ( Insert > Media > Audio or
> Video, then check 'Insert as link' checkbox), should it appear in the list
> of links as seen in Edit > Links ? (this is probably no longer an easy hack
> then)
This should be a separate bug.

> 
> Or is it all of the above *grin* ?
Of course, but piece by piece :-)
Comment 25 Raj Sarkar 2016-07-24 20:15:59 UTC
Since this is majorly a UI hack, the code pointers for the same are necessary. Can someone provide code pointers to the UI part where the media link should be shown?
I'm guessing the media link should be shown just below the media and should only be visible in edit mode. Is that so?
Some helpful pointers are given in comment 11, but again, there is a need for the pointers related to the UI, where I believe, most of the action will happen.
Comment 26 jani 2016-07-24 22:04:21 UTC
(In reply to Raj Sarkar from comment #25)
> Since this is majorly a UI hack, the code pointers for the same are
> necessary. Can someone provide code pointers to the UI part where the media
> link should be shown?
> I'm guessing the media link should be shown just below the media and should
> only be visible in edit mode. Is that so?
> Some helpful pointers are given in comment 11, but again, there is a need
> for the pointers related to the UI, where I believe, most of the action will
> happen.
Did you have a look at the following from comment 11, that is what you seek.

the context menu of the media object is apparently defined at Media_POPUP in
sd/source/ui/app/popup2_tmpl.src
Comment 27 abhilash300singh 2016-07-27 19:29:25 UTC
(In reply to jan iversen from comment #26)

> Did you have a look at the following from comment 11, that is what you seek.
> 
> the context menu of the media object is apparently defined at Media_POPUP in
> sd/source/ui/app/popup2_tmpl.src

Yes I did. That file(popup2_tmpl.src) no longer exists. Also, does it make sense to to show the file link in context menu? According to comment 23, the filename could be added to the media playback toolbar. That makes sense to me - the media playback toolbar, which is activated only when you click on the media, is very uncluttered and the file link would be easily noticeable there. What do you think? We might need UX help here. If this is indeed to be done, code pointers to UI of media playback toolbar would help.
Comment 28 jani 2016-07-28 13:06:02 UTC
(In reply to abhilash300singh from comment #27)
> (In reply to jan iversen from comment #26)
> 
> Yes I did. That file(popup2_tmpl.src) no longer exists. 

I gave you a hint, but not make the solution.
git log -- popup2_tmpl.src
shows you what happened to the file, and indrectly also where the content moved.

Have a look at 
popup.src

rgds
jan I.

, does it make
> sense to to show the file link in context menu? According to comment 23, the
> filename could be added to the media playback toolbar. That makes sense to
> me - the media playback toolbar, which is activated only when you click on
> the media, is very uncluttered and the file link would be easily noticeable
> there. What do you think? We might need UX help here. If this is indeed to
> be done, code pointers to UI of media playback toolbar would help.
Comment 29 jani 2016-08-03 05:35:57 UTC
unassigning
Comment 30 abhilash300singh 2016-08-14 08:15:46 UTC
The content in popup.src doesn't make sense with the context menu you get on right clicking media objects. The code pointer might be wrong. Comment 23 mentions about giving detailed code pointers, but doesn't do so. It would be great if the same happens. 

The code for playback toolbar is apparently located here - http://opengrok.libreoffice.org/xref/core/avmedia/source/framework/mediacontrol.cxx. We can just display a textlabel showing the file path in this toolbox. Items can be inserted in toolbox(maToolBox) using InsertItem function. The problem is, currently this function is overloaded only to handle insertion of buttons(play, pause etc). We need to insert a text label. If someone can mentor me in writing that function, this should be easy.
Comment 31 Katarina Behrens (CIB) 2016-08-16 21:21:57 UTC
Okay folks, no way this is an easy hack. difficultyInteresting at most and even that might be an overstatement

It is not possible to "just display a text label" in a toolbar. For adding something that looks like a text label (but it is a toolbar button in disguise) you need to 

1) create a fake UNO command (officecfg/*/Commands.xcu)- .uno:AVMediaURL or sth along that line
2) set it up to be text-only (no icon) and have it contain a placeholder text ('no media selected' or sth along that line)
3) add that command to media toolbar (sd/uiconfig/simpress/toolbar/mediaobjectbar.xml + all the other instances of that toolbar across all the modules)

(have a look for example at .uno:SearchLabel, that's a text label in search toolbar, for inspiration)

Next, those things need to be done:

4) When a new media is inserted, the placeholder text needs to be replaced with real media URL. The code for that is in sd/source/ui/func/fuinsert.cxx, FuInsertAVMedia class. You somehow need to get hold of the media toolbar, find the button disguised as text label and change the text on it. 

An useful piece of code doing just that (changing text on the label in search toolbar) is in svx/source/dialog/srchdlg.cxx, maybe you can re-use it

5) The same needs to be done when a media object is selected in a document. I don't know exactly where code for that is (but maybe someone else does?), I can however quickly find out once a patch implementing points 1-4 is up for review ;-)
Comment 32 jani 2016-08-16 21:34:07 UTC
agree with Bubli judgement. As a sidenote we should keep the good description of how to do this in the wiki
Comment 33 Katarina Behrens (CIB) 2016-08-18 12:04:00 UTC
Please ignore complete comment 31. I don't know what I was smoking before I wrote such an utter nonsense. But nevertheless, I still maintain that this task is at least difficultyInteresting

Go to avmedia/source/framework/mediacontrol.cxx (possibly MediaControlBase.cxx ... my GSoC student has been modifying that code recently). 

Insert a fixed text widget (VclPtr<FixedText>::Create)

Give it some reasonable initial size (look at what other SetSizePixel calls in this class are doing)

Position it (again, look at what other SetPosPixel calls in this class are doing)

Implement a method that will update it (implUpdateURLText?), it should retrieve media URL from MediaItem (maItem member variable) and does SetText($someURL) on your new fixed text widget accordingly

Add that method to the other methods called in setState()

Rinse and repeat until it compiles, works and all unit tests pass
Comment 34 Commit Notification 2016-09-02 16:23:31 UTC
Abhilash committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6228d6c52e4a6e6c0d82632a135211286e06852e

tdf#32581 Add the possibility to retrieve the filename of media

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 35 Jean-Baptiste Faure 2016-09-03 08:04:30 UTC
Hi Abhilash,

Thank you very much for your commit, now I see the location of the media file in the media toolbar, in both cases embedded media and linked media.
In the case of linked media, the link is not visible in menu Edition > Links. Do you plan to add the link there and to allow to break the link to transform a linked media in an embedded one as we can already do for images?

Best regards. JBF
Comment 36 abhilash300singh 2016-09-04 18:03:37 UTC
(In reply to Jean-Baptiste Faure from comment #35)
> Hi Abhilash,
> 
> Thank you very much for your commit, now I see the location of the media
> file in the media toolbar, in both cases embedded media and linked media.
> In the case of linked media, the link is not visible in menu Edition >
> Links. Do you plan to add the link there and to allow to break the link to
> transform a linked media in an embedded one as we can already do for images?
> 
> Best regards. JBF

Since I'm very new to LO, I'm mostly doing things as said/reviewed. I've no plans to do what you mention, as I wouldn't know where to begin. In case, what you mention is already a reported bug(easyhack preferably) and there are related code pointers, I surely have ample of free time to give it a try.

Thanks.
Comment 37 Katarina Behrens (CIB) 2016-09-05 07:18:39 UTC
@JB: I suggest that you file a new bug re: missing entries in Links... It will then no longer be an easy hack though.

Let's maybe then close this one as fixed
Comment 38 Jean-Baptiste Faure 2016-09-06 04:46:03 UTC
(In reply to Katarina Behrens (CIB) from comment #37)
> @JB: I suggest that you file a new bug re: missing entries in Links... It
> will then no longer be an easy hack though.
> 
> Let's maybe then close this one as fixed

You are right, I will do that.

Closing as Resolved - Fixed. Thank you very much :-)

Best regards. JBF