2007-04-29 17:35:43 +00:00
|
|
|
/*
|
2010-01-19 13:56:57 +00:00
|
|
|
This is the new kwindecoration kcontrol module
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2010-01-19 13:56:57 +00:00
|
|
|
Copyright (c) 2001
|
|
|
|
Karol Szwed <gallium@kde.org>
|
|
|
|
http://gallium.n3.net/
|
2013-03-12 12:17:53 +00:00
|
|
|
Copyright 2009, 2010 Martin Gräßlin <mgraesslin@kde.org>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2010-01-19 13:56:57 +00:00
|
|
|
Supports new kwin configuration plugins, and titlebar button position
|
|
|
|
modification via dnd interface.
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2010-01-19 13:56:57 +00:00
|
|
|
Based on original "kwintheme" (Window Borders)
|
|
|
|
Copyright (C) 2001 Rik Hemsley (rikkus) <rik@kde.org>
|
2007-04-29 17:35:43 +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, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KWINDECORATION_H
|
|
|
|
#define KWINDECORATION_H
|
|
|
|
|
|
|
|
#include <kcmodule.h>
|
2013-10-01 06:08:29 +00:00
|
|
|
#include <KSharedConfig>
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include <kdecoration.h>
|
|
|
|
|
2010-01-19 13:44:22 +00:00
|
|
|
#include "ui_decoration.h"
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-10-01 10:30:38 +00:00
|
|
|
class QQuickView;
|
2010-01-19 13:44:22 +00:00
|
|
|
class QSortFilterProxyModel;
|
2014-06-18 13:02:58 +00:00
|
|
|
class KLocalizedTranslator;
|
2010-01-19 13:44:22 +00:00
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
|
|
|
class DecorationModel;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2010-01-19 13:44:22 +00:00
|
|
|
class KWinDecorationForm : public QWidget, public Ui::KWinDecorationForm
|
2007-04-29 17:35:43 +00:00
|
|
|
{
|
2010-01-19 13:44:22 +00:00
|
|
|
Q_OBJECT
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
|
|
|
explicit KWinDecorationForm(QWidget* parent);
|
2010-01-19 13:44:22 +00:00
|
|
|
};
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-10-10 11:53:10 +00:00
|
|
|
class DecorationButtons : public QObject, public KDecorationDefines
|
2012-01-13 10:48:04 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(bool customButtonPositions READ customPositions WRITE setCustomPositions NOTIFY customPositionsChanged)
|
|
|
|
public:
|
2014-01-07 10:22:24 +00:00
|
|
|
explicit DecorationButtons(QObject *parent = nullptr);
|
2012-01-13 10:48:04 +00:00
|
|
|
virtual ~DecorationButtons();
|
|
|
|
|
|
|
|
bool customPositions() const;
|
2013-10-10 11:53:10 +00:00
|
|
|
const QList<DecorationButton> &leftButtons() const;
|
|
|
|
const QList<DecorationButton> &rightButtons() const;
|
2012-01-13 10:48:04 +00:00
|
|
|
|
|
|
|
void setCustomPositions(bool set);
|
2013-10-10 11:53:10 +00:00
|
|
|
void setLeftButtons(const QList<KDecorationDefines::DecorationButton> &buttons);
|
|
|
|
void setRightButtons(const QList<KDecorationDefines::DecorationButton> &buttons);
|
2012-01-13 10:48:04 +00:00
|
|
|
|
|
|
|
public Q_SLOTS:
|
|
|
|
void resetToDefaults();
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void customPositionsChanged();
|
|
|
|
void leftButtonsChanged();
|
|
|
|
void rightButtonsChanged();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_customPositions;
|
2013-10-10 11:53:10 +00:00
|
|
|
QList<DecorationButton> m_leftButtons;
|
|
|
|
QList<DecorationButton> m_rightButtons;
|
2012-01-13 10:48:04 +00:00
|
|
|
};
|
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
class KWinDecorationModule : public KCModule, public KDecorationDefines
|
|
|
|
{
|
2010-01-19 13:56:57 +00:00
|
|
|
Q_OBJECT
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
public:
|
|
|
|
KWinDecorationModule(QWidget* parent, const QVariantList &);
|
|
|
|
~KWinDecorationModule();
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
virtual void load();
|
|
|
|
virtual void save();
|
|
|
|
virtual void defaults();
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
QString quickHelp() const;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2013-10-01 05:59:59 +00:00
|
|
|
Q_SIGNALS:
|
2011-01-30 14:34:42 +00:00
|
|
|
void pluginLoad(const KConfigGroup& conf);
|
|
|
|
void pluginSave(KConfigGroup &conf);
|
|
|
|
void pluginDefaults();
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-05-22 17:32:53 +00:00
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *o, QEvent *e);
|
2012-11-26 09:05:17 +00:00
|
|
|
virtual void showEvent(QShowEvent *ev);
|
2012-05-22 17:32:53 +00:00
|
|
|
|
2013-10-01 05:59:59 +00:00
|
|
|
protected Q_SLOTS:
|
2011-01-30 14:34:42 +00:00
|
|
|
// Allows us to turn "save" on
|
|
|
|
void slotSelectionChanged();
|
|
|
|
void slotConfigureButtons();
|
|
|
|
void slotGHNSClicked();
|
|
|
|
void slotConfigureDecoration();
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
private:
|
2012-11-26 09:05:17 +00:00
|
|
|
void init();
|
2011-01-30 14:34:42 +00:00
|
|
|
void readConfig(const KConfigGroup& conf);
|
|
|
|
void writeConfig(KConfigGroup &conf);
|
2013-10-01 05:59:59 +00:00
|
|
|
private Q_SLOTS:
|
2012-05-22 17:32:53 +00:00
|
|
|
void updateScrollbarRange();
|
|
|
|
void updateScrollbarValue();
|
|
|
|
void updateViewPosition(int v);
|
|
|
|
private:
|
2011-01-30 14:34:42 +00:00
|
|
|
KSharedConfigPtr kwinConfig;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
KWinDecorationForm* m_ui;
|
|
|
|
bool m_showTooltips;
|
2010-01-19 13:44:22 +00:00
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
DecorationModel* m_model;
|
|
|
|
QSortFilterProxyModel* m_proxyModel;
|
|
|
|
bool m_configLoaded;
|
2012-01-13 10:48:04 +00:00
|
|
|
DecorationButtons *m_decorationButtons;
|
2012-05-24 20:22:50 +00:00
|
|
|
|
2013-10-01 10:30:38 +00:00
|
|
|
QScopedPointer<QQuickView> m_listView;
|
2014-06-06 06:07:56 +00:00
|
|
|
|
|
|
|
KLocalizedTranslator *m_translator;
|
2007-04-29 17:35:43 +00:00
|
|
|
};
|
|
|
|
|
2010-01-19 13:44:22 +00:00
|
|
|
} //namespace
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#endif
|