Skip to content

Commit

Permalink
[*] fix bugs and improve ui
Browse files Browse the repository at this point in the history
  • Loading branch information
heng30 committed Apr 6, 2024
1 parent a6f6721 commit 4e6545b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rssbox"
version = "0.5.0"
version = "0.7.0"
edition = "2021"

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions src/logic/setting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct BackupRecoverData {

#[derive(Serialize, Deserialize, Default, Debug, Clone)]
struct SettingUpdateData {
#[serde(skip)]
current_version: String,
latest_version: String,
detail_cn: String,
Expand Down
2 changes: 1 addition & 1 deletion src/version.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub static VERSION: &str = "v0.6.2";
pub static VERSION: &str = "v0.7.0";
33 changes: 26 additions & 7 deletions ui/panel/bodyer/setting.slint
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Theme, Icons } from "../../theme.slint";
import { Logic } from "../../logic.slint";
import { Util } from "../../util.slint";
import { Store, SettingUI, SettingSync, SettingProxy, SettingReading, SettingBackupRecover, SettingUpdate } from "../../store.slint";
import { CenterLayout, Divider, Link, Brand, IconBtn, Label, Head, SettingEntry, SettingDetail, SettingDetailInner, TabBtn, SettingDetailInnerVbox, SettingDetailLabel, TxtEdit, CancelBtn, ConfirmBtn } from "../../base/widgets.slint";
import { CenterLayout, Divider, Link, Brand, IconBtn, Label, Head, SettingEntry, SettingDetail, SettingDetailInner, TabBtn, SettingDetailInnerVbox, SettingDetailLabel, TxtEdit, CancelBtn, ConfirmBtn, NoDataImg, Tag} from "../../base/widgets.slint";

enum SettingDetailIndex {
UI,
Expand Down Expand Up @@ -586,6 +586,8 @@ component BackupRecover inherits SettingDetail {

component Update inherits SettingDetail {
private property <SettingUpdate> setting: Store.setting-update;
private property <bool> is-same-version: setting.current-version == setting.latest-version;
private property <bool> is-show-detail : (Store.is-cn && setting.detail-cn != "") || (!Store.is-cn && setting.detail-en != "");

title: Logic.tr(Store.is-cn, "获取最新版本");

Expand All @@ -596,12 +598,22 @@ component Update inherits SettingDetail {
}

HorizontalLayout {
current-txt := Label { width: 50%;
text: Logic.tr(Store.is-cn, "当前版本") + ": " + root.setting.current-version;
HorizontalLayout {
alignment: start;
current-txt := Tag {
background: Theme.tag-colors[0];
text-color: self.background.darker(100%);
text: Logic.tr(Store.is-cn, "当前版本") + ": " + root.setting.current-version;
}
}

latest-txt := Label {
text: Logic.tr(Store.is-cn, "最新版本") + ": " + root.setting.latest-version;
HorizontalLayout {
alignment: start;
latest-txt := Tag {
background: root.is-same-version ? Theme.tag-colors[0] : Theme.tag-colors[1];
text-color: self.background.darker(100%);
text: Logic.tr(Store.is-cn, "最新版本") + ": " + root.setting.latest-version;
}
}
}
}
Expand All @@ -611,13 +623,20 @@ component Update inherits SettingDetail {
text: Logic.tr(Store.is-cn, "更新信息");
}

detail-txt := Label {
if is-show-detail : Label {
wrap: word-wrap;
text: Store.is-cn ? setting.detail-cn : setting.detail-en;
}

if !is-show-detail : Rectangle {
NoDataImg {
width: root.width * 0.5;
text: Logic.tr(Store.is-cn, "没有数据");
}
}
}

if root.setting.url != "" && root.setting.current-version != root.setting.latest-version : HorizontalLayout {
if root.setting.url != "" && !root.is-same-version : HorizontalLayout {
alignment: end;
padding: Theme.padding * 2;

Expand Down

0 comments on commit 4e6545b

Please sign in to comment.