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

View File

@ -21,6 +21,7 @@
#include <QMainWindow> #include <QMainWindow>
#include <QMenu> #include <QMenu>
#include <QSvgWidget>
class QCloseEvent; class QCloseEvent;
class QDragEnterEvent; class QDragEnterEvent;
@ -534,6 +535,19 @@ public Q_SLOTS:
void showMenu(QPoint const &) { exec(QCursor::pos()); } 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 frontend
} // namespace lyx } // namespace lyx