#include "scrawler.h"

#include <QCoreApplication>
#include <iostream>
#include <QSqlDatabase>
#include <QNetworkProxy>
#include <time.h>

using namespace std;

int main(int argc, char *argv[])
{
    srand(time(0));
    QApplication a(argc, argv);
    a.setApplicationName(QString("Chrome"));
    a.setApplicationVersion(QString("39.0.2171.95"));

    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("bigbird.iptime.org");
    db.setUserName("admin");
    db.setPassword("admin123");
    db.setDatabaseName("concepters");

    if (db.open() == false)
    {
        std::cout << "error : db open fail...";
        return 0;
    }

    SCrawler *process = new SCrawler;
    QObject::connect(process, SIGNAL(finished()), QApplication::instance(), SLOT(quit()));

    QWebSettings::setObjectCacheCapacities(0,0,0);
    QWebSettings::clearMemoryCaches();

    QStringList strArgv;
    for (int i = 1; i < argc ; i++)
        strArgv.push_back(argv[i]);

    process->load(strArgv);
    a.exec();
    return 0;
}
