Commit 312b3342 authored by Matt Edman's avatar Matt Edman
Browse files

r1782@adrastea: edmanm | 2007-04-08 21:44:59 -0400

 Add a "spinning wheel" animation, displayed when we're starting Tor.


svn:r1700
parent 1f21cede
Loading
Loading
Loading
Loading
+20 −0
Changes for src/gui/common/vclicklabel.cpp: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ VClickLabel::VClickLabel(QWidget *parent)
 : QWidget(parent)
{
  setCursor(Qt::PointingHandCursor);
  connect(&_anim, SIGNAL(frameChanged(int)), 
             this, SLOT(animationFrameChanged(int)));
}

/** Returns the current size hint for this widget's current contents. */
@@ -66,6 +68,23 @@ VClickLabel::paintEvent(QPaintEvent *e)
  e->accept();
}

/** Sets the widget's image to the animated image file <b>animFile</b>. */
void
VClickLabel::setAnimation(const QPixmap &animPixmap)
{
  _anim.setPixmap(animPixmap);
  _anim.start();
}

/** Responds to a frame change on the animation. */
void
VClickLabel::animationFrameChanged(int frameNumber)
{
  Q_UNUSED(frameNumber);
  _pixmap = _anim.currentFrame();
  update();
}

/** Overloaded mouse event to catch left mouse button clicks. */
void
VClickLabel::mouseReleaseEvent(QMouseEvent *e)
@@ -88,6 +107,7 @@ VClickLabel::setText(const QString &text)
void
VClickLabel::setPixmap(const QPixmap &pixmap)
{
  _anim.stop();
  _pixmap = pixmap;
  update();
}
+9 −0
Changes for src/gui/common/vclicklabel.h: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@
#include <QMouseEvent>
#include <QSize>

#include "animatedpixmap.h"


class VClickLabel : public QWidget
{
@@ -51,6 +53,8 @@ public:
  void setText(const QString &text);
  /** Sets the widget's image to <b>img</b>. */
  void setPixmap(const QPixmap &img);
  /** Sets the widget's image to the animated image file <b>animFile</b>. */
  void setAnimation(const QPixmap &animPixmap);

signals:
  /** Emitted when the widget is left-clicked. */
@@ -62,9 +66,14 @@ protected:
  /** Overloaded mouse event to catch left mouse button clicks. */
  virtual void mouseReleaseEvent(QMouseEvent *e);

private slots:
  /** Responds to a frame change on the animation. */
  void animationFrameChanged(int frameNumber);

private:
  QString _text;    /**< Text label to display in the widget. */
  QPixmap _pixmap;  /**< Image to display in the widget. */
  AnimatedPixmap _anim; /**< Animated pixmap to display. */
};

#endif
+4 −0
Changes for src/gui/mainwindow.cpp: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include <util/html.h>

#include "common/vmessagebox.h"
#include "common/animatedpixmap.h"
#include "mainwindow.h"


@@ -57,6 +58,8 @@
#define IMG_TOR_STARTING_48  ":/images/48x48/tor-starting.png"
#define IMG_TOR_STOPPING_48  ":/images/48x48/tor-stopping.png"

#define ANIM_PROCESS_WORKING  ":/images/32x32/process-working.png"

/* Decide which of our four sets of tray icons to use. */
#if defined(USE_QSYSTEMTRAYICON)
/* QSystemTrayIcon is available */
@@ -376,6 +379,7 @@ MainWindow::updateTorStatus(TorStatus status)
      _startStopAct->setEnabled(false);
      ui.lblStartStopTor->setEnabled(false);
      ui.lblStartStopTor->setStatusTip(statusText);
      ui.lblStartStopTor->setAnimation(QPixmap(ANIM_PROCESS_WORKING));
  }

  /* Update the tray icon */
+9.54 KiB
Loading image diff...
+1 −0
Changes for src/gui/res/vidalia_common.qrc: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@
        <file>22x22/zoom-to-fit.png</file>
    </qresource>
    <qresource prefix="/images">
        <file>32x32/process-working.png</file>
        <file>32x32/tor-off.png</file>
        <file>32x32/tor-on.png</file>
        <file>32x32/tor-starting.png</file>