small fixes and qol

This commit is contained in:
potzplitz 2024-07-16 15:55:14 +02:00
parent 80dcc5fbf8
commit 184cde85d5
4 changed files with 14 additions and 18 deletions

View file

@ -91,8 +91,6 @@ public class DownloadLevels {
}
area.append(" >> ERFOLGREICH \n");
}
JOptionPane.showMessageDialog(null, "Alle " + ManageFiles.getMissinglevels().size() + " Level wurden erfolgreich heruntergeladen.", "Download abgeschlossen", JOptionPane.INFORMATION_MESSAGE);
main.dispose();
MainGUI gui = new MainGUI();

View file

@ -129,8 +129,8 @@ public class Sqlite {
+ " attempts INTEGER NOT NULL,\n"
+ " completed BOOLEAN NOT NULL,\n"
+ " locked BOOLEAN NOT NULL,\n" // Neue Spalte
+ " personalBest STRING,\n"
+ " levelLength String\n"
+ " personalBest STRING NOT NULL,\n"
+ " levelLength String NOT NULL\n"
+ ");";
try (Connection conn = DriverManager.getConnection(url);
@ -394,7 +394,7 @@ status = LoadingStatus.getInstance(); // Holen der Singleton-Instanz
}
private void createNewColumn(String tablename, String columnName) {
String sql = "ALTER TABLE " + tablename + " ADD COLUMN " + columnName + " TEXT";
String sql = "ALTER TABLE " + tablename + " ADD COLUMN " + columnName + " TEXT NOT NULL";
try (Connection conn = DriverManager.getConnection(url);
Statement stmt = conn.createStatement()) {
stmt.executeUpdate(sql);
@ -403,6 +403,7 @@ status = LoadingStatus.getInstance(); // Holen der Singleton-Instanz
}
}
public void moveDataToNewDatabase(String tablename) {
// Neuen Tabellennamen für die Kopie
String newTableName = tablename + "_new";

View file

@ -23,6 +23,13 @@ public class LoadingStatus {
initialize();
}
public static synchronized LoadingStatus getInstance() {
if (instance == null) {
instance = new LoadingStatus();
}
return instance;
}
public void initialize() {
main.setSize(400, 300);
main.setLayout(null);
@ -53,13 +60,6 @@ public class LoadingStatus {
main.setVisible(true);
}
public static synchronized LoadingStatus getInstance() {
if (instance == null) {
instance = new LoadingStatus();
}
return instance;
}
public void update(String level, int barValue) {
area.append(level + "\n");
bar.setValue(barValue + 1);

View file

@ -3,7 +3,6 @@ package gui;
import java.awt.Button;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.Toolkit;
@ -18,10 +17,6 @@ import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
@ -338,8 +333,10 @@ public class MainGUI {
String levellength = data.getLevelLength().get(index);
System.out.println("test:" + data.getLevelLength().get(index) + ".");
if(data.getLevelLength().get(index).equals("N/A") || data.getLevelID().get(index) == null) {
if(data.getLevelLength().get(index).equals("N/A") || data.getLevelLength().get(index) == null) {
levellength = api.getLevelLength(Integer.parseInt(data.getLevelID().get(index)));
data.modifyData(data.getLevelname().get(index), comp[index], Integer.parseInt(attempts.getText()), lockbool[index], data.getPbarr().get(index), levellength);
System.out.println("request");