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.Icons
|
||||||
import androidx.compose.material.icons.filled.Check
|
import androidx.compose.material.icons.filled.Check
|
||||||
import androidx.compose.material.icons.filled.Close
|
import androidx.compose.material.icons.filled.Close
|
||||||
|
import javax.swing.JFileChooser
|
||||||
|
import javax.swing.filechooser.FileNameExtensionFilter
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun HomePage(onGlossaireClick: () -> Unit) {
|
fun HomePage(
|
||||||
|
onGlossaireClick: () -> Unit,
|
||||||
|
onCodeAVerifierClick: () -> Unit
|
||||||
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
|
||||||
) {
|
) {
|
||||||
Text("Quali'Nomme", style = MaterialTheme.typography.h3)
|
Text("Quali'Nomme", style = MaterialTheme.typography.h3)
|
||||||
|
|
||||||
|
@ -33,7 +41,7 @@ fun HomePage(onGlossaireClick: () -> Unit) {
|
||||||
Text("Glossaire")
|
Text("Glossaire")
|
||||||
}
|
}
|
||||||
|
|
||||||
Button(onClick = { /* Action de Code à Vérifier */ }) {
|
Button(onClick = onCodeAVerifierClick ) {
|
||||||
Text("Code à Vérifier")
|
Text("Code à Vérifier")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,14 +61,24 @@ fun App() {
|
||||||
when (currentPage.value) {
|
when (currentPage.value) {
|
||||||
"accueil" -> {
|
"accueil" -> {
|
||||||
HomePage(
|
HomePage(
|
||||||
onGlossaireClick = { currentPage.value = "glossaire" }
|
onGlossaireClick = { currentPage.value = "glossaire" },
|
||||||
|
onCodeAVerifierClick = { currentPage.value = "choixLangage" }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
"glossaire" -> {
|
"glossaire" -> {
|
||||||
glossairePage(
|
glossairePage(
|
||||||
onAjouterMotClick = { currentPage.value = "formulaire" },
|
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 */ },
|
onExporterClick = { /* Action d'export */ },
|
||||||
onRetourClick = { currentPage.value = "accueil" }
|
onRetourClick = { currentPage.value = "accueil" }
|
||||||
)
|
)
|
||||||
|
@ -68,11 +86,86 @@ fun App() {
|
||||||
"formulaire" -> {
|
"formulaire" -> {
|
||||||
FormulairePage(onAnnulerClick = { currentPage.value = "glossaire" })
|
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"
|
// ... 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
|
@Composable
|
||||||
fun glossairePage(
|
fun glossairePage(
|
||||||
onAjouterMotClick: () -> Unit,
|
onAjouterMotClick: () -> Unit,
|
||||||
|
|
Loading…
Reference in New Issue