ccviewerlog.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //##########################################################################
  2. //# #
  3. //# CLOUDCOMPARE LIGHT VIEWER #
  4. //# #
  5. //# This project has been initiated under funding from ANR/CIFRE #
  6. //# #
  7. //# This program is free software; you can redistribute it and/or modify #
  8. //# it under the terms of the GNU General Public License as published by #
  9. //# the Free Software Foundation; version 2 or later of the License. #
  10. //# #
  11. //# This program is distributed in the hope that it will be useful, #
  12. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  13. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  14. //# GNU General Public License for more details. #
  15. //# #
  16. //# +++ COPYRIGHT: EDF R&D + TELECOM ParisTech (ENST-TSI) +++ #
  17. //# #
  18. //##########################################################################
  19. #ifndef CCVIEWER_LOG_HEADER
  20. #define CCVIEWER_LOG_HEADER
  21. //Qt
  22. #include <QMessageBox>
  23. #include <QMainWindow>
  24. //qCC_db
  25. #include <ccLog.h>
  26. //! Minimalist logger (only displays error messages)
  27. class ccViewerLog : public ccLog
  28. {
  29. public:
  30. //! Default constructor
  31. explicit ccViewerLog(QMainWindow* parentWindow = 0) : ccLog(), m_parentWindow(parentWindow) {}
  32. protected:
  33. //inherited from ccLog
  34. virtual void logMessage(const QString& message, int level)
  35. {
  36. if (level & LOG_ERROR)
  37. {
  38. QMessageBox::warning(m_parentWindow, "Error", message);
  39. }
  40. }
  41. //! Associated window
  42. QMainWindow* m_parentWindow;
  43. };
  44. #endif // CCVIEWER_LOG_HEADER