Skip to content

Commit

Permalink
Disable incompatible features for the Mac App Store version
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime Gervais <[email protected]>
  • Loading branch information
g-maxime committed Jan 4, 2025
1 parent 9826192 commit 3d19987
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 71 deletions.
69 changes: 3 additions & 66 deletions Project/Mac/Make_xcarchive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,70 +5,7 @@ TEAMID=$4

SIGNATURE="MediaArea.net"

DATE=$(date -u +'%s')
cp -r ../QtCreator/qctools-gui/build/$APPNAME.app . || exit 1

cp -r ../QtCreator/qctools-gui/$APPNAME.app . || exit 1

macdeployqt $APPNAME.app -no-strip -appstore-compliant
rm -rf $APPNAME.app/Contents/PlugIns/sqldrivers/{libqsqlmysql.dylib,libqsqlodbc.dylib,libqsqlpsql.dylib}

dsymutil $APPNAME.app/Contents/MacOS/$APPNAME -o $APPNAME.app.dSYM

for FRAMEWORK in $(ls $APPNAME.app/Contents/Frameworks | grep framework | sed 's/\.framework//') ; do
pushd $APPNAME.app/Contents/Frameworks/$FRAMEWORK.framework

rm -fr _CodeSignature
rm -fr Versions/5/_CodeSignature
plutil -replace CFBundleIdentifier -string "$BUNDLEID" Resources/Info.plist
popd

# codesign --force --verbose --sign "3rd Party Mac Developer Application: $SIGNATURE" -i $BUNDLEID $APPNAME.app/Contents/Frameworks/$FRAMEWORK.framework/Versions/5/$FRAMEWORK
done

#find $APPNAME.app/Contents/PlugIns -name "*.dylib" -exec codesign --force --verbose --sign "3rd Party Mac Developer Application: $SIGNATURE" -i $BUNDLEID '{}' \;

codesign --deep --force --verbose --sign "3rd Party Mac Developer Application: $SIGNATURE" --entitlements $APPNAME.entitlements $APPNAME.app

productbuild --component $APPNAME.app /Applications --sign "3rd Party Mac Developer Installer: $SIGNATURE" $APPNAME-$VERSION.pkg

rm -fr $APPNAME.xcarchive
mkdir -p $APPNAME.xcarchive{/Products/Applications,/dSYMs}
mv $APPNAME.app.dSYM $APPNAME.xcarchive/dSYMs
mv $APPNAME.app $APPNAME.xcarchive/Products/Applications

cat > $APPNAME.xcarchive/Info.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ApplicationProperties</key>
<dict>
<key>ApplicationPath</key>
<string>Applications/$APPNAME.app</string>
<key>CFBundleIdentifier</key>
<string>$BUNDLEID</string>
<key>CFBundleShortVersionString</key>
<string>$VERSION</string>
<key>CFBundleVersion</key>
<string>1.4</string>
<key>IconPaths</key>
<array>
<string>Applications/$APPNAME.app/Contents/Resources/Logo.icns</string>
</array>
<key>SigningIdentity</key>
<string>3rd Party Mac Developer Application: $SIGNATURE ($TEAMID)</string>
</dict>
<key>ArchiveVersion</key>
<integer>2</integer>
<key>CreationDate</key>
<date>$(date -u -j -f '%s' +'%Y-%m-%dT%H:%M:%SZ' $DATE)</date>
<key>Name</key>
<string>$APPNAME</string>
<key>SchemeName</key>
<string>$APPNAME</string>
</dict>
</plist>
EOF

mkdir -p $HOME/Library/Developer/Xcode/Archives/$(date -u -j -f '%s' +'%Y-%m-%d' $DATE)
cp -a $APPNAME.xcarchive $HOME/Library/Developer/Xcode/Archives/$(date -u -j -f '%s' +'%Y-%m-%d' $DATE)/"$APPNAME $(date -u -j -f '%s' +'%d-%m-%Y %H.%M' $DATE).xcarchive"
codesign --force --deep --verbose --sign "Apple Distribution: $SIGNATURE" --entitlements "$APPNAME.entitlements" "$APPNAME.app"
productbuild --component "$APPNAME.app" /Applications --sign "3rd Party Mac Developer Installer: $SIGNATURE" "$APPNAME-$VERSION.pkg"
6 changes: 6 additions & 0 deletions Project/QtCreator/QCTools.pro
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ USE_BREW = $$(USE_BREW)
DEFINES += USE_BREW
}

macx {
contains(MACSTORE, yes|1) {
DEFINES += MACSTORE
}
}

include(ffmpeg.pri)

