Exemple #1
0
Analysis::~Analysis() {
	deleteKeys();
	std::map<std::string, wchar_t *>::iterator it = attributes.begin();
	while (it != attributes.end()) {
		delete[] it++->second;
	}
}
Exemple #2
0
Analysis::~Analysis() {
	deleteKeys();
	std::map<Key, wchar_t *>::iterator it = attributes.begin();
	while (it != attributes.end()) {
		if (!constAttributes[static_cast<int>(it->first)]) {
			delete[] it->second;
		}
		++it;
	}
}
Exemple #3
0
void Analysis::seal() {
	deleteKeys();
	keys = new const char*[attributes.size() + 1];
	std::map<Key, wchar_t *>::const_iterator it = attributes.begin();
	size_t i = 0;
	while (it != attributes.end()) {
		keys[i++] = KEY_TO_STRING[(int)it++->first];
	}
	keys[i] = 0;
}
Exemple #4
0
void Analysis::recreateKeys() {
	deleteKeys();
	keys = new const char*[attributes.size() + 1];
	std::map<std::string, wchar_t *>::const_iterator it = attributes.begin();
	size_t i = 0;
	while (it != attributes.end()) {
		keys[i++] = it++->first.c_str();
	}
	keys[i] = 0;
}
int main(int argc, char *argv[])
{
    // For this example, wizard-generates single line code would be good enough,
    // but very soon it won't be enough for you anyway, so use this more detailed example from start
    QScopedPointer<QGuiApplication> app(SailfishApp::application(argc, argv));
    QScopedPointer<QQuickView> view(SailfishApp::createView());

// Here's how you will add QML components whenever you start using them
// Check https://github.com/amarchen/Wikipedia for a more full example
// view->engine()->addImportPath(SailfishApp::pathTo("qml/components").toString());

    sshExecuteCmd *sshCmd = new sshExecuteCmd();

    sshCmd->setSpinnerState(false);

    sshExecuteCmd *sshGenKey = new sshExecuteCmd();

    sshExecuteCmd *sshDelKey = new sshExecuteCmd();

    sshExecuteCmd *sshReadKey = new sshExecuteCmd();

    QThread* sshGenKeythread = new QThread;

    QThread* sshDelKeythread = new QThread;

    QThread* sshReadKeythread = new QThread;

    qDebug("Main Thread ID: %d",(int)QGuiApplication::instance()->thread());

    sqliteDB *onesshotDB = new sqliteDB();

    onesshotDB->createDB();



    sshGenKey->moveToThread(sshGenKeythread);

    QObject::connect(sshGenKeythread, SIGNAL(started()), sshGenKey, SLOT(genKey()),Qt::QueuedConnection);
    QObject::connect(sshGenKeythread, SIGNAL(started()), sshCmd, SLOT(spinIt()));
    QObject::connect(sshGenKey, SIGNAL(spinnerStateUpdated()), sshCmd, SLOT(stopSpinningIt()));
    QObject::connect(sshGenKey, SIGNAL(finished()), sshCmd, SLOT(stopSpinningIt()));


    sshDelKey->moveToThread(sshDelKeythread);

    QObject::connect(sshDelKeythread, SIGNAL(started()), sshDelKey, SLOT(deleteKeys()),Qt::QueuedConnection);
    QObject::connect(sshDelKeythread, SIGNAL(started()), sshCmd, SLOT(spinIt()));
    QObject::connect(sshDelKey, SIGNAL(keysDeletedUpdated()), sshCmd, SLOT(stopSpinningIt()));



    sshReadKey->moveToThread(sshReadKeythread);

    QObject::connect(sshReadKeythread, SIGNAL(started()), sshReadKey, SLOT(readKey()),Qt::QueuedConnection);
    QObject::connect(sshReadKeythread, SIGNAL(started()), sshCmd, SLOT(spinIt()));
    QObject::connect(sshReadKey, SIGNAL(pubKeyURLUpdated(QString)), sshCmd, SLOT(stopSpinningIt()));
    QObject::connect(sshReadKey, SIGNAL(pubKeyURLUpdated(QString)), sshReadKey, SLOT(getPubKey()));
    QObject::connect(sshReadKey, SIGNAL(pubKeyURLUpdated(QString)), sshReadKey, SLOT(getPubKeyURL()));


    view->rootContext()->setContextProperty("sshGenKey", sshGenKeythread);

    view->rootContext()->setContextProperty("sshDelKey", sshDelKeythread);

    view->rootContext()->setContextProperty("sshReadKey", sshReadKeythread);

    view->rootContext()->setContextProperty("sshReadKeyValue", sshReadKey);

    view->rootContext()->setContextProperty("sshCmd", sshCmd);

    view->setSource(SailfishApp::pathTo("qml/oneSSHot.qml"));

    view->show();


    return app->exec();
}