SVG replacement of busy.gif

Fix for bug #10384.
This commit is contained in:
Daniel Ramoeller 2021-09-29 04:25:58 +02:00 committed by Jean-Marc Lasgouttes
parent 42abb26054
commit 0862042b28
5 changed files with 32 additions and 12 deletions

View File

@ -564,7 +564,7 @@ dist_images_DATA1X = \
images/buffer-write-as.svgz \
images/buffer-write.svgz \
images/build-program.svgz \
images/busy.gif \
images/busy.svgz \
images/change-accept.svgz \
images/change-next.svgz \
images/change-reject.svgz \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

BIN
lib/images/busy.svgz Normal file

Binary file not shown.

View File

@ -96,7 +96,6 @@
#include <QMenu>
#include <QMenuBar>
#include <QMimeData>
#include <QMovie>
#include <QPainter>
#include <QPixmap>
#include <QPoint>
@ -612,20 +611,19 @@ GuiView::GuiView(int id)
setAcceptDrops(true);
// add busy indicator to statusbar
GuiClickableLabel * busylabel = new GuiClickableLabel(statusBar());
statusBar()->addPermanentWidget(busylabel);
search_mode mode = theGuiApp()->imageSearchMode();
QString fn = toqstr(lyx::libFileSearch("images", "busy", "gif", mode).absFileName());
QMovie * busyanim = new QMovie(fn, QByteArray(), busylabel);
busylabel->setMovie(busyanim);
busyanim->start();
busylabel->hide();
QString fn = toqstr(lyx::libFileSearch("images", "busy", "svgz", mode).absFileName());
PressableSvgWidget * busySVG = new PressableSvgWidget(fn);
statusBar()->addPermanentWidget(busySVG);
// make busy indicator square with 5px margins
busySVG->setMaximumSize(busySVG->height() - 5, busySVG->height() - 5);
busySVG->hide();
connect(&d.processing_thread_watcher_, SIGNAL(started()),
busylabel, SLOT(show()));
busySVG, SLOT(show()));
connect(&d.processing_thread_watcher_, SIGNAL(finished()),
busylabel, SLOT(hide()));
connect(busylabel, SIGNAL(clicked()), this, SLOT(checkCancelBackground()));
busySVG, SLOT(hide()));
connect(busySVG, SIGNAL(pressed()), this, SLOT(checkCancelBackground()));
QFontMetrics const fm(statusBar()->fontMetrics());
@ -5130,6 +5128,14 @@ SEMenu::SEMenu(QWidget * parent)
parent, SLOT(disableShellEscape()));
}
void PressableSvgWidget::mousePressEvent(QMouseEvent * event)
{
if (event->button() == Qt::LeftButton) {
Q_EMIT pressed();
}
}
} // namespace frontend
} // namespace lyx

View File

@ -21,6 +21,7 @@
#include <QMainWindow>
#include <QMenu>
#include <QSvgWidget>
class QCloseEvent;
class QDragEnterEvent;
@ -534,6 +535,19 @@ public Q_SLOTS:
void showMenu(QPoint const &) { exec(QCursor::pos()); }
};
class PressableSvgWidget : public QSvgWidget
{
Q_OBJECT
public:
explicit PressableSvgWidget(const QString &file, QWidget * parent = nullptr)
: QSvgWidget(file, parent) {};
protected:
void mousePressEvent(QMouseEvent *event) override;
Q_SIGNALS:
void pressed();
};
} // namespace frontend
} // namespace lyx