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

@ -44,7 +44,7 @@ public class NewTournamentDialog extends MageDialog {
private UUID roomId;
private String lastSessionId;
private RandomPacksSelectorDialog randomPackSelector;
private CustomOptionsDialog customOptions;
private final CustomOptionsDialog customOptions;
private JTextArea txtRandomPacks;
private final java.util.List<TournamentPlayerPanel> players = new ArrayList<>();
private final java.util.List<JPanel> packPanels = new ArrayList<>();
@ -60,7 +60,7 @@ public class NewTournamentDialog extends MageDialog {
public NewTournamentDialog() {
initComponents();
this.customOptions = new CustomOptionsDialog(CustomOptionsDialog.SaveLoadKeys.TOURNEY, btnCustomOptions);
MageFrame.getDesktop().add(customOptions, JLayeredPane.MODAL_LAYER);
MageFrame.getDesktop().add(customOptions, customOptions.isModal() ? JLayeredPane.MODAL_LAYER : JLayeredPane.PALETTE_LAYER);
lastSessionId = "";
txtName.setText("Tournament");
this.spnNumWins.setModel(new SpinnerNumberModel(2, 1, 5, 1));
@ -657,6 +657,13 @@ public class NewTournamentDialog extends MageDialog {
}//GEN-LAST:event_cbTournamentTypeActionPerformed
private void doClose() {
if (this.customOptions.isVisible()) {
this.customOptions.hideDialog();
}
this.hideDialog();
}
private void btnOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOkActionPerformed
// get settings
@ -714,7 +721,7 @@ public class NewTournamentDialog extends MageDialog {
DeckImporter.importDeckFromFile(this.player1Panel.getDeckFile(), true),
tOptions.getPassword())) {
// all fine, can close create dialog (join dialog will be opened after feedback from server)
this.hideDialog();
doClose();
return;
}
@ -726,7 +733,7 @@ public class NewTournamentDialog 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 updateNumSeats() {