NOTE @letsfindaway obsolete
| 956 | |
| 957 | // NOTE @letsfindaway obsolete |
| 958 | UBGraphicsAppleWidgetItem::UBGraphicsAppleWidgetItem(const QUrl& pWidgetUrl, QGraphicsItem *parent) |
| 959 | : UBGraphicsWidgetItem(pWidgetUrl, parent) |
| 960 | { |
| 961 | QString path = pWidgetUrl.toLocalFile(); |
| 962 | |
| 963 | if (!path.endsWith(".wdgt") && !path.endsWith(".wdgt/")) { |
| 964 | int lastSlashIndex = path.lastIndexOf("/"); |
| 965 | if (lastSlashIndex > 0) |
| 966 | path = path.mid(0, lastSlashIndex + 1); |
| 967 | } |
| 968 | |
| 969 | QFile plistFile(path + "/Info.plist"); |
| 970 | plistFile.open(QFile::ReadOnly); |
| 971 | |
| 972 | QByteArray plistBin = plistFile.readAll(); |
| 973 | QString plist = QString::fromUtf8(plistBin); |
| 974 | |
| 975 | int mainHtmlIndex = plist.indexOf("MainHTML"); |
| 976 | int mainHtmlIndexStart = plist.indexOf("<string>", mainHtmlIndex); |
| 977 | int mainHtmlIndexEnd = plist.indexOf("</string>", mainHtmlIndexStart); |
| 978 | |
| 979 | if (mainHtmlIndex > -1 && mainHtmlIndexStart > -1 && mainHtmlIndexEnd > -1) |
| 980 | mMainHtmlFileName = plist.mid(mainHtmlIndexStart + 8, mainHtmlIndexEnd - mainHtmlIndexStart - 8); |
| 981 | |
| 982 | mMainHtmlUrl = pWidgetUrl; |
| 983 | mMainHtmlUrl.setPath(pWidgetUrl.path() + "/" + mMainHtmlFileName); |
| 984 | |
| 985 | mWebEngineView->load(mMainHtmlUrl); |
| 986 | |
| 987 | QPixmap defaultPixmap(pWidgetUrl.toLocalFile() + "/Default.png"); |
| 988 | |
| 989 | setMaximumSize(defaultPixmap.size()); |
| 990 | |
| 991 | mNominalSize = defaultPixmap.size(); |
| 992 | |
| 993 | initialize(); |
| 994 | } |
| 995 | |
| 996 | |
| 997 | UBGraphicsAppleWidgetItem::~UBGraphicsAppleWidgetItem() |
nothing calls this directly
no test coverage detected