Go to the documentation of this file.
22 #include <QStringList>
23 #include <QRegularExpression>
53 pEntry->m_Data.Append(
new MHUnion(
true));
55 pEntry->m_Data.Append(
new MHUnion(
true));
128 std::chrono::milliseconds nNextTime = 0ms;
155 if (nAppTime != 0ms && (nNextTime == 0ms || nAppTime < nNextTime))
157 nNextTime = nAppTime;
197 if (text.size() == 0)
206 unsigned char ch = text[0];
256 if (csPath.isEmpty() || csPath.startsWith(
"DSM:") || csPath.startsWith(
"~"))
258 if (csPath.startsWith(
"hybrid:"))
260 if (csPath.startsWith(
"http:") || csPath.startsWith(
"https:"))
262 if (csPath.startsWith(
"CI:"))
265 int firstColon = csPath.indexOf(
':');
266 int firstSlash = csPath.indexOf(
'/');
267 if (firstColon > 0 && firstSlash > 0 && firstColon < firstSlash)
303 if (! pProgram->m_fIsApp)
343 pProgram->m_path = csPath;
344 int nPos = pProgram->m_path.lastIndexOf(
'/');
348 pProgram->m_path =
"";
352 pProgram->m_path = pProgram->m_path.left(nPos);
410 else if (
nullptr != pApp)
465 MHERROR(
"Application disappeared");
512 if (
nullptr != pScene)
539 QString csPath = QString::fromUtf8((
const char *)str.
Bytes(), str.
Size());
552 if (csPath.startsWith(
"DSM:"))
553 csPath = csPath.mid(4);
554 else if (csPath.startsWith(
"~"))
555 csPath = csPath.mid(1);
556 if (!csPath.startsWith(
"//"))
562 csPath = pApp->
m_path + csPath;
569 while ((nPos = csPath.indexOf(
"/../")) >= 0)
573 while (nPos >= 1 && csPath[nPos-1] !=
'/')
578 csPath = csPath.left(nPos) + csPath.mid(nEnd);
618 throw "FindObject failed";
703 pEvent->m_eventType = ev;
704 pEvent->m_eventData = evData;
720 link->MatchEvent(sourceRef, ev, un,
this);
738 for (
int i = actions.
Size(); i > 0; i--)
792 Redraw(pVis->GetVisibleArea());
810 Redraw(pVis->GetVisibleArea());
844 Redraw(pVis->GetVisibleArea());
875 Redraw(pVis->GetVisibleArea());
883 if (toDraw.isEmpty())
888 while (nStackPos >= 0)
895 if (! drawArea.isEmpty())
1016 if (csPath.isEmpty())
1032 reinterpret_cast< const unsigned char *
>(text.constData()),
1054 pContent->m_pRequester = pRequester;
1055 pContent->m_time.start();
1098 .arg(text.size()) );
1103 reinterpret_cast< const unsigned char *
>(text.constData()),
1121 else if (pContent->
m_time.elapsed() > 60000)
1145 QString
const csFile = QString::fromUtf8(
1146 (
const char *)fileName.
Bytes(), fileName.
Size() );
1168 "Load Persistent(%1) #%2: no such file")
1169 .arg(csFile).arg(variables.
Size()) );
1180 if (pEntry ==
nullptr)
1189 "Load Persistent(%1): size mismatch").arg(csFile));
1193 for (i = 0; i < variables.
Size(); i++)
1197 .arg(csFile).arg(i).arg(pValue->
Printable()) );
1211 for (i = 0; i < variables.
Size(); i++)
1217 .arg(csFile, pValue->Printable(), QString::number(i)) );
1227 QString csFeat = QString::fromUtf8((
const char *)
feature.Bytes(),
feature.Size());
1228 static const QRegularExpression kSeparatorRE { R
"([\(\,\)])" };
1229 QStringList strings = csFeat.split(kSeparatorRE);
1233 if (strings[0] ==
"ApplicationStacking" || strings[0] ==
"ASt")
1239 if (strings[0] ==
"Cloning" || strings[0] ==
"Clo")
1244 if (strings[0] ==
"SceneCoordinateSystem" || strings[0] ==
"SCS")
1246 return strings.count() >= 3 && strings[1] ==
"720" && strings[2] ==
"576";
1251 if (strings[0] ==
"MultipleAudioStreams" || strings[0] ==
"MAS")
1253 return strings.count() >= 2 && (strings[1] ==
"0" || strings[1] ==
"1");
1256 if (strings[0] ==
"MultipleVideoStreams" || strings[0] ==
"MVS")
1258 return strings.count() >= 2 && (strings[1] ==
"0" || strings[1] ==
"1");
1262 if (strings[0] ==
"OverlappingVisibles" || strings[0] ==
"OvV")
1267 if (strings[0] ==
"SceneAspectRatio" || strings[0] ==
"SAR")
1269 if (strings.count() < 3)
1273 return (strings[1] ==
"4" && strings[2] ==
"3") || (strings[1] ==
"16" && strings[2] ==
"9");
1277 if (strings[0] ==
"VideoScaling" || strings[0] ==
"VSc")
1279 if (strings.count() < 4 || strings[1] !=
"10")
1283 return (strings[2] ==
"720" && strings[3] ==
"576") || (strings[2] ==
"360" && strings[3] ==
"288");
1286 if (strings[0] ==
"BitmapScaling" || strings[0] ==
"BSc")
1288 if (strings.count() < 4 || strings[1] !=
"2")
1292 return (strings[2] ==
"720" && strings[3] ==
"576") || (strings[2] ==
"360" && strings[3] ==
"288");
1296 if (strings[0] ==
"VideoDecodeOffset" || strings[0] ==
"VDO")
1298 return strings.count() >= 3 && strings[1] ==
"10" && strings[1] ==
"0";
1302 if (strings[0] ==
"BitmapDecodeOffset" || strings[0] ==
"BDO")
1304 if (strings.count() >= 3 && strings[1] ==
"2" && (strings[2] ==
"0" || strings[2] ==
"1"))
1308 if (strings.count() >= 2 && (strings[1] ==
"4" || strings[1] ==
"6"))
1315 if (strings[0] ==
"UKEngineProfile" || strings[0] ==
"UniversalEngineProfile" || strings[0] ==
"UEP")
1317 if (strings.count() < 2)
1339 if (strings[1] ==
"2")
1341 if (strings[1] ==
"1")
1344 if (strings[1] ==
"PANT11001")
1347 if (strings[1] ==
"1285")
1354 if (strings[0] ==
"ICProfile" || strings[0] ==
"ICP") {
1355 if (strings.count() < 2)
return false;
1356 if (strings[1] ==
"0")
1358 if (strings[1] ==
"1")
1363 if (strings[0] ==
"HDExtension" || strings[0] ==
"HDE") {
1364 if (strings.count() < 2)
return false;
1365 if (strings[1] ==
"0")
1367 if (strings[1] ==
"1")
1371 if (strings[0] ==
"HDGraphicsPlaneExtension" || strings[0] ==
"HDG") {
1372 if (strings.count() < 2)
return false;
1374 return strings[1] ==
"0";
1506 str.
Copy(
"plain.24.24.0");
1521 QByteArray
tmp = logtext.toLatin1();
virtual bool GetCarouselData(const QString &objectPath, QByteArray &result)=0
virtual void SetInputRegister(int nReg)=0
void RequestExternalContent(MHIngredient *pRequester)
void GetDefaultBGColour(MHColour &colour)
MHInteractible * m_interacting
virtual void Deactivation(MHEngine *engine)
void DrawDisplay(const QRegion &toDraw) override
static const char * MHEGEngineProviderIdString
void Activation(MHEngine *engine) override
MHEngine(MHContext *context)
int FindOnStack(const MHRoot *pVis)
MHGroup * ParseProgram(QByteArray &text)
QQueue< MHAsynchEvent * > m_eventQueue
std::chrono::milliseconds RunAll(void) override
void Activation(MHEngine *engine) override
static EProtocol PathProtocol(const QString &csPath)
virtual void DrawBackground(const QRegion ®)=0
const unsigned char * Bytes() const
void Preparation(MHEngine *engine) override
void SendToBack(const MHRoot *pVis)
void GetDefaultButtonRefColour(MHColour &colour)
@ EventSliderValueChanged
virtual void KeyEvent(MHEngine *, int)
void AddLink(MHLink *pLink)
virtual void SetVariableValue(const MHUnion &)
void GetDefaultSliderRefColour(MHColour &colour)
MHScene * m_pCurrentScene
MHColour m_buttonRefColour
void Destruction(MHEngine *engine) override
QString GetPathName(const MHOctetString &str)
void Deactivation(MHEngine *engine) override
MHColour m_sliderRefColour
int GetDefaultStreamCHook()
MHObjectRef m_ObjectReference
void RemoveFromDisplayStack(MHVisible *pVis)
void Redraw(const QRegion ®ion)
void SetFromString(const char *str, int nLen)
MHOwnPtrSequence< MHIngredient > m_items
void CancelExternalContentRequest(MHIngredient *pRequester)
void EventTriggered(MHRoot *pSource, enum EventType ev)
MHOctetString m_fontAttrs
void CheckLinks(const MHObjectRef &sourceRef, enum EventType ev, const MHUnion &un)
int GetDefaultBitmapCHook()
static const std::array< featureStruct, 7 > feature
void mhlog_fn(const QString &logtext)
void GetDefaultHighlightRefColour(MHColour &colour)
static QString EventTypeToString(enum EventType ev)
void MHSetLogging(FILE *logStream, unsigned int logLevel)
void PutBefore(const MHRoot *pVis, const MHRoot *pRef)
MHRoot * FindObject(const MHObjectRef &oRef, bool failOnNotFound=true)
int GetDefaultTextCHook()
#define MHLOG(__level, __text)
MHRoot * FindByObjectNo(int n) override
virtual QRegion GetVisibleArea()
MHSequence< MHVisible * > m_displayStack
MHEG * MHCreateEngine(MHContext *context)
QStack< MHApplication * > m_applicationStack
std::chrono::milliseconds CheckTimers(MHEngine *engine)
void PrintMe(FILE *fd, int nTabs) const override
void GetDefaultTextColour(MHColour &colour)
void TransitionToScene(const MHObjectRef &target)
void InsertAt(BASE b, int n)
void AddActions(const MHActionSequence &actions)
void AddToDisplayStack(MHVisible *pVis)
void GetDefaultFontAttrs(MHOctetString &str)
void Initialise(MHParseNode *p, MHEngine *engine) override
QStack< MHElemAction * > m_actionStack
virtual const char * GetDSMCCId(void)=0
void GenerateUserAction(int nCode) override
MHOwnPtrSequence< MHUnion > m_Data
static void Failure(const char *p)
MHOctetString m_contentRef
QList< MHExternContent * > m_externContentTable
MHApplication * CurrentApp()
static constexpr std::chrono::milliseconds CONTENT_CHECK_TIME
void Copy(const MHColour &col)
virtual void RequireRedraw(const QRegion ®ion)=0
void EngineEvent(int nCode) override
QString Printable() const
void StreamStarted(MHStream *stream, bool bStarted) override
void SetInputRegister(int nReg)
bool LoadStorePersistent(bool fIsLoad, const MHOctetString &fileName, const MHSequence< MHObjectRef * > &variables)
bool Equal(const MHOctetString &str) const
void BringToFront(const MHRoot *pVis)
void PutBehind(const MHRoot *pVis, const MHRoot *pRef)
MHIngredient * m_pRequester
virtual void Perform(MHEngine *engine)=0
@ EventInteractionCompleted
virtual void ContentArrived(const unsigned char *, int, MHEngine *)
void RemoveLink(MHLink *pLink)
virtual bool CheckCarouselObject(const QString &objectPath)=0
void DrawRegion(const QRegion &toDraw, int nStackPos)
virtual const char * GetReceiverId(void)=0
MHOwnPtrSequence< MHPSEntry > m_persistentStore
virtual bool CheckStop(void)=0
virtual void Display(MHEngine *)=0
QList< MHLink * > m_linkTable
MHContentRef m_contentRef
@ EventFirstItemPresented
MHColour m_highlightRefColour
virtual void PrintMe(FILE *fd, int nTabs) const
virtual QRegion GetOpaqueArea()
void CheckContentRequests()
bool GetEngineSupport(const MHOctetString &feature)
void Copy(const MHOctetString &str)
bool Launch(const MHObjectRef &target, bool fIsSpawn=false)
virtual void GetVariableValue(MHUnion &, MHEngine *)
QString Printable() const