From f9ba063c4a19d2330a828ee7e377cfe2e52a4945 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 30 Apr 2025 12:17:31 -0400 Subject: [PATCH] add citation reminder --- tools/lammps-gui/lammps-gui.appdata.xml | 1 + tools/lammps-gui/lammpsgui.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/lammps-gui/lammps-gui.appdata.xml b/tools/lammps-gui/lammps-gui.appdata.xml index 875f0bfea2..3061e973ea 100644 --- a/tools/lammps-gui/lammps-gui.appdata.xml +++ b/tools/lammps-gui/lammps-gui.appdata.xml @@ -62,6 +62,7 @@ Add option to visualize molecules defined through the molecule command Add text fields for editing plot title and axis labels for charts Add option to automatically open tutorial websites (enabled by default) + Add citation reminder comment to empty documents and the About dialog currently pointing to arXiv. Add preferences tab for charts to set default for title, plot colors, smooth/raw plot, smooth params Highlight error URLs with pointers to additional explanations in log window Double-click on highlighted URL opens it in web browser. Also available via context menu. diff --git a/tools/lammps-gui/lammpsgui.cpp b/tools/lammps-gui/lammpsgui.cpp index d515e8df78..f23f2daa31 100644 --- a/tools/lammps-gui/lammpsgui.cpp +++ b/tools/lammps-gui/lammpsgui.cpp @@ -68,6 +68,8 @@ static const QString blank(" "); static constexpr int BUFLEN = 256; +static const QString citeme("# When using LAMMPS-GUI in your project, please cite: " + "https://arxiv.org/abs/2503.14020\n"); LammpsGui::LammpsGui(QWidget *parent, const QString &filename) : QMainWindow(parent), ui(new Ui::LammpsGui), highlighter(nullptr), capturer(nullptr), @@ -78,6 +80,8 @@ LammpsGui::LammpsGui(QWidget *parent, const QString &filename) : { docver = ""; ui->setupUi(this); + ui->textEdit->document()->setPlainText(citeme); + ui->textEdit->document()->setModified(false); this->setCentralWidget(ui->textEdit); highlighter = new Highlighter(ui->textEdit->document()); capturer = new StdCapture; @@ -413,7 +417,8 @@ LammpsGui::~LammpsGui() void LammpsGui::new_document() { current_file.clear(); - ui->textEdit->document()->setPlainText(QString()); + ui->textEdit->document()->setPlainText(citeme); + ui->textEdit->document()->setModified(false); if (lammps.is_running()) { stop_run(); @@ -1487,10 +1492,10 @@ void LammpsGui::about() info = std::string(info, start, end - start); } + info += citeme.toStdString(); to_clipboard += info.c_str(); #if QT_CONFIG(clipboard) QGuiApplication::clipboard()->setText(to_clipboard); - info += "(Note: this text has been copied to the clipboard)\n"; #endif QMessageBox msg;