Exemplo n.º 1
0
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));
}
Exemplo n.º 2
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);
    }
}
Exemplo n.º 3
0
void LatexDocument::setPackages(const QStringList& list)
{
	_packages = list;
	emit codeChanged();
	emit packagesChanged();

}
Exemplo n.º 4
0
void LatexDocument::setOrientation(Orientation o)
{
	_orientation = o;
	/// @todo wording
	emit codeChanged();
	emit orientationChanged();
}
Exemplo n.º 5
0
void StationScheduleModel::setCode(const QString &code)
{
    if (code != m_code) {
        m_code = code;
        emit codeChanged();
    }
}
Exemplo n.º 6
0
/*!
  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;
}
Exemplo n.º 7
0
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);
	}
}
Exemplo n.º 8
0
void EditorTab::onEditorTextChanged(void)
{
	int index = currentIndex();
	Editor * editor = (Editor *)widget(index);
	
	setTabText(index, "*" + QFileInfo(editor->GetFileName()).fileName());
	emit codeChanged();
}
Exemplo n.º 9
0
void OutputEvent::setCode(int code)
{
  if(code != _code)
  {
    _code = code;
    emit codeChanged(_code);
  }

}
Exemplo n.º 10
0
void DriverStation::resetEverything()
{
    m_elapsedTime->resetTimer();
    m_elapsedTime->stopTimer();

    emit codeChanged (false);
    emit voltageChanged (QString (""));
    emit elapsedTimeChanged ("00:00.0");
    emit communicationsChanged (kFailing);
}
Exemplo n.º 11
0
/*!
  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();
}
Exemplo n.º 12
0
/*!
  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();
}
Exemplo n.º 13
0
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;
}
Exemplo n.º 14
0
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();
}
Exemplo n.º 16
0
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);
}
Exemplo n.º 17
0
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();
}
Exemplo n.º 18
0
/**
 * \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();
}
Exemplo n.º 19
0
/**
 * \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();
}
Exemplo n.º 20
0
void LatexDocument::setFontSize(int value)
{
	_fontSize = value;
	emit codeChanged();
	emit fontSizeChanged();
}
Exemplo n.º 21
0
/*!
  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();
}
Exemplo n.º 22
0
/*!
  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();
}
Exemplo n.º 23
0
void LatexDocument::setPaperSize(PaperSize ps)
{
	_paperSize = ps;
	emit codeChanged();
	emit paperSizeChanged();
}
Exemplo n.º 24
0
void EditorTab::onEditorTextChanged(void)
{
	emit codeChanged();
}
Exemplo n.º 25
0
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);
}
Exemplo n.º 26
0
void CodeBar::setcode(QString arg) {
    if (m_code != arg) {        
        m_code = arg;
        emit codeChanged(arg);
    }
}