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

@ -34,6 +34,8 @@ import static mage.client.dialog.PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_4
/**
* App GUI: waiting other players before join to a table
* <p>
* Do not use modal/callback, send direct commands to server
*
* @author BetaSteward_at_googlemail.com
*/
@ -101,7 +103,7 @@ public class TableWaitingDialog extends MageDialog {
this.btnMoveUp.setEnabled(false);
break;
default:
closeDialog();
doClose();
return;
}
int row = this.jTableSeats.getSelectedRow();
@ -113,10 +115,10 @@ public class TableWaitingDialog extends MageDialog {
this.jTableSeats.repaint();
this.jTableSeats.getSelectionModel().setSelectionInterval(row, row);
} else {
closeDialog();
doClose();
}
} catch (Exception ex) {
closeDialog();
doClose();
}
}
@ -149,11 +151,11 @@ public class TableWaitingDialog extends MageDialog {
GuiDisplayUtil.restoreDividerLocations(currentBounds, tournamentChatDivider, jSplitPane1);
} else {
closeDialog();
doClose();
}
}
public void closeDialog() {
public void doClose() {
if (updateTask != null) {
updateTask.cancel(true);
}
@ -249,10 +251,10 @@ public class TableWaitingDialog extends MageDialog {
private void btnStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStartActionPerformed
if (!isTournament) {
if (SessionHandler.startMatch(roomId, tableId)) {
closeDialog();
doClose();
}
} else if (SessionHandler.startTournament(roomId, tableId)) {
closeDialog();
doClose();
}
}//GEN-LAST:event_btnStartActionPerformed
@ -265,7 +267,7 @@ public class TableWaitingDialog extends MageDialog {
//swallow exception
LOGGER.error(e);
}
closeDialog();
doClose();
}//GEN-LAST:event_btnCancelActionPerformed
private void btnMoveDownActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMoveDownActionPerformed
@ -401,7 +403,7 @@ class UpdateSeatsTask extends SwingWorker<Void, TableView> {
if (tableView.isPresent()) {
tableView.ifPresent(this::publish);
} else {
dialog.closeDialog();
dialog.doClose();
}
TimeUnit.SECONDS.sleep(1);
}