1 Commits

Author SHA1 Message Date
7cdaa4072c feat: macOS bundle support 2024-12-03 00:21:21 +08:00
5 changed files with 3 additions and 22 deletions

View File

@ -13,7 +13,6 @@ jobs:
uses: jurplel/install-qt-action@v4
with:
version: '6.8.1'
modules: 'qtimageformats'
- name: Run a qt project
run: |
cmake . -Bbuild

View File

@ -212,7 +212,7 @@ elseif (APPLE)
# See https://cmake.org/cmake/help/v3.15/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.html
set_target_properties(${EXE_NAME} PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/dist/MacOSXBundleInfo.plist.in
MACOSX_BUNDLE_INFO_PLIST dist/MacOSXBundleInfo.plist.in
MACOSX_BUNDLE_BUNDLE_NAME "Pineapple Pictures"
MACOSX_BUNDLE_GUI_IDENTIFIER net.blumia.pineapple-pictures
MACOSX_BUNDLE_ICON_FILE app-icon.icns # contains the .icns file name, *without* the path.

View File

@ -160,10 +160,6 @@ MainWindow::MainWindow(QWidget *parent)
installResizeCapture(m_graphicsView->viewport());
installResizeCapture(m_gv);
installResizeCapture(m_gv->viewport());
#ifdef Q_OS_MACOS
qApp->installEventFilter(this);
#endif // Q_OS_MACOS
}
MainWindow::~MainWindow()
@ -657,19 +653,6 @@ QSize MainWindow::sizeHint() const
return QSize(710, 530);
}
#ifdef Q_OS_MACOS
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
Q_UNUSED(obj);
if (event->type() == QEvent::FileOpen) {
QFileOpenEvent *fileOpenEvent = static_cast<QFileOpenEvent *>(event);
showUrls({fileOpenEvent->url()});
return true;
}
return false;
}
#endif // Q_OS_MACOS
void MainWindow::on_actionOpen_triggered()
{
QStringList picturesLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);

View File

@ -77,9 +77,6 @@ protected slots:
protected:
QSize sizeHint() const override;
#ifdef Q_OS_MACOS
bool eventFilter(QObject *obj, QEvent *event) override;
#endif // Q_OS_MACOS
private slots:
void on_actionOpen_triggered();

View File

@ -30,6 +30,8 @@
<true/>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
</dict>
<dict>
<key>CFBundleDocumentTypes</key>
<array>
<!-- JPEG -->