예제 #1
0
inline void VSCClientConfDefault(VidClientConf &pData)
{
	SimpleCrypt crypt;
	pData.set_nlang(VID_LANG_AUTO);
	pData.set_bautologin(false);
	/* Default passwd is admin */
	QString strPass = "******";
	pData.set_stradminpasswd(crypt.encryptToString(strPass).toStdString());

	return;
}
예제 #2
0
void Settings::SaveSettings()
{
    pSettings->setValue("windowState", pMain->saveState());

    if(!pMain->isMaximized())
        pSettings->setValue("windowSize", pMain->saveGeometry());

    pSettings->setValue("windowMaximized", pMain->isMaximized());

    pSettings->setValue("splitterState", pMain->GetUi()->splitter->saveState());

    pSettings->setValue("rulesSplitterState", pMain->GetUi()->rulesSplitter->saveState());

    pSettings->setValue("browserSplitterState", pMain->GetUi()->browserSplitter->saveState());

    pSettings->setValue("browserTableState", pMain->GetUi()->browserTable->horizontalHeader()->saveState());

    pSettings->setValue("rulesTableState", pMain->GetUi()->rulesTable->horizontalHeader()->saveState());

    pSettings->setValue("playerTableState", pMain->GetUi()->playerTable->horizontalHeader()->saveState());

    pSettings->setValue("darkTheme", pMain->GetUi()->menuSettings->actions().at(0)->isChecked());

    pSettings->setValue("showLoggingInfo", pMain->showLoggingInfo);

    pSettings->setValue("logPort", pMain->u16logPort);

    pSettings->beginGroup("servers");

    pSettings->remove("");

    if(serverList.size() > 0)
    {
        for(int i = 0; i < serverList.size(); i++)
        {
            ServerInfo *info = serverList.at(i);
            QStringList list;
            list.append(info->ipPort);

            if(info->saveRcon && info->rconPassword.length() >0)
            {
                SimpleCrypt encrypt;
                encrypt.setKey(info->ipPort.toLongLong());
                list.append(encrypt.encryptToString(info->rconPassword));

            }
            pSettings->setValue(QString::number(i+1), list);
        }
    }

    pSettings->endGroup();
}
예제 #3
0
/**
 * Encrypts the note text with the note's crypto key
 */
QString Note::encryptNoteText() {
    // split the text into a string list
    QStringList noteTextLines = this->noteText.split(
            QRegExp("(\\r\\n)|(\\n\\r)|\\r|\\n"));

    // keep the first two lines unencrypted
    noteText = noteTextLines.at(0) + "\n" + noteTextLines.at(1) + "\n\n" +
            QString(NOTE_TEXT_ENCRYPTION_PRE_STRING) + "\n";

    // remove the first two lines for encryption
    noteTextLines.removeFirst();
    noteTextLines.removeFirst();

    // remove the 3rd line too if it is empty
    if (noteTextLines.at(0) == "") {
        noteTextLines.removeFirst();
    }

    // join the remaining lines
    QString text = noteTextLines.join("\n");

    // empty notes will be detected as "can't be decrypted",
    // so we will add a space
    if (text.isEmpty()) {
        text = " ";
    }

    // encrypt the text
    SimpleCrypt* crypto = new SimpleCrypt(static_cast<quint64>(cryptoKey));
    QString encryptedText = crypto->encryptToString(text);

    // add the encrypted text to the new note text
    noteText += encryptedText + "\n" +
            QString(NOTE_TEXT_ENCRYPTION_POST_STRING);

    // store note
    store();

    return noteText;
}