diff --git a/src/main/java/org/qortal/controller/AutoUpdate.java b/src/main/java/org/qortal/controller/AutoUpdate.java index e1a445fef..ff941fb34 100644 --- a/src/main/java/org/qortal/controller/AutoUpdate.java +++ b/src/main/java/org/qortal/controller/AutoUpdate.java @@ -21,6 +21,7 @@ import org.qortal.api.ApiRequest; import org.qortal.data.transaction.ArbitraryTransactionData; import org.qortal.data.transaction.TransactionData; +import org.qortal.globalization.Translator; import org.qortal.gui.SysTray; import org.qortal.repository.DataException; import org.qortal.repository.Repository; @@ -245,7 +246,9 @@ private static boolean attemptUpdate(byte[] commitHash, byte[] downloadHash, Str LOGGER.info(String.format("Applying update with: %s", String.join(" ", javaCmd))); - SysTray.getInstance().showMessage("Auto Update", "Applying automatic update and restarting...", MessageType.INFO); + SysTray.getInstance().showMessage(Translator.INSTANCE.translate("SysTray", "AUTO_UPDATE"), + Translator.INSTANCE.translate("SysTray", "APPLYING_UPDATE_AND_RESTARTING"), + MessageType.INFO); new ProcessBuilder(javaCmd).start(); diff --git a/src/main/java/org/qortal/controller/Controller.java b/src/main/java/org/qortal/controller/Controller.java index 77a9d1696..3a8ab7d7c 100644 --- a/src/main/java/org/qortal/controller/Controller.java +++ b/src/main/java/org/qortal/controller/Controller.java @@ -1,5 +1,6 @@ package org.qortal.controller; +import java.awt.TrayIcon.MessageType; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -430,6 +431,12 @@ public void run() { // Give repository a chance to backup if (now >= repositoryBackupTimestamp) { repositoryBackupTimestamp = now + REPOSITORY_BACKUP_PERIOD; + + if (Settings.getInstance().getShowBackupNotification()) + SysTray.getInstance().showMessage(Translator.INSTANCE.translate("SysTray", "DB_BACKUP"), + Translator.INSTANCE.translate("SysTray", "CREATING_BACKUP_OF_DB_FILES"), + MessageType.INFO); + RepositoryManager.backup(true); } diff --git a/src/main/java/org/qortal/settings/Settings.java b/src/main/java/org/qortal/settings/Settings.java index 39dd01af9..da8da876e 100644 --- a/src/main/java/org/qortal/settings/Settings.java +++ b/src/main/java/org/qortal/settings/Settings.java @@ -71,6 +71,8 @@ public class Settings { private int maxTransactionTimestampFuture = 24 * 60 * 60 * 1000; // milliseconds /** Whether we check, fetch and install auto-updates */ private boolean autoUpdateEnabled = true; + /** Whether to show a notification when we backup repository. */ + private boolean showBackupNotification = false; // Peer-to-peer related private boolean isTestNet = false; @@ -369,4 +371,8 @@ public Long getTestNtpOffset() { return this.testNtpOffset; } + public boolean getShowBackupNotification() { + return this.showBackupNotification; + } + } diff --git a/src/main/resources/i18n/SysTray_en.properties b/src/main/resources/i18n/SysTray_en.properties index 8d805a365..118da1bb5 100644 --- a/src/main/resources/i18n/SysTray_en.properties +++ b/src/main/resources/i18n/SysTray_en.properties @@ -1,6 +1,10 @@ #Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/) # SysTray pop-up menu +APPLYING_UPDATE_AND_RESTARTING = Applying automatic update and restarting... + +AUTO_UPDATE = Auto Update + BLOCK_HEIGHT = height CHECK_TIME_ACCURACY = Check time accuracy @@ -9,6 +13,10 @@ CONNECTION = connection CONNECTIONS = connections +CREATING_BACKUP_OF_DB_FILES = Creating backup of database files... + +DB_BACKUP = Database Backup + EXIT = Exit MINTING_DISABLED = NOT minting diff --git a/src/test/java/org/qortal/test/apps/CheckTranslations.java b/src/test/java/org/qortal/test/apps/CheckTranslations.java index a263cd2aa..70215bcdf 100644 --- a/src/test/java/org/qortal/test/apps/CheckTranslations.java +++ b/src/test/java/org/qortal/test/apps/CheckTranslations.java @@ -13,8 +13,9 @@ public class CheckTranslations { private static final String[] SUPPORTED_LANGS = new String[] { "en", "de", "zh", "ru" }; - private static final Set SYSTRAY_KEYS = Set.of("BLOCK_HEIGHT", "CHECK_TIME_ACCURACY", "CONNECTION", "CONNECTIONS", - "EXIT", "MINTING_DISABLED", "MINTING_ENABLED", "NTP_NAG_CAPTION", "NTP_NAG_TEXT_UNIX", "NTP_NAG_TEXT_WINDOWS", + private static final Set SYSTRAY_KEYS = Set.of("AUTO_UPDATE", "APPLYING_UPDATE_AND_RESTARTING", "BLOCK_HEIGHT", + "CHECK_TIME_ACCURACY", "CONNECTION", "CONNECTIONS", "CREATING_BACKUP_OF_DB_FILES", "DB_BACKUP", "EXIT", + "MINTING_DISABLED", "MINTING_ENABLED", "NTP_NAG_CAPTION", "NTP_NAG_TEXT_UNIX", "NTP_NAG_TEXT_WINDOWS", "OPEN_UI", "SYNCHRONIZE_CLOCK", "SYNCHRONIZING_BLOCKCHAIN", "SYNCHRONIZING_CLOCK"); private static String failurePrefix;