Пример #1
0
void TestPanel::handleCameraComms(const QString input)
{
    if (input == "Excellent") { emit commandSignal(MessageCodes::CameraCommsExcellent); }
    else if (input == "Good") { emit commandSignal(MessageCodes::CameraCommsGood); }
    else if (input == "Poor") { emit commandSignal(MessageCodes::CameraCommsPoor); }
    else if (input == "Offline") { emit commandSignal(MessageCodes::CameraCommsOffline); }
}
Пример #2
0
void PgxConsole::keyPressEvent(QKeyEvent *event)
{
    switch(event->key()) {
    case Qt::Key_Up:
        emit historyUp();
        break;
    case Qt::Key_Down:
        emit historyDown();
        break;
    case Qt::Key_Left:
        if(!textCursor().atBlockStart())
            QPlainTextEdit::keyPressEvent(event);
        break;
    case Qt::Key_Backspace:
        if(!textCursor().atBlockStart())
            QPlainTextEdit::keyPressEvent(event);
        break;
    case Qt::Key_Return:
    case Qt::Key_Enter:
        emit commandSignal(QString());
        break;
    case Qt::Key_Backslash:
        QPlainTextEdit::keyPressEvent(event);
        appendPlainText("");
        break;
    default:
        QPlainTextEdit::keyPressEvent(event);
    }
}
Пример #3
0
void SR865::init()
{
    if (this->srs == nullptr)
        this->srs = new SRS();

    initBaudrateList();
    initReferenceSourceList();
    initReferenceTriggerModeList();
    initReferenceTriggerOutputZList();
    initSignalInputList();
    initVoltageInputModeList();
    initVoltageInputCouplingList();
    initVoltageInputShieldsList();
    initVoltageInputRangeList();
    initCurrentInputGainList();
    initSensivityList();
    initTimeConstantList();
    initFilterList();
    initOutputNumberList();
    initFrequencyPostfixList();
    initVoltagePostfixList();

    connect(this->srs, SIGNAL(errorSignal(QString)),    this, SLOT(catchErrorSignal(QString))   , Qt::DirectConnection);
    connect(this->srs, SIGNAL(responseSignal(QString)), this, SLOT(catchResponseSignal(QString)), Qt::DirectConnection);
    connect(this->srs, SIGNAL(commandSignal(QString)),  this, SLOT(catchCommandSignal(QString)) , Qt::DirectConnection);
    connect(this->srs, SIGNAL(timeoutSignal(QString)),  this, SLOT(catchTimeoutSignal(QString)) , Qt::DirectConnection);

    return;
}
Пример #4
0
bool SVGPathRunner::runPath(QVector<QVariant> & pathData, void * userData) {
	PathCommand * currentCommand = NULL;
	QList<double> args;

	foreach (QVariant variant, pathData) {
		if (variant.type() == QVariant::Char) {
			PathCommand * newCommand = pathCommands.value(variant.toChar(), NULL);
			if (newCommand == NULL) return false;

			if (currentCommand != NULL) {
				if (currentCommand->argCount == 0) {
					if (args.count() != 0) return false;
				}
				else if (args.count() % currentCommand->argCount != 0) return false;

				emit commandSignal(currentCommand->command, currentCommand->relative, args, userData);
			}

			args.clear();
			currentCommand = newCommand;
		}
		else if (variant.type() == QVariant::Double) {
			if (currentCommand == NULL) return false;
			args.append(variant.toDouble());
		}
	}

	if (currentCommand != NULL) {
		if (currentCommand->argCount == 0) {
			if (args.count() != 0) return false;
		}
		else if (args.count() % currentCommand->argCount != 0) return false;

		emit commandSignal(currentCommand->command, currentCommand->relative, args, userData);
	}

	return true;
}
Пример #5
0
void DS345::init()
{
    if (this->srs == nullptr)
        this->srs = new SRS();

    initBaudrateList();
    initAmplitudeTypeList();
    initFunctionList();
    initModulationFunctionList();
    initModulationTypeList();

    connect(this->srs, SIGNAL(errorSignal(QString)),    this, SLOT(catchErrorSignal(QString))   , Qt::DirectConnection);
    connect(this->srs, SIGNAL(responseSignal(QString)), this, SLOT(catchResponseSignal(QString)), Qt::DirectConnection);
    connect(this->srs, SIGNAL(commandSignal(QString)),  this, SLOT(catchCommandSignal(QString)) , Qt::DirectConnection);
    connect(this->srs, SIGNAL(timeoutSignal(QString)),  this, SLOT(catchTimeoutSignal(QString)) , Qt::DirectConnection);

    return;
}
Пример #6
0
PgxConsole::PgxConsole(Database *database)
{
    this->database = database;
    insertPlainText("");
    setViewportMargins(10, 0, 0, 0);
    setTabStopWidth(40);
    setUndoRedoEnabled(false);
    setWindowTitle(QApplication::translate("PgxConsole", "SQL console", 0, QApplication::UnicodeUTF8));
    setStyleSheet("QPlainTextEdit{background-color: white; font: bold 14px 'Courier New';}");

    createActions();
    hit = 0;

    highlighter = new Highlighter(document());
    prompt = new Prompt(this);

    toolbar = new ToolBar;
    toolbar->setIconSize(QSize(36,36));
    toolbar->setObjectName("pgxeditor");
    toolbar->setMovable(false);
    toolbar->addAction(newpgxconsole_action);
    toolbar->addAction(cut_action);
    toolbar->addAction(copy_action);
    toolbar->addAction(paste_action);
    toolbar->addSeparator();
    toolbar->addAction(clear_action);
    toolbar->addAction(find_action);

    pgxconsole_mainwin = new PgxConsoleMainWindow;
    pgxconsole_mainwin->addToolBar(toolbar);
    pgxconsole_mainwin->setCentralWidget(this);
    pgxconsole_mainwin->setAttribute(Qt::WA_DeleteOnClose);

    find_bar = new QLineEdit;
    find_bar->setPlaceholderText(tr("Find"));
    find_bar->setMaximumSize(100,find_bar->height());
    find_bar->setVisible(false);
    pgxconsole_mainwin->statusBar()->setSizeGripEnabled(false);
    pgxconsole_mainwin->statusBar()->addPermanentWidget(casesensitivity_button, 0);
    pgxconsole_mainwin->statusBar()->addPermanentWidget(wholeword_button, 0);
    //pgxconsole_mainwin->statusBar()->addPermanentWidget(backwards_button, 0);
    pgxconsole_mainwin->statusBar()->addPermanentWidget(find_bar);
    pgxconsole_mainwin->statusBar()->addPermanentWidget(find_previous_button, 0);
    pgxconsole_mainwin->statusBar()->addPermanentWidget(find_next_button, 0);

    connect(find_bar, SIGNAL(returnPressed()), SLOT(findText()));

    QShortcut *shortcut_paste = new QShortcut(QKeySequence::Paste, this);
    connect(shortcut_paste, SIGNAL(activated()), SLOT(pasteFromClipboard()));

    QShortcut *shortcut_single_paste = new QShortcut(QKeySequence("Ctrl+Shift+V"), this);
    connect(shortcut_single_paste, SIGNAL(activated()), SLOT(pasteAsSingleFromClipboard()));

    connect(this, SIGNAL(cursorPositionChanged()), SLOT(makePreviousBlocksReadonly()));

    //Tie command with QueryView creation.
    connect(this, SIGNAL(commandSignal(QString)), SLOT(showView(QString)));

    //Tie up and down keys with command history scolling.
    connect(this, SIGNAL(historyUp()), SLOT(historyUpCommand()));
    connect(this, SIGNAL(historyDown()), SLOT(historyDownCommand()));

    //Console updates.
    connect(this, SIGNAL(updateRequest(QRect,int)), SLOT(updatePrompt(QRect,int)));
    connect(pgxconsole_mainwin, SIGNAL(pgxconsoleClosing()), SLOT(pgxconsoleClosing()));
}
Пример #7
0
void TestPanel::handleLaserFireState(const QString input)
{
    if (input == "Active") { emit commandSignal(MessageCodes::LaserActive); }
    else if (input == "Not Active") { emit commandSignal(MessageCodes::LaserNotActive); }
}
Пример #8
0
void TestPanel::handleRoverOpState(const QString input)
{
    if (input == "Acquired") { emit commandSignal(MessageCodes::RoverAcquired); }
    else if (input == "Not Acquired") { emit commandSignal(MessageCodes::RoverNotAcquired); }
}
Пример #9
0
void TestPanel::handleCameraOpState(const QString input)
{
    if (input == "Online") { emit commandSignal(MessageCodes::CameraOnline); }
    else if (input == "Offline") { emit commandSignal(MessageCodes::CameraOffline); }
}