| 152 | } |
| 153 | |
| 154 | void splitViewWidget::paintEvent(QPaintEvent *) |
| 155 | { |
| 156 | MoveAndZoomableView::updatePaletteIfNeeded(); |
| 157 | |
| 158 | if (!playlist) |
| 159 | // The playlist was not initialized yet. Nothing to draw (yet) |
| 160 | return; |
| 161 | |
| 162 | QPainter painter(this); |
| 163 | |
| 164 | // Get the full size of the area that we can draw on (from the paint device base) |
| 165 | QPoint drawArea_botR(width(), height()); |
| 166 | |
| 167 | if (isViewFrozen) |
| 168 | { |
| 169 | QString text = "Playback is running in the separate view only.\nCheck 'Playback in primary " |
| 170 | "view' if you want playback to run here too."; |
| 171 | |
| 172 | // Set the QRect where to show the text |
| 173 | QFont displayFont = painter.font(); |
| 174 | QFontMetrics metrics(displayFont); |
| 175 | QSize textSize = metrics.size(0, text); |
| 176 | |
| 177 | QRect textRect; |
| 178 | textRect.setSize(textSize); |
| 179 | textRect.moveCenter(drawArea_botR / 2); |
| 180 | |
| 181 | // Draw a rectangle around the text in white with a black border |
| 182 | QRect boxRect = textRect + QMargins(5, 5, 5, 5); |
| 183 | painter.setPen(QPen(Qt::black, 1)); |
| 184 | painter.fillRect(boxRect, Qt::white); |
| 185 | painter.drawRect(boxRect); |
| 186 | |
| 187 | painter.drawText(textRect, Qt::AlignCenter, text); |
| 188 | |
| 189 | MoveAndZoomableView::updateMouseCursor(); |
| 190 | |
| 191 | return; |
| 192 | } |
| 193 | |
| 194 | DEBUG_LOAD_DRAW("splitViewWidget::paintEvent drawing " |
| 195 | << (isMasterView ? " separate widget" : "")); |
| 196 | |
| 197 | // Get the current frame to draw |
| 198 | const auto frame = playback->getCurrentFrame(); |
| 199 | |
| 200 | // Is playback running? |
| 201 | const bool playing = (playback) ? playback->playing() : false; |
| 202 | // If yes, is is currently stalled because we are waiting for caching of an item to finish first? |
| 203 | const bool waitingForCaching = playback->isWaitingForCaching(); |
| 204 | |
| 205 | // Get the playlist item(s) to draw |
| 206 | const auto item = playlist->getSelectedItems(); |
| 207 | const bool anyItemsSelected = item[0] != nullptr || item[1] != nullptr; |
| 208 | |
| 209 | // The x position of the split (if splitting) |
| 210 | const int xSplit = int(drawArea_botR.x() * splittingPoint); |
| 211 |
nothing calls this directly
no test coverage detected