Esempio n. 1
0
main() {
	enableInterrupts();
	begining:
	//display the welcome message and menu
	welcome();
	//enable VGA mode
	setVGAMode();
	//start the game play
	play();
	//go back to the main menu
	setTextMode();
	goto begining;

	//end of the game
	terminate();
}
Esempio n. 2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //вывод ошибок в log
    connect(&port,SIGNAL(error(QString)),this,SLOT(printErrorMessage(QString)));

    connect(ui->send_pushButton,SIGNAL(clicked()),this,SLOT(sendMessage()));
    connect(ui->run_button,SIGNAL(clicked()),this,SLOT(runScript()));
    connect(ui->comPort_comboBox,SIGNAL(currentTextChanged(QString)),&port,SLOT(serialPortChanged(QString)));

    //получение списка всех портов и добавление их в comPort_comboBox
    foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts())
       ui->comPort_comboBox->addItem(info.portName(),Qt::DisplayRole);

    //привязка изменения настроек в интерфейсе к сетерам
    connect(ui->bitsRate_comboBox,SIGNAL(currentTextChanged(QString)),&port,SLOT(baudRateChanged(QString)));
    connect(ui->parity__comboBox,SIGNAL(currentTextChanged(QString)),&port,SLOT(parityChanged(QString)));
    connect(ui->dataBits_comboBox,SIGNAL(currentTextChanged(QString)),&port,SLOT(dataBitsChanged(QString)));
    connect(ui->stopBits_comboBox,SIGNAL(currentTextChanged(QString)),&port,SLOT(stopBitsChanged(QString)));
    connect(ui->flowControl_comboBox,SIGNAL(currentTextChanged(QString)),&port,SLOT(flowControlChanged(QString)));
    connect(ui->comPort_comboBox,SIGNAL(currentTextChanged(QString)),this,SLOT(setDefault(QString)));
    //ввывод ошибок в log
    connect(&port,SIGNAL(error(QSerialPort::SerialPortError)),this,SLOT(error(QSerialPort::SerialPortError)));
    //добавление в всех возможных вариантов настроек в интерфейс
    ui->bitsRate_comboBox->addItems(comPortSettings::bitsRates);
    ui->dataBits_comboBox->addItems(comPortSettings::dataBits);
    ui->parity__comboBox->addItems(comPortSettings::parityBits);
    ui->stopBits_comboBox->addItems(comPortSettings::stopBits);
    ui->flowControl_comboBox->addItems(comPortSettings::flowControl);
    setDefault("");

    QFileDialog* fileDialog = new QFileDialog(this,QString("Open Script"),QString(""),QString("*.txt"));
    connect(ui->open_button, SIGNAL(clicked()), fileDialog, SLOT(open()));       //TODO: роскоментить в финальном варианте (а то система тормозит)
    connect(fileDialog, SIGNAL(fileSelected(QString)), ui->filePath_lineEdit,    //поєднання підтверження вибору файлу та завантаження
            SLOT(setText(QString)));
    //привязка действий к кнопкам выбора режима
    connect(ui->hex_radioButton,SIGNAL(clicked()),this,SLOT(setHexMode()));
    connect(ui->text_radioButton,SIGNAL(clicked()),this,SLOT(setTextMode()));
    emit ui->hex_radioButton->clicked();
    //слушаем порт
    connect(&port,SIGNAL(readData(QString)),this,SLOT(printReceivedMessage(QString)));
    loadSettings();
}