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)
|
# 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 YAML data" to Output viewer, if YAML thermo data is detected.
|
||||||
- add "export to YAML" to chart viewer.
|
- 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-box.png</file>
|
||||||
<file>icons/system-help.png</file>
|
<file>icons/system-help.png</file>
|
||||||
<file>icons/system-run.png</file>
|
<file>icons/system-run.png</file>
|
||||||
|
<file>icons/trash.png</file>
|
||||||
<file>icons/utilities-terminal.png</file>
|
<file>icons/utilities-terminal.png</file>
|
||||||
<file>icons/vdw-style.png</file>
|
<file>icons/vdw-style.png</file>
|
||||||
<file>icons/vmd.png</file>
|
<file>icons/vmd.png</file>
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
@ -75,6 +76,9 @@ SlideShow::SlideShow(const QString &fileName, QWidget *parent) :
|
|||||||
tomovie->setToolTip("Export to movie file");
|
tomovie->setToolTip("Export to movie file");
|
||||||
tomovie->setEnabled(has_exe("ffmpeg"));
|
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"), "");
|
auto *gofirst = new QPushButton(QIcon(":/icons/go-first.png"), "");
|
||||||
gofirst->setToolTip("Go to first Image");
|
gofirst->setToolTip("Go to first Image");
|
||||||
auto *goprev = new QPushButton(QIcon(":/icons/go-previous-2.png"), "");
|
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");
|
normal->setToolTip("Reset zoom to normal");
|
||||||
|
|
||||||
connect(tomovie, &QPushButton::released, this, &SlideShow::movie);
|
connect(tomovie, &QPushButton::released, this, &SlideShow::movie);
|
||||||
|
connect(totrash, &QPushButton::released, this, &SlideShow::delete_images);
|
||||||
connect(gofirst, &QPushButton::released, this, &SlideShow::first);
|
connect(gofirst, &QPushButton::released, this, &SlideShow::first);
|
||||||
connect(goprev, &QPushButton::released, this, &SlideShow::prev);
|
connect(goprev, &QPushButton::released, this, &SlideShow::prev);
|
||||||
connect(goplay, &QPushButton::released, this, &SlideShow::play);
|
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->addSpacerItem(new QSpacerItem(10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum));
|
||||||
navLayout->addWidget(dummy);
|
navLayout->addWidget(dummy);
|
||||||
navLayout->addWidget(tomovie);
|
navLayout->addWidget(tomovie);
|
||||||
|
navLayout->addWidget(totrash);
|
||||||
navLayout->addWidget(gofirst);
|
navLayout->addWidget(gofirst);
|
||||||
navLayout->addWidget(goprev);
|
navLayout->addWidget(goprev);
|
||||||
navLayout->addWidget(goplay);
|
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()
|
void SlideShow::clear()
|
||||||
{
|
{
|
||||||
imagefiles.clear();
|
imagefiles.clear();
|
||||||
|
|||||||
@ -33,6 +33,7 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void quit();
|
void quit();
|
||||||
|
void delete_images();
|
||||||
void stop_run();
|
void stop_run();
|
||||||
void movie();
|
void movie();
|
||||||
void first();
|
void first();
|
||||||
|
|||||||
Reference in New Issue
Block a user