| 174 | } |
| 175 | |
| 176 | QVariant InputEditorModel::data(const QModelIndex &index, int role) const |
| 177 | { |
| 178 | unsigned int row = index.row(); |
| 179 | unsigned int col = index.column(); |
| 180 | |
| 181 | if (col == columnCount() - 1) |
| 182 | return QVariant(); |
| 183 | |
| 184 | if (role == Qt::TextAlignmentRole) { |
| 185 | return Qt::AlignCenter; |
| 186 | } |
| 187 | |
| 188 | if (role == Qt::FontRole) { |
| 189 | QFont font; |
| 190 | if (col == COLUMN_SAVESTATE && row == last_savestate) { |
| 191 | font.setBold(true); |
| 192 | } |
| 193 | else if (col == COLUMN_FRAME && movie->editor->markers.count(row)) { |
| 194 | font.setStretch(QFont::ExtraExpanded); |
| 195 | font.setBold(true); |
| 196 | } |
| 197 | return font; |
| 198 | } |
| 199 | |
| 200 | if (role == Qt::ForegroundRole) { |
| 201 | if (row >= frameCount()) { |
| 202 | return QGuiApplication::palette().text(); |
| 203 | } |
| 204 | if (col < COLUMN_SPECIAL_SIZE) { |
| 205 | return QGuiApplication::palette().text(); |
| 206 | } |
| 207 | if (col == columnCount() - 1) { |
| 208 | return QGuiApplication::palette().text(); |
| 209 | } |
| 210 | |
| 211 | QColor color = QGuiApplication::palette().text().color(); |
| 212 | const SingleInput si = movie->editor->input_set[col-COLUMN_SPECIAL_SIZE]; |
| 213 | const AllInputs& ai = movie->inputs->getInputs(row); |
| 214 | int current_value = ai.getInput(si); |
| 215 | |
| 216 | /* Show inputs with transparancy when they are pending due to rewind */ |
| 217 | bool pending_input = false; |
| 218 | // movie->inputs->input_queue.lock(); |
| 219 | // for (auto it = movie->inputs->input_queue.begin(); it != movie->inputs->input_queue.end(); it++) { |
| 220 | // if (it->framecount != row) |
| 221 | // continue; |
| 222 | // |
| 223 | // if (si == it->si) { |
| 224 | // pending_input = true; |
| 225 | // /* For analog, use half-transparancy. Otherwise, |
| 226 | // * use strong/weak transparancy of set/clear input */ |
| 227 | // if (si.isAnalog()) { |
| 228 | // color.setAlpha(128); |
| 229 | // } |
| 230 | // else { |
| 231 | // int alpha = 0; |
| 232 | // if (it->value) alpha += 192; |
| 233 | // if (current_value) alpha += 63; |