Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
674b7b9
MAS
gee1k Jan 15, 2021
725f135
删除打赏、重启 Finder
gee1k Jan 16, 2021
15e9ece
修改一些信息
L1cardo Jan 16, 2021
96e67cc
Merge branch 'feature/mas' into feature/mas
L1cardo Jan 16, 2021
71be7e4
Merge pull request #169 from L1cardo/feature/mas
gee1k Jan 16, 2021
f8229e8
增加 自定义输出格式配置
L1cardo Jan 17, 2021
e9f6e80
输出格式支持自定义、上传记录图床、大小、时间
gee1k Jan 18, 2021
601e275
修正 Share 分享路径
gee1k Jan 18, 2021
cef4c05
添加磁盘访问授权
L1cardo Jan 18, 2021
ba9dba0
授权磁盘访问
gee1k Jan 19, 2021
a443774
添加欢迎界面,优化数据库页面
L1cardo Jan 20, 2021
3ff0689
接入欢迎页、改造磁盘授权逻辑
gee1k Jan 20, 2021
9ba3447
releasing v1.1.0
gee1k Jan 20, 2021
d55d5d0
添加重启 finder 的帮助
L1cardo Jan 20, 2021
cc8c139
Releasing v1.1.0 build 7
gee1k Jan 20, 2021
9b26605
增加截图权限获取教程、首次请求磁盘权限改为用户主目录
gee1k Jan 21, 2021
62111f7
修复问题
gee1k Jan 23, 2021
765fe5e
数据库界面增加新功能
L1cardo Jan 24, 2021
a48dd1f
录屏权限页面添加约束
L1cardo Jan 24, 2021
467d42a
修复 Bugs 和更新阿里云区域数据
gee1k Jan 25, 2021
be36231
更新命令行参数
gee1k Feb 18, 2021
9cbefbe
移除 Finder Toolbar
gee1k Apr 25, 2021
2f0b4b0
添加 apple script支持
L1cardo Jun 6, 2021
9fe4ab0
升级LoginServiceKit 到版本2.2.1,修复问题#180
L1cardo Jun 6, 2021
ba8d8ac
v1.2.0
gee1k Jun 7, 2021
4d548d2
Add ImageCodec #194
bqlin Jun 15, 2021
832dfe5
Remove ImageCodec meta files
bqlin Jun 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
数据库界面增加新功能
1. 双击复制 url
2. 右键菜单
  • Loading branch information
L1cardo authored and gee1k committed Jan 25, 2021
commit 765fe5e2f2e83763bcc1b708dd41793a9cf62fed
2 changes: 1 addition & 1 deletion uPic/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<action selector="cut:" id="YJe-68-I9s"/>
</connections>
</menuItem>
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
<menuItem title="Copy" keyEquivalent="c" identifier="copy" id="x3v-GG-iWU">
<connections>
<action selector="copy:" id="G1f-GL-Joy"/>
</connections>
Expand Down
2 changes: 1 addition & 1 deletion uPic/Views/DatabaseWindow/Base.lproj/Database.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
</tableHeaderView>
</scrollView>
<connections>
<outlet property="databaseTableView" destination="4Uo-6F-X0B" id="mQa-wt-PAh"/>
<outlet property="tableView" destination="4Uo-6F-X0B" id="mQa-wt-PAh"/>
</connections>
</viewController>
</objects>
Expand Down
74 changes: 54 additions & 20 deletions uPic/Views/DatabaseWindow/DatabaseViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Cocoa

class DatabaseViewController: NSViewController {
@IBOutlet weak var databaseTableView: NSTableView!
@IBOutlet weak var tableView: NSTableView!

var hostItems: [Host] = []
var items: [HistoryThumbnailModel] = []
Expand All @@ -25,16 +25,41 @@ class DatabaseViewController: NSViewController {
NSApp.setActivationPolicy(.regular)
}

databaseTableView.dataSource = self
databaseTableView.delegate = self
//enableCopyMenu()

tableView.dataSource = self
tableView.delegate = self
tableView.doubleAction = #selector(copyURL)

// 获取图床信息
hostItems = ConfigManager.shared.getHostItems()

items = DBManager.shared.getHistoryList()
sortConfig()
databaseTableView.reloadData()
tableView.reloadData()
}

