libosmscout 0.1
Loading...
Searching...
No Matches
osmscout::TTSMessageGeneratorQt Class Reference

Qt based implementation of TTSMessageGenerator producing template-based messages for a TTS engine. More...

#include <TTSMessageGeneratorQt.h>

+ Inheritance diagram for osmscout::TTSMessageGeneratorQt:

Public Member Functions

std::optional< std::string > GenerateMessage (const Distance &distanceFromStart, const VoiceMessageStruct &message, const VoiceMessageStruct &then) override
 Generate a spoken message for the given maneuver.
 
bool SetLanguage (const std::string &language) override
 Set the language of the generated messages.
 
void SetUnits (DistanceUnitSystem units) override
 Set the distance units used for the announced distances.
 
void SetVehicle (Vehicle vehicle) override
 Set the current vehicle.
 
 TTSMessageGeneratorQt (const QString &translationDir)
 
 ~TTSMessageGeneratorQt () override=default
 
- Public Member Functions inherited from osmscout::TTSMessageGenerator
virtual ~TTSMessageGenerator ()=default
 

Static Public Attributes

static constexpr const char * TranslationContext = "TTSMessageGeneratorQt"
 < Translation context used for all source strings (must match lupdate context).
 

Detailed Description

Qt based implementation of TTSMessageGenerator producing template-based messages for a TTS engine.

Translations are resolved through a dedicated QTranslator instance (see SetLanguage) instead of the globally installed application translators. This makes it possible to generate voice instructions in a language that is different from the language used by the rest of the application. When no translation is available for a given source string, the (English) source text is used as a fallback.

Constructor & Destructor Documentation

◆ TTSMessageGeneratorQt()

osmscout::TTSMessageGeneratorQt::TTSMessageGeneratorQt ( const QString &  translationDir)
explicit

◆ ~TTSMessageGeneratorQt()

osmscout::TTSMessageGeneratorQt::~TTSMessageGeneratorQt ( )
overridedefault

Member Function Documentation

◆ GenerateMessage()

std::optional< std::string > osmscout::TTSMessageGeneratorQt::GenerateMessage ( const Distance distanceFromStart,
const VoiceMessageStruct message,
const VoiceMessageStruct then 
)
overridevirtual

Generate a spoken message for the given maneuver.

Parameters
distanceFromStartcurrent position (distance from the route start). Together with the maneuver distance it defines how far ahead the maneuver is, which may be announced ("After 300 meters, ...") and controls the wording (e.g. a short roundabout phrase when close).
messagethe maneuver to announce
thenoptional following maneuver, only announced when close enough
Returns
the message text, or std::nullopt when there is nothing to say

Implements osmscout::TTSMessageGenerator.

References osmscout::Distance::As(), osmscout::Distance::AsMeter(), osmscout::VoiceMessageStruct::distance, osmscout::Meters(), osmscout::Metrics, osmscout::VoiceMessageStruct::type, and osmscout::vehicleCar.

◆ SetLanguage()

bool osmscout::TTSMessageGeneratorQt::SetLanguage ( const std::string &  languageCode)
overridevirtual

Set the language of the generated messages.

Parameters
languageCode
Returns
true if language is supported

Implements osmscout::TTSMessageGenerator.

References osmscout::Log::Debug(), osmscout::log, and osmscout::Log::Warn().

◆ SetUnits()

void osmscout::TTSMessageGeneratorQt::SetUnits ( DistanceUnitSystem  units)
overridevirtual

Set the distance units used for the announced distances.

Implements osmscout::TTSMessageGenerator.

◆ SetVehicle()

void osmscout::TTSMessageGeneratorQt::SetVehicle ( Vehicle  vehicle)
overridevirtual

Set the current vehicle.

Implements osmscout::TTSMessageGenerator.

Member Data Documentation

◆ TranslationContext

constexpr const char* osmscout::TTSMessageGeneratorQt::TranslationContext = "TTSMessageGeneratorQt"
staticconstexpr

< Translation context used for all source strings (must match lupdate context).


The documentation for this class was generated from the following files: