Press "Enter" to skip to content

pimp my mythvideo: another navigation patch

I’ve been working on a bug all night I noticed the other day that really annoys me in Myth, and I stayed up poking at the code trying to find a way around it. Actually, it’s a little weird how I “discovered” it, since I always perceived in the back of my mind that there was something annoying, but never pinpointed it specifically what it was doing until this week.

The bug is this: when you are using gallery view in MythVideo and you enter a folder, when you exit back to the main root menu, it repositions that folder at the top, regardless of where it was when you entered the folder.

Some pictures will probably make more sense.

Here is a screenshot of what my folder display looks like when I enter MythVideo’s gallery for the first time, and browsing for a folder to select:

 

Now, when I select that directory, I’ll see the files in there. But when I hit Escape or select the previous folder icon, it will return me back to the root menu. However, the folder layout has changed, and the row that the folder is on, originally the bottom, is now at the top.

 

 

Moving around the position of the folder layout throws my brain for a loop every time it happens, because I’m expecting to see the same display as when I was just in there, and since it’s different I have to rescan the layout visually and reprocess where I am and where I want to navigate.

This patch fixes that, and keeps the layout the same when you return to the root window.

I went ahead and added a new ebuild in my personal overlay which will install it for you if you don’t want to patch it manually. The ebuild is mythvideo-0.20.2_p15087-r2.ebuild and it also includes my original navigation patch.

Now then, there’s one small bug in it that I’d like to fix, but I don’t know any Qt or C++, and it’s a miracle in itself that I managed to even get this far on my own. In fact, I’m quite proud of myself actually that I even figured this one out all by myself, go me. 🙂

I originally patched it so that it would just reposition the parent view around the last folder row you were in … that is, I was doing the same thing, but not specifically for the root menu, just any folder you went into. That worked fine, provided your tree didn’t have more than one level. The second you went into a third directory Home -> Foo -> Bar, the 2nd variable would overwrite the first one so when you returned to the parent it would be whacked. If that makes any sense. Anyway, for someone with Qt knowledge, it shouldn’t be hard to fix so that it always does that no matter which folder you are in, and at what depth level. I have no idea how, though.

It’s actually kinda interesting how I figured this one out. There were two things I noticed from poking around in the code. One, to get videogallery to dump out variables to stdout, I would add this to the code:

VERBOSE(VB_GENERAL, QString(“Some text.”));

VERBOSE(VB_GENERAL, QString(“Some variable: %1”).arg(someVar));

Yah, brilliant hacking on my part, I know, but I managed to kludge my way through it and figure it out.

The second thing I realized was that if I wanted to find out if I was on the parent tree or not, I would have to create a new instance of GenericTree and check to see if getParent() returned the main root or not.

GenericTree *lparent = where_we_are->getParent();

Then, if lparent != video_tree_root you would know you’re not at the top yet.

Anyway, yah, my awesome debugging skillz at work there, but hey — it took a lot of patience and more than a few rebuilds, but it worked, and I’m happy. Woots.

One last thing — the patch will also apply cleanly against current SVN (r18336 as of this writing) since it hasn’t changed in a good while, so you don’t have to use my ebuild if you don’t want, or you could just rename it to the latest snapshot in portage and it’ll still apply.