Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaas Freitag <freitag@owncloud.com>2013-02-26 19:31:56 +0400
committerKlaas Freitag <freitag@owncloud.com>2013-04-24 13:45:53 +0400
commit09e7f5c618fd3e11d06ed8ea312a10984d026c1c (patch)
treee973d0e8018b2c57f8e32adfa3cc2be034f4ad6b /src/3rdparty
parentc5a674b1df3e742d17ff815a967d9b277724fd62 (diff)
Add qprogressindicator widget
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/QProgressIndicator/LICENSE165
-rw-r--r--src/3rdparty/QProgressIndicator/QProgressIndicator.cpp137
-rw-r--r--src/3rdparty/QProgressIndicator/QProgressIndicator.h108
-rw-r--r--src/3rdparty/QProgressIndicator/README.md14
4 files changed, 424 insertions, 0 deletions
diff --git a/src/3rdparty/QProgressIndicator/LICENSE b/src/3rdparty/QProgressIndicator/LICENSE
new file mode 100644
index 000000000..65c5ca88a
--- /dev/null
+++ b/src/3rdparty/QProgressIndicator/LICENSE
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/src/3rdparty/QProgressIndicator/QProgressIndicator.cpp b/src/3rdparty/QProgressIndicator/QProgressIndicator.cpp
new file mode 100644
index 000000000..425dc579f
--- /dev/null
+++ b/src/3rdparty/QProgressIndicator/QProgressIndicator.cpp
@@ -0,0 +1,137 @@
+/*
+*
+* This file is part of QProgressIndicator,
+* an open-source recent files menu widget
+*
+* Copyright (C) 2009 - 2010 Morgan Leborgne
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with QRecentFilesMenu. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+#include "QProgressIndicator.h"
+
+#include <QPainter>
+
+QProgressIndicator::QProgressIndicator(QWidget* parent)
+ : QWidget(parent),
+ m_angle(0),
+ m_timerId(-1),
+ m_delay(40),
+ m_displayedWhenStopped(false),
+ m_color(Qt::black)
+{
+ setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ setFocusPolicy(Qt::NoFocus);
+}
+
+bool QProgressIndicator::isAnimated () const
+{
+ return (m_timerId != -1);
+}
+
+void QProgressIndicator::setDisplayedWhenStopped(bool state)
+{
+ m_displayedWhenStopped = state;
+
+ update();
+}
+
+bool QProgressIndicator::isDisplayedWhenStopped() const
+{
+ return m_displayedWhenStopped;
+}
+
+void QProgressIndicator::startAnimation()
+{
+ m_angle = 0;
+
+ if (m_timerId == -1)
+ m_timerId = startTimer(m_delay);
+}
+
+void QProgressIndicator::stopAnimation()
+{
+ if (m_timerId != -1)
+ killTimer(m_timerId);
+
+ m_timerId = -1;
+
+ update();
+}
+
+void QProgressIndicator::setAnimationDelay(int delay)
+{
+ if (m_timerId != -1)
+ killTimer(m_timerId);
+
+ m_delay = delay;
+
+ if (m_timerId != -1)
+ m_timerId = startTimer(m_delay);
+}
+
+void QProgressIndicator::setColor(const QColor & color)
+{
+ m_color = color;
+
+ update();
+}
+
+QSize QProgressIndicator::sizeHint() const
+{
+ return QSize(20,20);
+}
+
+int QProgressIndicator::heightForWidth(int w) const
+{
+ return w;
+}
+
+void QProgressIndicator::timerEvent(QTimerEvent * /*event*/)
+{
+ m_angle = (m_angle+30)%360;
+
+ update();
+}
+
+void QProgressIndicator::paintEvent(QPaintEvent * /*event*/)
+{
+ if (!m_displayedWhenStopped && !isAnimated())
+ return;
+
+ int width = qMin(this->width(), this->height());
+
+ QPainter p(this);
+ p.setRenderHint(QPainter::Antialiasing);
+
+ int outerRadius = (width-1)*0.5;
+ int innerRadius = (width-1)*0.5*0.38;
+
+ int capsuleHeight = outerRadius - innerRadius;
+ int capsuleWidth = (width > 32 ) ? capsuleHeight *.23 : capsuleHeight *.35;
+ int capsuleRadius = capsuleWidth/2;
+
+ for (int i=0; i<12; i++)
+ {
+ QColor color = m_color;
+ color.setAlphaF(1.0f - (i/12.0f));
+ p.setPen(Qt::NoPen);
+ p.setBrush(color);
+ p.save();
+ p.translate(rect().center());
+ p.rotate(m_angle - i*30.0f);
+ p.drawRoundedRect(-capsuleWidth*0.5, -(innerRadius+capsuleHeight), capsuleWidth, capsuleHeight, capsuleRadius, capsuleRadius);
+ p.restore();
+ }
+}
diff --git a/src/3rdparty/QProgressIndicator/QProgressIndicator.h b/src/3rdparty/QProgressIndicator/QProgressIndicator.h
new file mode 100644
index 000000000..0614da60d
--- /dev/null
+++ b/src/3rdparty/QProgressIndicator/QProgressIndicator.h
@@ -0,0 +1,108 @@
+/*
+*
+* This file is part of QProgressIndicator,
+* an open-source recent files menu widget
+*
+* Copyright (C) 2009 - 2010 Morgan Leborgne
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public License
+* along with QRecentFilesMenu. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
+#ifndef QPROGRESSINDICATOR_H
+#define QPROGRESSINDICATOR_H
+
+#include <QWidget>
+#include <QColor>
+
+/*!
+ \class QProgressIndicator
+ \brief The QProgressIndicator class lets an application display a progress indicator to show that a lengthy task is under way.
+
+ Progress indicators are indeterminate and do nothing more than spin to show that the application is busy.
+ \sa QProgressBar
+*/
+class QProgressIndicator : public QWidget
+{
+ Q_OBJECT
+ Q_PROPERTY(int delay READ animationDelay WRITE setAnimationDelay)
+ Q_PROPERTY(bool displayedWhenStopped READ isDisplayedWhenStopped WRITE setDisplayedWhenStopped)
+ Q_PROPERTY(QColor color READ color WRITE setColor)
+public:
+ QProgressIndicator(QWidget* parent = 0);
+
+ /*! Returns the delay between animation steps.
+ \return The number of milliseconds between animation steps. By default, the animation delay is set to 40 milliseconds.
+ \sa setAnimationDelay
+ */
+ int animationDelay() const { return m_delay; }
+
+ /*! Returns a Boolean value indicating whether the component is currently animated.
+ \return Animation state.
+ \sa startAnimation stopAnimation
+ */
+ bool isAnimated () const;
+
+ /*! Returns a Boolean value indicating whether the receiver shows itself even when it is not animating.
+ \return Return true if the progress indicator shows itself even when it is not animating. By default, it returns false.
+ \sa setDisplayedWhenStopped
+ */
+ bool isDisplayedWhenStopped() const;
+
+ /*! Returns the color of the component.
+ \sa setColor
+ */
+ const QColor & color() const { return m_color; }
+
+ virtual QSize sizeHint() const;
+ int heightForWidth(int w) const;
+public slots:
+ /*! Starts the spin animation.
+ \sa stopAnimation isAnimated
+ */
+ void startAnimation();
+
+ /*! Stops the spin animation.
+ \sa startAnimation isAnimated
+ */
+ void stopAnimation();
+
+ /*! Sets the delay between animation steps.
+ Setting the \a delay to a value larger than 40 slows the animation, while setting the \a delay to a smaller value speeds it up.
+ \param delay The delay, in milliseconds.
+ \sa animationDelay
+ */
+ void setAnimationDelay(int delay);
+
+ /*! Sets whether the component hides itself when it is not animating.
+ \param state The animation state. Set false to hide the progress indicator when it is not animating; otherwise true.
+ \sa isDisplayedWhenStopped
+ */
+ void setDisplayedWhenStopped(bool state);
+
+ /*! Sets the color of the components to the given color.
+ \sa color
+ */
+ void setColor(const QColor & color);
+protected:
+ virtual void timerEvent(QTimerEvent * event);
+ virtual void paintEvent(QPaintEvent * event);
+private:
+ int m_angle;
+ int m_timerId;
+ int m_delay;
+ bool m_displayedWhenStopped;
+ QColor m_color;
+};
+
+#endif // QPROGRESSINDICATOR_H
diff --git a/src/3rdparty/QProgressIndicator/README.md b/src/3rdparty/QProgressIndicator/README.md
new file mode 100644
index 000000000..4b34a3553
--- /dev/null
+++ b/src/3rdparty/QProgressIndicator/README.md
@@ -0,0 +1,14 @@
+## Description
+
+The QProgressIndicator class lets an application display a progress indicator to show that a lengthy task is under way.
+Will work at any size.
+
+<img src="https://raw.github.com/mojocorp/QProgressIndicator/master/screen-capture-1.png" >
+<img src="https://raw.github.com/mojocorp/QProgressIndicator/master/screen-capture-2.png" >
+
+## Dependency
+Qt 4.4.x.
+
+## License
+
+LGPL