MCPcopy Create free account
hub / github.com/clementgallet/libTAS / data

Method data

src/program/ui/MarkerModel.cpp:68–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68QVariant MarkerModel::data(const QModelIndex &index, int role) const
69{
70 unsigned int row = index.row();
71
72 if (row >= movie->editor->markers.size())
73 return QVariant();
74
75 auto it = movie->editor->markers.cbegin();
76 std::advance(it, row);
77 uint64_t framecount = (uint64_t)it->first;
78 const std::string& text = it->second;
79
80 if (role == Qt::TextAlignmentRole) {
81 return Qt::AlignCenter;
82 }
83
84 if (role == Qt::BackgroundRole) {
85 /* Main color */
86 QColor color = QGuiApplication::palette().window().color();
87 bool lightTheme = isLightTheme();
88 int r, g, b;
89 color.getRgb(&r, &g, &b, nullptr);
90
91 /* Greenzone */
92 uint64_t root_frame = SaveStateList::rootStateFramecount();
93 bool greenzone = (framecount < context->framecount) && root_frame && (framecount >= root_frame);
94
95 if (lightTheme) {
96 /* Light theme */
97 if (framecount == context->framecount)
98 color.setRgb(r - 0x30, g - 0x10, b);
99 else if (framecount < context->framecount) {
100 if (greenzone)
101 color.setRgb(r - 0x30, g, b - 0x30);
102 else
103 color.setRgb(r - 0x20, g, b - 0x20);
104 }
105 else {
106 color.setRgb(r, g, b - 0x10);
107 }
108 }
109 else {
110 /* Dark theme */
111 if (framecount == context->framecount)
112 color.setRgb(r, g + 0x10, b + 0x20);
113 else if (framecount < context->framecount) {
114 if (greenzone)
115 color.setRgb(r, g + 0x30, b);
116 else
117 color.setRgb(r, g + 0x18, b);
118 }
119 else {
120 color.setRgb(r + 0x08, g + 0x08, b);
121 }
122 }
123
124 return QBrush(color);
125 }

Callers 15

receiveStringFunction · 0.45
sendMethod · 0.45
clearMethod · 0.45
recvMethod · 0.45
hasMaskMethod · 0.45
FindAVX2Method · 0.45
FindCommonMethod · 0.45
mousePressEventMethod · 0.45
mouseDoubleClickEventMethod · 0.45
slotSaveStateMethod · 0.45
createEditorMethod · 0.45

Calls 6

isLightThemeFunction · 0.85
windowMethod · 0.80
columnMethod · 0.80
sizeMethod · 0.45
cbeginMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected