Skip to content

Commit

Permalink
Remove mentions of CSV support
Browse files Browse the repository at this point in the history
macOS provides CSV Quick Look previews out of the box (even without Numbers being installed).
  • Loading branch information
samuelmeuli committed Apr 23, 2020
1 parent 013e949 commit 8cca348
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 49 deletions.
8 changes: 4 additions & 4 deletions Glance.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
7E21C88D2438CAA500818EB2 /* Stats.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E21C88C2438CAA500818EB2 /* Stats.swift */; };
7E21C88E24390BE400818EB2 /* Stats.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E21C88C2438CAA500818EB2 /* Stats.swift */; };
7E21C89124390E3100818EB2 /* Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E21C89024390E3100818EB2 /* Date.swift */; };
7E413F802418DD6200CFBB1D /* CSVPreviewVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E413F7F2418DD6200CFBB1D /* CSVPreviewVC.swift */; };
7E413F802418DD6200CFBB1D /* TSVPreviewVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E413F7F2418DD6200CFBB1D /* TSVPreviewVC.swift */; };
7E458AED2439176B0091BD0F /* Date.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E21C89024390E3100818EB2 /* Date.swift */; };
7E458AF0243944810091BD0F /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E458AEF243944810091BD0F /* URL.swift */; };
7E458AF22439474E0091BD0F /* NSMenuItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E458AF12439474E0091BD0F /* NSMenuItem.swift */; };
Expand Down Expand Up @@ -170,7 +170,7 @@
7E21C88C2438CAA500818EB2 /* Stats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Stats.swift; sourceTree = "<group>"; };
7E21C89024390E3100818EB2 /* Date.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Date.swift; sourceTree = "<group>"; };
7E3DF744242CBE7F00DE7CD6 /* Main.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
7E413F7F2418DD6200CFBB1D /* CSVPreviewVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CSVPreviewVC.swift; sourceTree = "<group>"; };
7E413F7F2418DD6200CFBB1D /* TSVPreviewVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TSVPreviewVC.swift; sourceTree = "<group>"; };
7E458AEF243944810091BD0F /* URL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = URL.swift; sourceTree = "<group>"; };
7E458AF12439474E0091BD0F /* NSMenuItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSMenuItem.swift; sourceTree = "<group>"; };
7E458AF42439481F0091BD0F /* Menu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Menu.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -340,10 +340,10 @@
isa = PBXGroup;
children = (
7E1DC529240E6FDE00D0A061 /* CodePreviewVC.swift */,
7E413F7F2418DD6200CFBB1D /* CSVPreviewVC.swift */,
7EB7491824228549007265A4 /* JupyterPreviewVC.swift */,
7E1DC520240E6D8000D0A061 /* MarkdownPreviewVC.swift */,
7E7A9DAC244F24B900276E51 /* TARPreviewVC.swift */,
7E413F7F2418DD6200CFBB1D /* TSVPreviewVC.swift */,
7EB36489244B665700D7F96F /* ZIPPreviewVC.swift */,
);
path = FileTypes;
Expand Down Expand Up @@ -813,7 +813,7 @@
7E1DC528240E6F4A00D0A061 /* PreviewVCFactory.swift in Sources */,
7EB36484244B0CCE00D7F96F /* TablePreviewVC.swift in Sources */,
7E1DC521240E6D8000D0A061 /* MarkdownPreviewVC.swift in Sources */,
7E413F802418DD6200CFBB1D /* CSVPreviewVC.swift in Sources */,
7E413F802418DD6200CFBB1D /* TSVPreviewVC.swift in Sources */,
7E1DC52A240E6FDE00D0A061 /* CodePreviewVC.swift in Sources */,
7E9F0D7E24168870007F1008 /* Script.swift in Sources */,
7EB3648A244B665700D7F96F /* ZIPPreviewVC.swift in Sources */,
Expand Down
26 changes: 16 additions & 10 deletions Glance/SupportedFilesWC.xib
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<window title="Supported Files" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="900"/>
<view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down Expand Up @@ -88,7 +88,7 @@
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
<fragment content="CSV/TSV">
<fragment content="Jupyter Notebook">
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" metaFont="systemBold"/>
Expand All @@ -97,31 +97,37 @@
</fragment>
<fragment>
<string key="content">
.csv, .tab, .tsv

</string>
.ipynb

</string>
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" metaFont="system"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
<fragment content="Jupyter Notebook">
<fragment content="TSV">
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" metaFont="systemBold"/>
<font key="NSFont" size="13" name="HelveticaNeue-Bold"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
<fragment>
<string key="content">
.ipynb</string>
<string key="content" base64-UTF8="YES">
Cg
</string>
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" metaFont="system"/>
<font key="NSFont" size="13" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
<fragment content=".tab, .tsv">
<attributes>
<color key="NSColor" name="textColor" catalog="System" colorSpace="catalog"/>
<font key="NSFont" size="13" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0" allowsDefaultTighteningForTruncation="NO"/>
</attributes>
</fragment>
</attributedString>
<color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
</textView>
Expand Down
9 changes: 4 additions & 5 deletions QLPlugin/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,16 @@
<string>public.tar-archive</string> <!-- .tar -->
<string>public.zip-archive</string> <!-- .zip -->

<!-- CSV -->
<string>dyn.ah62d4rv4ge81k2pc</string> <!-- .tab -->
<string>public.comma-separated-values-text</string> <!-- .csv -->
<string>public.tab-separated-values-text</string> <!-- .tsv -->

<!-- Jupyter Notebook -->
<string>dyn.ah62d4rv4ge80w6d3r3va</string> <!-- .ipynb -->

<!-- Markdown -->
<string>net.daringfireball.markdown</string> <!-- .md -->

<!-- TSV -->
<string>dyn.ah62d4rv4ge81k2pc</string> <!-- .tab -->
<string>public.tab-separated-values-text</string> <!-- .tsv -->

<!-- Code / plain text -->
<string>com.adobe.actionscript</string>
<string>com.adobe.coldfusion</string>
Expand Down
28 changes: 0 additions & 28 deletions QLPlugin/Views/FileTypes/CSVPreviewVC.swift

This file was deleted.

25 changes: 25 additions & 0 deletions QLPlugin/Views/FileTypes/TSVPreviewVC.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Cocoa
import Foundation
import os.log
import SwiftCSV

/// View controller for previewing TSV files
class TSVPreviewVC: TablePreviewVC, PreviewVC {
func loadPreview() throws {
// Read and parse TSV file
var csv: CSV
do {
csv = try CSV(url: file.url, delimiter: "\t")
} catch {
os_log(
"Could not parse TSV file: %{public}s",
log: Log.parse,
type: .error,
error.localizedDescription
)
throw error
}

loadData(tableData: csv.namedRows)
}
}
4 changes: 2 additions & 2 deletions QLPlugin/Views/PreviewVCFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import Foundation
class PreviewVCFactory {
static func getView(fileURL: URL) -> PreviewVC.Type? {
switch fileURL.pathExtension {
case "csv", "tab", "tsv":
return CSVPreviewVC.self
case "gz":
// `gzip` is only supported for tarballs
return fileURL.path.hasSuffix(".tar.gz") ? TARPreviewVC.self : nil
Expand All @@ -16,6 +14,8 @@ class PreviewVCFactory {
return JupyterPreviewVC.self
case "tar":
return TARPreviewVC.self
case "tab", "tsv":
return TSVPreviewVC.self
case "zip":
return ZIPPreviewVC.self
default:
Expand Down

0 comments on commit 8cca348

Please sign in to comment.