add a run counter to log, chart, and slideshow window titles
this counter is reset on loading a new file
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(lammps-gui VERSION 1.5.6 LANGUAGES CXX)
|
project(lammps-gui VERSION 1.5.7 LANGUAGES CXX)
|
||||||
|
|
||||||
set(CMAKE_AUTOUIC ON)
|
set(CMAKE_AUTOUIC ON)
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
|||||||
@ -63,7 +63,8 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
|
|||||||
QMainWindow(parent), ui(new Ui::LammpsGui), highlighter(nullptr), capturer(nullptr),
|
QMainWindow(parent), ui(new Ui::LammpsGui), highlighter(nullptr), capturer(nullptr),
|
||||||
status(nullptr), logwindow(nullptr), imagewindow(nullptr), chartwindow(nullptr),
|
status(nullptr), logwindow(nullptr), imagewindow(nullptr), chartwindow(nullptr),
|
||||||
slideshow(nullptr), logupdater(nullptr), dirstatus(nullptr), progress(nullptr),
|
slideshow(nullptr), logupdater(nullptr), dirstatus(nullptr), progress(nullptr),
|
||||||
prefdialog(nullptr), lammpsstatus(nullptr), varwindow(nullptr)
|
prefdialog(nullptr), lammpsstatus(nullptr), varwindow(nullptr), runner(nullptr),
|
||||||
|
is_running(false), run_counter(0)
|
||||||
{
|
{
|
||||||
// enforce using the plain ASCII C locale within the GUI.
|
// enforce using the plain ASCII C locale within the GUI.
|
||||||
QLocale::setDefault(QLocale("C"));
|
QLocale::setDefault(QLocale("C"));
|
||||||
@ -373,6 +374,7 @@ void LammpsGui::new_document()
|
|||||||
lammps.close();
|
lammps.close();
|
||||||
lammpsstatus->hide();
|
lammpsstatus->hide();
|
||||||
setWindowTitle(QString("LAMMPS-GUI - *unknown*"));
|
setWindowTitle(QString("LAMMPS-GUI - *unknown*"));
|
||||||
|
run_counter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LammpsGui::open()
|
void LammpsGui::open()
|
||||||
@ -588,6 +590,7 @@ void LammpsGui::open_file(const QString &fileName)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setWindowTitle(QString("LAMMPS-GUI - " + current_file));
|
setWindowTitle(QString("LAMMPS-GUI - " + current_file));
|
||||||
|
run_counter = 0;
|
||||||
QTextStream in(&file);
|
QTextStream in(&file);
|
||||||
QString text = in.readAll();
|
QString text = in.readAll();
|
||||||
ui->textEdit->document()->setPlainText(text);
|
ui->textEdit->document()->setPlainText(text);
|
||||||
@ -862,7 +865,8 @@ void LammpsGui::logupdate()
|
|||||||
else
|
else
|
||||||
slideshow->hide();
|
slideshow->hide();
|
||||||
} else {
|
} else {
|
||||||
slideshow->setWindowTitle(QString("LAMMPS-GUI - Slide Show: ") + current_file);
|
slideshow->setWindowTitle(
|
||||||
|
QString("LAMMPS-GUI - Slide Show: %1 - Run %2").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);
|
||||||
@ -980,6 +984,7 @@ void LammpsGui::do_run(bool use_buffer)
|
|||||||
progress->setValue(0);
|
progress->setValue(0);
|
||||||
dirstatus->hide();
|
dirstatus->hide();
|
||||||
progress->show();
|
progress->show();
|
||||||
|
|
||||||
int nthreads = settings.value("nthreads", 1).toInt();
|
int nthreads = settings.value("nthreads", 1).toInt();
|
||||||
int accel = settings.value("accelerator", AcceleratorTab::None).toInt();
|
int accel = settings.value("accelerator", AcceleratorTab::None).toInt();
|
||||||
if ((accel != AcceleratorTab::OpenMP) && (accel != AcceleratorTab::Intel) &&
|
if ((accel != AcceleratorTab::OpenMP) && (accel != AcceleratorTab::Intel) &&
|
||||||
@ -996,6 +1001,7 @@ void LammpsGui::do_run(bool use_buffer)
|
|||||||
|
|
||||||
runner = new LammpsRunner(this);
|
runner = new LammpsRunner(this);
|
||||||
is_running = true;
|
is_running = true;
|
||||||
|
++run_counter;
|
||||||
if (use_buffer) {
|
if (use_buffer) {
|
||||||
// always add final newline since the text edit widget does not do it
|
// always add final newline since the text edit widget does not do it
|
||||||
char *input = mystrdup(ui->textEdit->toPlainText() + "\n");
|
char *input = mystrdup(ui->textEdit->toPlainText() + "\n");
|
||||||
@ -1015,12 +1021,11 @@ void LammpsGui::do_run(bool use_buffer)
|
|||||||
logwindow->setReadOnly(true);
|
logwindow->setReadOnly(true);
|
||||||
logwindow->setCenterOnScroll(true);
|
logwindow->setCenterOnScroll(true);
|
||||||
logwindow->moveCursor(QTextCursor::End);
|
logwindow->moveCursor(QTextCursor::End);
|
||||||
if (use_buffer)
|
logwindow->setWindowTitle(
|
||||||
logwindow->setWindowTitle("LAMMPS-GUI - Output from running LAMMPS on buffer - " +
|
QString("LAMMPS-GUI - Output from running LAMMPS on %1 - %2 - Run %3")
|
||||||
current_file);
|
.arg(use_buffer ? "buffer" : "file")
|
||||||
else
|
.arg(current_file)
|
||||||
logwindow->setWindowTitle("LAMMPS-GUI - Output from running LAMMPS on file - " +
|
.arg(run_counter));
|
||||||
current_file);
|
|
||||||
logwindow->setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png"));
|
logwindow->setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png"));
|
||||||
QFont text_font;
|
QFont text_font;
|
||||||
text_font.fromString(settings.value("textfont", text_font.toString()).toString());
|
text_font.fromString(settings.value("textfont", text_font.toString()).toString());
|
||||||
@ -1039,12 +1044,11 @@ void LammpsGui::do_run(bool use_buffer)
|
|||||||
// if configured, delete old log window before opening new one
|
// if configured, delete old log window before opening new one
|
||||||
if (settings.value("chartreplace", false).toBool()) delete chartwindow;
|
if (settings.value("chartreplace", false).toBool()) delete chartwindow;
|
||||||
chartwindow = new ChartWindow(current_file);
|
chartwindow = new ChartWindow(current_file);
|
||||||
if (use_buffer)
|
chartwindow->setWindowTitle(
|
||||||
chartwindow->setWindowTitle("LAMMPS-GUI - Thermo charts from running LAMMPS on buffer - " +
|
QString("LAMMPS-GUI - Thermo charts from running LAMMPS on %1 - %2 - Run %3")
|
||||||
current_file);
|
.arg(use_buffer ? "buffer" : "file")
|
||||||
else
|
.arg(current_file)
|
||||||
chartwindow->setWindowTitle("LAMMPS-GUI - Thermo charts from running LAMMPS on file - " +
|
.arg(run_counter));
|
||||||
current_file);
|
|
||||||
chartwindow->setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png"));
|
chartwindow->setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png"));
|
||||||
chartwindow->setMinimumSize(400, 300);
|
chartwindow->setMinimumSize(400, 300);
|
||||||
shortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), chartwindow);
|
shortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), chartwindow);
|
||||||
|
|||||||
@ -126,6 +126,7 @@ private:
|
|||||||
LammpsRunner *runner;
|
LammpsRunner *runner;
|
||||||
std::string plugin_path;
|
std::string plugin_path;
|
||||||
bool is_running;
|
bool is_running;
|
||||||
|
int run_counter;
|
||||||
std::vector<char *> lammps_args;
|
std::vector<char *> lammps_args;
|
||||||
};
|
};
|
||||||
#endif // LAMMPSGUI_H
|
#endif // LAMMPSGUI_H
|
||||||
|
|||||||
Reference in New Issue
Block a user