summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/yuzu/debugger/wait_tree.cpp52
1 files changed, 41 insertions, 11 deletions
diff --git a/src/yuzu/debugger/wait_tree.cpp b/src/yuzu/debugger/wait_tree.cpp
index 9bb0a0109..f391a41a9 100644
--- a/src/yuzu/debugger/wait_tree.cpp
+++ b/src/yuzu/debugger/wait_tree.cpp
@@ -2,9 +2,11 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <array>
5#include <fmt/format.h> 6#include <fmt/format.h>
6 7
7#include "yuzu/debugger/wait_tree.h" 8#include "yuzu/debugger/wait_tree.h"
9#include "yuzu/uisettings.h"
8#include "yuzu/util/util.h" 10#include "yuzu/util/util.h"
9 11
10#include "common/assert.h" 12#include "common/assert.h"
@@ -19,11 +21,37 @@
19#include "core/hle/kernel/thread.h" 21#include "core/hle/kernel/thread.h"
20#include "core/memory.h" 22#include "core/memory.h"
21 23
24namespace {
25
26constexpr std::array<std::array<Qt::GlobalColor, 2>, 10> WaitTreeColors{{
27 {Qt::GlobalColor::darkGreen, Qt::GlobalColor::green},
28 {Qt::GlobalColor::darkGreen, Qt::GlobalColor::green},
29 {Qt::GlobalColor::darkBlue, Qt::GlobalColor::cyan},
30 {Qt::GlobalColor::lightGray, Qt::GlobalColor::lightGray},
31 {Qt::GlobalColor::lightGray, Qt::GlobalColor::lightGray},
32 {Qt::GlobalColor::darkRed, Qt::GlobalColor::red},
33 {Qt::GlobalColor::darkYellow, Qt::GlobalColor::yellow},
34 {Qt::GlobalColor::red, Qt::GlobalColor::red},
35 {Qt::GlobalColor::darkCyan, Qt::GlobalColor::cyan},
36 {Qt::GlobalColor::gray, Qt::GlobalColor::gray},
37}};
38
39bool IsDarkTheme() {
40 const auto& theme = UISettings::values.theme;
41 return theme == QStringLiteral("qdarkstyle") || theme == QStringLiteral("colorful_dark");
42}
43
44} // namespace
45
22WaitTreeItem::WaitTreeItem() = default; 46WaitTreeItem::WaitTreeItem() = default;
23WaitTreeItem::~WaitTreeItem() = default; 47WaitTreeItem::~WaitTreeItem() = default;
24 48
25QColor WaitTreeItem::GetColor() const { 49QColor WaitTreeItem::GetColor() const {
26 return QColor(Qt::GlobalColor::black); 50 if (IsDarkTheme()) {
51 return QColor(Qt::GlobalColor::white);
52 } else {
53 return QColor(Qt::GlobalColor::black);
54 }
27} 55}
28 56
29std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeItem::GetChildren() const { 57std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeItem::GetChildren() const {
@@ -263,36 +291,38 @@ QString WaitTreeThread::GetText() const {
263} 291}
264 292
265QColor WaitTreeThread::GetColor() const { 293QColor WaitTreeThread::GetColor() const {
294 const std::size_t color_index = IsDarkTheme() ? 1 : 0;
295
266 const auto& thread = static_cast<const Kernel::Thread&>(object); 296 const auto& thread = static_cast<const Kernel::Thread&>(object);
267 switch (thread.GetStatus()) { 297 switch (thread.GetStatus()) {
268 case Kernel::ThreadStatus::Running: 298 case Kernel::ThreadStatus::Running:
269 return QColor(Qt::GlobalColor::darkGreen); 299 return QColor(WaitTreeColors[0][color_index]);
270 case Kernel::ThreadStatus::Ready: 300 case Kernel::ThreadStatus::Ready:
271 if (!thread.IsPaused()) { 301 if (!thread.IsPaused()) {
272 if (thread.WasRunning()) { 302 if (thread.WasRunning()) {
273 return QColor(Qt::GlobalColor::darkGreen); 303 return QColor(WaitTreeColors[1][color_index]);
274 } else { 304 } else {
275 return QColor(Qt::GlobalColor::darkBlue); 305 return QColor(WaitTreeColors[2][color_index]);
276 } 306 }
277 } else { 307 } else {
278 return QColor(Qt::GlobalColor::lightGray); 308 return QColor(WaitTreeColors[3][color_index]);
279 } 309 }
280 case Kernel::ThreadStatus::Paused: 310 case Kernel::ThreadStatus::Paused:
281 return QColor(Qt::GlobalColor::lightGray); 311 return QColor(WaitTreeColors[4][color_index]);
282 case Kernel::ThreadStatus::WaitHLEEvent: 312 case Kernel::ThreadStatus::WaitHLEEvent:
283 case Kernel::ThreadStatus::WaitIPC: 313 case Kernel::ThreadStatus::WaitIPC:
284 return QColor(Qt::GlobalColor::darkRed); 314 return QColor(WaitTreeColors[5][color_index]);
285 case Kernel::ThreadStatus::WaitSleep: 315 case Kernel::ThreadStatus::WaitSleep:
286 return QColor(Qt::GlobalColor::darkYellow); 316 return QColor(WaitTreeColors[6][color_index]);
287 case Kernel::ThreadStatus::WaitSynch: 317 case Kernel::ThreadStatus::WaitSynch:
288 case Kernel::ThreadStatus::WaitMutex: 318 case Kernel::ThreadStatus::WaitMutex:
289 case Kernel::ThreadStatus::WaitCondVar: 319 case Kernel::ThreadStatus::WaitCondVar:
290 case Kernel::ThreadStatus::WaitArb: 320 case Kernel::ThreadStatus::WaitArb:
291 return QColor(Qt::GlobalColor::red); 321 return QColor(WaitTreeColors[7][color_index]);
292 case Kernel::ThreadStatus::Dormant: 322 case Kernel::ThreadStatus::Dormant:
293 return QColor(Qt::GlobalColor::darkCyan); 323 return QColor(WaitTreeColors[8][color_index]);
294 case Kernel::ThreadStatus::Dead: 324 case Kernel::ThreadStatus::Dead:
295 return QColor(Qt::GlobalColor::gray); 325 return QColor(WaitTreeColors[9][color_index]);
296 default: 326 default:
297 return WaitTreeItem::GetColor(); 327 return WaitTreeItem::GetColor();
298 } 328 }