Added Biome Theme

main
Cemal Odabasioglu 2023-11-23 11:43:20 +01:00
parent 93cce95884
commit 12255f2986
4 changed files with 182 additions and 48 deletions

View File

@ -20,6 +20,22 @@ dependencies {
// (in a separate module for demo project and in testMain). // (in a separate module for demo project and in testMain).
// With compose.desktop.common you will also lose @Preview functionality // With compose.desktop.common you will also lose @Preview functionality
implementation(compose.desktop.currentOs) implementation(compose.desktop.currentOs)
implementation(kotlin("stdlib"))
implementation("mysql:mysql-connector-java:8.0.23")
implementation("org.jetbrains.compose.material:material:1.0.0-beta-02")
implementation("org.jetbrains.compose.ui:ui:1.0.0-beta-02")
implementation("org.jetbrains.compose.foundation:foundation:1.0.0-beta-02")
implementation("org.jetbrains.compose.desktop:desktop:1.0.0-beta-02")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2")
implementation("io.ktor:ktor-client-cio:1.6.3")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30")
implementation("com.almworks.sqlite4java:sqlite4java:1.0.392")
implementation("io.ktor:ktor-server-netty:1.6.3")
implementation("io.ktor:ktor-html-builder:1.6.3")
} }
compose.desktop { compose.desktop {

View File

@ -1,15 +0,0 @@
import java.sql.DriverManager
// the model class
data class User(val id: Int, val name: String)
fun main(){
val connection = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/sae",
"root", "0000");
// prints true if the connection is valid
println(connection.isValid(0))
}

View File

@ -0,0 +1,45 @@
package database
import java.sql.Connection
import java.sql.DriverManager
import java.sql.SQLException
object DatabaseManager {
private var connection: Connection? = null
// Chargez le pilote JDBC
fun connect() {
try
{
Class.forName("com.mysql.cj.jdbc.Driver")
} catch (e: ClassNotFoundException)
{
println("Erreur lors du chargement du pilote JDBC")
e.printStackTrace()
return
}
// Informations de connexion à la base de données
val url = "jdbc:mysql://qualinommedb.odabasioglu.fr:3307"
val utilisateur = "QualiNommeUser"
val motDePasse = "QualiNommeDB"
try
{
connection = DriverManager.getConnection(url, utilisateur, motDePasse)
} catch (e: SQLException)
{
println("Erreur lors de la connexion à la base de données")
e.printStackTrace()
}
}
fun getConnection(): Connection? {
return connection
}
}
fun main() {
DatabaseManager.connect()
}

View File

@ -1,5 +1,7 @@
package main
import androidx.compose.desktop.ui.tooling.preview.Preview import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.foundation.hoverable import androidx.compose.foundation.Image
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
@ -13,22 +15,17 @@ import androidx.compose.material.icons.filled.Check
import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Close
import java.awt.FileDialog import java.awt.FileDialog
import java.awt.Frame import java.awt.Frame
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.unit.dp
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Button import androidx.compose.material.Button
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
import androidx.compose.material.lightColors
import androidx.compose.runtime.* import androidx.compose.runtime.*
import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.input.pointer.pointerMoveFilter import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.window.* import androidx.compose.ui.window.*
import database.DatabaseManager
val connection = DatabaseManager.getConnection()
val customRedColor = Color(0xFFB70D1B)
@OptIn(ExperimentalComposeUiApi::class) @OptIn(ExperimentalComposeUiApi::class)
@Composable @Composable
@ -52,16 +49,29 @@ fun HomePage(
horizontalArrangement = Arrangement.spacedBy(16.dp) horizontalArrangement = Arrangement.spacedBy(16.dp)
) { ) {
Button( Button(
onClick = onGlossaireClick onClick = onGlossaireClick,
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)
) { ) {
Text("Glossaire") Text("Glossaire")
} }
Button(onClick = onCodeAVerifierClick ) { Button(onClick = onCodeAVerifierClick,
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
) ) {
Text("Code à Vérifier") Text("Code à Vérifier")
} }
Button(onClick = { /* Action de Comparer */ }) { Button(onClick = { /* Action de Comparer */ },
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)
) {
Text("Comparer") Text("Comparer")
} }
} }
@ -196,15 +206,31 @@ fun ChoixLangagePage(
horizontalAlignment = Alignment.CenterHorizontally horizontalAlignment = Alignment.CenterHorizontally
) { ) {
Button(onClick = onPythonClick) { Button(
onClick = onPythonClick,
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)
) {
Text("Python") Text("Python")
} }
Button(onClick = onJavaClick) { Button(
onClick = onJavaClick,
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)) {
Text("Java") Text("Java")
} }
Button(onClick = onJavaScriptClick) { Button(
onClick = onJavaScriptClick,
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)) {
Text("JavaScript") Text("JavaScript")
} }
} }
@ -215,7 +241,12 @@ fun ChoixLangagePage(
verticalArrangement = Arrangement.Bottom, verticalArrangement = Arrangement.Bottom,
horizontalAlignment = Alignment.CenterHorizontally horizontalAlignment = Alignment.CenterHorizontally
) { ) {
Button(onClick = onRetourClick) { Button(
onClick = onRetourClick,
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)) {
Text("Retour") Text("Retour")
} }
} }
@ -247,15 +278,30 @@ fun glossairePage(
) { ) {
Button(onClick = onAjouterMotClick) { Button(
onClick = onAjouterMotClick,
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)) {
Text("Ajouter un mot") Text("Ajouter un mot")
} }
Button(onClick = onImporterClick) { Button(
onClick = onImporterClick,
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)) {
Text("Importer un fichier CSV") Text("Importer un fichier CSV")
} }
Button(onClick = onExporterClick) { Button(
onClick = onExporterClick,
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)) {
Text("Exporter un fichier CSV") Text("Exporter un fichier CSV")
} }
@ -267,7 +313,12 @@ fun glossairePage(
verticalArrangement = Arrangement.Bottom, verticalArrangement = Arrangement.Bottom,
horizontalAlignment = Alignment.CenterHorizontally horizontalAlignment = Alignment.CenterHorizontally
) { ) {
Button(onClick = onRetourClick) { Button(
onClick = onRetourClick,
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)) {
Text("Retour") Text("Retour")
} }
} }
@ -286,64 +337,101 @@ fun FormulairePage(onAnnulerClick: () -> Unit) {
) { ) {
Text(text = "Nouveau contexte métier", style = MaterialTheme.typography.h5) Text(text = "Nouveau contexte métier", style = MaterialTheme.typography.h5)
val mot = remember { mutableStateOf("") } val nom = remember { mutableStateOf("") }
TextField( TextField(
value = mot.value, value = nom.value,
onValueChange = { mot.value = it }, onValueChange = { nom.value = it },
label = { Text("Mot") } label = { Text("Mot") },
colors = TextFieldDefaults.textFieldColors(
focusedIndicatorColor = customRedColor, // Change this to the color you want
unfocusedIndicatorColor = Color.Gray // Change this to the color you want
)
) )
val description = remember { mutableStateOf("") } val description = remember { mutableStateOf("") }
TextField( TextField(
value = description.value, value = description.value,
onValueChange = { description.value = it }, onValueChange = { description.value = it },
label = { Text("Description") } label = { Text("Description") },
colors = TextFieldDefaults.textFieldColors(
focusedIndicatorColor = customRedColor, // Change this to the color you want
unfocusedIndicatorColor = Color.Gray // Change this to the color you want
)
) )
val contextePrincipal = remember { mutableStateOf("") } val contextePrincipal = remember { mutableStateOf("") }
TextField( TextField(
value = contextePrincipal.value, value = contextePrincipal.value,
onValueChange = { contextePrincipal.value = it }, onValueChange = { contextePrincipal.value = it },
label = { Text("Contexte principal") } label = { Text("Contexte principal") },
colors = TextFieldDefaults.textFieldColors(
focusedIndicatorColor = customRedColor, // Change this to the color you want
unfocusedIndicatorColor = Color.Gray // Change this to the color you want
)
) )
val contexte2 = remember { mutableStateOf("") } val contexte2 = remember { mutableStateOf("") }
TextField( TextField(
value = contexte2.value, value = contexte2.value,
onValueChange = { contexte2.value = it }, onValueChange = { contexte2.value = it },
label = { Text("Contexte 2") } label = { Text("Contexte 2") },
colors = TextFieldDefaults.textFieldColors(
focusedIndicatorColor = customRedColor, // Change this to the color you want
unfocusedIndicatorColor = Color.Gray // Change this to the color you want
)
) )
val lieA = remember { mutableStateOf("") } val lieA = remember { mutableStateOf("") }
TextField( TextField(
value = lieA.value, value = lieA.value,
onValueChange = { lieA.value = it }, onValueChange = { lieA.value = it },
label = { Text("Lié à") } label = { Text("Lié à") },
colors = TextFieldDefaults.textFieldColors(
focusedIndicatorColor = customRedColor, // Change this to the color you want
unfocusedIndicatorColor = Color.Gray // Change this to the color you want
)
) )
val synonyme = remember { mutableStateOf("") } val synonyme = remember { mutableStateOf("") }
TextField( TextField(
value = synonyme.value, value = synonyme.value,
onValueChange = { synonyme.value = it }, onValueChange = { synonyme.value = it },
label = { Text("Synonyme") } label = { Text("Synonyme") },
colors = TextFieldDefaults.textFieldColors(
focusedIndicatorColor = customRedColor, // Change this to the color you want
unfocusedIndicatorColor = Color.Gray // Change this to the color you want
)
) )
val antonyme = remember { mutableStateOf("") } val antonyme = remember { mutableStateOf("") }
TextField( TextField(
value = antonyme.value, value = antonyme.value,
onValueChange = { antonyme.value = it }, onValueChange = { antonyme.value = it },
label = { Text("Antonyme") } label = { Text("Antonyme") },
colors = TextFieldDefaults.textFieldColors(
focusedIndicatorColor = customRedColor, // Change this to the color you want
unfocusedIndicatorColor = Color.Gray // Change this to the color you want
)
) )
Row( Row(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceEvenly horizontalArrangement = Arrangement.SpaceEvenly
) { ) {
Button(onClick = onAnnulerClick) { Button(
onClick = onAnnulerClick,
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)) {
Icon(imageVector = Icons.Default.Close, contentDescription = null) Icon(imageVector = Icons.Default.Close, contentDescription = null)
Text("Annuler") Text("Annuler")
} }
Button(onClick = { /* Action de validation */ }) { Button(onClick = { /* Action de validation */ },
colors = ButtonDefaults.buttonColors(
backgroundColor = customRedColor,
contentColor = Color.White
)) {
Icon(imageVector = Icons.Default.Check, contentDescription = null) Icon(imageVector = Icons.Default.Check, contentDescription = null)
Text("Valider") Text("Valider")
} }