rename all cxx_qt::bridge modules to qobject for clarity

This commit is contained in:
Chris Cochrun 2024-06-24 16:40:37 -05:00
parent 8ae9911ee3
commit b4ce082891
11 changed files with 38 additions and 40 deletions

View file

@ -1,7 +1,7 @@
// The purpose of this file is to provide validation
// of whether or not a file exists
#[cxx_qt::bridge]
mod file_helper {
mod qobject {
unsafe extern "C++" {
include!("cxx-qt-lib/qstring.h");
type QString = cxx_qt_lib::QString;
@ -56,7 +56,7 @@ impl Default for FileHelperRust {
}
}
impl file_helper::FileHelper {
impl qobject::FileHelper {
pub fn load(self: Pin<&mut Self>, file: QUrl) -> Vec<String> {
println!("{file}");
vec!["hi".to_string()]

View file

@ -1,5 +1,5 @@
#[cxx_qt::bridge]
mod image_model {
mod qobject {
unsafe extern "C++" {
include!(< QAbstractListModel >);
include!("cxx-qt-lib/qhash.h");
@ -162,7 +162,7 @@ use diesel::{delete, insert_into, prelude::*, update};
use std::path::PathBuf;
use std::pin::Pin;
use self::image_model::{
use self::qobject::{
ImageRoles, QHash_i32_QByteArray, QMap_QString_QVariant,
QVector_i32,
};
@ -182,7 +182,7 @@ pub struct ImageModelRust {
images: Vec<Image>,
}
impl image_model::ImageModel {
impl qobject::ImageModel {
pub fn clear(mut self: Pin<&mut Self>) {
unsafe {
self.as_mut().begin_reset_model();
@ -450,7 +450,7 @@ impl image_model::ImageModel {
}
// QAbstractListModel implementation
impl image_model::ImageModel {
impl qobject::ImageModel {
fn data(&self, index: &QModelIndex, role: i32) -> QVariant {
let role = ImageRoles { repr: role };
if let Some(image) = self.images.get(index.row() as usize) {

View file

@ -1,5 +1,5 @@
#[cxx_qt::bridge]
mod presentation_model {
mod qobject {
unsafe extern "C++" {
include!(< QAbstractListModel >);
include!("cxx-qt-lib/qhash.h");
@ -175,7 +175,7 @@ mod presentation_model {
}
}
use crate::presentation_model::presentation_model::QMap_QString_QVariant;
use crate::presentation_model::qobject::QMap_QString_QVariant;
use crate::reveal_js;
use crate::schema::presentations::dsl::*;
use cxx_qt::CxxQtType;
@ -187,9 +187,7 @@ use std::path::PathBuf;
use std::pin::Pin;
use tracing::debug;
use self::presentation_model::{
PresRoles, QHash_i32_QByteArray, QVector_i32,
};
use self::qobject::{PresRoles, QHash_i32_QByteArray, QVector_i32};
#[derive(Default, Clone, Debug)]
pub struct Presentation {
@ -207,7 +205,7 @@ pub struct PresentationModelRust {
presentations: Vec<Presentation>,
}
impl presentation_model::PresentationModel {
impl qobject::PresentationModel {
pub fn clear(mut self: Pin<&mut Self>) {
unsafe {
self.as_mut().begin_reset_model();
@ -581,7 +579,7 @@ impl presentation_model::PresentationModel {
}
// QAbstractListModel implementation
impl presentation_model::PresentationModel {
impl qobject::PresentationModel {
fn data(&self, index: &QModelIndex, role: i32) -> QVariant {
let role = PresRoles { repr: role };
if let Some(presentation) =

View file

@ -1,5 +1,5 @@
#[cxx_qt::bridge]
mod service_item_model {
mod qobject {
unsafe extern "C++" {
include!(< QAbstractListModel >);
include!("cxx-qt-lib/qhash.h");
@ -291,7 +291,7 @@ mod service_item_model {
}
use crate::obs::Obs;
use crate::service_item_model::service_item_model::QList_QString;
use crate::service_item_model::qobject::QList_QString;
use cxx_qt::{CxxQtType, Threading};
use cxx_qt_lib::{
QByteArray, QModelIndex, QString, QStringList, QUrl, QVariant,
@ -306,12 +306,12 @@ use std::{fs, println};
use tar::{Archive, Builder};
use tracing::{debug, error};
use zstd::{Decoder, Encoder};
use self::service_item_model::{
use self::qobject::{
QHash_i32_QByteArray, QMap_QString_QVariant, QVector_i32,
ServiceRoles,
};
use super::service_item_model::service_item_model::ServiceItemModel;
use super::service_item_model::qobject::ServiceItemModel;
#[derive(Clone, Debug)]
pub struct ServiceItem {
@ -1382,7 +1382,7 @@ impl service_item_model::ServiceItemModel {
}
// QAbstractListModel implementation
impl service_item_model::ServiceItemModel {
impl qobject::ServiceItemModel {
fn data(&self, index: &QModelIndex, role: i32) -> QVariant {
let role = ServiceRoles { repr: role };
if let Some(service_item) =

View file

@ -1,5 +1,5 @@
#[cxx_qt::bridge]
mod settings {
mod qobject {
unsafe extern "C++" {
include!("cxx-qt-lib/qstring.h");
type QString = cxx_qt_lib::QString;
@ -60,7 +60,7 @@ impl Default for SettingsRust {
}
}
impl settings::Settings {
impl qobject::Settings {
pub fn setup(mut self: Pin<&mut Self>) {
let home = dirs::config_dir();
println!("{:?}", home);

View file

@ -1,5 +1,5 @@
#[cxx_qt::bridge]
mod slide_model {
mod qobject {
unsafe extern "C++" {
include!(< QAbstractListModel >);
include!("cxx-qt-lib/qhash.h");
@ -216,7 +216,7 @@ mod slide_model {
use crate::ffmpeg;
use crate::obs::Obs;
use crate::slide_model::slide_model::QList_QString;
use crate::slide_model::qobject::QList_QString;
use cxx_qt::{CxxQtType, Threading};
use cxx_qt_lib::{
CaseSensitivity, QByteArray, QMap, QModelIndex, QString, QStringList, QVariant
@ -226,7 +226,7 @@ use std::thread;
use std::{path::PathBuf, pin::Pin};
use tracing::{debug, error};
use self::slide_model::{
use self::qobject::{
QHash_i32_QByteArray, QMap_QString_QVariant, QVector_i32,
SlideRoles,
};
@ -311,7 +311,7 @@ impl Default for SlideModelRust {
}
}
impl slide_model::SlideModel {
impl qobject::SlideModel {
pub fn add_video_thumbnail(
mut self: Pin<&mut Self>,
index: i32,
@ -1236,7 +1236,7 @@ impl slide_model::SlideModel {
}
// QAbstractListModel implementation
impl slide_model::SlideModel {
impl qobject::SlideModel {
pub fn data(&self, index: &QModelIndex, role: i32) -> QVariant {
let role = SlideRoles { repr: role };
if let Some(slide) = self.slides.get(index.row() as usize) {

View file

@ -1,5 +1,5 @@
#[cxx_qt::bridge]
mod slide_object {
mod qobject {
unsafe extern "C++" {
include!("cxx-qt-lib/qstring.h");
type QString = cxx_qt_lib::QString;
@ -90,7 +90,7 @@ use cxx_qt::CxxQtType;
use cxx_qt_lib::{CaseSensitivity, QString, QVariant};
use tracing::debug;
use self::slide_object::QMap_QString_QVariant;
use self::qobject::QMap_QString_QVariant;
#[derive(Clone, Debug)]
pub struct SlideObjectRust {
@ -139,7 +139,7 @@ impl Default for SlideObjectRust {
}
}
impl slide_object::SlideObject {
impl qobject::SlideObject {
pub fn change_slide(
mut self: Pin<&mut Self>,
item: QMap_QString_QVariant,

View file

@ -1,5 +1,5 @@
#[cxx_qt::bridge]
pub mod song_editor {
pub mod qobject {
unsafe extern "C++" {
include!("cxx-qt-lib/qmap.h");
type QMap_QString_QVariant =

View file

@ -1,5 +1,5 @@
#[cxx_qt::bridge]
pub mod song_model {
pub mod qobject {
unsafe extern "C++" {
include!(< QAbstractListModel >);
include!("cxx-qt-lib/qhash.h");
@ -242,7 +242,7 @@ pub mod song_model {
use crate::models::*;
use crate::schema::songs::dsl::*;
use crate::songs::song_editor::song_editor::QList_QString;
use crate::songs::song_editor::qobject::QList_QString;
use cxx_qt::CxxQtType;
use cxx_qt_lib::{
QByteArray, QModelIndex, QString, QStringList, QVariant,
@ -254,7 +254,7 @@ use std::pin::Pin;
use std::slice::Iter;
use tracing::{debug, debug_span, error, info, instrument};
use self::song_model::{
use self::qobject::{
QHash_i32_QByteArray, QMap_QString_QVariant, QVector_i32,
SongRoles,
};
@ -296,7 +296,7 @@ pub struct SongModelRust {
inner_songs: Vec<Song>,
}
impl song_model::SongModel {
impl qobject::SongModel {
pub fn clear(mut self: Pin<&mut Self>) {
unsafe {
self.as_mut().begin_reset_model();
@ -1098,7 +1098,7 @@ impl song_model::SongModel {
}
// QAbstractListModel implementation
impl song_model::SongModel {
impl qobject::SongModel {
fn data(&self, index: &QModelIndex, role: i32) -> QVariant {
let role = SongRoles { repr: role };
if let Some(song) = self.songs.get(index.row() as usize) {

View file

@ -1,5 +1,5 @@
#[cxx_qt::bridge]
mod video_model {
mod qobject {
unsafe extern "C++" {
include!(< QAbstractListModel >);
include!("cxx-qt-lib/qhash.h");
@ -185,7 +185,7 @@ use diesel::{delete, insert_into, prelude::*, update};
use std::path::PathBuf;
use std::pin::Pin;
use self::video_model::{
use self::qobject::{
QHash_i32_QByteArray, QMap_QString_QVariant, QVector_i32,
VideoRoles,
};
@ -207,7 +207,7 @@ pub struct VideoModelRust {
videos: Vec<self::Video>,
}
impl video_model::VideoModel {
impl qobject::VideoModel {
pub fn clear(mut self: Pin<&mut Self>) {
unsafe {
self.as_mut().begin_reset_model();
@ -610,7 +610,7 @@ impl video_model::VideoModel {
}
// QAbstractListModel implementation
impl video_model::VideoModel {
impl qobject::VideoModel {
fn data(&self, index: &QModelIndex, role: i32) -> QVariant {
let role = VideoRoles { repr: role };
if let Some(video) = self.videos.get(index.row() as usize) {

View file

@ -1,5 +1,5 @@
#[cxx_qt::bridge]
mod ytdl {
mod qobject {
unsafe extern "C++" {
include!("cxx-qt-lib/qurl.h");
type QUrl = cxx_qt_lib::QUrl;
@ -40,7 +40,7 @@ pub struct YtdlRust {
file: QUrl,
}
impl ytdl::Ytdl {
impl qobject::Ytdl {
pub fn get_video(mut self: Pin<&mut Self>, url: QUrl) -> bool {
if !url.is_valid() {
false