From 3d5263d52a1087b4a65a18e12bc37bd773138d10 Mon Sep 17 00:00:00 2001 From: mlaurent Date: Thu, 27 Oct 2005 12:07:42 +0000 Subject: [PATCH] Start to port kwin style (it's my first port so for the moment it's not easy :( ) git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/KDE/kdeartwork@474853 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kwin-styles/openlook/OpenLook.cpp | 75 ++++++++++++++++++++++----------------- kwin-styles/openlook/OpenLook.h | 13 +++++-- 2 files changed, 53 insertions(+), 35 deletions(-) diff --git a/kwin-styles/openlook/OpenLook.cpp b/kwin-styles/openlook/OpenLook.cpp index dafb1383..a854015b 100644 --- a/kwin-styles/openlook/OpenLook.cpp +++ b/kwin-styles/openlook/OpenLook.cpp @@ -10,7 +10,7 @@ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. @@ -33,6 +33,16 @@ #include #include #include +//Added by qt3to4: +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -51,7 +61,7 @@ static uint openLookMargin = 5; static const uint openLookTextVMargin = 1; static uint titleHeight; -// --------------------------------------- +// --------------------------------------- DecorationFactory::DecorationFactory() { @@ -86,26 +96,25 @@ bool DecorationFactory::supports( Ability ability ) }; } -QValueList< DecorationFactory::BorderSize > -DecorationFactory::borderSizes() const -{ +QList< DecorationFactory::BorderSize > DecorationFactory::borderSizes() const +{ // the list must be sorted - return QValueList< BorderSize >() << BorderNormal << - BorderLarge << BorderVeryLarge << BorderHuge << + return QList< BorderSize >() << BorderNormal << + BorderLarge << BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized; } -// --------------------------------------- +// --------------------------------------- static inline const KDecorationOptions* options() { return KDecoration::options(); } -// --------------------------------------- +// --------------------------------------- -OpenLook::OpenLook(KDecorationBridge *b, KDecorationFactory *f) : - KDecoration(b, f), +OpenLook::OpenLook(KDecorationBridge *b, KDecorationFactory *f) : + KDecoration(b, f), titleSpacer_ (0), mousePressPoint_(0, 0), // Anywhere outside button rect. buttonDown_ (false) @@ -114,12 +123,14 @@ OpenLook::OpenLook(KDecorationBridge *b, KDecorationFactory *f) : void OpenLook::init() { - static const int SUPPORTED_WINDOW_TYPES_MASK = NET::NormalMask | - NET::DesktopMask | NET::DockMask | NET::ToolbarMask | NET::MenuMask | - NET::DialogMask | NET::OverrideMask | NET::TopMenuMask | + static const int SUPPORTED_WINDOW_TYPES_MASK = NET::NormalMask | + NET::DesktopMask | NET::DockMask | NET::ToolbarMask | NET::MenuMask | + NET::DialogMask | NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask; - createMainWidget(WStaticContents | WResizeNoErase | WRepaintNoErase); + createMainWidget( Qt::WResizeNoErase); + widget()->setAttribute( Qt::WA_StaticContents); + widget()->setAttribute( Qt::WA_NoBackground ); widget()->installEventFilter(this); widget()->setBackgroundMode(NoBackground); NET::WindowType type = windowType(SUPPORTED_WINDOW_TYPES_MASK); @@ -127,7 +138,7 @@ void OpenLook::init() QFontMetrics fm(options()->font(isActive(), tool_)); titleHeight = fm.height() + openLookTextVMargin * 2; - + switch(KDecoration::options()->preferredBorderSize(factory())) { case KDecoration::BorderLarge: openLookMargin = 9; @@ -151,7 +162,7 @@ void OpenLook::init() openLookCornerSize = 2*openLookMargin + 1; if (titleHeight <= openLookMargin) titleHeight = openLookMargin+1; - + doLayout(); } @@ -193,7 +204,7 @@ bool OpenLook::eventFilter(QObject *o, QEvent *e) return false; } - void + void OpenLook::borders(int &left, int &right, int &top, int &bottom) const { // FRAME XXX Check @@ -207,7 +218,7 @@ OpenLook::captionChange() widget()->update(titleRect()); } - void + void OpenLook::shadeChange() { } @@ -216,10 +227,10 @@ QSize OpenLook::minimumSize() const { int left, right, top, bottom; borders(left, right, top, bottom); - return QSize(left + right + 2 * titleHeight, top + bottom); + return QSize(left + right + 2 * titleHeight, top + bottom); } - void + void OpenLook::resize(const QSize& s) { widget()->resize(s); @@ -275,13 +286,13 @@ OpenLook::showEvent(QShowEvent *) void OpenLook::mouseDoubleClickEvent(QMouseEvent * e) { - if (e->button() == LeftButton && titleRect().contains(e->pos())) + if (e->button() == Qt::LeftButton && titleRect().contains(e->pos())) { titlebarDblClickOperation(); } } - void + void OpenLook::resizeEvent(QResizeEvent* e) { widget()->update(); @@ -308,17 +319,17 @@ OpenLook::mousePosition(const QPoint & p) const return PositionCenter; } - void + void OpenLook::iconChange() { } - void + void OpenLook::desktopChange() { } - void + void OpenLook::maximizeChange() { widget()->repaint(false); @@ -342,18 +353,18 @@ OpenLook::doLayout() layout->addSpacing(2); - QBoxLayout * midLayout = + QBoxLayout * midLayout = new QBoxLayout(layout, QBoxLayout::LeftToRight, 0, 0); - + if (isPreview()) { midLayout->addWidget(new QLabel( - i18n("
OpenLook preview
"), - widget()), + i18n("
OpenLook preview
"), + widget()), 1); } else { midLayout->addItem( new QSpacerItem( 0, 0 )); } - + } bool @@ -624,7 +635,7 @@ OpenLook::paintArrow(QPainter & p) const int w = br.width() - 10; int h = br.height() - 10; - QPointArray poly(3); + Q3PointArray poly(3); p.setBrush(widget()->colorGroup().mid()); diff --git a/kwin-styles/openlook/OpenLook.h b/kwin-styles/openlook/OpenLook.h index d96316c2..7005c613 100644 --- a/kwin-styles/openlook/OpenLook.h +++ b/kwin-styles/openlook/OpenLook.h @@ -25,8 +25,15 @@ #ifndef KWIN_WEB_H #define KWIN_WEB_H -#include -#include +#include +#include +//Added by qt3to4: +#include +#include +#include +#include +#include +#include #include #include @@ -106,7 +113,7 @@ namespace OpenLook virtual KDecoration *createDecoration(KDecorationBridge *); virtual bool reset(unsigned long changed); virtual bool supports( Ability ability ); - QValueList< DecorationFactory::BorderSize > borderSizes() const; + virtual QList< DecorationFactory::BorderSize > borderSizes() const; }; } -- 2.11.4.GIT