summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdwin Eefting <edwin@datux.nl>2013-01-23 20:41:21 (GMT)
committer Edwin Eefting <edwin@datux.nl>2013-01-23 20:41:21 (GMT)
commit606551a16d893916b8542a56621d6a5537222886 (patch)
tree82f17f75d9bdcad4a509dcc890d5bc39a1479f84
parent48ef5358b1197ac4364fc36256ba3dfda4f80d99 (diff)
improved directory navigator
-rw-r--r--modules/pl_dir.module/module.cpp3
-rw-r--r--wwwdir/mp.html88
2 files changed, 78 insertions, 13 deletions
diff --git a/modules/pl_dir.module/module.cpp b/modules/pl_dir.module/module.cpp
index 6578dfe..fe27588 100644
--- a/modules/pl_dir.module/module.cpp
+++ b/modules/pl_dir.module/module.cpp
@@ -517,6 +517,9 @@ namespace pl
out["currentPath"]=mCurrentPath.string();
out["currentFile"]=mCurrentFile.string();
+ //to make life easier for user interfaces in a crossplatform way:
+ out["parentPath"]=mCurrentPath.parent_path().string();
+
BOOST_FOREACH(path prevFile, mPrevFiles)
{
out["prevFiles"].list().push_back(prevFile.string());
diff --git a/wwwdir/mp.html b/wwwdir/mp.html
index 93f5597..0865add 100644
--- a/wwwdir/mp.html
+++ b/wwwdir/mp.html
@@ -60,38 +60,63 @@
synapse_register("pl_Entry",function(msg_src, msg_dst, msg_event, msg)
{
- var stripIndex=msg.currentPath.length;
$('.entry[key="rootPath"]').text(msg.rootPath);
- $('.entry[key="currentPath"]').text(msg.currentPath);
- $('.entry[key="currentFile"]').text(msg.currentFile.substr(stripIndex));
+ $('.entry[key="currentPath"]').text(msg.currentPath.substr(msg.parentPath.length));
+ $('.entry[key="parentPath"]').text(msg.parentPath);
+ $('.entry[key="currentFile"]').text(msg.currentFile.substr(msg.currentPath.length));
- //some dom magic going on here...for more of it and a better way to do it look at my kmur2 project
+ //some dom magic going on here...for more of it and a better way to do it look at the kmur2 project
//delete old clones
$(".entry.cloned").remove();
//next files
- var src=$('.entry[key="nextFiles"]');
+ var src=$('.entry_clone[key="nextFiles"]');
for (nr=msg['nextFiles'].length; nr--; nr>0)
{
var element=$(src).clone();
src.after(element);
element.addClass("cloned");
- $('.entry[key=nextFile]', element).text(msg.nextFiles[nr].substr(stripIndex));
+ //$('.entry[key="nextFiles"]', element).text(msg.nextFiles[nr].substr(msg.currentPath.length));
+ element.text(msg.nextFiles[nr].substr(msg.currentPath.length));
}
//prev files
- var src=$('.entry[key="prevFiles"]');
+ var src=$('.entry_clone[key="prevFiles"]');
for (nr=msg['prevFiles'].length; nr--; nr>0)
{
var element=$(src).clone();
src.before(element);
element.addClass("cloned");
- $('.entry[key=prevFile]', element).text(msg['prevFiles'][nr].substr(stripIndex));
+// $('.entry[key="prevFiles"]', element).text(msg['prevFiles'][nr].substr(msg.currentPath.length));
+ element.text(msg.prevFiles[nr].substr(msg.currentPath.length));
}
+ //next paths
+ var src=$('.entry_clone[key="nextPaths"]');
+ for (nr=msg['nextPaths'].length; nr--; nr>0)
+ {
+ var element=$(src).clone();
+ src.after(element);
+ element.addClass("cloned");
+ //$('.entry[key="nextFiles"]', element).text(msg.nextFiles[nr].substr(msg.currentPath.length));
+ element.text(msg.nextPaths[nr].substr(msg.parentPath.length));
+ }
+
+ //prev paths
+ var src=$('.entry_clone[key="prevPaths"]');
+ for (nr=msg['prevPaths'].length; nr--; nr>0)
+ {
+ var element=$(src).clone();
+ src.before(element);
+ element.addClass("cloned");
+ //$('.entry[key="nextFiles"]', element).text(msg.nextFiles[nr].substr(msg.currentPath.length));
+ element.text(msg.prevPaths[nr].substr(msg.parentPath.length));
+ }
+
+
});
synapse_register("play_Time",function(msg_src, msg_dst, msg_event, msg)
@@ -117,6 +142,17 @@
<style>
+ body
+ {
+ background-color: #000000;
+ color: #ffffff;
+ }
+
+ .selectedPath
+ {
+ background-color: #0000aa;
+ }
+
</style>
</head>
@@ -124,16 +160,42 @@
<body>
-
+Current path:
+<span class="entry selectedPath" key="parentPath"></span>
<table>
-<tr><th colspan=2>file navigator</tr>
-<tr class="entry" key="prevFiles"><td class="entry" key="prevFile"></tr>
-<tr><td style="background-color: #ccccff" class="entry" key="currentFile"></tr>
-<tr class="entry" key="nextFiles"> ><td class="entry" key="nextFile"></tr>
+<tr>
+ <td><button class="send" event="pl_PreviousPath">^^^ Previous directory ^^^</button>
+ <td><button class="send" event="pl_Previous">^^^ Previous song ^^^</button>
+
+</tr>
+<tr>
+ <td><div class="entry_clone entry" key="prevPaths"></div>
+ <td style="border-style: solid none none solid; "><div class="entry_clone entry" key="prevFiles"></div>
+</tr>
+<tr>
+ <td style="border-style: solid none solid none; " ><div class="entry selectedPath" key="currentPath"></div>
+ <td><div class="entry selectedPath" key="currentFile"></div>
+</tr>
+<tr>
+ <td><div class="entry_clone entry" key="nextPaths"></div>
+ <td style="border-style: none none solid solid; "><div class="entry_clone entry" key="nextFiles"></div>
+</tr>
+<tr>
+ <td>
+ <button class="send" event="pl_NextPath">vvv Next directory vvv</button>
+ <br>
+ <button class="send" event="pl_ExitPath">&lt;&lt;&lt; Exit directory</button>
+ <button class="send" event="pl_EnterPath">Enter directory&gt;&gt;&gt; </button>
+
+ <td><button class="send" event="pl_Next">vvv Next song vvv</button>
+
+</tr>
</table>
+
+
<table>
<tr><th colspan=2>filesystem data </tr>
<tr><th>Root dir <td class="entry" key="rootPath"></tr>