mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-21 23:20:23 +00:00
Small fixes
This commit is contained in:
parent
be464120fa
commit
c72ed034d1
3 changed files with 32 additions and 20 deletions
|
@ -1,5 +1,6 @@
|
|||
package io.xpipe.app.comp.base;
|
||||
|
||||
import io.xpipe.app.core.AppCache;
|
||||
import io.xpipe.app.core.AppFont;
|
||||
import io.xpipe.app.core.AppLayoutModel;
|
||||
import io.xpipe.app.fxcomps.Comp;
|
||||
|
@ -8,13 +9,17 @@ import io.xpipe.app.fxcomps.SimpleCompStructure;
|
|||
import io.xpipe.app.fxcomps.impl.IconButtonComp;
|
||||
import io.xpipe.app.fxcomps.impl.StackComp;
|
||||
import io.xpipe.app.fxcomps.impl.TooltipAugment;
|
||||
import io.xpipe.app.fxcomps.util.LabelGraphic;
|
||||
import io.xpipe.app.fxcomps.util.PlatformThread;
|
||||
import io.xpipe.app.update.UpdateAvailableAlert;
|
||||
import io.xpipe.app.update.XPipeDistributionType;
|
||||
|
||||
import io.xpipe.app.util.Hyperlinks;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.css.PseudoClass;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
|
@ -22,6 +27,9 @@ import javafx.scene.control.Button;
|
|||
import javafx.scene.layout.*;
|
||||
import javafx.scene.paint.Color;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public class SideMenuBarComp extends Comp<CompStructure<VBox>> {
|
||||
|
@ -133,6 +141,28 @@ public class SideMenuBarComp extends Comp<CompStructure<VBox>> {
|
|||
vbox.getChildren().add(b.createRegion());
|
||||
}
|
||||
|
||||
{
|
||||
var zone = ZoneId.of(ZoneId.SHORT_IDS.get("PST"));
|
||||
var now = Instant.now();
|
||||
var phStart = ZonedDateTime.of(2024, 10, 22, 0, 1, 0, 0, zone).toInstant();
|
||||
var phEnd = ZonedDateTime.of(2024, 10, 23, 0, 1, 0, 0, zone).toInstant();
|
||||
var clicked = AppCache.get("phClicked",Boolean.class,() -> false);
|
||||
var phShow = now.isAfter(phStart) && now.isBefore(phEnd) && !clicked;
|
||||
if (phShow) {
|
||||
var hide = new SimpleBooleanProperty(false);
|
||||
var b = new IconButtonComp(new LabelGraphic.ImageGraphic("app:producthunt-color.png", 24), () -> {
|
||||
AppCache.update("phClicked", true);
|
||||
Hyperlinks.open(Hyperlinks.PRODUCT_HUNT);
|
||||
hide.set(true);
|
||||
}).tooltip(new SimpleStringProperty("Product Hunt"));
|
||||
b.apply(struc -> {
|
||||
AppFont.setSize(struc.get(), 1);
|
||||
});
|
||||
b.hide(hide);
|
||||
vbox.getChildren().add(b.createRegion());
|
||||
}
|
||||
}
|
||||
|
||||
var filler = new Button();
|
||||
filler.setDisable(true);
|
||||
filler.setMaxHeight(3000);
|
||||
|
|
|
@ -126,25 +126,6 @@ public class AppLayoutModel {
|
|||
// () -> Hyperlinks.open(Hyperlinks.GITHUB_WEBTOP),
|
||||
// null)
|
||||
));
|
||||
|
||||
|
||||
var zone = ZoneId.of(ZoneId.SHORT_IDS.get("PST"));
|
||||
var now = Instant.now();
|
||||
var phStart = ZonedDateTime.of(2024, 10, 22, 0, 1, 0, 0, zone).toInstant();
|
||||
var phEnd = ZonedDateTime.of(2024, 10, 29, 0, 1, 0, 0, zone).toInstant();
|
||||
var clicked = AppCache.get("phClicked",Boolean.class,() -> false);
|
||||
var phShow = now.isAfter(phStart) && now.isBefore(phEnd) && !clicked;
|
||||
if (phShow) {
|
||||
l.add(new Entry(
|
||||
new SimpleStringProperty("Product Hunt"),
|
||||
new LabelGraphic.ImageGraphic("app:producthunt-color.png", 24),
|
||||
null,
|
||||
() -> {
|
||||
AppCache.update("phClicked", true);
|
||||
Hyperlinks.open(Hyperlinks.PRODUCT_HUNT);
|
||||
},
|
||||
null));
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,8 +76,9 @@ public class TerminalLauncher {
|
|||
type.launch(config);
|
||||
latch.await();
|
||||
} catch (Exception ex) {
|
||||
var modMsg = ex.getMessage() != null && ex.getMessage().contains("Unable to find application named") ? ex.getMessage() + " in installed Applications on this system" : ex;
|
||||
throw ErrorEvent.expected(new IOException(
|
||||
"Unable to launch terminal " + type.toTranslatedString().getValue() + ": " + ex.getMessage(), ex));
|
||||
"Unable to launch terminal " + type.toTranslatedString().getValue() + ": " + modMsg, ex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue