using more innerModels since they are already loaded

This commit is contained in:
Chris Cochrun 2023-05-18 06:39:22 -05:00
parent ae6ffd9595
commit ad2ed98968
2 changed files with 3 additions and 20 deletions

View file

@ -40,11 +40,11 @@ Item {
headerLabel: "Songs"
itemIcon: "folder-music-symbolic"
/* itemSubtitle: model.author */
count: innerModel.rowCount()
count: innerModel.count()
newItemFunction: (function() {
songProxyModel.setFilterRegularExpression("");
songProxyModel.songModel.newSong();
libraryList.currentIndex = songProxyModel.songModel.count() - 1;
innerModel.newSong();
libraryList.currentIndex = innerModel.count() - 1;
if (!editMode)
editMode = true;
editSwitch(libraryList.currentIndex, "song");

View file

@ -172,23 +172,6 @@ mod song_model {
// 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]
pub fn new_song(mut self: Pin<&mut Self>) -> bool {
let song_id = self.rust().highest_id + 1;