MCPcopy Create free account
hub / github.com/dannagle/PacketSender / executeScript

Method executeScript

src/panelgenerator.cpp:621–799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

619}
620
621void PanelGenerator::executeScript(QString script)
622{
623
624
625 QStringList linesAll = script.split("\n",
626#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
627
628 QString::SplitBehavior::SkipEmptyParts
629#else
630 Qt::SkipEmptyParts
631#endif
632 );
633
634 QString errorMessages = "";
635
636 QStringList lines;
637 int toLoad = 0;
638
639 foreach(QString line, linesAll) {
640 line = line.trimmed();
641 if( line.isEmpty() ||
642 line.startsWith("//") ||
643 line.startsWith("#") ||
644 line.startsWith(";")
645 ) {
646 continue;
647 }
648
649 QStringList cmdSplit = line.split(":");
650
651 bool ispacket = true;
652
653 //TODO: support system calls.
654 if( (line.startsWith("sleep:") || line.startsWith("delay:") || line.startsWith("panel:") ) ) {
655
656 ispacket = false;
657 if(cmdSplit.size() < 2) {
658 errorMessages.append("\nInvalid command:" + line);
659 continue;
660 }
661
662 unsigned int delaynum = cmdSplit[1].toUInt();
663 if(delaynum < 1) {
664 errorMessages.append("\nInvalid command:" + line);
665 continue;
666 }
667 }
668
669 if( line.startsWith("panel:") && cmdSplit.size() > 1) {
670 int panelnum = cmdSplit[1].toInt();
671 Panel p = Panel::fromDB(panelnum);
672 if(p.id == 0) {
673 errorMessages.append("\nInvalid panel id:" + QString::number(panelnum));
674 continue;
675 } else {
676 toLoad = p.id;
677
678 }

Callers

nothing calls this directly

Calls 10

renderViewModeMethod · 0.95
setWindowTitleMethod · 0.80
setStandardButtonsMethod · 0.80
setIconMethod · 0.80
setTextMethod · 0.80
execMethod · 0.80
isNotNewMethod · 0.80
isNewMethod · 0.80
setDefaultButtonMethod · 0.80
copyMethod · 0.80

Tested by

no test coverage detected