summaryrefslogtreecommitdiffstats
path: root/ksplashml/themeengine/standard/wndstatus.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
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /ksplashml/themeengine/standard/wndstatus.cpp
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.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/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksplashml/themeengine/standard/wndstatus.cpp')
-rw-r--r--ksplashml/themeengine/standard/wndstatus.cpp101
1 files changed, 101 insertions, 0 deletions
diff --git a/ksplashml/themeengine/standard/wndstatus.cpp b/ksplashml/themeengine/standard/wndstatus.cpp
new file mode 100644
index 000000000..3b8582c89
--- /dev/null
+++ b/ksplashml/themeengine/standard/wndstatus.cpp
@@ -0,0 +1,101 @@
+/***************************************************************************
+ * Copyright Brian Ledbetter 2001-2003 <brian@shadowcom.net> *
+ * Copyright Ravikiran Rajagopal 2003 *
+ * ravi@ee.eng.ohio-state.edu *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License (version 2) as *
+ * published by the Free Software Foundation. (The original KSplash/ML *
+ * codebase (upto version 0.95.3) is BSD-licensed.) *
+ * *
+ ***************************************************************************/
+
+#include <kapplication.h>
+#include <kcursor.h>
+#include <kdebug.h>
+#include <kglobalsettings.h>
+#include <kiconloader.h>
+#include <kprogress.h>
+#include <kwin.h>
+
+#include <qdesktopwidget.h>
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qpoint.h>
+#include <qrect.h>
+
+#include "wndstatus.h"
+#include "wndstatus.moc"
+
+// WndStatus::WndStatus(): Display a nifty status bar at
+// the bottom of the screen, so the user always knows what's
+// happening to his system.
+WndStatus::WndStatus( QPalette /*pal*/,
+ int xineramaScreen,
+ bool atTop, bool pbVisible,
+ const QFont& font,
+ const QColor& fgc, const QColor & bgc,
+ const QString& icon
+ )
+ :QHBox( 0, "wndStatus", WStyle_Customize|WX11BypassWM )
+{
+ setFrameStyle( QFrame::NoFrame );
+ //setPalette( pal );
+ setPaletteBackgroundColor( bgc );
+ setPaletteForegroundColor( fgc );
+ setCursor( KCursor::blankCursor() );
+ setSpacing( 5 );
+
+ const QRect rect = kapp->desktop()->screenGeometry( xineramaScreen );
+ // KGlobalSettings::splashScreenDesktopGeometry(); cannot be used here.
+
+ QLabel *pix = new QLabel( this );
+ QPixmap _icon( SmallIcon(icon.isNull()||icon.isEmpty()?QString("run"):icon) );
+ pix->setPixmap( _icon );
+ setStretchFactor(pix,0);
+ pix->setFixedWidth(16);
+
+ m_label = new QLabel( this );
+ m_label->setFont( font );
+ m_label->setPaletteBackgroundColor( bgc );
+ m_label->setPaletteForegroundColor( fgc );
+ //QFontMetrics metrics( font );
+ //m_label->setFixedHeight( metrics.height() );
+ m_label->setText(QString(""));
+ m_label->setFixedWidth(rect.width()-105-16-10); // What's this magic number?
+ m_label->show();
+
+ m_progress = new KProgress( this );
+ setStretchFactor(m_progress,0);
+ m_progress->setFixedWidth(100);
+
+ QWidget *widg = new QWidget( this );
+ setStretchFactor(widg,50);
+
+ setFixedSize( rect.width(), QMAX(m_progress->height(),m_label->height()) );
+
+ if ( atTop )
+ move( rect.topLeft() );
+ else
+ move( rect.bottomLeft().x(), rect.bottomLeft().y()-height()+1 ); // The +1 is to work around a bug in screenGeometry().
+
+ if (!pbVisible)
+ m_progress->hide();
+}
+
+void WndStatus::slotSetMessage( const QString& msg )
+{
+ raise();
+ m_label->setText( msg );
+}
+
+void WndStatus::slotUpdateProgress( int i )
+{
+ raise();
+ m_progress->setProgress( i );
+}
+
+void WndStatus::slotUpdateSteps( int i )
+{
+ m_progress->setTotalSteps( i );
+}