1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#ifndef TASKWINDOW_H
6#define TASKWINDOW_H
7
8#include <QWidget>
9
10QT_BEGIN_NAMESPACE
11class QAction;
12class QModelIndex;
13class QPoint;
14QT_END_NAMESPACE
15
16namespace ReverseDebugger {
17namespace Internal {
18class Task;
19class TaskWindowPrivate;
20
21class TaskWindow : public QObject
22{
23 Q_OBJECT
24public:
25 explicit TaskWindow();
26 ~TaskWindow();
27
28 void delayedInitialization();
29
30 int taskCount(const QString &category = "") const;
31
32 // IOutputPane
33 QWidget *outputWidget() const;
34 QList<QWidget *> toolBarWidgets() const;
35
36 QString displayName() const { return tr("Events"); }
37 int priorityInStatusBar() const;
38 void clearContents();
39 void visibilityChanged(bool visible);
40
41 bool canFocus() const;
42 bool hasFocus() const;
43 void setFocus();
44
45 bool canNavigate() const;
46 bool canNext() const;
47 bool canPrevious() const;
48 void goToNext();
49 void goToPrev();
50 void goTo(int index);
51 void addTask(const Task &task);
52 void removeTask(const Task &task);
53 void addCategory(const QString &categoryId, const QString &displayName, bool visible);
54 void updateTimeline(void* timeline, int count);
55
56signals:
57 void tasksChanged();
58 void tasksCleared();
59 void coredumpChanged(int index);
60
61 // parent
62 void setBadgeNumber(int number);
63 void navigateStateUpdate();
64
65public slots:
66 void execCommand(void);
67 void sortEvent(int index);
68
69 // parent
70 void navigateStateChanged() { emit navigateStateUpdate(); }
71
72private:
73 void setupUi();
74 void showTask(unsigned int id);
75 void openTask(unsigned int id);
76 void clearTasks(const QString &categoryId);
77 void setCategoryVisibility(const QString &categoryId, bool visible);
78 void currentChanged(const QModelIndex &index);
79 void saveSettings();
80 void loadSettings();
81
82 void triggerDefaultHandler(const QModelIndex &index);
83 void clickItem(const QModelIndex &index);
84 void actionTriggered();
85 void updateCategoriesMenu();
86
87 TaskWindowPrivate *const d;
88};
89
90} // namespace Internal
91} // namespace ReverseDebugger
92
93#endif // TASKWINDOW_H
94