summaryrefslogtreecommitdiffstats
path: root/src/splashscreen.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /src/splashscreen.cpp
downloadtdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz
tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/splashscreen.cpp')
-rw-r--r--src/splashscreen.cpp85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/splashscreen.cpp b/src/splashscreen.cpp
new file mode 100644
index 00000000..0c7ac7f2
--- /dev/null
+++ b/src/splashscreen.cpp
@@ -0,0 +1,85 @@
+
+#include "splashscreen.h"
+#include "splashscreen.moc"
+
+#include <config.h>
+
+#include <qtimer.h>
+#include <qfont.h>
+
+#include <klocale.h>
+#include <kglobalsettings.h>
+
+KDevSplashScreen::KDevSplashScreen(const QPixmap& pixmap, WFlags f) : QSplashScreen(pixmap, f)
+{
+ QTimer *timer = new QTimer( this );
+ QObject::connect(timer, SIGNAL(timeout()), this, SLOT(animate()));
+ timer->start(150);
+
+ state = 0;
+ progress_bar_size = 3;
+}
+
+
+KDevSplashScreen::~KDevSplashScreen()
+{
+}
+
+
+void KDevSplashScreen::animate()
+{
+ state = ((state + 1) % (2*progress_bar_size-1));
+ repaint();
+}
+
+
+void KDevSplashScreen::message( const QString &str, int flags, const QColor &color)
+{
+ QSplashScreen::message(str,flags,color);
+ animate();
+ m_string = str;
+}
+
+
+void KDevSplashScreen::drawContents (QPainter* painter)
+{
+ int position;
+ QColor base_color (201,229,165); // Base green color
+
+ // Draw background circles
+ painter->setPen(NoPen);
+ painter->setBrush(QColor(215,234,181));
+ painter->drawEllipse(51,7,9,9);
+ painter->drawEllipse(62,7,9,9);
+ painter->drawEllipse(73,7,9,9);
+
+ // Draw animated circles, increments are chosen
+ // to get close to background's color
+ // (didn't work well with QColor::light function)
+ for (int i=0; i < progress_bar_size; i++)
+ {
+ position = (state+i)%(2*progress_bar_size-1);
+ painter->setBrush(QColor(base_color.red()-18*i,
+ base_color.green()-10*i,
+ base_color.blue()-28*i));
+
+ if (position < 3) painter->drawEllipse(51+position*11,7,9,9);
+ }
+
+ painter->setPen(QColor(74,112,18));
+ QFont fnt(KGlobalSettings::generalFont());
+ fnt.setPointSize(8);
+ painter->setFont(fnt);
+
+ // Draw version number
+ QRect r = rect();
+ r.setRect(r.x() + 5, r.y() + 5, r.width() - 10, r.height() - 10);
+ painter->drawText(r, Qt::AlignRight, i18n("Version %1").arg( VERSION ));
+
+ // Draw message at given position, limited to 43 chars
+ // If message is too long, string is truncated
+ if (m_string.length() > 40) {m_string.truncate(39); m_string += "...";}
+ painter->drawText (90, 16, m_string, 42);
+
+}
+