Merge pull request #1389 from SiboVG/filesizeest

Replace save file size estimation by info label
This commit is contained in:
SiboVG 2022-05-29 19:02:35 +02:00 committed by GitHub
commit 92e4d8ea4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 19 additions and 58 deletions

View File

@ -1229,8 +1229,10 @@ StorageOptChooser.rdbut.Onlyprimfig = Only primary figures
StorageOptChooser.lbl.longC1 = <html>Store only the values shown in the summary table.<br> StorageOptChooser.lbl.longC1 = <html>Store only the values shown in the summary table.<br>
StorageOptChooser.lbl.longC2 = This results in the smallest files. StorageOptChooser.lbl.longC2 = This results in the smallest files.
StorageOptChooser.lbl.longD1 = An estimate on how large the resulting file would be with the present options. StorageOptChooser.lbl.longD1 = An estimate on how large the resulting file would be with the present options.
StorageOptChooser.lbl.info1 = Largest file size
StorageOptChooser.lbl.info2 = Smaller file size
StorageOptChooser.lbl.info3 = Smallest file size
StorageOptChooser.ttip.Saveopt = Save options StorageOptChooser.ttip.Saveopt = Save options
StorageOptChooser.lbl.Estfilesize = Estimated file size:
StorageOptChooser.lbl.Saveopt = Save options StorageOptChooser.lbl.Saveopt = Save options
! ThrustCurveMotorSelectionPanel ! ThrustCurveMotorSelectionPanel

View File

@ -932,7 +932,6 @@ StorageOptChooser.checkbox.Compfile = Zkomprimovat soubor
StorageOptChooser.lbl.UsingComp = Pou\u017Eitím komprese se významne redukuje velikost souboru. StorageOptChooser.lbl.UsingComp = Pou\u017Eitím komprese se významne redukuje velikost souboru.
StorageOptChooser.lbl.longD1 = Odhad jak velký bude výsledný soubor se stavajícím nastavením. StorageOptChooser.lbl.longD1 = Odhad jak velký bude výsledný soubor se stavajícím nastavením.
StorageOptChooser.ttip.Saveopt = Ulo\u017Eit nastavení StorageOptChooser.ttip.Saveopt = Ulo\u017Eit nastavení
StorageOptChooser.lbl.Estfilesize = Odhadovaná velikost souboru:
StorageOptChooser.lbl.Saveopt = Ulo\u017Eit nastavení StorageOptChooser.lbl.Saveopt = Ulo\u017Eit nastavení
! ThrustCurveMotorSelectionPanel ! ThrustCurveMotorSelectionPanel

View File

@ -989,7 +989,6 @@ StorageOptChooser.checkbox.Compfile = Datei komprimieren
StorageOptChooser.lbl.UsingComp = Kompression der Datei verringert die Größe signifikant. StorageOptChooser.lbl.UsingComp = Kompression der Datei verringert die Größe signifikant.
StorageOptChooser.lbl.longD1 = Eine Schätzung der Dateigröße mit den gegebenen Optionen. StorageOptChooser.lbl.longD1 = Eine Schätzung der Dateigröße mit den gegebenen Optionen.
StorageOptChooser.ttip.Saveopt = Speicheroptionen StorageOptChooser.ttip.Saveopt = Speicheroptionen
StorageOptChooser.lbl.Estfilesize = Voraussichtliche Dateigröße:
StorageOptChooser.lbl.Saveopt = Speicheroptionen StorageOptChooser.lbl.Saveopt = Speicheroptionen
! ThrustCurveMotorSelectionPanel ! ThrustCurveMotorSelectionPanel

View File

@ -1063,7 +1063,6 @@ StageConfig.tab.Separation = Separaci\u00f3n
StageConfig.tab.Separation.ttip = Opciones de separaci\u00f3n de etapa StageConfig.tab.Separation.ttip = Opciones de separaci\u00f3n de etapa
StorageOptChooser.checkbox.Compfile = Archivo comprimido StorageOptChooser.checkbox.Compfile = Archivo comprimido
StorageOptChooser.lbl.Estfilesize = Estimaci\u00f3n del tama\u00f1o del archivo:
StorageOptChooser.lbl.Saveopt = Guardar opciones StorageOptChooser.lbl.Saveopt = Guardar opciones
! StorageOptionChooser ! StorageOptionChooser
StorageOptChooser.lbl.Simdatatostore = Datos de las simulaciones a guardar: StorageOptChooser.lbl.Simdatatostore = Datos de las simulaciones a guardar:

View File

