[kcmdeco] Use new DecorationButton types for describing the buttons
Rather heavy change to get the kcm to no longer use the string based definition of the buttons on the left and right.
This commit is contained in:
parent
b73d90cf78
commit
07294b49f2
10 changed files with 115 additions and 111 deletions
|
@ -64,7 +64,7 @@ ButtonDrag::ButtonDrag(Button btn)
|
|||
QDataStream stream(&data, QIODevice::WriteOnly);
|
||||
stream << btn.name;
|
||||
stream << btn.icon;
|
||||
stream << btn.type.unicode();
|
||||
stream << btn.type;
|
||||
stream << (int) btn.duplicate;
|
||||
stream << (int) btn.supported;
|
||||
setData(BUTTONDRAGMIMETYPE, data);
|
||||
|
@ -84,9 +84,9 @@ bool ButtonDrag::decode(QDropEvent* e, Button& btn)
|
|||
QDataStream stream(data);
|
||||
stream >> btn.name;
|
||||
stream >> btn.icon;
|
||||
ushort type;
|
||||
int type;
|
||||
stream >> type;
|
||||
btn.type = QChar(type);
|
||||
btn.type = KDecorationDefines::DecorationButton(type);
|
||||
int duplicate;
|
||||
stream >> duplicate;
|
||||
btn.duplicate = duplicate;
|
||||
|
@ -103,7 +103,7 @@ Button::Button()
|
|||
{
|
||||
}
|
||||
|
||||
Button::Button(const QString& n, const QBitmap& i, QChar t, bool d, bool s)
|
||||
Button::Button(const QString& n, const QBitmap& i, KDecorationDefines::DecorationButton t, bool d, bool s)
|
||||
: name(n),
|
||||
icon(i),
|
||||
type(t),
|
||||
|
@ -696,115 +696,126 @@ ButtonPositionWidget::ButtonPositionWidget(QWidget *parent)
|
|||
|
||||
if (style == "ButtonVertical") {
|
||||
m_supportedButtons = "MNSHIAX_FBLR"; // support all buttons
|
||||
new ButtonSourceItem(m_buttonSource, getButton('N', dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonApplicationMenu, dummy));
|
||||
}
|
||||
#endif
|
||||
|
||||
new ButtonSourceItem(m_buttonSource, getButton('R', dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton('L', dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton('B', dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton('F', dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton('X', dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton('A', dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton('I', dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton('H', dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton('S', dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton('M', dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton('_', dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonResize, dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonShade, dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonKeepBelow, dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonKeepAbove, dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonClose, dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonMaximizeRestore, dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonMinimize, dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonQuickHelp, dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonOnAllDesktops, dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonMenu, dummy));
|
||||
new ButtonSourceItem(m_buttonSource, getButton(KDecorationDefines::DecorationButtonExplicitSpacer, dummy));
|
||||
}
|
||||
|
||||
ButtonPositionWidget::~ButtonPositionWidget()
|
||||
{
|
||||
}
|
||||
|
||||
Button ButtonPositionWidget::getButton(QChar type, bool& success)
|
||||
Button ButtonPositionWidget::getButton(KDecorationDefines::DecorationButton type, bool& success)
|
||||
{
|
||||
success = true;
|
||||
|
||||
if (type == 'R') {
|
||||
switch (type) {
|
||||
case KDecorationDefines::DecorationButtonResize: {
|
||||
QBitmap bmp = QBitmap::fromData(QSize(resize_width, resize_height), resize_bits);
|
||||
bmp.createMaskFromColor(Qt::white);
|
||||
return Button(i18n("Resize"), bmp, 'R', false, m_supportedButtons.contains('R'));
|
||||
} else if (type == 'L') {
|
||||
return Button(i18n("Resize"), bmp, type, false, m_supportedButtons.contains('R'));
|
||||
}
|
||||
case KDecorationDefines::DecorationButtonShade: {
|
||||
QBitmap bmp = QBitmap::fromData(QSize(shade_width, shade_height), shade_bits);
|
||||
bmp.createMaskFromColor(Qt::white);
|
||||
return Button(i18n("Shade"), bmp, 'L', false, m_supportedButtons.contains('L'));
|
||||
} else if (type == 'B') {
|
||||
return Button(i18n("Shade"), bmp, type, false, m_supportedButtons.contains('L'));
|
||||
}
|
||||
case KDecorationDefines::DecorationButtonKeepBelow: {
|
||||
QBitmap bmp = QBitmap::fromData(QSize(keepbelowothers_width, keepbelowothers_height), keepbelowothers_bits);
|
||||
bmp.createMaskFromColor(Qt::white);
|
||||
return Button(i18n("Keep Below Others"), bmp, 'B', false, m_supportedButtons.contains('B'));
|
||||
} else if (type == 'F') {
|
||||
return Button(i18n("Keep Below Others"), bmp, type, false, m_supportedButtons.contains('B'));
|
||||
}
|
||||
case KDecorationDefines::DecorationButtonKeepAbove: {
|
||||
QBitmap bmp = QBitmap::fromData(QSize(keepaboveothers_width, keepaboveothers_height), keepaboveothers_bits);
|
||||
bmp.createMaskFromColor(Qt::white);
|
||||
return Button(i18n("Keep Above Others"), bmp, 'F', false, m_supportedButtons.contains('F'));
|
||||
} else if (type == 'X') {
|
||||
return Button(i18n("Keep Above Others"), bmp, type, false, m_supportedButtons.contains('F'));
|
||||
}
|
||||
case KDecorationDefines::DecorationButtonClose: {
|
||||
QBitmap bmp = QBitmap::fromData(QSize(close_width, close_height), close_bits);
|
||||
bmp.createMaskFromColor(Qt::white);
|
||||
return Button(i18n("Close"), bmp, 'X', false, m_supportedButtons.contains('X'));
|
||||
} else if (type == 'A') {
|
||||
return Button(i18n("Close"), bmp, type, false, m_supportedButtons.contains('X'));
|
||||
}
|
||||
case KDecorationDefines::DecorationButtonMaximizeRestore: {
|
||||
QBitmap bmp = QBitmap::fromData(QSize(maximize_width, maximize_height), maximize_bits);
|
||||
bmp.createMaskFromColor(Qt::white);
|
||||
return Button(i18n("Maximize"), bmp, 'A', false, m_supportedButtons.contains('A'));
|
||||
} else if (type == 'I') {
|
||||
return Button(i18n("Maximize"), bmp, type, false, m_supportedButtons.contains('A'));
|
||||
}
|
||||
case KDecorationDefines::DecorationButtonMinimize: {
|
||||
QBitmap bmp = QBitmap::fromData(QSize(minimize_width, minimize_height), minimize_bits);
|
||||
bmp.createMaskFromColor(Qt::white);
|
||||
return Button(i18n("Minimize"), bmp, 'I', false, m_supportedButtons.contains('I'));
|
||||
} else if (type == 'H') {
|
||||
return Button(i18n("Minimize"), bmp, type, false, m_supportedButtons.contains('I'));
|
||||
}
|
||||
case KDecorationDefines::DecorationButtonQuickHelp: {
|
||||
QBitmap bmp = QBitmap::fromData(QSize(help_width, help_height), help_bits);
|
||||
bmp.createMaskFromColor(Qt::white);
|
||||
return Button(i18n("Help"), bmp, 'H', false, m_supportedButtons.contains('H'));
|
||||
} else if (type == 'S') {
|
||||
return Button(i18n("Help"), bmp, type, false, m_supportedButtons.contains('H'));
|
||||
}
|
||||
case KDecorationDefines::DecorationButtonOnAllDesktops: {
|
||||
QBitmap bmp = QBitmap::fromData(QSize(onalldesktops_width, onalldesktops_height), onalldesktops_bits);
|
||||
bmp.createMaskFromColor(Qt::white);
|
||||
return Button(i18n("On All Desktops"), bmp, 'S', false, m_supportedButtons.contains('S'));
|
||||
} else if (type == 'M') {
|
||||
return Button(i18n("On All Desktops"), bmp, type, false, m_supportedButtons.contains('S'));
|
||||
}
|
||||
case KDecorationDefines::DecorationButtonMenu: {
|
||||
QBitmap bmp = QBitmap::fromData(QSize(menu_width, menu_height), menu_bits);
|
||||
bmp.createMaskFromColor(Qt::white);
|
||||
return Button(i18nc("Button showing window actions menu", "Window Menu"), bmp, 'M', false, m_supportedButtons.contains('M'));
|
||||
return Button(i18nc("Button showing window actions menu", "Window Menu"), bmp, type, false, m_supportedButtons.contains('M'));
|
||||
#ifdef KWIN_BUILD_KAPPMENU
|
||||
} else if (type == 'N') {
|
||||
}
|
||||
case KDecorationDefines::DecorationButtonApplicationMenu: {
|
||||
QBitmap bmp = QBitmap::fromData(QSize(menu_width, menu_height), menu_bits);
|
||||
bmp.createMaskFromColor(Qt::white);
|
||||
return Button(i18nc("Button showing application menu imported from dbusmenu", "Application Menu"), bmp, 'N', false, m_supportedButtons.contains('N'));
|
||||
return Button(i18nc("Button showing application menu imported from dbusmenu", "Application Menu"), bmp, type, false, m_supportedButtons.contains('N'));
|
||||
#endif
|
||||
} else if (type == '_') {
|
||||
}
|
||||
case KDecorationDefines::DecorationButtonExplicitSpacer: {
|
||||
QBitmap bmp = QBitmap::fromData(QSize(spacer_width, spacer_height), spacer_bits);
|
||||
bmp.createMaskFromColor(Qt::white);
|
||||
return Button(i18n("--- spacer ---"), bmp, '_', true, m_supportedButtons.contains('_'));
|
||||
} else {
|
||||
return Button(i18n("--- spacer ---"), bmp, type, true, m_supportedButtons.contains('_'));
|
||||
}
|
||||
default:
|
||||
success = false;
|
||||
return Button();
|
||||
}
|
||||
}
|
||||
|
||||
QString ButtonPositionWidget::buttonsLeft() const
|
||||
QList<KDecorationDefines::DecorationButton> ButtonPositionWidget::buttonsLeft() const
|
||||
{
|
||||
ButtonList btns = m_dropSite->buttonsLeft;
|
||||
QString btnString = "";
|
||||
for (ButtonList::const_iterator it = btns.constBegin(); it != btns.constEnd(); ++it) {
|
||||
btnString.append((*it)->button().type);
|
||||
QList<KDecorationDefines::DecorationButton> ret;
|
||||
for (auto button : m_dropSite->buttonsLeft) {
|
||||
ret << button->button().type;
|
||||
}
|
||||
return btnString;
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString ButtonPositionWidget::buttonsRight() const
|
||||
QList<KDecorationDefines::DecorationButton> ButtonPositionWidget::buttonsRight() const
|
||||
{
|
||||
ButtonList btns = m_dropSite->buttonsRight;
|
||||
QString btnString = "";
|
||||
for (ButtonList::const_iterator it = btns.constBegin(); it != btns.constEnd(); ++it) {
|
||||
btnString.append((*it)->button().type);
|
||||
QList<KDecorationDefines::DecorationButton> ret;
|
||||
for (auto button : m_dropSite->buttonsRight) {
|
||||
ret << button->button().type;
|
||||
}
|
||||
return btnString;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ButtonPositionWidget::setButtonsLeft(const QString &buttons)
|
||||
void ButtonPositionWidget::setButtonsLeft(const QList<KDecorationDefines::DecorationButton> &buttons)
|
||||
{
|
||||
// to keep the button lists consistent, first remove all left buttons, then add buttons again...
|
||||
m_dropSite->clearLeft();
|
||||
|
||||
for (int i = 0; i < buttons.length(); ++i) {
|
||||
for (auto button : buttons) {
|
||||
bool succ = false;
|
||||
Button btn = getButton(buttons[i], succ);
|
||||
Button btn = getButton(button, succ);
|
||||
if (succ) {
|
||||
m_dropSite->buttonsLeft.append(new ButtonDropSiteItem(btn));
|
||||
m_buttonSource->hideButton(btn.type);
|
||||
|
@ -814,14 +825,14 @@ void ButtonPositionWidget::setButtonsLeft(const QString &buttons)
|
|||
m_dropSite->update();
|
||||
}
|
||||
|
||||
void ButtonPositionWidget::setButtonsRight(const QString &buttons)
|
||||
void ButtonPositionWidget::setButtonsRight(const QList<KDecorationDefines::DecorationButton> &buttons)
|
||||
{
|
||||
// to keep the button lists consistent, first remove all left buttons, then add buttons again...
|
||||
m_dropSite->clearRight();
|
||||
|
||||
for (int i = 0; i < buttons.length(); ++i) {
|
||||
for (auto button : buttons) {
|
||||
bool succ = false;
|
||||
Button btn = getButton(buttons[i], succ);
|
||||
Button btn = getButton(button, succ);
|
||||
if (succ) {
|
||||
m_dropSite->buttonsRight.append(new ButtonDropSiteItem(btn));
|
||||
m_buttonSource->hideButton(btn.type);
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
#ifndef BUTTONS_H
|
||||
#define BUTTONS_H
|
||||
|
||||
#include <kdecoration.h>
|
||||
|
||||
#include <QBitmap>
|
||||
#include <QListWidget>
|
||||
#include <QMimeData>
|
||||
|
||||
class KDecorationFactory;
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
|
@ -48,12 +48,12 @@ class Button
|
|||
{
|
||||
public:
|
||||
Button();
|
||||
Button(const QString& name, const QBitmap& icon, QChar type, bool duplicate, bool supported);
|
||||
Button(const QString& name, const QBitmap& icon, KDecorationDefines::DecorationButton type, bool duplicate, bool supported);
|
||||
virtual ~Button();
|
||||
|
||||
QString name;
|
||||
QBitmap icon;
|
||||
QChar type;
|
||||
KDecorationDefines::DecorationButton type;
|
||||
bool duplicate;
|
||||
bool supported;
|
||||
};
|
||||
|
@ -199,17 +199,17 @@ public:
|
|||
explicit ButtonPositionWidget(QWidget *parent = 0);
|
||||
~ButtonPositionWidget();
|
||||
|
||||
QString buttonsLeft() const;
|
||||
QString buttonsRight() const;
|
||||
void setButtonsLeft(const QString &buttons);
|
||||
void setButtonsRight(const QString &buttons);
|
||||
QList<KDecorationDefines::DecorationButton> buttonsLeft() const;
|
||||
QList<KDecorationDefines::DecorationButton> buttonsRight() const;
|
||||
void setButtonsLeft(const QList<KDecorationDefines::DecorationButton> &buttons);
|
||||
void setButtonsRight(const QList<KDecorationDefines::DecorationButton> &buttons);
|
||||
|
||||
Q_SIGNALS:
|
||||
void changed();
|
||||
|
||||
private:
|
||||
void clearButtonList(const ButtonList& btns);
|
||||
Button getButton(QChar type, bool& success);
|
||||
Button getButton(KDecorationDefines::DecorationButton type, bool& success);
|
||||
|
||||
ButtonDropSite* m_dropSite;
|
||||
ButtonSource *m_buttonSource;
|
||||
|
|
|
@ -74,12 +74,12 @@ bool KWinDecorationButtonsConfigDialog::showTooltips() const
|
|||
return m_ui->showToolTipsCheckBox->isChecked();
|
||||
}
|
||||
|
||||
QString KWinDecorationButtonsConfigDialog::buttonsLeft() const
|
||||
QList<KDecorationDefines::DecorationButton> KWinDecorationButtonsConfigDialog::buttonsLeft() const
|
||||
{
|
||||
return m_ui->buttonPositionWidget->buttonsLeft();
|
||||
}
|
||||
|
||||
QString KWinDecorationButtonsConfigDialog::buttonsRight() const
|
||||
QList<KDecorationDefines::DecorationButton> KWinDecorationButtonsConfigDialog::buttonsRight() const
|
||||
{
|
||||
return m_ui->buttonPositionWidget->buttonsRight();
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ public:
|
|||
|
||||
bool customPositions() const;
|
||||
bool showTooltips() const;
|
||||
QString buttonsLeft() const;
|
||||
QString buttonsRight() const;
|
||||
QList<KDecorationDefines::DecorationButton> buttonsLeft() const;
|
||||
QList<KDecorationDefines::DecorationButton> buttonsRight() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void changed();
|
||||
|
|
|
@ -56,8 +56,6 @@ DecorationModel::DecorationModel(KSharedConfigPtr config, QObject* parent)
|
|||
, m_plugins(new KDecorationPreviewPlugins(config))
|
||||
, m_preview(new KDecorationPreview())
|
||||
, m_customButtons(false)
|
||||
, m_leftButtons(QString())
|
||||
, m_rightButtons(QString())
|
||||
, m_options(new KDecorationPreviewOptions)
|
||||
{
|
||||
QHash<int, QByteArray> roleNames;
|
||||
|
@ -313,19 +311,14 @@ bool DecorationModel::setData(const QModelIndex& index, const QVariant& value, i
|
|||
void DecorationModel::changeButtons(const KWin::DecorationButtons *buttons)
|
||||
{
|
||||
m_customButtons = buttons->customPositions();
|
||||
m_leftButtons = buttons->leftButtons();
|
||||
m_rightButtons = buttons->rightButtons();
|
||||
m_options->setCustomTitleButtonsEnabled(m_customButtons);
|
||||
m_options->setCustomTitleButtons(m_leftButtons, m_rightButtons);
|
||||
m_options->setCustomTitleButtons(buttons->leftButtons(), buttons->rightButtons());
|
||||
}
|
||||
|
||||
void DecorationModel::setButtons(bool custom, const QString& left, const QString& right)
|
||||
void DecorationModel::setButtons(bool custom, const QList<KDecorationDefines::DecorationButton> &left, const QList<KDecorationDefines::DecorationButton> &right)
|
||||
{
|
||||
m_customButtons = custom;
|
||||
m_leftButtons = left;
|
||||
m_rightButtons = right;
|
||||
m_options->setCustomTitleButtonsEnabled(m_customButtons);
|
||||
m_options->setCustomTitleButtons(m_leftButtons, m_rightButtons);
|
||||
m_options->setCustomTitleButtons(left, right);
|
||||
}
|
||||
|
||||
QModelIndex DecorationModel::indexOfLibrary(const QString& libraryName) const
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
/**
|
||||
* Changes the button state without regenerating the preview.
|
||||
*/
|
||||
void setButtons(bool custom, const QString& left, const QString& right);
|
||||
void setButtons(bool custom, const QList<KDecorationDefines::DecorationButton>& left, const QList<KDecorationDefines::DecorationButton>& right);
|
||||
|
||||
void setBorderSize(const QModelIndex& index, KDecorationDefines::BorderSize size);
|
||||
|
||||
|
@ -127,8 +127,6 @@ private:
|
|||
KDecorationPlugins* m_plugins;
|
||||
KDecorationPreview* m_preview;
|
||||
bool m_customButtons;
|
||||
QString m_leftButtons;
|
||||
QString m_rightButtons;
|
||||
KSharedConfigPtr m_config;
|
||||
QScopedPointer<KDecorationPreviewOptions> m_options;
|
||||
};
|
||||
|
|
|
@ -216,9 +216,11 @@ void KWinDecorationModule::readConfig(const KConfigGroup & conf)
|
|||
// ============
|
||||
m_decorationButtons->setCustomPositions(conf.readEntry("CustomButtonPositions", false));
|
||||
// Menu and onAllDesktops buttons are default on LHS
|
||||
m_decorationButtons->setLeftButtons(conf.readEntry("ButtonsOnLeft", KDecorationOptions::defaultTitleButtonsLeft()));
|
||||
m_decorationButtons->setLeftButtons(KDecorationOptions::readDecorationButtons(conf, "ButtonsOnLeft",
|
||||
KDecorationOptions::defaultTitleButtonsLeft()));
|
||||
// Help, Minimize, Maximize and Close are default on RHS
|
||||
m_decorationButtons->setRightButtons(conf.readEntry("ButtonsOnRight", KDecorationOptions::defaultTitleButtonsRight()));
|
||||
m_decorationButtons->setRightButtons(KDecorationOptions::readDecorationButtons(conf, "ButtonsOnRight",
|
||||
KDecorationOptions::defaultTitleButtonsRight()));
|
||||
if (m_configLoaded)
|
||||
m_model->changeButtons(m_decorationButtons);
|
||||
else {
|
||||
|
@ -242,8 +244,8 @@ void KWinDecorationModule::writeConfig(KConfigGroup & conf)
|
|||
conf.writeEntry("ShowToolTips", m_showTooltips);
|
||||
|
||||
// Button settings
|
||||
conf.writeEntry("ButtonsOnLeft", m_decorationButtons->leftButtons());
|
||||
conf.writeEntry("ButtonsOnRight", m_decorationButtons->rightButtons());
|
||||
KDecorationOptions::writeDecorationButtons(conf, "ButtonsOnLeft", m_decorationButtons->leftButtons());
|
||||
KDecorationOptions::writeDecorationButtons(conf, "ButtonsOnRight", m_decorationButtons->rightButtons());
|
||||
conf.writeEntry("BorderSize",
|
||||
static_cast<int>(m_model->data(index, DecorationModel::BorderSizeRole).toInt()));
|
||||
|
||||
|
@ -508,9 +510,11 @@ void KWinDecorationModule::updateViewPosition(int v)
|
|||
DecorationButtons::DecorationButtons(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_customPositions(false)
|
||||
, m_leftButtons(KDecorationOptions::defaultTitleButtonsLeft())
|
||||
, m_rightButtons(KDecorationOptions::defaultTitleButtonsRight())
|
||||
, m_leftButtons()
|
||||
, m_rightButtons()
|
||||
{
|
||||
setLeftButtons(KDecorationOptions::defaultTitleButtonsLeft());
|
||||
setRightButtons(KDecorationOptions::defaultTitleButtonsRight());
|
||||
}
|
||||
|
||||
DecorationButtons::~DecorationButtons()
|
||||
|
@ -522,12 +526,12 @@ bool DecorationButtons::customPositions() const
|
|||
return m_customPositions;
|
||||
}
|
||||
|
||||
const QString &DecorationButtons::leftButtons() const
|
||||
const QList<KDecorationDefines::DecorationButton> &DecorationButtons::leftButtons() const
|
||||
{
|
||||
return m_leftButtons;
|
||||
}
|
||||
|
||||
const QString &DecorationButtons::rightButtons() const
|
||||
const QList<KDecorationDefines::DecorationButton> &DecorationButtons::rightButtons() const
|
||||
{
|
||||
return m_rightButtons;
|
||||
}
|
||||
|
@ -541,7 +545,7 @@ void DecorationButtons::setCustomPositions(bool set)
|
|||
emit customPositionsChanged();
|
||||
}
|
||||
|
||||
void DecorationButtons::setLeftButtons(const QString &leftButtons)
|
||||
void DecorationButtons::setLeftButtons(const QList<DecorationButton> &leftButtons)
|
||||
{
|
||||
if (m_leftButtons == leftButtons) {
|
||||
return;
|
||||
|
@ -550,7 +554,7 @@ void DecorationButtons::setLeftButtons(const QString &leftButtons)
|
|||
emit leftButtonsChanged();
|
||||
}
|
||||
|
||||
void DecorationButtons::setRightButtons (const QString &rightButtons)
|
||||
void DecorationButtons::setRightButtons(const QList<DecorationButton> &rightButtons)
|
||||
{
|
||||
if (m_rightButtons == rightButtons) {
|
||||
return;
|
||||
|
|
|
@ -53,23 +53,21 @@ public:
|
|||
explicit KWinDecorationForm(QWidget* parent);
|
||||
};
|
||||
|
||||
class DecorationButtons : public QObject
|
||||
class DecorationButtons : public QObject, public KDecorationDefines
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool customButtonPositions READ customPositions WRITE setCustomPositions NOTIFY customPositionsChanged)
|
||||
Q_PROPERTY(QString leftButtons READ leftButtons WRITE setLeftButtons NOTIFY leftButtonsChanged)
|
||||
Q_PROPERTY(QString rightButtons READ rightButtons WRITE setRightButtons NOTIFY rightButtonsChanged)
|
||||
public:
|
||||
explicit DecorationButtons(QObject *parent = 0);
|
||||
virtual ~DecorationButtons();
|
||||
|
||||
bool customPositions() const;
|
||||
const QString &leftButtons() const;
|
||||
const QString &rightButtons() const;
|
||||
const QList<DecorationButton> &leftButtons() const;
|
||||
const QList<DecorationButton> &rightButtons() const;
|
||||
|
||||
void setCustomPositions(bool set);
|
||||
void setLeftButtons(const QString &leftButtons);
|
||||
void setRightButtons(const QString &rightButtons);
|
||||
void setLeftButtons(const QList<KDecorationDefines::DecorationButton> &buttons);
|
||||
void setRightButtons(const QList<KDecorationDefines::DecorationButton> &buttons);
|
||||
|
||||
public Q_SLOTS:
|
||||
void resetToDefaults();
|
||||
|
@ -81,8 +79,8 @@ Q_SIGNALS:
|
|||
|
||||
private:
|
||||
bool m_customPositions;
|
||||
QString m_leftButtons;
|
||||
QString m_rightButtons;
|
||||
QList<DecorationButton> m_leftButtons;
|
||||
QList<DecorationButton> m_rightButtons;
|
||||
};
|
||||
|
||||
class KWinDecorationModule : public KCModule, public KDecorationDefines
|
||||
|
|
|
@ -577,9 +577,9 @@ void KDecorationPreviewOptions::updateSettings()
|
|||
if (customButtonsChanged)
|
||||
setCustomButtonPositions(customButtons);
|
||||
if (customButtons) {
|
||||
if (!customTitleButtonsLeft.isNull())
|
||||
if (!customTitleButtonsLeft.isEmpty())
|
||||
setTitleButtonsLeft(customTitleButtonsLeft);
|
||||
if (!customTitleButtonsRight.isNull())
|
||||
if (!customTitleButtonsRight.isEmpty())
|
||||
setTitleButtonsRight(customTitleButtonsRight);
|
||||
} else {
|
||||
setTitleButtonsLeft(KDecorationOptions::defaultTitleButtonsLeft());
|
||||
|
@ -602,7 +602,7 @@ void KDecorationPreviewOptions::setCustomTitleButtonsEnabled(bool enabled)
|
|||
updateSettings();
|
||||
}
|
||||
|
||||
void KDecorationPreviewOptions::setCustomTitleButtons(const QString &left, const QString &right)
|
||||
void KDecorationPreviewOptions::setCustomTitleButtons(const QList<DecorationButton> &left, const QList<DecorationButton> &right)
|
||||
{
|
||||
customTitleButtonsLeft = left;
|
||||
customTitleButtonsRight = right;
|
||||
|
|
|
@ -182,14 +182,14 @@ public:
|
|||
|
||||
void setCustomBorderSize(BorderSize size);
|
||||
void setCustomTitleButtonsEnabled(bool enabled);
|
||||
void setCustomTitleButtons(const QString &left, const QString &right);
|
||||
void setCustomTitleButtons(const QList<DecorationButton> &left, const QList<DecorationButton> &right);
|
||||
|
||||
private:
|
||||
BorderSize customBorderSize;
|
||||
bool customButtonsChanged;
|
||||
bool customButtons;
|
||||
QString customTitleButtonsLeft;
|
||||
QString customTitleButtonsRight;
|
||||
QList<DecorationButton> customTitleButtonsLeft;
|
||||
QList<DecorationButton> customTitleButtonsRight;
|
||||
};
|
||||
|
||||
class KDecorationPreviewPlugins
|
||||
|
|
Loading…
Reference in a new issue