LogReader::LogReader(QObject *parent) : QObject(parent) { if (!isRunning("mongod.exe")){ qDebug() << "MongoDB Server is not running!"; exit(0); } connect(&watcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChanged(QString))); connect(this, SIGNAL(dataReceived(QString)), &sHandle, SLOT(checkString(QString))); connect(&sHandle, SIGNAL(codeChanged(CodeType)), &json, SLOT(inputCode(CodeType))); connect(&sHandle, SIGNAL(codeChanged(CodeType)), &db, SLOT(inputCode(CodeType))); connect(&sHandle, SIGNAL(dataValidated(QRegularExpressionMatch)), &json, SLOT(inputData(QRegularExpressionMatch))); connect(&json, SIGNAL(jsonCreated(QJsonObject)), &db, SLOT(receiveData(QJsonObject))); connect(this, SIGNAL(readToWrite()), &db, SLOT(openMongoConn())); connect(this, SIGNAL(writenDone()), &db, SLOT(closeMongoConn())); directory.setPath("Z:/Log"); fileList << "/Pvqvscmw.log" << "/Pvqvscmw1.log" << "/Pvqvscmw2.log" << "/Pvqvscmw3.log" << "/Pvqvscmw4.log" << "/Pvqvscmw5.log" << "/Pvqvscmw6.log" << "/Pvqvscmw7.log" << "/Pvqvscmw8.log" << "/Pvqvscmw9.log"; // directory.setPath("C:/Temp/Data"); // fileList << "/Pvqvscmw.log"; // directory.setPath("C:/Temp/Data"); // fileList << "/Log (1).log" << "/Log (2).log" // << "/Log (3).log" << "/Log (4).log" // << "/Log (5).log" << "/Log (6).log" // << "/Log (7).log" << "/Log (8).log" // << "/Log (9).log" << "/Log (10).log" // << "/Log (11).log" << "/Log (12).log" // << "/Log (13).log" << "/Log (14).log" // << "/Log (15).log" << "/Log (16).log" // << "/Log (17).log" << "/Log (18).log" // << "/Log (19).log" << "/Log (20).log" // << "/Log (21).log" << "/Log (22).log" // << "/Log (23).log" << "/Log (24).log" // << "/Log (25).log" << "/Log (26).log" // << "/Log (27).log" << "/Log (28).log" // << "/Log (29).log" << "/Log (30).log" // << "/Log (31).log" << "/Log (32).log" // << "/Log (33).log" << "/Log (34).log" // << "/Log (35).log" << "/Log (36).log" // << "/Log (37).log" << "/Log (38).log" // << "/Log (39).log" << "/Log (40).log" // << "/Log (41).log" << "/Log (42).log"; // Força a leitura no arquivo na inicialização. readFile(0); watcher.addPath(directory.absolutePath()+fileList.at(0)); }
// Starts a new game with the entered code word and difficulty // signal void PlaySpace::newGame(bool test){ if(!test){ QMessageBox msgBx; msgBx.setText("Test is true"); msgBx.exec(); } if(!test){ // Set the code word for the game QString code = lineEdit->text().toUpper(); emit codeChanged(code); // Reset the current status of the individual GuessEntry objects // Iterators for current and its next GuessEntry object in the list List<GuessEntry*>::iterator curr = guessInterface.begin(); List<GuessEntry*>::iterator finish = guessInterface.end(); // Go through each guessInterface object in the list and reset current to false while(curr!=finish){ (*curr)->reset(); curr++; } guessInterface.first()->setCurrent(true); } }
void LatexDocument::setPackages(const QStringList& list) { _packages = list; emit codeChanged(); emit packagesChanged(); }
void LatexDocument::setOrientation(Orientation o) { _orientation = o; /// @todo wording emit codeChanged(); emit orientationChanged(); }
void StationScheduleModel::setCode(const QString &code) { if (code != m_code) { m_code = code; emit codeChanged(); } }
/*! A function called \a functionName is added to this script. The name must match the regular expression \c{/^[A-Za-z_][A-Za-z_0-9]*$/}. The code for the function can be passed in the \a functionBody parameter. If \a functionBody was specified, its text will appear in the editor; if the \a functionBody is empty a new empty function will be created. This function returns TRUE on success (i.e. the \a functionName was valid); otherwise returns FALSE. */ bool QSScript::addFunction(const QString &functionName, const QString &functionBody) { static QString letters = QString::fromLatin1("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_"); static QString numbers = QString::fromLatin1("0123456789"); for (int i = 0; i < (int)functionName.length(); ++i) { if (i == 0 && letters.find(functionName[i]) == -1 || letters.find(functionName[i]) == -1 && numbers.find(functionName[i]) == -1) { #if defined(QT_CHECK_RANGE) qWarning("QSProject::addFunction: '%s' is not a valid function name", functionName.latin1()); #endif return FALSE; } } QString str = QString::fromLatin1("function %1()\n{\n%2\n}") .arg(functionName) .arg(functionBody); #ifndef AQ_ENABLE_SCRIPTCACHE d->code += str; #else QString cod(this->code()); cod += str; d->code = aqSha1(cod); aqDiskCacheInsert(d->code, cod); #endif emit codeChanged(); return TRUE; }
void LatexDocument::appendPreamble(QQmlListProperty<LatexCodeBlock> *list, LatexCodeBlock*block) { LatexDocument *doc = qobject_cast<LatexDocument*>(list->object); if(doc && block) { connect(block, SIGNAL(changed()), doc, SIGNAL(codeChanged())); doc->_preamble.append(block); } }
void EditorTab::onEditorTextChanged(void) { int index = currentIndex(); Editor * editor = (Editor *)widget(index); setTabText(index, "*" + QFileInfo(editor->GetFileName()).fileName()); emit codeChanged(); }
void OutputEvent::setCode(int code) { if(code != _code) { _code = code; emit codeChanged(_code); } }
void DriverStation::resetEverything() { m_elapsedTime->resetTimer(); m_elapsedTime->stopTimer(); emit codeChanged (false); emit voltageChanged (QString ("")); emit elapsedTimeChanged ("00:00.0"); emit communicationsChanged (kFailing); }
/*! Sets the code in this script to \a code. This function will emit codeChanged(). */ void QSScript::setCode(const QString &code) { #ifndef AQ_ENABLE_SCRIPTCACHE d->code = code; #else d->code = aqSha1(code); aqDiskCacheInsert(d->code, code); #endif emit codeChanged(); }
/*! Appends the code \a code to the code in this script. This function will emit codeChanged() */ void QSScript::addCode(const QString &code) { #ifndef AQ_ENABLE_SCRIPTCACHE d->code += code; #else QString cod(this->code()); cod += code; d->code = aqSha1(cod); aqDiskCacheInsert(d->code, cod); #endif emit codeChanged(); }
bool CountryInput::onChooseCountry(const QString &iso) { CountriesByISO2::const_iterator i = countriesByISO2.constFind(iso); const CountryInfo *info = (i == countriesByISO2.cend()) ? 0 : (*i); if (info) { lastValidISO = info->iso2; setText(QString::fromUtf8(info->name)); emit codeChanged(info->code); update(); return true; } return false; }
void CountryCodeInput::correctValue(QKeyEvent *e, const QString &was) { QString oldText(text()), newText, addToNumber; int oldPos(cursorPosition()), newPos(-1), oldLen(oldText.length()), start = 0, digits = 5; newText.reserve(oldLen + 1); newText += '+'; if (oldLen && oldText[0] == '+') { ++start; } for (int i = start; i < oldLen; ++i) { QChar ch(oldText[i]); if (ch.isDigit()) { if (!digits || !--digits) { addToNumber += ch; } else { newText += ch; } } if (i == oldPos) { newPos = newText.length(); } } if (!addToNumber.isEmpty()) { QString validCode = findValidCode(newText.mid(1)); addToNumber = newText.mid(1 + validCode.length()) + addToNumber; newText = '+' + validCode; } if (newPos < 0 || newPos > newText.length()) { newPos = newText.length(); } if (newText != oldText) { setText(newText); if (newPos != oldPos) { setCursorPosition(newPos); } } if (!_nosignal && was != newText) { emit codeChanged(newText.mid(1)); } if (!addToNumber.isEmpty()) { emit addedToNumber(addToNumber); } }
void DiagnosticCodeSelector::newSelection(const QModelIndex& index) { if (!index.isValid()) { return; } // Now, we want to get an index to potentially different columns of // the same object. Note that index.row() is NOT unique, it's just the row // number for a given parent. // To get a different column, we go via the parent back to the child: // http://doc.qt.io/qt-5/qmodelindex.html#details QModelIndex parent = index.parent(); QModelIndex code_index = parent.child( index.row(), DiagnosticCode::COLUMN_CODE); QModelIndex description_index = parent.child( index.row(), DiagnosticCode::COLUMN_DESCRIPTION); QString code = code_index.data().toString(); QString description = description_index.data().toString(); emit codeChanged(code, description); emit finished(); }
void TextEditor::setupEditor(QFont *font) { setFont(*font); setTabStopWidth(Options::tabWidth() * QFontMetrics(*font).width(' ')); // strip formatting when pasting rich-text setAcceptRichText(false); setLineWrapMode(QTextEdit::NoWrap); m_syntaxTip = new SyntaxTip(this); m_registerTip = new RegisterTip(this); QShortcut *jumpToPC = new QShortcut(QKeySequence(tr("CTRL+J")), this, SLOT(focusPC()), SLOT(focusPC()), Qt::WidgetShortcut); //setContextMenuPolicy(Qt::CustomContextMenu); setContextMenuPolicy(Qt::NoContextMenu); connect(this, SIGNAL(textChanged()), this, SLOT(codeChanged())); connect(this, SIGNAL(textChanged()), m_parent, SLOT(contentChangedProxy())); // TODO: temp? optimize! connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateCursorPosition())); // signals for enabling/disabling editing functionality connect(this, SIGNAL(undoAvailable(bool)), this, SLOT(undoAvailabilityModified(bool))); connect(this, SIGNAL(undoAvailable(bool)), this, SLOT(undoAvailabilityModified(bool))); connect(this, SIGNAL(undoAvailable(bool)), m_parent, SLOT(undoAvailabilityModified(bool))); connect(this, SIGNAL(redoAvailable(bool)), m_parent, SLOT(redoAvailabilityModified(bool))); connect(this, SIGNAL(copyAvailable(bool)), m_parent, SLOT(copyAvailabilityModified(bool))); connect(verticalScrollBar(), SIGNAL(valueChanged(int)), m_parent, SLOT(updateLineNumbers(int))); connect(verticalScrollBar(), SIGNAL(valueChanged(int)), m_syntaxTip, SLOT(editorScrolled(int))); // connect(m_parent, SIGNAL(isModifiable(bool)), this, SLOT(modifiabilityChanged(bool))); connect(this, SIGNAL(updateModifiability(bool)), m_parent, SLOT(modifiabilityChanged(bool))); connect(m_parent, SIGNAL(fontChanged(const QFont&)), this, SLOT(fontChanged(const QFont&))); connect(Options::m_options, SIGNAL(errorHighlightingEnabledChanged(bool)), this, SLOT(errorHighlightingEnabledChanged(bool))); //modifiabilityChanged(m_parent->isModifiable()); m_syntaxHighligher = new SyntaxHighlighter(this); setMouseTracking(true); }
void SkinDocument::setupUI() { /* Setting up the text edit */ layout = new QHBoxLayout; editor = new CodeEditor(this); editor->setLineWrapMode(QPlainTextEdit::NoWrap); layout->addWidget(editor); setLayout(layout); /* Attaching the syntax highlighter */ highlighter = new SkinHighlighter(editor->document()); /* Setting up the model */ model = new ParseTreeModel(""); /* Connecting the editor's signal */ QObject::connect(editor, SIGNAL(textChanged()), this, SLOT(codeChanged())); QObject::connect(editor, SIGNAL(cursorPositionChanged()), this, SLOT(cursorChanged())); settingsChanged(); }
/** * \brief Append to the code that will be executed when calling exec() or eval() */ void AbstractScript::addCode(const QString &code) { m_code.append(code); m_compiled = notCompiled; emit codeChanged(); }
/** * \brief Set the code that will be executed when calling exec() or eval() */ void AbstractScript::setCode(const QString &code) { m_code=code; m_compiled = notCompiled; emit codeChanged(); }
void LatexDocument::setFontSize(int value) { _fontSize = value; emit codeChanged(); emit fontSizeChanged(); }
/*! Sets the code in this script to \a code. This function will emit codeChanged(). */ void QSScript::setCode( const QString &code ) { d->code = code; emit codeChanged(); }
/*! Appends the code \a code to the code in this script. This function will emit codeChanged() */ void QSScript::addCode( const QString &code ) { d->code += code; emit codeChanged(); }
void LatexDocument::setPaperSize(PaperSize ps) { _paperSize = ps; emit codeChanged(); emit paperSizeChanged(); }
void EditorTab::onEditorTextChanged(void) { emit codeChanged(); }
PlaySpace::PlaySpace(QPixmap bull, QPixmap cow, unsigned int size, QWidget *parent, Qt::WindowFlags f):QWidget(parent,f){ totalGuesses = size; currentGuess = 0; // Set the difficulty difficulty = new QButtonGroup; difficultyRadioBox = new QGroupBox(tr("Difficulty:")); QRadioButton *easy = new QRadioButton(tr("Easy: ")); QRadioButton *medium = new QRadioButton(tr("Medium:")); QRadioButton *hard = new QRadioButton(tr("Hard:")); QRadioButton *harder = new QRadioButton(tr("Harder:")); medium->setChecked(true); // Add the buttons to the difficulty button group difficulty->addButton(easy); difficulty->addButton(medium); difficulty->addButton(hard); difficulty->addButton(harder); // Set the values for the difficulty difficulty->setId(easy,3); difficulty->setId(medium,4); difficulty->setId(hard,5); difficulty->setId(harder,6); // Create a layout for the difficulty QVBoxLayout *diffLayout = new QVBoxLayout; diffLayout->addWidget(easy); diffLayout->addWidget(medium); diffLayout->addWidget(hard); diffLayout->addWidget(harder); difficultyRadioBox->setLayout(diffLayout); role = new QGroupBox(tr("Player Role")); // Prepare the playerRole combo box playerRole = new QComboBox(parent); QStringList options; options<< "Breaker" <<"Creator"; playerRole->addItems(options); // Set the code label and line edit for the code word codeLabel = new QLabel(parent); codeLabel->setText("Enter Code Word: "); lineEdit = new QLineEdit; lineEdit->setStyleSheet("color:blue; background-color: yellow; font: 18pt"); lineEdit->setFixedWidth(100); codeLabel->setBuddy(lineEdit); QVBoxLayout *roleLayout = new QVBoxLayout; roleLayout->addWidget(playerRole); roleLayout->addWidget(codeLabel); roleLayout->addWidget(lineEdit); // Hide the codeLabel and lineEdit. codeLabel->setVisible(false); lineEdit->setVisible(false); // Set it so characters are hidden like in password entry lineEdit->setEchoMode(QLineEdit::Password); role->setLayout(roleLayout); newGameButton = new QPushButton("New Game",parent); connect(playerRole,SIGNAL(currentIndexChanged(int)),this,SLOT(setRole(int))); connect(newGameButton,SIGNAL(clicked(bool)),this,SLOT(newGame(bool))); connect(difficulty,SIGNAL(buttonPressed(int)),this,SLOT(setValidation(int))); QHBoxLayout *gameLayout = new QHBoxLayout; gameLayout->addWidget(difficultyRadioBox); gameLayout->addWidget(role); gameLayout->addWidget(newGameButton); QVBoxLayout *bottomLayout = new QVBoxLayout; bottomLayout->addLayout(diffLayout); bottomLayout->addLayout(roleLayout); bottomLayout->addLayout(gameLayout); QVBoxLayout *rightLayout = new QVBoxLayout; // Create GuessEntry objects and connect the bullsCows signal to their setBullsCows slots for(unsigned int i = 0; i<size;i++){ GuessEntry *entry = new GuessEntry(bull, cow, false,parent,f); rightLayout->addWidget(entry); connect(this,SIGNAL(codeChanged(QString)),entry,SLOT(setCodeWord(QString))); connect(difficulty,SIGNAL(buttonPressed(int)),entry,SLOT(setValidation(int))); guessInterface.prepend(entry); } // Iterators for current and its next GuessEntry object in the list List<GuessEntry*>::iterator next = guessInterface.begin(); List<GuessEntry*>::iterator curr = next++; List<GuessEntry*>::iterator finish = guessInterface.end(); // Go through each guessInterface object in the list and connect it to its adjacent // object while(next!=finish){ connect(*curr,SIGNAL(finished(bool)),*next,SLOT(setCurrent(bool))); curr++; next++; } rightLayout->addLayout(bottomLayout); // Add the game start button and difficulty comboboxes // Set the first guess entry as the current entry setLayout(rightLayout); //guessInterface.first()->setCurrent(true); }
void CodeBar::setcode(QString arg) { if (m_code != arg) { m_code = arg; emit codeChanged(arg); } }