mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-24 08:30:27 +00:00
Improve tab pins
This commit is contained in:
parent
82e6b7a035
commit
bb0e049835
16 changed files with 95 additions and 23 deletions
|
@ -5,6 +5,7 @@ import io.xpipe.app.browser.file.BrowserHistorySavedState;
|
|||
import io.xpipe.app.browser.file.BrowserHistorySavedStateImpl;
|
||||
import io.xpipe.app.browser.file.BrowserHistoryTabModel;
|
||||
import io.xpipe.app.browser.file.BrowserTransferModel;
|
||||
import io.xpipe.app.prefs.AppPrefs;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import io.xpipe.app.storage.DataStoreEntryRef;
|
||||
import io.xpipe.app.util.BooleanScope;
|
||||
|
@ -34,6 +35,13 @@ public class BrowserFullSessionModel extends BrowserAbstractSessionModel<Browser
|
|||
|
||||
static {
|
||||
DEFAULT.getSessionEntries().add(new BrowserHistoryTabModel(DEFAULT));
|
||||
if (AppPrefs.get().pinLocalMachineOnStartup().get()) {
|
||||
var tab = new BrowserFileSystemTabModel(DEFAULT, DataStorage.get().local().ref(), BrowserFileSystemTabModel.SelectionMode.ALL);
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
DEFAULT.openSync(tab,null);
|
||||
DEFAULT.pinTab(tab);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private final BrowserTransferModel localTransfersStage = new BrowserTransferModel(this);
|
||||
|
@ -41,6 +49,7 @@ public class BrowserFullSessionModel extends BrowserAbstractSessionModel<Browser
|
|||
private final Property<BrowserSessionTab> globalPinnedTab = new SimpleObjectProperty<>();
|
||||
private final ObservableMap<BrowserSessionTab, BrowserSessionTab> splits = FXCollections.observableHashMap();
|
||||
private final ObservableValue<BrowserSessionTab> effectiveRightTab = createEffectiveRightTab();
|
||||
private final SequencedSet<BrowserSessionTab> previousTabs = new LinkedHashSet<>();
|
||||
|
||||
private ObservableValue<BrowserSessionTab> createEffectiveRightTab() {
|
||||
return Bindings.createObjectBinding(
|
||||
|
@ -80,6 +89,13 @@ public class BrowserFullSessionModel extends BrowserAbstractSessionModel<Browser
|
|||
|
||||
splits.keySet().removeIf(browserSessionTab -> !c.getList().contains(browserSessionTab));
|
||||
});
|
||||
|
||||
selectedEntry.addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue != null) {
|
||||
previousTabs.remove(newValue);
|
||||
previousTabs.add(newValue);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Set<BrowserSessionTab> getAllTabs() {
|
||||
|
@ -118,9 +134,10 @@ public class BrowserFullSessionModel extends BrowserAbstractSessionModel<Browser
|
|||
|
||||
globalPinnedTab.setValue(tab);
|
||||
|
||||
var nextIndex = getSessionEntries().indexOf(tab) + 1;
|
||||
if (nextIndex < getSessionEntries().size()) {
|
||||
getSelectedEntry().setValue(getSessionEntries().get(nextIndex));
|
||||
var previousOthers = previousTabs.stream().filter(browserSessionTab -> browserSessionTab != tab).toList();
|
||||
var prev = previousOthers.getLast();
|
||||
if (prev != null) {
|
||||
getSelectedEntry().setValue(prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package io.xpipe.app.browser.file;
|
||||
|
||||
import io.xpipe.app.browser.BrowserFullSessionModel;
|
||||
import io.xpipe.app.browser.action.BrowserAction;
|
||||
import io.xpipe.app.comp.Comp;
|
||||
import io.xpipe.app.comp.SimpleComp;
|
||||
import io.xpipe.app.comp.SimpleCompStructure;
|
||||
import io.xpipe.app.comp.augment.ContextMenuAugment;
|
||||
import io.xpipe.app.comp.base.ModalOverlayComp;
|
||||
import io.xpipe.app.comp.base.MultiContentComp;
|
||||
import io.xpipe.app.comp.base.TooltipAugment;
|
||||
import io.xpipe.app.comp.base.VerticalComp;
|
||||
import io.xpipe.app.comp.base.*;
|
||||
import io.xpipe.app.core.AppFont;
|
||||
import io.xpipe.app.util.InputHelper;
|
||||
|
||||
import io.xpipe.app.util.PlatformThread;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.MenuButton;
|
||||
|
@ -96,6 +96,28 @@ public class BrowserFileSystemTabComp extends SimpleComp {
|
|||
refreshBtn,
|
||||
terminalBtn,
|
||||
menuButton);
|
||||
|
||||
if (model.getBrowserModel() instanceof BrowserFullSessionModel fullSessionModel) {
|
||||
var pinButton = new Button();
|
||||
pinButton.graphicProperty().bind(PlatformThread.sync(Bindings.createObjectBinding(() -> {
|
||||
if (fullSessionModel.getGlobalPinnedTab().getValue() != model) {
|
||||
return new FontIcon("mdi2p-pin");
|
||||
}
|
||||
|
||||
return new FontIcon("mdi2p-pin-off");
|
||||
}, fullSessionModel.getGlobalPinnedTab())));
|
||||
pinButton.setOnAction(e -> {
|
||||
if (fullSessionModel.getGlobalPinnedTab().getValue() != model) {
|
||||
fullSessionModel.pinTab(model);
|
||||
} else {
|
||||
fullSessionModel.unpinTab(model);
|
||||
}
|
||||
e.consume();
|
||||
});
|
||||
topBar.getChildren().add(7, pinButton);
|
||||
squaredSize(navBar.get(), pinButton, true);
|
||||
}
|
||||
|
||||
squaredSize(navBar.get(), overview, true);
|
||||
squaredSize(navBar.get(), backBtn, true);
|
||||
squaredSize(navBar.get(), forthBtn, true);
|
||||
|
|
|
@ -43,6 +43,13 @@ public class AppPrefs {
|
|||
@Getter
|
||||
private final BooleanProperty requiresRestart = new SimpleBooleanProperty(false);
|
||||
|
||||
final BooleanProperty pinLocalMachineOnStartup =
|
||||
map(Mapping.builder()
|
||||
.property(new SimpleBooleanProperty(false))
|
||||
.key("pinLocalMachineOnStartup")
|
||||
.valueClass(Boolean.class)
|
||||
.requiresRestart(true)
|
||||
.build());
|
||||
final BooleanProperty dontAllowTerminalRestart =
|
||||
mapVaultShared(new SimpleBooleanProperty(false), "dontAllowTerminalRestart", Boolean.class, false);
|
||||
final BooleanProperty enableHttpApi =
|
||||
|
@ -191,6 +198,10 @@ public class AppPrefs {
|
|||
return dontAllowTerminalRestart;
|
||||
}
|
||||
|
||||
public ObservableBooleanValue pinLocalMachineOnStartup() {
|
||||
return pinLocalMachineOnStartup;
|
||||
}
|
||||
|
||||
private final IntegerProperty editorReloadTimeout =
|
||||
mapLocal(new SimpleIntegerProperty(1000), "editorReloadTimeout", Integer.class, false);
|
||||
private final BooleanProperty confirmDeletions =
|
||||
|
@ -480,19 +491,21 @@ public class AppPrefs {
|
|||
@SuppressWarnings("unchecked")
|
||||
private <T> T map(Mapping m) {
|
||||
mapping.add(m);
|
||||
m.property.addListener((observable, oldValue, newValue) -> {
|
||||
var running = OperationMode.get() == OperationMode.GUI;
|
||||
if (running && m.requiresRestart) {
|
||||
AppPrefs.get().requiresRestart.set(true);
|
||||
}
|
||||
});
|
||||
return (T) m.getProperty();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T mapLocal(Property<?> o, String name, Class<?> clazz, boolean requiresRestart) {
|
||||
mapping.add(new Mapping(name, o, clazz, false, requiresRestart));
|
||||
return (T) o;
|
||||
return map(new Mapping(name, o, clazz, false, requiresRestart));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T mapVaultShared(T o, String name, Class<?> clazz, boolean requiresRestart) {
|
||||
mapping.add(new Mapping(name, (Property<T>) o, (Class<T>) clazz, true, requiresRestart));
|
||||
return o;
|
||||
private <T> T mapVaultShared(Property<?> o, String name, Class<?> clazz, boolean requiresRestart) {
|
||||
return map(new Mapping(name, o, clazz, true, requiresRestart));
|
||||
}
|
||||
|
||||
public <T> void setFromExternal(ObservableValue<T> prop, T newValue) {
|
||||
|
@ -646,13 +659,6 @@ public class AppPrefs {
|
|||
this.vaultSpecific = vaultSpecific;
|
||||
this.requiresRestart = requiresRestart;
|
||||
this.licenseFeatureId = null;
|
||||
|
||||
this.property.addListener((observable, oldValue, newValue) -> {
|
||||
var running = OperationMode.get() == OperationMode.GUI;
|
||||
if (running && requiresRestart) {
|
||||
AppPrefs.get().requiresRestart.set(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,10 @@ public class FileBrowserCategory extends AppPrefsCategory {
|
|||
.pref(prefs.confirmAllDeletions)
|
||||
.addToggle(prefs.confirmAllDeletions)
|
||||
.pref(prefs.downloadsDirectory)
|
||||
.addString(prefs.downloadsDirectory))
|
||||
.addString(prefs.downloadsDirectory)
|
||||
.pref(prefs.pinLocalMachineOnStartup)
|
||||
.addToggle(prefs.pinLocalMachineOnStartup)
|
||||
)
|
||||
.buildComp();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -554,3 +554,5 @@ enableTerminalDocking=Aktiver terminal-docking
|
|||
enableTerminalDockingDescription=Med terminal-docking kan du docke terminalvinduer til XPipe-applikationsvinduet for at simulere en nogenlunde integreret terminal. Terminalvinduerne styres derefter af XPipe, så de altid passer ind i docken.
|
||||
downloadsDirectory=Brugerdefineret download-mappe
|
||||
downloadsDirectoryDescription=Den brugerdefinerede mappe, som downloadede filer skal placeres i, når man klikker på knappen Flyt til downloads. Som standard vil XPipe bruge din brugers download-bibliotek.
|
||||
pinLocalMachineOnStartup=Fastgør fane for lokal maskine ved opstart
|
||||
pinLocalMachineOnStartupDescription=Åbn automatisk en fane på den lokale maskine og fastgør den. Det er nyttigt, hvis du ofte bruger en delt filbrowser med den lokale maskine og fjernfilsystemet åbent.
|
||||
|
|
|
@ -548,3 +548,5 @@ enableTerminalDocking=St Finn We transmission
|
|||
enableTerminalDockingDescription=Mit Terminal Docking kannst du Terminalfenster an das XPipe-Anwendungsfenster andocken, um ein integriertes Terminal zu simulieren. Κ Finn continues theARotional'93 Veranstə Off extampİ Weṣς
|
||||
downloadsDirectory=Benutzerdefiniertes Download-Verzeichnis
|
||||
downloadsDirectoryDescription=Das benutzerdefinierte Verzeichnis, in das heruntergeladene Dateien verschoben werden sollen, wenn du auf die Schaltfläche In Downloads verschieben klickst. Standardmäßig verwendet XPipe dein Benutzer-Download-Verzeichnis.
|
||||
pinLocalMachineOnStartup=Registerkarte "Lokaler Rechner" beim Starten anheften
|
||||
pinLocalMachineOnStartupDescription=Öffne automatisch eine Registerkarte für den lokalen Rechner und pinne sie an. Dies ist nützlich, wenn du häufig einen geteilten Dateibrowser verwendest, bei dem der lokale Rechner und das entfernte Dateisystem geöffnet sind.
|
||||
|
|
|
@ -554,3 +554,5 @@ enableTerminalDocking=Enable terminal docking
|
|||
enableTerminalDockingDescription=With terminal docking you can dock terminal windows to the XPipe application window to simulate a somewhat integrated terminal. The terminal windows are then managed by XPipe to always fit into the dock.
|
||||
downloadsDirectory=Custom downloads directory
|
||||
downloadsDirectoryDescription=The custom directory to put downloaded files into when clicking on the move to downloads button. By default, XPipe will use your user downloads directory.
|
||||
pinLocalMachineOnStartup=Pin local machine tab on startup
|
||||
pinLocalMachineOnStartupDescription=Automatically open a local machine tab and pin it. This is useful if you are frequently using a split file browser with the local machine and remote file system open.
|
|
@ -535,3 +535,5 @@ enableTerminalDocking=Activar el acoplamiento de terminales
|
|||
enableTerminalDockingDescription=Con el acoplamiento de terminales puedes acoplar ventanas de terminal a la ventana de la aplicación XPipe para simular un terminal algo integrado. Las ventanas de terminal son gestionadas por XPipe para que siempre quepan en el acoplamiento.
|
||||
downloadsDirectory=Directorio de descargas personalizado
|
||||
downloadsDirectoryDescription=El directorio personalizado en el que colocar los archivos descargados al pulsar el botón mover a descargas. Por defecto, XPipe utilizará tu directorio de descargas de usuario.
|
||||
pinLocalMachineOnStartup=Fijar la pestaña de máquina local al iniciar
|
||||
pinLocalMachineOnStartupDescription=Abre automáticamente una pestaña de la máquina local y fíjala. Esto es útil si utilizas con frecuencia un explorador de archivos dividido con la máquina local y el sistema de archivos remoto abiertos.
|
||||
|
|
|
@ -535,3 +535,5 @@ enableTerminalDocking=Activer l'ancrage du terminal
|
|||
enableTerminalDockingDescription=Avec l'ancrage de terminal, tu peux ancrer des fenêtres de terminal à la fenêtre de l'application XPipe pour simuler un terminal quelque peu intégré. Les fenêtres du terminal sont alors gérées par XPipe pour toujours tenir dans la station d'accueil.
|
||||
downloadsDirectory=Répertoire de téléchargements personnalisé
|
||||
downloadsDirectoryDescription=Le répertoire personnalisé dans lequel placer les fichiers téléchargés lorsqu'on clique sur le bouton déplacer vers les téléchargements. Par défaut, XPipe utilisera le répertoire des téléchargements de l'utilisateur.
|
||||
pinLocalMachineOnStartup=Onglet de la machine locale au démarrage
|
||||
pinLocalMachineOnStartupDescription=Ouvrir automatiquement un onglet de machine locale et l'épingler. C'est utile si tu utilises fréquemment un navigateur de fichiers fractionné avec la machine locale et le système de fichiers distant ouverts.
|
||||
|
|
|
@ -535,3 +535,5 @@ enableTerminalDocking=Abilita l'aggancio del terminale
|
|||
enableTerminalDockingDescription=Con il docking del terminale puoi agganciare le finestre del terminale alla finestra dell'applicazione XPipe per simulare un terminale integrato. Le finestre del terminale vengono gestite da XPipe in modo da essere sempre inserite nel dock.
|
||||
downloadsDirectory=Directory di download personalizzata
|
||||
downloadsDirectoryDescription=La directory personalizzata in cui inserire i file scaricati quando si fa clic sul pulsante sposta nei download. Per impostazione predefinita, XPipe utilizzerà la directory dei download dell'utente.
|
||||
pinLocalMachineOnStartup=Blocca la scheda della macchina locale all'avvio
|
||||
pinLocalMachineOnStartupDescription=Apre automaticamente una scheda del computer locale e la blocca. Questa funzione è utile se utilizzi spesso un browser di file suddiviso con il computer locale e il file system remoto aperti.
|
||||
|
|
|
@ -535,3 +535,5 @@ enableTerminalDocking=端末のドッキングを有効にする
|
|||
enableTerminalDockingDescription=ターミナルドッキングを使えば、XPipeのアプリケーションウィンドウにターミナルウィンドウをドッキングさせることができる。ターミナルウィンドウはXPipeによって管理され、常にドックに収まる。
|
||||
downloadsDirectory=カスタムダウンロードディレクトリ
|
||||
downloadsDirectoryDescription=ダウンロードに移動ボタンをクリックしたときに、ダウンロードしたファイルを置くカスタムディレクトリ。デフォルトでは、XPipeはユーザーダウンロードディレクトリを使用する。
|
||||
pinLocalMachineOnStartup=起動時にローカルマシンのタブをピン留めする
|
||||
pinLocalMachineOnStartupDescription=ローカルマシンのタブを自動的に開き、ピン留めする。これは、ローカルマシンとリモートファイルシステムを開いた状態で、分割ファイルブラウザを頻繁に使用する場合に便利である。
|
||||
|
|
|
@ -535,3 +535,5 @@ enableTerminalDocking=Terminal docking inschakelen
|
|||
enableTerminalDockingDescription=Met terminal docking kun je terminalvensters in het XPipe toepassingsvenster plaatsen om een enigszins geïntegreerde terminal te simuleren. De terminalvensters worden dan door XPipe beheerd zodat ze altijd in het dock passen.
|
||||
downloadsDirectory=Aangepaste downloadmap
|
||||
downloadsDirectoryDescription=De aangepaste map om gedownloade bestanden in te plaatsen als je op de knop Verplaats naar downloads klikt. Standaard gebruikt XPipe je gebruikersdownloadmap.
|
||||
pinLocalMachineOnStartup=Tabblad lokale machine vastpinnen bij het opstarten
|
||||
pinLocalMachineOnStartupDescription=Automatisch een lokale machine tab openen en vastpinnen. Dit is handig als je vaak een gesplitste bestandsbrowser gebruikt met de lokale machine en het externe bestandssysteem open.
|
||||
|
|
|
@ -535,3 +535,5 @@ enableTerminalDocking=Ativar a ancoragem do terminal
|
|||
enableTerminalDockingDescription=Com o terminal docking podes acoplar janelas de terminal à janela da aplicação XPipe para simular um terminal integrado. As janelas de terminal são então geridas pelo XPipe para caberem sempre na doca.
|
||||
downloadsDirectory=Diretório de transferências personalizado
|
||||
downloadsDirectoryDescription=O diretório personalizado para colocar os arquivos baixados ao clicar no botão mover para downloads. Por defeito, o XPipe utiliza o diretório de downloads do utilizador.
|
||||
pinLocalMachineOnStartup=Fixa o separador da máquina local no arranque
|
||||
pinLocalMachineOnStartupDescription=Abre automaticamente um separador da máquina local e fixa-o. Isto é útil se estiveres a utilizar frequentemente um navegador de ficheiros dividido com a máquina local e o sistema de ficheiros remoto abertos.
|
||||
|
|
|
@ -535,3 +535,5 @@ enableTerminalDocking=Включить стыковку терминалов
|
|||
enableTerminalDockingDescription=С помощью терминальной докировки ты можешь пристыковать окна терминалов к окну приложения XPipe, чтобы имитировать некий интегрированный терминал. Окна терминала управляются XPipe, чтобы всегда помещаться в док.
|
||||
downloadsDirectory=Пользовательский каталог загрузок
|
||||
downloadsDirectoryDescription=Пользовательская директория, в которую будут помещаться скачанные файлы при нажатии на кнопку перемещения в загрузки. По умолчанию XPipe будет использовать твой пользовательский каталог загрузок.
|
||||
pinLocalMachineOnStartup=Закрепить вкладку локальной машины при запуске
|
||||
pinLocalMachineOnStartupDescription=Автоматически открывай вкладку локальной машины и закрепляй ее. Это полезно, если ты часто используешь разделенный файловый браузер с открытыми локальной машиной и удаленной файловой системой.
|
||||
|
|
|
@ -536,3 +536,5 @@ enableTerminalDocking=Terminal yerleştirmeyi etkinleştir
|
|||
enableTerminalDockingDescription=Terminal kenetleme ile terminal pencerelerini XPipe uygulama penceresine kenetleyerek bir nevi entegre terminal simülasyonu yapabilirsiniz. Terminal pencereleri daha sonra XPipe tarafından her zaman yuvaya sığacak şekilde yönetilir.
|
||||
downloadsDirectory=Özel indirme dizini
|
||||
downloadsDirectoryDescription=İndirilen dosyaları indirilenlere taşı düğmesine tıklandığında yerleştirilecek özel dizin. Varsayılan olarak, XPipe kullanıcı indirme dizininizi kullanacaktır.
|
||||
pinLocalMachineOnStartup=Başlangıçta yerel makine sekmesini sabitleme
|
||||
pinLocalMachineOnStartupDescription=Otomatik olarak bir yerel makine sekmesi açın ve sabitleyin. Bu, yerel makine ve uzak dosya sistemi açıkken sık sık bölünmüş bir dosya tarayıcısı kullanıyorsanız kullanışlıdır.
|
||||
|
|
|
@ -535,3 +535,5 @@ enableTerminalDocking=启用终端对接
|
|||
enableTerminalDockingDescription=使用终端停靠功能,您可以将终端窗口停靠在 XPipe 应用程序窗口上,以模拟集成终端。XPipe会对终端窗口进行管理,使其始终适合停靠。
|
||||
downloadsDirectory=自定义下载目录
|
||||
downloadsDirectoryDescription=单击 "移动到下载 "按钮时将下载文件放入的自定义目录。默认情况下,XPipe 将使用您的用户下载目录。
|
||||
pinLocalMachineOnStartup=启动时 Pin 本地计算机选项卡
|
||||
pinLocalMachineOnStartupDescription=自动打开本地计算机标签并将其固定。如果你经常在打开本地机器和远程文件系统的情况下使用分割文件浏览器,这将非常有用。
|
||||
|
|
Loading…
Reference in a new issue