mainwindow-common.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef MAINWINDOWCOMMON_H
  2. #define MAINWINDOWCOMMON_H
  3. #include <QMainWindow>
  4. #include <QTableWidgetSelectionRange>
  5. #include <QMutex>
  6. #include "redmineitemtree.h"
  7. #include "roles.h"
  8. #include "memberships.h"
  9. #include "enumerations.h"
  10. #include "common.h"
  11. class MainWindowCommon : public QMainWindow
  12. {
  13. Q_OBJECT
  14. public:
  15. explicit MainWindowCommon ( QWidget *parent = 0 );
  16. ~MainWindowCommon();
  17. QList<QJsonObject> issues_get_byProjectId ( int project_id );
  18. /*
  19. * TODO: the next public stuff (but not slots) should be moved to
  20. * the protected section:
  21. */
  22. RedmineItemTree projects;
  23. RedmineItemTree issues;
  24. protected:
  25. static const int SORT_DEPTH = 3;
  26. enum ESortColumn {
  27. SORT_UNDEFINED = 0,
  28. SORT_NAME_ASC,
  29. SORT_NAME_DESC,
  30. SORT_ASSIGNEE_ASC,
  31. SORT_ASSIGNEE_DESC,
  32. SORT_DUE_TO_ASC,
  33. SORT_DUE_TO_DESC,
  34. SORT_STATUS_POS_ASC,
  35. SORT_STATUS_POS_DESC,
  36. SORT_UPDATED_ON_ASC,
  37. SORT_UPDATED_ON_DESC,
  38. SORT_STATUS_ISCLOSED_ASC,
  39. };
  40. typedef bool ( *sortfunct_t ) ( const QJsonObject &issue_a, const QJsonObject &issue_b );
  41. // TODO: deduplicate sortLogicalIndex+sortOrder and sortColumn
  42. int sortLogicalIndex = -1;
  43. Qt::SortOrder sortOrder;
  44. enum ESortColumn sortColumn[SORT_DEPTH];
  45. QMap <enum ESortColumn, sortfunct_t> sortFunctMap;
  46. /*
  47. * TODO: the next protected stuff (but not slots) should be moved to
  48. * the private section:
  49. */
  50. QHash<int, QList<QJsonObject>> issues_byProjectId;
  51. Roles roles;
  52. Memberships memberships;
  53. Enumerations enumerations;
  54. protected slots:
  55. int updateEnumerations();
  56. int updateMemberships();
  57. int updateProjects();
  58. int updateIssues();
  59. int updateRoles();
  60. signals:
  61. public slots:
  62. private:
  63. /* projects */
  64. virtual void projects_display();
  65. virtual void issues_display();
  66. void get_enumerations_callback ( QNetworkReply *reply, QJsonDocument *json, void *arg );
  67. void get_memberships_callback ( QNetworkReply *reply, QJsonDocument *json, void *arg );
  68. void get_projects_callback ( QNetworkReply *reply, QJsonDocument *json, void *arg );
  69. void get_issues_callback ( QNetworkReply *reply, QJsonDocument *json, void *arg );
  70. void get_roles_callback ( QNetworkReply *reply, QJsonDocument *json, void *arg );
  71. QMutex updateProjectsMutex;
  72. QMutex updateIssuesMutex;
  73. };
  74. #endif // MAINWINDOWCOMMON_H