ctkCmdLineModuleDirectoryWatcher.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) University College London
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =============================================================================*/
  14. #ifndef __ctkCmdLineModuleDirectoryWatcher_h
  15. #define __ctkCmdLineModuleDirectoryWatcher_h
  16. #include <ctkCommandLineModulesCoreExport.h>
  17. #include "ctkCmdLineModuleReference.h"
  18. #include <QObject>
  19. #include <QScopedPointer>
  20. class ctkCmdLineModuleManager;
  21. class ctkCmdLineModuleDirectoryWatcherPrivate;
  22. /**
  23. * \class ctkCmdLineModuleDirectoryWatcher
  24. * \brief Provides directory scanning to automatically load new modules
  25. * into a ctkCmdLineModuleManager.
  26. * \ingroup CommandLineModulesCore
  27. * \author m.clarkson@ucl.ac.uk
  28. *
  29. * This class provides directory scanning and automatic loading of command
  30. * line modules. The client should call setDirectories() to set the list of
  31. * directories, and listen to the signal modulesChanged to know when to
  32. * re-build the GUI representation.
  33. */
  34. class CTK_CMDLINEMODULECORE_EXPORT ctkCmdLineModuleDirectoryWatcher
  35. : public QObject
  36. {
  37. Q_OBJECT
  38. public:
  39. ctkCmdLineModuleDirectoryWatcher(ctkCmdLineModuleManager* moduleManager);
  40. virtual ~ctkCmdLineModuleDirectoryWatcher();
  41. /**
  42. * \brief Set the watcher into debug mode, for more output.
  43. * \param debug if true, you get more output, otherwise, less output.
  44. */
  45. void setDebug(bool debug);
  46. /**
  47. * \brief Set the directories to be watched.
  48. * \param directories a StringList of directory names. If any of these are
  49. * invalid, they will be filtered out and ignored.
  50. */
  51. void setDirectories(const QStringList& directories);
  52. /**
  53. * \brief Returns the list of directories currently being watched.
  54. */
  55. QStringList directories() const;
  56. /**
  57. * \brief Returns the list of files (command line apps)
  58. * currently being watched.
  59. */
  60. QStringList files() const;
  61. private:
  62. QScopedPointer<ctkCmdLineModuleDirectoryWatcherPrivate> d;
  63. Q_DISABLE_COPY(ctkCmdLineModuleDirectoryWatcher)
  64. };
  65. #endif // __ctkCmdLineModuleDirectoryWatcher_h