using more innerModels since they are already loaded
This commit is contained in:
parent
ae6ffd9595
commit
ad2ed98968
2 changed files with 3 additions and 20 deletions
|
@ -40,11 +40,11 @@ Item {
|
||||||
headerLabel: "Songs"
|
headerLabel: "Songs"
|
||||||
itemIcon: "folder-music-symbolic"
|
itemIcon: "folder-music-symbolic"
|
||||||
/* itemSubtitle: model.author */
|
/* itemSubtitle: model.author */
|
||||||
count: innerModel.rowCount()
|
count: innerModel.count()
|
||||||
newItemFunction: (function() {
|
newItemFunction: (function() {
|
||||||
songProxyModel.setFilterRegularExpression("");
|
songProxyModel.setFilterRegularExpression("");
|
||||||
songProxyModel.songModel.newSong();
|
innerModel.newSong();
|
||||||
libraryList.currentIndex = songProxyModel.songModel.count() - 1;
|
libraryList.currentIndex = innerModel.count() - 1;
|
||||||
if (!editMode)
|
if (!editMode)
|
||||||
editMode = true;
|
editMode = true;
|
||||||
editSwitch(libraryList.currentIndex, "song");
|
editSwitch(libraryList.currentIndex, "song");
|
||||||
|
|
|
@ -172,23 +172,6 @@ mod song_model {
|
||||||
// self.rust().db = db;
|
// self.rust().db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[qinvokable]
|
|
||||||
pub fn new_item(mut self: Pin<&mut Self>, url: QUrl) {
|
|
||||||
println!("LETS INSERT THIS SUCKER!");
|
|
||||||
let file_path = PathBuf::from(url.path().to_string());
|
|
||||||
let name = file_path.file_stem().unwrap().to_str().unwrap();
|
|
||||||
let song_id = self.rust().highest_id + 1;
|
|
||||||
let song_title = QString::from(name);
|
|
||||||
let song_path = url.to_qstring();
|
|
||||||
|
|
||||||
// if self.as_mut().add_item(song_id, song_title, song_path) {
|
|
||||||
// println!("filename: {:?}", name);
|
|
||||||
// self.as_mut().set_highest_id(song_id);
|
|
||||||
// } else {
|
|
||||||
// println!("Error in inserting item");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
pub fn new_song(mut self: Pin<&mut Self>) -> bool {
|
pub fn new_song(mut self: Pin<&mut Self>) -> bool {
|
||||||
let song_id = self.rust().highest_id + 1;
|
let song_id = self.rust().highest_id + 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue