autoquerylist.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #ifndef __AUTOQUERYLIST_H
  2. #define __AUTOQUERYLIST_H
  3. #include "itemlistwnd.h"
  4. #include "../db/multiqueryserver.h"
  5. #include "../ptrlist.h"
  6. #include "../string.h"
  7. #include "../timeslicer.h"
  8. #include "../appcmds.h"
  9. #include "../../pledit/plhand.h"
  10. #include "../nakedobject.h"
  11. class svc_plDir;
  12. class Playlist;
  13. #define AUTOQUERYLIST_PARENT NakedObject
  14. #define AUTOQUERYLIST_DBPARENTSRV MultiQueryServerI
  15. /**
  16. Automates the display of the result set of
  17. a query.
  18. Simply create an AutoQueryList instance,
  19. set it's query with setQuery().
  20. Can send results to the playlist directory
  21. for automatic playlist creation based on
  22. the result of the query.
  23. @short Automated query result display window.
  24. @author Nullsoft
  25. @ver 1.0
  26. @see AutoFilterList
  27. */
  28. class AutoQueryList : public AUTOQUERYLIST_PARENT,
  29. public AUTOQUERYLIST_DBPARENTSRV, AppCmdsI {
  30. public:
  31. /**
  32. Initializes member data.
  33. */
  34. AutoQueryList();
  35. /**
  36. Releases playlist directory service and removes
  37. the AppCmd button.
  38. */
  39. virtual ~AutoQueryList();
  40. /**
  41. Initializes the auto query list.
  42. ret 1
  43. */
  44. virtual int onInit();
  45. /**
  46. Event is triggered when a playstring is added to the result list.
  47. Updates the progress bar at the bottom of the window (from 0 to 100%).
  48. @param playstring The playstring to being added to the result list.
  49. @param nitems The number of items (total) in the result list.
  50. @param thispos The current position in the list of items.
  51. */
  52. virtual void mqs_onAddPlaystring(const char *playstring, int nitems, int thispos);
  53. /**
  54. Event is triggered when a new query is set.
  55. Updates the progress bar to 0%, resets the playlist associated
  56. with this auto query list and resets the number of items found
  57. for the query to zero.
  58. */
  59. virtual void mqs_onNewMultiQuery();
  60. /**
  61. Event is triggered when a query completes.
  62. Updates the progress bar to 100% and resets the last
  63. known progress count.
  64. */
  65. virtual void mqs_onCompleteMultiQuery();
  66. virtual int onDeferredCallback(intptr_t p1, intptr_t p2);
  67. protected:
  68. /**
  69. Event is triggered when an AppCmd button (which belongs to this
  70. auto query list) is pushed.
  71. Only one command is handled by the auto query list which causes the query
  72. to be reset. The id of the command is 0.
  73. @param id The id of the command associated with the button that was pressed.
  74. @param rect The RECT of the button that was pushed.
  75. */
  76. virtual void appcmds_onCommand(int id, const RECT *buttonRect, int which_btn);
  77. virtual void onSetVisible(int v);
  78. private:
  79. int lastpc;
  80. int nfound;
  81. Playlist *playlist;
  82. svc_plDir *pldir;
  83. stdtimevalms last_status_update;
  84. };
  85. #endif