-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
22 changed files
with
1,050 additions
and
603 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Fooyin | ||
* Copyright © 2024, Luke Taylor <LukeT1@proton.me> | ||
* | ||
* Fooyin 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 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Fooyin 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 Fooyin. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <QFont> | ||
#include <QColor> | ||
|
||
namespace Fooyin { | ||
struct RichFormatting | ||
{ | ||
QFont font; | ||
QColor colour; | ||
|
||
bool operator==(const RichFormatting& other) const | ||
{ | ||
return std::tie(font, colour) == std::tie(other.font, other.colour); | ||
}; | ||
}; | ||
|
||
struct RichTextBlock | ||
{ | ||
QString text; | ||
RichFormatting format; | ||
|
||
bool operator==(const RichTextBlock& other) const | ||
{ | ||
return std::tie(text, format) == std::tie(other.text, other.format); | ||
}; | ||
}; | ||
using RichText = std::vector<RichTextBlock>; | ||
|
||
struct RichScript | ||
{ | ||
QString script; | ||
RichText text; | ||
|
||
bool operator==(const RichScript& other) const | ||
{ | ||
return std::tie(script, text) == std::tie(other.script, other.text); | ||
}; | ||
|
||
friend QDataStream& operator<<(QDataStream& stream, const RichScript& richScript) | ||
{ | ||
stream << richScript.script; | ||
return stream; | ||
} | ||
|
||
friend QDataStream& operator>>(QDataStream& stream, RichScript& richScript) | ||
{ | ||
stream >> richScript.script; | ||
return stream; | ||
} | ||
}; | ||
} // namespace Fooyin |
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,44 @@ | ||
/* | ||
* Fooyin | ||
* Copyright © 2024, Luke Taylor <LukeT1@proton.me> | ||
* | ||
* Fooyin 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 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Fooyin 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 Fooyin. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "fygui_export.h" | ||
|
||
#include <gui/scripting/richtext.h> | ||
|
||
#include <QColor> | ||
#include <QFont> | ||
|
||
namespace Fooyin { | ||
class ScriptFormatterRegistry; | ||
|
||
class FYGUI_EXPORT ScriptFormatter | ||
{ | ||
public: | ||
ScriptFormatter(); | ||
~ScriptFormatter(); | ||
|
||
RichText evaluate(const QString& input); | ||
|
||
private: | ||
struct Private; | ||
std::unique_ptr<Private> p; | ||
}; | ||
} // namespace Fooyin |
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,43 @@ | ||
/* | ||
* Fooyin | ||
* Copyright © 2024, Luke Taylor <LukeT1@proton.me> | ||
* | ||
* Fooyin 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 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Fooyin 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 Fooyin. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "fygui_export.h" | ||
|
||
#include <core/scripting/scriptregistry.h> | ||
#include <gui/scripting/richtext.h> | ||
|
||
namespace Fooyin { | ||
struct FormattedTextBlock; | ||
|
||
class FYGUI_EXPORT ScriptFormatterRegistry | ||
{ | ||
public: | ||
ScriptFormatterRegistry(); | ||
~ScriptFormatterRegistry(); | ||
|
||
bool isFormatFunc(const QString& option) const; | ||
void format(RichFormatting& formatting, const QString& func, const QString& option = {}) const; | ||
|
||
private: | ||
struct Private; | ||
std::unique_ptr<Private> p; | ||
}; | ||
} // namespace Fooyin |
Oops, something went wrong.