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(){ SourcesEditorWidget::SourcesEditorWidget(){
mediaServer = 0; mediaServer = 0;
addMediaServerListeners(); }
void SourcesEditorWidget::setup(){
createSelectors();
}
void SourcesEditorWidget::createSelectors(){
imageSelector = new RadioList(); imageSelector = new RadioList();
videoSelector = new RadioList(); videoSelector = new RadioList();
fboSelector = new RadioList(); fboSelector = new RadioList();
}
void SourcesEditorWidget::setup(){
int numImages = mediaServer->getNumImages(); int numImages = mediaServer->getNumImages();
int numVideos = mediaServer->getNumVideos(); int numVideos = mediaServer->getNumVideos();
int numFbos = mediaServer->getNumFboSources(); int numFbos = mediaServer->getNumFboSources();
@ -48,7 +52,6 @@ void SourcesEditorWidget::setup(){
if(numFbos){ if(numFbos){
fboSelector->setPosition(menuPosX, 20); fboSelector->setPosition(menuPosX, 20);
} }
} }
void SourcesEditorWidget::draw(){ void SourcesEditorWidget::draw(){
@ -119,8 +122,13 @@ void SourcesEditorWidget::setMediaServer(MediaServer * newMediaServer){
ofLogFatalError("SourcesEditorWidget") << "New media server is 0"; ofLogFatalError("SourcesEditorWidget") << "New media server is 0";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if(mediaServer != 0){
removeMediaServerListeners();
}
clearMediaServer(); clearMediaServer();
mediaServer = newMediaServer; mediaServer = newMediaServer;
addMediaServerListeners();
} }
MediaServer * SourcesEditorWidget::getMediaServer(){ 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. // 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::handleImageRemoved(string & path){}
void SourcesEditorWidget::handleVideoAdded(string & path){} void SourcesEditorWidget::handleVideoAdded(string & path){}
void SourcesEditorWidget::handleVideoRemoved(string & path){} void SourcesEditorWidget::handleVideoRemoved(string & path){}

3
src/Gui/Widgets/SourcesEditorWidget.h

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

3
src/MediaServer/DirectoryWatcher.h

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

3
src/MediaServer/MediaServer.cpp

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

Loading…
Cancel
Save