no one disagreed on the list so rename default and add a deskop file

svn path=/trunk/KDE/kdebase/workspace/; revision=694801
This commit is contained in:
Gerd Fleischer 2007-07-31 19:37:29 +00:00
parent 768fa6432f
commit e6d07e906d
7 changed files with 120 additions and 108 deletions

View file

@ -3,12 +3,14 @@ add_subdirectory( config )
########### next target ###############
set(kwin3_default_PART_SRCS kdedefault.cpp)
set(kwin3_kde2_PART_SRCS kdedefault.cpp)
kde4_add_plugin(kwin3_default ${kwin3_default_PART_SRCS})
kde4_add_plugin(kwin3_kde2 ${kwin3_kde2_PART_SRCS})
target_link_libraries(kwin3_default ${KDE4_KDEFX_LIBS} kdecorations ${QT_QTGUI_LIBRARY})
target_link_libraries(kwin3_kde2 ${KDE4_KDEFX_LIBS} kdecorations ${QT_QTGUI_LIBRARY})
install(TARGETS kwin3_default DESTINATION ${PLUGIN_INSTALL_DIR})
install(TARGETS kwin3_kde2 DESTINATION ${PLUGIN_INSTALL_DIR})
install( FILES kde2.desktop DESTINATION ${DATA_INSTALL_DIR}/kwin/ )

View file

@ -3,14 +3,14 @@
########### next target ###############
set(kwin_default_config_PART_SRCS config.cpp )
set(kwin_kde2_config_PART_SRCS config.cpp )
kde4_add_plugin(kwin_default_config ${kwin_default_config_PART_SRCS})
kde4_add_plugin(kwin_kde2_config ${kwin_kde2_config_PART_SRCS})
target_link_libraries(kwin_default_config ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY})
target_link_libraries(kwin_kde2_config ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY})
install(TARGETS kwin_default_config DESTINATION ${PLUGIN_INSTALL_DIR} )
install(TARGETS kwin_kde2_config DESTINATION ${PLUGIN_INSTALL_DIR} )

View file

