Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
BornIncompetence committed Oct 17, 2018
0 parents commit 5408acb
Show file tree
Hide file tree
Showing 40 changed files with 851 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/libraries/KotlinJavaRuntime.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

577 changes: 577 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions cecs343.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/mysql-connector-java-8.0.11.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
Binary file added lib/mysql-connector-java-8.0.11.jar
Binary file not shown.
Binary file added out/production/cecs343/GUI$Companion.class
Binary file not shown.
Binary file added out/production/cecs343/GUI.class
Binary file not shown.
Binary file added out/production/cecs343/GUIFont.class
Binary file not shown.
Binary file added out/production/cecs343/Logger$scene$2.class
Binary file not shown.
Binary file added out/production/cecs343/Logger$scene$3.class
Binary file not shown.
Binary file added out/production/cecs343/Logger$scene$4.class
Binary file not shown.
Binary file added out/production/cecs343/Logger.class
Binary file not shown.
Binary file not shown.
Binary file added out/production/cecs343/Registrar$scene$2.class
Binary file not shown.
Binary file added out/production/cecs343/Registrar$scene$3.class
Binary file not shown.
Binary file added out/production/cecs343/Registrar$scene$4.class
Binary file not shown.
Binary file added out/production/cecs343/Registrar.class
Binary file not shown.
Binary file added out/production/cecs343/SourceKt.class
Binary file not shown.
Binary file added out/production/cecs343/Welcome$User.class
Binary file not shown.
Binary file added out/production/cecs343/Welcome$scene$2.class
Binary file not shown.
Binary file added out/production/cecs343/Welcome.class
Binary file not shown.
Binary file added resources/fonts/SF-Pro-Text-Bold.otf
Binary file not shown.
Binary file added resources/fonts/SF-Pro-Text-BoldItalic.otf
Binary file not shown.
Binary file added resources/fonts/SF-Pro-Text-Heavy.otf
Binary file not shown.
Binary file added resources/fonts/SF-Pro-Text-HeavyItalic.otf
Binary file not shown.
Binary file added resources/fonts/SF-Pro-Text-Light.otf
Binary file not shown.
Binary file added resources/fonts/SF-Pro-Text-LightItalic.otf
Binary file not shown.
Binary file added resources/fonts/SF-Pro-Text-Medium.otf
Binary file not shown.
Binary file added resources/fonts/SF-Pro-Text-MediumItalic.otf
Binary file not shown.
Binary file added resources/fonts/SF-Pro-Text-Regular.otf
Binary file not shown.
Binary file added resources/fonts/SF-Pro-Text-RegularItalic.otf
Binary file not shown.
Binary file added resources/fonts/SF-Pro-Text-Semibold.otf
Binary file not shown.
Binary file added resources/fonts/SF-Pro-Text-SemiboldItalic.otf
Binary file not shown.
58 changes: 58 additions & 0 deletions src/Logger.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import javafx.geometry.Insets
import javafx.geometry.Pos
import javafx.scene.Scene
import javafx.scene.control.Button
import javafx.scene.control.Label
import javafx.scene.control.PasswordField
import javafx.scene.control.TextField
import javafx.scene.layout.GridPane
import javafx.scene.layout.HBox
import javafx.scene.layout.VBox

// Login to user account
object Logger {
val scene by lazy { scene() }

private fun scene(): Scene {

val gridPane = GridPane()
gridPane.alignment = Pos.CENTER
gridPane.hgap = 10.0
gridPane.vgap = 10.0
gridPane.padding = Insets(25.0, 25.0, 25.0, 25.0)

val text = Label("Login")
text.font = GUIFont.heavy
gridPane.add(text, 0, 0)

val email = TextField()
email.promptText = "Email"
email.font = GUIFont.regular

val password = PasswordField()
password.promptText = "Password"
password.font = GUIFont.regular

val vbox = VBox(10.0)
vbox.children.addAll(email, password)
gridPane.add(vbox, 0, 1)

val signIn = Button("Sign in")
signIn.font = GUIFont.medium
signIn.setOnAction {
_ ->
Welcome.user = Welcome.User(email.text, password.text)
window.scene = Welcome.scene
}

val signUp = Button("Sign up")
signUp.font = GUIFont.medium
signUp.setOnAction { _ -> window.scene = Registrar.scene }

val hbox = HBox(10.0)
hbox.children.addAll(signIn, signUp)
gridPane.add(hbox, 0, 2)

return Scene(gridPane, 250.0, 150.0)
}
}
71 changes: 71 additions & 0 deletions src/Registrar.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import javafx.geometry.Insets
import javafx.geometry.Pos
import javafx.scene.Scene
import javafx.scene.control.Button
import javafx.scene.control.Label
import javafx.scene.control.PasswordField
import javafx.scene.control.TextField
import javafx.scene.layout.GridPane
import javafx.scene.layout.HBox
import javafx.scene.layout.VBox

