Compare commits
7 Commits
2de9ff810d
...
macmenu
Author | SHA1 | Date | |
---|---|---|---|
9296faf0ff | |||
eb04ac362b | |||
6d7d0e4e1d | |||
ff4f71c1e6 | |||
101f111209 | |||
c227c74e23 | |||
32ff813609 |
20
.github/workflows/macos.yml
vendored
20
.github/workflows/macos.yml
vendored
@ -14,15 +14,25 @@ jobs:
|
||||
with:
|
||||
version: '6.8.1'
|
||||
modules: 'qtimageformats'
|
||||
- name: Run a qt project
|
||||
- name: Install Conan and Dependencies
|
||||
id: conan
|
||||
working-directory: ./
|
||||
shell: bash
|
||||
run: |
|
||||
cmake . -Bbuild -DTRANSLATION_RESOURCE_EMBEDDING=ON
|
||||
cmake --build build
|
||||
pip3 install wheel setuptools
|
||||
pip3 install conan --upgrade
|
||||
conan --version
|
||||
conan profile detect
|
||||
conan install --requires=exiv2/0.28.3 --generator CMakeDeps --generator CMakeToolchain --build=missing
|
||||
- name: Build
|
||||
run: |
|
||||
cmake . -DTRANSLATION_RESOURCE_EMBEDDING=ON --preset conan-release
|
||||
cmake --build --preset conan-release
|
||||
- name: Deploy
|
||||
run: |
|
||||
macdeployqt ./build/ppic.app -dmg
|
||||
macdeployqt ./ppic.app -dmg
|
||||
ls
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "macos-bundle"
|
||||
path: build/*.dmg
|
||||
path: "*.dmg"
|
||||
|
@ -68,6 +68,7 @@ set (PPIC_CPP_FILES
|
||||
app/exiv2wrapper.cpp
|
||||
app/playlistmanager.cpp
|
||||
app/shortcutedit.cpp
|
||||
app/fileopeneventhandler.cpp
|
||||
)
|
||||
|
||||
set (PPIC_HEADER_FILES
|
||||
@ -88,6 +89,7 @@ set (PPIC_HEADER_FILES
|
||||
app/exiv2wrapper.h
|
||||
app/playlistmanager.h
|
||||
app/shortcutedit.h
|
||||
app/fileopeneventhandler.h
|
||||
)
|
||||
|
||||
set (PPIC_QRC_FILES
|
||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 BLumia
|
||||
Copyright (c) 2025 BLumia
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -59,7 +59,7 @@ AboutDialog::AboutDialog(QWidget *parent)
|
||||
)),
|
||||
QStringLiteral("<hr/>"),
|
||||
tr("Copyright (c) %1 %2", "%1 is year, %2 is the name of copyright holder(s)")
|
||||
.arg(QStringLiteral("2024"), QStringLiteral("<a href='https://github.com/BLumia'>@BLumia</a>")),
|
||||
.arg(QStringLiteral("2025"), QStringLiteral("<a href='https://github.com/BLumia'>@BLumia</a>")),
|
||||
QStringLiteral("<br/>"),
|
||||
tr("Logo designed by %1").arg(QStringLiteral("<a href='https://github.com/Lovelyblack'>@Lovelyblack</a>")),
|
||||
QStringLiteral("<hr/>"),
|
||||
@ -103,7 +103,7 @@ AboutDialog::AboutDialog(QWidget *parent)
|
||||
|
||||
const QString mitLicense(QStringLiteral(R"(Expat/MIT License
|
||||
|
||||
Copyright (c) 2024 BLumia
|
||||
Copyright (c) 2025 BLumia
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -83,6 +83,8 @@ void ActionManager::setupAction(MainWindow *mainWindow)
|
||||
#undef CREATE_NEW_ACTION
|
||||
#undef CREATE_NEW_THEMEICON_ACTION
|
||||
|
||||
actionSettings->setMenuRole(QAction::PreferencesRole);
|
||||
|
||||
retranslateUi(mainWindow);
|
||||
|
||||
QMetaObject::connectSlotsByName(mainWindow);
|
||||
|
22
app/fileopeneventhandler.cpp
Normal file
22
app/fileopeneventhandler.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
// SPDX-FileCopyrightText: 2024 Gary Wang <git@blumia.net>
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#include "fileopeneventhandler.h"
|
||||
|
||||
#include <QFileOpenEvent>
|
||||
|
||||
FileOpenEventHandler::FileOpenEventHandler(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
bool FileOpenEventHandler::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::FileOpen) {
|
||||
QFileOpenEvent *fileOpenEvent = static_cast<QFileOpenEvent *>(event);
|
||||
emit fileOpen(fileOpenEvent->url());
|
||||
return true;
|
||||
}
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
21
app/fileopeneventhandler.h
Normal file
21
app/fileopeneventhandler.h
Normal file
@ -0,0 +1,21 @@
|
||||
// SPDX-FileCopyrightText: 2024 Gary Wang <git@blumia.net>
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class FileOpenEventHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FileOpenEventHandler(QObject *parent = nullptr);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
signals:
|
||||
void fileOpen(const QUrl &url);
|
||||
};
|
19
app/main.cpp
19
app/main.cpp
@ -7,6 +7,10 @@
|
||||
#include "playlistmanager.h"
|
||||
#include "settings.h"
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
#include "fileopeneventhandler.h"
|
||||
#endif // Q_OS_MACOS
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QDir>
|
||||
@ -55,6 +59,21 @@ int main(int argc, char *argv[])
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
FileOpenEventHandler * fileOpenEventHandler = new FileOpenEventHandler(&a);
|
||||
a.installEventFilter(fileOpenEventHandler);
|
||||
a.connect(fileOpenEventHandler, &FileOpenEventHandler::fileOpen, [&w](const QUrl & url){
|
||||
if (w.isHidden()) {
|
||||
w.setWindowOpacity(1);
|
||||
w.showNormal();
|
||||
} else {
|
||||
w.activateWindow();
|
||||
}
|
||||
w.showUrls({url});
|
||||
w.initWindowSize();
|
||||
});
|
||||
#endif // Q_OS_MACOS
|
||||
|
||||
QStringList urlStrList = parser.positionalArguments();
|
||||
QList<QUrl> && urlList = PlaylistManager::convertToUrlList(urlStrList);
|
||||
|
||||
|
@ -37,6 +37,8 @@
|
||||
#include <QProcess>
|
||||
#include <QDesktopServices>
|
||||
#include <QMessageBox>
|
||||
#include <QMenuBar>
|
||||
#include <QLayout>
|
||||
|
||||
#ifdef HAVE_QTDBUS
|
||||
#include <QDBusInterface>
|
||||
@ -71,7 +73,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
m_exitAnimationGroup->addAnimation(m_fadeOutAnimation);
|
||||
m_exitAnimationGroup->addAnimation(m_floatUpAnimation);
|
||||
connect(m_exitAnimationGroup, &QParallelAnimationGroup::finished,
|
||||
#ifdef Q_OS_MAC
|
||||
this, &QWidget::hide);
|
||||
#else
|
||||
this, &QWidget::close);
|
||||
#endif
|
||||
|
||||
GraphicsScene * scene = new GraphicsScene(this);
|
||||
|
||||
@ -122,6 +128,14 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
|
||||
m_am->setupAction(this);
|
||||
|
||||
QMenuBar * menuBar = new QMenuBar(this);
|
||||
QMenu* fileMenu = menuBar->addMenu("File");
|
||||
fileMenu->addAction(m_am->actionOpen);
|
||||
fileMenu->addAction(m_am->actionSettings);
|
||||
QMenu* helpMenu = menuBar->addMenu("Help");
|
||||
helpMenu->addAction(m_am->actionHelp);
|
||||
layout()->setMenuBar(menuBar);
|
||||
|
||||
m_bottomButtonGroup = new BottomButtonGroup({
|
||||
m_am->actionActualSize,
|
||||
m_am->actionToggleMaximize,
|
||||
@ -160,10 +174,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()
|
||||
@ -563,7 +573,7 @@ void MainWindow::centerWindow()
|
||||
Qt::LeftToRight,
|
||||
Qt::AlignCenter,
|
||||
this->size(),
|
||||
qApp->screenAt(QCursor::pos())->geometry()
|
||||
qApp->screenAt(QCursor::pos())->availableGeometry()
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -661,20 +671,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()});
|
||||
initWindowSize();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif // Q_OS_MACOS
|
||||
|
||||
void MainWindow::on_actionOpen_triggered()
|
||||
{
|
||||
QStringList picturesLocations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation);
|
||||
|
@ -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();
|
||||
|
@ -8,9 +8,9 @@ environment:
|
||||
LIBEXIV2: C:\projects\exiv2
|
||||
PPKG: C:\projects\ppkg
|
||||
matrix:
|
||||
- job_name: mingw_64_qt6_7
|
||||
QTDIR: C:\Qt\6.7\mingw_64
|
||||
MINGW64: C:\Qt\Tools\mingw1120_64
|
||||
- job_name: mingw_64_qt6_8
|
||||
QTDIR: C:\Qt\6.8\mingw_64
|
||||
MINGW64: C:\Qt\Tools\mingw1310_64
|
||||
KF_BRANCH: master
|
||||
EXIV2_VERSION: "0.28.3"
|
||||
EXIV2_CMAKE_OPTIONS: "-DEXIV2_ENABLE_BROTLI=OFF -DEXIV2_ENABLE_INIH=OFF -DEXIV2_BUILD_EXIV2_COMMAND=OFF"
|
||||
@ -125,7 +125,7 @@ build_script:
|
||||
- cd kimageformats
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake .. -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_QTPLUGINDIR=%QTDIR%\plugins
|
||||
- cmake .. -G "Ninja" -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DKDE_INSTALL_QTPLUGINDIR=%QTDIR%\plugins
|
||||
- cmake --build . --config Release
|
||||
- cmake --build . --config Release --target install/strip
|
||||
- cd %APPVEYOR_BUILD_FOLDER%
|
||||
|
@ -40,7 +40,8 @@ SOURCES += \
|
||||
app/exiv2wrapper.cpp \
|
||||
app/actionmanager.cpp \
|
||||
app/playlistmanager.cpp \
|
||||
app/shortcutedit.cpp
|
||||
app/shortcutedit.cpp \
|
||||
app/fileopeneventhandler.cpp
|
||||
|
||||
HEADERS += \
|
||||
app/aboutdialog.h \
|
||||
@ -59,7 +60,8 @@ HEADERS += \
|
||||
app/exiv2wrapper.h \
|
||||
app/actionmanager.h \
|
||||
app/playlistmanager.h \
|
||||
app/shortcutedit.h
|
||||
app/shortcutedit.h \
|
||||
app/fileopeneventhandler.h
|
||||
|
||||
TRANSLATIONS = \
|
||||
app/translations/PineapplePictures.ts \
|
||||
|
Reference in New Issue
Block a user