Added file import
parent
a8335f51e3
commit
76d7807c44
|
@ -12,15 +12,23 @@ import androidx.compose.ui.unit.dp
|
|||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Check
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import javax.swing.JFileChooser
|
||||
import javax.swing.filechooser.FileNameExtensionFilter
|
||||
import java.io.File
|
||||
|
||||
|
||||
|
||||
|
||||
@Composable
|
||||
fun HomePage(onGlossaireClick: () -> Unit) {
|
||||
fun HomePage(
|
||||
onGlossaireClick: () -> Unit,
|
||||
onCodeAVerifierClick: () -> Unit
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
|
||||
) {
|
||||
Text("Quali'Nomme", style = MaterialTheme.typography.h3)
|
||||
|
||||
|
@ -33,7 +41,7 @@ fun HomePage(onGlossaireClick: () -> Unit) {
|
|||
Text("Glossaire")
|
||||
}
|
||||
|
||||
Button(onClick = { /* Action de Code à Vérifier */ }) {
|
||||
Button(onClick = onCodeAVerifierClick ) {
|
||||
Text("Code à Vérifier")
|
||||
}
|
||||
|
||||
|
@ -53,14 +61,24 @@ fun App() {
|
|||
when (currentPage.value) {
|
||||
"accueil" -> {
|
||||
HomePage(
|
||||
onGlossaireClick = { currentPage.value = "glossaire" }
|
||||
|
||||
onGlossaireClick = { currentPage.value = "glossaire" },
|
||||
onCodeAVerifierClick = { currentPage.value = "choixLangage" }
|
||||
)
|
||||
}
|
||||
"glossaire" -> {
|
||||
glossairePage(
|
||||
onAjouterMotClick = { currentPage.value = "formulaire" },
|
||||
onImporterClick = { /* Action d'import */ },
|
||||
onImporterClick = {
|
||||
val fileChooser = JFileChooser()
|
||||
fileChooser.fileFilter = FileNameExtensionFilter("CSV Files", "csv")
|
||||
val returnVal = fileChooser.showOpenDialog(null)
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
val file = fileChooser.selectedFile
|
||||
println("Opening: " + file.name + ".")
|
||||
} else {
|
||||
println("Open command cancelled by user.")
|
||||
}
|
||||
},
|
||||
onExporterClick = { /* Action d'export */ },
|
||||
onRetourClick = { currentPage.value = "accueil" }
|
||||
)
|
||||
|
@ -68,11 +86,86 @@ fun App() {
|
|||
"formulaire" -> {
|
||||
FormulairePage(onAnnulerClick = { currentPage.value = "glossaire" })
|
||||
}
|
||||
"choixLangage" -> {
|
||||
ChoixLangagePage(
|
||||
onRetourClick = { currentPage.value = "accueil" },
|
||||
onPythonClick = {
|
||||
val fileChooser = JFileChooser()
|
||||
fileChooser.fileFilter = FileNameExtensionFilter("Python Files", "py")
|
||||
val returnVal = fileChooser.showOpenDialog(null)
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
val file = fileChooser.selectedFile
|
||||
println("Opening: " + file.name + ".")
|
||||
} else {
|
||||
println("Open command cancelled by user.")
|
||||
}
|
||||
},
|
||||
onJavaClick = {
|
||||
val fileChooser = JFileChooser()
|
||||
fileChooser.fileFilter = FileNameExtensionFilter("Java Files", "java")
|
||||
val returnVal = fileChooser.showOpenDialog(null)
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
val file = fileChooser.selectedFile
|
||||
println("Opening: " + file.name + ".")
|
||||
} else {
|
||||
println("Open command cancelled by user.")
|
||||
}
|
||||
},
|
||||
onJavaScriptClick = {
|
||||
val fileChooser = JFileChooser()
|
||||
fileChooser.fileFilter = FileNameExtensionFilter("JavaScript Files", "js")
|
||||
val returnVal = fileChooser.showOpenDialog(null)
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
val file = fileChooser.selectedFile
|
||||
println("Opening: " + file.name + ".")
|
||||
} else {
|
||||
println("Open command cancelled by user.")
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
// ... Ajoutez d'autres cas pour les pages "glossaire," "code a verifier," et "comparer"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Composable
|
||||
fun ChoixLangagePage(
|
||||
onRetourClick: () -> Unit,
|
||||
onPythonClick: () -> Unit,
|
||||
onJavaClick: () -> Unit,
|
||||
onJavaScriptClick: () -> Unit
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize() // Fills the maximum available width
|
||||
.padding(16.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
|
||||
) {
|
||||
Text(text = "Choix du langage", style = MaterialTheme.typography.h5)
|
||||
|
||||
Button(onClick = onPythonClick) {
|
||||
Text("Python")
|
||||
}
|
||||
|
||||
Button(onClick = onJavaClick) {
|
||||
Text("Java")
|
||||
}
|
||||
|
||||
Button(onClick = onJavaScriptClick) {
|
||||
Text("JavaScript")
|
||||
}
|
||||
|
||||
Button(onClick = onRetourClick) {
|
||||
Text("Retour")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun glossairePage(
|
||||
onAjouterMotClick: () -> Unit,
|
||||
|
|
Loading…
Reference in New Issue