Hello community,
here is the log from the commit of package netease-cloud-music-gtk for
openSUSE:Factory checked in at 2020-11-17 21:21:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/netease-cloud-music-gtk (Old)
and /work/SRC/openSUSE:Factory/.netease-cloud-music-gtk.new.24930 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "netease-cloud-music-gtk"
Tue Nov 17 21:21:41 2020 rev:4 rq:846363 version:1.1.3
Changes:
--------
---
/work/SRC/openSUSE:Factory/netease-cloud-music-gtk/netease-cloud-music-gtk.changes
2020-06-14 18:35:49.618640943 +0200
+++
/work/SRC/openSUSE:Factory/.netease-cloud-music-gtk.new.24930/netease-cloud-music-gtk.changes
2020-11-17 21:22:01.361152699 +0100
@@ -1,0 +2,7 @@
+Fri Nov 6 03:15:57 UTC 2020 - gmg 137 <[email protected]>
+
+- Updata to version 1.1.3:
+ + Add mouse back button support.
+ + Fix bug.
+
+-------------------------------------------------------------------
Old:
----
netease-cloud-music-gtk-1.1.2.tar.xz
New:
----
netease-cloud-music-gtk-1.1.3.tar.xz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ netease-cloud-music-gtk.spec ++++++
--- /var/tmp/diff_new_pack.Okwt1W/_old 2020-11-17 21:22:02.589154553 +0100
+++ /var/tmp/diff_new_pack.Okwt1W/_new 2020-11-17 21:22:02.589154553 +0100
@@ -18,7 +18,7 @@
Name: netease-cloud-music-gtk
-Version: 1.1.2
+Version: 1.1.3
Release: 0
Summary: Linux 平台下基于 Rust + GTK 开发的网易云音乐播放器
License: GPL-3.0-or-later
++++++ netease-cloud-music-gtk-1.1.2.tar.xz ->
netease-cloud-music-gtk-1.1.3.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/Cargo.toml
new/netease-cloud-music-gtk-1.1.3/Cargo.toml
--- old/netease-cloud-music-gtk-1.1.2/Cargo.toml 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/Cargo.toml 2020-11-06
03:47:40.000000000 +0100
@@ -1,22 +1,22 @@
[package]
name = "netease-cloud-music-gtk"
description = "Linux 平台下基于 Rust + GTK 开发的网易云音乐播放器"
-version = "1.1.2"
+version = "1.1.3"
authors = ["gmg137 <[email protected]>"]
license = "GPL-v3"
edition = "2018"
homepage = "https://github.com/gmg137/netease-cloud-music-gtk"
[dependencies]
-gtk = "^0.8"
-gdk = "^0.12"
-gio = "^0.8"
-glib = "^0.9"
-pango = "^0.8"
-gdk-pixbuf ="^0.8"
-gstreamer = "^0.15"
-gstreamer-player = "^0.15"
-cairo-rs = { version = "^0.8", features = ["png"] }
+gtk = "^0.9"
+gdk = "^0.13"
+gio = "^0.9"
+glib = "^0.10"
+pango = "^0.9"
+gdk-pixbuf ="^0.9"
+gstreamer = "^0.16"
+gstreamer-player = "^0.16"
+cairo-rs = { version = "^0.9", features = ["png"] }
mpris-player = "*"
dirs = "*"
@@ -35,7 +35,7 @@
fragile = "*"
xdg = "*"
futures = "^0.3"
-async-std = "*"
+async-std = "^1.6.1"
isahc = { version = "*", features = ["cookies"] }
custom_error = "*"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/README.md
new/netease-cloud-music-gtk-1.1.3/README.md
--- old/netease-cloud-music-gtk-1.1.2/README.md 2020-06-14 05:16:01.000000000
+0200
+++ new/netease-cloud-music-gtk-1.1.3/README.md 2020-11-06 03:47:40.000000000
+0100
@@ -36,6 +36,15 @@
[archlinuxcn]
Server = https://repo.archlinuxcn.org/$arch
```
+添加后执行下面语句安装 archlinuxcn-keyring
+```bash
+sudo pacman -Syyu archlinuxcn-keyring
+```
+然后安装 netease-cloud-music-gtk
+```bash
+sudo pacman -Syu netease-cloud-music-gtk
+```
+
### Debian
```bash
echo "deb https://dl.bintray.com/debianopt/debianopt buster main" | sudo tee
-a /etc/apt/sources.list
@@ -49,6 +58,9 @@
### openSUSE Leap / Ubuntu
- 下载 [RPM/DEB](https://gitee.com/gmg137/netease-cloud-music-gtk/releases)包安装。
+### 其它发行版
+- 下载 [Appimage](https://gitee.com/gmg137/netease-cloud-music-gtk/releases) 运行。
+
## 从源码安装
### openSUSE 安装依赖
```bash
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/netease-cloud-music-gtk-1.1.2/netease-cloud-music-gtk.desktop
new/netease-cloud-music-gtk-1.1.3/netease-cloud-music-gtk.desktop
--- old/netease-cloud-music-gtk-1.1.2/netease-cloud-music-gtk.desktop
2020-06-14 05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/netease-cloud-music-gtk.desktop
2020-11-06 03:47:40.000000000 +0100
@@ -1,5 +1,4 @@
[Desktop Entry]
-Version=1.1.2
Type=Application
Name=NetEase Cloud Music
Name[zh_CN]=网易云音乐
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/src/app.rs
new/netease-cloud-music-gtk-1.1.3/src/app.rs
--- old/netease-cloud-music-gtk-1.1.2/src/app.rs 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/src/app.rs 2020-11-06
03:47:40.000000000 +0100
@@ -20,7 +20,7 @@
use futures::channel::mpsc;
use gio::{self, prelude::*};
use glib::{Receiver, Sender};
-use gtk::{prelude::*, ApplicationWindow, Builder, Overlay};
+use gtk::{prelude::*, AccelGroup, ApplicationWindow, Builder, Overlay};
use std::{cell::RefCell, rc::Rc};
pub(crate) enum Action {
@@ -85,6 +85,9 @@
ConfigsSetLyrics(bool),
ConfigsSetClear(u8),
ActivateApp,
+ PlayAddAccel,
+ PlayRemoveAccel,
+ BackEvent,
}
pub(crate) struct App {
@@ -98,6 +101,7 @@
sender: Sender<Action>,
receiver: RefCell<Option<Receiver<Action>>>,
music_data: Arc<Mutex<MusicData>>,
+ accel_group: AccelGroup,
}
impl App {
@@ -106,12 +110,15 @@
let receiver = RefCell::new(Some(r));
let glade_src = include_str!("../ui/window.ui");
- let builder = Builder::new_from_string(glade_src);
+ let builder = Builder::from_string(glade_src);
let window: ApplicationWindow =
builder.get_object("applicationwindow").expect("Couldn't get window");
window.set_application(Some(application));
window.set_title("网易云音乐");
+ let accel_group = AccelGroup::new();
+ window.add_accel_group(&accel_group);
+
let configs = task::block_on(get_config()).unwrap();
let (sender_task, receiver_task) = mpsc::channel::<Task>(10);
@@ -120,7 +127,16 @@
actuator_loop(receiver_task, sender_clone).await.ok();
});
- let music_data = Arc::new(Mutex::new(MusicData::new()));
+ // 捕获鼠标返回键
+ let sender_clone = sender.clone();
+ window.connect_button_press_event(move |_, event| {
+ if event.get_button() == 8 {
+ sender_clone.send(Action::BackEvent).unwrap_or(());
+ }
+ gtk::Inhibit(false)
+ });
+
+ let music_data =
Arc::new(Mutex::new(task::block_on(MusicData::new())));
let data = music_data.clone();
task::block_on(async move {
let mut data = data.lock().await;
@@ -131,6 +147,7 @@
let header = Header::new(&builder, &sender, &configs,
Arc::clone(&music_data));
let view = View::new(&builder, &sender, &sender_task,
Arc::clone(&music_data));
let player = PlayerWrapper::new(&builder, &sender, &sender_task,
Arc::clone(&music_data));
+ player.play_add_accel(&accel_group);
window.show_all();
@@ -173,6 +190,7 @@
sender,
receiver,
music_data,
+ accel_group,
};
Rc::new(app)
}
@@ -269,7 +287,7 @@
Action::PlayerSubpages => self.view.play_subpages(),
Action::PlayerFound => self.view.play_found(),
Action::PlayerMine => self.view.play_mine(),
- Action::QuitMain => self.window.destroy(),
+ Action::QuitMain => unsafe { self.window.destroy() },
Action::ConfigsSetTray(state) => {
task::spawn(async move {
if let Ok(mut conf) = get_config().await {
@@ -313,6 +331,15 @@
self.window.show_now();
self.window.present();
}
+ Action::PlayAddAccel => {
+ self.player.play_add_accel(&self.accel_group);
+ }
+ Action::PlayRemoveAccel => {
+ self.player.play_remove_accel(&self.accel_group);
+ }
+ Action::BackEvent => {
+ self.header.click_back();
+ }
}
glib::Continue(true)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/src/data.rs
new/netease-cloud-music-gtk-1.1.3/src/data.rs
--- old/netease-cloud-music-gtk-1.1.2/src/data.rs 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/src/data.rs 2020-11-06
03:47:40.000000000 +0100
@@ -8,7 +8,7 @@
model::{Errors, NCMResult, DATE_DAY, NCM_CONFIG, NCM_DATA},
musicapi::{model::*, MusicApi},
};
-use async_std::{fs, prelude::*, task};
+use async_std::{fs, prelude::*};
use openssl::hash::{hash, MessageDigest};
use serde::{Deserialize, Serialize};
use std::path::Path;
@@ -45,21 +45,19 @@
impl MusicData {
#[allow(unused)]
- pub(crate) fn new() -> Self {
- if let Ok(data) = task::block_on(Self::from_db()) {
+ pub(crate) async fn new() -> Self {
+ if let Ok(data) = Self::from_db().await {
return data;
}
- task::spawn(async {
- let data = StatusData {
- login: false,
- day: *DATE_DAY,
- };
- if let Ok(value) = bincode::serialize(&data) {
- fs::write(format!("{}status_data.db",
NCM_CONFIG.to_string_lossy()), value)
- .await
- .ok();
- }
- });
+ let data = StatusData {
+ login: false,
+ day: *DATE_DAY,
+ };
+ if let Ok(value) = bincode::serialize(&data) {
+ fs::write(format!("{}status_data.db",
NCM_CONFIG.to_string_lossy()), value)
+ .await
+ .ok();
+ }
MusicData {
musicapi: MusicApi::new(),
login: false,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/src/musicapi/mod.rs
new/netease-cloud-music-gtk-1.1.3/src/musicapi/mod.rs
--- old/netease-cloud-music-gtk-1.1.2/src/musicapi/mod.rs 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/src/musicapi/mod.rs 2020-11-06
03:47:40.000000000 +0100
@@ -238,7 +238,7 @@
// songlist_id: 歌单 id
#[allow(unused)]
pub async fn song_list_detail(&mut self, songlist_id: u64) ->
NCMResult<Vec<SongInfo>> {
- let path = "/api/v3/playlist/detail";
+ let path = "/api/v6/playlist/detail";
let mut params = HashMap::new();
let songlist_id = songlist_id.to_string();
params.insert("id", songlist_id.as_str());
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/src/utils.rs
new/netease-cloud-music-gtk-1.1.3/src/utils.rs
--- old/netease-cloud-music-gtk-1.1.2/src/utils.rs 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/src/utils.rs 2020-11-06
03:47:40.000000000 +0100
@@ -264,7 +264,7 @@
} = bincode::deserialize(&buffer).map_err(|_| Errors::NoneError)?;
// 提取歌曲 id 列表
let song_id_list = player_list.iter().map(|(si, _)|
si.id).collect::<Vec<u64>>();
- let mut api = MusicData::new();
+ let mut api = MusicData::new().await;
// 批量搜索歌曲 URL
if let Ok(v) = api.songs_url(&song_id_list, 320).await {
// 初始化播放列表
@@ -322,7 +322,7 @@
#[allow(unused)]
pub(crate) fn create_round_avatar(src: &str) -> io::Result<Pixbuf> {
// 初始化图像
- let image = Pixbuf::new_from_file(src).map_err(|_|
Error::last_os_error())?;
+ let image = Pixbuf::from_file(src).map_err(|_| Error::last_os_error())?;
// 获取宽高
let w = image.get_width();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/src/view/found.rs
new/netease-cloud-music-gtk-1.1.3/src/view/found.rs
--- old/netease-cloud-music-gtk-1.1.2/src/view/found.rs 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/src/view/found.rs 2020-11-06
03:47:40.000000000 +0100
@@ -215,7 +215,9 @@
let song_list = self.song_list.clone();
let sender = self.sender.clone();
sender.send(Action::PlayerTypes(PlayerTypes::Song)).unwrap_or(());
- let mut api = MusicData::new();
- task::spawn(async move { create_player_list(&mut api, &song_list,
sender, true, false).await.ok() });
+ task::spawn(async move {
+ let mut api = MusicData::new().await;
+ create_player_list(&mut api, &song_list, sender, true,
false).await.ok()
+ });
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/src/view/home.rs
new/netease-cloud-music-gtk-1.1.3/src/view/home.rs
--- old/netease-cloud-music-gtk-1.1.2/src/view/home.rs 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/src/view/home.rs 2020-11-06
03:47:40.000000000 +0100
@@ -72,11 +72,11 @@
label.set_ellipsize(pango::EllipsizeMode::End);
label.set_line_wrap(true);
let image_path = format!("{}{}.jpg",
NCM_CACHE.to_string_lossy(), &sl.id);
- let image = if let Ok(image) =
Pixbuf::new_from_file(&image_path) {
+ let image = if let Ok(image) = Pixbuf::from_file(&image_path) {
let image = image.scale_simple(140, 140,
InterpType::Bilinear);
- Image::new_from_pixbuf(image.as_ref())
+ Image::from_pixbuf(image.as_ref())
} else {
- let image =
Image::new_from_icon_name(Some("media-optical"), gtk::IconSize::Button);
+ let image = Image::from_icon_name(Some("media-optical"),
gtk::IconSize::Button);
image.set_pixel_size(140);
image
};
@@ -118,11 +118,11 @@
label.set_ellipsize(pango::EllipsizeMode::End);
label.set_line_wrap(true);
let image_path = format!("{}{}.jpg",
NCM_CACHE.to_string_lossy(), &sl.id);
- let image = if let Ok(image) =
Pixbuf::new_from_file(&image_path) {
+ let image = if let Ok(image) =
Pixbuf::from_file(&image_path) {
let image = image.scale_simple(140, 140,
InterpType::Bilinear);
- Image::new_from_pixbuf(image.as_ref())
+ Image::from_pixbuf(image.as_ref())
} else {
- let image =
Image::new_from_icon_name(Some("media-optical"), gtk::IconSize::Button);
+ let image =
Image::from_icon_name(Some("media-optical"), gtk::IconSize::Button);
image.set_pixel_size(140);
image
};
@@ -174,11 +174,11 @@
label.set_ellipsize(pango::EllipsizeMode::End);
label.set_line_wrap(true);
let image_path = format!("{}{}.jpg", NCM_CACHE.to_string_lossy(),
&song_list.id);
- let image = if let Ok(image) = Pixbuf::new_from_file(&image_path) {
+ let image = if let Ok(image) = Pixbuf::from_file(&image_path) {
let image = image.scale_simple(140, 140, InterpType::Bilinear);
- Image::new_from_pixbuf(image.as_ref())
+ Image::from_pixbuf(image.as_ref())
} else {
- let image = Image::new_from_icon_name(Some("media-optical"),
gtk::IconSize::Button);
+ let image = Image::from_icon_name(Some("media-optical"),
gtk::IconSize::Button);
image.set_pixel_size(140);
image
};
@@ -217,11 +217,11 @@
label.set_ellipsize(pango::EllipsizeMode::End);
label.set_line_wrap(true);
let image_path = format!("{}{}.jpg", NCM_CACHE.to_string_lossy(),
&song_list.id);
- let image = if let Ok(image) = Pixbuf::new_from_file(&image_path) {
+ let image = if let Ok(image) = Pixbuf::from_file(&image_path) {
let image = image.scale_simple(140, 140, InterpType::Bilinear);
- Image::new_from_pixbuf(image.as_ref())
+ Image::from_pixbuf(image.as_ref())
} else {
- let image = Image::new_from_icon_name(Some("media-optical"),
gtk::IconSize::Button);
+ let image = Image::from_icon_name(Some("media-optical"),
gtk::IconSize::Button);
image.set_pixel_size(140);
image
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/src/view/mine/fm.rs
new/netease-cloud-music-gtk-1.1.3/src/view/mine/fm.rs
--- old/netease-cloud-music-gtk-1.1.2/src/view/mine/fm.rs 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/src/view/mine/fm.rs 2020-11-06
03:47:40.000000000 +0100
@@ -105,7 +105,7 @@
pub(crate) fn update_fm_view(&self, song_info: &SongInfo) {
// 更新 FM
let image_path = format!("{}{}.jpg",
crate::model::NCM_CACHE.to_string_lossy(), &song_info.id);
- if let Ok(image) = Pixbuf::new_from_file(&image_path) {
+ if let Ok(image) = Pixbuf::from_file(&image_path) {
let image = image.scale_simple(140, 140, InterpType::Bilinear);
self.image.set_from_pixbuf(image.as_ref());
};
@@ -132,11 +132,11 @@
label.set_ellipsize(pango::EllipsizeMode::End);
label.set_line_wrap(true);
let image_path = format!("{}{}.jpg",
NCM_CACHE.to_string_lossy(), &sl.id);
- let image = if let Ok(image) =
Pixbuf::new_from_file(&image_path) {
+ let image = if let Ok(image) = Pixbuf::from_file(&image_path) {
let image = image.scale_simple(140, 140,
InterpType::Bilinear);
- Image::new_from_pixbuf(image.as_ref())
+ Image::from_pixbuf(image.as_ref())
} else {
- let image =
Image::new_from_icon_name(Some("media-optical"), gtk::IconSize::Button);
+ let image = Image::from_icon_name(Some("media-optical"),
gtk::IconSize::Button);
image.set_pixel_size(140);
image
};
@@ -189,11 +189,11 @@
label.set_ellipsize(pango::EllipsizeMode::End);
label.set_line_wrap(true);
let image_path = format!("{}{}.jpg", NCM_CACHE.to_string_lossy(),
&song_list.id);
- let image = if let Ok(image) = Pixbuf::new_from_file(&image_path) {
+ let image = if let Ok(image) = Pixbuf::from_file(&image_path) {
let image = image.scale_simple(140, 140, InterpType::Bilinear);
- Image::new_from_pixbuf(image.as_ref())
+ Image::from_pixbuf(image.as_ref())
} else {
- let image = Image::new_from_icon_name(Some("media-optical"),
gtk::IconSize::Button);
+ let image = Image::from_icon_name(Some("media-optical"),
gtk::IconSize::Button);
image.set_pixel_size(140);
image
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/src/view/mod.rs
new/netease-cloud-music-gtk-1.1.3/src/view/mod.rs
--- old/netease-cloud-music-gtk-1.1.2/src/view/mod.rs 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/src/view/mod.rs 2020-11-06
03:47:40.000000000 +0100
@@ -60,17 +60,17 @@
let mine_stack: Stack = builder.get_object("mine_stack").expect("无法获取
mine_stack.");
let glade_src = include_str!("../../ui/subpages.ui");
- let subpages_builder = Builder::new_from_string(glade_src);
+ let subpages_builder = Builder::from_string(glade_src);
let subpages_stack: Stack = subpages_builder
.get_object("subpages_stack")
.expect("无法获取 subpages_stack.");
let glade_src = include_str!("../../ui/home.ui");
- let home_builder = Builder::new_from_string(glade_src);
+ let home_builder = Builder::from_string(glade_src);
let home_stack: Stack =
home_builder.get_object("home_stack").expect("无法获取 home_stack.");
let glade_src = include_str!("../../ui/found.ui");
- let found_builder = Builder::new_from_string(glade_src);
+ let found_builder = Builder::from_string(glade_src);
let found_stack: Stack =
found_builder.get_object("found_stack").expect("无法获取 found_stack.");
let found_content_stack: Stack = found_builder
.get_object("found_content_stack")
@@ -78,25 +78,26 @@
let spinner_stack = Stack::new();
let spinner = Spinner::new();
+ spinner.set_size_request(50, 50);
spinner.start();
spinner_stack.add(&spinner);
found_content_stack.add_named(&spinner_stack, "spinner_stack");
found_content_stack.set_visible_child_name("found_right_stack");
let glade_src = include_str!("../../ui/mine_fm.ui");
- let mine_login_fm_builder = Builder::new_from_string(glade_src);
+ let mine_login_fm_builder = Builder::from_string(glade_src);
let mine_fm_stack: Stack = mine_login_fm_builder
.get_object("mine_fm_stack")
.expect("无法获取 mine_fm_stack.");
let glade_src = include_str!("../../ui/mine_list.ui");
- let mine_login_list_builder = Builder::new_from_string(glade_src);
+ let mine_login_list_builder = Builder::from_string(glade_src);
let mine_list_stack: Stack = mine_login_list_builder
.get_object("mine_list_stack")
.expect("无法获取 mine_list_stack.");
let glade_src = include_str!("../../ui/mine_login.ui");
- let mine_login_builder = Builder::new_from_string(glade_src);
+ let mine_login_builder = Builder::from_string(glade_src);
let mine_login_stack: Stack = mine_login_builder
.get_object("mine_login_stack")
.expect("无法获取 mine_login_stack.");
@@ -106,6 +107,7 @@
let spinner_stack = Stack::new();
let spinner = Spinner::new();
+ spinner.set_size_request(50, 50);
spinner.start();
spinner_stack.add(&spinner);
@@ -115,7 +117,7 @@
mine_login_center_stack.set_visible_child_name("mine_fm_stack");
let glade_src = include_str!("../../ui/mine_not_login.ui");
- let mine_not_login_builder = Builder::new_from_string(glade_src);
+ let mine_not_login_builder = Builder::from_string(glade_src);
let mine_not_login_stack: Stack = mine_not_login_builder
.get_object("mine_not_login_stack")
.expect("无法获取 mine_not_login_stack.");
@@ -130,6 +132,7 @@
let spinner_stack = Stack::new();
let spinner = Spinner::new();
+ spinner.set_size_request(50, 50);
spinner.start();
spinner_stack.add(&spinner);
@@ -220,7 +223,7 @@
let sender = self.sender.clone();
let text_clone = text.clone();
task::spawn(async move {
- let mut data = MusicData::new();
+ let mut data = MusicData::new().await;
if let Ok(json) = data.search(text_clone, 1, 0, 50).await {
if let Ok(song_list) =
serde_json::from_str::<Vec<SongInfo>>(&json) {
// 发送更新子页概览, 用以清除原始歌曲列表
@@ -248,7 +251,7 @@
self.subpages.borrow_mut().update_up_view(id, name, image_path);
let sender = self.sender.clone();
task::spawn(async move {
- let mut data = MusicData::new();
+ let mut data = MusicData::new().await;
if data.login_info().await.is_ok() {
sender.send(Action::ShowSubLike(true)).unwrap_or(());
} else {
@@ -295,7 +298,7 @@
let sender = self.sender.clone();
let mut sender_task = self.sender_task.clone();
task::spawn(async move {
- let mut data = MusicData::new();
+ let mut data = MusicData::new().await;
if let Ok(tsl) = data.top_song_list("hot", 0, 8).await {
let tsl = Arc::new(tsl);
sender_task.send(Task::DownloadHomeUpImage(Arc::clone(&tsl))).await.ok();
@@ -349,7 +352,7 @@
let title = TOP_NAME.get(&row_id).unwrap();
self.found_content_stack.set_visible_child_name("spinner_stack");
task::spawn(async move {
- let mut data = MusicData::new();
+ let mut data = MusicData::new().await;
if let Ok(song_list) = data.song_list_detail(*lid, false).await {
sender
.send(Action::RefreshFoundView(song_list,
(*title).to_string()))
@@ -421,7 +424,7 @@
if let Ok(vsi) = data.personal_fm().await {
// 提取歌曲 id 列表
if !vsi.is_empty() {
- let mut api = MusicData::new();
+ let mut api = MusicData::new().await;
// 创建播放列表
create_player_list(&mut api, &vsi, sender.clone(), false,
true)
.await
@@ -480,7 +483,7 @@
// 提取歌曲 id 列表
let song_id_list = vsi.iter().map(|si|
si.id).collect::<Vec<u64>>();
if !vsi.is_empty() {
- let mut api = MusicData::new();
+ let mut api = MusicData::new().await;
// 创建播放列表
create_player_list(&mut api, &vsi, sender.clone(),
false, true)
.await
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/src/view/subpages.rs
new/netease-cloud-music-gtk-1.1.3/src/view/subpages.rs
--- old/netease-cloud-music-gtk-1.1.2/src/view/subpages.rs 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/src/view/subpages.rs 2020-11-06
03:47:40.000000000 +0100
@@ -158,7 +158,7 @@
self.overview.grid.hide();
return;
}
- if let Ok(image) = Pixbuf::new_from_file(&image_path) {
+ if let Ok(image) = Pixbuf::from_file(&image_path) {
let image = image.scale_simple(140, 140, InterpType::Bilinear);
self.overview.pic.set_from_pixbuf(image.as_ref());
};
@@ -238,8 +238,10 @@
let song_list = self.song_list.clone();
let sender = self.sender.clone();
sender.send(Action::PlayerTypes(PlayerTypes::Song)).unwrap_or(());
- let mut api = MusicData::new();
- task::spawn(async move { create_player_list(&mut api, &song_list,
sender, true, false).await.ok() });
+ task::spawn(async move {
+ let mut api = MusicData::new().await;
+ create_player_list(&mut api, &song_list, sender, true,
false).await.ok()
+ });
}
// 显示收藏按钮
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/src/widgets/header.rs
new/netease-cloud-music-gtk-1.1.3/src/widgets/header.rs
--- old/netease-cloud-music-gtk-1.1.2/src/widgets/header.rs 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/src/widgets/header.rs 2020-11-06
03:47:40.000000000 +0100
@@ -151,8 +151,8 @@
s.login_dialog
.ok
.connect_clicked(clone!(@weak dialog, @weak name,@weak pass =>
move |_| {
- let name = name.get_text().unwrap().as_str().to_owned();
- let pass = pass.get_text().unwrap().as_str().to_owned();
+ let name = name.get_text().as_str().to_owned();
+ let pass = pass.get_text().as_str().to_owned();
if !name.is_empty() && !pass.is_empty(){
sen.send(Action::Login(name,pass)).unwrap();
dialog.hide();
@@ -174,11 +174,17 @@
// 搜索按钮
let search_bar = &s.search_bar;
let search_entry = &s.search_entry;
+ let sender_clone = sender.clone();
s.search
.connect_clicked(clone!(@weak search_bar, @weak search_entry=>
move |_| {
search_entry.set_property_is_focus(true);
search_entry.set_text("");
search_bar.set_search_mode(!search_bar.get_search_mode());
+ if search_bar.get_search_mode() {
+ sender_clone.send(Action::PlayRemoveAccel).unwrap_or(());
+ }else {
+ sender_clone.send(Action::PlayAddAccel).unwrap_or(());
+ }
}));
// 搜索框
@@ -188,11 +194,10 @@
s.search_entry
.connect_activate(clone!(@weak search_entry, @weak search => move
|_| {
// 回车键直接搜索
- if let Some(text) = search_entry.get_text() {
- if !text.is_empty() {
- search.clicked();
-
sender_clone.send(Action::Search(text.to_owned())).unwrap_or(());
- }
+ let text = search_entry.get_text();
+ if !text.is_empty() {
+ search.clicked();
+
sender_clone.send(Action::Search(text.to_owned())).unwrap_or(());
}
}));
@@ -333,4 +338,9 @@
self.title.show();
self.back.show();
}
+
+ // 激活返回键
+ pub(crate) fn click_back(&self) {
+ self.back.clicked();
+ }
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/src/widgets/notice.rs
new/netease-cloud-music-gtk-1.1.3/src/widgets/notice.rs
--- old/netease-cloud-music-gtk-1.1.2/src/widgets/notice.rs 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/src/widgets/notice.rs 2020-11-06
03:47:40.000000000 +0100
@@ -3,8 +3,6 @@
// Copyright (C) 2019 gmg137 <[email protected]>
// Distributed under terms of the GPLv3 license.
//
-use glib;
-use gtk;
use gtk::prelude::*;
#[derive(Debug, Clone, Copy)]
@@ -30,7 +28,7 @@
impl Default for InAppNotification {
fn default() -> Self {
let glade_src = include_str!("../../ui/inapp_notif.ui");
- let builder = gtk::Builder::new_from_string(glade_src);
+ let builder = gtk::Builder::from_string(glade_src);
let revealer: gtk::Revealer = builder.get_object("revealer").unwrap();
let text: gtk::Label = builder.get_object("text").unwrap();
@@ -51,7 +49,7 @@
let revealer_weak = notif.revealer.downgrade();
let mut time = 0;
- timeout_add(250, move || {
+ glib::timeout_add_local(250, move || {
if time < timer {
time += 250;
return glib::Continue(true);
@@ -80,6 +78,6 @@
}
pub(crate) fn destroy(self) {
- self.revealer.destroy();
+ self.revealer.set_reveal_child(false);
}
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/src/widgets/player.rs
new/netease-cloud-music-gtk-1.1.3/src/widgets/player.rs
--- old/netease-cloud-music-gtk-1.1.2/src/widgets/player.rs 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/src/widgets/player.rs 2020-11-06
03:47:40.000000000 +0100
@@ -12,7 +12,8 @@
use glib::{clone, Sender, SignalHandlerId, WeakRef};
use gst::ClockTime;
use gtk::{
- prelude::*, ActionBar, Builder, Button, Image, Label, MenuButton,
RadioButton, Scale, TextView, VolumeButton,
+ prelude::*, AccelGroup, ActionBar, Builder, Button, Image, Label,
MenuButton, RadioButton, Scale, TextView,
+ VolumeButton,
};
use mpris_player::{LoopStatus, Metadata, MprisPlayer,
OrgMprisMediaPlayer2Player, PlaybackStatus};
use serde::{Deserialize, Serialize};
@@ -45,7 +46,7 @@
self.song.set_tooltip_text(Some(&song_info.name[..]));
self.singer.set_text(&song_info.singer);
let image_path = format!("{}{}.jpg", NCM_CACHE.to_string_lossy(),
&song_info.id);
- if let Ok(image) = Pixbuf::new_from_file(&image_path) {
+ if let Ok(image) = Pixbuf::from_file(&image_path) {
let image = image.scale_simple(38, 38, InterpType::Bilinear);
self.cover.set_from_pixbuf(image.as_ref());
};
@@ -55,7 +56,7 @@
let mut metadata = Metadata::new();
metadata.artist = Some(vec![song_info.singer.clone()]);
metadata.title = Some(song_info.name.clone());
- metadata.art_url = Some(format!("file://{}{}.jpg",
NCM_CACHE.to_string_lossy(), song_info.id));
+ metadata.art_url = Some(format!("file:///{}{}.jpg",
NCM_CACHE.to_string_lossy(), song_info.id));
self.mpris.set_metadata(metadata);
}
@@ -367,7 +368,7 @@
task::spawn(async move {
// 下载歌词
if lyrics {
- let mut data = MusicData::new();
+ let mut data = MusicData::new().await;
download_lyrics(&mut data, &song_info.name,
&song_info).await.ok();
}
sender.send(Action::Player(song_info.clone())).unwrap();
@@ -406,7 +407,7 @@
let song_uri = format!("{}{}.mp3", NCM_CACHE.to_string_lossy(),
song_info.id);
if Path::new(&song_uri).exists() {
info!("播放音乐缓存: {}", song_uri);
- self.player.set_uri(&format!("file://{}", song_uri));
+ self.player.set_uri(&format!("file:///{}", song_uri));
} else {
let music_url = song_info.song_url.replace("https:", "http:");
info!("播放在线音乐: {}", music_url);
@@ -549,7 +550,7 @@
let sender = self.sender.clone();
let song_id = *self.info.song_id.borrow();
task::spawn(async move {
- let mut data = MusicData::new();
+ let mut data = MusicData::new().await;
if let Some(id) = song_id {
let lrc = get_lyrics(&mut data, id)
.await
@@ -578,17 +579,15 @@
fn set_shuffle(&self, shuffle: bool) {
if shuffle {
self.loops.shuffle.set_active(true);
- } else {
- if let Ok(status) = self.info.mpris.get_loop_status() {
- if status.eq("None") {
- self.set_loops(LoopStatus::None);
- } else if status.eq("Track") {
- self.set_loops(LoopStatus::Track);
- } else if status.eq("Playlist") {
- self.set_loops(LoopStatus::Playlist);
- } else {
- self.set_loops(LoopStatus::None);
- }
+ } else if let Ok(status) = self.info.mpris.get_loop_status() {
+ if status.eq("None") {
+ self.set_loops(LoopStatus::None);
+ } else if status.eq("Track") {
+ self.set_loops(LoopStatus::Track);
+ } else if status.eq("Playlist") {
+ self.set_loops(LoopStatus::Playlist);
+ } else {
+ self.set_loops(LoopStatus::None);
}
}
}
@@ -605,11 +604,31 @@
}
pub(crate) fn set_cover_image(&self, image_path: String) {
- if let Ok(image) = Pixbuf::new_from_file(&image_path) {
+ if let Ok(image) = Pixbuf::from_file(&image_path) {
let image = image.scale_simple(38, 38, InterpType::Bilinear);
self.info.cover.set_from_pixbuf(image.as_ref());
};
}
+
+ // 添加快捷键
+ pub(crate) fn play_add_accel(&self, ag: &AccelGroup) {
+ self.controls
+ .play
+ .add_accelerator("clicked", ag, 32, gdk::ModifierType::empty(),
gtk::AccelFlags::VISIBLE);
+ self.controls
+ .pause
+ .add_accelerator("clicked", ag, 32, gdk::ModifierType::empty(),
gtk::AccelFlags::VISIBLE);
+ }
+
+ // 删除快捷键
+ pub(crate) fn play_remove_accel(&self, ag: &AccelGroup) {
+ self.controls
+ .play
+ .remove_accelerator(ag, 32, gdk::ModifierType::empty());
+ self.controls
+ .pause
+ .remove_accelerator(ag, 32, gdk::ModifierType::empty());
+ }
}
#[derive(Clone)]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/netease-cloud-music-gtk-1.1.2/ui/window.ui
new/netease-cloud-music-gtk-1.1.3/ui/window.ui
--- old/netease-cloud-music-gtk-1.1.2/ui/window.ui 2020-06-14
05:16:01.000000000 +0200
+++ new/netease-cloud-music-gtk-1.1.3/ui/window.ui 2020-11-06
03:47:40.000000000 +0100
@@ -357,7 +357,6 @@
<property name="tooltip_text"
translatable="yes">播放</property>
<property name="image">play_image</property>
<property name="always_show_image">True</property>
- <accelerator key="space" signal="clicked"/>
</object>
<packing>
<property name="expand">False</property>
@@ -374,7 +373,6 @@
<property name="tooltip_text"
translatable="yes">播放</property>
<property name="image">pause_image</property>
<property name="always_show_image">True</property>
- <accelerator key="space" signal="clicked"/>
</object>
<packing>
<property name="expand">False</property>
++++++ vendor.tar.xz ++++++
/work/SRC/openSUSE:Factory/netease-cloud-music-gtk/vendor.tar.xz
/work/SRC/openSUSE:Factory/.netease-cloud-music-gtk.new.24930/vendor.tar.xz
differ: char 25, line 1
_______________________________________________
openSUSE Commits mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives:
https://lists.opensuse.org/archives/list/[email protected]