|
|
@ -3,8 +3,20 @@ |
|
|
|
namespace ofx { |
|
|
|
namespace piMapper { |
|
|
|
SourcesEditor::SourcesEditor() { |
|
|
|
defImgDir = DEFAULT_IMAGES_DIR; |
|
|
|
registerAppEvents(); |
|
|
|
init(); |
|
|
|
|
|
|
|
// Create new MediaServer instance,
|
|
|
|
// we will need to clear this in the deconstr
|
|
|
|
mediaServer = new MediaServer(); |
|
|
|
isMediaServerExternal = false; |
|
|
|
} |
|
|
|
|
|
|
|
SourcesEditor::SourcesEditor(MediaServer* externalMediaServer) { |
|
|
|
init(); |
|
|
|
|
|
|
|
// Assign external MediaServer instance pointer
|
|
|
|
mediaServer = externalMediaServer; |
|
|
|
isMediaServerExternal = true; |
|
|
|
} |
|
|
|
|
|
|
|
SourcesEditor::~SourcesEditor() { |
|
|
@ -14,6 +26,23 @@ SourcesEditor::~SourcesEditor() { |
|
|
|
delete images.back(); |
|
|
|
images.pop_back(); |
|
|
|
} |
|
|
|
|
|
|
|
// If mediaServer is local, clear it
|
|
|
|
if (isMediaServerExternal) { |
|
|
|
// Clear all loaded sources
|
|
|
|
//mediaServer->clear()
|
|
|
|
// Destroy the pointer and set it to NULL pointer
|
|
|
|
delete mediaServer; |
|
|
|
mediaServer = NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Initialize instance variables
|
|
|
|
void SourcesEditor::init() { |
|
|
|
mediaServer = NULL; |
|
|
|
isMediaServerExternal = false; |
|
|
|
defImgDir = DEFAULT_IMAGES_DIR; |
|
|
|
registerAppEvents(); |
|
|
|
} |
|
|
|
|
|
|
|
void SourcesEditor::registerAppEvents() { |
|
|
|