contains(DEFINES, USE_BREW) {
Expand Down
26 changes: 21 additions & 5 deletions Source/GUI/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,14 @@ void MainWindow::on_actionFilesList_triggered()
ui->menuLegacy_outputs->setVisible(false);
if (ui->actionExport_XmlGz_Prompt)
ui->actionExport_XmlGz_Prompt->setVisible(false);
if (ui->actionExport_XmlGz_Sidecar)
ui->actionExport_XmlGz_Sidecar->setVisible(false);
if (ui->actionExport_Mkv_Prompt)
ui->actionExport_Mkv_Prompt->setVisible(false);
#ifndef MACSTORE
if (ui->actionExport_XmlGz_Sidecar)
ui->actionExport_XmlGz_Sidecar->setVisible(false);
if (ui->actionExport_Mkv_Sidecar)
ui->actionExport_Mkv_Sidecar->setVisible(false);
#endif // !MACSTORE
if (ui->actionExport_Mkv_QCvault)
ui->actionExport_Mkv_QCvault->setVisible(false);
if (ui->actionPrint)
Expand Down Expand Up @@ -436,12 +438,14 @@ void MainWindow::on_actionGraphsLayout_triggered()
ui->actionGoTo->setVisible(true);
if (ui->actionExport_XmlGz_Prompt)
ui->actionExport_XmlGz_Prompt->setVisible(true);
if (ui->actionExport_XmlGz_Sidecar)
ui->actionExport_XmlGz_Sidecar->setVisible(true);
if (ui->actionExport_Mkv_Prompt)
ui->actionExport_Mkv_Prompt->setVisible(true);
#ifndef MACSTORE
if (ui->actionExport_XmlGz_Sidecar)
ui->actionExport_XmlGz_Sidecar->setVisible(true);
if (ui->actionExport_Mkv_Sidecar)
ui->actionExport_Mkv_Sidecar->setVisible(true);
#endif // !MACSTORE
//if (ui->actionPrint)
// ui->actionPrint->setVisible(true);
if (ui->actionZoomIn)
Expand Down Expand Up @@ -823,12 +827,18 @@ void MainWindow::updateExportActions()
exportEnabled = hasStats || parsed;
}
ui->actionExport_XmlGz_Prompt->setEnabled(exportEnabled);
ui->actionExport_XmlGz_Sidecar->setEnabled(exportEnabled);
ui->actionExport_Mkv_Prompt->setEnabled(exportEnabled);
#ifndef MACSTORE
ui->actionExport_XmlGz_Sidecar->setEnabled(exportEnabled);
ui->actionExport_Mkv_Sidecar->setEnabled(exportEnabled);
#endif // !MACSTORE
ui->actionExport_Mkv_QCvault->setEnabled(exportEnabled);

#ifndef MACSTORE
ui->menuLegacy_outputs->setEnabled(ui->actionExport_XmlGz_Prompt->isEnabled() || ui->actionExport_XmlGz_Sidecar->isEnabled() || ui->actionExport_XmlGz_SidecarAll->isEnabled());
#else
ui->menuLegacy_outputs->setEnabled(ui->actionExport_XmlGz_Prompt->isEnabled());
#endif // !MACSTORE
}

void MainWindow::updateExportAllAction()
Expand All @@ -842,11 +852,17 @@ void MainWindow::updateExportAllAction()
}
}

#ifndef MACSTORE
ui->actionExport_XmlGz_SidecarAll->setEnabled(allParsedOrHaveStats);
ui->actionExport_Mkv_SidecarAll->setEnabled(allParsedOrHaveStats);
#endif // !MACSTORE
ui->actionExport_Mkv_QCvaultAll->setEnabled(allParsedOrHaveStats);

#ifndef MACSTORE
ui->menuLegacy_outputs->setEnabled(ui->actionExport_XmlGz_Prompt->isEnabled() || ui->actionExport_XmlGz_Sidecar->isEnabled() || ui->actionExport_XmlGz_SidecarAll->isEnabled());
#else
ui->menuLegacy_outputs->setEnabled(ui->actionExport_XmlGz_Prompt->isEnabled());
#endif // !MACSTORE
}

void MainWindow::showPlayer()
Expand Down
17 changes: 17 additions & 0 deletions Source/GUI/mainwindow_Ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,19 @@ void MainWindow::Ui_Init()
// Drag n drop
setAcceptDrops(true);

#ifdef MACSTORE
if (ui->actionExport_XmlGz_Sidecar)
ui->actionExport_XmlGz_Sidecar->setVisible(false);
if (ui->actionExport_Mkv_Prompt)
ui->actionExport_Mkv_Prompt->setVisible(false);
if (ui->actionExport_Mkv_Sidecar)
ui->actionExport_Mkv_Sidecar->setVisible(false);
if (ui->actionExport_XmlGz_SidecarAll)
ui->actionExport_XmlGz_SidecarAll->setVisible(false);
if (ui->actionExport_Mkv_SidecarAll)
ui->actionExport_Mkv_SidecarAll->setVisible(false);
#endif // MACSTORE

// Icons
ui->actionOpen->setIcon(QIcon(":/icon/document-open.png"));
ui->actionExport_XmlGz_Prompt->setIcon(QIcon(":/icon/export_xml.png"));
Expand Down Expand Up @@ -411,7 +424,9 @@ void MainWindow::configureZoom()

ui->actionGoTo->setEnabled(!Files.empty());
ui->actionExport_XmlGz_Prompt->setEnabled(!Files.empty());
#ifndef MACSTORE
ui->actionExport_XmlGz_Sidecar->setEnabled(!Files.empty());
#endif // !MACSTORE
//ui->actionPrint->setEnabled(!Files.empty());
return;
}
Expand All @@ -421,7 +436,9 @@ void MainWindow::configureZoom()
ui->actionZoomIn->setEnabled( isPlotZoomable() );
ui->actionGoTo->setEnabled(true);
ui->actionExport_XmlGz_Prompt->setEnabled(true);
#ifndef MACSTORE
ui->actionExport_XmlGz_Sidecar->setEnabled(true);
#endif // !MACSTORE
//ui->actionPrint->setEnabled(true);
}

Expand Down

0 comments on commit 3d19987

Please sign in to comment.