GUI: reworked GUI to support non-blocking UI:

- GUI: added non-blocking UI to almost all app and game dialogs;
- GUI: it allows to switch between UI dialogs and use any UI elements at any moment;
- GUI: it allows to use chat, card popup, battlefield, concede and other features while choosing (related to #12670);
- GUI: it allows to download images while playing (related to #4160, not fully tested);
- GUI: enabled by default, can be disabled by java option: -Dxmage.guiModalMode=true
- connection: auto-connect will be visible in main menu on startup;
- connection: removed some unused features (auto-connect by command line);
- connection: added <ESC> button to close connection dialog;
- download: added background images download (see non-blocking UI);
- download: improved cancel stability and fixes that it can't stop preparing/downloading process in some use cases;
- app: fixed freezes on macOS systems in some use cases (related to #12431, #11292, #9300, #4920);
This commit is contained in:
Oleg Agafonov 2024-09-08 00:40:13 +04:00
parent 2fc4e94b3a
commit 6625db1be1
40 changed files with 614 additions and 532 deletions

View file

@ -35,7 +35,7 @@ public class NewTableDialog extends MageDialog {
private static final Logger logger = Logger.getLogger(NewTableDialog.class);
private CustomOptionsDialog customOptions;
private final CustomOptionsDialog customOptions;
private TableView table;
private UUID playerId;
private UUID roomId;
@ -45,14 +45,11 @@ public class NewTableDialog extends MageDialog {
private static final String LIMITED = "Limited";
/**
* Creates new form NewTableDialog
*/
public NewTableDialog() {
lastSessionId = "";
initComponents();
this.customOptions = new CustomOptionsDialog(CustomOptionsDialog.SaveLoadKeys.TABLE, btnCustomOptions);
MageFrame.getDesktop().add(customOptions, JLayeredPane.MODAL_LAYER);
MageFrame.getDesktop().add(customOptions, customOptions.isModal() ? JLayeredPane.MODAL_LAYER : JLayeredPane.PALETTE_LAYER);
player1Panel.showLevel(false);
this.spnNumWins.setModel(new SpinnerNumberModel(1, 1, 5, 1));
this.spnQuitRatio.setModel(new SpinnerNumberModel(100, 0, 100, 5));
@ -480,12 +477,19 @@ public class NewTableDialog extends MageDialog {
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
this.table = null;
this.playerId = null;
this.hideDialog();
doClose();
}//GEN-LAST:event_btnCancelActionPerformed
private void btnPreviousConfigurationActionPerformed(java.awt.event.ActionEvent evt, int i) {//GEN-FIRST:event_btnPreviousConfigurationActionPerformed
}//GEN-LAST:event_btnPreviousConfigurationActionPerformed
private void doClose() {
if (this.customOptions.isVisible()) {
this.customOptions.hideDialog();
}
this.hideDialog();
}
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
MatchOptions options = getMatchOptions();
@ -524,7 +528,7 @@ public class NewTableDialog extends MageDialog {
DeckImporter.importDeckFromFile(this.player1Panel.getDeckFile(), true),
this.txtPassword.getText())) {
// all fine, can close create dialog (join dialog will be opened after feedback from server)
this.hideDialog();
doClose();
return;
}
} catch (ClassNotFoundException | IOException ex) {