ctkCmdLineModuleDirectoryWatcher.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 load new modules into a ctkCmdLineModuleManager.
  25. * \ingroup CommandLineModulesCore
  26. * \author m.clarkson@ucl.ac.uk
  27. *
  28. * This class provides directory scanning and automatic loading of command line modules.
  29. * The client should call setDirectories() to set the list of directories, and listen
  30. * to the signal modulesChanged to know when to re-build the GUI representation.
  31. */
  32. class CTK_CMDLINEMODULECORE_EXPORT ctkCmdLineModuleDirectoryWatcher : public QObject
  33. {
  34. Q_OBJECT
  35. public:
  36. ctkCmdLineModuleDirectoryWatcher(ctkCmdLineModuleManager* moduleManager);
  37. virtual ~ctkCmdLineModuleDirectoryWatcher();
  38. /**
  39. * \brief Set the watcher into debug mode, for more output.
  40. * \param debug if true, you get more output, otherwise, less output.
  41. */
  42. void setDebug(bool debug);
  43. /**
  44. * \brief Set the directories to be watched.
  45. * \param directories a StringList of directory names. If any of these are invalid, they will be filtered out and ignored.
  46. */
  47. void setDirectories(const QStringList& directories);
  48. /**
  49. * \brief Returns the list of directories currently being watched.
  50. */
  51. QStringList directories() const;
  52. /**
  53. * \brief Returns the list of files (command line apps) currently being watched.
  54. */
  55. QStringList files() const;
  56. private:
  57. QScopedPointer<ctkCmdLineModuleDirectoryWatcherPrivate> d;
  58. Q_DISABLE_COPY(ctkCmdLineModuleDirectoryWatcher)
  59. };
  60. #endif // __ctkCmdLineModuleDirectoryWatcher_h