Merge pull request #5261 from dignow/refact/separate_remote_window

Refact/separate remote window
This commit is contained in:
RustDesk 2023-08-06 11:30:44 +08:00 committed by GitHub
commit a47db31d46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
39 changed files with 41 additions and 42 deletions

View File

@ -2,7 +2,6 @@ import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_hbb/common/widgets/address_book.dart';
import 'package:flutter_hbb/common/widgets/dialog.dart'; import 'package:flutter_hbb/common/widgets/dialog.dart';
import 'package:flutter_hbb/consts.dart'; import 'package:flutter_hbb/consts.dart';
import 'package:flutter_hbb/models/peer_tab_model.dart'; import 'package:flutter_hbb/models/peer_tab_model.dart';

View File

@ -39,10 +39,10 @@ const String kWindowEventActiveSession = "active_session";
const String kWindowEventGetRemoteList = "get_remote_list"; const String kWindowEventGetRemoteList = "get_remote_list";
const String kWindowEventGetSessionIdList = "get_session_id_list"; const String kWindowEventGetSessionIdList = "get_session_id_list";
const String kWindowEventSplit = "split"; const String kWindowEventMoveTabToNewWindow = "move_tab_to_new_window";
const String kWindowEventCloseForSeparateWindow = "close_for_separate_window"; const String kWindowEventCloseForSeparateWindow = "close_for_separate_window";
const String kOptionSeparateRemoteWindow = "enable-separate-remote-window"; const String kOptionSeparateRemoteWindow = "allow-separate-remote-window";
const String kUniLinksPrefix = "rustdesk://"; const String kUniLinksPrefix = "rustdesk://";
const String kUrlActionClose = "close"; const String kUrlActionClose = "close";

View File

@ -570,7 +570,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
forceRelay: call.arguments['forceRelay'], forceRelay: call.arguments['forceRelay'],
forceSeparateWindow: call.arguments['forceSeparateWindow'], forceSeparateWindow: call.arguments['forceSeparateWindow'],
); );
} else if (call.method == kWindowEventSplit) { } else if (call.method == kWindowEventMoveTabToNewWindow) {
final args = call.arguments.split(','); final args = call.arguments.split(',');
int? windowId; int? windowId;
try { try {
@ -579,7 +579,7 @@ class _DesktopHomePageState extends State<DesktopHomePage>
debugPrint("Failed to parse window id '${call.arguments}': $e"); debugPrint("Failed to parse window id '${call.arguments}': $e");
} }
if (windowId != null) { if (windowId != null) {
await rustDeskWinManager.splitWindow(windowId, args[1], args[2]); await rustDeskWinManager.moveTabToNewWindow(windowId, args[1], args[2]);
} }
} }
}); });

View File

@ -332,12 +332,12 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
if (tabController.state.value.tabs.length > 1) { if (tabController.state.value.tabs.length > 1) {
final splitAction = MenuEntryButton<String>( final splitAction = MenuEntryButton<String>(
childBuilder: (TextStyle? style) => Text( childBuilder: (TextStyle? style) => Text(
translate('Split'), translate('Move tab to new window'),
style: style, style: style,
), ),
proc: () async { proc: () async {
await DesktopMultiWindow.invokeMethod( await DesktopMultiWindow.invokeMethod(
kMainWindowId, kWindowEventSplit, '${windowId()},$key,$sessionId'); kMainWindowId, kWindowEventMoveTabToNewWindow, '${windowId()},$key,$sessionId');
cancelFunc(); cancelFunc();
}, },
padding: padding, padding: padding,

View File

@ -43,7 +43,7 @@ class RustDeskMultiWindowManager {
final List<int> _fileTransferWindows = List.empty(growable: true); final List<int> _fileTransferWindows = List.empty(growable: true);
final List<int> _portForwardWindows = List.empty(growable: true); final List<int> _portForwardWindows = List.empty(growable: true);
splitWindow(int windowId, String peerId, String sessionId) async { moveTabToNewWindow(int windowId, String peerId, String sessionId) async {
var params = { var params = {
'type': WindowType.RemoteDesktop.index, 'type': WindowType.RemoteDesktop.index,
'id': peerId, 'id': peerId,

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", "对标签进行排序"), ("Sort tags", "对标签进行排序"),
("Separate remote window", "使用独立远程窗口"), ("Separate remote window", "使用独立远程窗口"),
("separate window", "独立窗口"), ("separate window", "独立窗口"),
("Split", "拆分"), ("Move tab to new window", "将标签页移至新窗口"),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", "Tags sortieren"), ("Sort tags", "Tags sortieren"),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", "Ordenar etiquetas"), ("Sort tags", "Ordenar etiquetas"),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", "Ordina etichette"), ("Sort tags", "Ordina etichette"),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", "Labels sorteren"), ("Sort tags", "Labels sorteren"),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", "Сортировка меток"), ("Sort tags", "Сортировка меток"),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -526,6 +526,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Sort tags", ""), ("Sort tags", ""),
("Separate remote window", ""), ("Separate remote window", ""),
("separate window", ""), ("separate window", ""),
("Split", ""), ("Move tab to new window", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }