「优化」部分界面

main
lensfrex 3 years ago
parent 7ae4dcb92b
commit 8140e063ea
Signed by: lensfrex
GPG Key ID: 947ADABD8533C476
  1. 7
      Dogename/src/main/java/me/lensferno/dogename/Main.java
  2. 5
      Dogename/src/main/java/me/lensferno/dogename/controllers/OcrPaneController.java
  3. 8
      Dogename/src/main/java/me/lensferno/dogename/controllers/ProgramInfoPaneController.java
  4. 4
      Dogename/src/main/java/me/lensferno/dogename/sayings/Gushici.java
  5. 6
      Dogename/src/main/java/me/lensferno/dogename/sayings/Hitokoto.java
  6. 6
      Dogename/src/main/java/me/lensferno/dogename/utils/ocr/ScreenCapture.java
  7. 2
      Dogename/src/main/resources/me/lensferno/dogename/FXMLs/MainInterface.fxml

@ -78,14 +78,13 @@ public class Main extends Application {
System.exit(0);
});
if (mainInterfaceController.getMainConfig().isShowSaying()) {
if (new Random().nextBoolean()){
new Gushici().showGushici(mainInterfaceController.getRootPane(),mainInterfaceController.getTopBar());
new Gushici().showGushici(mainInterfaceController.getRootPane(),mainInterfaceController.getTopBar(), mainInterfaceController.getMainConfig().isShowSaying());
} else {
new Hitokoto().showHitokoto(mainInterfaceController.getRootPane(),mainInterfaceController.getTopBar());
}
new Hitokoto().showHitokoto(mainInterfaceController.getRootPane(),mainInterfaceController.getTopBar(), mainInterfaceController.getMainConfig().isShowSaying());
}
}
}

@ -22,6 +22,8 @@ public class OcrPaneController {
this.mainStage = mainStage;
}
@FXML
void addNew() {
@ -39,7 +41,7 @@ public class OcrPaneController {
ScreenCapture screenCapture = new ScreenCapture();
ocrText.textProperty().bindBidirectional(screenCapture.resultProperty());
loadingSpinner.visibleProperty().bind(screenCapture.endProperty().not());
loadingSpinner.visibleProperty().set(true);
screenCapture.startCapture();
@ -47,6 +49,7 @@ public class OcrPaneController {
if (end) {
mainStage.show();
thisStage.show();
loadingSpinner.visibleProperty().set(false);
}
});
}

@ -48,7 +48,7 @@ public class ProgramInfoPaneController extends VBox {
}
@FXML
void showLicense(ActionEvent event) {
void showLicense() {
TextArea textArea=new TextArea(IOUtil.inputStreamToString(getClass().getResourceAsStream("/gpl-3.0.txt"), StandardCharsets.UTF_8));
textArea.setFont(Font.font("Microsoft YaHei",14));
textArea.setMinWidth(600);
@ -58,7 +58,7 @@ public class ProgramInfoPaneController extends VBox {
}
@FXML
void showLibLicense(ActionEvent event) {
void showLibLicense() {
TextArea textArea=new TextArea(IOUtil.inputStreamToString(getClass().getResourceAsStream("/LibLicense.txt"), StandardCharsets.UTF_8));
textArea.setFont(Font.font("Microsoft YaHei",14));
textArea.setMinWidth(600);
@ -68,7 +68,7 @@ public class ProgramInfoPaneController extends VBox {
}
@FXML
void showHelp(ActionEvent event) {
void showHelp() {
JFXButton YesButton = new JFXButton("好的~去吧去吧");
YesButton.setFont(Font.font("Microsoft YaHei", FontWeight.BOLD,14));
@ -97,7 +97,7 @@ public class ProgramInfoPaneController extends VBox {
}
@FXML
void viewCode(ActionEvent event) {
void viewCode() {
JFXButton githubButton = new JFXButton("前往Github查看");
githubButton.setFont(Font.font("Microsoft YaHei", FontWeight.BOLD,14));
githubButton.setPrefWidth(150);

@ -19,7 +19,7 @@ public class Gushici {
return NetworkUtil.getHtml(GUSHICI_API);
}
public void showGushici(Pane rootPane, Label topBar){
public void showGushici(Pane rootPane, Label topBar, boolean showOnDialog){
new Thread(()->{
@ -35,8 +35,10 @@ public class Gushici {
type=gushiciData.getType();
Platform.runLater(()->{
topBar.setText(content+" ——"+author+"《"+title+"》");
if (showOnDialog) {
GushiciPaneController gushiciPaneController=new GushiciPaneController(content, title, author, type);
new DialogMaker(rootPane).createDialogWithOneBtn("每日古诗词",gushiciPaneController);
}
});
}
}).start();

@ -20,7 +20,7 @@ public class Hitokoto {
return NetworkUtil.getHtml(HITOKOTO_API);
}
public void showHitokoto(Pane rootPane, Label topBar) {
public void showHitokoto(Pane rootPane, Label topBar, boolean showOnDialog) {
new Thread(() -> {
@ -39,8 +39,10 @@ public class Hitokoto {
Platform.runLater(() -> {
topBar.setText(String.format("《%s》:%s (%s)", from, hitokoto, author));
if (showOnDialog) {
HitokotoPaneController hitokotoPaneController = new HitokotoPaneController(hitokoto, from, author, creator, type);
new DialogMaker(rootPane).createDialogWithOneBtn("每日一句话", hitokotoPaneController);
new DialogMaker(rootPane).createDialogWithOneBtn("每日一言", hitokotoPaneController);
}
});
}
}).start();

@ -22,7 +22,7 @@ public class ScreenCapture {
private OcrTool ocrTool;
private final String cacheImageFileLocation = "caches/image/ocrImageCache.jpg";
private final String cacheImageFileLocation = "caches/image/ocrImageCache.png";
private final Runnable finalEvent = new Runnable() {
@Override
@ -30,9 +30,9 @@ public class ScreenCapture {
if (ocrTool == null) {
ocrTool = new OcrTool();
}
end.set(true);
ocrTool.requestOcrAPI(cacheImageFileLocation);
result.set(ocrTool.getResult());
end.set(true);
}
};
@ -152,6 +152,8 @@ public class ScreenCapture {
}
private void createNewSelectedAreaRectangle() {
rootPane.getChildren().removeAll(Width_Follow, Height_Follow, Width_Fixed, Height_Fixed);
Width_Follow = new Line();
Height_Follow = new Line();
Width_Fixed = new Line();

@ -21,7 +21,7 @@
<font>
<Font name="Microsoft YaHei" size="14.0" />
</font></JFXButton>
<Label fx:id="downLabel" alignment="CENTER" layoutX="194.0" layoutY="177.0" prefHeight="117.0" prefWidth="650.0" text="✋( ˙0˙)" textAlignment="CENTER" wrapText="true">
<Label fx:id="downLabel" alignment="CENTER" layoutX="194.0" layoutY="177.0" prefHeight="117.0" prefWidth="650.0" text="(¯﹃¯)" textAlignment="CENTER" wrapText="true">
<font>
<Font name="Microsoft YaHei" size="86.0" />
</font>

Loading…
Cancel
Save