Use vscode icons

This commit is contained in:
Nora
2023-01-25 11:34:42 +00:00
parent 64e73c6426
commit 0771e93c1e
4 changed files with 7 additions and 211 deletions

View File

@@ -1,56 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="30px"
width="30px"
fill="#000000"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 100 100"
style="enable-background:new 0 0 100 100;"
xml:space="preserve"
id="svg3895"
sodipodi:docname="check-dark-mode.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata
id="metadata3901"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs3899" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1179"
inkscape:window-height="701"
id="namedview3897"
showgrid="false"
inkscape:zoom="7.8666667"
inkscape:cx="-22.881356"
inkscape:cy="15"
inkscape:window-x="0"
inkscape:window-y="28"
inkscape:window-maximized="0"
inkscape:current-layer="svg3895" /><g
transform="translate(-452.57627,-74.457627)"
id="g3893"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"><g
id="g3891"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"><g
id="g3889"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"><path
d="M 457.98136,131.82373 488.80508,163.49492 548.8661,92.416949 535.93729,81.60678 487.85763,144.41695 468.2678,120.58983 Z"
id="path3887"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1" /></g></g></g></svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="30px"
width="30px"
fill="#000000"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 100 100"
style="enable-background:new 0 0 100 100;"
xml:space="preserve"
id="svg3895"
sodipodi:docname="check.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata
id="metadata3901"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs3899" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1179"
inkscape:window-height="701"
id="namedview3897"
showgrid="false"
inkscape:zoom="7.8666667"
inkscape:cx="15"
inkscape:cy="15"
inkscape:window-x="0"
inkscape:window-y="28"
inkscape:window-maximized="0"
inkscape:current-layer="svg3895" /><g
transform="translate(-452.57627,-74.457627)"
id="g3893"
style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"><g
id="g3891"
style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"><g
id="g3889"
style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-opacity:1"><path
d="M 457.98136,131.82373 488.80508,163.49492 548.8661,92.416949 535.93729,81.60678 487.85763,144.41695 468.2678,120.58983 Z"
id="path3887"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc"
style="fill:#000000;fill-opacity:1;stroke:#ffffff;stroke-opacity:1" /></g></g></g></svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -1,58 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="30px"
width="30px"
fill="#000000"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 100 100"
style="enable-background:new 0 0 100 100;"
xml:space="preserve"
id="svg3895"
sodipodi:docname="red-x.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)"><metadata
id="metadata3901"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs3899" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1179"
inkscape:window-height="701"
id="namedview3897"
showgrid="false"
inkscape:zoom="7.8666667"
inkscape:cx="-22.881356"
inkscape:cy="15"
inkscape:window-x="33"
inkscape:window-y="36"
inkscape:window-maximized="0"
inkscape:current-layer="svg3895" /><rect
style="opacity:1;vector-effect:none;fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:2.24023867;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="rect29"
width="15.499873"
height="88.381233"
x="-8.3491764"
y="27.119303"
transform="matrix(-0.70710678,0.70710678,0.70710678,0.70710678,0,0)" /><rect
style="fill:#ff0000;fill-opacity:1;stroke:none;stroke-width:2.24023867;stroke-opacity:1"
id="rect29-6"
width="15.499873"
height="88.381233"
x="63.559982"
y="-44.789856"
transform="rotate(45)" /></svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -10,6 +10,8 @@ import {
window,
env,
CancellationToken,
ThemeIcon,
ThemeColor,
} from "vscode";
import { pathExists, stat, readdir, remove } from "fs-extra";
@@ -39,33 +41,6 @@ import { Credentials } from "./authentication";
import { QueryRunner } from "./queryRunner";
import { isCanary } from "./config";
type ThemableIconPath = { light: string; dark: string } | string;
/**
* Path to icons to display next to currently selected database.
*/
const SELECTED_DATABASE_ICON: ThemableIconPath = {
light: "media/light/check.svg",
dark: "media/dark/check.svg",
};
/**
* Path to icon to display next to an invalid database.
*/
const INVALID_DATABASE_ICON: ThemableIconPath = "media/red-x.svg";
function joinThemableIconPath(
base: string,
iconPath: ThemableIconPath,
): ThemableIconPath {
if (typeof iconPath == "object")
return {
light: join(base, iconPath.light),
dark: join(base, iconPath.dark),
};
else return join(base, iconPath);
}
enum SortOrder {
NameAsc = "NameAsc",
NameDesc = "NameDesc",
@@ -87,10 +62,7 @@ class DatabaseTreeDataProvider
);
private currentDatabaseItem: DatabaseItem | undefined;
constructor(
private databaseManager: DatabaseManager,
private readonly extensionPath: string,
) {
constructor(private databaseManager: DatabaseManager) {
super();
this.currentDatabaseItem = databaseManager.currentDatabaseItem;
@@ -135,16 +107,11 @@ class DatabaseTreeDataProvider
public getTreeItem(element: DatabaseItem): TreeItem {
const item = new TreeItem(element.name);
if (element === this.currentDatabaseItem) {
item.iconPath = joinThemableIconPath(
this.extensionPath,
SELECTED_DATABASE_ICON,
);
item.iconPath = new ThemeIcon("check");
item.contextValue = "currentDatabase";
} else if (element.error !== undefined) {
item.iconPath = joinThemableIconPath(
this.extensionPath,
INVALID_DATABASE_ICON,
);
item.iconPath = new ThemeIcon("error", new ThemeColor("errorForeground"));
}
item.tooltip = element.databaseUri.fsPath;
item.description = element.language;
@@ -229,7 +196,7 @@ export class DatabaseUI extends DisposableObject {
super();
this.treeDataProvider = this.push(
new DatabaseTreeDataProvider(databaseManager, extensionPath),
new DatabaseTreeDataProvider(databaseManager),
);
this.push(
window.createTreeView("codeQLDatabases", {