-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
72 changed files
with
405 additions
and
532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 Nick Korotysh <[email protected]> | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
#include "appearance_base.hpp" | ||
|
||
#include <QFile> | ||
|
||
QBrush AppearanceSectionBase::getTexture() const | ||
{ | ||
switch (getTextureType()) { | ||
case None: | ||
return Qt::NoBrush; | ||
case SolidColor: | ||
return getTextureColor(); | ||
case Gradient: | ||
return getTextureGradient(); | ||
case Pattern: | ||
return getTexturePattern(); | ||
} | ||
Q_UNREACHABLE(); | ||
return Qt::NoBrush; | ||
} | ||
|
||
QPixmap AppearanceSectionBase::getTexturePattern() const | ||
{ | ||
if (QFile::exists(getTexturePatternFile())) | ||
return QPixmap(getTexturePatternFile()); | ||
return sample_pattern(); | ||
} | ||
|
||
QBrush AppearanceSectionBase::getBackground() const | ||
{ | ||
switch (getBackgroundType()) { | ||
case None: | ||
return Qt::NoBrush; | ||
case SolidColor: | ||
return getBackgroundColor(); | ||
case Gradient: | ||
return getBackgroundGradient(); | ||
case Pattern: | ||
return getBackgroundPattern(); | ||
} | ||
Q_UNREACHABLE(); | ||
return Qt::NoBrush; | ||
} | ||
|
||
QPixmap AppearanceSectionBase::getBackgroundPattern() const | ||
{ | ||
if (QFile::exists(getBackgroundPatternFile())) | ||
return QPixmap(getBackgroundPatternFile()); | ||
return sample_pattern(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 Nick Korotysh <[email protected]> | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "settings_storage.hpp" | ||
|
||
#include <QtCore/qtmetamacros.h> | ||
|
||
#include "custom_converters.hpp" | ||
#include "sample_brushes.hpp" | ||
|
||
class CLOCK_COMMON_EXPORT AppearanceSectionBase : public SettingsStorageClient { | ||
Q_GADGET | ||
public: | ||
enum CustomizationType { | ||
None, | ||
SolidColor, | ||
Gradient, | ||
Pattern, | ||
}; | ||
Q_ENUM(CustomizationType) | ||
|
||
using SettingsStorageClient::SettingsStorageClient; | ||
|
||
QBrush getTexture() const; | ||
CONFIG_OPTION_Q(CustomizationType, TextureType, SolidColor) | ||
CONFIG_OPTION_Q(QColor, TextureColor, QColor(112, 96, 240)) | ||
CONFIG_OPTION_Q(QGradient, TextureGradient, sample_conical_gradient()) | ||
QPixmap getTexturePattern() const; | ||
CONFIG_OPTION_Q(QString, TexturePatternFile, QString()) | ||
CONFIG_OPTION_Q(bool, TextureStretch, false) | ||
CONFIG_OPTION_Q(bool, TexturePerCharacter, true) | ||
|
||
QBrush getBackground() const; | ||
CONFIG_OPTION_Q(CustomizationType, BackgroundType, None) | ||
CONFIG_OPTION_Q(QColor, BackgroundColor, QColor(0, 0, 0, 160)) | ||
CONFIG_OPTION_Q(QGradient, BackgroundGradient, sample_linear_gradient()) | ||
QPixmap getBackgroundPattern() const; | ||
CONFIG_OPTION_Q(QString, BackgroundPatternFile, QString()) | ||
CONFIG_OPTION_Q(bool, BackgroundStretch, false) | ||
CONFIG_OPTION_Q(bool, BackgroundPerCharacter, false) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.