@ -1056,7 +1056,6 @@ StageConfig.tab.Separation = S\u00E9paration
StageConfig.tab.Separation.ttip = Options de s\u00E9paration de l'\u00E9tage StageConfig.tab.Separation.ttip = Options de s\u00E9paration de l'\u00E9tage
StorageOptChooser.checkbox.Compfile = Compresse le fichier StorageOptChooser.checkbox.Compfile = Compresse le fichier
StorageOptChooser.lbl.Estfilesize = Taille estim\u00E9e du fichier:
StorageOptChooser.lbl.Saveopt = Options de sauvegarde StorageOptChooser.lbl.Saveopt = Options de sauvegarde
! StorageOptionChooser ! StorageOptionChooser
StorageOptChooser.lbl.Simdatatostore = Donn\u00E9es simul\u00E9es \u00E0 stocker: StorageOptChooser.lbl.Simdatatostore = Donn\u00E9es simul\u00E9es \u00E0 stocker:

View File

@ -991,7 +991,6 @@ StorageOptChooser.checkbox.Compfile = Comprimi file
StorageOptChooser.lbl.UsingComp = Usare la compressione riduce significativamente la dimensione dei files. StorageOptChooser.lbl.UsingComp = Usare la compressione riduce significativamente la dimensione dei files.
StorageOptChooser.lbl.longD1 = Stima di quanto grossi possono essere i files con le impostazioni attuali. StorageOptChooser.lbl.longD1 = Stima di quanto grossi possono essere i files con le impostazioni attuali.
StorageOptChooser.ttip.Saveopt = Salva le opzioni StorageOptChooser.ttip.Saveopt = Salva le opzioni
StorageOptChooser.lbl.Estfilesize = Stima della dimensione del file:
StorageOptChooser.lbl.Saveopt = Salva le opzioni StorageOptChooser.lbl.Saveopt = Salva le opzioni
! ThrustCurveMotorSelectionPanel ! ThrustCurveMotorSelectionPanel

View File

@ -1021,7 +1021,6 @@ StorageOptChooser.checkbox.Compfile = \u30D5\u30A1\u30A4\u30EB\u306E\u5727\u7E2
StorageOptChooser.lbl.UsingComp = \u30D5\u30A1\u30A4\u30EB\u30B5\u30A4\u30BA\u3092\u5727\u7E2E\u3059\u308B StorageOptChooser.lbl.UsingComp = \u30D5\u30A1\u30A4\u30EB\u30B5\u30A4\u30BA\u3092\u5727\u7E2E\u3059\u308B
StorageOptChooser.lbl.longD1 = \u73FE\u5728\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3069\u308C\u307B\u3069\u5727\u7E2E\u3067\u304D\u308B\u304B\u306E\u63A8\u5B9A StorageOptChooser.lbl.longD1 = \u73FE\u5728\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u3069\u308C\u307B\u3069\u5727\u7E2E\u3067\u304D\u308B\u304B\u306E\u63A8\u5B9A
StorageOptChooser.ttip.Saveopt = \u4FDD\u5B58\u30AA\u30D7\u30B7\u30E7\u30F3 StorageOptChooser.ttip.Saveopt = \u4FDD\u5B58\u30AA\u30D7\u30B7\u30E7\u30F3
StorageOptChooser.lbl.Estfilesize = \u63A8\u5B9A\u30D5\u30A1\u30A4\u30EB\u30B5\u30A4\u30BA\uFF1A
StorageOptChooser.lbl.Saveopt = \u4FDD\u5B58\u30AA\u30D7\u30B7\u30E7\u30F3 StorageOptChooser.lbl.Saveopt = \u4FDD\u5B58\u30AA\u30D7\u30B7\u30E7\u30F3
! ThrustCurveMotorSelectionPanel ! ThrustCurveMotorSelectionPanel

View File

@ -1180,7 +1180,6 @@ StorageOptChooser.lbl.longC1 = <html>Sla alleen de waarden op die in de overzich
StorageOptChooser.lbl.longC2 = Dit resulteert in de kleinste bestanden. StorageOptChooser.lbl.longC2 = Dit resulteert in de kleinste bestanden.
StorageOptChooser.lbl.longD1 = Een schatting van hoe groot het resulterende bestand zou zijn met de huidige opties. StorageOptChooser.lbl.longD1 = Een schatting van hoe groot het resulterende bestand zou zijn met de huidige opties.
StorageOptChooser.ttip.Saveopt = Bewaaropties StorageOptChooser.ttip.Saveopt = Bewaaropties
StorageOptChooser.lbl.Estfilesize = Geschatte bestandsgrootte:
StorageOptChooser.lbl.Saveopt = Bewaaropties StorageOptChooser.lbl.Saveopt = Bewaaropties
! ThrustCurveMotorSelectionPanel ! ThrustCurveMotorSelectionPanel

