Skip to content

Commit

Permalink
Fixed Bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
EasyG0ing1 committed Apr 14, 2022
1 parent dc45afa commit 696656c
Show file tree
Hide file tree
Showing 32 changed files with 889 additions and 761 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.redmondsims</groupId>
<artifactId>GistFX</artifactId>
<version>3.4.3</version>
<version>3.4.4</version>
<name>GistFX</name>
<url>https://github.com/redmondsims/gistfx</url>

Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/redmondsims/gistfx/Main.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package com.redmondsims.gistfx;

import com.redmondsims.gistfx.cryptology.Crypto;
import com.redmondsims.gistfx.data.Action;
import com.redmondsims.gistfx.enums.Colors;
import com.redmondsims.gistfx.enums.Type;
import com.redmondsims.gistfx.preferences.AppSettings;
import com.redmondsims.gistfx.preferences.LiveSettings;
import com.redmondsims.gistfx.ui.LoginWindow;
import com.redmondsims.gistfx.ui.Password;
import com.redmondsims.gistfx.ui.TreeIcons;
import com.redmondsims.gistfx.ui.trayicon.TrayIcon;
import com.redmondsims.gistfx.utils.Resources;
import com.redmondsims.gistfx.utils.Util;
import javafx.application.Application;
import javafx.stage.Stage;

