Browse Source

qt: use series of pngs for spinner

Use a series of .png frames for the spinner instead of a .mng.
`mng` is an obscure image format and is not built by default into Qt5.

This appears to improve the crispness of the spinner as well.

Does not noticably increase the size (still ~27k) and the code
is not more complicated either.
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
f10b2d70d0
  1. 2
      contrib/debian/copyright
  2. 4
      doc/assets-attribution.md
  3. BIN
      share/qt/img/reload.png
  4. 13
      share/qt/make_spinner.py
  5. 2
      src/qt/Makefile.am
  6. 36
      src/qt/bitcoin.qrc
  7. 14
      src/qt/bitcoingui.cpp
  8. 2
      src/qt/bitcoingui.h
  9. 3
      src/qt/guiconstants.h
  10. BIN
      src/qt/res/movies/spinner-000.png
  11. BIN
      src/qt/res/movies/spinner-001.png
  12. BIN
      src/qt/res/movies/spinner-002.png
  13. BIN
      src/qt/res/movies/spinner-003.png
  14. BIN
      src/qt/res/movies/spinner-004.png
  15. BIN
      src/qt/res/movies/spinner-005.png
  16. BIN
      src/qt/res/movies/spinner-006.png
  17. BIN
      src/qt/res/movies/spinner-007.png
  18. BIN
      src/qt/res/movies/spinner-008.png
  19. BIN
      src/qt/res/movies/spinner-009.png
  20. BIN
      src/qt/res/movies/spinner-010.png
  21. BIN
      src/qt/res/movies/spinner-011.png
  22. BIN
      src/qt/res/movies/spinner-012.png
  23. BIN
      src/qt/res/movies/spinner-013.png
  24. BIN
      src/qt/res/movies/spinner-014.png
  25. BIN
      src/qt/res/movies/spinner-015.png
  26. BIN
      src/qt/res/movies/spinner-016.png
  27. BIN
      src/qt/res/movies/spinner-017.png
  28. BIN
      src/qt/res/movies/spinner-018.png
  29. BIN
      src/qt/res/movies/spinner-019.png
  30. BIN
      src/qt/res/movies/spinner-020.png
  31. BIN
      src/qt/res/movies/spinner-021.png
  32. BIN
      src/qt/res/movies/spinner-022.png
  33. BIN
      src/qt/res/movies/spinner-023.png
  34. BIN
      src/qt/res/movies/spinner-024.png
  35. BIN
      src/qt/res/movies/spinner-025.png
  36. BIN
      src/qt/res/movies/spinner-026.png
  37. BIN
      src/qt/res/movies/spinner-027.png
  38. BIN
      src/qt/res/movies/spinner-028.png
  39. BIN
      src/qt/res/movies/spinner-029.png
  40. BIN
      src/qt/res/movies/spinner-030.png
  41. BIN
      src/qt/res/movies/spinner-031.png
  42. BIN
      src/qt/res/movies/spinner-032.png
  43. BIN
      src/qt/res/movies/spinner-033.png
  44. BIN
      src/qt/res/movies/spinner-034.png
  45. BIN
      src/qt/res/movies/update_spinner.mng

2
contrib/debian/copyright vendored

