2008-07-15 19:21:50 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
2013-03-12 12:17:53 +00:00
|
|
|
Copyright (C) 2008 Martin Gräßlin <mgraesslin@kde.org>
|
2008-07-15 19:21:50 +00:00
|
|
|
|
|
|
|
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. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
#include "cube_config.h"
|
2012-09-12 16:39:13 +00:00
|
|
|
// KConfigSkeleton
|
|
|
|
#include "cubeconfig.h"
|
|
|
|
|
2013-08-14 19:13:12 +00:00
|
|
|
#include <QAction>
|
2008-07-15 19:21:50 +00:00
|
|
|
#include <kwineffects.h>
|
|
|
|
|
|
|
|
#include <kconfiggroup.h>
|
|
|
|
#include <kcolorscheme.h>
|
|
|
|
#include <KActionCollection>
|
2013-07-24 05:41:10 +00:00
|
|
|
#include <KDE/KAboutData>
|
2013-08-14 19:13:12 +00:00
|
|
|
#include <KDE/KGlobalAccel>
|
2008-07-15 19:21:50 +00:00
|
|
|
|
2008-09-16 07:41:39 +00:00
|
|
|
#include <QVBoxLayout>
|
2008-07-15 19:21:50 +00:00
|
|
|
#include <QColor>
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2009-02-05 15:35:38 +00:00
|
|
|
KWIN_EFFECT_CONFIG_FACTORY
|
|
|
|
|
2008-07-15 19:21:50 +00:00
|
|
|
CubeEffectConfigForm::CubeEffectConfigForm(QWidget* parent) : QWidget(parent)
|
|
|
|
{
|
2011-01-30 14:34:42 +00:00
|
|
|
setupUi(this);
|
2008-07-15 19:21:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CubeEffectConfig::CubeEffectConfig(QWidget* parent, const QVariantList& args) :
|
2013-07-24 05:41:10 +00:00
|
|
|
KCModule(KAboutData::pluginData(QStringLiteral("cube")), parent, args)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2008-07-15 19:21:50 +00:00
|
|
|
m_ui = new CubeEffectConfigForm(this);
|
|
|
|
|
2008-09-16 07:41:39 +00:00
|
|
|
QVBoxLayout* layout = new QVBoxLayout(this);
|
2008-07-15 19:21:50 +00:00
|
|
|
|
2008-09-16 07:41:39 +00:00
|
|
|
layout->addWidget(m_ui);
|
2008-07-15 19:21:50 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
m_ui->tabWidget->setTabText(0, i18nc("@title:tab Basic Settings", "Basic"));
|
|
|
|
m_ui->tabWidget->setTabText(1, i18nc("@title:tab Advanced Settings", "Advanced"));
|
2008-08-28 07:42:52 +00:00
|
|
|
|
2009-02-11 00:34:09 +00:00
|
|
|
// Shortcut config. The shortcut belongs to the component "kwin"!
|
2013-08-14 19:13:12 +00:00
|
|
|
m_actionCollection = new KActionCollection(this, QStringLiteral("kwin"));
|
2009-02-11 00:34:09 +00:00
|
|
|
|
2013-07-23 05:02:52 +00:00
|
|
|
m_actionCollection->setConfigGroup(QStringLiteral("Cube"));
|
2008-07-15 19:21:50 +00:00
|
|
|
m_actionCollection->setConfigGlobal(true);
|
|
|
|
|
2013-08-14 19:13:12 +00:00
|
|
|
QAction* cubeAction = m_actionCollection->addAction(QStringLiteral("Cube"));
|
2011-01-30 14:34:42 +00:00
|
|
|
cubeAction->setText(i18n("Desktop Cube"));
|
2009-02-14 09:29:01 +00:00
|
|
|
cubeAction->setProperty("isConfigurationAction", true);
|
2013-08-14 19:13:12 +00:00
|
|
|
KGlobalAccel::self()->setDefaultShortcut(cubeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F11);
|
|
|
|
KGlobalAccel::self()->setShortcut(cubeAction, QList<QKeySequence>() << Qt::CTRL + Qt::Key_F11);
|
|
|
|
QAction* cylinderAction = m_actionCollection->addAction(QStringLiteral("Cylinder"));
|
2011-01-30 14:34:42 +00:00
|
|
|
cylinderAction->setText(i18n("Desktop Cylinder"));
|
2009-02-14 09:29:01 +00:00
|
|
|
cylinderAction->setProperty("isConfigurationAction", true);
|
2013-08-14 19:13:12 +00:00
|
|
|
KGlobalAccel::self()->setShortcut(cylinderAction, QList<QKeySequence>());
|
|
|
|
QAction* sphereAction = m_actionCollection->addAction(QStringLiteral("Sphere"));
|
2011-01-30 14:34:42 +00:00
|
|
|
sphereAction->setText(i18n("Desktop Sphere"));
|
2009-02-14 09:29:01 +00:00
|
|
|
sphereAction->setProperty("isConfigurationAction", true);
|
2013-08-14 19:13:12 +00:00
|
|
|
KGlobalAccel::self()->setShortcut(sphereAction, QList<QKeySequence>());
|
2008-07-15 19:21:50 +00:00
|
|
|
|
|
|
|
m_ui->editor->addCollection(m_actionCollection);
|
2013-08-14 19:13:12 +00:00
|
|
|
|
2012-09-12 16:39:13 +00:00
|
|
|
connect(m_ui->kcfg_Caps, SIGNAL(stateChanged(int)), this, SLOT(capsSelectionChanged()));
|
2013-07-23 05:02:52 +00:00
|
|
|
m_ui->kcfg_Wallpaper->setFilter(QStringLiteral("*.png *.jpeg *.jpg "));
|
2012-09-12 16:39:13 +00:00
|
|
|
addConfig(CubeConfig::self(), m_ui);
|
2008-07-15 19:21:50 +00:00
|
|
|
load();
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-07-15 19:21:50 +00:00
|
|
|
|
|
|
|
void CubeEffectConfig::save()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-09-12 16:39:13 +00:00
|
|
|
KCModule::save();
|
2008-07-15 19:21:50 +00:00
|
|
|
m_ui->editor->save();
|
2013-07-23 05:02:52 +00:00
|
|
|
EffectsHandler::sendReloadMessage(QStringLiteral("cube"));
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2008-07-15 19:21:50 +00:00
|
|
|
|
|
|
|
void CubeEffectConfig::capsSelectionChanged()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-09-12 16:39:13 +00:00
|
|
|
if (m_ui->kcfg_Caps->checkState() == Qt::Checked) {
|
2008-07-15 19:21:50 +00:00
|
|
|
// activate cap color
|
2012-09-12 16:39:13 +00:00
|
|
|
m_ui->kcfg_CapColor->setEnabled(true);
|
2011-01-30 14:34:42 +00:00
|
|
|
m_ui->capColorLabel->setEnabled(true);
|
2012-09-12 16:39:13 +00:00
|
|
|
m_ui->kcfg_TexturedCaps->setEnabled(true);
|
2011-01-30 14:34:42 +00:00
|
|
|
} else {
|
2008-07-15 19:21:50 +00:00
|
|
|
// deactivate cap color
|
2012-09-12 16:39:13 +00:00
|
|
|
m_ui->kcfg_CapColor->setEnabled(false);
|
2011-01-30 14:34:42 +00:00
|
|
|
m_ui->capColorLabel->setEnabled(false);
|
2012-09-12 16:39:13 +00:00
|
|
|
m_ui->kcfg_TexturedCaps->setEnabled(false);
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-17 09:11:53 +00:00
|
|
|
|
2008-07-15 19:21:50 +00:00
|
|
|
} // namespace
|
|
|
|
|
2013-08-07 11:04:01 +00:00
|
|
|
#include "moc_cube_config.cpp"
|