Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "frontend/plot"]
path = frontend/plot
url = https://github.com/disorderedmaterials/plot
22 changes: 19 additions & 3 deletions frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ find_package(
COMPONENTS Core Gui Widgets Network Charts Xml
REQUIRED)

add_subdirectory(plot/)

# Build main binary
qt6_add_executable(
jv2
Expand All @@ -46,6 +48,12 @@ qt6_add_executable(
journal.h
lock.cpp
lock.h
logValue.cpp
logValue.h
logValueData.cpp
logValueData.h
logValueGroup.cpp
logValueGroup.h
optionalRef.h
# Backend
backend.cpp
Expand All @@ -69,7 +77,6 @@ qt6_add_executable(
nexusInteraction.cpp
searching.cpp
settings.cpp
visualisation.cpp
version.h
# Models
genericTreeModel.cpp
Expand All @@ -82,6 +89,12 @@ qt6_add_executable(
journalSourceFilterProxy.h
journalSourceModel.cpp
journalSourceModel.h
logValueFilterProxy.cpp
logValueFilterProxy.h
logValueGroupModel.cpp
logValueGroupModel.h
logValueModel.cpp
logValueModel.h
runDataModel.cpp
runDataModel.h
runDataFilterProxy.cpp
Expand All @@ -95,6 +108,9 @@ qt6_add_executable(
journalSourcesDialog.cpp
journalSourcesDialog.h
journalSourcesDialog.ui
plotLogDataWidget.cpp
plotLogDataWidget.h
plotLogDataWidget.ui
searchDialog.cpp
searchDialog.h
searchDialog.ui
Expand All @@ -108,10 +124,10 @@ qt6_add_executable(

set_target_properties(jv2 PROPERTIES WIN32_EXECUTABLE ON)
target_link_libraries(jv2 PRIVATE Qt6::Core Qt6::Widgets Qt6::Network
Qt6::Charts Qt6::Xml)
Qt6::Charts Qt6::Xml mildred)

target_include_directories(
jv2
PRIVATE ${PROJECT_SOURCE_DIR} ${Qt6Widgets_INCLUDE_DIRS}
${Qt6Xml_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS}
${Qt6Charts_INCLUDE_DIRS})
${Qt6Charts_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/plot/src)
4 changes: 4 additions & 0 deletions frontend/args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// Copyright (c) 2025 Team JournalViewer and contributors

#include "args.h"
#include <QDebug>

namespace JV2
{
CLIArgs::CLIArgs() : helpOption_(addHelpOption())
{
setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
Expand Down Expand Up @@ -34,3 +37,4 @@ bool CLIArgs::parseArguments(const QList<QString> &arguments)

return true;
}
} // namespace JV2
3 changes: 3 additions & 0 deletions frontend/args.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <QList>
#include <QString>

namespace JV2
{
class CLIArgs : public QCommandLineParser
{
public:
Expand All @@ -31,3 +33,4 @@ class CLIArgs : public QCommandLineParser
const inline static QString UseWaitress = QStringLiteral("use-waitress");
const inline static QString DebugBackend = QStringLiteral("debug-backend");
};
} // namespace JV2
9 changes: 6 additions & 3 deletions frontend/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <QCommandLineParser>
#include <QProcessEnvironment>

namespace JV2
{
Backend::Backend(const QCommandLineParser &args) : process_()
{
QStringList backendArgs;
Expand Down Expand Up @@ -171,9 +173,9 @@ void Backend::acquireAllJournalsStop(const HttpRequestWorker::HttpRequestHandler
* NeXuS Endpoints
*/

// Get NeXuS log values present in specified run files
void Backend::getNexusFields(const JournalSource *source, const std::vector<int> &runNos,
const HttpRequestWorker::HttpRequestHandler &handler)
// Get all NeXuS log values present over specified run files
void Backend::getNeXuSLogValues(const JournalSource *source, const std::vector<int> &runNos,
const HttpRequestWorker::HttpRequestHandler &handler)
{
auto data = source->sourceObjectData();

Expand Down Expand Up @@ -301,3 +303,4 @@ void Backend::generateFinalise(const JournalSource *source, JournalGenerationSty

postRequest(createRoute("generate/finalise"), data, handler);
}
} // namespace JV2
24 changes: 19 additions & 5 deletions frontend/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
#pragma once

#include "httpRequestWorker.h"
#include <QCommandLineParser>
#include <QNetworkAccessManager>
#include <QProcess>
#include <QString>

namespace JV2
{
// Forward-declarations
class JournalSource;
class QCommandLineParser;

// Backend Process
class Backend : public QObject
Expand Down Expand Up @@ -44,10 +46,21 @@ class Backend : public QObject
// Create a request
HttpRequestWorker *createRequest(const QString &url, const HttpRequestWorker::HttpRequestHandler &handler = {});

public:
// Error Codes
const inline static QString NoError = QStringLiteral("NoError");
const inline static QString QNetworkReplyError = QStringLiteral("QNetworkReplyError");
const inline static QString InvalidRequestError = QStringLiteral("InvalidRequestError");
const inline static QString NetworkError = QStringLiteral("NetworkError");
const inline static QString XMLParseError = QStringLiteral("XMLParseError");
const inline static QString CollectionNotFoundError = QStringLiteral("CollectionNotFoundError");
const inline static QString JournalNotFoundError = QStringLiteral("JournalNotFoundError");
const inline static QString FileNotFoundError = QStringLiteral("FileNotFoundError");

public slots:
// Start the backend process
void start();
// Stop the backend processs
// Stop the backend process
void stop();

signals:
Expand Down Expand Up @@ -88,9 +101,9 @@ class Backend : public QObject
* NeXuS Endpoints
*/
public:
// Get NeXuS log values present in specified run files
void getNexusFields(const JournalSource *source, const std::vector<int> &runNos,
const HttpRequestWorker::HttpRequestHandler &handler = {});
// Get all NeXuS log values present over specified run files
void getNeXuSLogValues(const JournalSource *source, const std::vector<int> &runNos,
const HttpRequestWorker::HttpRequestHandler &handler = {});
// Get NeXuS log value data for specified run files
void getNexusLogValueData(const JournalSource *source, const std::vector<int> &runNos, const QString &logValue,
const HttpRequestWorker::HttpRequestHandler &handler = {});
Expand Down Expand Up @@ -129,3 +142,4 @@ class Backend : public QObject
void generateFinalise(const JournalSource *source, JournalGenerationStyle generationStyle,
const HttpRequestWorker::HttpRequestHandler &handler = {});
};
} // namespace JV2
3 changes: 3 additions & 0 deletions frontend/chartView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <QValueAxis>
#include <QtGui/QMouseEvent>

namespace JV2
{
ChartView::ChartView(QChart *chart, QWidget *parent) : QChartView(chart, parent)
{
setRubberBand(QChartView::HorizontalRubberBand);
Expand Down Expand Up @@ -317,3 +319,4 @@ void ChartView::mouseMoveEvent(QMouseEvent *event)

QChartView::mouseMoveEvent(event);
}
} // namespace JV2
3 changes: 3 additions & 0 deletions frontend/chartView.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <QtCharts/QChartView>
#include <QtWidgets/QRubberBand>

namespace JV2
{
class ChartView : public QChartView
{
Q_OBJECT
Expand Down Expand Up @@ -43,3 +45,4 @@ class ChartView : public QChartView
QGraphicsSimpleTextItem *coordStartLabelX_;
QGraphicsSimpleTextItem *coordStartLabelY_;
};
} // namespace JV2
10 changes: 8 additions & 2 deletions frontend/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
// Copyright (c) 2025 Team JournalViewer and contributors

#include "mainWindow.h"
#include "plotLogDataWidget.h"
#include <QInputDialog>
#include <QJsonArray>
#include <QMessageBox>
#include <QNetworkReply>
#include <QSettings>
#include <QWidgetAction>

namespace JV2
{
/*
* Private Functions
*/
Expand Down Expand Up @@ -200,8 +203,10 @@ void MainWindow::runDataContextMenuRequested(QPoint pos)
}
else if (selectedAction == plotSELog)
{
backend_.getNexusFields(currentJournalSource(), selectedRunNumbers(),
[=](HttpRequestWorker *worker) { handlePlotSELogValue(worker); });
auto *plot = new PlotLogDataWidget(this, backend_, currentJournalSource(), selectedRunNumbers());
auto index = ui_.MainTabs->addTab(plot, plot->summaryText());
connect(plot, SIGNAL(summaryTextChanged(QString)), this, SLOT(setTabTitle(QString)));
ui_.MainTabs->setCurrentIndex(index);
}
else if (selectedAction == plotDetector)
{
Expand All @@ -214,3 +219,4 @@ void MainWindow::runDataContextMenuRequested(QPoint pos)
[=](HttpRequestWorker *worker) { plotMonSpectra(worker); });
}
}
} // namespace JV2
3 changes: 3 additions & 0 deletions frontend/errorHandling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "mainWindow.h"
#include <QNetworkReply>

namespace JV2
{
// Perform check for errors on http request, returning the handled error
QString MainWindow::handleRequestError(HttpRequestWorker *worker, const QString &taskDescription)
{
Expand Down Expand Up @@ -51,3 +53,4 @@ void MainWindow::setErrorPage(const QString &errorTitle, const QString &errorTex
}

void MainWindow::on_ErrorOKButton_clicked(bool checked) { updateForCurrentSource(JournalSource::JournalSourceState::OK); }
} // namespace JV2
3 changes: 3 additions & 0 deletions frontend/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <QFileDialog>
#include <QMessageBox>

namespace JV2
{
void MainWindow::exportRunDataAsText()
{
// Save selection or all items?
Expand Down Expand Up @@ -56,3 +58,4 @@ void MainWindow::exportRunDataAsText()
*/

void MainWindow::on_actionExportAsText_triggered() { exportRunDataAsText(); }
} // namespace JV2
3 changes: 3 additions & 0 deletions frontend/filtering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <QInputDialog>
#include <QMessageBox>

namespace JV2
{
/*
* UI
*/
Expand Down Expand Up @@ -46,3 +48,4 @@ void MainWindow::on_GroupRunsButton_clicked(bool checked)

// Clears filter parameters
void MainWindow::on_RunFilterClearButton_clicked(bool checked) { ui_.RunFilterEdit->clear(); }
} // namespace JV2
3 changes: 3 additions & 0 deletions frontend/finding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "mainWindow.h"
#include <QInputDialog>

namespace JV2
{
/*
* Private Functions
*/
Expand Down Expand Up @@ -132,3 +134,4 @@ void MainWindow::on_actionFind_triggered()
void MainWindow::on_actionFindNext_triggered() { findDown(); }
void MainWindow::on_actionFindPrevious_triggered() { findUp(); }
void MainWindow::on_actionSelectAllFound_triggered() { selectAllSearches(); }
} // namespace JV2
3 changes: 3 additions & 0 deletions frontend/generation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "mainWindow.h"
#include <QMessageBox>

namespace JV2
{
/*
* UI
*/
Expand Down Expand Up @@ -197,3 +199,4 @@ void MainWindow::handleGenerateScanStop(HttpRequestWorker *worker)

sourceBeingGenerated_ = nullptr;
}
} // namespace JV2
Loading
Loading