qmlprieview: fix that init language is the chosen one

* removes language feature from preview service
* it is handled by an extra DebugTranslationService until now
* Qt versions without that extra service can not preview
  languages anymore
* Introduce the use of QmlPreviewRunnerSetting. It makes it
  easier to add more properties in the future
* Language needs an extra handling because it needs
  the loadUrl to find existing languages. So we save
  the language to a m_scheduledInitLanguage and emit
  this after the loadFile call happend.

Change-Id: I7f4aec97f7b61d6b290f225282169da594eb9160
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Tim Jenssen
2020-09-28 08:20:23 +02:00
parent ac0ae2f1eb
commit 9dda8af0b0
16 changed files with 91 additions and 130 deletions

View File

@@ -36,24 +36,24 @@ QmlDebugTranslationClient::QmlDebugTranslationClient(QmlDebug::QmlDebugConnectio
{
}
void QmlDebugTranslationClient::changeLanguage(const QUrl &url, const QString &locale)
void QmlDebugTranslationClient::changeLanguage(const QUrl &url, const QString &localeIsoCode)
{
QmlDebug::QPacket packet(dataStreamVersion());
packet << static_cast<qint8>(ChangeLanguage) << url << locale;
packet << static_cast<qint8>(Command::ChangeLanguage) << url << localeIsoCode;
sendMessage(packet.data());
}
void QmlDebugTranslationClient::changeWarningColor(const QColor &warningColor)
{
QmlDebug::QPacket packet(dataStreamVersion());
packet << static_cast<qint8>(ChangeWarningColor) << warningColor;
packet << static_cast<qint8>(Command::ChangeWarningColor) << warningColor;
sendMessage(packet.data());
}
void QmlDebugTranslationClient::changeElidedTextWarningString(const QString &warningString)
{
QmlDebug::QPacket packet(dataStreamVersion());
packet << static_cast<qint8>(ChangeElidedTextWarningString) << warningString;
packet << static_cast<qint8>(Command::ChangeElidedTextWarningString) << warningString;
sendMessage(packet.data());
}
@@ -68,21 +68,21 @@ void QmlDebugTranslationClient::changeElideWarning(bool elideWarning)
void QmlDebugTranslationClient::setDebugTranslationServiceLogFile(const QString &logFilePath)
{
QmlDebug::QPacket packet(dataStreamVersion());
packet << static_cast<qint8>(SetDebugTranslationServiceLogFile) << logFilePath;
packet << static_cast<qint8>(Command::SetDebugTranslationServiceLogFile) << logFilePath;
sendMessage(packet.data());
}
void QmlDebugTranslationClient::enableElidedTextWarning()
{
QmlDebug::QPacket packet(dataStreamVersion());
packet << static_cast<qint8>(EnableElidedTextWarning);
packet << static_cast<qint8>(Command::EnableElidedTextWarning);
sendMessage(packet.data());
}
void QmlDebugTranslationClient::disableElidedTextWarning()
{
QmlDebug::QPacket packet(dataStreamVersion());
packet << static_cast<qint8>(DisableElidedTextWarning);
packet << static_cast<qint8>(Command::DisableElidedTextWarning);
sendMessage(packet.data());
}
@@ -91,7 +91,7 @@ void QmlDebugTranslationClient::messageReceived(const QByteArray &data)
QmlDebug::QPacket packet(dataStreamVersion(), data);
qint8 command;
packet >> command;
qDebug() << "invalid command" << command;
qDebug() << Q_FUNC_INFO << "invalid command" << command;
}
void QmlDebugTranslationClient::stateChanged(QmlDebug::QmlDebugClient::State state)