source-label.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /******************************************************************************
  2. Copyright (C) 2015 by Ruwen Hahn <[email protected]>
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ******************************************************************************/
  14. #include "source-label.hpp"
  15. void OBSSourceLabel::SourceRenamed(void *data, calldata_t *params)
  16. {
  17. auto &label = *static_cast<OBSSourceLabel *>(data);
  18. const char *name = calldata_string(params, "new_name");
  19. label.setText(name);
  20. emit label.Renamed(name);
  21. }
  22. void OBSSourceLabel::SourceRemoved(void *data, calldata_t *)
  23. {
  24. auto &label = *static_cast<OBSSourceLabel *>(data);
  25. emit label.Removed();
  26. }
  27. void OBSSourceLabel::SourceDestroyed(void *data, calldata_t *)
  28. {
  29. auto &label = *static_cast<OBSSourceLabel *>(data);
  30. emit label.Destroyed();
  31. label.destroyedSignal.Disconnect();
  32. label.removedSignal.Disconnect();
  33. label.renamedSignal.Disconnect();
  34. }