diff options
Diffstat (limited to 'src/widgetinfo.cpp')
-rw-r--r-- | src/widgetinfo.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/widgetinfo.cpp b/src/widgetinfo.cpp index d23da8f..f7b766c 100644 --- a/src/widgetinfo.cpp +++ b/src/widgetinfo.cpp @@ -1,3 +1,5 @@ +#include <QtCore/QRegularExpression> + #include "widgetinfo.h" struct WidgetInfoData : public QSharedData @@ -48,6 +50,22 @@ void WidgetInfo::setUrl(const QUrl &url) d->url = url; } +int WidgetInfo::builtinClockfaceId() const +{ + QString file = d->url.toLocalFile(); + if (file.isEmpty()) return -1; + + + // I'm definitely evil: + static const QRegularExpression re("qml/watch/faces/builtinface([0-9]+).qml$"); + QRegularExpressionMatch match = re.match(file); + if (match.hasMatch()) { + return match.captured(1).toInt(); + } else { + return -1; + } +} + QString WidgetInfo::description() const { return d->desc; |