more compact and consistent window titles

This commit is contained in:
Axel Kohlmeyer
2024-07-16 05:13:04 -04:00
parent 90dee57aae
commit 615c1bb623

View File

@ -169,7 +169,7 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
ui->textEdit->setMinimumSize(600, 400); ui->textEdit->setMinimumSize(600, 400);
varwindow = new QLabel(QString()); varwindow = new QLabel(QString());
varwindow->setWindowTitle("LAMMPS-GUI - Current Variables:"); varwindow->setWindowTitle(QString("LAMMPS-GUI - Current Variables - " + current_file));
varwindow->setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png")); varwindow->setWindowIcon(QIcon(":/icons/lammps-icon-128x128.png"));
varwindow->setMinimumSize(100, 50); varwindow->setMinimumSize(100, 50);
varwindow->setText("(none)"); varwindow->setText("(none)");
@ -272,7 +272,7 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
if (filename) { if (filename) {
open_file(filename); open_file(filename);
} else { } else {
setWindowTitle(QString("LAMMPS-GUI - *unknown*")); setWindowTitle("LAMMPS-GUI - Editor - *unknown*");
} }
resize(settings.value("mainx", "500").toInt(), settings.value("mainy", "320").toInt()); resize(settings.value("mainx", "500").toInt(), settings.value("mainy", "320").toInt());
@ -384,7 +384,7 @@ void LammpsGui::new_document()
} }
lammps.close(); lammps.close();
lammpsstatus->hide(); lammpsstatus->hide();
setWindowTitle(QString("LAMMPS-GUI - *unknown*")); setWindowTitle("LAMMPS-GUI - Editor - *unknown*");
run_counter = 0; run_counter = 0;
} }
@ -609,7 +609,7 @@ void LammpsGui::open_file(const QString &fileName)
ui->textEdit->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor); ui->textEdit->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
file.close(); file.close();
} }
setWindowTitle(QString("LAMMPS-GUI - " + current_file)); setWindowTitle(QString("LAMMPS-GUI - Editor - " + current_file));
run_counter = 0; run_counter = 0;
ui->textEdit->document()->setModified(false); ui->textEdit->document()->setModified(false);
ui->textEdit->setGroupList(); ui->textEdit->setGroupList();
@ -653,7 +653,7 @@ void LammpsGui::write_file(const QString &fileName)
QMessageBox::warning(this, "Warning", "Cannot save file: " + file.errorString()); QMessageBox::warning(this, "Warning", "Cannot save file: " + file.errorString());
return; return;
} }
setWindowTitle(QString("LAMMPS-GUI - " + current_file)); setWindowTitle(QString("LAMMPS-GUI - Editor - " + current_file));
QDir::setCurrent(current_dir); QDir::setCurrent(current_dir);
update_recents(path.absoluteFilePath()); update_recents(path.absoluteFilePath());
@ -886,7 +886,7 @@ void LammpsGui::logupdate()
slideshow->hide(); slideshow->hide();
} else { } else {
slideshow->setWindowTitle( slideshow->setWindowTitle(
QString("LAMMPS-GUI - Slide Show: %1 - Run %2").arg(current_file).arg(run_counter)); 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);
@ -1046,10 +1046,7 @@ void LammpsGui::do_run(bool use_buffer)
logwindow->setCenterOnScroll(true); logwindow->setCenterOnScroll(true);
logwindow->moveCursor(QTextCursor::End); logwindow->moveCursor(QTextCursor::End);
logwindow->setWindowTitle( logwindow->setWindowTitle(
QString("LAMMPS-GUI - Output from running LAMMPS on %1 - %2 - Run %3") QString("LAMMPS-GUI - Output - %2 - Run %3").arg(current_file).arg(run_counter));
.arg(use_buffer ? "buffer" : "file")
.arg(current_file)
.arg(run_counter));
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());
@ -1069,10 +1066,7 @@ void LammpsGui::do_run(bool use_buffer)
if (settings.value("chartreplace", true).toBool()) delete chartwindow; if (settings.value("chartreplace", true).toBool()) delete chartwindow;
chartwindow = new ChartWindow(current_file); chartwindow = new ChartWindow(current_file);
chartwindow->setWindowTitle( chartwindow->setWindowTitle(
QString("LAMMPS-GUI - Thermo charts from running LAMMPS on %1 - %2 - Run %3") QString("LAMMPS-GUI - Charts - %2 - Run %3").arg(current_file).arg(run_counter));
.arg(use_buffer ? "buffer" : "file")
.arg(current_file)
.arg(run_counter));
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);
@ -1085,7 +1079,7 @@ void LammpsGui::do_run(bool use_buffer)
chartwindow->hide(); chartwindow->hide();
if (slideshow) { if (slideshow) {
slideshow->setWindowTitle("LAMMPS-GUI - Slide Show"); slideshow->setWindowTitle(QString("LAMMPS-GUI - Slide Show - " + current_file));
slideshow->clear(); slideshow->clear();
slideshow->hide(); slideshow->hide();
} }