-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Photo albums download - Private messages download
- Loading branch information
0 parents
commit bfac635
Showing
12 changed files
with
807 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target | ||
.idea | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 callate.io | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>io.callate</groupId> | ||
<artifactId>tuDownloader</artifactId> | ||
<version>1.0</version> | ||
<inceptionYear>2016</inceptionYear> | ||
<properties> | ||
<scala.version>2.11.7</scala.version> | ||
</properties> | ||
|
||
<repositories> | ||
<repository> | ||
<id>scala-tools.org</id> | ||
<name>Scala-Tools Maven2 Repository</name> | ||
<url>http://scala-tools.org/repo-releases</url> | ||
</repository> | ||
</repositories> | ||
|
||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>scala-tools.org</id> | ||
<name>Scala-Tools Maven2 Repository</name> | ||
<url>http://scala-tools.org/repo-releases</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.scala-lang</groupId> | ||
<artifactId>scala-library</artifactId> | ||
<version>${scala.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jsoup</groupId> | ||
<artifactId>jsoup</artifactId> | ||
<version>1.8.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.json4s</groupId> | ||
<artifactId>json4s-native_2.11</artifactId> | ||
<version>3.3.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.scala-lang</groupId> | ||
<artifactId>scala-swing</artifactId> | ||
<version>2.11.0-M7</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<sourceDirectory>src/main/scala</sourceDirectory> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.scala-tools</groupId> | ||
<artifactId>maven-scala-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>compile</goal> | ||
<goal>testCompile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<scalaVersion>${scala.version}</scalaVersion> | ||
<args> | ||
<arg>-target:jvm-1.5</arg> | ||
</args> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-eclipse-plugin</artifactId> | ||
<configuration> | ||
<downloadSources>true</downloadSources> | ||
<buildcommands> | ||
<buildcommand>ch.epfl.lamp.sdt.core.scalabuilder</buildcommand> | ||
</buildcommands> | ||
<additionalProjectnatures> | ||
<projectnature>ch.epfl.lamp.sdt.core.scalanature</projectnature> | ||
</additionalProjectnatures> | ||
<classpathContainers> | ||
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer> | ||
<classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER</classpathContainer> | ||
</classpathContainers> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>2.2-beta-5</version> | ||
<configuration> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
<archive> | ||
<manifest> | ||
<mainClass>io.callate.main.Main</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
<resources> | ||
<resource> | ||
<directory>.</directory> | ||
<includes> | ||
<include>**/*.png</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
</build> | ||
<reporting> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.scala-tools</groupId> | ||
<artifactId>maven-scala-plugin</artifactId> | ||
<configuration> | ||
<scalaVersion>${scala.version}</scalaVersion> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</reporting> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
package io.callate.gui | ||
|
||
import java.awt.Color | ||
import java.awt.Dimension | ||
import java.awt.Image | ||
import java.awt._ | ||
import java.awt.event.{MouseEvent, MouseAdapter} | ||
import java.io.IOException | ||
import java.net.{URISyntaxException, URI} | ||
import javax.swing.ImageIcon | ||
|
||
import scala.swing.Dialog | ||
import scala.swing.Label | ||
import scala.swing._ | ||
import scala.swing.BorderPanel.Position._ | ||
|
||
object About extends Dialog { | ||
title = "tuDownloader" | ||
resizable = false | ||
modal = true | ||
|
||
val imagePanel = new BorderPanel{ | ||
layout(new Label { | ||
icon = new ImageIcon(new ImageIcon(getClass.getClassLoader.getResource("logo.png")).getImage.getScaledInstance(200, 200, Image.SCALE_SMOOTH)) | ||
preferredSize = new Dimension(100, 100) | ||
}) = Center | ||
} | ||
|
||
val createdBy = new Label { text = "tuDownloader v1.0 - "} | ||
val callateName = new Label { | ||
text = "callate.io" | ||
foreground = Color.blue | ||
} | ||
callateName.peer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)) | ||
callateName.peer.addMouseListener(new MouseAdapter() { | ||
override def mouseClicked(e: MouseEvent) { | ||
if (e.getClickCount > 0) { | ||
if (Desktop.isDesktopSupported) { | ||
val desktop: Desktop = Desktop.getDesktop | ||
try { | ||
val uri: URI = new URI("http://callate.io") | ||
desktop.browse(uri) | ||
} catch { | ||
case _: IOException => | ||
case _: URISyntaxException => | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
|
||
|
||
val nurLabel = new Label { | ||
text = "@subnurmality" | ||
foreground = Color.blue | ||
} | ||
nurLabel.peer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)) | ||
nurLabel.peer.addMouseListener(new MouseAdapter() { | ||
override def mouseClicked(e: MouseEvent) { | ||
if (e.getClickCount > 0) { | ||
if (Desktop.isDesktopSupported) { | ||
val desktop: Desktop = Desktop.getDesktop | ||
try { | ||
val uri: URI = new URI("http://twitter.com/subnurmality") | ||
desktop.browse(uri) | ||
} catch { | ||
case _: IOException => | ||
case _: URISyntaxException => | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
|
||
val toroLabel = new Label { | ||
text = "@wynkth" | ||
foreground = Color.blue | ||
} | ||
toroLabel.peer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)) | ||
toroLabel.peer.addMouseListener(new MouseAdapter() { | ||
override def mouseClicked(e: MouseEvent) { | ||
if (e.getClickCount > 0) { | ||
if (Desktop.isDesktopSupported) { | ||
val desktop: Desktop = Desktop.getDesktop | ||
try { | ||
val uri: URI = new URI("http://twitter.com/wynkth") | ||
desktop.browse(uri) | ||
} catch { | ||
case _: IOException => | ||
case _: URISyntaxException => | ||
} | ||
} | ||
} | ||
} | ||
}) | ||
|
||
val nurFlowPanel = new FlowPanel { | ||
contents += new Label("UI") | ||
contents += nurLabel | ||
} | ||
|
||
val toroFlowPanel = new FlowPanel { | ||
contents += new Label("Code") | ||
contents += toroLabel | ||
} | ||
|
||
val flowPanel = new FlowPanel { | ||
contents += createdBy | ||
contents += callateName | ||
} | ||
|
||
val borderLayout = new BorderPanel { | ||
layout(flowPanel) = North | ||
layout(toroFlowPanel) = Center | ||
layout(nurFlowPanel) = South | ||
} | ||
|
||
val gridPanel = new BorderPanel { | ||
layout(imagePanel) = Center | ||
layout(borderLayout) = South | ||
} | ||
// Add the grid, set the size | ||
contents = new BorderPanel { | ||
layout(gridPanel) = Center | ||
} | ||
size = new Dimension(320, 260) | ||
|
||
peer.setLocationRelativeTo(null) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package io.callate.gui | ||
|
||
import io.callate.main.Main | ||
import scala.swing._ | ||
import scala.swing.BorderPanel.Position._ | ||
import event._ | ||
|
||
object Login extends MainFrame { | ||
title = "tuDownloader" | ||
resizable = false | ||
|
||
if (System.getProperty("os.name") != "Mac OS X") { | ||
menuBar = new MenuBar { | ||
contents += new MenuItem(Action("Acerca de..") { | ||
About.open() | ||
}) | ||
} | ||
} | ||
|
||
// Define components | ||
val emailLabel = new Label { | ||
text = "Email: " | ||
} | ||
|
||
val passLabel = new Label { | ||
text = "Contraseña: " | ||
} | ||
|
||
val button = new Button { | ||
text = "Conectar" | ||
enabled = true | ||
tooltip = "Haz click para iniciar sesión" | ||
} | ||
|
||
val emailText = new TextField { | ||
columns = 20 | ||
text = "" | ||
} | ||
|
||
val passText = new PasswordField { | ||
columns = 20 | ||
text = "" | ||
} | ||
|
||
val gridPanel = new GridPanel(5, 1) { | ||
contents += emailLabel | ||
contents += emailText | ||
contents += passLabel | ||
contents += passText | ||
contents += button | ||
} | ||
|
||
// Define alignments | ||
emailLabel.horizontalAlignment = Alignment.Left | ||
passLabel.horizontalAlignment = Alignment.Left | ||
|
||
// Add the grid, set the size | ||
contents = new BorderPanel { | ||
layout(gridPanel) = Center | ||
} | ||
|
||
// Listen to events | ||
listenTo(button) | ||
listenTo(emailText.keys) | ||
listenTo(passText.keys) | ||
|
||
// Add the reactions to the events | ||
reactions += { | ||
case ButtonClicked(component) if component == button => Main.login(emailText.text, new String(passText.password)) | ||
case KeyPressed(_, Key.Enter, _, _) => Main.login(emailText.text, new String(passText.password)) | ||
} | ||
|
||
// Set frame location | ||
peer.setLocationRelativeTo(null) | ||
|
||
def error() = { | ||
Dialog.showMessage(contents.head, | ||
"Error al conectar, asegúrate de que has introducido los datos correctamente", | ||
title="Error", | ||
Dialog.Message.Error) | ||
} | ||
} |
Oops, something went wrong.