Bibletime – a bible study tool
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cdisplaytemplatemgr.h 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. //
  2. // C++ Interface: cdisplaytemplatemgr
  3. //
  4. // Description:
  5. //
  6. //
  7. // Author: The BibleTime team <info@bibletime.info>, (C) 2004
  8. //
  9. // Copyright: See COPYING file that comes with this distribution
  10. //
  11. //
  12. #ifndef CDISPLAYTEMPLATEMGR_H
  13. #define CDISPLAYTEMPLATEMGR_H
  14. //BibleTime include
  15. #include "cswordmoduleinfo.h"
  16. //Qt includes
  17. #include <tqmap.h>
  18. #include <tqstring.h>
  19. #include <tqstringlist.h>
  20. //KDE includes
  21. #include <klocale.h>
  22. /**
  23. * Manages the display templates used in the filters and display classes.
  24. * @author The BibleTime team
  25. */
  26. class CDisplayTemplateMgr {
  27. public:
  28. /** Settings which are used to fill the content into the template.
  29. */
  30. struct Settings {
  31. /** Constructor. Constructs the new settings object. The default values are empty.
  32. */
  33. Settings() {
  34. title = TQString::null;
  35. langAbbrev = TQString::null;
  36. pageCSS_ID = TQString::null;
  37. pageDirection = TQString("ltr");
  38. };
  39. ListCSwordModuleInfo modules; /**< the list of modules */
  40. TQString title; /**< the title which is used for the new processed HTML page */
  41. TQString langAbbrev; /**< the language for the HTML page. */
  42. TQString pageDirection; /**< the language for the HTML page. */
  43. TQString pageCSS_ID; /**< the CSS ID which is used in the content part of the page */
  44. };
  45. /** Available templates.
  46. * @return The list of templates, which are available.
  47. */
  48. inline const TQStringList availableTemplates();
  49. /** Fill template. Fill rendered content into the template given by the name.
  50. * @param name The name of the template
  51. * @param content The content which should be filled into the template
  52. * @param settings The settings which are used to process the templating process
  53. * @return The full HTML template HTML code including the CSS data.
  54. */
  55. const TQString fillTemplate( const TQString& name, const TQString& content, Settings& settings);
  56. /** Default template.
  57. * @return The i18n'ed name of the default template
  58. */
  59. inline static const TQString defaultTemplate();
  60. protected:
  61. friend class CPointers;
  62. /** Display template manager constructor. Protected to just allow CPointers to create objects.
  63. */
  64. CDisplayTemplateMgr();
  65. /** Destructor.
  66. */
  67. ~CDisplayTemplateMgr();
  68. void loadUserTemplates();
  69. private:
  70. void init();
  71. TQMap<TQString, TQString> m_templateMap;
  72. };
  73. inline const TQString CDisplayTemplateMgr::defaultTemplate() {
  74. return i18n("Default");
  75. }
  76. /**
  77. * CDisplayTemplateMgr::availableTemplates()
  78. */
  79. inline const TQStringList CDisplayTemplateMgr::availableTemplates() {
  80. return m_templateMap.keys();
  81. }
  82. #endif