예제 #1
0
void LogLoader::init(qint64 &logSize)
{
    readSettings();
    logSize = getLogFileSize();

    if(logSize >= 0)
    {
        emit pDebug("Log found.");
        emit pLog(tr("Log: Log found."));

        if(logSize == 0)
        {
            emit pDebug("Log is empty.");
            emit pLog(tr("Log: Log is empty."));
        }

        this->logSize = logSize;
        firstRun = true;
        updateTime = 1000;

        logWorker = new LogWorker(this, logPath);
        connect(logWorker, SIGNAL(newLogLineRead(QString, qint64)),
                this, SLOT(emitNewLogLineRead(QString, qint64)));
        connect(logWorker, SIGNAL(seekChanged(qint64)),
                this, SLOT(updateSeek(qint64)));
        connect(logWorker, SIGNAL(pLog(QString)),
                this, SIGNAL(pLog(QString)));
        connect(logWorker, SIGNAL(pDebug(QString,DebugLevel,QString)),
                this, SIGNAL(pDebug(QString,DebugLevel,QString)));

        QTimer::singleShot(1000, this, SLOT(sendLogWorker())); //Retraso para dejar que la aplicacion se pinte.
    }
    else
    {
        QSettings settings("Arena Tracker", "Arena Tracker");
        settings.setValue("logPath", "");
        emit pDebug("Log not found.");
        emit pLog(tr("Log: Log not found. Restart Arena Tracker and set the path again."));
        QMessageBox::information((QMainWindow*)this->parent(), tr("Log not found"), tr("Log not found. Restart Arena Tracker and set the path again."));
    }
}
예제 #2
0
void LogLoader::init(qint64 &logSize)
{
    readSettings();
    logSize = getLogFileSize();

    if(logSize >= 0)
    {
        emit pDebug("Log found.");
        emit pLog(tr("Log: Log found."));

        if(logSize == 0)
        {
            emit pDebug("Log is empty.");
            emit pLog(tr("Log: Log is empty."));
        }

        this->logSize = logSize;
        firstRun = true;
        updateTime = 1000;

        logWorker = new LogWorker(this, logPath);
        connect(logWorker, SIGNAL(newLogLineRead(QString, qint64)),
                this, SLOT(emitNewLogLineRead(QString, qint64)));
        connect(logWorker, SIGNAL(seekChanged(qint64)),
                this, SLOT(updateSeek(qint64)));
        connect(logWorker, SIGNAL(pLog(QString)),
                this, SIGNAL(pLog(QString)));
        connect(logWorker, SIGNAL(pDebug(QString,DebugLevel,QString)),
                this, SIGNAL(pDebug(QString,DebugLevel,QString)));

        QTimer::singleShot(updateTime, this, SLOT(sendLogWorker()));
    }
    else
    {
        QSettings settings("Arena Tracker", "Arena Tracker");
        settings.setValue("logPath", "");
        emit pDebug("Log not found.");
        emit pLog(tr("Log: Log not found. Restart Arena Tracker and set the path again."));
    }
}