@ -8,18 +8,20 @@
*/
#include "config.h"
#include <kglobal.h>
#include <QWhatsThis>
#include <QPixmap>
#include <kglobal.h>
#include <kdialog.h>
#include <klocale.h>
#include <QPixmap>
#include <kvbox.h>
extern "C"
{
KDE_EXPORT QObject* allocate_config( KConfig* conf, QWidget* parent )
{
return(new KDEDefaultConfig(conf, parent));
return(new KDE2Config(conf, parent));
}
}
@ -29,13 +31,13 @@ extern "C"
// 'parent' is the parent of the QObject, which is a VBox inside the
// Configure tab in kwindecoration
KDEDefaultConfig::KDEDefaultConfig( KConfig* conf, QWidget* parent )
: QObject( parent ),c(conf)
KDE2Config::KDE2Config( KConfig* conf, QWidget* parent )
: QObject( parent ), c(conf)
{
KGlobal::locale()->insertCatalog("kwin_clients");
highcolor = QPixmap::defaultDepth() > 8;
gb = new KVBox( parent );
gb->setSpacing( KDialog::spacingHint() );
gb->setSpacing( KDialog::spacingHint() );
cbShowStipple = new QCheckBox( i18n("Draw titlebar &stipple effect"), gb );
cbShowStipple->setWhatsThis(
@ -58,7 +60,8 @@ KDEDefaultConfig::KDEDefaultConfig( KConfig* conf, QWidget* parent )
}
// Load configuration options
KConfigGroup cg(c, "KDEDefault");
c = new KConfig("kwinKDE2rc");
KConfigGroup cg(c, "General");
load( cg );
// Ensure we track user changes properly
@ -75,13 +78,13 @@ KDEDefaultConfig::KDEDefaultConfig( KConfig* conf, QWidget* parent )
}
KDEDefaultConfig::~KDEDefaultConfig()
KDE2Config::~KDE2Config()
{
delete gb;
}
void KDEDefaultConfig::slotSelectionChanged()
void KDE2Config::slotSelectionChanged()
{
emit changed();
}
@ -89,9 +92,9 @@ void KDEDefaultConfig::slotSelectionChanged()
// Loads the configurable options from the kwinrc config file
// It is passed the open config from kwindecoration to improve efficiency
void KDEDefaultConfig::load( const KConfigGroup& )
void KDE2Config::load( const KConfigGroup& )
{
KConfigGroup cg(c, "KDEDefault");
KConfigGroup cg(c, "KDE2");
bool override = cg.readEntry( "ShowTitleBarStipple", true);
cbShowStipple->setChecked( override );
@ -106,9 +109,9 @@ void KDEDefaultConfig::load( const KConfigGroup& )
// Saves the configurable options to the kwinrc config file
void KDEDefaultConfig::save( KConfigGroup& )
void KDE2Config::save( KConfigGroup& )
{
KConfigGroup cg(c, "KDEDefault");
KConfigGroup cg(c, "KDE2");
cg.writeEntry( "ShowTitleBarStipple", cbShowStipple->isChecked() );
cg.writeEntry( "ShowGrabBar", cbShowGrabBar->isChecked() );
@ -119,7 +122,7 @@ void KDEDefaultConfig::save( KConfigGroup& )
// Sets UI widget defaults which must correspond to style defaults
void KDEDefaultConfig::defaults()
void KDE2Config::defaults()
{
cbShowStipple->setChecked( true );
cbShowGrabBar->setChecked( true );
@ -130,3 +133,4 @@ void KDEDefaultConfig::defaults()
#include "config.moc"
// vim: ts=4
// kate: space-indent off; tab-width 4;

View file

@ -7,22 +7,23 @@
* http://gallium.n3.net/
*/
#ifndef _KDE_DEFAULT_CONFIG_H
#define _KDE_DEFAULT_CONFIG_H
#ifndef KDE2_CONFIG_H
#define KDE2_CONFIG_H
#include <QCheckBox>
#include <QGroupBox>
#include <kconfig.h>
#include <QLabel>
#include <kvbox.h>
class KDEDefaultConfig: public QObject
#include <kvbox.h>
#include <kconfig.h>
class KDE2Config: public QObject
{
Q_OBJECT
public:
KDEDefaultConfig( KConfig* conf, QWidget* parent );
~KDEDefaultConfig();
KDE2Config( KConfig* conf, QWidget* parent );
~KDE2Config();
// These public signals/slots work similar to KCM modules
signals:
@ -41,9 +42,10 @@ class KDEDefaultConfig: public QObject
QCheckBox* cbShowGrabBar;
QCheckBox* cbUseGradients;
KVBox* gb;
KConfig *c;
bool highcolor;
KConfig *c;
bool highcolor;
};
#endif
// vim: ts=4
// kate: space-indent off; tab-width 4;

View file

@ -0,0 +1,5 @@
[Desktop Entry]
Encoding=UTF-8
Name=KDE 2
Name[x-test]=xxKDE 2xx
X-KDE-Library=kwin3_kde2

View file

@ -18,19 +18,18 @@
#include <kimageeffect.h>
#include <kdrawutil.h>
#include <klocale.h>
#include <kdebug.h>
#include <QLayout>
#include <qdrawutil.h>
#include <QBitmap>
#include <QImage>
#include <QApplication>
#include <QLabel>
#include <kdebug.h>
#include <QPixmap>
#include <QPolygon>
#include <QStyle>
namespace Default
namespace KDE2
{
static const unsigned char iconify_bits[] = {
@ -139,12 +138,12 @@ static QPixmap* leftBtnDownPix[2];
static QPixmap* ileftBtnUpPix[2];
static QPixmap* ileftBtnDownPix[2];
static KDEDefaultHandler* clientHandler;
static int toolTitleHeight;
static int normalTitleHeight;
static KDE2Handler* clientHandler;
static int toolTitleHeight;
static int normalTitleHeight;
static int borderWidth;
static int grabBorderWidth;
static bool KDEDefault_initialized = false;
static bool KDE2_initialized = false;
static bool useGradients;
static bool showGrabBar;
static bool showTitleBarStipple;
@ -152,37 +151,37 @@ static bool showTitleBarStipple;
// ===========================================================================
KDEDefaultHandler::KDEDefaultHandler()
KDE2Handler::KDE2Handler()
{
clientHandler = this;
clientHandler = this;
readConfig( false );
createPixmaps();
KDEDefault_initialized = true;
KDE2_initialized = true;
}
KDEDefaultHandler::~KDEDefaultHandler()
KDE2Handler::~KDE2Handler()
{
KDEDefault_initialized = false;
KDE2_initialized = false;
freePixmaps();
clientHandler = NULL;
clientHandler = NULL;
}
KDecoration* KDEDefaultHandler::createDecoration( KDecorationBridge* b )
KDecoration* KDE2Handler::createDecoration( KDecorationBridge* b )
{
return new KDEDefaultClient( b, this );
return new KDE2Client( b, this );
}
bool KDEDefaultHandler::reset( unsigned long changed )
bool KDE2Handler::reset( unsigned long changed )
{
KDEDefault_initialized = false;
KDE2_initialized = false;
changed |= readConfig( true );
if( changed & SettingColors )
{ // pixmaps need to be recreated
freePixmaps();
createPixmaps();
}
KDEDefault_initialized = true;
KDE2_initialized = true;
// SettingButtons is handled by KCommonDecoration
bool need_recreate = ( changed & ( SettingDecoration | SettingFont | SettingBorder )) != 0;
if( need_recreate ) // something else than colors changed
@ -192,12 +191,13 @@ bool KDEDefaultHandler::reset( unsigned long changed )
}
unsigned long KDEDefaultHandler::readConfig( bool update )
unsigned long KDE2Handler::readConfig( bool update )
{
unsigned long changed = 0;
KConfigGroup conf(KGlobal::config(), "KDEDefault");
unsigned long changed = 0;
KConfig c("kwinKDE2rc");
KConfigGroup conf(&c, "General");
bool new_showGrabBar = conf.readEntry("ShowGrabBar", true);
bool new_showGrabBar = conf.readEntry("ShowGrabBar", true);
bool new_showTitleBarStipple = conf.readEntry("ShowTitleBarStipple", true);
bool new_useGradients = conf.readEntry("UseGradients", true);
int new_titleHeight = QFontMetrics(options()->font(true)).height();
@ -257,7 +257,7 @@ unsigned long KDEDefaultHandler::readConfig( bool update )
// This paints the button pixmaps upon loading the style.
void KDEDefaultHandler::createPixmaps()
void KDE2Handler::createPixmaps()
{
bool highcolor = useGradients && (QPixmap::defaultDepth() > 8);
@ -410,7 +410,7 @@ void KDEDefaultHandler::createPixmaps()
}
void KDEDefaultHandler::freePixmaps()
void KDE2Handler::freePixmaps()
{
// Free button pixmaps
if (rightBtnUpPix[true])
@ -471,7 +471,7 @@ void KDEDefaultHandler::freePixmaps()
}
void KDEDefaultHandler::drawButtonBackground(QPixmap *pix,
void KDE2Handler::drawButtonBackground(QPixmap *pix,
const QPalette &g, bool sunken)
{
QPainter p;
@ -508,13 +508,13 @@ void KDEDefaultHandler::drawButtonBackground(QPixmap *pix,
p.drawLine(2, x2-2, y2-2, x2-2);
}
QList< KDEDefaultHandler::BorderSize > KDEDefaultHandler::borderSizes() const
QList< KDE2Handler::BorderSize > KDE2Handler::borderSizes() const
{ // the list must be sorted
return QList< BorderSize >() << BorderNormal << BorderLarge <<
BorderVeryLarge << BorderHuge << BorderVeryHuge << BorderOversized;
}
bool KDEDefaultHandler::supports( Ability ability )
bool KDE2Handler::supports( Ability ability )
{
switch( ability )
{
@ -537,7 +537,7 @@ bool KDEDefaultHandler::supports( Ability ability )
// ===========================================================================
KDEDefaultButton::KDEDefaultButton(ButtonType type, KDEDefaultClient *parent, const char *name)
KDE2Button::KDE2Button(ButtonType type, KDE2Client *parent, const char *name)
: KCommonDecorationButton(type, parent)
{
setObjectName( name );
@ -549,14 +549,14 @@ KDEDefaultButton::KDEDefaultButton(ButtonType type, KDEDefaultClient *parent, co
}
KDEDefaultButton::~KDEDefaultButton()
KDE2Button::~KDE2Button()
{
if (deco)
delete deco;
}
void KDEDefaultButton::reset(unsigned long changed)
void KDE2Button::reset(unsigned long changed)
{
if (changed&DecorationReset || changed&ManualReset || changed&SizeChange || changed&StateChange) {
switch (type() ) {
@ -594,7 +594,7 @@ void KDEDefaultButton::reset(unsigned long changed)
}
void KDEDefaultButton::setBitmap(const unsigned char *bitmap)
void KDE2Button::setBitmap(const unsigned char *bitmap)
{
delete deco;
deco = 0;
@ -605,15 +605,15 @@ void KDEDefaultButton::setBitmap(const unsigned char *bitmap)
}
}
void KDEDefaultButton::paintEvent(QPaintEvent *)
void KDE2Button::paintEvent(QPaintEvent *)
{
QPainter p(this);
drawButton(&p);
}
void KDEDefaultButton::drawButton(QPainter *p)
void KDE2Button::drawButton(QPainter *p)
{
if (!KDEDefault_initialized)
if (!KDE2_initialized)
return;
const bool active = decoration()->isActive();
@ -662,7 +662,7 @@ void KDEDefaultButton::drawButton(QPainter *p)
// otherwise we paint a menu button (with mini icon), or a sticky button.
if( deco ) {
// Select the appropriate button decoration color
bool darkDeco = qGray( KDecoration::options()->color(
bool darkDeco = qGray( KDecoration::options()->color(
isLeft() ? KDecoration::ColorTitleBar : KDecoration::ColorButtonBg,
active).rgb() ) > 127;
@ -703,7 +703,7 @@ void KDEDefaultButton::drawButton(QPainter *p)
}
void KDEDefaultButton::enterEvent(QEvent *e)
void KDE2Button::enterEvent(QEvent *e)
{
isMouseOver=true;
repaint();
@ -711,7 +711,7 @@ void KDEDefaultButton::enterEvent(QEvent *e)
}
void KDEDefaultButton::leaveEvent(QEvent *e)
void KDE2Button::leaveEvent(QEvent *e)
{
isMouseOver=false;
repaint();
@ -721,28 +721,28 @@ void KDEDefaultButton::leaveEvent(QEvent *e)
// ===========================================================================
KDEDefaultClient::KDEDefaultClient( KDecorationBridge* b, KDecorationFactory* f )
KDE2Client::KDE2Client( KDecorationBridge* b, KDecorationFactory* f )
: KCommonDecoration( b, f )/*,
m_closing(false)*/
{
}
QString KDEDefaultClient::visibleName() const
QString KDE2Client::visibleName() const
{
return i18n("KDE2");
return i18n("KDE 2");
}
QString KDEDefaultClient::defaultButtonsLeft() const
QString KDE2Client::defaultButtonsLeft() const
{
return "MS";
}
QString KDEDefaultClient::defaultButtonsRight() const
QString KDE2Client::defaultButtonsRight() const
{
return "HIAX";
}
bool KDEDefaultClient::decorationBehaviour(DecorationBehaviour behaviour) const
bool KDE2Client::decorationBehaviour(DecorationBehaviour behaviour) const
{
switch (behaviour) {
case DB_MenuClose:
@ -757,7 +757,7 @@ bool KDEDefaultClient::decorationBehaviour(DecorationBehaviour behaviour) const
}
}
int KDEDefaultClient::layoutMetric(LayoutMetric lm, bool respectWindowState, const KCommonDecorationButton *btn) const
int KDE2Client::layoutMetric(LayoutMetric lm, bool respectWindowState, const KCommonDecorationButton *btn) const
{
switch (lm) {
case LM_BorderLeft:
@ -794,40 +794,40 @@ int KDEDefaultClient::layoutMetric(LayoutMetric lm, bool respectWindowState, con
case LM_ExplicitButtonSpacer:
if ( !isToolWindow() )
return borderWidth/2;
// fall though
// fall through
default:
return KCommonDecoration::layoutMetric(lm, respectWindowState, btn);
}
}
KCommonDecorationButton *KDEDefaultClient::createButton(ButtonType type)
KCommonDecorationButton *KDE2Client::createButton(ButtonType type)
{
switch (type) {
case MenuButton:
return new KDEDefaultButton(MenuButton, this, "menu");
return new KDE2Button(MenuButton, this, "menu");
case OnAllDesktopsButton:
return new KDEDefaultButton(OnAllDesktopsButton, this, "on_all_desktops");
return new KDE2Button(OnAllDesktopsButton, this, "on_all_desktops");
case HelpButton:
return new KDEDefaultButton(HelpButton, this, "help");
return new KDE2Button(HelpButton, this, "help");
case MinButton:
return new KDEDefaultButton(MinButton, this, "minimize");
return new KDE2Button(MinButton, this, "minimize");
case MaxButton:
return new KDEDefaultButton(MaxButton, this, "maximize");
return new KDE2Button(MaxButton, this, "maximize");
case CloseButton:
return new KDEDefaultButton(CloseButton, this, "close");
return new KDE2Button(CloseButton, this, "close");
case AboveButton:
return new KDEDefaultButton(AboveButton, this, "above");
return new KDE2Button(AboveButton, this, "above");
case BelowButton:
return new KDEDefaultButton(BelowButton, this, "below");
return new KDE2Button(BelowButton, this, "below");
case ShadeButton:
return new KDEDefaultButton(ShadeButton, this, "shade");
return new KDE2Button(ShadeButton, this, "shade");
default:
return 0;
}
}
void KDEDefaultClient::init()
void KDE2Client::init()
{
// Finally, toolWindows look small
if ( isToolWindow() ) {
@ -840,14 +840,14 @@ void KDEDefaultClient::init()
KCommonDecoration::init();
}
void KDEDefaultClient::reset( unsigned long changed)
void KDE2Client::reset( unsigned long changed)
{
widget()->repaint();
KCommonDecoration::reset(changed);
}
bool KDEDefaultClient::mustDrawHandle() const
bool KDE2Client::mustDrawHandle() const
{
bool drawSmallBorders = !options()->moveResizeMaximizedWindows();
if (drawSmallBorders && (maximizeMode() & MaximizeVertical)) {
@ -857,9 +857,9 @@ bool KDEDefaultClient::mustDrawHandle() const
}
}
void KDEDefaultClient::paintEvent( QPaintEvent* )
void KDE2Client::paintEvent( QPaintEvent* )
{
if (!KDEDefault_initialized)
if (!KDE2_initialized)
return;
QPalette g;
@ -1024,7 +1024,7 @@ void KDEDefaultClient::paintEvent( QPaintEvent* )
#endif
}
QRegion KDEDefaultClient::cornerShape(WindowCorner corner)
QRegion KDE2Client::cornerShape(WindowCorner corner)
{
switch (corner) {
case WC_TopLeft:
@ -1049,7 +1049,7 @@ QRegion KDEDefaultClient::cornerShape(WindowCorner corner)
// Extended KWin plugin interface
extern "C" KDE_EXPORT KDecorationFactory* create_factory()
{
return new Default::KDEDefaultHandler();
return new KDE2::KDE2Handler();
}
// vim: ts=4

View file

@ -10,8 +10,8 @@
* Many features are now customizable.
*/
#ifndef _KDE_DEFAULT_H
#define _KDE_DEFAULT_H
#ifndef KDE2_H
#define KDE2_H
#include <QBitmap>
#include <QDateTime>
@ -20,15 +20,15 @@
class QPixmap;
namespace Default {
namespace KDE2 {
class KDEDefaultClient;
class KDE2Client;
class KDEDefaultHandler: public KDecorationFactory
class KDE2Handler: public KDecorationFactory
{
public:
KDEDefaultHandler();
~KDEDefaultHandler();
KDE2Handler();
~KDE2Handler();
KDecoration* createDecoration( KDecorationBridge* b );
bool reset( unsigned long changed );
virtual QList< BorderSize > borderSizes() const;
@ -43,12 +43,11 @@ class KDEDefaultHandler: public KDecorationFactory
};
// class KDEDefaultButton : public QButton, public KDecorationDefines
class KDEDefaultButton : public KCommonDecorationButton
class KDE2Button : public KCommonDecorationButton
{
public:
KDEDefaultButton(ButtonType type, KDEDefaultClient *parent, const char *name);
~KDEDefaultButton();
KDE2Button(ButtonType type, KDE2Client *parent, const char *name);
~KDE2Button();
void reset(unsigned long changed);
@ -67,11 +66,11 @@ class KDEDefaultButton : public KCommonDecorationButton
};
class KDEDefaultClient : public KCommonDecoration
class KDE2Client : public KCommonDecoration
{
public:
KDEDefaultClient( KDecorationBridge* b, KDecorationFactory* f );
~KDEDefaultClient() {;}
KDE2Client( KDecorationBridge* b, KDecorationFactory* f );
~KDE2Client() {;}
virtual QString visibleName() const;
virtual QString defaultButtonsLeft() const;