View File

@ -934,7 +934,6 @@ update.dlg.latestVersion = Korzystasz z najnowszej wersji OpenRocket: %s.
StorageOptChooser.lbl.UsingComp = Kompresowanie pliku zmniejsza znacznie jego rozmiar. StorageOptChooser.lbl.UsingComp = Kompresowanie pliku zmniejsza znacznie jego rozmiar.
StorageOptChooser.lbl.longD1 = Szacunkowy rozmiar pliku przy bie\u017C\u0105cych ustawieniach. StorageOptChooser.lbl.longD1 = Szacunkowy rozmiar pliku przy bie\u017C\u0105cych ustawieniach.
StorageOptChooser.ttip.Saveopt = Zapisz opcje StorageOptChooser.ttip.Saveopt = Zapisz opcje
StorageOptChooser.lbl.Estfilesize = Przybli\u017Cony rozmiar pliku:
StorageOptChooser.lbl.Saveopt = Zapisz opcje StorageOptChooser.lbl.Saveopt = Zapisz opcje
! ThrustCurveMotorSelectionPanel ! ThrustCurveMotorSelectionPanel

View File

@ -1033,7 +1033,6 @@ StageConfig.tab.Separation = Separa\u00e7\u00e3o
StageConfig.tab.Separation.ttip = Op\u00e7\u00f5es de separa\u00e7\u00e3o de est\u00e1gio StageConfig.tab.Separation.ttip = Op\u00e7\u00f5es de separa\u00e7\u00e3o de est\u00e1gio
StorageOptChooser.checkbox.Compfile = Compactar arquivos StorageOptChooser.checkbox.Compfile = Compactar arquivos
StorageOptChooser.lbl.Estfilesize = Tamanho estimado:
StorageOptChooser.lbl.Saveopt = Salvar as Op\u00e7\u00f5es StorageOptChooser.lbl.Saveopt = Salvar as Op\u00e7\u00f5es
# StorageOptionChooser # StorageOptionChooser
StorageOptChooser.lbl.Simdatatostore = Dados simulados para armazenar: StorageOptChooser.lbl.Simdatatostore = Dados simulados para armazenar:

View File

@ -1084,7 +1084,6 @@ StorageOptChooser.lbl.longC1 = <html>\u0421\u043e\u0445\u0440\u0430\u043d\u0438\
StorageOptChooser.lbl.longC2 = \u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430. StorageOptChooser.lbl.longC2 = \u042d\u0442\u043e \u0434\u0430\u0435\u0442 \u043d\u0430\u0438\u043c\u0435\u043d\u044c\u0448\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430.
StorageOptChooser.lbl.longD1 = \u041f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438. StorageOptChooser.lbl.longD1 = \u041f\u0440\u0438\u0431\u043b\u0438\u0437\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043e\u0446\u0435\u043d\u043a\u0430 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438.
StorageOptChooser.ttip.Saveopt = \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 StorageOptChooser.ttip.Saveopt = \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430
StorageOptChooser.lbl.Estfilesize = \u041e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430:
StorageOptChooser.lbl.Saveopt = \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f StorageOptChooser.lbl.Saveopt = \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f
! ThrustCurveMotorSelectionPanel ! ThrustCurveMotorSelectionPanel

View File

@ -1089,7 +1089,6 @@ StorageOptChooser.lbl.longC1 = <html>Store only the values shown in the summary
StorageOptChooser.lbl.longC2 = This results in the smallest files. StorageOptChooser.lbl.longC2 = This results in the smallest files.
StorageOptChooser.lbl.longD1 = An estimate on how large the resulting file would be with the present options. StorageOptChooser.lbl.longD1 = An estimate on how large the resulting file would be with the present options.
StorageOptChooser.ttip.Saveopt = Save options StorageOptChooser.ttip.Saveopt = Save options
StorageOptChooser.lbl.Estfilesize = Estimated file size:
StorageOptChooser.lbl.Saveopt = Save options StorageOptChooser.lbl.Saveopt = Save options
! ThrustCurveMotorSelectionPanel ! ThrustCurveMotorSelectionPanel

View File

