From 3fe016c6352dd94617ac5a6b274a162d7333299f Mon Sep 17 00:00:00 2001 From: ArsenArsen Date: Sun, 23 Jul 2017 13:32:02 +0200 Subject: [PATCH] Add OS X bundle info --- KShare.pro | 14 +++++++++----- install.sh | 5 +++-- packages/macos/Info.plist | 20 ++++++++++++++++++++ settings.cpp | 5 ++--- 4 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 packages/macos/Info.plist diff --git a/KShare.pro b/KShare.pro index 432fc3e..5265869 100644 --- a/KShare.pro +++ b/KShare.pro @@ -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) diff --git a/install.sh b/install.sh index 657aba4..d0ab4cd 100755 --- a/install.sh +++ b/install.sh @@ -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 diff --git a/packages/macos/Info.plist b/packages/macos/Info.plist new file mode 100644 index 0000000..c23fa53 --- /dev/null +++ b/packages/macos/Info.plist @@ -0,0 +1,20 @@ + + + + + NSPrincipalClass + NSApplication + CFBundleIconFile + icon.icns + CFBundlePackageType + APPL + CFBundleGetInfoString + Created by Qt/QMake + CFBundleSignature + ???? + CFBundleExecutable + KShare + CFBundleIdentifier + com.arsenarsen.KShare + + diff --git a/settings.cpp b/settings.cpp index 86cb78d..e16c4d8 100644 --- a/settings.cpp +++ b/settings.cpp @@ -4,8 +4,6 @@ #include #include -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; }