alog>
# include
# include
# include "mainwindow.h"
# include "ui_mainwindow.h"
:: MainWindow (QWidget * parent): (parent), (new Ui :: MainWindow)
widget, SLOT (repaint ())); (& timer, SIGNAL (timeout ()), this, 0; = 0; = false; = false;
}
:: ~ MainWindow ()
{ui;
}
MainWindow :: isStopState (const QChar c)
{endStateSet.contains (c);
}
MainWindow :: writeSymbol (const QChar c)
{. insert (ribbonPos, c);. removeAt (ribbonPos + 1); stateChanged ();
}
MainWindow :: moveRight ()
{+ +; (ribbonPos == ribbon.count () -
}
MainWindow :: moveLeft ()
{-; (ribbonPos>
}
MainWindow :: step ()
{> widget-> setResultText (QString ("")); (! isStopState (currentState) && ready)
{logString; + = trUtf8 ("Вхідний символ '"); i = 0, j = 0; in; (ribbon.count ()! = 0) = ribbon.at (ribbonPos ); = ui-> comboSpaceSymbol-> itemText (ui-> comboSpaceSymbol-> currentIndex ()). at (0); + = in + trUtf8 ("', встановлюється стан'"); p>
QString inSymbol = ui-> ruleTable-> horizontalHeaderItem (i) -> text (); (in! = inSymbol && i ruleTable-> columnCount ())
{+ +; = ui-> ruleTable-> horizontalHeaderItem (i) -> text ();
}
state = ui-> ruleTable-> verticalHeaderItem (j) -> text (); (state! = currentState && j ruleTable-> rowCount ())
{+ +; = ui-> ruleTable-> verticalHeaderItem (j) -> text ();
} asd = ui-> ruleTable-> item (j, i) -> text (). at (2); + = asd + trUtf8 ("', записується символ' ");
currentState = asd;> writeSymbol (ui-> ruleTable-> item (j, i) -> text (). at (0)); + = ui-> ruleTable -> item (j, i) -> text (). at (0); + = trUtf8 ("', каретка");
(ui-> ruleTable-> item (j, i) -> text (). at (1) == QString ("L"). at (0))
{> moveLeft (); + = trUtf8 ("рухається вліво");
} if (ui-> ruleTable-> item (j, i) -> text (). at (1) == QString ("R"). at (0) )
{> moveRight (); + = trUtf8 ("рухається вправо");
} + = trUtf8 ("стоїть на місці");> logWidget-> addItem (logString);
}
{= false;> buttonStartStop-> setText (trUtf8 ("Старт"));. stop ();