@ -1130,7 +1130,6 @@ StageConfig.separation.lbl.title = \u8BBE\u5B9A\u5206\u79BB\u65F6\u673A:
StageConfig.tab.Separation = \u5206\u79BB StageConfig.tab.Separation = \u5206\u79BB
StageConfig.tab.Separation.ttip = \u591A\u7EA7\u5206\u79BB\u9009\u9879 StageConfig.tab.Separation.ttip = \u591A\u7EA7\u5206\u79BB\u9009\u9879
StorageOptChooser.lbl.Estfilesize = \u9884\u8BA1\u6587\u4EF6\u4F53\u79EF:
StorageOptChooser.lbl.Saveopt = \u4FDD\u5B58\u9009\u9879 StorageOptChooser.lbl.Saveopt = \u4FDD\u5B58\u9009\u9879
! StorageOptionChooser ! StorageOptionChooser
StorageOptChooser.lbl.Simdatatostore = \u4FDD\u5B58\u4EFF\u771F\u6570\u636E: StorageOptChooser.lbl.Simdatatostore = \u4FDD\u5B58\u4EFF\u771F\u6570\u636E:

View File

@ -39,7 +39,7 @@ public class StorageOptionChooser extends JPanel {
private JSpinner timeSpinner; private JSpinner timeSpinner;
private JLabel estimateLabel; private JLabel infoLabel;
private boolean artificialEvent = false; private boolean artificialEvent = false;
@ -51,16 +51,10 @@ public class StorageOptionChooser extends JPanel {
this.document = doc; this.document = doc;
ChangeListener changeUpdater = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
updateEstimate();
}
};
ActionListener actionUpdater = new ActionListener() { ActionListener actionUpdater = new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
updateEstimate(); updateInfoLabel();
} }
}; };
@ -103,7 +97,6 @@ public class StorageOptionChooser extends JPanel {
} }
}); });
this.add(timeSpinner, "wmin 55lp"); this.add(timeSpinner, "wmin 55lp");
timeSpinner.addChangeListener(changeUpdater);
//// seconds //// seconds
JLabel label = new JLabel(trans.get("StorageOptChooser.lbl.seconds")); JLabel label = new JLabel(trans.get("StorageOptChooser.lbl.seconds"));
@ -120,12 +113,10 @@ public class StorageOptionChooser extends JPanel {
noneButton.addActionListener(actionUpdater); noneButton.addActionListener(actionUpdater);
this.add(noneButton, "spanx, wrap 20lp"); this.add(noneButton, "spanx, wrap 20lp");
// Estimate is updated in loadOptions(opts) // File size info label
estimateLabel = new JLabel(""); infoLabel = new JLabel("");
//// An estimate on how large the resulting file would infoLabel.setToolTipText(trans.get("StorageOptChooser.lbl.longD1"));
//// be with the present options. this.add(infoLabel, "spanx");
estimateLabel.setToolTipText(trans.get("StorageOptChooser.lbl.longD1"));
this.add(estimateLabel, "spanx");
this.setBorder(BorderFactory.createCompoundBorder( this.setBorder(BorderFactory.createCompoundBorder(
@ -157,7 +148,7 @@ public class StorageOptionChooser extends JPanel {
timeSpinner.setValue(t); timeSpinner.setValue(t);
artificialEvent = false; artificialEvent = false;
updateEstimate(); updateInfoLabel();
} }
@ -177,36 +168,16 @@ public class StorageOptionChooser extends JPanel {
opts.setExplicitlySet(true); opts.setExplicitlySet(true);
} }
private void updateInfoLabel() {
if (allButton.isSelected()) {
// TODO: MEDIUM: The estimation method always uses OpenRocketSaver! infoLabel.setText(trans.get("StorageOptChooser.lbl.info1"));
private static final RocketSaver ROCKET_SAVER = new OpenRocketSaver(); } else if (noneButton.isSelected()) {
infoLabel.setText(trans.get("StorageOptChooser.lbl.info3"));
private void updateEstimate() {
StorageOptions opts = new StorageOptions();
storeOptions(opts);
long size = ROCKET_SAVER.estimateFileSize(document, opts);
size = Math.max((size+512)/1024, 1);
String formatted;
if (size >= 10000) {
formatted = (size/1000) + " MB";
} else if (size >= 1000){
formatted = (size/1000) + "." + ((size/100)%10) + " MB";
} else if (size >= 100) {
formatted = ((size/10)*10) + " kB";
} else { } else {
formatted = size + " kB"; infoLabel.setText(trans.get("StorageOptChooser.lbl.info2"));
} }
//// Estimated file size:
estimateLabel.setText(trans.get("StorageOptChooser.lbl.Estfilesize") + " " + formatted);
} }
/** /**
* Asks the user the storage options using a modal dialog window if the document * Asks the user the storage options using a modal dialog window if the document
* contains simulated data and the user has not explicitly set how to store the data. * contains simulated data and the user has not explicitly set how to store the data.