Expand Down Expand Up @@ -82,6 +85,7 @@ public class Main extends Application {

public static void main(String[] args) {
boolean stopFlag = false;
LiveSettings.setTempIconSize(22);
for (String arg : args) {
if (arg.toLowerCase(Locale.ROOT).startsWith("newdatabase")) {
com.redmondsims.gistfx.data.Action.deleteDatabaseFile();
Expand Down Expand Up @@ -114,6 +118,11 @@ public static void main(String[] args) {
AppSettings.set().iconBaseSize(value);
System.out.println("iconbase set to " + value);
}
if (arg.toLowerCase().startsWith("iconsize=")) {
String num = arg.replaceFirst("iconsize=", "");
int value = Integer.parseInt(num);
LiveSettings.setTempIconSize(value);
}
}
if (stopFlag) System.exit(100);
launch(args);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/redmondsims/gistfx/alerts/CustomAlert.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public static String showChangeGistDescriptionAlert(String currentDescription) {
lblMessage.setPrefWidth(100);
lblMessage.setPrefHeight(35);
Label lblBlank = new Label(" ");
Label lblNewGistName = new Label("New getName:");
Label lblNewGistName = new Label("New getGitHubUsername:");
TextArea taGistDescription = new TextArea(currentDescription);
taGistDescription.setWrapText(true);
taGistDescription.setPrefWidth(500);
Expand Down Expand Up @@ -410,7 +410,7 @@ public static String[] newGistAlert(String fileText, boolean categorySet, String
});
tfFilename.setMinWidth(250);
TextField tfGistName = newTextField("New Gist", "");
tfGistName.setPromptText("Gist getName");
tfGistName.setPromptText("Gist getGitHubUsername");
tfGistName.textProperty().addListener((observable, oldValue, newValue) -> {if (newValue.isEmpty()) tfGistName.setText("New Gist");});
tfGistName.setMinWidth(200);
TextArea taGistDescription = new TextArea("Gist Description");
Expand Down
95 changes: 51 additions & 44 deletions src/main/java/com/redmondsims/gistfx/data/Action.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.redmondsims.gistfx.data;

import com.redmondsims.gistfx.data.metadata.Json;
import com.redmondsims.gistfx.data.metadata.MetaManager;
import com.redmondsims.gistfx.enums.LoginStates;
import com.redmondsims.gistfx.enums.Source;
import com.redmondsims.gistfx.gist.Gist;
Expand Down Expand Up @@ -47,8 +47,8 @@ public class Action {
private static final DoubleProperty progress = new SimpleDoubleProperty(0);
private static final GitHub GITHUB = new GitHub();
private static final SQLite SQLITE = new SQLite();
private static final Disk DISK = new Disk();
private static final Json JSON = new Json();
private static final Disk DISK = new Disk();
private static final MetaManager META_MANAGER = new MetaManager();

/**
* SQLite ONLY Methods
Expand All @@ -64,7 +64,7 @@ public static void deleteDatabaseFile() {

public static void addGistToSQL(Gist gist) {SQLITE.addGist(gist);}

public static void wipeSQLAndMetaData() {
public static void wipeSQLAndLocalData() {
SQLITE.cleanDatabase();
AppSettings.clear().metadata();
}
Expand Down Expand Up @@ -98,15 +98,20 @@ public static Map<String, Gist> getGistMap() {
}

public static String getGistName(@NotNull GHGist ghGist) {
return JSON.getName(ghGist.getGistId());
return getGistName(ghGist.getGistId());
}

public static String getGistName(String gistId) {
return JSON.getName(gistId);
String gistName = META_MANAGER.getName(gistId);
if(gistName.isEmpty()) {
gistName = GITHUB.getGistDescription(gistId);
setGistName(gistId,gistName);
}
return gistName;
}

public static void setGistName(String gistId, String newName) {
JSON.setName(gistId, newName);
META_MANAGER.setName(gistId, newName);
}

public static String getSQLMetadata() {
Expand Down Expand Up @@ -141,8 +146,8 @@ public static GHGist getNewGist(String description, String filename, String cont
return GITHUB.newGist(description,filename,content,isPublic);
}

public static String getName() {
return GITHUB.getName();
public static String getGitHubUsername() {
return GITHUB.getGitHubUsername();
}

public static GHGist addGistToGitHub(String description, String filename, String content, boolean isPublic) {
Expand Down Expand Up @@ -170,7 +175,7 @@ public static void loadWindow() {
else {
LoginWindow.updateProgress("Downloading Gist Objects");
Map<String,GHGist> ghGistMap = GITHUB.getNewGHGistMap();
GistManager.startFromGit(ghGistMap, Source.GITHUB);
GistManager.startFromGitHub(ghGistMap, Source.GITHUB);
}
}
else if (dataSource.equals(UISettings.DataSource.LOCAL)) {
Expand All @@ -179,7 +184,9 @@ else if (dataSource.equals(UISettings.DataSource.LOCAL)) {
}

public static void updateProgress(String text) {
LoginWindow.updateProgress(text);
Platform.runLater(() -> {
LoginWindow.updateProgress(text);
});
}

public static void refreshAllData() {
Expand Down Expand Up @@ -242,109 +249,105 @@ public static String getLocalGitHubVersion(int fileId) {
}

/**
* Json Methods
* MetaManager Methods
*/

public static void deleteGitHubMetadata() {JSON.deleteGitHubMetadata();}
public static void deleteGitHubMetadata() {META_MANAGER.deleteGitHubMetadata();}

public static void loadMetaData() {
JSON.loadMetaData();
}

public static String getJSonGistName(String gistId) {
return JSON.getName(gistId);
META_MANAGER.loadMetaData();
}

public static void deleteGistMetadata(String gistId) {
JSON.deleteGistMetadata(gistId);
META_MANAGER.deleteGistMetadata(gistId);
}

public static void setJsonName(String gistId, String name) {
JSON.setName(gistId,name);
META_MANAGER.setName(gistId, name);
}

/**
* Json Category Methods
* MetaManager Category Methods
*/

public static ObservableList<String> getCategoryList() {
return JSON.getCategoryList();
return META_MANAGER.getCategoryList();
}

public static void changeCategoryName(String oldName, String newName) {
JSON.changeCategoryName(oldName,newName);
META_MANAGER.changeCategoryName(oldName, newName);
}

public static void mapCategoryNameToGist(String gistId, String categoryName) {
JSON.mapCategoryNameToGist(gistId,categoryName);
META_MANAGER.mapCategoryNameToGist(gistId, categoryName);
}

public static void deleteCategoryName(String categoryName) {
JSON.deleteCategoryName(categoryName);
META_MANAGER.deleteCategoryName(categoryName);
}

public static void addCategoryName(String categoryName) {
JSON.addCategoryName(categoryName);
META_MANAGER.addCategoryName(categoryName);
}

public static Collection<String> getNameList() {
return JSON.getNameList();
return META_MANAGER.getNameList();
}

public static String getGistIdByName (String name) {
return JSON.getGistIdByName(name);
return META_MANAGER.getGistIdByName(name);
}

public static String getGistCategoryName(String gistId) {
return JSON.getGistCategoryName(gistId);
return META_MANAGER.getGistCategoryName(gistId);
}

public static ChoiceBox<String> getCategoryBox() {
return JSON.getGistCategoryBox();
return META_MANAGER.getGistCategoryBox();
}

public static List<Gist> getGistsInCategory(String category) {
return JSON.getGistsInCategory(category);
return META_MANAGER.getGistsInCategory(category);
}

/**
* Json File Description Methods
* MetaManager File Description Methods
*/

public static void setFileDescription(GistFile gistFile, String description) {
JSON.setFileDescription(gistFile,description);
META_MANAGER.setFileDescription(gistFile, description);
}

public static void setFileDescription(String gistId, String filename, String description) {
JSON.setFileDescription(gistId,filename,description);
META_MANAGER.setFileDescription(gistId, filename, description);
}

public static String getFileDescription(GistFile gistFile) {
return JSON.getFileDescription(gistFile);
return META_MANAGER.getFileDescription(gistFile);
}

public static void deleteFileDescription(String gistId, String filename) {
JSON.deleteFileDescription(gistId,filename);
META_MANAGER.deleteFileDescription(gistId, filename);
}

/**
* Json Hosts Methods
* MetaManager Hosts Methods
*/

public static void addHost(String host) {
JSON.addHost(host);
META_MANAGER.addHost(host);
}

public static Collection<String> getHostCollection() {
return JSON.getHostCollection();
return META_MANAGER.getHostCollection();
}

public static void removeHost(String host) {
JSON.removeHost(host);
META_MANAGER.removeHost(host);
}

public static void renameHost(String oldName, String newName) {
JSON.renameHost(oldName,newName);
META_MANAGER.renameHost(oldName, newName);
}

/**
Expand Down Expand Up @@ -374,6 +377,10 @@ public static void renameFile(String gistId, Integer fileId, String oldFilename,
SQLITE.renameFile(fileId,newFilename);
}

public static void getNewGHGistMap() {
GITHUB.getNewGHGistMap();
}

/**
* Methods that require multiple disciplines
*/
Expand Down Expand Up @@ -450,7 +457,7 @@ public static Tooltip newTooltip(String message) {
}

public static void setGitHubUserId(Long gitHubUserId) {
JSON.setGitHubUserId(gitHubUserId);
META_MANAGER.setGitHubUserId(gitHubUserId);
}

public static BooleanProperty getGitHubActivityProperty() {
Expand All @@ -469,7 +476,7 @@ public static boolean accessingGitHub() {

public static void deleteLocalGist(String gistId) {
SQLITE.deleteGist(gistId);
JSON.deleteGistMetadata(gistId);
META_MANAGER.deleteGistMetadata(gistId);
}

public static void deleteLocalFiles() {
Expand Down Expand Up @@ -499,7 +506,7 @@ public static void uploadGistToGitHub(String gistId) {
GITHUB.addFileToGist(newGistId,filename,content);
}
if(!newGistId.isEmpty()) {
JSON.changeGistId(gistId,newGistId);
META_MANAGER.changeGistId(gistId, newGistId);
}
}

Expand Down
Loading

0 comments on commit 696656c

Please sign in to comment.