Browse Source

Remove useless SourcesEditor code

master
Krisjanis Rijnieks 9 years ago
parent
commit
f60e83a1b5
  1. 29
      src/UserInterface/SourcesEditor.cpp
  2. 8
      src/UserInterface/SourcesEditor.h

29
src/UserInterface/SourcesEditor.cpp

@ -4,32 +4,14 @@ namespace ofx {
namespace piMapper { namespace piMapper {
SourcesEditor::SourcesEditor(){ SourcesEditor::SourcesEditor(){
init();
mediaServer = 0; mediaServer = 0;
isMediaServerExternal = false;
addMediaServerListeners(); addMediaServerListeners();
imageSelector = new RadioList(); imageSelector = new RadioList();
videoSelector = new RadioList(); videoSelector = new RadioList();
fboSelector = new RadioList(); fboSelector = new RadioList();
} }
void SourcesEditor::init(){
mediaServer = 0; // Pointers to 0 pointer so we can check later
isMediaServerExternal = false;
}
SourcesEditor::~SourcesEditor(){
delete imageSelector;
delete videoSelector;
delete fboSelector;
clearMediaServer();
}
void SourcesEditor::setup(){ void SourcesEditor::setup(){
// Get media count
int numImages = mediaServer->getNumImages(); int numImages = mediaServer->getNumImages();
int numVideos = mediaServer->getNumVideos(); int numVideos = mediaServer->getNumVideos();
int numFbos = mediaServer->getNumFboSources(); int numFbos = mediaServer->getNumFboSources();
@ -132,17 +114,12 @@ void SourcesEditor::setCmdManager(CmdManager * cmdManager){
} }
void SourcesEditor::setMediaServer(MediaServer * newMediaServer){ void SourcesEditor::setMediaServer(MediaServer * newMediaServer){
// If the new media server is not valid
if(newMediaServer == 0){ if(newMediaServer == 0){
// Log an error and return from the routine
ofLogFatalError("SourcesEditor") << "New media server is 0"; ofLogFatalError("SourcesEditor") << "New media server is 0";
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
// Attempt to clear existing media server and assign new one
clearMediaServer(); clearMediaServer();
mediaServer = newMediaServer; mediaServer = newMediaServer;
isMediaServerExternal = true;
} }
MediaServer * SourcesEditor::getMediaServer(){ MediaServer * SourcesEditor::getMediaServer(){
@ -333,16 +310,10 @@ void SourcesEditor::clearMediaServer(){
if(mediaServer == 0){ if(mediaServer == 0){
return; return;
} }
// If mediaServer is local, clear it
if(!isMediaServerExternal){
// Clear all loaded sources
mediaServer->clear(); mediaServer->clear();
// Destroy the pointer and set it to 0 pointer
delete mediaServer; delete mediaServer;
mediaServer = 0; mediaServer = 0;
} }
}
void SourcesEditor::handleImageAdded(string & path){} void SourcesEditor::handleImageAdded(string & path){}
void SourcesEditor::handleImageRemoved(string & path){} void SourcesEditor::handleImageRemoved(string & path){}

8
src/UserInterface/SourcesEditor.h

@ -14,7 +14,6 @@ namespace piMapper {
class SourcesEditor { class SourcesEditor {
public: public:
SourcesEditor(); SourcesEditor();
~SourcesEditor();
void setup(); void setup();
void draw(); void draw();
@ -46,13 +45,6 @@ class SourcesEditor {
RadioList * fboSelector; RadioList * fboSelector;
CmdManager * _cmdManager; CmdManager * _cmdManager;
// Is the media server pointer local or from somewhere else?
// We use this to determine if we are allowed to clear media server locally.
bool isMediaServerExternal;
// Init handles variable initialization in all constructors
void init();
// 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();

Loading…
Cancel
Save