diff --git a/CommitMark.xcodeproj/project.pbxproj b/CommitMark.xcodeproj/project.pbxproj new file mode 100644 index 0000000..6bb3197 --- /dev/null +++ b/CommitMark.xcodeproj/project.pbxproj @@ -0,0 +1,350 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 936F2FDB1F2B2BD7002300FC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 936F2FC91F2B2BD7002300FC /* AppDelegate.swift */; }; + 936F2FDC1F2B2BD7002300FC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 936F2FCA1F2B2BD7002300FC /* Assets.xcassets */; }; + 936F2FDD1F2B2BD7002300FC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 936F2FCB1F2B2BD7002300FC /* Main.storyboard */; }; + 936F2FDE1F2B2BD7002300FC /* ApplicationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 936F2FCE1F2B2BD7002300FC /* ApplicationController.swift */; }; + 936F2FDF1F2B2BD7002300FC /* MenuController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 936F2FCF1F2B2BD7002300FC /* MenuController.swift */; }; + 936F2FE01F2B2BD7002300FC /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 936F2FD01F2B2BD7002300FC /* ViewController.swift */; }; + 936F2FE11F2B2BD7002300FC /* WindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 936F2FD11F2B2BD7002300FC /* WindowController.swift */; }; + 936F2FE31F2B2BD7002300FC /* Mark.swift in Sources */ = {isa = PBXBuildFile; fileRef = 936F2FD41F2B2BD7002300FC /* Mark.swift */; }; + 936F2FE41F2B2BD7002300FC /* Windows.swift in Sources */ = {isa = PBXBuildFile; fileRef = 936F2FD51F2B2BD7002300FC /* Windows.swift */; }; + 936F2FE51F2B2BD7002300FC /* MarkService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 936F2FD71F2B2BD7002300FC /* MarkService.swift */; }; + 936F2FE61F2B2BD7002300FC /* MarkMenuItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 936F2FD91F2B2BD7002300FC /* MarkMenuItem.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 936F2FC91F2B2BD7002300FC /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 936F2FCA1F2B2BD7002300FC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 936F2FCC1F2B2BD7002300FC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 936F2FCE1F2B2BD7002300FC /* ApplicationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApplicationController.swift; sourceTree = ""; }; + 936F2FCF1F2B2BD7002300FC /* MenuController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuController.swift; sourceTree = ""; }; + 936F2FD01F2B2BD7002300FC /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 936F2FD11F2B2BD7002300FC /* WindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WindowController.swift; sourceTree = ""; }; + 936F2FD21F2B2BD7002300FC /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 936F2FD41F2B2BD7002300FC /* Mark.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mark.swift; sourceTree = ""; }; + 936F2FD51F2B2BD7002300FC /* Windows.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Windows.swift; sourceTree = ""; }; + 936F2FD71F2B2BD7002300FC /* MarkService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkService.swift; sourceTree = ""; }; + 936F2FD91F2B2BD7002300FC /* MarkMenuItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkMenuItem.swift; sourceTree = ""; }; + 9390E1D21C91A91E00E459FE /* CommitMark.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CommitMark.app; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9390E1CF1C91A91E00E459FE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 936F2FC81F2B2BD7002300FC /* CommitMark */ = { + isa = PBXGroup; + children = ( + 936F2FC91F2B2BD7002300FC /* AppDelegate.swift */, + 936F2FCA1F2B2BD7002300FC /* Assets.xcassets */, + 936F2FCB1F2B2BD7002300FC /* Main.storyboard */, + 936F2FD21F2B2BD7002300FC /* Info.plist */, + 936F2FCD1F2B2BD7002300FC /* Controllers */, + 936F2FD31F2B2BD7002300FC /* Models */, + 936F2FD61F2B2BD7002300FC /* Services */, + 936F2FD81F2B2BD7002300FC /* Views */, + ); + path = CommitMark; + sourceTree = ""; + }; + 936F2FCD1F2B2BD7002300FC /* Controllers */ = { + isa = PBXGroup; + children = ( + 936F2FCE1F2B2BD7002300FC /* ApplicationController.swift */, + 936F2FCF1F2B2BD7002300FC /* MenuController.swift */, + 936F2FD01F2B2BD7002300FC /* ViewController.swift */, + 936F2FD11F2B2BD7002300FC /* WindowController.swift */, + ); + path = Controllers; + sourceTree = ""; + }; + 936F2FD31F2B2BD7002300FC /* Models */ = { + isa = PBXGroup; + children = ( + 936F2FD41F2B2BD7002300FC /* Mark.swift */, + 936F2FD51F2B2BD7002300FC /* Windows.swift */, + ); + path = Models; + sourceTree = ""; + }; + 936F2FD61F2B2BD7002300FC /* Services */ = { + isa = PBXGroup; + children = ( + 936F2FD71F2B2BD7002300FC /* MarkService.swift */, + ); + path = Services; + sourceTree = ""; + }; + 936F2FD81F2B2BD7002300FC /* Views */ = { + isa = PBXGroup; + children = ( + 936F2FD91F2B2BD7002300FC /* MarkMenuItem.swift */, + ); + path = Views; + sourceTree = ""; + }; + 9390E1C91C91A91E00E459FE = { + isa = PBXGroup; + children = ( + 936F2FC81F2B2BD7002300FC /* CommitMark */, + 9390E1D31C91A91E00E459FE /* Products */, + ); + sourceTree = ""; + }; + 9390E1D31C91A91E00E459FE /* Products */ = { + isa = PBXGroup; + children = ( + 9390E1D21C91A91E00E459FE /* CommitMark.app */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 9390E1D11C91A91E00E459FE /* CommitMark */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9390E1E11C91A91E00E459FE /* Build configuration list for PBXNativeTarget "CommitMark" */; + buildPhases = ( + 9390E1CE1C91A91E00E459FE /* Sources */, + 9390E1CF1C91A91E00E459FE /* Frameworks */, + 9390E1D01C91A91E00E459FE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CommitMark; + productName = CommitMessagePrefix; + productReference = 9390E1D21C91A91E00E459FE /* CommitMark.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 9390E1CA1C91A91E00E459FE /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0720; + LastUpgradeCheck = 0830; + TargetAttributes = { + 9390E1D11C91A91E00E459FE = { + CreatedOnToolsVersion = 7.2; + LastSwiftMigration = 0810; + }; + }; + }; + buildConfigurationList = 9390E1CD1C91A91E00E459FE /* Build configuration list for PBXProject "CommitMark" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 9390E1C91C91A91E00E459FE; + productRefGroup = 9390E1D31C91A91E00E459FE /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 9390E1D11C91A91E00E459FE /* CommitMark */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 9390E1D01C91A91E00E459FE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 936F2FDC1F2B2BD7002300FC /* Assets.xcassets in Resources */, + 936F2FDD1F2B2BD7002300FC /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 9390E1CE1C91A91E00E459FE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 936F2FE01F2B2BD7002300FC /* ViewController.swift in Sources */, + 936F2FE11F2B2BD7002300FC /* WindowController.swift in Sources */, + 936F2FE51F2B2BD7002300FC /* MarkService.swift in Sources */, + 936F2FDF1F2B2BD7002300FC /* MenuController.swift in Sources */, + 936F2FE61F2B2BD7002300FC /* MarkMenuItem.swift in Sources */, + 936F2FE41F2B2BD7002300FC /* Windows.swift in Sources */, + 936F2FE31F2B2BD7002300FC /* Mark.swift in Sources */, + 936F2FDE1F2B2BD7002300FC /* ApplicationController.swift in Sources */, + 936F2FDB1F2B2BD7002300FC /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 936F2FCB1F2B2BD7002300FC /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 936F2FCC1F2B2BD7002300FC /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 9390E1DF1C91A91E00E459FE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 9390E1E01C91A91E00E459FE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.10; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + }; + name = Release; + }; + 9390E1E21C91A91E00E459FE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = CommitMark/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + PRODUCT_BUNDLE_IDENTIFIER = jp.sasaki.CommitMark; + PRODUCT_NAME = CommitMark; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + 9390E1E31C91A91E00E459FE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = CommitMark/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; + PRODUCT_BUNDLE_IDENTIFIER = jp.sasaki.CommitMark; + PRODUCT_NAME = CommitMark; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 9390E1CD1C91A91E00E459FE /* Build configuration list for PBXProject "CommitMark" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9390E1DF1C91A91E00E459FE /* Debug */, + 9390E1E01C91A91E00E459FE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9390E1E11C91A91E00E459FE /* Build configuration list for PBXNativeTarget "CommitMark" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9390E1E21C91A91E00E459FE /* Debug */, + 9390E1E31C91A91E00E459FE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 9390E1CA1C91A91E00E459FE /* Project object */; +} diff --git a/CommitMark.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/CommitMark.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..e681846 --- /dev/null +++ b/CommitMark.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/CommitMark.xcodeproj/xcshareddata/xcschemes/CommitMark.xcscheme b/CommitMark.xcodeproj/xcshareddata/xcschemes/CommitMark.xcscheme new file mode 100644 index 0000000..b9cef59 --- /dev/null +++ b/CommitMark.xcodeproj/xcshareddata/xcschemes/CommitMark.xcscheme @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CommitMark/AppDelegate.swift b/CommitMark/AppDelegate.swift new file mode 100644 index 0000000..70a31ab --- /dev/null +++ b/CommitMark/AppDelegate.swift @@ -0,0 +1,18 @@ +// +// AppDelegate.swift +// CommitMark +// +// Created by Jin Sasaki on 2016/03/10. +// +// + +import Cocoa + +@NSApplicationMain +class AppDelegate: NSObject, NSApplicationDelegate { + + func applicationDidFinishLaunching(_ aNotification: Notification) { + ApplicationController.shared.appDelegate = self + MenuController.shared.setup() + } +} diff --git a/CommitMark/Assets.xcassets/AppIcon.appiconset/Contents.json b/CommitMark/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..9e0aab3 --- /dev/null +++ b/CommitMark/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "icon_16@2x.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "icon_32@2x.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "icon_128@2x.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "icon_128@2x-1.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "icon_512-1.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "icon_512@2x.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_128.png b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_128.png new file mode 100644 index 0000000..b06a72a Binary files /dev/null and b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_128.png differ diff --git a/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_128@2x-1.png b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_128@2x-1.png new file mode 100644 index 0000000..5ba7157 Binary files /dev/null and b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_128@2x-1.png differ diff --git a/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_128@2x.png b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_128@2x.png new file mode 100644 index 0000000..5ba7157 Binary files /dev/null and b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_128@2x.png differ diff --git a/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_16.png b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_16.png new file mode 100644 index 0000000..6525a40 Binary files /dev/null and b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_16.png differ diff --git a/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_16@2x.png b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_16@2x.png new file mode 100644 index 0000000..575ed72 Binary files /dev/null and b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_16@2x.png differ diff --git a/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_32.png b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_32.png new file mode 100644 index 0000000..575ed72 Binary files /dev/null and b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_32.png differ diff --git a/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_32@2x.png b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_32@2x.png new file mode 100644 index 0000000..454bf6d Binary files /dev/null and b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_32@2x.png differ diff --git a/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_512-1.png b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_512-1.png new file mode 100644 index 0000000..08dc18c Binary files /dev/null and b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_512-1.png differ diff --git a/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_512.png b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_512.png new file mode 100644 index 0000000..08dc18c Binary files /dev/null and b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_512.png differ diff --git a/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_512@2x.png b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_512@2x.png new file mode 100644 index 0000000..7bee148 Binary files /dev/null and b/CommitMark/Assets.xcassets/AppIcon.appiconset/icon_512@2x.png differ diff --git a/CommitMark/Assets.xcassets/Contents.json b/CommitMark/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/CommitMark/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/CommitMark/Assets.xcassets/icon_16.imageset/Contents.json b/CommitMark/Assets.xcassets/icon_16.imageset/Contents.json new file mode 100644 index 0000000..4f65f02 --- /dev/null +++ b/CommitMark/Assets.xcassets/icon_16.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "icon_16@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/CommitMark/Assets.xcassets/icon_16.imageset/icon_16@3x.png b/CommitMark/Assets.xcassets/icon_16.imageset/icon_16@3x.png new file mode 100644 index 0000000..fe15ff8 Binary files /dev/null and b/CommitMark/Assets.xcassets/icon_16.imageset/icon_16@3x.png differ diff --git a/CommitMark/Assets.xcassets/icon_white_16.imageset/Contents.json b/CommitMark/Assets.xcassets/icon_white_16.imageset/Contents.json new file mode 100644 index 0000000..ce92d85 --- /dev/null +++ b/CommitMark/Assets.xcassets/icon_white_16.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "icon_white_16.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "icon_white_16@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "icon_white_16@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/CommitMark/Assets.xcassets/icon_white_16.imageset/icon_white_16.png b/CommitMark/Assets.xcassets/icon_white_16.imageset/icon_white_16.png new file mode 100644 index 0000000..a27c7a8 Binary files /dev/null and b/CommitMark/Assets.xcassets/icon_white_16.imageset/icon_white_16.png differ diff --git a/CommitMark/Assets.xcassets/icon_white_16.imageset/icon_white_16@2x.png b/CommitMark/Assets.xcassets/icon_white_16.imageset/icon_white_16@2x.png new file mode 100644 index 0000000..9cdf174 Binary files /dev/null and b/CommitMark/Assets.xcassets/icon_white_16.imageset/icon_white_16@2x.png differ diff --git a/CommitMark/Assets.xcassets/icon_white_16.imageset/icon_white_16@3x.png b/CommitMark/Assets.xcassets/icon_white_16.imageset/icon_white_16@3x.png new file mode 100644 index 0000000..98d870d Binary files /dev/null and b/CommitMark/Assets.xcassets/icon_white_16.imageset/icon_white_16@3x.png differ diff --git a/CommitMark/Base.lproj/Main.storyboard b/CommitMark/Base.lproj/Main.storyboard new file mode 100644 index 0000000..56c4002 --- /dev/null +++ b/CommitMark/Base.lproj/Main.storyboard @@ -0,0 +1,259 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CommitMark/Controllers/ApplicationController.swift b/CommitMark/Controllers/ApplicationController.swift new file mode 100644 index 0000000..ff31117 --- /dev/null +++ b/CommitMark/Controllers/ApplicationController.swift @@ -0,0 +1,31 @@ +// +// ApplicationController.swift +// CommitMark +// +// Created by Jin Sasaki on 2017/07/28. +// +// + +import Cocoa + +final class ApplicationController { + static let shared = ApplicationController() + + weak var appDelegate: AppDelegate? + init() {} + + func copyToPasteBoard(text: String) { + let pasteBoard = NSPasteboard.general() + pasteBoard.declareTypes([NSStringPboardType], owner: nil) + pasteBoard.setString(text, forType: NSStringPboardType) + } + + func open(url: URL) { + NSWorkspace.shared().open(url) + } + + func terminate() { + NSApplication.shared().terminate(appDelegate) + } +} + diff --git a/CommitMark/Controllers/MenuController.swift b/CommitMark/Controllers/MenuController.swift new file mode 100644 index 0000000..cc38b13 --- /dev/null +++ b/CommitMark/Controllers/MenuController.swift @@ -0,0 +1,87 @@ +// +// MenuController.swift +// CommitMark +// +// Created by Jin Sasaki on 2017/07/28. +// +// + +import Cocoa + +final class MenuController { + + static let shared = MenuController() + + private let markService: MarkService + private let windowManager: WindowController + private let applicationManager: ApplicationController + private let statusItem = NSStatusBar.system().statusItem(withLength: NSVariableStatusItemLength) + + init(markService: MarkService = .shared, windowManager: WindowController = .shared, applicationManager: ApplicationController = .shared) { + self.markService = markService + self.windowManager = windowManager + self.applicationManager = applicationManager + } + + func setup() { + let image = NSImage(named: "icon_white_16") + image?.isTemplate = true + statusItem.image = image + statusItem.highlightMode = true + statusItem.menu = makeMenu() + } + + func makeMenu() -> NSMenu { + let menu = NSMenu() + + for mark in markService.marks { + let menuItem = MarkMenuItem() + menuItem.target = self + menuItem.action = #selector(didSelectMarkMenuItem(_:)) + menuItem.mark = mark + menu.addItem(menuItem) + } + + menu.addItem(NSMenuItem.separator()) + + let preferencesMenuItem = NSMenuItem() + preferencesMenuItem.title = "Preferences" + preferencesMenuItem.action = #selector(didSelectPreferences(_:)) + preferencesMenuItem.target = self + menu.addItem(preferencesMenuItem) + + let downloadMenuItem = NSMenuItem() + downloadMenuItem.title = "About CommitMark ..." + downloadMenuItem.action = #selector(didSelectDownloadMenuItem(_:)) + downloadMenuItem.target = self + menu.addItem(downloadMenuItem) + + menu.addItem(NSMenuItem.separator()) + + let quitMenuItem = NSMenuItem() + quitMenuItem.title = "Quit" + quitMenuItem.action = #selector(didSelectQuit(_:)) + quitMenuItem.target = self + menu.addItem(quitMenuItem) + + return menu + } + + @IBAction func didSelectMarkMenuItem(_ sender: MarkMenuItem) { + guard let mark = sender.mark else { return } + applicationManager.copyToPasteBoard(text: mark.code) + } + + @IBAction func didSelectPreferences(_ sender: AnyObject) { + guard let controller = Windows.preference else { return } + windowManager.set(windowController: controller) + } + + @IBAction func didSelectDownloadMenuItem(_ sender: AnyObject) { + applicationManager.open(url: URL(string: "https://github.com/jinSasaki/CommitMark")!) + } + + @IBAction func didSelectQuit(_ sender: NSButton) { + applicationManager.terminate() + } +} diff --git a/CommitMark/Controllers/ViewController.swift b/CommitMark/Controllers/ViewController.swift new file mode 100644 index 0000000..3079978 --- /dev/null +++ b/CommitMark/Controllers/ViewController.swift @@ -0,0 +1,106 @@ +// +// ViewController.swift +// CommitMark +// +// Created by Jin Sasaki on 2016/03/10. +// +// + +import Cocoa + +class ViewController: NSViewController { + + @IBOutlet private weak var tableView: NSTableView! + @IBOutlet private weak var versionText: NSTextField! + @IBOutlet private weak var launchCheckBox: NSButton! + + var markService: MarkService = .shared + + fileprivate var editingColumn: NSTableColumn? + private var observerId: String? + + deinit { + guard let id = observerId else { return } + markService.unregisterObserverBlock(id: id) + } + + override func viewDidLoad() { + super.viewDidLoad() + + NSApp.activate(ignoringOtherApps: true) + + tableView.dataSource = self + tableView.delegate = self + versionText.stringValue = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "" + + observerId = markService.register { [weak self] (marks) in + self?.tableView.reloadData() + } + } + + override func keyDown(with theEvent: NSEvent) { + let key = theEvent.charactersIgnoringModifiers + if key == String(describing: UnicodeScalar(NSDeleteCharacter)!) && self.tableView.selectedRow != -1 { + NSApp.sendAction(#selector(delete), to: self, from: self) + } else { + super.keyUp(with: theEvent) + } + } + + func delete() { + markService.marks.remove(at: self.tableView.selectedRow) + } + + // MARK: - IBActions + + @IBAction func didTapAdd(_ sender: AnyObject) { + markService.marks.append(Mark()) + tableView.scrollRowToVisible(markService.marks.count - 1) + } + + @IBAction func didTapDefault(_ sender: AnyObject) { + markService.setDefault() + } +} + +extension ViewController: NSTableViewDataSource { + func numberOfRows(in tableView: NSTableView) -> Int { + return markService.marks.count + } + + func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? { + guard let tableColumn = tableColumn else { return nil } + let mark = markService.marks[row] + switch tableColumn.identifier { + case "code": + return mark.code + case "description": + return mark.description + default: + return nil + } + } +} + +extension ViewController: NSTableViewDelegate { + override func controlTextDidEndEditing(_ obj: Notification) { + guard let tableView = obj.object as? NSTableView else { return } + guard let textView = obj.userInfo?["NSFieldEditor"] else { return } + guard let tableColumn = self.editingColumn else { return } + + switch tableColumn.identifier { + case "code": + markService.marks[tableView.selectedRow].code = (textView as? NSTextView)?.string ?? "" + case "description": + markService.marks[tableView.selectedRow].description = (textView as? NSTextView)?.string ?? "" + default: + break + } + self.editingColumn = nil + } + + func tableView(_ tableView: NSTableView, shouldEdit tableColumn: NSTableColumn?, row: Int) -> Bool { + self.editingColumn = tableColumn + return true + } +} diff --git a/CommitMark/Controllers/WindowController.swift b/CommitMark/Controllers/WindowController.swift new file mode 100644 index 0000000..53d97f6 --- /dev/null +++ b/CommitMark/Controllers/WindowController.swift @@ -0,0 +1,23 @@ +// +// WindowController.swift +// CommitMark +// +// Created by Jin Sasaki on 2017/07/28. +// +// + +import Cocoa + +final class WindowController { + static let shared = WindowController() + + var currentWindowController: NSWindowController? + + init() {} + + func set(windowController: NSWindowController) { + windowController.showWindow(self) + windowController.window?.makeKeyAndOrderFront(nil) + currentWindowController = windowController + } +} diff --git a/CommitMark/Info.plist b/CommitMark/Info.plist new file mode 100644 index 0000000..dbd014e --- /dev/null +++ b/CommitMark/Info.plist @@ -0,0 +1,36 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 0.2.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSApplicationCategoryType + + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + LSUIElement + + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + + diff --git a/CommitMark/Models/Mark.swift b/CommitMark/Models/Mark.swift new file mode 100644 index 0000000..d155de4 --- /dev/null +++ b/CommitMark/Models/Mark.swift @@ -0,0 +1,38 @@ +// +// Mark.swift +// CommitMark +// +// Created by Jin Sasaki on 2017/07/28. +// +// + +import Foundation + +struct Mark { + struct Key { + static let code = "code" + static let description = "description" + static let marks = "marks" + } + + var code: String = "" + var description: String = "" + + init(code: String = ":ok:", description: String = "๐Ÿ†— Some description") { + self.code = code + self.description = description + } + + init(dictionary: [String: String]) { + self.code = dictionary[Mark.Key.code] ?? "" + self.description = dictionary[Mark.Key.description] ?? "" + } + + func toDictionary() -> [String: String] { + return [ + Mark.Key.code: self.code, + Mark.Key.description: self.description + ] + } +} + diff --git a/CommitMark/Models/Windows.swift b/CommitMark/Models/Windows.swift new file mode 100644 index 0000000..c55d241 --- /dev/null +++ b/CommitMark/Models/Windows.swift @@ -0,0 +1,16 @@ +// +// Windows.swift +// CommitMark +// +// Created by Jin Sasaki on 2017/07/28. +// +// + +import Cocoa + +struct Windows { + static var preference: NSWindowController? { + let storyboard = NSStoryboard(name: "Main", bundle: Bundle.main) + return storyboard.instantiateController(withIdentifier: "Window") as? NSWindowController + } +} diff --git a/CommitMark/Services/MarkService.swift b/CommitMark/Services/MarkService.swift new file mode 100644 index 0000000..78035c3 --- /dev/null +++ b/CommitMark/Services/MarkService.swift @@ -0,0 +1,82 @@ +// +// MarkService.swift +// CommitMark +// +// Created by Jin Sasaki on 2017/07/28. +// +// + +import Cocoa + +protocol KeyValueAccessable { + func array(forKey: String) -> [Any]? + func set(_ value: Any?, forKey: String) + @discardableResult + func synchronize() -> Bool +} + +extension UserDefaults: KeyValueAccessable {} + +final class MarkService { + typealias ObserveBlock = (_ marks: [Mark]) -> Void + + static let shared = MarkService() + private static var defaultMarks: [Mark] { + return[ + Mark(code: ":heavy_plus_sign:", description: "โž• ๆฉŸ่ƒฝใ‚’่ฟฝๅŠ ใ—ใŸใจใ"), + Mark(code: ":art:", description: "๐ŸŽจ ใ‚ณใƒผใƒ‰ใฎๅฏ่ชญๆ€งใ‚„ไฟๅฎˆๆ€งใ‚’ๆ”นๅ–„ใ—ใŸใจใ"), + Mark(code: ":racehorse:", description: "๐ŸŽ ใƒ‘ใƒ•ใ‚ฉใƒผใƒžใƒณใ‚นใ‚’ๆ”นๅ–„ใ—ใŸใจใ"), + Mark(code: ":bug:", description: "๐Ÿ› ใƒใ‚ฐใ‚’ไฟฎๆญฃใ—ใŸใจใ"), + Mark(code: ":arrow_up:", description: "๐Ÿ”ผ ใƒใƒผใ‚ธใƒงใƒณใ‚’ไธŠใ’ใŸใจใ"), + Mark(code: ":arrow_down:", description: "๐Ÿ”ฝ ใƒใƒผใ‚ธใƒงใƒณใ‚’ไธ‹ใ’ใŸใจใ"), + Mark(code: ":bird:", description: "๐Ÿฆ SwiftๅŒ–ใ‚’ใ—ใŸใจใ"), + Mark(code: ":fire:", description: "๐Ÿ”ฅ ใ‚ณใƒผใƒ‰ใ‚„ใƒ•ใ‚กใ‚คใƒซใ‚’ๅ‰Š้™คใ—ใŸใจใ"), + Mark(code: ":shirt:", description: "๐Ÿ‘• warningใ‚’ๅ–ใ‚Š้™คใ„ใŸๆ™‚"), + Mark(code: ":white_check_mark:", description: "โœ… ใƒ†ใ‚นใƒˆใ‚’่ฟฝๅŠ ใƒป็ทจ้›†ใ—ใŸใจใ"), + Mark(code: ":memo:", description: "๐Ÿ“ ใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆใ‚’ๆ›ธใ„ใŸใจใ"), + Mark(code: ":wrench:", description: "๐Ÿ”ง ไป•ๆง˜ใ‚’ๅค‰ๆ›ดใ—ใŸใจใ"), + Mark(code: ":ok:", description: "๐Ÿ†— ใชใซใ‹OKใชๅค‰ๆ›ดใ‚’ใ—ใŸใจใ") + ] + } + + let userDefaults: KeyValueAccessable + private var observerBlocks: [String: ObserveBlock] = [:] + + var marks: [Mark] { + get { + let markValues = self.userDefaults.array(forKey: Mark.Key.marks) as? [[String: String]] ?? [] + return markValues.map({ Mark(dictionary: $0) }) + } + set { + userDefaults.set(newValue.map({ $0.toDictionary() }), forKey: Mark.Key.marks) + userDefaults.synchronize() + + // Notify to block + observerBlocks.forEach({ $0.value(newValue) }) + } + } + + init(userDefaults: KeyValueAccessable = UserDefaults.standard) { + self.userDefaults = userDefaults + + // Set default if not initialized + if userDefaults.array(forKey: Mark.Key.marks) == nil { + setDefault() + } + } + + func setDefault() { + marks = MarkService.defaultMarks + } + + func register(observerBlock: @escaping ObserveBlock) -> String { + let id = UUID().uuidString + observerBlocks[id] = observerBlock + return id + } + + func unregisterObserverBlock(id: String) { + observerBlocks.removeValue(forKey: id) + } +} + diff --git a/CommitMark/Views/MarkMenuItem.swift b/CommitMark/Views/MarkMenuItem.swift new file mode 100644 index 0000000..573ddc0 --- /dev/null +++ b/CommitMark/Views/MarkMenuItem.swift @@ -0,0 +1,17 @@ +// +// MarkMenuItem.swift +// CommitMark +// +// Created by Jin Sasaki on 2017/07/28. +// +// + +import Cocoa + +final class MarkMenuItem: NSMenuItem { + var mark: Mark? { + didSet { + self.title = mark?.description ?? "" + } + } +} diff --git a/README.md b/README.md index b500a29..59a5c00 100644 --- a/README.md +++ b/README.md @@ -1 +1,24 @@ -# CommitMark \ No newline at end of file +# CommitMark + +![CommitMark](./assets/logo.png) + +**CommitMark** makes easy to input pictogram for the commitment rule with pictograms. + +If you find bugs, please create a new issue. + +[DOWNLOAD](https://github.com/jinSasaki/CommitMark/releases/tag/0.2.0) + +## Features +- Run on Menu bar +- Copy to Clipboard +- Custom pictogram code and description + +On Menu Bar | Preferences +--- | --- +![screenshot1](./assets/screenshot01.png) | ![screenshot2](./assets/screenshot02.png) + +The commitment rule with pictograms samples: + +- [http://qiita.com/pocotan001/items/775cc77087be5562cc56](http://qiita.com/pocotan001/items/775cc77087be5562cc56) +- [http://mzyy94.com/blog/2015/10/14/emoji-commit-message/](http://mzyy94.com/blog/2015/10/14/emoji-commit-message/) +- [http://pronama.azurewebsites.net/2015/06/20/github-emoji-commit-message/](http://pronama.azurewebsites.net/2015/06/20/github-emoji-commit-message/) diff --git a/assets/logo.png b/assets/logo.png new file mode 100644 index 0000000..399ffe5 Binary files /dev/null and b/assets/logo.png differ diff --git a/assets/screenshot01.png b/assets/screenshot01.png new file mode 100644 index 0000000..49a415b Binary files /dev/null and b/assets/screenshot01.png differ diff --git a/assets/screenshot02.png b/assets/screenshot02.png new file mode 100644 index 0000000..efc9d12 Binary files /dev/null and b/assets/screenshot02.png differ