Skip to content
This repository has been archived by the owner on Oct 22, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
* release/1.0.0: (38 commits)
  Bump CFBundleShortVersionString to 1.0.0
  Read version values from Info.plist
  Update "Things to complete"
  Update screenshots to latest layout
  Minor package and workspace cleanup
  Bring window to front on showWindow() calls
  Add Menu Item to open the Pi-hole dashboard
  Add missing enable/disable time values and their action handler
  Ignore local pi-hole data created by docker
  Minor Xcode configuration update
  Update README.md with screenshot
  Add MIT license
  Remove unused cocoa pods integration
  Fixed invalid description position
  Add links to project repository and the pi-hole project
  Add application description to readme and about window
  Minor package refactor and cleanup
  Add AboutWindow to display copyright acknowledges, references and links
  Make NSColor usages consistent
  Add missing about application action handling
  ...
  • Loading branch information
dotWee committed Nov 10, 2018
2 parents 93fb9da + 3f8f76f commit e86dd3c
Show file tree
Hide file tree
Showing 34 changed files with 1,727 additions and 1,509 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

# Created by https://www.gitignore.io/api/xcode,macos,cocoapods

### Pi-hole docker data ###
dnsmasq.d/
pihole/

### CocoaPods ###
## CocoaPods GitIgnore Template

Expand Down
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

MIT License

Copyright (c) 2018 Lukas Wolfsteiner <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 0 additions & 10 deletions Podfile

This file was deleted.

16 changes: 0 additions & 16 deletions Podfile.lock

This file was deleted.

47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,46 @@
# Shortcuts for Pi-hole
# Shortcuts for Pi-hole

Shortcuts for Pi-hole is a small menu bar application that lives in your status bar. It provides quick actions for managing and monitoring your Pi-hole® instance.

<img src="Screenshots/Overview.png"/>

General Preferences | Connection Preferences
:-------------------------:|:-------------------------:
<img src="Screenshots/GeneralPreferences.png"/> | <img src="Screenshots/ConnectionPreferences.png"/>

## Things to complete

