From f60e83a1b53c6e0900e7df32c4a4c3d27a8934cc Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sun, 25 Sep 2016 14:48:05 +0300 Subject: [PATCH] Remove useless SourcesEditor code --- src/UserInterface/SourcesEditor.cpp | 35 +++-------------------------- src/UserInterface/SourcesEditor.h | 8 ------- 2 files changed, 3 insertions(+), 40 deletions(-) diff --git a/src/UserInterface/SourcesEditor.cpp b/src/UserInterface/SourcesEditor.cpp index ca6da70..5fbce5d 100644 --- a/src/UserInterface/SourcesEditor.cpp +++ b/src/UserInterface/SourcesEditor.cpp @@ -4,32 +4,14 @@ namespace ofx { namespace piMapper { SourcesEditor::SourcesEditor(){ - init(); - mediaServer = 0; - isMediaServerExternal = false; addMediaServerListeners(); - imageSelector = new RadioList(); videoSelector = 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(){ - // Get media count int numImages = mediaServer->getNumImages(); int numVideos = mediaServer->getNumVideos(); int numFbos = mediaServer->getNumFboSources(); @@ -132,17 +114,12 @@ void SourcesEditor::setCmdManager(CmdManager * cmdManager){ } void SourcesEditor::setMediaServer(MediaServer * newMediaServer){ - // If the new media server is not valid if(newMediaServer == 0){ - // Log an error and return from the routine ofLogFatalError("SourcesEditor") << "New media server is 0"; exit(EXIT_FAILURE); } - // Attempt to clear existing media server and assign new one clearMediaServer(); - mediaServer = newMediaServer; - isMediaServerExternal = true; } MediaServer * SourcesEditor::getMediaServer(){ @@ -333,15 +310,9 @@ void SourcesEditor::clearMediaServer(){ if(mediaServer == 0){ return; } - - // If mediaServer is local, clear it - if(!isMediaServerExternal){ - // Clear all loaded sources - mediaServer->clear(); - // Destroy the pointer and set it to 0 pointer - delete mediaServer; - mediaServer = 0; - } + mediaServer->clear(); + delete mediaServer; + mediaServer = 0; } void SourcesEditor::handleImageAdded(string & path){} diff --git a/src/UserInterface/SourcesEditor.h b/src/UserInterface/SourcesEditor.h index a9eb351..7f614e0 100644 --- a/src/UserInterface/SourcesEditor.h +++ b/src/UserInterface/SourcesEditor.h @@ -14,7 +14,6 @@ namespace piMapper { class SourcesEditor { public: SourcesEditor(); - ~SourcesEditor(); void setup(); void draw(); @@ -46,13 +45,6 @@ class SourcesEditor { RadioList * fboSelector; 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 void addMediaServerListeners(); void removeMediaServerListeners();