26
26
#include < QMetaObject>
27
27
#include < QPointer>
28
28
29
+ #include < libaudcore/audstrings.h>
29
30
#include < libaudcore/hook.h>
30
31
#include < libaudcore/i18n.h>
31
32
#include < libaudcore/playlist.h>
@@ -44,14 +45,6 @@ static const char * printable(const String & str)
44
45
return str ? str : " " ;
45
46
}
46
47
47
- static QString toQString (const String & str)
48
- {
49
- // The explicit cast to const char * is necessary to compile with Qt 6,
50
- // because otherwise two implicit conversions would be necessary: from
51
- // String to const char * and from const char * to QByteArrayView.
52
- return QString::fromUtf8 (static_cast <const char *>(str));
53
- }
54
-
55
48
class PlaybackHistory : public GeneralPlugin
56
49
{
57
50
private:
@@ -525,17 +518,19 @@ QVariant HistoryModel::data(const QModelIndex & index, int role) const
525
518
switch (role)
526
519
{
527
520
case Qt::DisplayRole:
528
- return toQString (m_entries[pos].text ());
521
+ return QString (m_entries[pos].text ());
529
522
case Qt::ToolTipRole:
530
523
{
531
524
const auto & entry = m_entries[pos];
532
525
// The playlist title and entry number are rarely interesting and
533
526
// therefore shown only in the tooltip.
534
- return QString::fromUtf8 (_ (" <b>%1:</b> %2<br><b>Playlist:</b> %3"
535
- " <br><b>Entry Number:</b> %4" ))
536
- .arg (QString::fromUtf8 (entry.translatedTextDesignation ()),
537
- toQString (entry.text ()), toQString (entry.playlistTitle ()),
538
- QString::number (entry.entryNumber ()));
527
+ return QString (
528
+ str_printf (_ (" <b>%s:</b> %s<br><b>Playlist:</b> %s<br>"
529
+ " <b>Entry Number:</b> %d" ),
530
+ entry.translatedTextDesignation (),
531
+ static_cast <const char *>(entry.text ()),
532
+ static_cast <const char *>(entry.playlistTitle ()),
533
+ entry.entryNumber ()));
539
534
}
540
535
case Qt::FontRole:
541
536
if (pos == m_playingPosition)
0 commit comments