ccApplicationBase.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. //##########################################################################
  3. //# #
  4. //# CLOUDCOMPARE #
  5. //# #
  6. //# This program is free software; you can redistribute it and/or modify #
  7. //# it under the terms of the GNU General Public License as published by #
  8. //# the Free Software Foundation; version 2 or later of the License. #
  9. //# #
  10. //# This program 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. //# COPYRIGHT: CloudCompare project #
  16. //# #
  17. //##########################################################################
  18. #include "CCAppCommon.h"
  19. //Qt
  20. #include <QApplication>
  21. //! Mimic Qt's qApp for easy access to the application instance
  22. #define ccApp (static_cast<ccApplicationBase *>( QCoreApplication::instance() ))
  23. class CCAPPCOMMON_LIB_API ccApplicationBase : public QApplication
  24. {
  25. public:
  26. //! This must be called before instantiating the application class so it
  27. //! can setup OpenGL first.
  28. static void InitOpenGL();
  29. ccApplicationBase( int &argc, char **argv, bool isCommandLine, const QString &version );
  30. inline bool isCommandLine() const { return m_isCommandLine; }
  31. inline const QString& translationPath() const { return m_translationPath; }
  32. inline const QString& versionStr() const { return m_versionStr; }
  33. QString versionLongStr(bool includeOS) const;
  34. //! Set the application style (based on a QStyleFactory key)
  35. bool setAppStyle(QString styleKey);
  36. private:
  37. void setupPaths();
  38. const QString m_versionStr;
  39. QString m_shaderPath;
  40. QString m_translationPath;
  41. QStringList m_pluginPaths;
  42. const bool m_isCommandLine;
  43. };