Skip to content

Commit

Permalink
Version 2.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisTurco authored Dec 15, 2024
2 parents fef0800 + f3636ce commit d9af316
Show file tree
Hide file tree
Showing 45 changed files with 938 additions and 364 deletions.
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Current File",
"request": "launch",
"mainClass": "${file}"
},
{
"type": "java",
"name": "TranslationLoaderEnum",
"request": "launch",
"mainClass": "com.mycompany.autobackupprogram.Enums.TranslationLoaderEnum",
"projectName": "BackupManager"
},
{
"type": "java",
"name": "MainApp",
"request": "launch",
"mainClass": "com.mycompany.autobackupprogram.MainApp",
"projectName": "BackupManager"
}
]
}
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@
Each backup is carefully saved, and the program maintains a detailed log of all completed operations. Users can also view, manage, and edit the details of each backup, ensuring complete control and customization over saved data. This tool is an ideal solution for efficiently and securely protecting files, minimizing the risk of data loss.


## Screenshots
## Screenshots and Videos
![](./docs/imgs/BackupManagerPresentation.gif)

![](./docs/imgs/AutoBackup.png)
![](./docs/imgs/BackupList.png)
![](./docs/imgs/CompletedBackup.png)
![](./docs/imgs/ThemeLanguage.png)

### Multi theme
![](./docs/imgs/Home.png)
![](./docs/imgs/Home2.png)
![](./docs/imgs/Home3.png)


## Startup Logic
Expand Down
Binary file added docs/imgs/AutoBackup.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 docs/imgs/BackupList.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 docs/imgs/BackupManagerPresentation.gif
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 docs/imgs/CompletedBackup.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 docs/imgs/Home.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 docs/imgs/Home2.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 docs/imgs/Home3.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 docs/imgs/ThemeLanguage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
233 changes: 160 additions & 73 deletions src/main/java/com/mycompany/autobackupprogram/BackupOperations.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import javax.swing.JFrame;

import com.mycompany.autobackupprogram.Entities.Backup;
import com.mycompany.autobackupprogram.Entities.Preferences;
import com.mycompany.autobackupprogram.Enums.ConfigKey;
import com.mycompany.autobackupprogram.GUI.BackupManagerGUI;

