TraceConfig.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*\
  2. |*| Copyright 2015-2016 bill-auger <https://github.com/bill-auger/av-caster/issues>
  3. |*|
  4. |*| This file is part of the AvCaster program.
  5. |*|
  6. |*| AvCaster is free software: you can redistribute it and/or modify
  7. |*| it under the terms of the GNU General Public License version 3
  8. |*| as published by the Free Software Foundation.
  9. |*|
  10. |*| AvCaster is distributed in the hope that it will be useful,
  11. |*| but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. |*| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. |*| GNU General Public License for more details.
  14. |*|
  15. |*| You should have received a copy of the GNU General Public License
  16. |*| along with AvCaster. If not, see <http://www.gnu.org/licenses/>.
  17. \*/
  18. #ifndef _TRACECONFIG_H_
  19. #define _TRACECONFIG_H_
  20. #ifdef DEBUG_TRACE
  21. # include "Trace.h"
  22. # define DEBUG_TRACE_CONFIG_LOAD_CONFIG \
  23. String preset_name = STRING(this->configStore[CONFIG::PRESET_NAME_ID]) ; \
  24. Trace::TraceGui("loading preset '" + preset_name + "'") ; \
  25. DEBUG_TRACE_DUMP_CONFIG(this->configStore , "volatile") ;
  26. # define DEBUG_TRACE_SET_CREATE_PRESET_MODE \
  27. bool has_mode_changed = is_pending_new_preset_name != isCreatePresetMode() ; \
  28. if (has_mode_changed) \
  29. Trace::TraceGui(String((is_pending_new_preset_name) ? "entering create preset mode" : \
  30. "exiting create preset mode" )) ;
  31. # define DEBUG_TRACE_CREATE_PRESET \
  32. bool should_update = !is_create_preset_mode && !should_rename_preset ; \
  33. bool is_rejecting = is_empty_preset_name || (is_name_collision && !should_update) ; \
  34. String preset = String((should_update) ? stored_name : preset_name) ; \
  35. if (is_rejecting ) Trace::TraceGui("rejecting preset '" + preset + "'") ; \
  36. else if (is_create_preset_mode) Trace::TraceGui("creating preset '" + preset + "'") ; \
  37. else if (should_rename_preset ) Trace::TraceGui("renaming preset '" + preset + "'") ; \
  38. else Trace::TraceGui("updating preset '" + preset + "'") ; \
  39. String pad = "\n " ; \
  40. Trace::TraceGuiVb(String("handling preset change '") + preset_name + "'" + \
  41. pad + "stored_preset_name = '" + String(stored_name ) + "'" + \
  42. pad + "option_n = " + String(option_n ) + \
  43. pad + "stored_option_n = " + String(stored_idx ) + \
  44. pad + "is_valid_option = " + String(is_valid_option ) + \
  45. pad + "is_static_preset = " + String(is_static_preset ) + \
  46. pad + "is_empty_preset_name = " + String(is_empty_preset_name ) + \
  47. pad + "has_selection_changed = " + String(has_selection_changed) + \
  48. pad + "has_name_changed = " + String(has_name_changed ) + \
  49. pad + "is_static_preset = " + String(is_static_preset ) ) ;
  50. #else // DEBUG_TRACE
  51. # define DEBUG_TRACE_CONFIG_LOAD_CONFIG ;
  52. # define DEBUG_TRACE_SET_CREATE_PRESET_MODE ;
  53. # define DEBUG_TRACE_CREATE_PRESET ;
  54. #endif // DEBUG_TRACE
  55. #endif // _TRACECONFIG_H_