// Create User Account
object Registrar {
val scene by lazy { scene() }

private fun scene(): Scene {

val gridPane = GridPane()
gridPane.alignment = Pos.CENTER
gridPane.hgap = 10.0
gridPane.vgap = 10.0
gridPane.padding = Insets(25.0, 25.0, 25.0, 25.0)

val text = Label("Register")
text.font = GUIFont.heavy
gridPane.add(text, 0, 0)

val email = TextField()
email.promptText = "Email"
email.font = GUIFont.regular

val password = PasswordField()
password.promptText = "Password"
password.font = GUIFont.regular

val retypePassword = PasswordField()
retypePassword.promptText = "Retype Password"
retypePassword.font = GUIFont.regular

val vbox = VBox(10.0)
vbox.children.addAll(email, password, retypePassword)
gridPane.add(vbox, 0, 1)

val register = Button("Register")
register.font = GUIFont.medium
register.setOnAction {
_ ->
// Check if email address already exists
// - Connect to database
// - Check database for instances of email-address
// - If found
// - Display warning that email address already exists in the system
// - Check if password matches retype password
// - If matches
// - Display warning that passwords don't match
// Else execute a query that adds email address and password to database
println("An email has been sent confirming your account.")
window.scene = Logger.scene
}

val back = Button("Go back")
back.font = GUIFont.medium
back.setOnAction { _ -> window.scene = Logger.scene }

val hbox = HBox(10.0)
hbox.children.addAll(register, back)
gridPane.add(hbox, 0, 2)

return Scene(gridPane, 250.0, 200.0)
}
}
41 changes: 41 additions & 0 deletions src/Source.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import javafx.application.Application
import javafx.scene.text.Font
import javafx.stage.Stage

object GUIFont {
val bold = Font.loadFont("file:resources/fonts/SF-Pro-Text-Bold.otf", 20.0)!!
val boldItalic = Font.loadFont("file:resources/fonts/SF-Pro-Text-BoldItalic.otf", 20.0)!!
val heavy = Font.loadFont("file:resources/fonts/SF-Pro-Text-Heavy.otf", 20.0)!!
val heavyItalic = Font.loadFont("file:resources/fonts/SF-Pro-Text-HeavyItalic.otf", 20.0)!!
val light = Font.loadFont("file:resources/fonts/SF-Pro-Text-Light.otf", 20.0)!!
val lightItalic = Font.loadFont("file:resources/fonts/SF-Pro-Text-LightItalic.otf", 20.0)!!
val medium = Font.loadFont("file:resources/fonts/SF-Pro-Text-Medium.otf", 12.0)!!
val mediumItalic = Font.loadFont("file:resources/fonts/SF-Pro-Text-MediumItalic.otf", 20.0)!!
val regular = Font.loadFont("file:resources/fonts/SF-Pro-Text-Regular.otf", 12.0)!!
val regularItalic = Font.loadFont("file:resources/fonts/SF-Pro-Text-RegularItalic.otf", 20.0)!!
val semibold = Font.loadFont("file:resources/fonts/SF-Pro-Text-Semibold.otf", 20.0)!!
val semibolditalic = Font.loadFont("file:resources/fonts/SF-Pro-Text-SemiboldItalic.otf", 20.0)!!
}

lateinit var window: Stage

class GUI : Application() {

val url = "jdbc:mysql://localhost:3306/"
val database = "scheduler"

override fun start(primaryStage: Stage) {
window = primaryStage

window.scene = Logger.scene
window.title = "Vision"
window.show()
}

companion object {
@JvmStatic
fun main(args: Array<String>) {
launch(GUI::class.java)
}
}
}
34 changes: 34 additions & 0 deletions src/Welcome.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import javafx.geometry.Insets
import javafx.geometry.Pos
import javafx.scene.Scene
import javafx.scene.layout.GridPane
import javafx.scene.text.Text

// Main menu:
// Modify user account data
// Menu bar include account, appointment, setting, and help
object Welcome {
data class User(val email: String, val password: String) {}
lateinit var user: User

val scene by lazy { scene() }

private fun scene(): Scene {

val gridPane = GridPane()
gridPane.alignment = Pos.CENTER
gridPane.hgap = 10.0
gridPane.vgap = 10.0
gridPane.padding = Insets(25.0, 25.0, 25.0, 25.0)

val email = Text(user.email)
email.font = GUIFont.bold
gridPane.add(email, 0, 0)

val password = Text(user.password)
password.font = GUIFont.bold
gridPane.add(password, 1, 0)

return Scene(gridPane, 150.0, 50.0)
}
}

0 comments on commit 5408acb

Please sign in to comment.