Merge branch '0.10.1'

Conflicts:
	main/core/pom.xml
	main/crypto-aes/pom.xml
	main/crypto-api/pom.xml
	main/installer-debian/pom.xml
	main/installer-osx/pom.xml
	main/installer-win-portable/pom.xml
	main/installer-win/pom.xml
	main/pom.xml
	main/uber-jar/pom.xml
	main/ui/pom.xml
This commit is contained in:
Sebastian Stenzel
2015-11-02 14:21:17 +01:00
10 changed files with 255 additions and 13 deletions
@@ -38,6 +38,7 @@ import javafx.application.Platform;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
@@ -53,6 +54,9 @@ public class WelcomeController extends AbstractFXMLViewController {
@FXML
private ImageView botImageView;
@FXML
private Node checkForUpdatesContainer;
@FXML
private CheckBox checkForUpdatesCheckbox;
@@ -93,8 +97,15 @@ public class WelcomeController extends AbstractFXMLViewController {
botImageView.setImage(new Image(getClass().getResource("/bot_welcome.png").toString()));
checkForUpdatesCheckbox.setSelected(settings.isCheckForUpdatesEnabled());
checkForUpdatesCheckbox.selectedProperty().addListener(this::checkForUpdatesChanged);
if (settings.isCheckForUpdatesEnabled()) {
executor.execute(this::checkForUpdates);
if (areUpdatesManagedExternally()) {
checkForUpdatesContainer.setVisible(false);
checkForUpdatesContainer.setManaged(false);
} else {
checkForUpdatesCheckbox.setSelected(settings.isCheckForUpdatesEnabled());
checkForUpdatesCheckbox.selectedProperty().addListener(this::checkForUpdatesChanged);
if (settings.isCheckForUpdatesEnabled()) {
executor.execute(this::checkForUpdates);
}
}
}
@@ -110,7 +121,14 @@ public class WelcomeController extends AbstractFXMLViewController {
}
}
private boolean areUpdatesManagedExternally() {
return Boolean.parseBoolean(System.getProperty("cryptomator.updatesManagedExternally", "false"));
}
private void checkForUpdates() {
if (areUpdatesManagedExternally()) {
return;
}
Platform.runLater(() -> {
checkForUpdatesCheckbox.setVisible(false);
checkForUpdatesStatus.setText(resourceBundle.getString("welcome.checkForUpdates.label.currentlyChecking"));
@@ -11,9 +11,7 @@ import java.awt.TrayIcon.MessageType;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.util.ResourceBundle;
import javafx.application.Platform;
import javafx.stage.Stage;
import java.util.concurrent.TimeUnit;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
@@ -21,10 +19,16 @@ import javax.script.ScriptException;
import javax.swing.SwingUtilities;
import org.apache.commons.lang3.SystemUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javafx.application.Platform;
import javafx.stage.Stage;
public final class TrayIconUtil {
private static TrayIconUtil INSTANCE;
private static final Logger LOG = LoggerFactory.getLogger(TrayIconUtil.class);
private final Stage mainApplicationWindow;
private final ResourceBundle rb;
@@ -79,10 +83,32 @@ public final class TrayIconUtil {
exitItem.addActionListener(this::quitFromTray);
popup.add(exitItem);
final Image image = Toolkit.getDefaultToolkit().getImage(TrayIconUtil.class.getResource("/tray_icon.png"));
final Image image;
if (SystemUtils.IS_OS_MAC_OSX && isMacMenuBarDarkMode()) {
image = Toolkit.getDefaultToolkit().getImage(TrayIconUtil.class.getResource("/tray_icon_white.png"));
} else {
image = Toolkit.getDefaultToolkit().getImage(TrayIconUtil.class.getResource("/tray_icon.png"));
}
return new TrayIcon(image, rb.getString("app.name"), popup);
}
/**
* @return true if <code>defaults read -g AppleInterfaceStyle</code> has an exit status of <code>0</code> (i.e. _not_ returning "key not found").
*/
private boolean isMacMenuBarDarkMode() {
try {
// check for exit status only. Once there are more modes than "dark" and "default", we might need to analyze string contents..
final Process proc = Runtime.getRuntime().exec(new String[] {"defaults", "read", "-g", "AppleInterfaceStyle"});
proc.waitFor(100, TimeUnit.MILLISECONDS);
return proc.exitValue() == 0;
} catch (IOException | InterruptedException | IllegalThreadStateException ex) {
// IllegalThreadStateException thrown by proc.exitValue(), if process didn't terminate
LOG.warn("Determining MAC OS X dark mode settings failed. Assuming default (light) mode.");
return false;
}
}
private void showTrayNotification(TrayIcon trayIcon) {
final Runnable notificationCmd;
if (SystemUtils.IS_OS_MAC_OSX) {
+8 -7
View File
@@ -27,15 +27,16 @@
<children>
<VBox AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="20.0" prefWidth="400.0" alignment="CENTER" spacing="10.0" cacheShape="true" cache="true">
<Label alignment="CENTER" style="-fx-font-size: 1.5em;" text="%welcome.welcomeLabel" cacheShape="true" cache="true" />
<HBox alignment="CENTER" spacing="5.0" cacheShape="true" cache="true">
<CheckBox fx:id="checkForUpdatesCheckbox" cacheShape="true" cache="true" />
<Label fx:id="checkForUpdatesStatus" text="%welcome.checkForUpdates.label.checkboxLabel" cacheShape="true" cache="true" />
<ProgressIndicator fx:id="checkForUpdatesIndicator" progress="-1" prefWidth="15.0" prefHeight="15.0" visible="false" cacheShape="true" cache="true" cacheHint="SPEED" />
</HBox>
<Hyperlink alignment="CENTER" fx:id="updateLink" onAction="#didClickUpdateLink" visible="false" cacheShape="true" cache="true" />
<VBox fx:id="checkForUpdatesContainer" prefWidth="400.0" alignment="CENTER" spacing="5.0" cacheShape="true" cache="true">
<HBox alignment="CENTER" spacing="5.0" cacheShape="true" cache="true">
<CheckBox fx:id="checkForUpdatesCheckbox" cacheShape="true" cache="true" />
<Label fx:id="checkForUpdatesStatus" text="%welcome.checkForUpdates.label.checkboxLabel" cacheShape="true" cache="true" />
<ProgressIndicator fx:id="checkForUpdatesIndicator" progress="-1" prefWidth="15.0" prefHeight="15.0" visible="false" cacheShape="true" cache="true" cacheHint="SPEED" />
</HBox>
<Hyperlink alignment="CENTER" fx:id="updateLink" onAction="#didClickUpdateLink" visible="false" cacheShape="true" cache="true" />
</VBox>
</VBox>
<ImageView fx:id="botImageView" AnchorPane.leftAnchor="100.0" AnchorPane.topAnchor="200.0" fitHeight="200.0" preserveRatio="true" smooth="false" cache="true"/>
<Line AnchorPane.leftAnchor="4.0" AnchorPane.topAnchor="380.0" startX="0.0" endX="6.0" startY="5.0" endY="0.0" strokeWidth="1.0" cache="true" />
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB