Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
Quoted
Originally posted by darkmatter
How do I go about applying the patch to the source files?
Source code |
|
1 |
$ patch -p0 < /path/to/some.patch |
Source code |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
diff -ur kdebase-3.4.0.orig/kicker/buttons/kbutton.cpp kdebase-3.4.0/kicker= /buttons/kbutton.cpp =2D-- kdebase-3.4.0.orig/kicker/buttons/kbutton.cpp 2005-04-01 16:15:33.000= 000000 +0300 +++ kdebase-3.4.0/kicker/buttons/kbutton.cpp 2005-04-01 16:20:34.008786000 = +0300 @@ -22,6 +22,7 @@ ******************************************************************/ =20 #include <qtooltip.h> +#include <qpainter.h> =20 #include <klocale.h> #include <kapplication.h> @@ -44,6 +45,21 @@ setPopup(MenuManager::the()->kmenu()); MenuManager::the()->registerKButton(this); setIcon("kmenu"); + + KConfigGroup cfgGroup( KGlobal::config(), "KMenu" ); + + //QFont f("Nimbus Sans L"); + QFont f(KApplication::kApplication()->font()); + f =3D cfgGroup.readFontEntry( "Font", &f ); + _fontPercent =3D cfgGroup.readDoubleNumEntry( "FontSize", 0.40 ); + setFont(f); + + _fontHeight =3D cfgGroup.readDoubleNumEntry( "FontHeight", 0.60 ); + + // we *want* the color to be invalid if not specifically set + // this makes it easy to let the text color use the system default + _textColor =3D cfgGroup.readColorEntry("TextColor",&_textColor); + } =20 KButton::~KButton() @@ -67,3 +83,40 @@ MenuManager::the()->kmenu()->initialize(); } =20 +void KButton::resizeEvent(QResizeEvent*e) +{ + PanelPopupButton::resizeEvent(e); +} + +void KButton::drawButtonLabel(QPainter *p) +{ + if (isDown() || isOn()) + p->translate(2,2); + + const QPixmap& icon =3D labelIcon(); + if ( !icon.isNull() ) { + int y =3D (height() - icon.height())/2; + + // the config defaults and the i18n'd text *must* be the same both = here and in container_button.cpp + if ( orientation() =3D=3D Horizontal ) { + p->save(); + QFont f =3D font(); + f.setPixelSize( int( float(height()) * _fontPercent ) ); + f.setBold(true); + p->setFont(f); + if( _textColor.isValid() ) + p->setPen(_textColor); + p->drawPixmap(3, y, icon); + p->drawText( icon.width()+5, int( float(height())*_fontHeight )= , i18n("KMenu")); + p->restore(); + } else { + int x =3D (width() - icon.width() )/2; + p->drawPixmap(x, y, icon); + } + } + + if (isDown() || isOn()) + p->translate(-2,-2); +} + + diff -ur kdebase-3.4.0.orig/kicker/buttons/kbutton.h kdebase-3.4.0/kicker/b= uttons/kbutton.h =2D-- kdebase-3.4.0.orig/kicker/buttons/kbutton.h 2005-04-01 16:15:33.00000= 0000 +0300 +++ kdebase-3.4.0/kicker/buttons/kbutton.h 2005-04-01 16:19:34.388849608 +0= 300 @@ -45,6 +45,13 @@ virtual QString tileName() { return "KMenu"; } virtual void initPopup(); virtual QString defaultIcon() const { return "go"; } + + virtual void drawButtonLabel(QPainter *); + virtual void resizeEvent(QResizeEvent*); + +private: + float _fontPercent, _fontHeight; + QColor _textColor; }; =20 #endif diff -ur kdebase-3.4.0.orig/kicker/core/container_button.cpp kdebase-3.4.0/= kicker/core/container_button.cpp =2D-- kdebase-3.4.0.orig/kicker/core/container_button.cpp 2005-04-01 16:15:= 33.000000000 +0300 +++ kdebase-3.4.0/kicker/core/container_button.cpp 2005-04-01 16:26:06.8151= 91736 +0300 @@ -316,14 +316,30 @@ { embedButton( new KButton(this) ); _actions =3D PanelAppletOpMenu::KMenuEditor; + + KConfigGroup cfgGroup( KGlobal::config(), "KMenu" ); + //QFont f("Nimbus Sans L"); + QFont f(KApplication::kApplication()->font()); + f =3D cfgGroup.readFontEntry( "Font", &f ); + fontPercent =3D cfgGroup.readDoubleNumEntry( "FontSize", 0.30 ); + extraSpace =3D cfgGroup.readDoubleNumEntry( "ExtraSpace", 0.50 ); } =20 int KMenuButtonContainer::widthForHeight( int height ) const { =2D if ( height < 32 ) =2D return height + 10; =2D else =2D return ButtonContainer::widthForHeight(height); + int padding =3D int( float(height) * extraSpace ); + + // the config defaults and the i18n'd text *must* be the same both her= e and in kbutton.cpp + QFont f(font()); + f.setPixelSize( int( float(height) * fontPercent ) ); + f.setBold(true); + QFontMetrics fm( f ); + if (height > 50) // large panel + padding +=3D height/2; + + // the added X is to provide some pad on the right + int w =3D height + fm.width(i18n("KMenu"), -1) + padding; + return w; } =20 int KMenuButtonContainer::heightForWidth( int width ) const diff -ur kdebase-3.4.0.orig/kicker/core/container_button.h kdebase-3.4.0/ki= cker/core/container_button.h =2D-- kdebase-3.4.0.orig/kicker/core/container_button.h 2005-04-01 16:15:33= =2E000000000 +0300 +++ kdebase-3.4.0/kicker/core/container_button.h 2005-04-01 16:16:13.000000= 000 +0300 @@ -90,6 +90,10 @@ virtual int widthForHeight( int height ) const; virtual int heightForWidth( int width ) const; bool isAMenu() const { return true; } + =20 +private: + float fontPercent; + float extraSpace; }; =20 class DesktopButtonContainer : public ButtonContainer |
Forum Software: Burning Board®, developed by WoltLab® GmbH
Linux Computer - Linux Forum -
Linux Computer und Notebooks - Lastminute - Wasserbetten & Whirlpools