add tooltips, add run/stop/image buttons to status bar, replace run/stop icons

This commit is contained in:
Axel Kohlmeyer
2023-08-16 07:11:07 -04:00
parent 7c9eda658f
commit 44f725f61f
8 changed files with 35 additions and 7 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16)
project(lammps-gui VERSION 1.2.0 LANGUAGES CXX)
project(lammps-gui VERSION 1.2.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -60,21 +60,33 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
auto *dossao = new QPushButton(QIcon(":/hd-img.png"), "");
dossao->setCheckable(true);
dossao->setToolTip("Toggle SSAO rendering");
auto *doanti = new QPushButton(QIcon(":/antialias.png"), "");
doanti->setCheckable(true);
doanti->setToolTip("Toggle anti-aliasing");
auto *dobox = new QPushButton(QIcon(":/system-box.png"), "");
dobox->setCheckable(true);
dobox->setToolTip("Toggle displaying box");
auto *doaxes = new QPushButton(QIcon(":/axes-img.png"), "");
doaxes->setCheckable(true);
doaxes->setToolTip("Toggle displaying axes");
auto *zoomin = new QPushButton(QIcon(":/gtk-zoom-in.png"), "");
zoomin->setToolTip("Zoom in by 10 percent");
auto *zoomout = new QPushButton(QIcon(":/gtk-zoom-out.png"), "");
zoomout->setToolTip("Zoom out by 10 percent");
auto *rotleft = new QPushButton(QIcon(":/object-rotate-left.png"), "");
rotleft->setToolTip("Rotate left by 15 degrees");
auto *rotright = new QPushButton(QIcon(":/object-rotate-right.png"), "");
rotright->setToolTip("Rotate right by 15 degrees");
auto *rotup = new QPushButton(QIcon(":/gtk-go-up.png"), "");
rotup->setToolTip("Rotate up by 15 degrees");
auto *rotdown = new QPushButton(QIcon(":/gtk-go-down.png"), "");
rotdown->setToolTip("Rotate down by 15 degrees");
auto *reset = new QPushButton(QIcon(":/gtk-zoom-fit.png"), "");
reset->setToolTip("Reset view to defaults");
auto *combo = new QComboBox;
combo->setObjectName("group");
combo->setToolTip("Select group to display");
int ngroup = lammps->id_count("group");
char gname[64];
for (int i = 0; i < ngroup; ++i) {
@ -215,28 +227,28 @@ void ImageViewer::do_zoom_out()
void ImageViewer::do_rot_left()
{
vrot -= 15;
vrot -= 10;
if (vrot < -180) vrot += 360;
createImage();
}
void ImageViewer::do_rot_right()
{
vrot += 15;
vrot += 10;
if (vrot > 180) vrot -= 360;
createImage();
}
void ImageViewer::do_rot_down()
{
hrot -= 15;
hrot -= 10;
if (hrot < 0) hrot += 360;
createImage();
}
void ImageViewer::do_rot_up()
{
hrot += 15;
hrot += 10;
if (hrot > 360) hrot -= 360;
createImage();
}

View File

@ -34,6 +34,7 @@
#include <QPlainTextEdit>
#include <QProcess>
#include <QProgressBar>
#include <QPushButton>
#include <QSettings>
#include <QShortcut>
#include <QStatusBar>
@ -241,7 +242,22 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
auto pix = QPixmap(":/lammps-icon-128x128.png");
lammpsstatus->setPixmap(pix.scaled(22, 22, Qt::KeepAspectRatio));
ui->statusbar->addWidget(lammpsstatus);
lammpsstatus->setToolTip("LAMMPS instance is active");
lammpsstatus->hide();
auto *lammpsrun = new QPushButton(QIcon(":/system-run.png"),"");
auto *lammpsstop = new QPushButton(QIcon(":/process-stop.png"), "");
auto *lammpsimage = new QPushButton(QIcon(":/emblem-photos.png"), "");
lammpsrun->setToolTip("Run LAMMPS on input");
lammpsstop->setToolTip("Stop LAMMPS");
lammpsimage->setToolTip("Create snapshot image");
ui->statusbar->addWidget(lammpsrun);
ui->statusbar->addWidget(lammpsstop);
ui->statusbar->addWidget(lammpsimage);
connect(lammpsrun, &QPushButton::released, this, &LammpsGui::run_buffer);
connect(lammpsstop, &QPushButton::released, this, &LammpsGui::stop_run);
connect(lammpsimage, &QPushButton::released, this, &LammpsGui::render_image);
status = new QLabel("Ready.");
status->setFixedWidth(300);
ui->statusbar->addWidget(status);

View File

@ -33,7 +33,7 @@
<file>help-about.png</file>
<file>emblem-photos.png</file>
<file>process-stop.png</file>
<file>emblem-default.png</file>
<file>system-run.png</file>
<file>window-close.png</file>
<file>application-plot.png</file>
<file>application-calc.png</file>

View File

@ -212,7 +212,7 @@
</action>
<action name="actionRun_Buffer">
<property name="icon">
<iconset theme=":/emblem-default.png"/>
<iconset theme=":/system-run.png"/>
</property>
<property name="text">
<string>&amp;Run LAMMPS</string>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB