Skip to content
Snippets Groups Projects
Commit e66b73af authored by broman's avatar broman
Browse files

Working

parent d846479f
No related branches found
No related tags found
1 merge request!2Test settings view
No preview for this file type
......@@ -13,8 +13,7 @@ import SKQueue
class AppDelegate: NSObject, NSApplicationDelegate {
let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
let popover = NSPopover()
let viewController = PopoverMenu(nibName: "PopoverMenu",
bundle: Bundle.main)
let viewController = PopoverMenu(nibName: "PopoverMenu", bundle: Bundle.main)
let statusIcon = NSImage(named: "status_icon")
var spinnerView = NSView()
let spinner = NSProgressIndicator()
......
......@@ -8,38 +8,28 @@
import Cocoa
class DropView: NSImageView {
@IBOutlet var uploadImage: DropView!
@IBOutlet var textLabel: NSTextField!
var filePath: String?
class DropView: NSView {
@IBOutlet weak var textLabel: NSTextField! //FIXME: Value is Nil despite outlet existing. https://stackoverflow.com/questions/58314461/outlet-definition-is-nil-despite-outlet-existing
var filePath: String?
required init?(coder: NSCoder) {
super.init(coder: coder)
isEditable = false
//isEditable = false
wantsLayer = true
registerForDraggedTypes([NSPasteboard.PasteboardType.URL, NSPasteboard.PasteboardType.fileURL])
}
override func draggingEntered(_: NSDraggingInfo) -> NSDragOperation {
textLabel.stringValue = "*notices your file* owo what's this?"
//textLabel.stringValue = "*notices your file* owo what's this?"
return .copy
}
override func draggingEnded(_: NSDraggingInfo) {
textLabel.stringValue = "Drag and Drop to Upload"
image = NSImage(named: "upload")
/*
* For anybody in the future: The reason we change the image is because, for some reason, the
* image view in PopoverMenu will not connect to the outlet, meaning I cannot mark it as un-editable.
* No matter how hard I try it is an editable image view.
* If you, future person, find a solution, please email me. My email will be on https://github.com/broman
* But I am currently reachable at ryan@broman.dev
*/
//textLabel.stringValue = "Drag and Drop to Upload"
}
override func draggingExited(_: NSDraggingInfo?) {
textLabel.stringValue = "Drag and Drop to Upload"
//textLabel.stringValue = "Drag and Drop to Upload"
}
override func performDragOperation(_ sender: NSDraggingInfo) -> Bool {
......
//
// DropViewController.swift
// Screenshottr
//
// Created by Ryan Broman on 26/09/19.
// Copyright © 2019 JOS Computing. All rights reserved.
//
import Cocoa
class DropViewController {
@IBOutlet weak var uploaderImage: DropView!
}
......@@ -9,11 +9,14 @@
import Cocoa
class PopoverMenu: NSViewController {
let settingsMenu = NSMenu()
@IBOutlet weak var uploadButton: NSButton!
let settingsMenu = NSMenu()
override func viewDidLoad() {
super.viewDidLoad()
// Do view setup here.
uploadButton.isHighlighted = false
let settingsItem = NSMenuItem()
settingsItem.action = #selector(presentSettingsDialog)
settingsItem.title = "Settings"
......
......@@ -7,13 +7,14 @@
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="PopoverMenu" customModule="Screenshottr" customModuleProvider="target">
<connections>
<outlet property="uploadButton" destination="jrN-oy-XGI" id="wjX-1I-3Py"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="DropView">
<connections>
<outlet property="uploadImage" destination="687-0U-0uf" id="lti-id-9I9"/>
<outlet property="textLabel" destination="fj4-kJ-fXa" id="Fz7-VA-xTL"/>
</connections>
</customObject>
<customView id="Hz6-mo-xeY">
......@@ -21,7 +22,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jrN-oy-XGI">
<rect key="frame" x="78" y="13" width="108" height="32"/>
<rect key="frame" x="72" y="6" width="120" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Upload File" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="7jj-A4-JC3">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
......@@ -31,8 +32,28 @@
<action selector="uploadFileClicked:" target="-2" id="jft-g4-t1c"/>
</connections>
</button>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="2jg-Ct-0t0">
<rect key="frame" x="20" y="49" width="225" height="215"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="upload" id="SQf-YI-nXZ"/>
</imageView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="MI0-Tw-K0l" customClass="DropView" customModule="Screenshottr" customModuleProvider="target">
<rect key="frame" x="20" y="49" width="225" height="215"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fj4-kJ-fXa">
<rect key="frame" x="-2" y="20" width="229" height="17"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Drag and Drop to Upload" id="dcJ-qF-u2q">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
</customView>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ZlR-St-Ru0">
<rect key="frame" x="237" y="20" width="21" height="21"/>
<rect key="frame" x="224" y="20" width="21" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="NSActionTemplate" imagePosition="only" alignment="center" refusesFirstResponder="YES" imageScaling="proportionallyDown" inset="2" id="uPe-bE-h5R">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
......@@ -42,23 +63,6 @@
<action selector="toggleGearMenu:" target="-2" id="FKD-T9-7Xw"/>
</connections>
</button>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="687-0U-0uf" customClass="DropView" customModule="Screenshottr" customModuleProvider="target">
<rect key="frame" x="20" y="49" width="225" height="215"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="upload" id="DPA-2I-1fC"/>
<connections>
<outlet property="textLabel" destination="r6E-aY-KOH" id="nQx-7n-fKo"/>
</connections>
</imageView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="r6E-aY-KOH">
<rect key="frame" x="5" y="95" width="254" height="23"/>
<autoresizingMask key="autoresizingMask"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" selectable="YES" alignment="center" title="Drag and Drop to Upload" usesSingleLineMode="YES" id="IqH-JI-SBr">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<point key="canvasLocation" x="-17.5" y="62"/>
</customView>
......
......@@ -24,7 +24,7 @@ class UploadManager: NSObject {
defaults.set(true, forKey: uploadingKey)
// This could probably be done better
// oh well lol
// sleep(2)
sleep(2) //prevents race condiiton on legacy Mac OS
let fileManager = FileManager.default
do {
// Grab contents by predicate, convert to array, loop through array with paths
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment