From b422e4c22a883bc5db2ba66e4ca153f288a47321 Mon Sep 17 00:00:00 2001 From: Sebastian Schuberth Date: Thu, 7 Nov 2024 19:29:16 +0100 Subject: [PATCH] deps: update dependency org.jetbrains.compose to v1.7.0 Signed-off-by: Sebastian Schuberth --- build.gradle.kts | 2 + detekt.yml | 7 ++ gradle/libs.versions.toml | 2 +- .../drawable}/advisor.svg | 0 .../drawable}/analyzer.svg | 0 .../drawable}/app-icon/icon.icns | Bin .../drawable}/app-icon/icon.ico | Bin .../drawable}/app-icon/icon.png | Bin .../drawable}/evaluator.svg | 0 .../drawable}/ort-black.png | Bin .../drawable}/ort-white.png | Bin .../drawable}/scanner.svg | 0 src/main/kotlin/Main.kt | 15 ++++- src/main/kotlin/composables/Expandable.kt | 9 ++- src/main/kotlin/composables/ExpandableText.kt | 13 ++-- .../kotlin/composables/FilterTextField.kt | 11 ++-- src/main/kotlin/composables/IconText.kt | 8 +-- src/main/kotlin/composables/Link.kt | 11 ++-- .../kotlin/composables/ListScreenAppBar.kt | 7 +- src/main/kotlin/composables/SeverityIcon.kt | 12 ++-- src/main/kotlin/composables/tree/Tree.kt | 16 +++-- src/main/kotlin/ui/App.kt | 61 +++++++++++++----- src/main/kotlin/ui/Menu.kt | 3 +- src/main/kotlin/ui/MenuItem.kt | 20 +++--- src/main/kotlin/ui/TopBar.kt | 16 +++-- .../kotlin/ui/dependencies/Dependencies.kt | 10 +-- .../ui/packagedetails/PackageDetails.kt | 6 +- src/main/kotlin/ui/packages/Packages.kt | 12 ++-- .../kotlin/ui/summary/EmptyToolInfoCard.kt | 3 +- .../kotlin/ui/summary/ResultFileInfoCard.kt | 7 +- src/main/kotlin/ui/summary/ToolInfoCard.kt | 11 ++-- src/main/kotlin/utils/MaterialIcon.kt | 29 --------- src/main/kotlin/utils/OrtIcon.kt | 14 ++-- src/main/resources/material/account_tree.svg | 1 - src/main/resources/material/add.svg | 1 - src/main/resources/material/arrow_back.svg | 1 - src/main/resources/material/assessment.svg | 1 - .../resources/material/bookmark_border.svg | 1 - src/main/resources/material/bug_report.svg | 1 - .../resources/material/calendar_month.svg | 1 - src/main/resources/material/chevron_right.svg | 1 - src/main/resources/material/close.svg | 1 - src/main/resources/material/error.svg | 1 - src/main/resources/material/expand_less.svg | 1 - src/main/resources/material/expand_more.svg | 1 - src/main/resources/material/file_present.svg | 1 - src/main/resources/material/filter.svg | 1 - src/main/resources/material/filter_list.svg | 1 - src/main/resources/material/gavel.svg | 1 - src/main/resources/material/info.svg | 1 - src/main/resources/material/inventory.svg | 1 - src/main/resources/material/lock_open.svg | 1 - src/main/resources/material/open_in_new.svg | 1 - src/main/resources/material/remove.svg | 1 - src/main/resources/material/search.svg | 1 - src/main/resources/material/settings.svg | 1 - src/main/resources/material/timelapse.svg | 1 - src/main/resources/material/warning.svg | 1 - 58 files changed, 168 insertions(+), 162 deletions(-) rename src/main/{resources => composeResources/drawable}/advisor.svg (100%) rename src/main/{resources => composeResources/drawable}/analyzer.svg (100%) rename src/main/{resources => composeResources/drawable}/app-icon/icon.icns (100%) rename src/main/{resources => composeResources/drawable}/app-icon/icon.ico (100%) rename src/main/{resources => composeResources/drawable}/app-icon/icon.png (100%) rename src/main/{resources => composeResources/drawable}/evaluator.svg (100%) rename src/main/{resources => composeResources/drawable}/ort-black.png (100%) rename src/main/{resources => composeResources/drawable}/ort-white.png (100%) rename src/main/{resources => composeResources/drawable}/scanner.svg (100%) delete mode 100644 src/main/kotlin/utils/MaterialIcon.kt delete mode 100644 src/main/resources/material/account_tree.svg delete mode 100644 src/main/resources/material/add.svg delete mode 100644 src/main/resources/material/arrow_back.svg delete mode 100644 src/main/resources/material/assessment.svg delete mode 100644 src/main/resources/material/bookmark_border.svg delete mode 100644 src/main/resources/material/bug_report.svg delete mode 100644 src/main/resources/material/calendar_month.svg delete mode 100644 src/main/resources/material/chevron_right.svg delete mode 100644 src/main/resources/material/close.svg delete mode 100644 src/main/resources/material/error.svg delete mode 100644 src/main/resources/material/expand_less.svg delete mode 100644 src/main/resources/material/expand_more.svg delete mode 100644 src/main/resources/material/file_present.svg delete mode 100644 src/main/resources/material/filter.svg delete mode 100644 src/main/resources/material/filter_list.svg delete mode 100644 src/main/resources/material/gavel.svg delete mode 100644 src/main/resources/material/info.svg delete mode 100644 src/main/resources/material/inventory.svg delete mode 100644 src/main/resources/material/lock_open.svg delete mode 100644 src/main/resources/material/open_in_new.svg delete mode 100644 src/main/resources/material/remove.svg delete mode 100644 src/main/resources/material/search.svg delete mode 100644 src/main/resources/material/settings.svg delete mode 100644 src/main/resources/material/timelapse.svg delete mode 100644 src/main/resources/material/warning.svg diff --git a/build.gradle.kts b/build.gradle.kts index 7783822..633857b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -45,7 +45,9 @@ repositories { } dependencies { + implementation(compose.components.resources) implementation(compose.desktop.currentOs) + implementation(compose.materialIconsExtended) implementation(libs.bundles.ort) implementation(libs.bundles.richtext) implementation(libs.dataTableMaterial) diff --git a/detekt.yml b/detekt.yml index c217c9e..2d2da39 100644 --- a/detekt.yml +++ b/detekt.yml @@ -23,6 +23,8 @@ formatting: active: false MaximumLineLength: active: false + NoWildcardImports: + active: false naming: FunctionNaming: @@ -42,6 +44,11 @@ style: UnusedPrivateMember: active: true ignoreAnnotated: ['Preview'] + WildcardImport: + excludeImports: + - 'androidx.compose.material.icons.automirrored.filled.*' + - 'androidx.compose.material.icons.filled.*' + - 'org.ossreviewtoolkit.workbench.ort_workbench.generated.resources.*' ORT: OrtImportOrder: diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index aba8443..ba9010d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] detektPlugin = "1.23.7" -composePlugin = "1.6.11" +composePlugin = "1.7.0" kotlinPlugin = "2.0.21" versionsPlugin = "0.51.0" diff --git a/src/main/resources/advisor.svg b/src/main/composeResources/drawable/advisor.svg similarity index 100% rename from src/main/resources/advisor.svg rename to src/main/composeResources/drawable/advisor.svg diff --git a/src/main/resources/analyzer.svg b/src/main/composeResources/drawable/analyzer.svg similarity index 100% rename from src/main/resources/analyzer.svg rename to src/main/composeResources/drawable/analyzer.svg diff --git a/src/main/resources/app-icon/icon.icns b/src/main/composeResources/drawable/app-icon/icon.icns similarity index 100% rename from src/main/resources/app-icon/icon.icns rename to src/main/composeResources/drawable/app-icon/icon.icns diff --git a/src/main/resources/app-icon/icon.ico b/src/main/composeResources/drawable/app-icon/icon.ico similarity index 100% rename from src/main/resources/app-icon/icon.ico rename to src/main/composeResources/drawable/app-icon/icon.ico diff --git a/src/main/resources/app-icon/icon.png b/src/main/composeResources/drawable/app-icon/icon.png similarity index 100% rename from src/main/resources/app-icon/icon.png rename to src/main/composeResources/drawable/app-icon/icon.png diff --git a/src/main/resources/evaluator.svg b/src/main/composeResources/drawable/evaluator.svg similarity index 100% rename from src/main/resources/evaluator.svg rename to src/main/composeResources/drawable/evaluator.svg diff --git a/src/main/resources/ort-black.png b/src/main/composeResources/drawable/ort-black.png similarity index 100% rename from src/main/resources/ort-black.png rename to src/main/composeResources/drawable/ort-black.png diff --git a/src/main/resources/ort-white.png b/src/main/composeResources/drawable/ort-white.png similarity index 100% rename from src/main/resources/ort-white.png rename to src/main/composeResources/drawable/ort-white.png diff --git a/src/main/resources/scanner.svg b/src/main/composeResources/drawable/scanner.svg similarity index 100% rename from src/main/resources/scanner.svg rename to src/main/composeResources/drawable/scanner.svg diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt index c0372de..5cf3982 100644 --- a/src/main/kotlin/Main.kt +++ b/src/main/kotlin/Main.kt @@ -1,25 +1,34 @@ package org.ossreviewtoolkit.workbench import androidx.compose.ui.graphics.painter.BitmapPainter -import androidx.compose.ui.res.loadImageBitmap -import androidx.compose.ui.res.useResource import androidx.compose.ui.unit.DpSize import androidx.compose.ui.unit.dp import androidx.compose.ui.window.WindowState import androidx.compose.ui.window.singleWindowApplication +import java.net.URI + +import org.jetbrains.compose.resources.ExperimentalResourceApi +import org.jetbrains.compose.resources.decodeToImageBitmap + +import org.ossreviewtoolkit.workbench.ort_workbench.generated.resources.Res import org.ossreviewtoolkit.workbench.ui.App import org.ossreviewtoolkit.workbench.ui.WorkbenchController +@OptIn(ExperimentalResourceApi::class) fun main() { val workbenchController = WorkbenchController() + // See https://github.com/JetBrains/compose-multiplatform/issues/2369. + val iconBytes = URI.create(Res.getUri("drawable/app-icon/icon.png")).toURL().readBytes() + val icon = BitmapPainter(iconBytes.decodeToImageBitmap()) + singleWindowApplication( title = "ORT Workbench", state = WindowState( size = DpSize(1440.dp, 810.dp) ), - icon = BitmapPainter(useResource("app-icon/icon.png", ::loadImageBitmap)) + icon = icon ) { App(workbenchController) } diff --git a/src/main/kotlin/composables/Expandable.kt b/src/main/kotlin/composables/Expandable.kt index 36e65d8..80dec19 100644 --- a/src/main/kotlin/composables/Expandable.kt +++ b/src/main/kotlin/composables/Expandable.kt @@ -10,13 +10,12 @@ import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.Row import androidx.compose.material.Icon import androidx.compose.material.IconButton +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource - -import org.ossreviewtoolkit.workbench.utils.MaterialIcon @Composable fun Expandable( @@ -35,8 +34,8 @@ fun Expandable( onClick = { expanded.targetState = !expanded.currentState }, modifier = Modifier.align(Alignment.Top) ) { - val resource = (if (expanded.currentState) MaterialIcon.EXPAND_LESS else MaterialIcon.EXPAND_MORE).resource - Icon(painterResource(resource), "expand") + val image = if (expanded.currentState) Icons.Default.ExpandLess else Icons.Default.ExpandMore + Icon(image, "expand") } } diff --git a/src/main/kotlin/composables/ExpandableText.kt b/src/main/kotlin/composables/ExpandableText.kt index fc765c5..217ac5a 100644 --- a/src/main/kotlin/composables/ExpandableText.kt +++ b/src/main/kotlin/composables/ExpandableText.kt @@ -7,13 +7,14 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.material.Icon import androidx.compose.material.Text +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp @@ -21,8 +22,6 @@ import androidx.compose.ui.unit.dp import com.halilibo.richtext.markdown.Markdown import com.halilibo.richtext.ui.material.RichText -import org.ossreviewtoolkit.workbench.utils.MaterialIcon - @Composable fun ExpandableText(text: String, unexpandedHeight: Dp = 20.dp, fontFamily: FontFamily? = null) { var expanded by rememberSaveable { mutableStateOf(false) } @@ -31,8 +30,8 @@ fun ExpandableText(text: String, unexpandedHeight: Dp = 20.dp, fontFamily: FontF Row(modifier = modifier.animateContentSize()) { Text(text, modifier = Modifier.weight(1f), fontFamily = fontFamily) - val resource = (if (expanded) MaterialIcon.EXPAND_LESS else MaterialIcon.EXPAND_MORE).resource - Icon(painterResource(resource), "expand", modifier = Modifier.clickable { expanded = !expanded }) + val image = if (expanded) Icons.Default.ExpandLess else Icons.Default.ExpandMore + Icon(image, "expand", modifier = Modifier.clickable { expanded = !expanded }) } } @@ -46,7 +45,7 @@ fun ExpandableMarkdown(text: String, unexpandedHeight: Dp = 20.dp) { Markdown(text) } - val resource = (if (expanded) MaterialIcon.EXPAND_LESS else MaterialIcon.EXPAND_MORE).resource - Icon(painterResource(resource), "expand", modifier = Modifier.clickable { expanded = !expanded }) + val image = if (expanded) Icons.Default.ExpandLess else Icons.Default.ExpandMore + Icon(image, "expand", modifier = Modifier.clickable { expanded = !expanded }) } } diff --git a/src/main/kotlin/composables/FilterTextField.kt b/src/main/kotlin/composables/FilterTextField.kt index e7ac161..e6e2458 100644 --- a/src/main/kotlin/composables/FilterTextField.kt +++ b/src/main/kotlin/composables/FilterTextField.kt @@ -9,6 +9,8 @@ import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.material.TextField import androidx.compose.material.TextFieldDefaults +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -16,20 +18,17 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import androidx.compose.ui.res.painterResource +import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.unit.dp -import org.ossreviewtoolkit.workbench.utils.MaterialIcon - @Composable fun FilterTextField( filterText: String, label: String = "Filter", - icon: MaterialIcon = MaterialIcon.FILTER, + image: ImageVector = Icons.Default.Filter, modifier: Modifier = Modifier, onFilterChange: (String) -> Unit ) { - val filterIcon = painterResource(icon.resource) var localFilterText by remember(filterText) { mutableStateOf(filterText) } TextField( @@ -40,7 +39,7 @@ fun FilterTextField( }, placeholder = { Text(label) }, singleLine = true, - leadingIcon = { Icon(filterIcon, label) }, + leadingIcon = { Icon(image, label) }, shape = RoundedCornerShape(10.dp), colors = TextFieldDefaults.textFieldColors( focusedIndicatorColor = Color.Transparent, diff --git a/src/main/kotlin/composables/IconText.kt b/src/main/kotlin/composables/IconText.kt index d25e32c..324ec3d 100644 --- a/src/main/kotlin/composables/IconText.kt +++ b/src/main/kotlin/composables/IconText.kt @@ -4,14 +4,14 @@ import androidx.compose.desktop.ui.tooling.preview.Preview import androidx.compose.foundation.layout.Row import androidx.compose.material.Icon import androidx.compose.material.Text +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.scale import androidx.compose.ui.graphics.painter.Painter -import androidx.compose.ui.res.painterResource - -import org.ossreviewtoolkit.workbench.utils.MaterialIcon +import androidx.compose.ui.graphics.vector.rememberVectorPainter private const val ICON_SCALE = 0.6f @@ -36,7 +36,7 @@ fun IconText( private fun IconTextPreview() { Preview { IconText( - icon = painterResource(MaterialIcon.BUG_REPORT.resource), + icon = rememberVectorPainter(Icons.Default.BugReport), text = "Issues" ) } diff --git a/src/main/kotlin/composables/Link.kt b/src/main/kotlin/composables/Link.kt index 588df1e..9123d7f 100644 --- a/src/main/kotlin/composables/Link.kt +++ b/src/main/kotlin/composables/Link.kt @@ -13,17 +13,18 @@ import androidx.compose.material.Icon import androidx.compose.material.LocalContentAlpha import androidx.compose.material.MaterialTheme import androidx.compose.material.Text +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.* import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.painter.Painter -import androidx.compose.ui.res.painterResource +import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.unit.dp import java.io.File -import org.ossreviewtoolkit.workbench.utils.MaterialIcon import org.ossreviewtoolkit.workbench.utils.browseDirectory import org.ossreviewtoolkit.workbench.utils.editFile import org.ossreviewtoolkit.workbench.utils.openUrlInBrowser @@ -75,21 +76,21 @@ private fun LinkPreview() { @Composable fun BrowseDirectoryLink(text: String, file: File) { - Link(text, tooltip = file.path, icon = painterResource(MaterialIcon.OPEN_IN_NEW.resource)) { + Link(text, tooltip = file.path, icon = rememberVectorPainter(Icons.AutoMirrored.Default.OpenInNew)) { browseDirectory(file) } } @Composable fun EditFileLink(text: String, file: File) { - Link(text, tooltip = file.path, icon = painterResource(MaterialIcon.OPEN_IN_NEW.resource)) { + Link(text, tooltip = file.path, icon = rememberVectorPainter(Icons.AutoMirrored.Default.OpenInNew)) { editFile(file) } } @Composable fun WebLink(text: String, url: String) { - Link(text, tooltip = url, icon = painterResource(MaterialIcon.OPEN_IN_NEW.resource)) { + Link(text, tooltip = url, icon = rememberVectorPainter(Icons.AutoMirrored.Default.OpenInNew)) { openUrlInBrowser(url) } } diff --git a/src/main/kotlin/composables/ListScreenAppBar.kt b/src/main/kotlin/composables/ListScreenAppBar.kt index 0cade92..c9d35bc 100644 --- a/src/main/kotlin/composables/ListScreenAppBar.kt +++ b/src/main/kotlin/composables/ListScreenAppBar.kt @@ -6,13 +6,12 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material.Icon import androidx.compose.material.IconButton +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp -import org.ossreviewtoolkit.workbench.utils.MaterialIcon - @Composable fun ListScreenAppBar( filterText: String, @@ -27,7 +26,7 @@ fun ListScreenAppBar( IconButton(onClick = onToggleFilter) { Icon( - painterResource(MaterialIcon.FILTER_LIST.resource), + Icons.Default.FilterList, contentDescription = "Filter", modifier = Modifier.size(32.dp) ) diff --git a/src/main/kotlin/composables/SeverityIcon.kt b/src/main/kotlin/composables/SeverityIcon.kt index c59fffa..7218b3e 100644 --- a/src/main/kotlin/composables/SeverityIcon.kt +++ b/src/main/kotlin/composables/SeverityIcon.kt @@ -4,9 +4,10 @@ import androidx.compose.desktop.ui.tooling.preview.Preview import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.size import androidx.compose.material.Icon +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp @@ -15,14 +16,13 @@ import org.ossreviewtoolkit.workbench.theme.Error import org.ossreviewtoolkit.workbench.theme.Hint import org.ossreviewtoolkit.workbench.theme.LightGray import org.ossreviewtoolkit.workbench.theme.Warning -import org.ossreviewtoolkit.workbench.utils.MaterialIcon @Composable fun SeverityIcon(severity: Severity, resolved: Boolean = false, size: Dp = 24.dp) { val icon = when (severity) { - Severity.HINT -> MaterialIcon.INFO - Severity.WARNING -> MaterialIcon.WARNING - Severity.ERROR -> MaterialIcon.ERROR + Severity.HINT -> Icons.Default.Info + Severity.WARNING -> Icons.Default.Warning + Severity.ERROR -> Icons.Default.Error } val tint = if (resolved) { @@ -36,7 +36,7 @@ fun SeverityIcon(severity: Severity, resolved: Boolean = false, size: Dp = 24.dp } Icon( - painterResource(icon.resource), + icon, contentDescription = severity.name, tint = tint, modifier = Modifier.size(size) diff --git a/src/main/kotlin/composables/tree/Tree.kt b/src/main/kotlin/composables/tree/Tree.kt index e371c65..1c47ab2 100644 --- a/src/main/kotlin/composables/tree/Tree.kt +++ b/src/main/kotlin/composables/tree/Tree.kt @@ -12,23 +12,25 @@ import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.material.Icon import androidx.compose.material.Text +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.input.key.Key import androidx.compose.ui.input.key.KeyEvent import androidx.compose.ui.input.key.KeyEventType import androidx.compose.ui.input.key.key import androidx.compose.ui.input.key.onKeyEvent import androidx.compose.ui.input.key.type -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import org.ossreviewtoolkit.workbench.composables.Preview -import org.ossreviewtoolkit.workbench.utils.MaterialIcon @Composable fun Tree( @@ -37,8 +39,8 @@ fun Tree( startExpanded: Boolean = false, listState: LazyListState = rememberLazyListState(), indentation: Dp = 5.dp, - expandIcon: MaterialIcon = MaterialIcon.CHEVRON_RIGHT, - expandedIcon: MaterialIcon = MaterialIcon.EXPAND_MORE, + expandIcon: ImageVector = Icons.Default.ChevronRight, + expandedIcon: ImageVector = Icons.Default.ExpandMore, iconSize: Dp = 12.dp, itemContent: @Composable (item: TreeItem, isSelected: Boolean) -> Unit = { item, isSelected -> DefaultItemContent(item, isSelected) @@ -62,8 +64,8 @@ fun Tree( state: TreeState, listState: LazyListState = rememberLazyListState(), indentation: Dp = 5.dp, - expandIcon: MaterialIcon = MaterialIcon.CHEVRON_RIGHT, - expandedIcon: MaterialIcon = MaterialIcon.EXPAND_MORE, + expandIcon: ImageVector = Icons.Default.ChevronRight, + expandedIcon: ImageVector = Icons.Default.ExpandMore, iconSize: Dp = 12.dp, itemContent: @Composable (item: TreeItem, isSelected: Boolean) -> Unit = { item, isSelected -> DefaultItemContent(item, isSelected) @@ -127,7 +129,7 @@ fun Tree( if (icon != null) { Icon( - painter = painterResource(icon.resource), + painter = rememberVectorPainter(icon), contentDescription = null, modifier = Modifier.size(iconSize).clickable { state.toggleExpanded(item) } ) diff --git a/src/main/kotlin/ui/App.kt b/src/main/kotlin/ui/App.kt index 29694b1..c6c4204 100644 --- a/src/main/kotlin/ui/App.kt +++ b/src/main/kotlin/ui/App.kt @@ -1,6 +1,8 @@ package org.ossreviewtoolkit.workbench.ui +import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.Image +import androidx.compose.foundation.draganddrop.dragAndDropTarget import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -19,17 +21,21 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment -import androidx.compose.ui.DragData import androidx.compose.ui.Modifier -import androidx.compose.ui.onExternalDrag -import androidx.compose.ui.res.painterResource +import androidx.compose.ui.draganddrop.DragAndDropEvent +import androidx.compose.ui.draganddrop.DragAndDropTarget +import androidx.compose.ui.draganddrop.DragAndDropTransferAction +import androidx.compose.ui.draganddrop.awtTransferable import androidx.compose.ui.unit.dp +import java.awt.datatransfer.DataFlavor import java.io.File -import java.net.URI import kotlinx.coroutines.flow.combine import kotlinx.coroutines.launch +import kotlinx.coroutines.runBlocking + +import org.jetbrains.compose.resources.imageResource import org.ossreviewtoolkit.model.Identifier import org.ossreviewtoolkit.utils.common.enumSetOf @@ -41,6 +47,9 @@ import org.ossreviewtoolkit.workbench.navigation.BackstackEntry import org.ossreviewtoolkit.workbench.navigation.NavController import org.ossreviewtoolkit.workbench.navigation.NavHost import org.ossreviewtoolkit.workbench.navigation.viewModel +import org.ossreviewtoolkit.workbench.ort_workbench.generated.resources.Res +import org.ossreviewtoolkit.workbench.ort_workbench.generated.resources.ort_black +import org.ossreviewtoolkit.workbench.ort_workbench.generated.resources.ort_white import org.ossreviewtoolkit.workbench.theme.OrtWorkbenchTheme import org.ossreviewtoolkit.workbench.ui.dependencies.Dependencies import org.ossreviewtoolkit.workbench.ui.issues.Issues @@ -52,6 +61,7 @@ import org.ossreviewtoolkit.workbench.ui.summary.Summary import org.ossreviewtoolkit.workbench.ui.violations.Violations import org.ossreviewtoolkit.workbench.ui.vulnerabilities.Vulnerabilities +@OptIn(ExperimentalFoundationApi::class) @Composable fun App(controller: WorkbenchController) { val settings by controller.settings.collectAsState() @@ -74,18 +84,37 @@ fun App(controller: WorkbenchController) { OrtWorkbenchTheme(settings.theme) { var isDragging by remember { mutableStateOf(false) } - Surface( - modifier = Modifier.onExternalDrag( - onDragStart = { isDragging = true }, - onDragExit = { isDragging = false }, - onDrop = { state -> - val data = state.dragData - if (data is DragData.FilesList) { - val files = data.readFiles().map { File(URI(it)) } - scope.launch { files.forEach { file -> controller.openOrtResult(file) } } - } + val dragAndDropTarget = remember { + object : DragAndDropTarget { + override fun onStarted(event: DragAndDropEvent) { + isDragging = true + } + + override fun onEnded(event: DragAndDropEvent) { isDragging = false } + + override fun onDrop(event: DragAndDropEvent): Boolean { + with(event.awtTransferable) { + if (!isDataFlavorSupported(DataFlavor.javaFileListFlavor)) return false + + @Suppress("UNCHECKED_CAST") + val files = getTransferData(DataFlavor.javaFileListFlavor) as List + + runBlocking { + files.forEach { file -> controller.openOrtResult(file) } + } + + return true + } + } + } + } + + Surface( + modifier = Modifier.dragAndDropTarget( + shouldStartDragAndDrop = { it.action == DragAndDropTransferAction.Copy }, + target = dragAndDropTarget ), color = when { isDragging -> MaterialTheme.colors.primaryVariant @@ -221,9 +250,9 @@ private fun LoadResult(controller: WorkbenchController, onLoadResult: () -> Unit verticalArrangement = Arrangement.spacedBy(25.dp, alignment = Alignment.CenterVertically), horizontalAlignment = Alignment.CenterHorizontally ) { - val image = if (MaterialTheme.colors.isLight) "ort-black.png" else "ort-white.png" + val resource = if (MaterialTheme.colors.isLight) Res.drawable.ort_black else Res.drawable.ort_white - Image(painter = painterResource(image), contentDescription = "OSS Review Toolkit") + Image(imageResource(resource), contentDescription = "OSS Review Toolkit") if (apiState in listOf(OrtApiState.LOADING_RESULT, OrtApiState.PROCESSING_RESULT)) { CircularProgressIndicator() diff --git a/src/main/kotlin/ui/Menu.kt b/src/main/kotlin/ui/Menu.kt index 3feb1c9..54101b3 100644 --- a/src/main/kotlin/ui/Menu.kt +++ b/src/main/kotlin/ui/Menu.kt @@ -26,7 +26,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp @@ -131,7 +130,7 @@ fun MenuRow(item: MenuItem, currentItem: MenuItem?, apiState: OrtApiState, onSel horizontalArrangement = Arrangement.spacedBy(5.dp), verticalAlignment = Alignment.CenterVertically, ) { - Icon(painterResource(item.icon.resource), item.name) + Icon(item.icon, item.name) Text( text = item.name.enumcase(), diff --git a/src/main/kotlin/ui/MenuItem.kt b/src/main/kotlin/ui/MenuItem.kt index d9109e4..1ab3ef9 100644 --- a/src/main/kotlin/ui/MenuItem.kt +++ b/src/main/kotlin/ui/MenuItem.kt @@ -1,13 +1,15 @@ package org.ossreviewtoolkit.workbench.ui -import org.ossreviewtoolkit.workbench.utils.MaterialIcon +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* +import androidx.compose.ui.graphics.vector.ImageVector -enum class MenuItem(val icon: MaterialIcon) { - SUMMARY(MaterialIcon.ASSESSMENT), - PACKAGES(MaterialIcon.INVENTORY), - DEPENDENCIES(MaterialIcon.ACCOUNT_TREE), - ISSUES(MaterialIcon.BUG_REPORT), - RULE_VIOLATIONS(MaterialIcon.GAVEL), - VULNERABILITIES(MaterialIcon.LOCK_OPEN), - SETTINGS(MaterialIcon.SETTINGS) +enum class MenuItem(val icon: ImageVector) { + SUMMARY(Icons.Default.Assessment), + PACKAGES(Icons.Default.Inventory), + DEPENDENCIES(Icons.Default.AccountTree), + ISSUES(Icons.Default.BugReport), + RULE_VIOLATIONS(Icons.Default.Gavel), + VULNERABILITIES(Icons.Default.LockOpen), + SETTINGS(Icons.Default.Settings) } diff --git a/src/main/kotlin/ui/TopBar.kt b/src/main/kotlin/ui/TopBar.kt index c41de44..9bc5532 100644 --- a/src/main/kotlin/ui/TopBar.kt +++ b/src/main/kotlin/ui/TopBar.kt @@ -19,6 +19,8 @@ import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.material.TextButton import androidx.compose.material.TopAppBar +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.getValue @@ -28,16 +30,18 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.zIndex +import org.jetbrains.compose.resources.imageResource + import org.ossreviewtoolkit.workbench.composables.conditional import org.ossreviewtoolkit.workbench.model.OrtModelInfo -import org.ossreviewtoolkit.workbench.utils.MaterialIcon +import org.ossreviewtoolkit.workbench.ort_workbench.generated.resources.Res +import org.ossreviewtoolkit.workbench.ort_workbench.generated.resources.ort_white @Composable fun TopBar( @@ -49,7 +53,7 @@ fun TopBar( ) { TopAppBar(modifier = Modifier.zIndex(zIndex = 5f), backgroundColor = MaterialTheme.colors.primaryVariant) { Image( - painter = painterResource("ort-white.png"), + imageResource(Res.drawable.ort_white), contentDescription = "OSS Review Toolkit", contentScale = ContentScale.FillHeight, modifier = Modifier.padding(vertical = 10.dp).width(200.dp) @@ -82,8 +86,8 @@ fun OrtModelSelector( CompositionLocalProvider(LocalContentColor provides MaterialTheme.colors.onPrimary) { Text(selectedOrtModel?.name ?: "") - val resource = (if (expanded) MaterialIcon.EXPAND_LESS else MaterialIcon.EXPAND_MORE).resource - Icon(painterResource(resource), if (expanded) "expand" else "collapse") + val image = if (expanded) Icons.Default.ExpandLess else Icons.Default.ExpandMore + Icon(image, if (expanded) "expand" else "collapse") } } @@ -119,7 +123,7 @@ fun OrtModelSelector( IconButton(onClick = { onCloseModel(modelInfo) }) { Icon( - painterResource(MaterialIcon.CLOSE.resource), + Icons.Default.Close, contentDescription = "close", modifier = Modifier.size(16.dp) ) diff --git a/src/main/kotlin/ui/dependencies/Dependencies.kt b/src/main/kotlin/ui/dependencies/Dependencies.kt index a130da3..f2dae72 100644 --- a/src/main/kotlin/ui/dependencies/Dependencies.kt +++ b/src/main/kotlin/ui/dependencies/Dependencies.kt @@ -21,6 +21,8 @@ import androidx.compose.material.Icon import androidx.compose.material.MaterialTheme import androidx.compose.material.ProvideTextStyle import androidx.compose.material.Text +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.remember @@ -33,7 +35,6 @@ import androidx.compose.ui.input.key.KeyEventType import androidx.compose.ui.input.key.key import androidx.compose.ui.input.key.onKeyEvent import androidx.compose.ui.input.key.type -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp @@ -73,7 +74,6 @@ import org.ossreviewtoolkit.workbench.composables.WebLink import org.ossreviewtoolkit.workbench.composables.toStringOrDash import org.ossreviewtoolkit.workbench.composables.tree.Tree import org.ossreviewtoolkit.workbench.composables.tree.TreeItem -import org.ossreviewtoolkit.workbench.utils.MaterialIcon @Composable fun Dependencies(viewModel: DependenciesViewModel) { @@ -205,7 +205,7 @@ private fun Search( FilterTextField( filterText = search, label = "Search", - icon = MaterialIcon.SEARCH, + image = Icons.Default.Search, modifier = Modifier.onKeyEvent(::handleSearchKeyEvent), onSearchChange ) @@ -220,13 +220,13 @@ private fun Search( Text("${searchCurrentHit + 1} / $searchTotalHits", modifier = Modifier.padding(start = 10.dp)) Icon( - painterResource(MaterialIcon.EXPAND_LESS.resource), + imageVector = Icons.Default.ExpandLess, contentDescription = "previous", modifier = Modifier.clickable { onSelectPreviousSearchHit() } ) Icon( - painterResource(MaterialIcon.EXPAND_MORE.resource), + imageVector = Icons.Default.ExpandMore, contentDescription = "next", modifier = Modifier.clickable { onSelectNextSearchHit() } ) diff --git a/src/main/kotlin/ui/packagedetails/PackageDetails.kt b/src/main/kotlin/ui/packagedetails/PackageDetails.kt index b4f7104..94045dd 100644 --- a/src/main/kotlin/ui/packagedetails/PackageDetails.kt +++ b/src/main/kotlin/ui/packagedetails/PackageDetails.kt @@ -24,6 +24,8 @@ import androidx.compose.material.MaterialTheme import androidx.compose.material.Tab import androidx.compose.material.TabRow import androidx.compose.material.Text +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.* import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -31,7 +33,6 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp @@ -44,7 +45,6 @@ import org.ossreviewtoolkit.model.licenses.ResolvedLicenseInfo import org.ossreviewtoolkit.workbench.composables.ScreenAppBar import org.ossreviewtoolkit.workbench.composables.WebLink import org.ossreviewtoolkit.workbench.composables.toStringOrDash -import org.ossreviewtoolkit.workbench.utils.MaterialIcon private const val TAB_METADATA = 0 private const val TAB_SCAN_RESULTS = 1 @@ -62,7 +62,7 @@ fun PackageDetails(state: PackageDetailsState, onBack: () -> Unit) { navigationIcon = { IconButton(onClick = onBack) { Icon( - painterResource(MaterialIcon.ARROW_BACK.resource), + Icons.AutoMirrored.Default.ArrowBack, contentDescription = "Back", modifier = Modifier.size(32.dp) ) diff --git a/src/main/kotlin/ui/packages/Packages.kt b/src/main/kotlin/ui/packages/Packages.kt index b664568..b098867 100644 --- a/src/main/kotlin/ui/packages/Packages.kt +++ b/src/main/kotlin/ui/packages/Packages.kt @@ -15,13 +15,14 @@ import androidx.compose.material.Divider import androidx.compose.material.LocalContentAlpha import androidx.compose.material.Text import androidx.compose.material.TextButton +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.collectAsState -import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource +import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp @@ -36,7 +37,6 @@ import org.ossreviewtoolkit.workbench.composables.IconText import org.ossreviewtoolkit.workbench.composables.ListScreenContent import org.ossreviewtoolkit.workbench.composables.ListScreenList import org.ossreviewtoolkit.workbench.composables.Preview -import org.ossreviewtoolkit.workbench.utils.MaterialIcon @Composable fun Packages(viewModel: PackagesViewModel, onSelectPackage: (Identifier) -> Unit) { @@ -127,9 +127,9 @@ fun PackageCard( // TODO: Add links to other view, pre-filtered by this package. // TODO: Take resolutions into account. - IconText(painterResource(MaterialIcon.BUG_REPORT.resource), issues.toString()) - IconText(painterResource(MaterialIcon.GAVEL.resource), ruleViolations.toString()) - IconText(painterResource(MaterialIcon.LOCK_OPEN.resource), vulnerabilities.toString()) + IconText(rememberVectorPainter(Icons.Default.BugReport), issues.toString()) + IconText(rememberVectorPainter(Icons.Default.Gavel), ruleViolations.toString()) + IconText(rememberVectorPainter(Icons.Default.LockOpen), vulnerabilities.toString()) TextButton( onClick = onSelectPackage, diff --git a/src/main/kotlin/ui/summary/EmptyToolInfoCard.kt b/src/main/kotlin/ui/summary/EmptyToolInfoCard.kt index 066edf2..fc0e1be 100644 --- a/src/main/kotlin/ui/summary/EmptyToolInfoCard.kt +++ b/src/main/kotlin/ui/summary/EmptyToolInfoCard.kt @@ -3,7 +3,8 @@ package org.ossreviewtoolkit.workbench.ui.summary import androidx.compose.desktop.ui.tooling.preview.Preview import androidx.compose.material.Text import androidx.compose.runtime.Composable -import androidx.compose.ui.res.painterResource + +import org.jetbrains.compose.resources.painterResource import org.ossreviewtoolkit.workbench.composables.Preview import org.ossreviewtoolkit.workbench.composables.StyledCard diff --git a/src/main/kotlin/ui/summary/ResultFileInfoCard.kt b/src/main/kotlin/ui/summary/ResultFileInfoCard.kt index 1dfb03f..aa4eb63 100644 --- a/src/main/kotlin/ui/summary/ResultFileInfoCard.kt +++ b/src/main/kotlin/ui/summary/ResultFileInfoCard.kt @@ -8,10 +8,12 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.material.MaterialTheme import androidx.compose.material.Text +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource +import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.unit.dp import com.halilibo.richtext.markdown.Markdown @@ -29,7 +31,6 @@ import org.ossreviewtoolkit.workbench.composables.SingleLineText import org.ossreviewtoolkit.workbench.composables.StyledCard import org.ossreviewtoolkit.workbench.composables.TwoColumnTable import org.ossreviewtoolkit.workbench.composables.rememberFormattedDatetime -import org.ossreviewtoolkit.workbench.utils.MaterialIcon private const val KIBI = 1024 private const val MEBI = KIBI * KIBI @@ -37,7 +38,7 @@ private const val MEBI = KIBI * KIBI @Composable fun ResultFileInfoCard(info: ResultFileInfo) { StyledCard( - titleIcon = painterResource(MaterialIcon.FILE_PRESENT.resource), + titleIcon = rememberVectorPainter(Icons.Default.FilePresent), title = "ORT Result File" ) { Row(modifier = Modifier.padding(vertical = 15.dp), horizontalArrangement = Arrangement.spacedBy(16.dp)) { diff --git a/src/main/kotlin/ui/summary/ToolInfoCard.kt b/src/main/kotlin/ui/summary/ToolInfoCard.kt index 3219a93..3777a4d 100644 --- a/src/main/kotlin/ui/summary/ToolInfoCard.kt +++ b/src/main/kotlin/ui/summary/ToolInfoCard.kt @@ -16,11 +16,13 @@ import androidx.compose.foundation.verticalScroll import androidx.compose.material.Icon import androidx.compose.material.MaterialTheme import androidx.compose.material.Text +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.* import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource +import androidx.compose.ui.graphics.vector.rememberVectorPainter import androidx.compose.ui.unit.dp import com.halilibo.richtext.markdown.Markdown @@ -28,6 +30,8 @@ import com.halilibo.richtext.ui.CodeBlockStyle import com.halilibo.richtext.ui.RichTextStyle import com.halilibo.richtext.ui.material.RichText +import org.jetbrains.compose.resources.painterResource + import org.ossreviewtoolkit.model.Severity import org.ossreviewtoolkit.reporter.IssueStatistics import org.ossreviewtoolkit.workbench.composables.Datetime @@ -35,7 +39,6 @@ import org.ossreviewtoolkit.workbench.composables.Expandable import org.ossreviewtoolkit.workbench.composables.SeverityIcon import org.ossreviewtoolkit.workbench.composables.StyledCard import org.ossreviewtoolkit.workbench.composables.TwoColumnTable -import org.ossreviewtoolkit.workbench.utils.MaterialIcon import org.ossreviewtoolkit.workbench.utils.OrtIcon private val whiteCodeBlockRichTextStyle = RichTextStyle(codeBlockStyle = CodeBlockStyle(modifier = Modifier)) @@ -60,7 +63,7 @@ fun ToolInfoCard( horizontalArrangement = Arrangement.spacedBy(8.dp) ) { Icon( - painter = painterResource(MaterialIcon.CALENDAR_MONTH.resource), + painter = rememberVectorPainter(Icons.Default.CalendarMonth), contentDescription = "Start time" ) @@ -72,7 +75,7 @@ fun ToolInfoCard( horizontalArrangement = Arrangement.spacedBy(8.dp), ) { Icon( - painter = painterResource(MaterialIcon.TIMELAPSE.resource), + painter = rememberVectorPainter(Icons.Default.Timelapse), contentDescription = "Duration" ) diff --git a/src/main/kotlin/utils/MaterialIcon.kt b/src/main/kotlin/utils/MaterialIcon.kt deleted file mode 100644 index 4a23293..0000000 --- a/src/main/kotlin/utils/MaterialIcon.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.ossreviewtoolkit.workbench.utils - -enum class MaterialIcon(val resource: String) { - ACCOUNT_TREE("material/account_tree.svg"), - ADD("material/add.svg"), - ARROW_BACK("material/arrow_back.svg"), - ASSESSMENT("material/assessment.svg"), - BOOKMARK_BORDER("material/bookmark_border.svg"), - BUG_REPORT("material/bug_report.svg"), - CALENDAR_MONTH("material/calendar_month.svg"), - CHEVRON_RIGHT("material/chevron_right.svg"), - CLOSE("material/close.svg"), - ERROR("material/error.svg"), - EXPAND_LESS("material/expand_less.svg"), - EXPAND_MORE("material/expand_more.svg"), - FILE_PRESENT("material/file_present.svg"), - FILTER("material/filter.svg"), - FILTER_LIST("material/filter_list.svg"), - GAVEL("material/gavel.svg"), - INFO("material/info.svg"), - INVENTORY("material/inventory.svg"), - LOCK_OPEN("material/lock_open.svg"), - OPEN_IN_NEW("material/open_in_new.svg"), - REMOVE("material/remove.svg"), - SEARCH("material/search.svg"), - SETTINGS("material/settings.svg"), - TIMELAPSE("material/timelapse.svg"), - WARNING("material/warning.svg") -} diff --git a/src/main/kotlin/utils/OrtIcon.kt b/src/main/kotlin/utils/OrtIcon.kt index 2d623d7..ae40337 100644 --- a/src/main/kotlin/utils/OrtIcon.kt +++ b/src/main/kotlin/utils/OrtIcon.kt @@ -1,8 +1,12 @@ package org.ossreviewtoolkit.workbench.utils -enum class OrtIcon(val resource: String) { - ADVISOR("advisor.svg"), - ANALYZER("analyzer.svg"), - EVALUATOR("evaluator.svg"), - SCANNER("scanner.svg") +import org.jetbrains.compose.resources.DrawableResource + +import org.ossreviewtoolkit.workbench.ort_workbench.generated.resources.* + +enum class OrtIcon(val resource: DrawableResource) { + ADVISOR(Res.drawable.advisor), + ANALYZER(Res.drawable.analyzer), + EVALUATOR(Res.drawable.evaluator), + SCANNER(Res.drawable.scanner) } diff --git a/src/main/resources/material/account_tree.svg b/src/main/resources/material/account_tree.svg deleted file mode 100644 index ac0c5e1..0000000 --- a/src/main/resources/material/account_tree.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/add.svg b/src/main/resources/material/add.svg deleted file mode 100644 index bead882..0000000 --- a/src/main/resources/material/add.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/arrow_back.svg b/src/main/resources/material/arrow_back.svg deleted file mode 100644 index 5227c9c..0000000 --- a/src/main/resources/material/arrow_back.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/assessment.svg b/src/main/resources/material/assessment.svg deleted file mode 100644 index 756b643..0000000 --- a/src/main/resources/material/assessment.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/bookmark_border.svg b/src/main/resources/material/bookmark_border.svg deleted file mode 100644 index 2295362..0000000 --- a/src/main/resources/material/bookmark_border.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/bug_report.svg b/src/main/resources/material/bug_report.svg deleted file mode 100644 index f4073c5..0000000 --- a/src/main/resources/material/bug_report.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/calendar_month.svg b/src/main/resources/material/calendar_month.svg deleted file mode 100644 index f0eb348..0000000 --- a/src/main/resources/material/calendar_month.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/chevron_right.svg b/src/main/resources/material/chevron_right.svg deleted file mode 100644 index 7909259..0000000 --- a/src/main/resources/material/chevron_right.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/close.svg b/src/main/resources/material/close.svg deleted file mode 100644 index 8570240..0000000 --- a/src/main/resources/material/close.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/error.svg b/src/main/resources/material/error.svg deleted file mode 100644 index 19bd916..0000000 --- a/src/main/resources/material/error.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/expand_less.svg b/src/main/resources/material/expand_less.svg deleted file mode 100644 index 72c48c9..0000000 --- a/src/main/resources/material/expand_less.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/expand_more.svg b/src/main/resources/material/expand_more.svg deleted file mode 100644 index 79fe936..0000000 --- a/src/main/resources/material/expand_more.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/file_present.svg b/src/main/resources/material/file_present.svg deleted file mode 100644 index 7cf5dfe..0000000 --- a/src/main/resources/material/file_present.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/filter.svg b/src/main/resources/material/filter.svg deleted file mode 100644 index 871cf7f..0000000 --- a/src/main/resources/material/filter.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/filter_list.svg b/src/main/resources/material/filter_list.svg deleted file mode 100644 index 6b5bda9..0000000 --- a/src/main/resources/material/filter_list.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/gavel.svg b/src/main/resources/material/gavel.svg deleted file mode 100644 index 5c905e3..0000000 --- a/src/main/resources/material/gavel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/info.svg b/src/main/resources/material/info.svg deleted file mode 100644 index d6564d6..0000000 --- a/src/main/resources/material/info.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/inventory.svg b/src/main/resources/material/inventory.svg deleted file mode 100644 index 56685cb..0000000 --- a/src/main/resources/material/inventory.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/lock_open.svg b/src/main/resources/material/lock_open.svg deleted file mode 100644 index ff8ff01..0000000 --- a/src/main/resources/material/lock_open.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/open_in_new.svg b/src/main/resources/material/open_in_new.svg deleted file mode 100644 index 54db134..0000000 --- a/src/main/resources/material/open_in_new.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/remove.svg b/src/main/resources/material/remove.svg deleted file mode 100644 index d84e9a6..0000000 --- a/src/main/resources/material/remove.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/search.svg b/src/main/resources/material/search.svg deleted file mode 100644 index 7c2111e..0000000 --- a/src/main/resources/material/search.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/settings.svg b/src/main/resources/material/settings.svg deleted file mode 100644 index e40c849..0000000 --- a/src/main/resources/material/settings.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/timelapse.svg b/src/main/resources/material/timelapse.svg deleted file mode 100644 index 43fb54b..0000000 --- a/src/main/resources/material/timelapse.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/main/resources/material/warning.svg b/src/main/resources/material/warning.svg deleted file mode 100644 index 22cf31b..0000000 --- a/src/main/resources/material/warning.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file