Browse Source

React to image added events

master
Krisjanis Rijnieks 9 years ago
parent
commit
ed0ee4fd96
  1. 23
      src/Gui/Widgets/SourcesEditorWidget.cpp
  2. 3
      src/Gui/Widgets/SourcesEditorWidget.h
  3. 3
      src/MediaServer/DirectoryWatcher.h
  4. 3
      src/MediaServer/MediaServer.cpp

23
src/Gui/Widgets/SourcesEditorWidget.cpp

@ -5,13 +5,17 @@ namespace piMapper {
SourcesEditorWidget::SourcesEditorWidget(){
mediaServer = 0;
addMediaServerListeners();
}
void SourcesEditorWidget::setup(){
createSelectors();
}
void SourcesEditorWidget::createSelectors(){
imageSelector = new RadioList();
videoSelector = new RadioList();
fboSelector = new RadioList();
}
void SourcesEditorWidget::setup(){
int numImages = mediaServer->getNumImages();
int numVideos = mediaServer->getNumVideos();
int numFbos = mediaServer->getNumFboSources();
@ -48,7 +52,6 @@ void SourcesEditorWidget::setup(){
if(numFbos){
fboSelector->setPosition(menuPosX, 20);
}
}
void SourcesEditorWidget::draw(){
@ -119,8 +122,13 @@ void SourcesEditorWidget::setMediaServer(MediaServer * newMediaServer){
ofLogFatalError("SourcesEditorWidget") << "New media server is 0";
exit(EXIT_FAILURE);
}
if(mediaServer != 0){
removeMediaServerListeners();
}
clearMediaServer();
mediaServer = newMediaServer;
addMediaServerListeners();
}
MediaServer * SourcesEditorWidget::getMediaServer(){
@ -317,7 +325,12 @@ void SourcesEditorWidget::clearMediaServer(){
}
// TODO: There is no need for those at the moment. They add too much overhead.
void SourcesEditorWidget::handleImageAdded(string & path){}
void SourcesEditorWidget::handleImageAdded(string & path){
ofLogNotice("SourcesEditorWidget::handleImageAdded")
<< "Image path: "
<< path;
}
void SourcesEditorWidget::handleImageRemoved(string & path){}
void SourcesEditorWidget::handleVideoAdded(string & path){}
void SourcesEditorWidget::handleVideoRemoved(string & path){}

3
src/Gui/Widgets/SourcesEditorWidget.h

@ -44,6 +44,9 @@ class SourcesEditorWidget {
RadioList * videoSelector;
RadioList * fboSelector;
CmdManager * _cmdManager;
// Methods for creating and destroying the source selectors
void createSelectors();
// Methods for adding and removing listeners to the media server
void addMediaServerListeners();

3
src/MediaServer/DirectoryWatcher.h

@ -66,6 +66,9 @@ class DirectoryWatcher {
if(!filter->accept(pocoPath)){
return;
}
ofLogNotice("DirectoryWatcher::onDirectoryWatcherItemAdded")
<< "Added item: "
<< path;
filePaths.push_back(path);
ofNotifyEvent(onItemAdded, path, this);
}

3
src/MediaServer/MediaServer.cpp

@ -447,6 +447,9 @@ void MediaServer::unloadFboSource(string & fboSourceName){
} // unloadFboSource
void MediaServer::handleImageAdded(string & path){
ofLogNotice("MediaServer::handleImageAdded")
<< "Image path: "
<< path;
ofNotifyEvent(onImageAdded, path, this);
}
void MediaServer::handleImageRemoved(string & path){

Loading…
Cancel
Save