Пример #1
0
void ScoresTable::clearTable()
{
    QMessageBox::StandardButton reply;
    reply = QMessageBox::question(this,
                                  tr("Confirmation"),
                                  tr("Are you sure that you want to "
                                     "delete all data from scores table?"),
                                  QMessageBox::Yes|QMessageBox::No);
    if (reply == QMessageBox::Yes)
    {
        QFile scoresFile("scores_table.sapst");
        bool fileHasCreated = scoresFile.open(QIODevice::WriteOnly);
        if (fileHasCreated)
        {
            scoresFile.write("");
            scoresFile.close();
            updateInformation();
            return;
        }
        else
        {
            QMessageBox::warning(this,
                                 tr("Error"),
                                 tr("Cannot create scores table file."),
                                 QMessageBox::Ok);
            return;
        }
    }
}
Пример #2
0
int FRModel::setSerialNumber(const QString &number, QString password)
{
    fillString(password, getPasswordLength(password));

    int result = hw->hw()->ECR_SetMode(0);
    if (result == 0 || result == 157)
    {
        result = hw->hw()->ECR_SetMode(5, codec->fromUnicode(password));
        if (!result)
            result = hw->hw()->ECR_SetSerialNumber(codec->fromUnicode(number));
    }

    result = err->analizeError(result);
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = setSerialNumber(number, password);
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка установки серийного номера."), result));
    }

    return result;
}
Пример #3
0
int FRModel::report()
{
    int result = hw->hw()->ECR_SetMode(0);
    if (!result)
    {
        result = hw->hw()->ECR_SetMode(3);
        if (!result)
            result = hw->hw()->ECR_Report(Z_REPORT);
    }

    result = err->analizeError(result, "report");
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = report();
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка создания z-отчета."), result));
    }

    return result;
}
Пример #4
0
int FRModel::setDateTime(int day, int month, int year, int hour, int minute, int second)
{   
    int result = hw->hw()->ECR_SetMode(0);
    if (!result)
    {
        result = hw->hw()->ECR_SetDate(day, month, year);
        if (!result)
            result = hw->hw()->ECR_SetTime(hour, minute, second);
    }

    result = err->analizeError(result);
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = setDateTime(day, month, year, hour, minute, second);
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка синхронизации даты и времени."), result));
    }

    return result;
}
Пример #5
0
int FRModel::makeFullReport(int sessionBegin, int sessionEnd, QString password)
{
    fillString(password, getPasswordLength(password));

    int result = hw->hw()->ECR_SetMode(0);
    if (result == 0 || result == 157)
    {
        result = hw->hw()->ECR_SetMode(5, codec->fromUnicode(password));
        if (!result)
            result = hw->hw()->ECR_Report(FULL_REPORT_BY_SESSION, 0, 0, 0, 0, 0, 0, sessionBegin, sessionEnd);
    }

    result = err->analizeError(result);
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = makeFullReport(sessionBegin, sessionEnd, password);
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка снятия полного отчета по сменам."), result));
    }

    return result;
}
Пример #6
0
int FRModel::makeBriefReport(int dayBegin, int monthBegin, int yearBegin, int dayEnd, int monthEnd, int yearEnd, QString password)
{
    fillString(password, getPasswordLength(password));

    int result = hw->hw()->ECR_SetMode(0);
    if (result == 0 || result == 157)
    {
        result = hw->hw()->ECR_SetMode(5, codec->fromUnicode(password));
        if (!result)
            result = hw->hw()->ECR_Report(BRIEF_REPORT_BY_DATE, dayBegin, monthBegin, yearBegin, dayEnd, monthEnd, yearEnd);
    }

    result = err->analizeError(result);
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = makeBriefReport(dayBegin, monthBegin, yearBegin, dayEnd, monthEnd, yearEnd, password);
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка снятия краткого отчета по датам."), result));
    }

    return result;
}
Пример #7
0
int FRModel::fiscalization(QString registrationNumber, QString INN, QString newPassword, QString password)
{
    fillString(password, getPasswordLength(password));
    fillString(newPassword, getPasswordLength(password));
    fillString(registrationNumber, getRegistrationNumberLength());
    fillString(INN, getINNNumberLength());

    int result = hw->hw()->ECR_SetMode(0);
    if (result == 0 || result == 157)
    {
        result = hw->hw()->ECR_SetMode(5, codec->fromUnicode(password));
        if (!result)
           result = hw->hw()->ECR_Fiscalization(codec->fromUnicode(registrationNumber), codec->fromUnicode(INN), codec->fromUnicode(newPassword));
    }

    result = err->analizeError(result, "fiscalization");
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = fiscalization(registrationNumber, INN, newPassword, password);
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка фискализации."), result));
    }

    return result;
}
Пример #8
0
void MachineWidget::executeAllInstructions()
{
    piet->executeAllInstr();
    std::string output(stream->str());
    stream->str(""); // clearing
    ui->consoleOutputBrowser->setText(ui->consoleOutputBrowser->toPlainText().append(output.c_str()));
    updateInformation();
}
Пример #9
0
void SceneWidget::slotOpenDistanceField(void) {
  MainWindow* main_window = MainWindow::getInstance();

  QString filename = QFileDialog::getOpenFileName(main_window, "Open Distance Field", main_window->getWorkspace().c_str(), "Distance Field (*.h5)");
  if (filename.isEmpty())
    return;

  if (distance_field_->load(filename.toStdString())) {
    updateInformation();
    centerScene();
  }

  return;
}
Пример #10
0
void SceneWidget::slotOpenPointCloud(void) {
  MainWindow* main_window = MainWindow::getInstance();

  QString filename = QFileDialog::getOpenFileName(main_window, "Open Point Cloud", main_window->getWorkspace().c_str(), "Point Cloud (*.pcd *.ply *.obj)");
  if (filename.isEmpty())
    return;

  if (point_cloud_->load(filename.toStdString())) {
    updateInformation();
    centerScene();
  }

  return;
}
Пример #11
0
void MachineWidget::createMachine(QString filepath)
{
    this->setWindowTitle(filepath);
    ui->consoleOutputBrowser->setText("");

    if (machine_created)
    {
      delete piet;
    }

    piet = new PGuiVirtualMachine(filepath.toStdString().c_str(), *stream);
    program_image->setPiet(piet);
    program_image->render();
    machine_created = true;
    updateInformation();
}
Пример #12
0
NetworkSettingsWidget::NetworkSettingsWidget(Device *device, QWidget *parent)
	: StandardWidget(device, parent),
	ui(new Ui::NetworkSettingsWidget)
{
	ui->setupUi(this);
	performStandardSetup(tr("Network Settings"));
	
	ui->turnOn->setVisible(false);
	ui->turnOff->setVisible(false);
	
	QObject::connect(ui->connect, SIGNAL(clicked()), SLOT(connect()));
	QObject::connect(ui->manage, SIGNAL(clicked()), SLOT(manage()));
	NetworkManager::ref().connect(ui->turnOn, SIGNAL(clicked()), SLOT(turnOn()));
	NetworkManager::ref().connect(ui->turnOff, SIGNAL(clicked()), SLOT(turnOff()));
	
	QObject::connect(&NetworkManager::ref(),
		SIGNAL(stateChanged(const NetworkManager::State &, const NetworkManager::State &)),
		SLOT(stateChanged(const NetworkManager::State &, const NetworkManager::State &)));
	
	updateInformation();
}
Пример #13
0
/*!
 * \brief Constructor.
 */
