implement delete-all-images function with pushbutton in slideshow viewer
This commit is contained in:
@ -2,7 +2,6 @@ LAMMPS-GUI TODO list:
|
||||
|
||||
# Short term goals (v1.x)
|
||||
|
||||
- add "delete image files" option to Slide Show, plus pushbutton
|
||||
- add "export YAML data" to Output viewer, if YAML thermo data is detected.
|
||||
- add "export to YAML" to chart viewer.
|
||||
|
||||
|
||||
BIN
tools/lammps-gui/icons/trash.png
Normal file
BIN
tools/lammps-gui/icons/trash.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
@ -53,6 +53,7 @@
|
||||
<file>icons/system-box.png</file>
|
||||
<file>icons/system-help.png</file>
|
||||
<file>icons/system-run.png</file>
|
||||
<file>icons/trash.png</file>
|
||||
<file>icons/utilities-terminal.png</file>
|
||||
<file>icons/vdw-style.png</file>
|
||||
<file>icons/vmd.png</file>
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#include <QApplication>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QGuiApplication>
|
||||
@ -75,6 +76,9 @@ SlideShow::SlideShow(const QString &fileName, QWidget *parent) :
|
||||
tomovie->setToolTip("Export to movie file");
|
||||
tomovie->setEnabled(has_exe("ffmpeg"));
|
||||
|
||||
auto *totrash = new QPushButton(QIcon(":/icons/trash.png"), "");
|
||||
totrash->setToolTip("Delete all image files");
|
||||
|
||||
auto *gofirst = new QPushButton(QIcon(":/icons/go-first.png"), "");
|
||||
gofirst->setToolTip("Go to first Image");
|
||||
auto *goprev = new QPushButton(QIcon(":/icons/go-previous-2.png"), "");
|
||||
@ -101,6 +105,7 @@ SlideShow::SlideShow(const QString &fileName, QWidget *parent) :
|
||||
normal->setToolTip("Reset zoom to normal");
|
||||
|
||||
connect(tomovie, &QPushButton::released, this, &SlideShow::movie);
|
||||
connect(totrash, &QPushButton::released, this, &SlideShow::delete_images);
|
||||
connect(gofirst, &QPushButton::released, this, &SlideShow::first);
|
||||
connect(goprev, &QPushButton::released, this, &SlideShow::prev);
|
||||
connect(goplay, &QPushButton::released, this, &SlideShow::play);
|
||||
@ -115,6 +120,7 @@ SlideShow::SlideShow(const QString &fileName, QWidget *parent) :
|
||||
navLayout->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||
navLayout->addWidget(dummy);
|
||||
navLayout->addWidget(tomovie);
|
||||
navLayout->addWidget(totrash);
|
||||
navLayout->addWidget(gofirst);
|
||||
navLayout->addWidget(goprev);
|
||||
navLayout->addWidget(goplay);
|
||||
@ -157,6 +163,14 @@ void SlideShow::add_image(const QString &filename)
|
||||
}
|
||||
}
|
||||
|
||||
void SlideShow::delete_images()
|
||||
{
|
||||
for (const auto &file : imagefiles) {
|
||||
QFile::remove(file);
|
||||
}
|
||||
clear();
|
||||
}
|
||||
|
||||
void SlideShow::clear()
|
||||
{
|
||||
imagefiles.clear();
|
||||
@ -316,7 +330,7 @@ void SlideShow::prev()
|
||||
void SlideShow::loop()
|
||||
{
|
||||
auto *button = qobject_cast<QPushButton *>(sender());
|
||||
do_loop = !do_loop;
|
||||
do_loop = !do_loop;
|
||||
button->setChecked(do_loop);
|
||||
}
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ public:
|
||||
|
||||
private slots:
|
||||
void quit();
|
||||
void delete_images();
|
||||
void stop_run();
|
||||
void movie();
|
||||
void first();
|
||||
|
||||
Reference in New Issue
Block a user