Skip to content

Commit

Permalink
V 1.1-pre improvments
Browse files Browse the repository at this point in the history
  • Loading branch information
intdel committed Jan 9, 2016
1 parent 9ba96ca commit 9a765d9
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 47 deletions.
12 changes: 6 additions & 6 deletions controller/MainView.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
<MenuItem mnemonicParsing="false" onAction="#openAddNewMailClientDialog" text="Custom Tab" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit...">
<items>
<MenuItem mnemonicParsing="false" onAction="#showSettings" text="Preferences" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Tabs..">
<items>
<Menu mnemonicParsing="false" text="All Tabs">
Expand All @@ -31,16 +36,11 @@
<Menu mnemonicParsing="false" text="Selected Tab">
<items>
<MenuItem mnemonicParsing="false" onAction="#refreshTab" text="Refresh" />
<MenuItem mnemonicParsing="false" onAction="#removeTab" text="Remove" />
<MenuItem mnemonicParsing="false" onAction="#removeTab" text="Close" />
</items>
</Menu>
</items>
</Menu>
<Menu mnemonicParsing="false" text="Settings">
<items>
<MenuItem mnemonicParsing="false" onAction="#showSettings" text="Settings" />
</items>
</Menu>
<Menu disable="true" mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" onAction="#about" text="About" />
Expand Down
25 changes: 13 additions & 12 deletions controller/MainView.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.Alert;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import settings.MailConfig;
Expand Down Expand Up @@ -75,7 +77,7 @@ private void openAddNewMailClientDialog() {
FXMLLoader loader = new FXMLLoader(getClass().getResource("NewMailClientDialog.fxml"));
AnchorPane newMailClient = (AnchorPane) loader.load();
Stage newMailClientStage = new Stage(StageStyle.UTILITY);
newMailClientStage.setTitle("Add new mail client");
newMailClientStage.setTitle("Malavi - Add new mail tab");
newMailClientStage.setResizable(false);
newMailClientStage.setAlwaysOnTop(true);
newMailClientStage.setScene(new Scene(newMailClient));
Expand Down Expand Up @@ -208,7 +210,7 @@ private void showSettings() {
Stage settingsStage = new Stage(StageStyle.UTILITY);
settingsStage.setAlwaysOnTop(true);
settingsStage.setScene(new Scene(settingsView));
settingsStage.setTitle("Settings");
settingsStage.setTitle("Malavi Preferences");
((SettingsView) loader.getController()).setStage(settingsStage);
((SettingsView) loader.getController()).setTabs(tabs);
settingsStage.setResizable(false);
Expand All @@ -219,30 +221,29 @@ private void showSettings() {
}

@FXML
private void about()
{
private void about() {

}

@FXML
private void addGMail()
{
private void addGMail() {
addClient("GMail", "https://mail.google.com");
settings.addNewConifg("GMail", "https://mail.google.com");
renumberTabIDs();
}

@FXML
private void addGoogleCalendar()
{
private void addGoogleCalendar() {
addClient("Google Calendar", "https://calendar.google.com");
settings.addNewConifg("Google Calendar", "https://calendar.google.com");
renumberTabIDs();
}

@FXML
private void addYahooMail()
{
private void addYahooMail() {
addClient("Yahoo Mail", "https://mail.yahoo.com");
settings.addNewConifg("Yahoo Mail", "https://mail.yahoo.com");
renumberTabIDs();
}


Expand Down
16 changes: 8 additions & 8 deletions controller/NewMailClientDialog.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<?import java.lang.*?>
<?import javafx.scene.layout.*?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="158.0" prefWidth="230.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.NewMailClientDialog">
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="207.0" prefWidth="288.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.NewMailClientDialog">
<children>
<Label layoutX="26.0" layoutY="24.0" text="Name" />
<Label layoutX="26.0" layoutY="68.0" text="URL" />
<Button layoutX="42.0" layoutY="118.0" mnemonicParsing="false" onAction="#addNewClient" text="Add" />
<TextField fx:id="name" layoutX="67.0" layoutY="20.0" promptText="Example" />
<TextField fx:id="URL" layoutX="67.0" layoutY="64.0" promptText="https://mail.example.com" />
<Text layoutX="32.0" layoutY="102.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Please make sure you use https" />
<Button layoutX="149.0" layoutY="118.0" mnemonicParsing="false" onAction="#cancel" text="Cancel" />
<Label layoutX="26.0" layoutY="24.0" text="Name:" />
<Label layoutX="35.0" layoutY="68.0" text="URL:" />
<Button layoutX="65.0" layoutY="161.0" mnemonicParsing="false" onAction="#addNewClient" text="Add" />
<TextField fx:id="name" layoutX="67.0" layoutY="20.0" prefHeight="25.0" prefWidth="194.0" promptText="Example" />
<TextField fx:id="URL" layoutX="67.0" layoutY="64.0" prefHeight="25.0" prefWidth="194.0" promptText="https://mail.example.com" />
<Text layoutX="47.0" layoutY="117.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Please make sure you use https for increased security." wrappingWidth="193.98046875" />
<Button layoutX="172.0" layoutY="161.0" mnemonicParsing="false" onAction="#cancel" text="Cancel" />
</children>
</AnchorPane>
15 changes: 9 additions & 6 deletions controller/Notification.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
<?import java.lang.*?>
<?import javafx.scene.layout.*?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="87.0" prefWidth="333.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.Notification">
<AnchorPane fx:id="anchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="91.0" prefWidth="316.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.Notification">
<children>
<ImageView fx:id="logo" fitHeight="87.0" fitWidth="96.0" layoutX="-3.0" layoutY="-1.0" pickOnBounds="true" preserveRatio="true" />
<Label layoutX="110.0" layoutY="6.0" text="Malavi Notification">
<ImageView fx:id="logo" fitHeight="91.0" fitWidth="88.0" pickOnBounds="true" preserveRatio="true" />
<Label layoutX="100.0" layoutY="6.0" text="Malavi Notification">
<font>
<Font name="System Bold" size="12.0" />
<Font name="System Bold" size="18.0" />
</font>
</Label>
<Text fx:id="text" layoutX="110.0" layoutY="36.0" strokeType="OUTSIDE" strokeWidth="0.0" text="DUMMY NOTIFICATION 123 456" wrappingWidth="156.0" />
<ToggleButton fx:id="muteButton" layoutX="126.0" layoutY="57.0" mnemonicParsing="false" onAction="#muteNotification" text="Mute until next start" />
<Text fx:id="text" layoutX="89.0" layoutY="49.0" strokeType="OUTSIDE" strokeWidth="0.0" text="GMAIL seems to have a new email for you!" textAlignment="CENTER" wrappingWidth="216.0">
<font>
<Font size="16.0" />
</font></Text>
<ToggleButton fx:id="muteButton" layoutX="278.0" layoutY="3.0" mnemonicParsing="false" onAction="#muteNotification" prefHeight="14.0" prefWidth="23.0" text="Mute until next start" />
</children>
</AnchorPane>
10 changes: 8 additions & 2 deletions controller/Notification.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class Notification {
private Text text;
@FXML
private ToggleButton muteButton;
@FXML
private AnchorPane anchorPane;

private Stage stage;
private static Settings settings = Settings.getInstance();
Expand All @@ -44,6 +46,10 @@ public class Notification {
private void initialize()
{
logo.setImage(new Image(getClass().getResource("/res/logo.png").toString()));
Image muteImage = new Image(getClass().getResource("/res/mute.png").toString(),muteButton.getPrefWidth(), muteButton.getPrefHeight(), true, true);
ImageView muteLogo = new ImageView(muteImage);
muteButton.setGraphic(muteLogo);
muteButton.setText("");
}

public void setText(String text)
Expand Down Expand Up @@ -72,8 +78,8 @@ public static void showNotification(String text, int length)
notificationStage.setScene(new Scene(anchorPane));
notificationStage.alwaysOnTopProperty();
notificationStage.setAlwaysOnTop(true);
notificationStage.setX(screenDim.getWidth() - 272); //FIXME don't hard code width of notification
notificationStage.setY(0);
notificationStage.setX(screenDim.getWidth() - (anchorPane.getPrefWidth() + 10));
notificationStage.setY(10);

PauseTransition delay = new PauseTransition(Duration.millis(length));
delay.setOnFinished(event -> notificationStage.close());
Expand Down
36 changes: 25 additions & 11 deletions controller/SettingsView.fxml
Original file line number Diff line number Diff line change
@@ -1,31 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.image.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>

<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="366.0" prefWidth="297.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.SettingsView">
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="366.0" prefWidth="473.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="controller.SettingsView">
<children>
<Text layoutX="21.0" layoutY="27.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Notification length">
<font>
<Font name="System Bold" size="12.0" />
</font></Text>
<ToggleButton fx:id="notificationHiddenButton" layoutX="75.0" layoutY="142.0" mnemonicParsing="false" onAction="#muteNotifications" text="Mute notifications for now" />
<Button layoutX="11.0" layoutY="283.0" mnemonicParsing="false" onAction="#resetToDefault" text="Reset to default" />
<Text fx:id="notificationHiddenText" fill="#ee0b0b" layoutX="14.0" layoutY="107.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Notifications are currently hidden until the next launch of Malavi." textAlignment="CENTER" wrappingWidth="275.00000622018706">
<ToggleButton fx:id="notificationHiddenButton" layoutX="252.0" layoutY="67.0" mnemonicParsing="false" onAction="#muteNotifications" text="Mute notifications for now" />
<Button layoutX="21.0" layoutY="210.0" mnemonicParsing="false" onAction="#resetToDefault" text="Reset setting values to default" />
<Text fx:id="notificationHiddenText" fill="#ee0b0b" layoutX="178.0" layoutY="27.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Notifications are currently hidden until the next launch of Malavi." textAlignment="CENTER" wrappingWidth="275.00000622018706">
<font>
<Font name="System Bold" size="12.0" />
</font>
</Text>
<Text layoutX="21.0" layoutY="196.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Notification sound" />
<Button disable="true" layoutX="110.0" layoutY="240.0" mnemonicParsing="false" text="Select sound" />
<Label layoutX="69.0" layoutY="213.0" text="sounds currently not supported" />
<Text layoutX="22.0" layoutY="99.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Notification sound">
<font>
<Font name="System Bold" size="12.0" />
</font></Text>
<Button disable="true" layoutX="19.0" layoutY="145.0" mnemonicParsing="false" text="Select sound" />
<Label layoutX="111.0" layoutY="113.0" text="sounds currently not supported" />
<Button layoutX="47.0" layoutY="320.0" mnemonicParsing="false" onAction="#applySettings" text="Apply" />
<Button cancelButton="true" layoutX="208.0" layoutY="320.0" mnemonicParsing="false" onAction="#cancel" text="Cancel" />
<Button layoutX="119.0" layoutY="283.0" mnemonicParsing="false" onAction="#resetSettings" text="Reset ALL settings and files (!)" />
<TextField fx:id="notificationLengthText" layoutX="85.0" layoutY="45.0" prefHeight="25.0" prefWidth="84.0" />
<Text layoutX="177.0" layoutY="62.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Milliseconds" />
<Button cancelButton="true" layoutX="383.0" layoutY="320.0" mnemonicParsing="false" onAction="#cancel" text="Cancel" />
<Button layoutX="21.0" layoutY="246.0" mnemonicParsing="false" onAction="#resetSettings" text="Reset ALL settings and DELETE files (!)" />
<TextField fx:id="notificationLengthText" layoutX="21.0" layoutY="46.0" prefHeight="25.0" prefWidth="84.0">
<tooltip>
<Tooltip text="Hint: Use 0 to disable notifications" />
</tooltip></TextField>
<Text layoutX="113.0" layoutY="63.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Milliseconds" />
<Text layoutX="21.0" layoutY="126.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Selected sound:" />
<Text layoutX="22.0" layoutY="196.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Reset settings">
<font>
<Font name="System Bold" size="12.0" />
</font>
</Text>
<ImageView fx:id="settingsImage" fitHeight="108.0" fitWidth="147.0" layoutX="288.0" layoutY="137.0" pickOnBounds="true" preserveRatio="true" />
</children>
</AnchorPane>
6 changes: 6 additions & 0 deletions controller/SettingsView.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;
import javafx.scene.text.Text;
import javafx.stage.Stage;
Expand All @@ -24,6 +26,8 @@ public class SettingsView {
private TextField notificationLengthText;
@FXML
private ToggleButton notificationHiddenButton;
@FXML
private ImageView settingsImage;

private Settings settings = Settings.getInstance();
private Stage stage;
Expand Down Expand Up @@ -63,6 +67,8 @@ public void changed(ObservableValue<? extends String> observable, String oldValu
}
}
});

settingsImage.setImage(new Image(getClass().getResource("/res/settings.png").toString()));
}


Expand Down
2 changes: 1 addition & 1 deletion controller/TitleChanged.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void onTitleChange(TitleEvent titleEvent) {
Platform.runLater(new Runnable() {
@Override
public void run() {
String message = "You have one or more new messages in " + clientName + "!";
String message = clientName + " seems to have a new email for you!";
String title = titleEvent.getTitle();
String debugtitle = title.replaceAll("\\D+","");
int newMessageCount = -1;
Expand Down
Binary file added res/mute.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/new_mail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion view/Malavi.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void start(Stage primaryStage) throws Exception {
mainView.setStage(stage);

stage.setScene(mainScene);
stage.setTitle("Malavi - V1.0");
stage.setTitle("Malavi - V1.1");
stage.getIcons().add(new Image(getClass().getResource("/res/logo.png").toString()));
stage.show();
}
Expand Down

0 comments on commit 9a765d9

Please sign in to comment.