override func rightMouseDown(with event: NSEvent) {
let menu = NSMenu()

let copyMenuItem = NSMenuItem()
copyMenuItem.title = "Copy".localized + " (" + "\(selectedRow.count)" + "items".localized + ")"
copyMenuItem.isEnabled = false
copyMenuItem.action = #selector(copyURL)

menu.addItem(copyMenuItem)

NSMenu.popUpContextMenu(menu, with: event, for: tableView)
}

func enableCopyMenu() {
if let mainMenu = NSApp.mainMenu, let editMenu = mainMenu.item(at: 2)?.submenu {
for item in editMenu.items {
if item.identifier?.rawValue == "copy" {
item.action = #selector(didClickCopyButton(_:))
}
}
}
}

// 根据 ID 获取图床
Expand All @@ -47,18 +72,11 @@ class DatabaseViewController: NSViewController {

@IBAction func didClickRefreshButton(_ sender: NSToolbarItem) {
items = DBManager.shared.getHistoryList()
databaseTableView.reloadData()
tableView.reloadData()
}

@IBAction func didClickCopyButton(_ sender: NSToolbarItem) {
var urls: [String] = []

for row in selectedRow.sorted() {
urls.append(items[row].url)
}

let outputUrl = (NSApplication.shared.delegate as? AppDelegate)?.copyUrls(urls: urls)
NotificationExt.shared.postCopySuccessfulNotice(outputUrl)
copyURL()
}

@IBAction func didClickDeleteButton(_ sender: NSToolbarItem) {
Expand All @@ -74,12 +92,25 @@ class DatabaseViewController: NSViewController {
if response == .alertFirstButtonReturn {
ConfigManager.shared.clearHistoryList()
items = ConfigManager.shared.getHistoryList()
databaseTableView.reloadData()
tableView.reloadData()
} else if response == .alertSecondButtonReturn {
NSLog("Cancel")
}
}

@objc func copyURL() {
guard selectedRow.count > 0 else {
return
}
var urls: [String] = []

for row in selectedRow.sorted() {
urls.append(items[row].url)
}

let outputUrl = (NSApplication.shared.delegate as? AppDelegate)?.copyUrls(urls: urls)
NotificationExt.shared.postCopySuccessfulNotice(outputUrl)
}

func sortConfig() {
let descriptorName = NSSortDescriptor(key: SortOrder.Name.rawValue, ascending: false)
Expand All @@ -88,11 +119,11 @@ class DatabaseViewController: NSViewController {
let descriptorTime = NSSortDescriptor(key: SortOrder.Time.rawValue, ascending: false)
let descriptorURL = NSSortDescriptor(key: SortOrder.URL.rawValue, ascending: false)

databaseTableView.tableColumns[1].sortDescriptorPrototype = descriptorName
databaseTableView.tableColumns[2].sortDescriptorPrototype = descriptorHost
databaseTableView.tableColumns[3].sortDescriptorPrototype = descriptorSize
databaseTableView.tableColumns[4].sortDescriptorPrototype = descriptorTime
databaseTableView.tableColumns[5].sortDescriptorPrototype = descriptorURL
tableView.tableColumns[1].sortDescriptorPrototype = descriptorName
tableView.tableColumns[2].sortDescriptorPrototype = descriptorHost
tableView.tableColumns[3].sortDescriptorPrototype = descriptorSize
tableView.tableColumns[4].sortDescriptorPrototype = descriptorTime
tableView.tableColumns[5].sortDescriptorPrototype = descriptorURL
}

func sortTableView() {
Expand All @@ -114,7 +145,7 @@ class DatabaseViewController: NSViewController {
}
}

databaseTableView.reloadData()
tableView.reloadData()
}

}
Expand Down Expand Up @@ -168,6 +199,9 @@ extension DatabaseViewController: NSTableViewDelegate {

func tableViewSelectionDidChange(_ notification: Notification) {
selectionDidChange = true
if tableView.selectedRow < 0 {
selectedRow.removeAll()
}
}

func tableView(_ tableView: NSTableView, sortDescriptorsDidChange oldDescriptors: [NSSortDescriptor]) {
Expand Down
24 changes: 12 additions & 12 deletions uPic/Views/PreferencesWindow/Base.lproj/Preferences.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -1068,18 +1068,18 @@
<rect key="frame" x="20" y="20" width="268" height="217"/>
<subviews>
<stackView distribution="fill" orientation="horizontal" alignment="top" spacing="12" horizontalStackHuggingPriority="250" verticalStackHuggingPriority="216" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yY2-Uz-6lI">
<rect key="frame" x="0.0" y="190" width="93" height="27"/>
<rect key="frame" x="0.0" y="192" width="93" height="25"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PJu-EB-sSS">
<rect key="frame" x="-2" y="3" width="44" height="24"/>
<rect key="frame" x="-2" y="1" width="44" height="24"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="uPic" id="mOB-su-ZM1">
<font key="font" metaFont="systemSemibold" size="20"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GS4-or-3hj">
<rect key="frame" x="50" y="3" width="45" height="24"/>
<rect key="frame" x="50" y="1" width="45" height="24"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="0.1.0" id="Jnf-AX-bIr">
<font key="font" metaFont="system" size="20"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
Expand All @@ -1097,7 +1097,7 @@
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="F5k-92-BmU">
<rect key="frame" x="0.0" y="159" width="262" height="16"/>
<rect key="frame" x="0.0" y="161" width="262" height="16"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FCw-yO-sfT">
<rect key="frame" x="-2" y="0.0" width="73" height="16"/>
Expand Down Expand Up @@ -1129,7 +1129,7 @@
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="MuS-Gl-ip2">
<rect key="frame" x="0.0" y="128" width="159" height="16"/>
<rect key="frame" x="0.0" y="130" width="159" height="16"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ruh-p7-eW7">
<rect key="frame" x="-2" y="0.0" width="97" height="16"/>
Expand Down Expand Up @@ -1161,7 +1161,7 @@
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Kp8-FV-lYw">
<rect key="frame" x="0.0" y="97" width="153" height="16"/>
<rect key="frame" x="0.0" y="99" width="153" height="16"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PTf-CP-tw5">
<rect key="frame" x="-2" y="0.0" width="73" height="16"/>
Expand Down Expand Up @@ -1193,7 +1193,7 @@
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LBo-Zi-R8f">
<rect key="frame" x="0.0" y="66" width="136" height="16"/>
<rect key="frame" x="0.0" y="68" width="136" height="16"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uLj-4I-Xpk">
<rect key="frame" x="-2" y="0.0" width="87" height="16"/>
Expand Down Expand Up @@ -1225,7 +1225,7 @@
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GIc-KW-yw5">
<rect key="frame" x="0.0" y="35" width="215" height="16"/>
<rect key="frame" x="0.0" y="37" width="215" height="16"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="if3-nE-vHb">
<rect key="frame" x="-2" y="0.0" width="79" height="16"/>
Expand Down Expand Up @@ -1257,18 +1257,18 @@
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="horizontal" alignment="centerY" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Rr1-mz-JLF">
<rect key="frame" x="0.0" y="0.0" width="163" height="20"/>
<rect key="frame" x="0.0" y="0.0" width="165" height="22"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zjU-iE-iB1">
<rect key="frame" x="-2" y="2" width="117" height="16"/>
<rect key="frame" x="-2" y="3" width="117" height="16"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="✋Welcome Page:" id="ul8-3a-sB4">
<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>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NdA-aI-djJ">
<rect key="frame" x="119" y="-3" width="46" height="25"/>
<rect key="frame" x="120" y="-2" width="46" height="25"/>
<buttonCell key="cell" type="squareTextured" title="Show" bezelStyle="texturedSquare" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="7Gg-u8-8Yt">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand Down Expand Up @@ -1783,7 +1783,7 @@ Gw
<image name="NSPreferencesGeneral" width="32" height="32"/>
<image name="NSRemoveTemplate" width="14" height="4"/>
<image name="NSStatusPartiallyAvailable" width="16" height="16"/>
<image name="color" width="16" height="16"/>
<image name="color" width="22" height="22"/>
<image name="downloadOnAppStore" width="120" height="40"/>
<image name="finderRestart" width="150" height="255"/>
<image name="host" width="64" height="64"/>
Expand Down
1 change: 1 addition & 0 deletions uPic/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"Off" = "Off";
"Later" = "Later";
"APP Name" = "APP Name";
"Copy" = "Copy";

// 欢迎界面
"Next" = "Next";
Expand Down
1 change: 1 addition & 0 deletions uPic/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"Off" = "关闭";
"Later" = "稍后";
"APP Name" = "APP 名称";
"Copy" = "复制";

// 欢迎界面
"Next" = "下一步";
Expand Down
1 change: 1 addition & 0 deletions uPic/zh-Hant.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"Off" = "關閉";
"Later" = "稍後";
"APP Name" = "APP 名稱";
"Copy" = "复制";

// 欢迎界面
"Next" = "下一步";
Expand Down