summaryrefslogtreecommitdiff
path: root/noncore/styles/liquid/liquid.cpp
Side-by-side diff
Diffstat (limited to 'noncore/styles/liquid/liquid.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index bac882c..51814e7 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1,68 +1,73 @@
/*-
* Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved.
*/
//
// (c) 2002 Robert 'sandman' Griebl
//
#ifndef INCLUDE_MENUITEM_DEF
#define INCLUDE_MENUITEM_DEF
#endif
-#include <qmenudata.h>
#include "liquid.h"
-//#include "liquiddeco.h"
-#include <qapplication.h>
+#include "effects.h"
+#include "htmlmasks.h"
+#include "embeddata.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
#include <qpe/config.h>
-#include "effects.h"
+using namespace Opie::Core;
+
+/* QT */
+#include <qmenudata.h>
+#include <qapplication.h>
#include <qpalette.h>
#include <qbitmap.h>
#include <qtabbar.h>
#include <qpopupmenu.h>
#include <qobjectlist.h>
#include <qimage.h>
#include <qtimer.h>
#include <qpixmapcache.h>
#include <qradiobutton.h>
#include <qcombobox.h>
#include <qdrawutil.h>
#include <qwidgetlist.h>
#include <qtoolbutton.h>
#include <qheader.h>
-#include <unistd.h>
#include <qmenubar.h>
#include <qprogressbar.h>
#include <qlineedit.h>
#include <qlistbox.h>
+/* STD */
+#include <unistd.h>
#include <stdio.h>
-#include "htmlmasks.h"
-#include "embeddata.h"
-
typedef void (QStyle::*QDrawMenuBarItemImpl) (QPainter *, int, int, int, int, QMenuItem *,
QColorGroup &, bool, bool);
QDrawMenuBarItemImpl qt_set_draw_menu_bar_impl(QDrawMenuBarItemImpl impl);
void TransMenuHandler::stripePixmap(QPixmap &pix, const QColor &color)
{
QImage img(pix.convertToImage());
QImageEffect::fade(img, 0.9, color);
int x, y;
int r, g, b;
for(y=0; y < img.height(); y+=3){
unsigned int *data = (unsigned int *) img.scanLine(y);
for(x=0; x < img.width(); ++x){
r = qRed(data[x]);
g = qGreen(data[x]);
b = qBlue(data[x]);
if(r-10)
r-=10;
if(g-10)
g-=10;
if(b-10)
b-=10;
@@ -128,49 +133,49 @@ bool TransMenuHandler::eventFilter(QObject *obj, QEvent *ev)
stripePixmap(*pix, p->colorGroup().button());
}
else{
QPixmapEffect::fade(*pix, (((float)opacity)+80)*0.01, color);
}
pixDict.insert(p->winId(), pix);
if ( !p->inherits("QPopupMenu"))
p->setBackgroundPixmap(*pix);
QObjectList *ol = p-> queryList("QWidget");
for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
QWidget *wid = (QWidget *) it.current ( );
wid-> setBackgroundPixmap(*pix);
wid-> setBackgroundOrigin(QWidget::ParentOrigin);
}
delete ol;
}
}
else if(ev->type() == QEvent::Hide){
if(type == TransStippleBg || type == TransStippleBtn ||
type == Custom){
-// qWarning("Deleting menu pixmap, width %d", pixDict.find(p->winId())->width());
+// owarn << "Deleting menu pixmap, width " << pixDict.find(p->winId())->width() << "" << oendl;
pixDict.remove(p->winId());
if ( !p->inherits("QPopupMenu"))
p->setBackgroundMode(QWidget::PaletteBackground);
QObjectList *ol = p-> queryList("QWidget");
for ( QObjectListIt it( *ol ); it. current ( ); ++it ) {
QWidget *wid = (QWidget *) it.current ( );
wid-> setBackgroundMode( QWidget::PaletteBackground );
}
delete ol;
}
}
return(false);
}
LiquidStyle::LiquidStyle()
:QWindowsStyle()
{
setName ( "LiquidStyle" );
@@ -473,49 +478,49 @@ void LiquidStyle::drawRoundButton(QPainter *painter, const QColor &c,
/*if(autoDefault){
if(supportPushDown && pushedDown){
painter->drawPixmap(x+3, y+3, tmpPix);
}
else{
painter->drawPixmap(x+2, y+2, tmpPix);
}
}
else */if(supportPushDown && pushedDown)
painter->drawPixmap(x+1, y+1, tmpPix);
else
painter->drawPixmap(x, y, tmpPix);
}
QPixmap* LiquidStyle::processEmbedded(const char *label, int h, int s, int v,
bool blend)
{
QImage img(qembed_findImage(label));
img.detach();
if(img.isNull()){ // shouldn't happen, been tested
- qWarning("Invalid embedded label %s", label);
+ owarn << "Invalid embedded label " << label << "" << oendl;
return(NULL);
}
if(img.depth() != 32)
img = img.convertDepth(32);
unsigned int *data = (unsigned int *)img.bits();
int total = img.width()*img.height();
int current;
QColor c;
int oldH, oldS, oldV;
int alpha;
if(v < 235)
v += 20;
else
v = 255;
float intensity = v/255.0;
for(current=0; current<total; ++current){
alpha = qAlpha(data[current]);
c.setRgb(data[current]);
c.hsv(&oldH, &oldS, &oldV);
oldV = (int)(oldV*intensity);
c.setHsv(h, s, oldV);
if(blend && alpha != 255 && alpha != 0){
float srcPercent = ((float)alpha)/255.0;
@@ -839,49 +844,49 @@ void LiquidStyle::polish(QWidget *w)
return;
}
}
if(w->inherits("QHeader")){
w->setMouseTracking(true);
w->installEventFilter(this);
}
if(w-> inherits("QToolButton")) {
if (w->parent()->inherits("QToolBar")) {
((QToolButton*)w)->setAutoRaise (flatTBButtons);
if ( flatTBButtons )
w->setBackgroundOrigin(QWidget::ParentOrigin);
}
w-> installEventFilter ( this );
}
if(w-> inherits("QToolBarSeparator")&&w->parent()->inherits("QToolBar")) {
((QFrame *) w)-> setFrameShape ( QFrame::NoFrame );
}
if(w->ownPalette() && !w->inherits("QButton") && !w->inherits("QComboBox")){
return;
}
if(w->parent() && w->parent()->isWidgetType() && !((QWidget*)w->parent())->
palette().active().brush(QColorGroup::Background).pixmap()){
- qWarning("No parent pixmap for child widget %s", w->className());
+ owarn << "No parent pixmap for child widget " << w->className() << "" << oendl;
return;
}
if(!isViewport && !isViewportChild && !w->testWFlags(WType_Popup) &&
!( !w-> inherits("QLineEdit") && w-> parent() && w-> parent()-> isWidgetType ( ) && w-> parent()-> inherits ( "QMultiLineEdit" ))) {
if(w->backgroundMode() == QWidget::PaletteBackground ||
w->backgroundMode() == QWidget::PaletteButton){
w->setBackgroundMode(w->parentWidget()->backgroundMode( )/*QWidget::X11ParentRelative*/);
w->setBackgroundOrigin(QWidget::ParentOrigin);
// w->setBackgroundMode(QWidget::NoBackground);
}
}
if ( !w-> inherits("QFrame") || (((QFrame*) w)-> frameShape () == QFrame::NoFrame ))
w-> setBackgroundOrigin ( QWidget::ParentOrigin );
else if ( w-> inherits("QFrame") )
w->setBackgroundOrigin ( QWidget::WidgetOrigin );
if ( w->parentWidget()->inherits ( "QWidgetStack" )) {
w->setBackgroundOrigin ( QWidget::WidgetOrigin );
}
}
void LiquidStyle::unPolish(QWidget *w)
{
if(w->inherits("QMenuBar")){