Server::Server(QString name, QTabWidget *parent, QString yarpVersion) : ui(new Ui::Server)
{
    ui->setupUi(this);
    parent->addTab(this, name);
    gpuInfo.append("GPU devices will appear once any modules are running on this server.");
    minimumYarpVersion = yarpVersion;
    portName = name;
    initialised = false;
    timeStep = 0;

    timer = new QTimer(this);
    timer->setInterval(1000);
    QObject::connect(timer, SIGNAL(timeout()), this, SLOT(updateInformation()));

    systemInfo = new QProcess(this);
    QObject::connect(systemInfo, SIGNAL(readyRead()), this, SLOT(readFromStdout()));
    QObject::connect(systemInfo, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(closeProcess()));

    QFont plotFont("Times", 10, QFont::Bold);
    ui->cpuPlot->setTitle("CPU Load");
    ui->cpuPlot->setTitleFont(plotFont);
    ui->cpuPlot->xAxis->setTickLabels(false);
    ui->cpuPlot->yAxis->setTickLabels(false);
    ui->cpuPlot->yAxis->setRange(0, 100);
    ui->cpuPlot->addGraph();
    ui->cpuPlot->graph()->setLineStyle(QCPGraph::lsLine);
    ui->cpuPlot->graph()->setPen(QPen(Qt::black));
    ui->cpuPlot->graph()->clearData();

    ui->memoryPlot->setTitle("Memory");
    ui->memoryPlot->setTitleFont(plotFont);
    ui->memoryPlot->xAxis->setTickLabels(false);
    ui->memoryPlot->yAxis->setTickLabels(false);
    ui->memoryPlot->addGraph();
    ui->memoryPlot->graph()->setLineStyle(QCPGraph::lsLine);
    ui->memoryPlot->graph()->setPen(QPen(Qt::black));
    ui->memoryPlot->graph()->clearData();
}
Пример #14
0
int FRModel::setLicence(const QString &license)
{
    int result = hw->hw()->ECR_SetMode(0);
    if (!result)
        hw->hw()->ECR_SetLicense(4, codec->fromUnicode(license));

    result = err->analizeError(result);
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = setLicence(license);
        break;

    default:
        emit signalFail(generateErrorMessage(conv("Ошибка установки лицензии."), result));
    }

    return result;
}
Пример #15
0
int FRModel::testSale(double price)
{
    int result = hw->hw()->ECR_SetMode(0);
    if (!result)
    {
        result = hw->hw()->ECR_SetMode(1);
        if (!result)
        {
            result = hw->hw()->ECR_OpenCheck(0);
            if (!result)
            {
                result = hw->hw()->ECR_Registration(price, 1, "");
                if (!result)
                    result = hw->hw()->ECR_CloseCheck(price);
            }
        }
    }

    result = err->analizeError(result, "check");
    switch (result)
    {
    case 0:
        updateInformation();
        break;

    case 1:
        waitForRelease();
        result = testSale(price);
        break;

    default:
            emit signalFail(generateErrorMessage(conv("Ошибка печати чека."), result));
    }

    return result;
}
Пример #16
0
void NetworkSettingsWidget::stateChanged(const NetworkManager::State &newState, const NetworkManager::State &oldState)
{
	qDebug() << "State Changed to" << newState;
	QTimer::singleShot(300, this, SLOT(updateInformation()));
}