Skip to content

Commit

Permalink
fix high dpi in mac
Browse files Browse the repository at this point in the history
* fix enabling high dpi before QcoreApplication
* fix plist for correct high resolution handling, PLayground keep low resolution because in make problem to click robot butons inside the simulator
  • Loading branch information
Michael Bonani authored Jan 20, 2021
1 parent 62a37a2 commit 121363e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion aseba/launcher/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ int main(int argc, char** argv) {
QQmlDebuggingEnabler enabler;
#endif

QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
// Ensure a single instance
QtSingleApplication app(argc, argv);

Expand Down Expand Up @@ -78,7 +79,6 @@ int main(int argc, char** argv) {
mobsya::ThymioDevicesModel model(client);

QApplication::setWindowIcon(QIcon(":/assets/thymio-launcher.ico"));
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

auto load_trads = [](const QString& name, const QString& dir) {
QTranslator* translator = new QTranslator(qApp);
Expand Down
31 changes: 30 additions & 1 deletion osx/createbundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,36 @@ cp -R "${BUILD_DIR}/AsebaStudio.app" "$APPS_DIR/"
cp -R "${BUILD_DIR}/AsebaPlayground.app" "$APPS_DIR/"
cp -R "${BUILD_DIR}/ThymioVPLClassic.app" "$APPS_DIR/"

for app in "AsebaStudio" "AsebaPlayground" "ThymioVPLClassic"
for app in "AsebaStudio" "ThymioVPLClassic"
do
cp -r "${BUILD_DIR}/$app.app" "$APPS_DIR/"
defaults write $(realpath "$APPS_DIR/$app.app/Contents/Info.plist") NSPrincipalClass -string NSApplication
defaults write $(realpath "$APPS_DIR/$app.app/Contents/Info.plist") NSHighResolutionCapable -string True
add_to_group $(realpath "$APPS_DIR/$app.app/Contents/Info.plist")

plutil -replace CFBundleURLTypes -xml "
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLName</key>
<string>org.mobsy.CustomURLScheme</string>
<key>CFBundleURLSchemes</key>
<array>
<string>mobsya</string>
</array>
</dict>
</array>
" $(realpath "$APPS_DIR/$app.app/Contents/Info.plist")



defaults read $(realpath "$APPS_DIR/$app.app/Contents/Info.plist")
chmod 644 $(realpath "$APPS_DIR/$app.app/Contents/Info.plist")

done

for app in "AsebaPlayground"
do
cp -r "${BUILD_DIR}/$app.app" "$APPS_DIR/"
defaults write $(realpath "$APPS_DIR/$app.app/Contents/Info.plist") NSPrincipalClass -string NSApplication
Expand Down

0 comments on commit 121363e

Please sign in to comment.