add configuration option for stripes
svn path=/trunk/KDE/kdebase/workspace/; revision=818156icc-effect-5.14.5
parent
5ea47aa221
commit
ecfa8aa80f
|
@ -1,5 +1,7 @@
|
||||||
add_definitions (-DQT3_SUPPORT -DQT3_SUPPORT_WARNINGS)
|
add_definitions (-DQT3_SUPPORT -DQT3_SUPPORT_WARNINGS)
|
||||||
|
|
||||||
|
add_subdirectory( config )
|
||||||
|
|
||||||
########### next target ###############
|
########### next target ###############
|
||||||
|
|
||||||
set(kwin_oxygen_SRCS
|
set(kwin_oxygen_SRCS
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
include_directories( ${KDEBASE_WORKSPACE_SOURCE_DIR}/kwin/lib )
|
||||||
|
|
||||||
|
|
||||||
|
########### next target ###############
|
||||||
|
|
||||||
|
set(kwin_oxygen_config_PART_SRCS config.cpp )
|
||||||
|
|
||||||
|
|
||||||
|
kde4_add_ui_files(kwin_oxygen_config_PART_SRCS oxygenconfig.ui )
|
||||||
|
|
||||||
|
kde4_add_plugin(kwin_oxygen_config ${kwin_oxygen_config_PART_SRCS})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
target_link_libraries(kwin_oxygen_config ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY})
|
||||||
|
|
||||||
|
install(TARGETS kwin_oxygen_config DESTINATION ${PLUGIN_INSTALL_DIR} )
|
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* Oxygen KWin client configuration module
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008 Lubos Lunak <l.lunak@kde.org>
|
||||||
|
*
|
||||||
|
* Based on the Quartz configuration module,
|
||||||
|
* Copyright (c) 2001 Karol Szwed <gallium@kde.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the license, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <kglobal.h>
|
||||||
|
#include <klocale.h>
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
|
|
||||||
|
#include "config.moc"
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
KDE_EXPORT QObject* allocate_config( KConfig* conf, QWidget* parent )
|
||||||
|
{
|
||||||
|
return ( new Oxygen::OxygenConfig( conf, parent ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Oxygen {
|
||||||
|
|
||||||
|
OxygenConfig::OxygenConfig( KConfig*, QWidget* parent )
|
||||||
|
: QObject( parent )
|
||||||
|
{
|
||||||
|
KGlobal::locale()->insertCatalog("kwin_clients");
|
||||||
|
c = new KConfig( "oxygenrc" );
|
||||||
|
KConfigGroup cg(c, "Windeco");
|
||||||
|
ui = new OxygenConfigUI( parent );
|
||||||
|
connect( ui->showStripes, SIGNAL(clicked()), SIGNAL(changed()) );
|
||||||
|
|
||||||
|
load( cg );
|
||||||
|
ui->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OxygenConfig::~OxygenConfig()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
delete c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Loads the configurable options from the kwinrc config file
|
||||||
|
// It is passed the open config from kwindecoration to improve efficiency
|
||||||
|
void OxygenConfig::load( const KConfigGroup& )
|
||||||
|
{
|
||||||
|
KConfigGroup cg(c, "Windeco");
|
||||||
|
ui->showStripes->setChecked( cg.readEntry("ShowStripes", true) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Saves the configurable options to the kwinrc config file
|
||||||
|
void OxygenConfig::save( KConfigGroup& )
|
||||||
|
{
|
||||||
|
KConfigGroup cg(c, "Windeco");
|
||||||
|
cg.writeEntry( "ShowStripes", ui->showStripes->isChecked() );
|
||||||
|
c->sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Sets UI widget defaults which must correspond to style defaults
|
||||||
|
void OxygenConfig::defaults()
|
||||||
|
{
|
||||||
|
ui->showStripes->setChecked( true );
|
||||||
|
|
||||||
|
emit changed();
|
||||||
|
}
|
||||||
|
|
||||||
|
} //namespace Oxygen
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* Oxygen KWin client configuration module
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008 Lubos Lunak <l.lunak@kde.org>
|
||||||
|
*
|
||||||
|
* Based on the Quartz configuration module,
|
||||||
|
* Copyright (c) 2001 Karol Szwed <gallium@kde.org>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the license, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OXYGEN_CONFIG_H
|
||||||
|
#define OXYGEN_CONFIG_H
|
||||||
|
|
||||||
|
#include <kconfig.h>
|
||||||
|
|
||||||
|
#include "ui_oxygenconfig.h"
|
||||||
|
|
||||||
|
namespace Oxygen {
|
||||||
|
|
||||||
|
class OxygenConfigUI : public QWidget, public Ui::OxygenConfigUI
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OxygenConfigUI( QWidget *parent ) : QWidget( parent )
|
||||||
|
{
|
||||||
|
setupUi( this );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class OxygenConfig: public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
OxygenConfig( KConfig* conf, QWidget* parent );
|
||||||
|
~OxygenConfig();
|
||||||
|
// These public signals/slots work similar to KCM modules
|
||||||
|
signals:
|
||||||
|
void changed();
|
||||||
|
public slots:
|
||||||
|
void load( const KConfigGroup& conf );
|
||||||
|
void save( KConfigGroup& conf );
|
||||||
|
void defaults();
|
||||||
|
private:
|
||||||
|
OxygenConfigUI *ui;
|
||||||
|
KConfig *c;
|
||||||
|
};
|
||||||
|
|
||||||
|
} //namespace Oxygen
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,35 @@
|
||||||
|
<ui version="4.0" >
|
||||||
|
<class>OxygenConfigUI</class>
|
||||||
|
<widget class="QWidget" name="OxygenConfigUI" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>287</width>
|
||||||
|
<height>33</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string>Ozone</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="showStripes" >
|
||||||
|
<property name="whatsThis" >
|
||||||
|
<string>When enabled, this option increases the visibility of the window titlebar by showing stripes</string>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Show stripes next to the title</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11" />
|
||||||
|
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -45,6 +45,7 @@ namespace Oxygen
|
||||||
|
|
||||||
bool OxygenFactory::initialized_ = false;
|
bool OxygenFactory::initialized_ = false;
|
||||||
Qt::Alignment OxygenFactory::titlealign_ = Qt::AlignLeft;
|
Qt::Alignment OxygenFactory::titlealign_ = Qt::AlignLeft;
|
||||||
|
bool OxygenFactory::showStripes_ = true;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// OxygenFactory()
|
// OxygenFactory()
|
||||||
|
@ -114,7 +115,10 @@ bool OxygenFactory::readConfig()
|
||||||
else if (value == "AlignHCenter") titlealign_ = Qt::AlignHCenter;
|
else if (value == "AlignHCenter") titlealign_ = Qt::AlignHCenter;
|
||||||
else if (value == "AlignRight") titlealign_ = Qt::AlignRight;
|
else if (value == "AlignRight") titlealign_ = Qt::AlignRight;
|
||||||
|
|
||||||
if (oldalign == titlealign_)
|
bool oldstripes = showStripes;
|
||||||
|
showStripes_ = group.readEntry( "ShowStripes", true );
|
||||||
|
|
||||||
|
if (oldalign == titlealign_ && oldstripes == showStripes_)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -63,6 +63,7 @@ public:
|
||||||
|
|
||||||
static bool initialized();
|
static bool initialized();
|
||||||
static Qt::Alignment titleAlign();
|
static Qt::Alignment titleAlign();
|
||||||
|
static bool showStripes();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool readConfig();
|
bool readConfig();
|
||||||
|
@ -70,6 +71,7 @@ private:
|
||||||
private:
|
private:
|
||||||
static bool initialized_;
|
static bool initialized_;
|
||||||
static Qt::Alignment titlealign_;
|
static Qt::Alignment titlealign_;
|
||||||
|
static bool showStripes_;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool OxygenFactory::initialized()
|
inline bool OxygenFactory::initialized()
|
||||||
|
@ -78,6 +80,9 @@ inline bool OxygenFactory::initialized()
|
||||||
inline Qt::Alignment OxygenFactory::titleAlign()
|
inline Qt::Alignment OxygenFactory::titleAlign()
|
||||||
{ return titlealign_; }
|
{ return titlealign_; }
|
||||||
|
|
||||||
|
inline bool OxygenFactory::showStripes()
|
||||||
|
{ return showStripes_; }
|
||||||
|
|
||||||
} //namespace Oxygen
|
} //namespace Oxygen
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -346,8 +346,8 @@ void OxygenClient::paintEvent(QPaintEvent *e)
|
||||||
QPointF(x+w, titleTop+titleHeight-0.5));
|
QPointF(x+w, titleTop+titleHeight-0.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw "scratches" as indicator for active windows
|
// draw stripes as indicator for active windows
|
||||||
if (isActive()) {
|
if (isActive() && OxygenFactory::showStripes()) {
|
||||||
Qt::Alignment align = OxygenFactory::titleAlign();
|
Qt::Alignment align = OxygenFactory::titleAlign();
|
||||||
if (widget()->layoutDirection() == Qt::RightToLeft)
|
if (widget()->layoutDirection() == Qt::RightToLeft)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue