fix macos build, remove NSPopover, update app icon.icns

This commit is contained in:
uncor3
2025-11-15 20:59:57 -08:00
parent 4862289a29
commit c95dab2881
6 changed files with 95 additions and 69 deletions
+34 -20
View File
@@ -159,7 +159,6 @@ jobs:
"libgstosxaudio"
"libgstplayback"
"libgstvolume"
"libgstfaad"
)
for plugin in "${PLUGINS[@]}"; do
@@ -168,32 +167,47 @@ jobs:
cp "$(brew --prefix gstreamer)/libexec/gstreamer-1.0/gst-plugin-scanner" "build/iDescriptor.app/Contents/Frameworks/"
# Bundle FFmpeg libraries
FFMPEG_LIBS=(
"libavcodec.61.dylib"
"libavformat.61.dylib"
"libavutil.59.dylib"
"libswresample.5.dylib"
"libswscale.8.dylib"
"libavfilter.11.dylib"
)
for lib in "${FFMPEG_LIBS[@]}"; do
if [ -f "$(brew --prefix ffmpeg)/lib/${lib}" ]; then
cp "$(brew --prefix ffmpeg)/lib/${lib}" build/iDescriptor.app/Contents/Frameworks/
install_name_tool -id "@rpath/${lib}" "build/iDescriptor.app/Contents/Frameworks/${lib}"
else
echo "Warning: ${lib} not found"
fi
done
# Bundle libjxl_cms
cp "$(brew --prefix)/lib/libjxl_cms.0.11.dylib" build/iDescriptor.app/Contents/Frameworks/
install_name_tool -id "@rpath/libjxl_cms.0.11.dylib" build/iDescriptor.app/Contents/Frameworks/libjxl_cms.0.11.dylib
install_name_tool -change "$(brew --prefix)/lib/libjxl_cms.0.11.dylib" "@rpath/libjxl_cms.0.11.dylib" build/iDescriptor.app/Contents/Frameworks/libjxl.0.11.dylib
# Add rpath to main executable
install_name_tool -add_rpath "@executable_path/../Frameworks" build/iDescriptor.app/Contents/MacOS/iDescriptor
# Fix GStreamer library paths
FRAMEWORKS_DIR="build/iDescriptor.app/Contents/Frameworks"
BREW_PREFIX="$(brew --prefix)"
# For some reason libavfilter sometimes doesnt get copied by macdeployqt
FFMPEG_LIB_DIR="$(brew --prefix ffmpeg)/lib"
cp ${FFMPEG_LIB_DIR}/libavfilter.11.dylib "${FRAMEWORKS_DIR}/"
# Fix dependencies in all GStreamer plugins
for plugin in "${GST_PLUGIN_DIR}"/*.dylib; do
echo "Fixing plugin: $(basename ${plugin})"
# Get all dependencies and fix them
otool -L "${plugin}" | grep -E "${BREW_PREFIX}" | awk '{print $1}' | while read dep; do
depname=$(basename "${dep}")
echo " Changing ${depname}"
install_name_tool -change "${dep}" "@rpath/${depname}" "${plugin}" 2>/dev/null || true
done
done
# Fix dependencies in GStreamer core libraries themselves
for lib in "${FRAMEWORKS_DIR}"/libgst*.dylib "${FRAMEWORKS_DIR}"/libglib*.dylib "${FRAMEWORKS_DIR}"/libgobject*.dylib "${FRAMEWORKS_DIR}"/libgmodule*.dylib "${FRAMEWORKS_DIR}"/libgio*.dylib "${FRAMEWORKS_DIR}"/libgthread*.dylib; do
if [ -f "${lib}" ]; then
echo "Fixing library: $(basename ${lib})"
otool -L "${lib}" | grep -E "${BREW_PREFIX}" | awk '{print $1}' | while read dep; do
depname=$(basename "${dep}")
echo " Changing ${depname}"
install_name_tool -change "${dep}" "@rpath/${depname}" "${lib}" 2>/dev/null || true
done
fi
done
- name: Create DMG
run: |
create-dmg \
Binary file not shown.
+37 -37
View File
@@ -95,30 +95,32 @@ void DiskUsageWidget::setupUI()
m_diskBarLayout->setContentsMargins(0, 0, 0, 0);
m_diskBarLayout->setSpacing(0);
// Create colored segments
#ifdef Q_OS_MAC
m_systemBar = new DiskUsageBar();
m_appsBar = new DiskUsageBar();
m_mediaBar = new DiskUsageBar();
m_othersBar = new DiskUsageBar();
m_freeBar = new DiskUsageBar();
/*
FIXME: There is bug with qt, related to NSPopover on macOS
need to revisit this when we find a fix
*/
// #ifdef Q_OS_MAC
// m_systemBar = new DiskUsageBar();
// m_appsBar = new DiskUsageBar();
// m_mediaBar = new DiskUsageBar();
// m_othersBar = new DiskUsageBar();
// m_freeBar = new DiskUsageBar();
m_systemBar->setStyleSheet(
" background-color: #a1384d; border: 1px solid"
"#e64a5b; padding: 0; margin: 0; border-top-left-radius: 3px; "
"border-bottom-left-radius: 3px; ");
m_appsBar->setStyleSheet("background-color: #4f869f; border: 1px solid "
"#63b4da; padding: 0; margin: 0; ");
m_mediaBar->setStyleSheet("background-color: #2ECC71; "
"border: none; padding: 0; margin: 0; ");
m_othersBar->setStyleSheet("background-color: #a28729; border: 1px solid "
"#c4a32d; padding: 0; margin: 0; ");
m_freeBar->setStyleSheet(
"background-color: #6e6d6d; border: 1px solid "
"#4f4f4f; padding: 0; margin: 0; border-top-right-radius: 3px; "
"border-bottom-right-radius: 3px; ");
// m_systemBar->setStyleSheet(
// " background-color: #a1384d; border: 1px solid"
// "#e64a5b; padding: 0; margin: 0; border-top-left-radius: 3px; "
// "border-bottom-left-radius: 3px; ");
// m_appsBar->setStyleSheet("background-color: #4f869f; border: 1px solid "
// "#63b4da; padding: 0; margin: 0; ");
// m_mediaBar->setStyleSheet("background-color: #2ECC71; "
// "border: none; padding: 0; margin: 0; ");
// m_othersBar->setStyleSheet("background-color: #a28729; border: 1px solid "
// "#c4a32d; padding: 0; margin: 0; ");
// m_freeBar->setStyleSheet(
// "background-color: #6e6d6d; border: 1px solid "
// "#4f4f4f; padding: 0; margin: 0; border-top-right-radius: 3px; "
// "border-bottom-right-radius: 3px; ");
#else
m_systemBar = new QWidget();
m_appsBar = new QWidget();
m_mediaBar = new QWidget();
@@ -154,7 +156,6 @@ void DiskUsageWidget::setupUI()
m_mediaBar->setContentsMargins(0, 0, 0, 0);
m_othersBar->setContentsMargins(0, 0, 0, 0);
m_freeBar->setContentsMargins(0, 0, 0, 0);
#endif
m_diskBarLayout->addWidget(m_systemBar);
m_diskBarLayout->addWidget(m_appsBar);
@@ -317,19 +318,19 @@ void DiskUsageWidget::updateUI()
m_diskBarLayout->setStretchFactor(m_othersBar, othersStretch);
m_diskBarLayout->setStretchFactor(m_freeBar, freeStretch);
// Set usage info for popovers
#ifdef Q_OS_MAC
m_systemBar->setUsageInfo("System", formatSize(m_systemUsage), "#a1384d",
(double)m_systemUsage / m_totalCapacity);
m_appsBar->setUsageInfo("Apps", formatSize(m_appsUsage), "#3498DB",
(double)m_appsUsage / m_totalCapacity);
m_mediaBar->setUsageInfo("Media", formatSize(m_mediaUsage), "#2ECC71",
(double)m_mediaUsage / m_totalCapacity);
m_othersBar->setUsageInfo("Others", formatSize(m_othersUsage), "#F39C12",
(double)m_othersUsage / m_totalCapacity);
m_freeBar->setUsageInfo("Free", formatSize(m_freeSpace), "#BDC3C7",
(double)m_freeSpace / m_totalCapacity);
#else
/* FIXME: NSPopover bug */
// #ifdef Q_OS_MAC
// m_systemBar->setUsageInfo("System", formatSize(m_systemUsage), "#a1384d",
// (double)m_systemUsage / m_totalCapacity);
// m_appsBar->setUsageInfo("Apps", formatSize(m_appsUsage), "#3498DB",
// (double)m_appsUsage / m_totalCapacity);
// m_mediaBar->setUsageInfo("Media", formatSize(m_mediaUsage), "#2ECC71",
// (double)m_mediaUsage / m_totalCapacity);
// m_othersBar->setUsageInfo("Others", formatSize(m_othersUsage), "#F39C12",
// (double)m_othersUsage / m_totalCapacity);
// m_freeBar->setUsageInfo("Free", formatSize(m_freeSpace), "#BDC3C7",
// (double)m_freeSpace / m_totalCapacity);
// #else
m_systemBar->setToolTip(
QString("System: %1 (%2%)")
.arg(formatSize(m_systemUsage))
@@ -356,7 +357,6 @@ void DiskUsageWidget::updateUI()
.arg(QString::number((double)m_freeSpace / m_totalCapacity * 100,
'f', 1)));
#endif
// Hide segments with zero usage
// m_systemBar->setVisible(m_systemUsage > 0);
+9 -8
View File
@@ -65,19 +65,20 @@ private:
QVBoxLayout *m_dataLayout;
QWidget *m_diskBarContainer;
QHBoxLayout *m_diskBarLayout;
#ifdef Q_OS_MAC
DiskUsageBar *m_systemBar;
DiskUsageBar *m_appsBar;
DiskUsageBar *m_mediaBar;
DiskUsageBar *m_othersBar;
DiskUsageBar *m_freeBar;
#else
/*FIXME: NSPopover bug */
// #ifdef Q_OS_MAC
// DiskUsageBar *m_systemBar;
// DiskUsageBar *m_appsBar;
// DiskUsageBar *m_mediaBar;
// DiskUsageBar *m_othersBar;
// DiskUsageBar *m_freeBar;
// #else
QWidget *m_systemBar;
QWidget *m_appsBar;
QWidget *m_mediaBar;
QWidget *m_othersBar;
QWidget *m_freeBar;
#endif
// #endif
QHBoxLayout *m_legendLayout;
QLabel *m_systemLabel;
+2 -2
View File
@@ -62,9 +62,9 @@ int main(int argc, char *argv[])
QString gstPluginScannerPath =
QDir::toNativeSeparators(frameworksPath + "/gst-plugin-scanner");
qputenv("DYLD_LIBRARY_PATH", frameworksPath.toUtf8());
qputenv("GST_PLUGIN_PATH", gstPluginPath.toUtf8());
qputenv("GST_PLUGIN_SYSTEM_PATH", gstPluginPath.toUtf8());
qputenv("GST_PLUGIN_SCANNER_1_0", gstPluginScannerPath.toUtf8());
qputenv("GST_PLUGIN_SYSTEM_PATH_1_0", gstPluginPath.toUtf8());
#endif
QCoreApplication::setOrganizationName("iDescriptor");
// QCoreApplication::setOrganizationDomain("iDescriptor.com");
+13 -2
View File
@@ -3,7 +3,18 @@
#include <QDebug>
#include <QMainWindow>
void setupMacOSWindow(QMainWindow *window)
void setupMacOSWindow(QMainWindow *window) {
window->setUnifiedTitleAndToolBarOnMac(true);
NSView* nativeView = reinterpret_cast<NSView*>(window->winId());
NSWindow* nativeWindow = [nativeView window];
[nativeWindow setStyleMask:[nativeWindow styleMask] | NSWindowStyleMaskFullSizeContentView | NSWindowTitleHidden];
[nativeWindow setTitlebarAppearsTransparent:YES];
[nativeWindow center];
}
// TODO:remove
void setupMacOSWindowOLD(QMainWindow *window)
{
if (!window) {
@@ -18,7 +29,7 @@ void setupMacOSWindow(QMainWindow *window)
qWarning() << "setupMacOSWindow: native window is null";
return;
}
// TODO: implement theme switching from app settings
// // Force dark mode
// nsWindow.overrideUserInterfaceStyle = NSUserInterfaceStyleDark;