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

View File

@ -10,14 +10,15 @@ resultfile=""
if [[ "$uname" = "Darwin" ]]; then
export PATH="/usr/local/opt/qt/bin:$PATH"
command -v brew >/dev/null || { echo "Homebrew is required!"; exit }
installIfNeeded qt
installIfNeeded ffmpeg
installIfNeeded pkg-config
installIfNeeded git
resultfile="$(pwd)/KShare/build/KShare.app/"
elif [[ "$uname" = "Linux" ]]; then
echo "Please install Qt5 SDK, qmake, ffmpeg development files, git, and pkgconfig"
bash
echo "Please install Qt5 GUI, Widgets, Networking, and X11 Extras, qmake, ffmpeg development files, git, and pkgconfig"
sh
resultfile="$(pwd)/KShare/build/KShare"
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 <QStandardPaths>
QMutex *lock = new QMutex;
QSettings &settings::settings() {
QMutexLocker l(lock);
static QSettings settings(dir().absoluteFilePath("settings.ini"), QSettings::IniFormat);
@ -15,12 +13,13 @@ QSettings &settings::settings() {
QDir settings::dir() {
static QDir configDir(QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation));
if (configDir.dirName() != "KShare") {
if (!configDir.cd("KShare"))
if (!configDir.cd("KShare")) {
if (!configDir.mkdir("KShare")) {
qFatal("Could not make config directory");
} else {
configDir.cd("KShare");
}
}
}
return configDir;
}