Expand Down Expand Up @@ -112,7 +114,7 @@ class BackupTask implements Runnable {
public void run() {
Logger.logMessage("Checking for automatic backup...", Logger.LogLevel.INFO);
try {
List<Backup> backups = json.ReadBackupListFromJSON(ConfigKey.BACKUP_FILE_STRING.getValue(), ConfigKey.RES_DIRECTORY_STRING.getValue());
List<Backup> backups = json.ReadBackupListFromJSON(Preferences.getBackupList().getDirectory(), Preferences.getBackupList().getFile());
List<Backup> needsBackup = getBackupsToDo(backups);
if (needsBackup != null && !needsBackup.isEmpty()) {
Logger.logMessage("Start backup process.", Logger.LogLevel.INFO);
Expand All @@ -122,7 +124,6 @@ public void run() {
}
} catch (IOException ex) {
Logger.logMessage("An error occurred: " + ex.getMessage(), Logger.LogLevel.ERROR, ex);
ex.printStackTrace();
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mycompany.autobackupprogram.Dialogs;

import com.formdev.flatlaf.FlatIntelliJLaf;
import com.mycompany.autobackupprogram.Logger;
import com.mycompany.autobackupprogram.Logger.LogLevel;
import com.mycompany.autobackupprogram.Entities.Preferences;
import com.mycompany.autobackupprogram.Enums.ConfigKey;
import com.mycompany.autobackupprogram.Enums.LanguagesEnum;
Expand All @@ -9,23 +10,26 @@
import com.mycompany.autobackupprogram.Enums.TranslationLoaderEnum.TranslationCategory;
import com.mycompany.autobackupprogram.Enums.TranslationLoaderEnum.TranslationKey;
import com.mycompany.autobackupprogram.Managers.ThemeManager;

import static com.mycompany.autobackupprogram.GUI.BackupManagerGUI.OpenExceptionMessage;

import java.awt.Image;
import java.io.IOException;
import java.util.Arrays;

import javax.swing.ImageIcon;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import org.json.simple.parser.ParseException;

import com.mycompany.autobackupprogram.GUI.BackupManagerGUI;

public class PreferencesDialog extends javax.swing.JDialog {

private boolean isApply = false;
private final BackupManagerGUI mainGui;

public PreferencesDialog(java.awt.Frame parent, boolean modal) {
public PreferencesDialog(java.awt.Frame parent, boolean modal, BackupManagerGUI mainGui) {
super(parent, modal);
this.mainGui = mainGui;

initComponents();

// logo application
Expand All @@ -37,10 +41,6 @@ public PreferencesDialog(java.awt.Frame parent, boolean modal) {
setThemes();
setTranslations();
}

public void changeTheme() {

}

/**
* This method is called from within the constructor to initialize the form.
Expand Down Expand Up @@ -136,18 +136,27 @@ private void themesComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GE
}//GEN-LAST:event_themesComboBoxActionPerformed

private void applyBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applyBtnActionPerformed
isApply = true;
String selectedLanguage = (String) languagesComboBox.getSelectedItem();
String selectedTheme = (String) themesComboBox.getSelectedItem();

Logger.logMessage("Updating preferences -> Language: " + selectedLanguage + "; Theme: " + selectedTheme, LogLevel.INFO);

try {
// translactions
Preferences.setLanguage((String) languagesComboBox.getSelectedItem());
Preferences.setLanguage(selectedLanguage);
TranslationLoaderEnum.loadTranslations(ConfigKey.LANGUAGES_DIRECTORY_STRING.getValue() + Preferences.getLanguage().getFileName());
setTranslations();

// theme
Preferences.setTheme((String) themesComboBox.getSelectedItem());
Preferences.setTheme(selectedTheme);
ThemeManager.updateThemeDialog(this);
} catch (IOException | ParseException e) {
e.printStackTrace();

// update globally
Preferences.updatePreferencesToJSON();
mainGui.reloadPreferences();
} catch (IOException | ParseException ex) {
Logger.logMessage("An error occurred during applying preferences: " + ex.getMessage(), Logger.LogLevel.ERROR, ex);
OpenExceptionMessage(ex.getMessage(), Arrays.toString(ex.getStackTrace()));
}
}//GEN-LAST:event_applyBtnActionPerformed

Expand Down Expand Up @@ -187,10 +196,6 @@ private void setTranslations() {
jLabel1.setText(TranslationCategory.PREFERENCES_DIALOG.getTranslation(TranslationKey.LANGUAGE));
jLabel2.setText(TranslationCategory.PREFERENCES_DIALOG.getTranslation(TranslationKey.THEME));
}

public boolean isApply() {
return isApply;
}

// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton applyBtn;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" alignment="0" pref="294" max="32767" attributes="0"/>
<Component id="jScrollPane1" alignment="0" pref="313" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<EmptySpace min="0" pref="92" max="32767" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Group type="102" alignment="1" attributes="0">
Expand Down Expand Up @@ -88,12 +88,12 @@
<Component id="minutesSpinner" alignment="3" min="-2" pref="35" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="38" max="-2" attributes="0"/>
<EmptySpace pref="87" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="btnOk" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
package com.mycompany.autobackupprogram.Dialogs;

import com.formdev.flatlaf.FlatIntelliJLaf;
import com.mycompany.autobackupprogram.Enums.ConfigKey;
import com.mycompany.autobackupprogram.Enums.TranslationLoaderEnum.TranslationCategory;
import com.mycompany.autobackupprogram.Enums.TranslationLoaderEnum.TranslationKey;
import com.mycompany.autobackupprogram.Managers.ThemeManager;
import com.mycompany.autobackupprogram.Entities.TimeInterval;

import static com.mycompany.autobackupprogram.GUI.BackupManagerGUI.OpenExceptionMessage;

import java.awt.Image;
import java.util.Arrays;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class TimePicker extends javax.swing.JDialog {

Expand All @@ -28,6 +21,7 @@ public TimePicker(java.awt.Frame parent, TimeInterval timeInterval, boolean moda

initComponents();

this.timeInterval = timeInterval;
if (timeInterval != null) {
daysSpinner.setValue(timeInterval.getDays());
hoursSpinner.setValue(timeInterval.getHours());
Expand All @@ -44,7 +38,7 @@ public TimePicker(java.awt.Frame parent, TimeInterval timeInterval, boolean moda
public TimeInterval getTimeInterval() {
if (closeOk) return timeInterval;
return null;
}
}

private void daysIntervalSpinnerChange() {
Integer days = (Integer) daysSpinner.getValue();
Expand Down Expand Up @@ -188,9 +182,9 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 313, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGap(0, 92, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
Expand Down Expand Up @@ -227,11 +221,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(minutesSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addGap(38, 38, 38)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 87, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnOk)
.addComponent(jButton2))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);

pack();
Expand Down
Loading

0 comments on commit d9af316

Please sign in to comment.