Do not use KDecorationDefines in Aurorae

This commit is contained in:
Martin Gräßlin 2014-12-02 10:31:16 +01:00
parent f5c305bf64
commit b9fb7df15a
3 changed files with 36 additions and 26 deletions

View file

@ -45,16 +45,16 @@ public:
Aurorae::ThemeConfig themeConfig;
QHash< AuroraeButtonType, QString > pathes;
bool activeCompositing;
KDecorationDefines::BorderSize borderSize;
KDecorationDefines::BorderSize buttonSize;
AuroraeTheme::BorderSize borderSize;
AuroraeTheme::BorderSize buttonSize;
QString dragMimeType;
QString decorationPath;
};
AuroraeThemePrivate::AuroraeThemePrivate()
:activeCompositing(true)
, borderSize(KDecoration::BorderNormal)
, buttonSize(KDecoration::BorderNormal)
, borderSize(AuroraeTheme::BorderNormal)
, buttonSize(AuroraeTheme::BorderNormal)
{
}
@ -106,8 +106,8 @@ void AuroraeTheme::loadTheme(const QString &name)
KConfig::FullConfig, QStandardPaths::GenericDataLocation);
KConfigGroup themeGroup(&conf, name);
loadTheme(name, config);
setBorderSize((KDecorationDefines::BorderSize)themeGroup.readEntry<int>("BorderSize", KDecorationDefines::BorderNormal));
setButtonSize((KDecorationDefines::BorderSize)themeGroup.readEntry<int>("ButtonSize", KDecorationDefines::BorderNormal));
setBorderSize((BorderSize)themeGroup.readEntry<int>("BorderSize", BorderNormal));
setButtonSize((BorderSize)themeGroup.readEntry<int>("ButtonSize", BorderNormal));
}
void AuroraeTheme::loadTheme(const QString &name, const KConfig &config)
@ -211,7 +211,7 @@ void AuroraeTheme::borders(int& left, int& top, int& right, int& bottom, bool ma
}
} else {
switch (d->borderSize) {
case KDecoration::BorderTiny:
case BorderTiny:
// TODO: this looks wrong
if (isCompositingActive()) {
left = qMin(0, (int)left - d->themeConfig.borderLeft() - d->themeConfig.paddingLeft());
@ -223,22 +223,22 @@ void AuroraeTheme::borders(int& left, int& top, int& right, int& bottom, bool ma
bottom = qMin(0, (int)bottom - d->themeConfig.borderBottom());
}
break;
case KDecoration::BorderLarge:
case BorderLarge:
left = right = bottom = top = 4;
break;
case KDecoration::BorderVeryLarge:
case BorderVeryLarge:
left = right = bottom = top = 8;
break;
case KDecoration::BorderHuge:
case BorderHuge:
left = right = bottom = top = 12;
break;
case KDecoration::BorderVeryHuge:
case BorderVeryHuge:
left = right = bottom = top = 23;
break;
case KDecoration::BorderOversized:
case BorderOversized:
left = right = bottom = top = 36;
break;
case KDecoration::BorderNormal:
case BorderNormal:
default:
left = right = bottom = top = 0;
}
@ -450,7 +450,7 @@ void AuroraeTheme::setCompositingActive(bool active)
d->activeCompositing = active;
}
void AuroraeTheme::setBorderSize(KDecorationDefines::BorderSize size)
void AuroraeTheme::setBorderSize(BorderSize size)
{
if (d->borderSize == size) {
return;
@ -459,7 +459,7 @@ void AuroraeTheme::setBorderSize(KDecorationDefines::BorderSize size)
emit borderSizesChanged();
}
void AuroraeTheme::setButtonSize(KDecorationDefines::BorderSize size)
void AuroraeTheme::setButtonSize(BorderSize size)
{
if (d->buttonSize == size) {
return;
@ -481,19 +481,19 @@ const QString &AuroraeTheme::tabDragMimeType() const
qreal AuroraeTheme::buttonSizeFactor() const
{
switch (d->buttonSize) {
case KDecorationDefines::BorderTiny:
case BorderTiny:
return 0.8;
case KDecorationDefines::BorderLarge:
case BorderLarge:
return 1.2;
case KDecorationDefines::BorderVeryLarge:
case BorderVeryLarge:
return 1.4;
case KDecorationDefines::BorderHuge:
case BorderHuge:
return 1.6;
case KDecorationDefines::BorderVeryHuge:
case BorderVeryHuge:
return 1.8;
case KDecorationDefines::BorderOversized:
case BorderOversized:
return 2.0;
case KDecorationDefines::BorderNormal: // fall through
case BorderNormal: // fall through
default:
return 1.0;
}

View file

@ -24,7 +24,6 @@
// #include "libaurorae_export.h"
#include <QObject>
#include <kdecoration.h>
#include <QLoggingCategory>
@ -114,6 +113,18 @@ class /*LIBAURORAE_EXPORT*/ AuroraeTheme : public QObject
Q_PROPERTY(Qt::Alignment horizontalAlignment READ alignment NOTIFY themeChanged)
Q_PROPERTY(Qt::Alignment verticalAlignment READ verticalAlignment NOTIFY themeChanged)
public:
enum BorderSize {
BorderTiny, ///< Minimal borders
BorderNormal, ///< Standard size borders, the default setting
BorderLarge, ///< Larger borders
BorderVeryLarge, ///< Very large borders
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
};
explicit AuroraeTheme(QObject* parent = nullptr);
virtual ~AuroraeTheme();
// TODO: KSharedConfigPtr
@ -183,13 +194,13 @@ public:
* @returns true if the theme contains a FrameSvg for specified button.
*/
bool hasButton(AuroraeButtonType button) const;
void setBorderSize(KDecorationDefines::BorderSize size);
void setBorderSize(BorderSize size);
/**
* Sets the size of the buttons.
* The available sizes are identical to border sizes, therefore BorderSize is used.
* @param size The buttons size
*/
void setButtonSize(KDecorationDefines::BorderSize size);
void setButtonSize(BorderSize size);
qreal buttonSizeFactor() const;
DecorationPosition decorationPosition() const;

View file

@ -15,7 +15,6 @@ 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 "themeconfig.h"
#include <kdecoration.h>
#include <KConfig>
#include <KConfigGroup>