@ -71,7 +71,7 @@ Copyright: Bitboy (optimized for 16x16 by Wladimir van der Laan)
License: PUB-DOM License: PUB-DOM
Comment: Site: https://bitcointalk.org/?topic=1756.0 Comment: Site: https://bitcointalk.org/?topic=1756.0
Files: scripts/img/reload.xcf, src/qt/res/movies/update_spinner.mng Files: scripts/img/reload.xcf, src/qt/res/movies/*.png
Copyright: Everaldo (Everaldo Coelho) Copyright: Everaldo (Everaldo Coelho)
License: GPL-3+ License: GPL-3+
Comment: Icon Pack: Kids Comment: Icon Pack: Kids

4
doc/assets-attribution.md

@ -76,7 +76,7 @@ Everaldo (Everaldo Coelho)
* Site: [http://findicons.com/icon/17102/reload?id=17102](http://findicons.com/icon/17102/reload?id=17102) * Site: [http://findicons.com/icon/17102/reload?id=17102](http://findicons.com/icon/17102/reload?id=17102)
### Assets Used ### Assets Used
scripts/img/reload.xcf (modified), src/qt/res/movies/update_spinner.mng scripts/img/reload.xcf (modified), src/qt/res/movies/*.png
[Vignoni David](http://www.oxygen-icons.org) [Vignoni David](http://www.oxygen-icons.org)
----------------------- -----------------------
@ -101,4 +101,4 @@ Jonas Schnelli
src/qt/res/src/bitcoin.ico, src/qt/res/src/bitcoin.png, src/qt/res/src/bitcoin.ico, src/qt/res/src/bitcoin.png,
src/qt/res/src/bitcoin_testnet.png, docs/bitcoin_logo_doxygen.png, src/qt/res/src/bitcoin_testnet.png, docs/bitcoin_logo_doxygen.png,
src/qt/res/icons/toolbar.png, src/qt/res/icons/toolbar_testnet.png, src/qt/res/icons/toolbar.png, src/qt/res/icons/toolbar_testnet.png,
src/qt/res/images/splash.png, src/qt/res/images/splash_testnet.png src/qt/res/images/splash.png, src/qt/res/images/splash_testnet.png

BIN
share/qt/img/reload.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

13
share/qt/make_spinner.py

@ -1,16 +1,15 @@
#!/usr/bin/env python #!/usr/bin/env python
# W.J. van der Laan, 2011 # W.J. van der Laan, 2011
# Make spinning .mng animation from a .png # Make spinning animation from a .png
# Requires imagemagick 6.7+ # Requires imagemagick 6.7+
from __future__ import division from __future__ import division
from os import path from os import path
from PIL import Image from PIL import Image
from subprocess import Popen from subprocess import Popen
SRC='img/reload_scaled.png' SRC='img/reload.png'
DST='../../src/qt/res/movies/update_spinner.mng' TMPDIR='../../src/qt/res/movies/'
TMPDIR='/tmp' TMPNAME='spinner-%03i.png'
TMPNAME='tmp-%03i.png'
NUMFRAMES=35 NUMFRAMES=35
FRAMERATE=10.0 FRAMERATE=10.0
CONVERT='convert' CONVERT='convert'
@ -36,8 +35,4 @@ for frame in xrange(NUMFRAMES):
im_new.save(outfile, 'png') im_new.save(outfile, 'png')
frame_files.append(outfile) frame_files.append(outfile)
p = Popen([CONVERT, "-delay", str(FRAMERATE), "-dispose", "2"] + frame_files + [DST])
p.communicate()

2
src/qt/Makefile.am

@ -303,7 +303,7 @@ RES_IMAGES = \
res/images/splash.png \ res/images/splash.png \
res/images/splash_testnet.png res/images/splash_testnet.png
RES_MOVIES = res/movies/update_spinner.mng RES_MOVIES = $(wildcard res/movies/spinner-*.png)
BITCOIN_RC = res/bitcoin-qt-res.rc BITCOIN_RC = res/bitcoin-qt-res.rc

36
src/qt/bitcoin.qrc

@ -47,7 +47,41 @@
<file alias="splash_testnet">res/images/splash_testnet.png</file> <file alias="splash_testnet">res/images/splash_testnet.png</file>
</qresource> </qresource>
<qresource prefix="/movies"> <qresource prefix="/movies">
<file alias="update_spinner">res/movies/update_spinner.mng</file> <file alias="spinner-000">res/movies/spinner-000.png</file>
<file alias="spinner-001">res/movies/spinner-001.png</file>
<file alias="spinner-002">res/movies/spinner-002.png</file>
<file alias="spinner-003">res/movies/spinner-003.png</file>
<file alias="spinner-004">res/movies/spinner-004.png</file>
<file alias="spinner-005">res/movies/spinner-005.png</file>
<file alias="spinner-006">res/movies/spinner-006.png</file>
<file alias="spinner-007">res/movies/spinner-007.png</file>
<file alias="spinner-008">res/movies/spinner-008.png</file>
<file alias="spinner-009">res/movies/spinner-009.png</file>
<file alias="spinner-010">res/movies/spinner-010.png</file>
<file alias="spinner-011">res/movies/spinner-011.png</file>
<file alias="spinner-012">res/movies/spinner-012.png</file>
<file alias="spinner-013">res/movies/spinner-013.png</file>
<file alias="spinner-014">res/movies/spinner-014.png</file>
<file alias="spinner-015">res/movies/spinner-015.png</file>
<file alias="spinner-016">res/movies/spinner-016.png</file>
<file alias="spinner-017">res/movies/spinner-017.png</file>
<file alias="spinner-018">res/movies/spinner-018.png</file>
<file alias="spinner-019">res/movies/spinner-019.png</file>
<file alias="spinner-020">res/movies/spinner-020.png</file>
<file alias="spinner-021">res/movies/spinner-021.png</file>
<file alias="spinner-022">res/movies/spinner-022.png</file>
<file alias="spinner-023">res/movies/spinner-023.png</file>
<file alias="spinner-024">res/movies/spinner-024.png</file>
<file alias="spinner-025">res/movies/spinner-025.png</file>
<file alias="spinner-026">res/movies/spinner-026.png</file>
<file alias="spinner-027">res/movies/spinner-027.png</file>
<file alias="spinner-028">res/movies/spinner-028.png</file>
<file alias="spinner-029">res/movies/spinner-029.png</file>
<file alias="spinner-030">res/movies/spinner-030.png</file>
<file alias="spinner-031">res/movies/spinner-031.png</file>
<file alias="spinner-032">res/movies/spinner-032.png</file>
<file alias="spinner-033">res/movies/spinner-033.png</file>
<file alias="spinner-034">res/movies/spinner-034.png</file>
</qresource> </qresource>
<qresource prefix="/translations"> <qresource prefix="/translations">
<file alias="ach">locale/bitcoin_ach.qm</file> <file alias="ach">locale/bitcoin_ach.qm</file>

14
src/qt/bitcoingui.cpp

@ -39,7 +39,6 @@
#include <QMenuBar> #include <QMenuBar>
#include <QMessageBox> #include <QMessageBox>
#include <QMimeData> #include <QMimeData>
#include <QMovie>
#include <QProgressBar> #include <QProgressBar>
#include <QSettings> #include <QSettings>
#include <QStackedWidget> #include <QStackedWidget>
@ -68,7 +67,8 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
trayIcon(0), trayIcon(0),
notificator(0), notificator(0),
rpcConsole(0), rpcConsole(0),
prevBlocks(0) prevBlocks(0),
spinnerFrame(0)
{ {
GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this); GUIUtil::restoreWindowGeometry("nWindow", QSize(850, 550), this);
@ -187,8 +187,6 @@ BitcoinGUI::BitcoinGUI(bool fIsTestnet, QWidget *parent) :
statusBar()->addWidget(progressBar); statusBar()->addWidget(progressBar);
statusBar()->addPermanentWidget(frameBlocks); statusBar()->addPermanentWidget(frameBlocks);
syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);
connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show())); connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));
// prevents an oben debug window from becoming stuck/unusable on client shutdown // prevents an oben debug window from becoming stuck/unusable on client shutdown
@ -684,9 +682,13 @@ void BitcoinGUI::setNumBlocks(int count, int nTotalBlocks)
progressBar->setVisible(true); progressBar->setVisible(true);
tooltip = tr("Catching up...") + QString("<br>") + tooltip; tooltip = tr("Catching up...") + QString("<br>") + tooltip;
labelBlocksIcon->setMovie(syncIconMovie);
if(count != prevBlocks) if(count != prevBlocks)
syncIconMovie->jumpToNextFrame(); {
labelBlocksIcon->setPixmap(QIcon(QString(
":/movies/spinner-%1").arg(spinnerFrame, 3, 10, QChar('0')))
.pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES;
}
prevBlocks = count; prevBlocks = count;
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET

2
src/qt/bitcoingui.h

@ -98,9 +98,9 @@ private:
Notificator *notificator; Notificator *notificator;
RPCConsole *rpcConsole; RPCConsole *rpcConsole;
QMovie *syncIconMovie;
/** Keep track of previous number of blocks, to detect progress */ /** Keep track of previous number of blocks, to detect progress */
int prevBlocks; int prevBlocks;
int spinnerFrame;
/** Create the main UI actions. */ /** Create the main UI actions. */
void createActions(bool fIsTestnet); void createActions(bool fIsTestnet);

3
src/qt/guiconstants.h

@ -38,4 +38,7 @@ static const int MAX_PAYMENT_REQUEST_SIZE = 50000; // bytes
/* QRCodeDialog -- size of exported QR Code image */ /* QRCodeDialog -- size of exported QR Code image */
#define EXPORT_IMAGE_SIZE 256 #define EXPORT_IMAGE_SIZE 256
/* Number of frames in spinner animation */
#define SPINNER_FRAMES 35
#endif // GUICONSTANTS_H #endif // GUICONSTANTS_H

BIN
src/qt/res/movies/spinner-000.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

BIN
src/qt/res/movies/spinner-001.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

BIN
src/qt/res/movies/spinner-002.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

BIN
src/qt/res/movies/spinner-003.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

BIN
src/qt/res/movies/spinner-004.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

BIN
src/qt/res/movies/spinner-005.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

BIN
src/qt/res/movies/spinner-006.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 852 B

BIN
src/qt/res/movies/spinner-007.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 888 B

BIN
src/qt/res/movies/spinner-008.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

BIN
src/qt/res/movies/spinner-009.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

BIN
src/qt/res/movies/spinner-010.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 854 B

BIN
src/qt/res/movies/spinner-011.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 B

BIN
src/qt/res/movies/spinner-012.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

BIN
src/qt/res/movies/spinner-013.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

BIN
src/qt/res/movies/spinner-014.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

BIN
src/qt/res/movies/spinner-015.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

BIN
src/qt/res/movies/spinner-016.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

BIN
src/qt/res/movies/spinner-017.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

BIN
src/qt/res/movies/spinner-018.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

BIN
src/qt/res/movies/spinner-019.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

BIN
src/qt/res/movies/spinner-020.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

BIN
src/qt/res/movies/spinner-021.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

BIN
src/qt/res/movies/spinner-022.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

BIN
src/qt/res/movies/spinner-023.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 854 B

BIN
src/qt/res/movies/spinner-024.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

BIN
src/qt/res/movies/spinner-025.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

BIN
src/qt/res/movies/spinner-026.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

BIN
src/qt/res/movies/spinner-027.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

BIN
src/qt/res/movies/spinner-028.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

BIN
src/qt/res/movies/spinner-029.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 846 B

BIN
src/qt/res/movies/spinner-030.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 866 B

BIN
src/qt/res/movies/spinner-031.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

BIN
src/qt/res/movies/spinner-032.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

BIN
src/qt/res/movies/spinner-033.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

BIN
src/qt/res/movies/spinner-034.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 859 B

BIN
src/qt/res/movies/update_spinner.mng

Binary file not shown.
Loading…
Cancel
Save