]> gitweb @ CieloNegro.org - task-reporter.git/blobdiff - src/main/scala/jp/ymir/taskReporter/Preferences.scala
wip
[task-reporter.git] / src / main / scala / jp / ymir / taskReporter / Preferences.scala
diff --git a/src/main/scala/jp/ymir/taskReporter/Preferences.scala b/src/main/scala/jp/ymir/taskReporter/Preferences.scala
new file mode 100644 (file)
index 0000000..d8b70ee
--- /dev/null
@@ -0,0 +1,31 @@
+package jp.ymir.taskReporter;
+import java.awt.Dimension
+import java.io._
+import sbinary._
+import sbinary.DefaultProtocol._
+import sbinary.Operations._
+import preferscala._
+
+object AWTProtocol extends DefaultProtocol {
+  implicit object DimensionFormat extends Format[Dimension] {
+    def reads(in: Input) = read[(Int, Int)](in) match {
+      case (width, height) =>
+        new Dimension(width, height)
+    }
+    def writes(out: Output, value: Dimension) =
+      write[(Int, Int)](out, (value.width, value.height))
+  }
+}
+
+object Preferences extends PackageGroup(PreferenceType.User) {
+  import AWTProtocol._
+
+  val lookAndFeel =
+    new Preference("ui/lookAndFeel", "javax.swing.plaf.metal.MetalLookAndFeel");
+
+  val mainFrameSize =
+    new Preference("ui/MainFrame/size", new Dimension(640, 480));
+
+  val lastChosenDir =
+    new Preference("ui/lastChosenDir", new File(System.getProperty("user.dir")))
+}