trying to fix models
This commit is contained in:
parent
a1f18f803d
commit
b61e05a423
6 changed files with 20 additions and 28 deletions
|
@ -19,8 +19,8 @@ serde = "1.0.152"
|
|||
serde_derive = "1.0.152"
|
||||
quote = "1.0.27"
|
||||
cxx = "1.0.83"
|
||||
cxx-qt = "0.6.0"
|
||||
cxx-qt-lib = "0.6.0"
|
||||
cxx-qt = "0.6.1"
|
||||
cxx-qt-lib = "0.6.1"
|
||||
# home = "0.5.4"
|
||||
dirs = "5.0.0"
|
||||
diesel = { version = "2.0.3", features = ["sqlite"] }
|
||||
|
@ -44,8 +44,8 @@ reqwest = "0.11.23"
|
|||
# cxx-qt-build generates C++ code from the `#[cxx_qt::bridge]` module
|
||||
# and compiles it together with the Rust static library
|
||||
[build-dependencies]
|
||||
cxx-qt-build = "0.6.0"
|
||||
qt-build-utils = "0.6.0"
|
||||
cxx-qt-build = "0.6.1"
|
||||
qt-build-utils = "0.6.1"
|
||||
|
||||
# [dependencies.confy]
|
||||
# features = ["yaml_conf"]
|
||||
|
|
19
src/main.cpp
19
src/main.cpp
|
@ -133,19 +133,8 @@ int main(int argc, char *argv[])
|
|||
|
||||
QQuickView *PresWindow = new QQuickView;
|
||||
qDebug() << PresWindow;
|
||||
// PresWindow->create();
|
||||
// PresWindow->setSource(QUrl(QStringLiteral("qrc://qml/presenter/PresentationWindow.qml")));
|
||||
qDebug() << PresWindow->isVisible();
|
||||
|
||||
// QObject::connect(serviceItemC.get(),
|
||||
// SIGNAL(itemInserted(const int&, const ServiceItem&)),
|
||||
// slideMod.get(),
|
||||
// SLOT(insertItemFromService(const int&, const ServiceItem&)));
|
||||
// QObject::connect(serviceItemC.get(),
|
||||
// SIGNAL(itemAdded(const int&, const ServiceItem&)),
|
||||
// slideMod.get(),
|
||||
// SLOT(addItemFromService(const int&, const ServiceItem&)));
|
||||
|
||||
QObject::connect(serviceItemModel.get(),
|
||||
&ServiceItemModel::itemAdded,
|
||||
slideModel.get(),
|
||||
|
@ -166,10 +155,6 @@ int main(int argc, char *argv[])
|
|||
&ServiceItemModel::cleared,
|
||||
slideModel.get(),
|
||||
&SlideModel::clear);
|
||||
// QObject::connect(serviceItemModel.get(),
|
||||
// SIGNAL(allRemoved()),
|
||||
// slideMod.get(),
|
||||
// SLOT(clear()));
|
||||
QObject::connect(slideobject.get(),
|
||||
SIGNAL(slideChanged(int)),
|
||||
slideModel.get(),
|
||||
|
@ -193,7 +178,8 @@ int main(int argc, char *argv[])
|
|||
// qmlRegisterType<MpvItem>("mpv", 1, 0, "MpvItem");
|
||||
// qmlRegisterSingletonInstance("org.presenter", 1, 0, "MpvProperties", MpvProperties::self());
|
||||
|
||||
qDebug() << serviceItemModel.count;
|
||||
qDebug() << "IDKFd";
|
||||
qDebug() << serviceItemModel.get()->rowCount(QModelIndex());
|
||||
|
||||
//register our models
|
||||
// qmlRegisterType<SongProxyModel>("org.presenter", 1, 0, "SongProxyModel");
|
||||
|
@ -268,7 +254,6 @@ int main(int argc, char *argv[])
|
|||
// qDebug() << KWindowSystem::windows();
|
||||
// qDebug() << "00000000000000000000000000000000";
|
||||
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ Item {
|
|||
}
|
||||
|
||||
function addVideo(url) {
|
||||
videoProxyModel.videoModel.newItem(url);
|
||||
videoModel.newItem(url);
|
||||
selectedLibrary = "video";
|
||||
videoLibrary.libraryList.currentIndex = videoProxyModel.videoModel.count - 1;
|
||||
if (!editMode)
|
||||
|
@ -215,7 +215,7 @@ Item {
|
|||
}
|
||||
|
||||
function addImg(url) {
|
||||
imageProxyModel.newItem(url);
|
||||
imageModel.newItem(url);
|
||||
selectedLibrary = "image";
|
||||
imageLibrary.libraryList.currentIndex = imageProxyModel.imageModel.count - 1;
|
||||
if (!editMode)
|
||||
|
@ -249,7 +249,8 @@ Item {
|
|||
}
|
||||
|
||||
function isDragFile(item) {
|
||||
var extension = item.split('.').pop();
|
||||
console.log(item.toString());
|
||||
var extension = item.toString().split('.').pop();
|
||||
var valid = false;
|
||||
|
||||
if(extension) {
|
||||
|
@ -261,7 +262,7 @@ Item {
|
|||
}
|
||||
|
||||
function addFile(file) {
|
||||
let extension = file.split('.').pop();
|
||||
let extension = file.toString().split('.').pop();
|
||||
if (videoexts.includes(extension))
|
||||
{
|
||||
addVideo(file);
|
||||
|
@ -281,7 +282,7 @@ Item {
|
|||
showPassiveNotification("More than one file");
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
let file = files[i];
|
||||
let ext = file.split('.').pop()
|
||||
let ext = file.toString().split('.').pop()
|
||||
if (videoexts.includes(ext))
|
||||
{
|
||||
addVideo(file);
|
||||
|
|
|
@ -179,6 +179,10 @@ Controls.Page {
|
|||
/* ImageProxyModel { id: imageProxyModel } */
|
||||
/* PresentationProxyModel { id: presProxyModel } */
|
||||
/* VideoProxyModel { id: videoProxyModel } */
|
||||
SongModel { id: songModel }
|
||||
VideoModel { id: videoModel }
|
||||
PresentationModel { id: presentationModel }
|
||||
ImageModel { id: imageModel }
|
||||
ServiceThing { id: serviceThing }
|
||||
FileHelper { id: fileHelper }
|
||||
/* SlideHelper { id: slideHelper } */
|
||||
|
|
|
@ -81,7 +81,7 @@ Item {
|
|||
id: serviceListItem
|
||||
implicitWidth: serviceItemList.width
|
||||
height: Kirigami.Units.gridUnit * 2
|
||||
Component.onCompleted: Utils.dbg("SERVICEMODEL: " + name)
|
||||
Component.onCompleted: Utils.dbg("HELLLLLOOOOOO: " + ServiceItemModel.getItem(0).name)
|
||||
|
||||
property var selectedItems
|
||||
|
||||
|
@ -161,7 +161,7 @@ Item {
|
|||
anchors.rightMargin: 5
|
||||
implicitWidth: Kirigami.Units.gridUnit
|
||||
source: {
|
||||
switch (type) {
|
||||
switch (ty) {
|
||||
case 'image': return "folder-pictures-symbolic";
|
||||
case 'video': return "folder-videos-symbolic";
|
||||
case 'song': return "folder-music-symbolic";
|
||||
|
|
|
@ -179,6 +179,7 @@ mod video_model {
|
|||
use crate::schema::videos::dsl::*;
|
||||
use cxx_qt::CxxQtType;
|
||||
use cxx_qt_lib::{QByteArray, QModelIndex, QString, QUrl, QVariant};
|
||||
use diesel::migration::MigrationConnection;
|
||||
use diesel::sqlite::SqliteConnection;
|
||||
use diesel::{delete, insert_into, prelude::*, update};
|
||||
use std::path::PathBuf;
|
||||
|
@ -217,6 +218,7 @@ impl video_model::VideoModel {
|
|||
|
||||
pub fn setup(mut self: Pin<&mut Self>) {
|
||||
let db = &mut self.as_mut().get_db();
|
||||
run_migrations(db);
|
||||
let results = videos
|
||||
.load::<crate::models::Video>(db)
|
||||
.expect("Error loading videos");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue