apply clang-format

This commit is contained in:
Axel Kohlmeyer
2024-07-17 23:18:03 -04:00
parent 7c804f7843
commit 1d1bf669f6
5 changed files with 59 additions and 56 deletions

View File

@ -138,8 +138,7 @@ void ChartWindow::quit()
void ChartWindow::reset_zoom() void ChartWindow::reset_zoom()
{ {
int choice = columns->currentData().toInt(); int choice = columns->currentData().toInt();
if ((choice >= 0) && (choice < charts.size())) if ((choice >= 0) && (choice < charts.size())) charts[choice]->reset_zoom();
charts[choice]->reset_zoom();
} }
void ChartWindow::stop_run() void ChartWindow::stop_run()

View File

@ -885,8 +885,9 @@ void LammpsGui::logupdate()
else else
slideshow->hide(); slideshow->hide();
} else { } else {
slideshow->setWindowTitle( slideshow->setWindowTitle(QString("LAMMPS-GUI - Slide Show - %1 - Run %2")
QString("LAMMPS-GUI - Slide Show - %1 - Run %2").arg(current_file).arg(run_counter)); .arg(current_file)
.arg(run_counter));
if (QSettings().value("viewslide", true).toBool()) slideshow->show(); if (QSettings().value("viewslide", true).toBool()) slideshow->show();
} }
slideshow->add_image(imagefile); slideshow->add_image(imagefile);
@ -1254,50 +1255,51 @@ void LammpsGui::help()
msg.setWindowTitle("LAMMPS-GUI Quick Help"); msg.setWindowTitle("LAMMPS-GUI Quick Help");
msg.setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png")); msg.setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png"));
msg.setText("<div>This is LAMMPS-GUI version " LAMMPS_GUI_VERSION "</div>"); msg.setText("<div>This is LAMMPS-GUI version " LAMMPS_GUI_VERSION "</div>");
msg.setInformativeText("<p>LAMMPS-GUI is a graphical text editor that is customized for " msg.setInformativeText(
"editing LAMMPS input files and linked to the LAMMPS " "<p>LAMMPS-GUI is a graphical text editor that is customized for "
"library and thus can run LAMMPS directly using the contents of the " "editing LAMMPS input files and linked to the LAMMPS "
"text buffer as input. It can retrieve and display information from " "library and thus can run LAMMPS directly using the contents of the "
"LAMMPS while it is running and display visualizations created " "text buffer as input. It can retrieve and display information from "
"with the dump image command.</p>" "LAMMPS while it is running and display visualizations created "
"<p>The main window of the LAMMPS-GUI is a text editor window with " "with the dump image command.</p>"
"LAMMPS specific syntax highlighting. When typing <b>Ctrl-Enter</b> " "<p>The main window of the LAMMPS-GUI is a text editor window with "
"or clicking on 'Run LAMMMPS' in the 'Run' menu, LAMMPS will be run " "LAMMPS specific syntax highlighting. When typing <b>Ctrl-Enter</b> "
"with the contents of editor buffer as input. The output of the LAMMPS " "or clicking on 'Run LAMMMPS' in the 'Run' menu, LAMMPS will be run "
"run is captured and displayed in an Output window. The thermodynamic data " "with the contents of editor buffer as input. The output of the LAMMPS "
"is displayed in a chart window. Both are updated regularly during the " "run is captured and displayed in an Output window. The thermodynamic data "
"run, as is a progress bar in the main window. The running simulation " "is displayed in a chart window. Both are updated regularly during the "
"can be stopped cleanly by typing <b>Ctrl-/</b> or by clicking on " "run, as is a progress bar in the main window. The running simulation "
"'Stop LAMMPS' in the 'Run' menu. While LAMMPS is not running, " "can be stopped cleanly by typing <b>Ctrl-/</b> or by clicking on "
"an image of the simulated system can be created and shown in an image " "'Stop LAMMPS' in the 'Run' menu. While LAMMPS is not running, "
"viewer window by typing <b>Ctrl-i</b> or by clicking on 'View Image' " "an image of the simulated system can be created and shown in an image "
"in the 'Run' menu. Multiple image settings can be changed through the " "viewer window by typing <b>Ctrl-i</b> or by clicking on 'View Image' "
"buttons in the menu bar and the image will be re-renderd. In case " "in the 'Run' menu. Multiple image settings can be changed through the "
"an input file contains a dump image command, LAMMPS-GUI will load " "buttons in the menu bar and the image will be re-renderd. In case "
"the images as they are created and display them in a slide show. </p>" "an input file contains a dump image command, LAMMPS-GUI will load "
"<p>When opening a file, the editor will determine the directory " "the images as they are created and display them in a slide show. </p>"
"where the input file resides and switch its current working directory " "<p>When opening a file, the editor will determine the directory "
"to that same folder and thus enabling the run to read other files in " "where the input file resides and switch its current working directory "
"that folder, e.g. a data file. The GUI will show its current working " "to that same folder and thus enabling the run to read other files in "
"directory in the status bar. In addition to using the menu, the " "that folder, e.g. a data file. The GUI will show its current working "
"editor window can also receive files as the first command line " "directory in the status bar. In addition to using the menu, the "
"argument or via drag-n-drop from a graphical file manager or a " "editor window can also receive files as the first command line "
"desktop environment.</p>" "argument or via drag-n-drop from a graphical file manager or a "
"<p>Almost all commands are accessible via keyboard shortcuts. Which " "desktop environment.</p>"
"those shortcuts are, is typically shown next to their entries in the " "<p>Almost all commands are accessible via keyboard shortcuts. Which "
"menus. " "those shortcuts are, is typically shown next to their entries in the "
"In addition, the documentation for the command in the current line " "menus. "
"can be viewed by typing <b>Ctrl-?</b> or by choosing the respective " "In addition, the documentation for the command in the current line "
"entry in the context menu, available by right-clicking the mouse. " "can be viewed by typing <b>Ctrl-?</b> or by choosing the respective "
"Log, chart, slide show, and image windows can be closed with " "entry in the context menu, available by right-clicking the mouse. "
"<b>Ctrl-W</b> and the application terminated with <b>Ctrl-Q</b>.</p>" "Log, chart, slide show, and image windows can be closed with "
"<p>The 'About LAMMPS-GUI' dialog will show the LAMMPS version and the " "<b>Ctrl-W</b> and the application terminated with <b>Ctrl-Q</b>.</p>"
"features included into the LAMMPS library linked to the LAMMPS-GUI. " "<p>The 'About LAMMPS-GUI' dialog will show the LAMMPS version and the "
"A number of settings can be adjusted in the 'Preferences' dialog (in " "features included into the LAMMPS library linked to the LAMMPS-GUI. "
"the 'Edit' menu or from <b>Ctrl-P</b>) which includes selecting " "A number of settings can be adjusted in the 'Preferences' dialog (in "
"accelerator packages and number of OpenMP threads. Due to its nature " "the 'Edit' menu or from <b>Ctrl-P</b>) which includes selecting "
"as a graphical application, it is <b>not</b> possible to use the " "accelerator packages and number of OpenMP threads. Due to its nature "
"LAMMPS-GUI in parallel with MPI.</p>"); "as a graphical application, it is <b>not</b> possible to use the "
"LAMMPS-GUI in parallel with MPI.</p>");
msg.setIconPixmap(QPixmap(":/icons/lammps-icon-128x128.png").scaled(64, 64)); msg.setIconPixmap(QPixmap(":/icons/lammps-icon-128x128.png").scaled(64, 64));
msg.setStandardButtons(QMessageBox::Close); msg.setStandardButtons(QMessageBox::Close);
msg.exec(); msg.exec();

View File

@ -30,7 +30,8 @@
#include <QString> #include <QString>
#include <QTextStream> #include <QTextStream>
const QString LogWindow::yaml_regex = QStringLiteral("^(keywords:.*$|data:$|---$|\\.\\.\\.$| - \\[.*\\]$)"); const QString LogWindow::yaml_regex =
QStringLiteral("^(keywords:.*$|data:$|---$|\\.\\.\\.$| - \\[.*\\]$)");
LogWindow::LogWindow(const QString &_filename, QWidget *parent) : LogWindow::LogWindow(const QString &_filename, QWidget *parent) :
QPlainTextEdit(parent), filename(_filename) QPlainTextEdit(parent), filename(_filename)

View File

@ -93,7 +93,7 @@ void Preferences::accept()
// store selected accelerator // store selected accelerator
QList<QRadioButton *> allButtons = tabWidget->findChildren<QRadioButton *>(); QList<QRadioButton *> allButtons = tabWidget->findChildren<QRadioButton *>();
for (auto & allButton : allButtons) { for (auto &allButton : allButtons) {
if (allButton->isChecked()) { if (allButton->isChecked()) {
if (allButton->objectName() == "none") if (allButton->objectName() == "none")
settings->setValue("accelerator", QString::number(AcceleratorTab::None)); settings->setValue("accelerator", QString::number(AcceleratorTab::None));
@ -411,13 +411,13 @@ AcceleratorTab::AcceleratorTab(QSettings *_settings, LammpsWrapper *_lammps, QWi
auto *choices = new QFrame; auto *choices = new QFrame;
auto *choiceLayout = new QVBoxLayout; auto *choiceLayout = new QVBoxLayout;
#if defined(_OPENMP) #if defined(_OPENMP)
auto *ntlabel = new QLabel(QString("Number of threads (max %1):").arg(maxthreads)); auto *ntlabel = new QLabel(QString("Number of threads (max %1):").arg(maxthreads));
auto *ntchoice = new QLineEdit(settings->value("nthreads", maxthreads).toString()); auto *ntchoice = new QLineEdit(settings->value("nthreads", maxthreads).toString());
#else #else
auto *ntlabel = new QLabel(QString("Number of threads (OpenMP not available):")); auto *ntlabel = new QLabel(QString("Number of threads (OpenMP not available):"));
auto *ntchoice = new QLineEdit("1"); auto *ntchoice = new QLineEdit("1");
#endif #endif
auto *intval = new QIntValidator(1, maxthreads, this); auto *intval = new QIntValidator(1, maxthreads, this);
ntchoice->setValidator(intval); ntchoice->setValidator(intval);
ntchoice->setObjectName("nthreads"); ntchoice->setObjectName("nthreads");
#if !defined(_OPENMP) #if !defined(_OPENMP)

View File

@ -94,7 +94,8 @@ bool StdCapture::EndCapture()
buf[bytesRead] = 0; buf[bytesRead] = 0;
m_captured += buf; m_captured += buf;
} else if (bytesRead < 0) { } else if (bytesRead < 0) {
fd_blocked = ((errno == EAGAIN) || (errno == EWOULDBLOCK) || (errno == EINTR)) && (maxwait > 0); fd_blocked =
((errno == EAGAIN) || (errno == EWOULDBLOCK) || (errno == EINTR)) && (maxwait > 0);
if (fd_blocked) std::this_thread::sleep_for(std::chrono::milliseconds(10)); if (fd_blocked) std::this_thread::sleep_for(std::chrono::milliseconds(10));
--maxwait; --maxwait;