- [ ] Application icon
- [ ] Update mechanism (using the [Spark Framework](https://sparkle-project.org/))
- [ ] Implement Unit-/Testing
- [ ] Create as cask

## Copyright acknowledges and credits

Big thanks to the whole Pi-hole userspace for developing and maintaining the Pi-hole project. Visit [pi-hole.net](https://pi-hole.net/) for more information. This application uses the Pi-hole API and it's logo as menu bar icon.

**Pi-hole® is a registered trademark of Pi-hole LLC**

## Source code license

MIT License

Copyright (c) 2018 Lukas Wolfsteiner <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file added Screenshots/ConnectionPreferences.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/GeneralPreferences.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/Overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
186 changes: 96 additions & 90 deletions Shortcuts for Pi-hole.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>Shortcuts for Pi-hole.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
Expand Down
10 changes: 0 additions & 10 deletions Shortcuts for Pi-hole.xcworkspace/contents.xcworkspacedata

This file was deleted.

This file was deleted.

34 changes: 34 additions & 0 deletions Shortcuts for Pi-hole/About/AboutViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// AboutViewController.swift
// Shortcuts for Pi-hole
//
// Created by Lukas Wolfsteiner on 21.10.18.
// Copyright © 2018 Lukas Wolfsteiner. All rights reserved.
//

import Cocoa

class AboutViewController: NSViewController {

@IBOutlet weak var versionTextField: NSTextField!

@IBAction func viewSourceCodeActionHandler(_ sender: NSButton) {
NSWorkspace.shared.open(URL(string: "https://github.com/dotWee/macOS-PiholeShortcuts")!)
}

@IBAction func visitPiHoleProjectActionHandler(_ sender: NSButton) {
NSWorkspace.shared.open(URL(string: "https://pi-hole.net")!)
}

override func viewDidLoad() {
super.viewDidLoad()

// Do view setup here.
print("AboutViewController: viewDidLoad()")

let versionValue = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
let bundleValue = Bundle.main.infoDictionary?["CFBundleVersion"] as? String
versionTextField.stringValue = "Version: \(versionValue!) (Bundle No. #\(bundleValue!))";
}

}
26 changes: 26 additions & 0 deletions Shortcuts for Pi-hole/About/AboutWindowController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// AboutWindowController.swift
// Shortcuts for Pi-hole
//
// Created by Lukas Wolfsteiner on 21.10.18.
// Copyright © 2018 Lukas Wolfsteiner. All rights reserved.
//

import Cocoa

class AboutWindowController: NSWindowController {

@IBOutlet weak var aboutWindow: NSWindow!

override func showWindow(_ sender: Any?) {
super.showWindow(sender)

AppDelegate.bringToFront(window: self.window!)
}

override func windowDidLoad() {
super.windowDidLoad()

// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
}
}
62 changes: 4 additions & 58 deletions Shortcuts for Pi-hole/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,76 +7,22 @@
//

import Cocoa
import Preferences

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {

static let menuItems = [AppDelegate.menuItemStatus, AppKit.NSMenuItem.separator(), AppDelegate.menuItemEnable, AppDelegate.menuItemDisable, AppKit.NSMenuItem.separator(), AppDelegate.menuItemPreferences, AppKit.NSMenuItem.separator(), AppDelegate.menuItemQuit]

static let menuItemStatus = NSMenuItem(title: "Status", action: nil, keyEquivalent: "", isEnabled: false)
@objc func menuItemStatusActionHandler(_ sender: Any?) {

}

static let menuItemEnable = NSMenuItem(title: "Enable", action: #selector(AppDelegate.menuItemEnableActionHandler(_:)), keyEquivalent: "E", isEnabled: true)
@objc func menuItemEnableActionHandler(_ sender: Any?) {

}

static let menuItemDisable = NSMenuItem(title: "Disable", action: #selector(AppDelegate.menuItemDisableActionHandler(_:)), keyEquivalent: "D", isEnabled: true)
@objc func menuItemDisableActionHandler(_ sender: Any?) {

}

static let menuItemPreferences = NSMenuItem(title: "Preferences", action: #selector(AppDelegate.menuItemPreferenceActionHandler(_:)), keyEquivalent: "P", isEnabled: true)
@objc func menuItemPreferenceActionHandler(_ sender: Any?) {
preferencesWindowController.showWindow()
}

static let menuItemQuit = NSMenuItem(title: "Quit " + (Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as? String ?? ""), action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q", isEnabled: true)

@IBOutlet weak var window: NSWindow!

let statusBarItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
@objc func statusBarItemActionHandler(_ sender: NSStatusBarButton) {

}

let preferencesWindowController = PreferencesWindowController(viewControllers: [GeneralPreferenceViewController()])

func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
preferencesWindowController.showWindow()
if let button = statusBarItem.button {
button.image = NSImage(named:"StatusBarButtonImage")
button.action = #selector(self.statusBarItemActionHandler(_:))
button.target = self
}

let menu = NSMenu()

AppDelegate.menuItems.forEach { menuItem in menu.addItem(menuItem) }
statusBarItem.menu = menu
}

func applicationWillFinishLaunching(_ notification: Notification) {
window.orderOut(self)
}

func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
preferencesWindowController.close()
}

@IBAction func preferencesMenuItemActionHandler(_ sender: Any) {
preferencesWindowController.showWindow()
}

static func NSMenuItem(title: String, action selector: Selector?, keyEquivalent charCode: String, isEnabled: Bool) -> NSMenuItem {
let menuItem = AppKit.NSMenuItem(title: title, action: selector, keyEquivalent: charCode)
menuItem.isEnabled = isEnabled
return menuItem
public static func bringToFront(window: NSWindow) {
window.center()
window.makeKeyAndOrderFront(nil)
NSApp.activate(ignoringOtherApps: true)
}
}

Loading

0 comments on commit e86dd3c

Please sign in to comment.