connect(forwardAction, SIGNAL(triggered()), MediaView::instance(), SLOT(goForward()));
addAction(forwardAction);
- foreach (QAction* action, actions()) {
+ const auto a = actions();
+ for (QAction* action : a) {
window()->addAction(action);
IconUtils::setupAction(action);
}
void SidebarHeader::updateInfo() {
setup();
- QList<VideoSource*> history = MediaView::instance()->getHistory();
+ const QVector<VideoSource*> &history = MediaView::instance()->getHistory();
int currentIndex = MediaView::instance()->getHistoryIndex();
bool canGoForward = MediaView::instance()->canGoForward();
this->title = title;
update();
- QList<VideoSource*> history = MediaView::instance()->getHistory();
+ QVector<VideoSource*> history = MediaView::instance()->getHistory();
int currentIndex = MediaView::instance()->getHistoryIndex();
VideoSource *currentVideoSource = history.at(currentIndex);
- foreach (QAction* action, videoSourceActions)
+ for (QAction* action : videoSourceActions)
removeAction(action);
videoSourceActions = currentVideoSource->getActions();
addActions(videoSourceActions);
if (title.isEmpty()) return;
QPainter p(this);
p.setPen(Qt::white);
- p.setFont(FontUtils::small());
const QRect r = rect();
QString t = title;
QRect textBox = p.boundingRect(r, Qt::AlignCenter, t);
int i = 1;
- const int margin = forwardAction->isVisible() ? 45 : 20;
+ const int margin = forwardAction->isVisible() ? 50 : 25;
while (textBox.width() > r.width() - margin*2 && t.length() > 3) {
- t = t.left(t.length() - i).trimmed() + QLatin1String("...");
+ t = t.left(t.length() - i).trimmed() + QStringLiteral("\u2026");
textBox = p.boundingRect(r, Qt::AlignCenter, t);
i++;
}