mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-08 12:10:43 +00:00
Merge branch 'master' into version
This commit is contained in:
commit
0a55e12d5b
@ -891,10 +891,9 @@ void PRS1Loader::ScanFiles(const QStringList & paths, int sessionid_base, Machin
|
|||||||
|
|
||||||
QDateTime datetime;
|
QDateTime datetime;
|
||||||
|
|
||||||
/* Unused until we get an actual timestamp below.
|
qint64 ignoreBefore = p_profile->session->ignoreOlderSessionsDate().toSecsSinceEpoch();
|
||||||
QDateTime ignoreBefore = p_profile->session->ignoreOlderSessionsDate();
|
|
||||||
bool ignoreOldSessions = p_profile->session->ignoreOlderSessions();
|
bool ignoreOldSessions = p_profile->session->ignoreOlderSessions();
|
||||||
*/
|
QSet<SessionID> skipped;
|
||||||
|
|
||||||
// for each p0/p1/p2/etc... folder
|
// for each p0/p1/p2/etc... folder
|
||||||
for (int p=0; p < size; ++p) {
|
for (int p=0; p < size; ++p) {
|
||||||
@ -937,15 +936,6 @@ void PRS1Loader::ScanFiles(const QStringList & paths, int sessionid_base, Machin
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This never worked: the filename isn't a timestamp.
|
|
||||||
if (ignoreOldSessions) {
|
|
||||||
datetime = QDateTime::fromTime_t(sid);
|
|
||||||
if (datetime < ignoreBefore) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TODO: BUG: This isn't right, since files can have multiple session
|
// TODO: BUG: This isn't right, since files can have multiple session
|
||||||
// chunks, which might not correspond to the filename. But before we can
|
// chunks, which might not correspond to the filename. But before we can
|
||||||
// fix this we need to come up with a reasonably fast way to filter previously
|
// fix this we need to come up with a reasonably fast way to filter previously
|
||||||
@ -957,6 +947,16 @@ void PRS1Loader::ScanFiles(const QStringList & paths, int sessionid_base, Machin
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((ext == 5) || (ext == 6)) {
|
if ((ext == 5) || (ext == 6)) {
|
||||||
|
if (skipped.contains(sid)) {
|
||||||
|
// We don't know the timestamp until the file is parsed, which we only do for
|
||||||
|
// waveform data at import (after scanning) since it's so large. If we relied
|
||||||
|
// solely on the chunks' timestamps at that point, we'd get half of an otherwise
|
||||||
|
// skipped session (the half after midnight).
|
||||||
|
//
|
||||||
|
// So we skip the entire file here based on the session's other data.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Waveform files aren't grouped... so we just want to add the filename for later
|
// Waveform files aren't grouped... so we just want to add the filename for later
|
||||||
QHash<SessionID, PRS1Import *>::iterator it = sesstasks.find(sid);
|
QHash<SessionID, PRS1Import *>::iterator it = sesstasks.find(sid);
|
||||||
if (it != sesstasks.end()) {
|
if (it != sesstasks.end()) {
|
||||||
@ -1013,7 +1013,14 @@ void PRS1Loader::ScanFiles(const QStringList & paths, int sessionid_base, Machin
|
|||||||
delete chunk;
|
delete chunk;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (ignoreOldSessions && chunk->timestamp < ignoreBefore) {
|
||||||
|
qDebug().noquote() << relativePath(path) << "skipping session" << chunk_sid << ":"
|
||||||
|
<< QDateTime::fromSecsSinceEpoch(chunk->timestamp).toString() << "older than"
|
||||||
|
<< QDateTime::fromSecsSinceEpoch(ignoreBefore).toString();
|
||||||
|
skipped += chunk_sid;
|
||||||
|
delete chunk;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
task = nullptr;
|
task = nullptr;
|
||||||
QHash<SessionID, PRS1Import *>::iterator it = sesstasks.find(chunk_sid);
|
QHash<SessionID, PRS1Import *>::iterator it = sesstasks.find(chunk_sid);
|
||||||
@ -7670,7 +7677,26 @@ QList<PRS1DataChunk *> PRS1Import::CoalesceWaveformChunks(QList<PRS1DataChunk *>
|
|||||||
lastchunk = chunk;
|
lastchunk = chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
return coalesced;
|
// In theory there could be broken sessions that have waveform data but no summary or events.
|
||||||
|
// Those waveforms won't be skipped by the scanner, so we have to check for them here.
|
||||||
|
//
|
||||||
|
// This won't be perfect, since any coalesced chunks starting after midnight of the threshhold
|
||||||
|
// date will also be imported, but those should be relatively few, and tolerable imprecision.
|
||||||
|
QList<PRS1DataChunk *> coalescedAndFiltered;
|
||||||
|
qint64 ignoreBefore = p_profile->session->ignoreOlderSessionsDate().toSecsSinceEpoch();
|
||||||
|
bool ignoreOldSessions = p_profile->session->ignoreOlderSessions();
|
||||||
|
|
||||||
|
for (auto & chunk : coalesced) {
|
||||||
|
if (ignoreOldSessions && chunk->timestamp < ignoreBefore) {
|
||||||
|
qWarning().noquote() << relativePath(chunk->m_path) << "skipping session" << chunk->sessionid << ":"
|
||||||
|
<< QDateTime::fromSecsSinceEpoch(chunk->timestamp).toString() << "older than"
|
||||||
|
<< QDateTime::fromSecsSinceEpoch(ignoreBefore).toString();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
coalescedAndFiltered.append(chunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
return coalescedAndFiltered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* OSCAR Logger module implementation
|
/* OSCAR Logger module implementation
|
||||||
*
|
*
|
||||||
|
* Copyright (c) 2020 The OSCAR Team
|
||||||
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
||||||
*
|
*
|
||||||
* This file is subject to the terms and conditions of the GNU General Public
|
* This file is subject to the terms and conditions of the GNU General Public
|
||||||
@ -59,18 +60,32 @@ void MyOutputHandler(QtMsgType type, const QMessageLogContext &context, const QS
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static QMutex s_LoggerRunning;
|
||||||
|
|
||||||
void initializeLogger()
|
void initializeLogger()
|
||||||
{
|
{
|
||||||
|
s_LoggerRunning.lock(); // lock until the thread starts running
|
||||||
logger = new LogThread();
|
logger = new LogThread();
|
||||||
otherThreadPool = new QThreadPool();
|
otherThreadPool = new QThreadPool();
|
||||||
bool b = otherThreadPool->tryStart(logger);
|
bool b = otherThreadPool->tryStart(logger);
|
||||||
|
if (b) {
|
||||||
|
s_LoggerRunning.lock(); // wait until the thread begins running
|
||||||
|
s_LoggerRunning.unlock(); // we no longer need the lock
|
||||||
|
}
|
||||||
qInstallMessageHandler(MyOutputHandler);
|
qInstallMessageHandler(MyOutputHandler);
|
||||||
if (b) {
|
if (b) {
|
||||||
qDebug() << "Started logging thread";
|
qDebug() << "Started logging thread";
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Logging thread did not start correctly";
|
qWarning() << "Logging thread did not start correctly";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogThread::connectionReady()
|
||||||
|
{
|
||||||
|
strlock.lock();
|
||||||
|
connected = true;
|
||||||
|
strlock.unlock();
|
||||||
|
qDebug() << "Logging UI initialized";
|
||||||
}
|
}
|
||||||
|
|
||||||
void shutdownLogger()
|
void shutdownLogger()
|
||||||
@ -117,10 +132,11 @@ void LogThread::quit() {
|
|||||||
void LogThread::run()
|
void LogThread::run()
|
||||||
{
|
{
|
||||||
running = true;
|
running = true;
|
||||||
|
s_LoggerRunning.unlock(); // unlock as soon as the thread begins to run
|
||||||
do {
|
do {
|
||||||
strlock.lock();
|
strlock.lock();
|
||||||
//int r = receivers(SIGNAL(outputLog(QString())));
|
//int r = receivers(SIGNAL(outputLog(QString())));
|
||||||
while (!buffer.isEmpty()) {
|
while (connected && !buffer.isEmpty()) {
|
||||||
QString msg = buffer.takeFirst();
|
QString msg = buffer.takeFirst();
|
||||||
fprintf(stderr, "%s\n", msg.toLocal8Bit().data());
|
fprintf(stderr, "%s\n", msg.toLocal8Bit().data());
|
||||||
emit outputLog(msg);
|
emit outputLog(msg);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#ifndef LOGGER_H
|
#ifndef LOGGER_H
|
||||||
#define LOGGER_H
|
#define LOGGER_H
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@ -16,13 +16,14 @@ class LogThread:public QObject, public QRunnable
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit LogThread() : QRunnable() { running = false; logtime.start(); }
|
explicit LogThread() : QRunnable() { running = false; logtime.start(); connected = false; }
|
||||||
virtual ~LogThread() {}
|
virtual ~LogThread() {}
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
void append(QString msg);
|
void append(QString msg);
|
||||||
void appendClean(QString msg);
|
void appendClean(QString msg);
|
||||||
bool isRunning() { return running; }
|
bool isRunning() { return running; }
|
||||||
|
void connectionReady();
|
||||||
|
|
||||||
void quit();
|
void quit();
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ signals:
|
|||||||
protected:
|
protected:
|
||||||
volatile bool running;
|
volatile bool running;
|
||||||
QTime logtime;
|
QTime logtime;
|
||||||
|
bool connected;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern LogThread * logger;
|
extern LogThread * logger;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* OSCAR Main
|
/* OSCAR Main
|
||||||
*
|
*
|
||||||
|
* Copyright (c) 2019-2020 The OSCAR Team
|
||||||
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
* Copyright (c) 2011-2018 Mark Watkins <mark@jedimark.net>
|
||||||
*
|
*
|
||||||
* This file is subject to the terms and conditions of the GNU General Public
|
* This file is subject to the terms and conditions of the GNU General Public
|
||||||
@ -338,7 +339,6 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initializeLogger();
|
initializeLogger();
|
||||||
QThread::msleep(50); // Logger takes a little bit to catch up
|
|
||||||
|
|
||||||
qDebug().noquote() << "OSCAR starting" << QDateTime::currentDateTime().toString();
|
qDebug().noquote() << "OSCAR starting" << QDateTime::currentDateTime().toString();
|
||||||
|
|
||||||
|
@ -69,10 +69,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui(new Ui::MainWindow)
|
ui(new Ui::MainWindow)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->logText->setPlainText("00000: Startup: OSCAR Logger initialized");
|
|
||||||
|
|
||||||
if (logger) {
|
if (logger) {
|
||||||
connect(logger, SIGNAL(outputLog(QString)), this, SLOT(logMessage(QString)));
|
connect(logger, SIGNAL(outputLog(QString)), this, SLOT(logMessage(QString)));
|
||||||
|
logger->connectionReady();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bring window to top (useful when language is changed)
|
// Bring window to top (useful when language is changed)
|
||||||
@ -128,9 +128,8 @@ void MainWindow::SetupGUI()
|
|||||||
setWindowTitle(getMainWindowTitle());
|
setWindowTitle(getMainWindowTitle());
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
ui->action_About->setMenuRole(QAction::ApplicationSpecificRole);
|
ui->action_About->setMenuRole(QAction::AboutRole);
|
||||||
ui->action_Preferences->setMenuRole(QAction::ApplicationSpecificRole);
|
ui->action_Preferences->setMenuRole(QAction::PreferencesRole);
|
||||||
ui->action_Preferences->setShortcuts(QKeySequence::Preferences);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ui->actionLine_Cursor->setChecked(AppSetting->lineCursorMode());
|
ui->actionLine_Cursor->setChecked(AppSetting->lineCursorMode());
|
||||||
|
Loading…
Reference in New Issue
Block a user