Support for new decoration border sizes BorderNoSides and BorderNone

BorderNoSides is what is known from Oxygen as "No Side Borders". The name
should indicate that there is only a border at the bottom. BorderNone is
a mode with no borders at all.

The new enums are added to KDecoration and the KCM so that all decos can
make use of it.

Aurorae is adjusted to support the new sizes for QML themes (it breaks
the old svg based themes) and Plastik makes use of it, by rendering a
one-pixel border around the window, which illustrates that it's still up
to the decoration to decide how to make use of the setting.

REVIEW: 108164
This commit is contained in:
Martin Gräßlin 2013-01-04 14:02:44 +01:00
parent b7f06b8708
commit 6acae45205
6 changed files with 45 additions and 14 deletions

View file

@ -120,7 +120,9 @@ public:
BorderVeryLarge, ///< Very large borders
BorderHuge, ///< Huge borders
BorderVeryHuge, ///< Very huge borders
BorderOversized ///< Oversized borders
BorderOversized, ///< Oversized borders
BorderNoSides, ///< No borders on sides
BorderNone ///< No borders except title
};
explicit DecorationOptions(QObject *parent = 0);
virtual ~DecorationOptions();

View file

@ -31,35 +31,50 @@ Decoration {
root.extendedBorderBottom = 0;
root.extendedBorderLeft = 0;
}
function setBorderSize(value) {
root.borderLeft = value;
root.borderRight = value;
root.borderBottom = value;
}
function readConfig() {
switch (decoration.readConfig("BorderSize", DecorationOptions.BorderNormal)) {
case DecorationOptions.BorderTiny:
root.borderSize = 3;
enableExtendedBorders();
setBorderSize(3);
disableExtendedBorders();
break;
case DecorationOptions.BorderLarge:
root.borderSize = 8;
setBorderSize(8);
disableExtendedBorders();
break;
case DecorationOptions.BorderVeryLarge:
root.borderSize = 12;
setBorderSize(12);
disableExtendedBorders();
break;
case DecorationOptions.BorderHuge:
root.borderSize = 18;
setBorderSize(18);
disableExtendedBorders();
break;
case DecorationOptions.BorderVeryHuge:
root.borderSize = 27;
setBorderSize(27);
disableExtendedBorders();
break;
case DecorationOptions.BorderOversized:
root.borderSize = 40;
setBorderSize(40);
disableExtendedBorders();
break;
case DecorationOptions.BorderNoSides:
root.borderLeft = 1;
root.borderRight = 1;
root.borderBottom = 4;
enableExtendedBorders();
break;
case DecorationOptions.BorderNone:
setBorderSize(1);
enableExtendedBorders();
break;
case DecorationOptions.BorderNormal: // fall through to default
default:
root.borderSize = 4;
setBorderSize(4);
disableExtendedBorders();
break;
}
@ -99,12 +114,11 @@ Decoration {
duration: root.animationDuration
}
}
property int borderSize: 4
id: root
borderLeft: borderSize
borderRight: borderSize
borderLeft: 4
borderRight: 4
borderTop: top.normalHeight
borderBottom: borderSize
borderBottom: 4
borderLeftMaximized: 0
borderRightMaximized: 0
borderBottomMaximized: 0

View file

@ -35,7 +35,9 @@ static const char* const border_names[ KDecorationDefines::BordersCount ] = {
I18N_NOOP2("@item:inlistbox Border size:", "Very Large"),
I18N_NOOP2("@item:inlistbox Border size:", "Huge"),
I18N_NOOP2("@item:inlistbox Border size:", "Very Huge"),
I18N_NOOP2("@item:inlistbox Border size:", "Oversized")
I18N_NOOP2("@item:inlistbox Border size:", "Oversized"),
I18N_NOOP2("@item:inlistbox Border size:", "No Side Border"),
I18N_NOOP2("@item:inlistbox Border size:", "No Border"),
};
KWinAuroraeConfigForm::KWinAuroraeConfigForm(QWidget* parent)
@ -44,6 +46,15 @@ KWinAuroraeConfigForm::KWinAuroraeConfigForm(QWidget* parent)
setupUi(this);
}
void KWinAuroraeConfigForm::enableNoSideBorderSupport(bool enable)
{
if (!enable) {
return;
}
borderSizesCombo->addItem(i18nc("@item:inlistbox Border size:", border_names[KDecorationDefines::BorderBottom]));
borderSizesCombo->addItem(i18nc("@item:inlistbox Border size:", border_names[KDecorationDefines::BorderNone]));
}
KWinDecorationConfigForm::KWinDecorationConfigForm(QWidget* parent)
: QWidget(parent)
{

View file

@ -34,6 +34,7 @@ class KWinAuroraeConfigForm : public QWidget, public Ui::KWinAuroraeConfigForm
public:
explicit KWinAuroraeConfigForm(QWidget* parent);
void enableNoSideBorderSupport(bool enable);
};
class KWinDecorationConfigForm : public QWidget, public Ui::KWinDecorationConfigForm

View file

@ -377,6 +377,7 @@ void KWinDecorationModule::slotConfigureDecoration()
dlg->setCaption(i18n("Decoration Options"));
dlg->setButtons(KDialog::Ok | KDialog::Cancel);
KWinAuroraeConfigForm *form = new KWinAuroraeConfigForm(dlg);
form->enableNoSideBorderSupport(index.data(DecorationModel::TypeRole).toInt() == DecorationModelData::QmlDecoration);
dlg->setMainWidget(form);
form->borderSizesCombo->setCurrentIndex(index.data(DecorationModel::BorderSizeRole).toInt());
form->buttonSizesCombo->setCurrentIndex(index.data(DecorationModel::ButtonSizeRole).toInt());

View file

@ -176,6 +176,8 @@ public:
BorderHuge, ///< Huge borders
BorderVeryHuge, ///< Very huge borders
BorderOversized, ///< Oversized borders
BorderNoSides, ///< No borders on sides @since 4.11
BorderNone, ///< No borders except title @since 4.11
BordersCount ///< @internal
};