ccViewerApplication.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //##########################################################################
  2. //# #
  3. //# CLOUDCOMPARE #
  4. //# #
  5. //# This program is free software; you can redistribute it and/or modify #
  6. //# it under the terms of the GNU General Public License as published by #
  7. //# the Free Software Foundation; version 2 or later of the License. #
  8. //# #
  9. //# This program is distributed in the hope that it will be useful, #
  10. //# but WITHOUT ANY WARRANTY; without even the implied warranty of #
  11. //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
  12. //# GNU General Public License for more details. #
  13. //# #
  14. //# COPYRIGHT: CloudCompare project #
  15. //# #
  16. //##########################################################################
  17. #include <QtGlobal>
  18. #ifdef Q_OS_MAC
  19. #include <QFileOpenEvent>
  20. #endif
  21. #include "ccviewer.h"
  22. #include "ccViewerApplication.h"
  23. ccViewerApplication::ccViewerApplication( int &argc, char **argv, bool isCommandLine )
  24. : ccApplicationBase( argc, argv, isCommandLine, QString( "1.41 (%1)" ).arg(__DATE__))
  25. {
  26. setApplicationName( "CloudCompareViewer" );
  27. }
  28. void ccViewerApplication::setViewer(ccViewer *inViewer)
  29. {
  30. mViewer = inViewer;
  31. }
  32. bool ccViewerApplication::event(QEvent *inEvent)
  33. {
  34. #ifdef Q_OS_MAC
  35. switch ( inEvent->type() )
  36. {
  37. case QEvent::FileOpen:
  38. {
  39. if ( mViewer == nullptr )
  40. {
  41. return false;
  42. }
  43. mViewer->addToDB( { static_cast<QFileOpenEvent *>(inEvent)->file() } );
  44. return true;
  45. }
  46. default:
  47. break;
  48. }
  49. #endif
  50. return ccApplicationBase::event( inEvent );
  51. }