Add OS X bundle info

This commit is contained in:
ArsenArsen 2017-07-23 13:32:02 +02:00
parent 0c6f947139
commit 3fe016c635
4 changed files with 34 additions and 10 deletions

View File

@ -4,9 +4,7 @@
# #
#------------------------------------------------- #-------------------------------------------------
QT += core gui network QT += core gui network widgets
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = KShare TARGET = KShare
TEMPLATE = app TEMPLATE = app
@ -141,6 +139,7 @@ mac {
SOURCES += $$PWD/platformspecifics/mac/macbackend.cpp SOURCES += $$PWD/platformspecifics/mac/macbackend.cpp
HEADERS += $$PWD/platformspecifics/mac/macbackend.hpp HEADERS += $$PWD/platformspecifics/mac/macbackend.hpp
LIBS += -framework Carbon LIBS += -framework Carbon
QMAKE_INFO_PLIST = $$PWD/packages/macos/Info.plist
warning(Mac is on TODO); warning(Mac is on TODO);
} else:win32 { } else:win32 {
RC_FILE = $$PWD/icon.rc RC_FILE = $$PWD/icon.rc
@ -178,7 +177,12 @@ DISTFILES += \
RESOURCES += \ RESOURCES += \
icon.qrc icon.qrc
# Enable debug symbols CONFIG += debug_and_release
QMAKE_CFLAGS_DEBUG += -g
CONFIG(debug, debug|release) {
TARGET = debug_binary
} else {
TARGET = release_binary
}
include(QHotkey/qhotkey.pri) include(QHotkey/qhotkey.pri)

View File

@ -10,14 +10,15 @@ resultfile=""
if [[ "$uname" = "Darwin" ]]; then if [[ "$uname" = "Darwin" ]]; then
export PATH="/usr/local/opt/qt/bin:$PATH" export PATH="/usr/local/opt/qt/bin:$PATH"
command -v brew >/dev/null || { echo "Homebrew is required!"; exit }
installIfNeeded qt installIfNeeded qt
installIfNeeded ffmpeg installIfNeeded ffmpeg
installIfNeeded pkg-config installIfNeeded pkg-config
installIfNeeded git installIfNeeded git
resultfile="$(pwd)/KShare/build/KShare.app/" resultfile="$(pwd)/KShare/build/KShare.app/"
elif [[ "$uname" = "Linux" ]]; then elif [[ "$uname" = "Linux" ]]; then
echo "Please install Qt5 SDK, qmake, ffmpeg development files, git, and pkgconfig" echo "Please install Qt5 GUI, Widgets, Networking, and X11 Extras, qmake, ffmpeg development files, git, and pkgconfig"
bash sh
resultfile="$(pwd)/KShare/build/KShare" resultfile="$(pwd)/KShare/build/KShare"
else echo "Unsupported OS!" && exit 1; fi else echo "Unsupported OS!" && exit 1; fi

20
packages/macos/Info.plist Normal file
View File

@ -0,0 +1,20 @@
<?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>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>KShare</string>
<key>CFBundleIdentifier</key>
<string>com.arsenarsen.KShare</string>
</dict>
</plist>

View File

@ -4,8 +4,6 @@
#include <QMutex> #include <QMutex>
#include <QStandardPaths> #include <QStandardPaths>
QMutex *lock = new QMutex;
QSettings &settings::settings() { QSettings &settings::settings() {
QMutexLocker l(lock); QMutexLocker l(lock);
static QSettings settings(dir().absoluteFilePath("settings.ini"), QSettings::IniFormat); static QSettings settings(dir().absoluteFilePath("settings.ini"), QSettings::IniFormat);
@ -15,12 +13,13 @@ QSettings &settings::settings() {
QDir settings::dir() { QDir settings::dir() {
static QDir configDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation)); static QDir configDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
if (configDir.dirName() != "KShare") { if (configDir.dirName() != "KShare") {
if (!configDir.cd("KShare")) if (!configDir.cd("KShare")) {
if (!configDir.mkdir("KShare")) { if (!configDir.mkdir("KShare")) {
qFatal("Could not make config directory"); qFatal("Could not make config directory");
} else { } else {
configDir.cd("KShare"); configDir.cd("KShare");
} }
} }
}
return configDir; return configDir;
} }