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

@ -57,6 +57,8 @@ import java.util.concurrent.TimeUnit;
import static mage.client.dialog.PreferencesDialog.*;
/**
* GUI: lobby's main component
*
* @author BetaSteward_at_googlemail.com
*/
public class TablesPanel extends javax.swing.JPanel {
@ -140,9 +142,12 @@ public class TablesPanel extends javax.swing.JPanel {
private UpdateTablesTask updateTablesTask;
private UpdatePlayersTask updatePlayersTask;
private UpdateMatchesTask updateMatchesTask;
// no needs in multiple create/join tables dialogs, it's a client side action
private JoinTableDialog joinTableDialog;
private NewTableDialog newTableDialog;
private NewTournamentDialog newTournamentDialog;
private final GameChooser gameChooser;
private java.util.List<String> messages;
private int currentMessage;
@ -439,14 +444,18 @@ public class TablesPanel extends javax.swing.JPanel {
LOGGER.info("Joining tournament " + tableId);
if (!gameType.startsWith("Constructed")) {
if (TablesTableModel.PASSWORD_VALUE_YES.equals(pwdColumn)) {
// need enter password
joinTableDialog.showDialog(roomId, tableId, true, !gameType.startsWith("Constructed"));
} else {
// direct join (no pass, no deck)
SessionHandler.joinTournamentTable(roomId, tableId, SessionHandler.getUserName(), PlayerType.HUMAN, 1, null, "");
}
} else {
// need choose deck
joinTableDialog.showDialog(roomId, tableId, true, !gameType.startsWith("Constructed"));
}
} else {
// need choose deck
LOGGER.info("Joining table " + tableId);
joinTableDialog.showDialog(roomId, tableId, false, false);
}
@ -758,15 +767,15 @@ public class TablesPanel extends javax.swing.JPanel {
}
if (newTableDialog == null) {
newTableDialog = new NewTableDialog();
MageFrame.getDesktop().add(newTableDialog, JLayeredPane.MODAL_LAYER);
MageFrame.getDesktop().add(newTableDialog, newTableDialog.isModal() ? JLayeredPane.MODAL_LAYER : JLayeredPane.PALETTE_LAYER);
}
if (newTournamentDialog == null) {
newTournamentDialog = new NewTournamentDialog();
MageFrame.getDesktop().add(newTournamentDialog, JLayeredPane.MODAL_LAYER);
MageFrame.getDesktop().add(newTournamentDialog, newTournamentDialog.isModal() ? JLayeredPane.MODAL_LAYER : JLayeredPane.PALETTE_LAYER);
}
if (joinTableDialog == null) {
joinTableDialog = new JoinTableDialog();
MageFrame.getDesktop().add(joinTableDialog, JLayeredPane.MODAL_LAYER);
MageFrame.getDesktop().add(joinTableDialog, joinTableDialog.isModal() ? JLayeredPane.MODAL_LAYER : JLayeredPane.PALETTE_LAYER);
}
if (chatRoomId != null) {
this.chatPanelMain.getUserChatPanel().connect(chatRoomId);
@ -810,7 +819,7 @@ public class TablesPanel extends javax.swing.JPanel {
this.saveDividerLocations();
for (Component component : MageFrame.getDesktop().getComponents()) {
if (component instanceof TableWaitingDialog) {
((TableWaitingDialog) component).closeDialog();
((TableWaitingDialog) component).doClose();
}
}
stopTasks();