Commit 91a7a20f authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Build with QT_NO_CAST_FROM_ASCII

NO_CHANGELOG
parent e9ae6ded
......@@ -68,7 +68,7 @@ add_definitions(
-DQT_DISABLE_DEPRECATED_BEFORE=0x050900
-DQT_USE_QSTRINGBUILDER
-DQT_NO_CAST_TO_ASCII
# -DQT_NO_CAST_FROM_ASCII
-DQT_NO_CAST_FROM_ASCII
-DQT_NO_CAST_FROM_BYTEARRAY
-DQT_STRICT_ITERATORS
-DQT_NO_URL_CAST_FROM_STRING
......
......@@ -36,11 +36,11 @@ AdjustSizeButton::AdjustSizeButton( QWidget *parent )
setPalette( QApplication::palette() ); //videoWindow has different palette
setFrameStyle( QFrame::Plain | QFrame::Box );
m_preferred = new QPushButton( QIcon::fromTheme( "viewmag" ), i18nc("@action:button", "Preferred Scale"), this );
m_preferred = new QPushButton( QIcon::fromTheme(QStringLiteral("viewmag")), i18nc("@action:button", "Preferred Scale"), this );
connect( m_preferred, &QAbstractButton::clicked, Dragon::mainWindow(), &QWidget::adjustSize);
connect( m_preferred, &QAbstractButton::clicked, this, &QObject::deleteLater);
m_oneToOne = new QPushButton( QIcon::fromTheme( "viewmag1" ), i18nc("@action:button", "Scale 100%"), this );
m_oneToOne = new QPushButton( QIcon::fromTheme(QStringLiteral("viewmag1")), i18nc("@action:button", "Scale 100%"), this );
connect( m_oneToOne, &QAbstractButton::clicked, videoWindow(), &VideoWindow::resetZoom);
connect( m_oneToOne, &QAbstractButton::clicked, this, &QObject::deleteLater);
......
......@@ -31,11 +31,13 @@ int main( int argc, char **argv )
KLocalizedString::setApplicationDomain("dragonplayer");
KAboutData aboutData( APP_NAME, i18n("Dragon Player"), QLatin1String(APP_VERSION),
KAboutData aboutData( QStringLiteral(APP_NAME),
i18n("Dragon Player"),
QStringLiteral(APP_VERSION),
i18n("A video player that has a usability focus"), KAboutLicense::GPL_V2,
i18n("Copyright 2006, Max Howell\nCopyright 2007, Ian Monroe"),
i18n("IRC:\nirc.freenode.net #dragonplayer\n\nFeedback:\nimonroe@kde.org"),
"https://multimedia.kde.org" );
QStringLiteral("https://commits.kde.org/dragon"));
aboutData.setDesktopFileName(QStringLiteral("org.kde.dragonplayer"));
aboutData.addCredit( QStringLiteral("David Edmundson"), i18n("Improvements and polish") );
aboutData.addCredit( QStringLiteral("Matthias Kretz"), i18n("Creator of Phonon") );
......@@ -51,8 +53,9 @@ int main( int argc, char **argv )
QCommandLineParser parser;
aboutData.setupCommandLine(&parser);
parser.addOption(QCommandLineOption("play-dvd", i18n("Play DVD Video")));
parser.addPositionalArgument("url", i18n("Play 'URL'"), QStringLiteral("+[URL]"));
const QCommandLineOption playDvDOption(QStringLiteral("play-dvd"), i18n("Play DVD Video"));
parser.addOption(playDvDOption);
parser.addPositionalArgument(QStringLiteral("url"), i18n("Play 'URL'"), QStringLiteral("+[URL]"));
parser.process(app);
aboutData.processCommandLine(&parser);
......@@ -70,7 +73,7 @@ int main( int argc, char **argv )
QUrl::AssumeLocalFile));
}
app.newInstance(parser.isSet("play-dvd"), urls);
app.newInstance(parser.isSet(playDvDOption), urls);
return app.exec();
}
......@@ -476,7 +476,7 @@ MainWindow::toggleVolumeSlider( bool show )
m_rightDock = new QDockWidget( this );
m_rightDock->setFeatures( QDockWidget::NoDockWidgetFeatures );
m_rightDock->setObjectName("volume_dock");
m_rightDock->setObjectName(QStringLiteral("volume_dock"));
dock->setParent( m_rightDock );
m_rightDock->setWidget( dock );
addDockWidget( Qt::RightDockWidgetArea, m_rightDock );
......
......@@ -47,11 +47,11 @@ PlayDialog::PlayDialog( QWidget *parent, bool be_welcome_dialog )
grid->setVerticalSpacing( 20 );
//TODO use the kguiItems from the actions
mapper->setMapping( o = new QPushButton( QIcon::fromTheme( "document-open" ), i18nc("@action:button", "Play File..."), this ), FILE );
mapper->setMapping( o = new QPushButton( QIcon::fromTheme(QStringLiteral("document-open")), i18nc("@action:button", "Play File..."), this ), FILE );
connect(o, &QAbstractButton::clicked, mapper, QOverload<>::of(&QSignalMapper::map));
grid->addWidget( o, 0, 0 );
mapper->setMapping( o = new QPushButton( QIcon::fromTheme( "media-optical-video" ), i18nc("@action:button", "Play Disc"), this ), DVD );
mapper->setMapping( o = new QPushButton( QIcon::fromTheme(QStringLiteral("media-optical-video")), i18nc("@action:button", "Play Disc"), this ), DVD );
connect(o, &QAbstractButton::clicked, mapper, QOverload<>::of(&QSignalMapper::map));
grid->addWidget( o, 0, 1 );
......
......@@ -30,7 +30,7 @@ PlayerApplication::~PlayerApplication()
void PlayerApplication::slotActivateRequested(const QStringList &arguments, const QString &workingDirectory)
{
qDebug() << Q_FUNC_INFO << arguments;
if (!arguments.filter("play-dvd", Qt::CaseInsensitive).isEmpty()) {
if (!arguments.filter(QStringLiteral("play-dvd"), Qt::CaseInsensitive).isEmpty()) {
newInstance(true);
forceActiveWindow();
} else if (arguments.count() == 2) { // 1st arg binary name, 2nd arg file to open
......
......@@ -148,8 +148,8 @@ TheStream::prettyTitle()
//using QString::toLatin1() will display "????" in titlelabel. Should be QString::toUtf8(). patched by nihui, Jul.6th, 2008
return QUrl::fromPercentEncoding( n.left( n.lastIndexOf( QLatin1Char( '.' ) ) ).replace( QLatin1Char( '_' ), QLatin1Char( ' ' ) ).toUtf8() ); //krazy:exclude-qclasses
} else if (videoWindow()->m_media->currentSource().discType() == Phonon::Cd) {
return i18n("Track %1/%2", videoWindow()->m_media->metaData().value("TRACK-NUMBER"),
videoWindow()->m_media->metaData().value("TRACK-COUNT"));
return i18n("Track %1/%2", videoWindow()->m_media->metaData().value(QStringLiteral("TRACK-NUMBER")),
videoWindow()->m_media->metaData().value(QStringLiteral("TRACK-COUNT")));
} else {
return url.toDisplayString();
}
......
......@@ -63,9 +63,10 @@ void MediaPlayer2::setFullscreen(bool fullscreen) const
void MediaPlayer2::emitFullscreenChange(bool fullscreen) const
{
QVariantMap properties;
properties["Fullscreen"] = fullscreen;
properties["CanSetFullscreen"] = CanSetFullscreen();
const QVariantMap properties {
{ QStringLiteral("Fullscreen"), fullscreen },
{ QStringLiteral("CanSetFullscreen"), CanSetFullscreen()},
};
Mpris2::signalPropertiesChange(this, properties);
}
......@@ -104,7 +105,7 @@ QStringList MediaPlayer2::SupportedUriSchemes() const
QStringList MediaPlayer2::SupportedMimeTypes() const
{
KService::Ptr app = KService::serviceByDesktopName("org.kde." APP_NAME);
KService::Ptr app = KService::serviceByDesktopName(DesktopEntry());
if (app)
return app->mimeTypes();
......
......@@ -104,24 +104,24 @@ QString MediaPlayer2Player::PlaybackStatus() const
{
switch (Dragon::engine()->state()) {
case (Phonon::PlayingState):
return "Playing";
return QStringLiteral("Playing");
break;
case (Phonon::PausedState):
case (Phonon::BufferingState):
return "Paused";
return QStringLiteral("Paused");
break;
case (Phonon::StoppedState):
return "Stopped";
return QStringLiteral("Stopped");
break;
default:
return "Stopped";
return QStringLiteral("Stopped");
break;
}
}
QString MediaPlayer2Player::LoopStatus() const
{
return "None";
return QStringLiteral("None");
}
void MediaPlayer2Player::setLoopStatus(const QString& loopStatus) const
......@@ -158,19 +158,22 @@ QVariantMap MediaPlayer2Player::Metadata() const
case Phonon::MediaSource::Empty:
break;
default:
metaData["mpris:trackid"] = QVariant::fromValue<QDBusObjectPath>(QDBusObjectPath(makeTrackId(Dragon::engine()->urlOrDisc()).constData()));
metaData["mpris:length"] = Dragon::engine()->length() * 1000;
metaData["xesam:url"] = Dragon::engine()->urlOrDisc();
metaData = {
{ QStringLiteral("mpris:trackid"),
QVariant::fromValue<QDBusObjectPath>(QDBusObjectPath(makeTrackId(Dragon::engine()->urlOrDisc()).constData())) },
{ QStringLiteral("mpris:length"), Dragon::engine()->length() * 1000 },
{ QStringLiteral("xesam:url"), Dragon::engine()->urlOrDisc() },
};
}
QMultiMap<QString, QString> phononMetaData = Dragon::engine()->metaData();
QMultiMap<QString, QString>::const_iterator i = phononMetaData.constBegin();
while (i != phononMetaData.constEnd()) {
if (i.key() == "ALBUM" || i.key() == "TITLE")
metaData["xesam:" + i.key().toLower()] = i.value();
else if (i.key() == "ARTIST" || i.key() == "GENRE")
metaData["xesam:" + i.key().toLower()] = QStringList(i.value());
if (i.key() == QLatin1String("ALBUM") || i.key() == QLatin1String("TITLE"))
metaData[QLatin1String("xesam:") + i.key().toLower()] = i.value();
else if (i.key() == QLatin1String("ARTIST") || i.key() == QLatin1String("GENRE"))
metaData[QLatin1String("xesam:") + i.key().toLower()] = QStringList(i.value());
++i;
}
......@@ -228,44 +231,42 @@ void MediaPlayer2Player::tick(qint64 newPos)
void MediaPlayer2Player::emitMetadataChange() const
{
QVariantMap properties;
properties["Metadata"] = Metadata();
const QVariantMap properties { { QStringLiteral("Metadata"), Metadata() } };
Mpris2::signalPropertiesChange(this, properties);
}
void MediaPlayer2Player::currentSourceChanged() const
{
QVariantMap properties;
properties["Metadata"] = Metadata();
properties["CanSeek"] = CanSeek();
const QVariantMap properties {
{ QStringLiteral("Metadata"), Metadata() },
{ QStringLiteral("CanSeek"), CanSeek() },
};
Mpris2::signalPropertiesChange(this, properties);
}
void MediaPlayer2Player::stateUpdated() const
{
QVariantMap properties;
properties["PlaybackStatus"] = PlaybackStatus();
properties["CanPause"] = CanPause();
const QVariantMap properties {
{ QStringLiteral("PlaybackStatus"), PlaybackStatus() },
{ QStringLiteral("CanPause"), CanPause() },
};
Mpris2::signalPropertiesChange(this, properties);
}
void MediaPlayer2Player::totalTimeChanged() const
{
QVariantMap properties;
properties["Metadata"] = Metadata();
const QVariantMap properties { { QStringLiteral("Metadata"), Metadata() } };
Mpris2::signalPropertiesChange(this, properties);
}
void MediaPlayer2Player::seekableChanged(bool seekable) const
{
QVariantMap properties;
properties["CanSeek"] = seekable;
const QVariantMap properties { { QStringLiteral("CanSeek"), seekable } };
Mpris2::signalPropertiesChange(this, properties);
}
void MediaPlayer2Player::volumeChanged() const
{
QVariantMap properties;
properties["Volume"] = Volume();
const QVariantMap properties { { QStringLiteral("Volume"), Volume() } };
Mpris2::signalPropertiesChange(this, properties);
}
......@@ -18,7 +18,7 @@
Mpris2::Mpris2(QObject* parent) : QObject(parent)
{
QString mpris2Name("org.mpris.MediaPlayer2." + QLatin1String(APP_NAME));
const QString mpris2Name = QStringLiteral("org.mpris.MediaPlayer2." APP_NAME);
bool success = QDBusConnection::sessionBus().registerService(mpris2Name);
......@@ -26,12 +26,12 @@ Mpris2::Mpris2(QObject* parent) : QObject(parent)
// and the name is already taken. In that event the MPRIS2 spec wants the
// following:
if (!success)
success = QDBusConnection::sessionBus().registerService(mpris2Name + ".instance" + QString::number(getpid()));
success = QDBusConnection::sessionBus().registerService(mpris2Name + QLatin1String(".instance") + QString::number(getpid()));
if (success) {
new MediaPlayer2(this);
new MediaPlayer2Player(this);
QDBusConnection::sessionBus().registerObject("/org/mpris/MediaPlayer2", this, QDBusConnection::ExportAdaptors);
QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/mpris/MediaPlayer2"), this, QDBusConnection::ExportAdaptors);
}
}
......@@ -41,10 +41,10 @@ Mpris2::~Mpris2()
void Mpris2::signalPropertiesChange(const QObject* adaptor, const QVariantMap& properties)
{
QDBusMessage msg = QDBusMessage::createSignal("/org/mpris/MediaPlayer2",
"org.freedesktop.DBus.Properties", "PropertiesChanged" );
QDBusMessage msg = QDBusMessage::createSignal(QStringLiteral("/org/mpris/MediaPlayer2"),
QStringLiteral("org.freedesktop.DBus.Properties"), QStringLiteral("PropertiesChanged"));
msg << adaptor->metaObject()->classInfo(0).value();
msg << QString::fromUtf8(adaptor->metaObject()->classInfo(0).value());
msg << properties;
msg << QStringList();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment