fixing a lot of debug info
This commit is contained in:
parent
64e10dd765
commit
428386a25b
4 changed files with 72 additions and 40 deletions
|
@ -124,7 +124,7 @@ int main(int argc, char *argv[])
|
||||||
QCoreApplication::setOrganizationName(QStringLiteral("lumina"));
|
QCoreApplication::setOrganizationName(QStringLiteral("lumina"));
|
||||||
QCoreApplication::setOrganizationDomain(QStringLiteral("tfcconnection.org"));
|
QCoreApplication::setOrganizationDomain(QStringLiteral("tfcconnection.org"));
|
||||||
QCoreApplication::setApplicationName(QStringLiteral("lumina"));
|
QCoreApplication::setApplicationName(QStringLiteral("lumina"));
|
||||||
// qSetMessagePattern("[%{type} %{time h:m:s ap}: %{function} in %{file}]: %{message}\n");
|
qSetMessagePattern("[%{type} %{time h:m:s ap}: %{function} in %{file}]: %{message}\n");
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
QIcon::setFallbackThemeName("breeze");
|
QIcon::setFallbackThemeName("breeze");
|
||||||
|
@ -141,7 +141,7 @@ int main(int argc, char *argv[])
|
||||||
qDebug() << QApplication::platformName();
|
qDebug() << QApplication::platformName();
|
||||||
|
|
||||||
//Need to instantiate our slide
|
//Need to instantiate our slide
|
||||||
QScopedPointer<Utils> utils(new Utils);
|
// QScopedPointer<Utils> utils(new Utils);
|
||||||
QScopedPointer<SlideModel> slideModel(new SlideModel);
|
QScopedPointer<SlideModel> slideModel(new SlideModel);
|
||||||
QScopedPointer<SlideModelCpp> slideMod(new SlideModelCpp);
|
QScopedPointer<SlideModelCpp> slideMod(new SlideModelCpp);
|
||||||
QScopedPointer<File> filemanager(new File);
|
QScopedPointer<File> filemanager(new File);
|
||||||
|
@ -200,7 +200,9 @@ int main(int argc, char *argv[])
|
||||||
slideModel.get(),
|
slideModel.get(),
|
||||||
SLOT(activate(int)));
|
SLOT(activate(int)));
|
||||||
|
|
||||||
utils.get()->setup();
|
Utils *utils = new Utils;
|
||||||
|
utils->setup();
|
||||||
|
// qDebug() << utils.get();
|
||||||
|
|
||||||
if (!serviceItemModel.get()->load(settings->getLastSaveFile())) {
|
if (!serviceItemModel.get()->load(settings->getLastSaveFile())) {
|
||||||
qDebug() << "Last saved file is missing or there isn't a last saved file.";
|
qDebug() << "Last saved file is missing or there isn't a last saved file.";
|
||||||
|
@ -239,6 +241,7 @@ int main(int argc, char *argv[])
|
||||||
"ServiceItemC", serviceItemC.get());
|
"ServiceItemC", serviceItemC.get());
|
||||||
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideModel", slideModel.get());
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideModel", slideModel.get());
|
||||||
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideMod", slideMod.get());
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideMod", slideMod.get());
|
||||||
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "Utils", utils);
|
||||||
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideObject", slideobject.get());
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideObject", slideobject.get());
|
||||||
qmlRegisterSingletonInstance("org.presenter", 1, 0, "FileManager", filemanager.get());
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "FileManager", filemanager.get());
|
||||||
qmlRegisterSingletonInstance("org.presenter", 1, 0, "PresWindow", PresWindow);
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "PresWindow", PresWindow);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import QtQuick.Dialogs 1.3
|
||||||
import QtQuick.Layouts 1.15
|
import QtQuick.Layouts 1.15
|
||||||
import org.kde.kirigami 2.13 as Kirigami
|
import org.kde.kirigami 2.13 as Kirigami
|
||||||
import "./" as Presenter
|
import "./" as Presenter
|
||||||
|
import org.presenter 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
@ -348,7 +349,7 @@ Item {
|
||||||
songEditorModel.lyrics = text
|
songEditorModel.lyrics = text
|
||||||
/* editorTimer.running = false; */
|
/* editorTimer.running = false; */
|
||||||
}
|
}
|
||||||
/* onPressed: editorTimer.running = true */
|
onPressed: editorTimer.running = true
|
||||||
background: Presenter.TextBackground {
|
background: Presenter.TextBackground {
|
||||||
control: lyricsEditor
|
control: lyricsEditor
|
||||||
}
|
}
|
||||||
|
@ -469,25 +470,34 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Timer { */
|
Timer {
|
||||||
/* id: editorTimer */
|
id: editorTimer
|
||||||
/* interval: 1000 */
|
interval: 1000
|
||||||
/* repeat: true */
|
repeat: true
|
||||||
/* running: false */
|
running: false
|
||||||
/* onTriggered: { */
|
onTriggered: {
|
||||||
/* if (lyricsEditor.text === songEditorModel.lyrics) */
|
if (lyricsEditor.text === songEditorModel.lyrics) {
|
||||||
/* return; */
|
return;
|
||||||
/* else */
|
}
|
||||||
/* songEditorModel.lyrics = lyricsEditor.text; */
|
else {
|
||||||
/* /\* updateLyrics(lyricsEditor.text); *\/ */
|
Utils.dbg("Changing Lyrics");
|
||||||
/* } */
|
/* songEditorModel.lyrics = lyricsEditor.text; */
|
||||||
/* } */
|
/* showPassiveNotification("Lyrics changed"); */
|
||||||
|
songProxyModel.songModel.updateLyrics(songID, lyricsEditor.text);
|
||||||
|
clearSlides();
|
||||||
|
changeSlideText(songID);
|
||||||
|
Utils.dbg("Lyrics changed");
|
||||||
|
}
|
||||||
|
/* updateLyrics(lyricsEditor.text); */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function changeSong(index) {
|
function changeSong(index) {
|
||||||
console.log("Preparing to change song: " + index + 1 + " out of " + songProxyModel.songModel.count);
|
Utils.dbg("Preparing to change song: " + index + 1 + " out of " + songProxyModel.songModel.count);
|
||||||
|
editorTimer.running = false;
|
||||||
clearSlides();
|
clearSlides();
|
||||||
const updatedSong = songProxyModel.getSong(index);
|
const updatedSong = songProxyModel.songModel.getItem(index);
|
||||||
console.log(updatedSong.vorder + " " + updatedSong.title + " " + updatedSong.audio);
|
Utils.dbg(updatedSong.vorder + " " + updatedSong.title + " " + updatedSong.audio);
|
||||||
songEditorModel.title = updatedSong.title;
|
songEditorModel.title = updatedSong.title;
|
||||||
songEditorModel.lyrics = updatedSong.lyrics;
|
songEditorModel.lyrics = updatedSong.lyrics;
|
||||||
songEditorModel.author = updatedSong.author;
|
songEditorModel.author = updatedSong.author;
|
||||||
|
@ -502,14 +512,14 @@ Item {
|
||||||
songEditorModel.fontSize = updatedSong.fontSize;
|
songEditorModel.fontSize = updatedSong.fontSize;
|
||||||
songEditorModel.checkVerseOrder();
|
songEditorModel.checkVerseOrder();
|
||||||
songEditorModel.checkFiles();
|
songEditorModel.checkFiles();
|
||||||
songID = updatedSong.id;
|
songID = index;
|
||||||
|
|
||||||
changeSlideHAlignment(song.horizontalTextAlignment);
|
changeSlideHAlignment(song.horizontalTextAlignment);
|
||||||
changeSlideVAlignment(song.verticalTextAlignment);
|
changeSlideVAlignment(song.verticalTextAlignment);
|
||||||
changeSlideFont(song.font, true);
|
changeSlideFont(song.font, true);
|
||||||
changeSlideFontSize(song.fontSize, true)
|
changeSlideFontSize(song.fontSize, true)
|
||||||
changeSlideText(songProxyModel.modelIndex(index).row);
|
changeSlideText(index);
|
||||||
console.log("Changing to song: " + song.title + " with ID: " + songID);
|
Utils.dbg("Changing to song: " + song.title + " with ID: " + songID);
|
||||||
footerFirstText = "Song: ";
|
footerFirstText = "Song: ";
|
||||||
footerSecondText = song.title;
|
footerSecondText = song.title;
|
||||||
songList.loadVideo();
|
songList.loadVideo();
|
||||||
|
@ -518,10 +528,6 @@ Item {
|
||||||
Connections {
|
Connections {
|
||||||
target: songEditorModel
|
target: songEditorModel
|
||||||
function onLyricsChanged() {
|
function onLyricsChanged() {
|
||||||
showPassiveNotification("Lyrics changed");
|
|
||||||
songProxyModel.songModel.updateLyrics(songID, lyricsEditor.text);
|
|
||||||
clearSlides();
|
|
||||||
changeSlideText(songID);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,7 +574,7 @@ Item {
|
||||||
songEditorModel.background = file;
|
songEditorModel.background = file;
|
||||||
songProxyModel.songModel.updateBackground(songID, file);
|
songProxyModel.songModel.updateBackground(songID, file);
|
||||||
songProxyModel.songModel.updateBackgroundType(songID, backgroundType);
|
songProxyModel.songModel.updateBackgroundType(songID, backgroundType);
|
||||||
console.log("changed background");
|
Utils.dbg("changed background");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -647,7 +653,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeSlideText(id) {
|
function changeSlideText(id) {
|
||||||
const verses = songProxyModel.getLyricList(id);
|
const verses = songProxyModel.songModel.getLyricList(id);
|
||||||
verses.forEach(songList.appendVerse);
|
verses.forEach(songList.appendVerse);
|
||||||
/* songList.loadVideo(); */
|
/* songList.loadVideo(); */
|
||||||
}
|
}
|
||||||
|
|
|
@ -978,8 +978,8 @@ impl song_model::SongModel {
|
||||||
for (i, line) in raw_lyrics.split("\n").enumerate() {
|
for (i, line) in raw_lyrics.split("\n").enumerate() {
|
||||||
if keywords.contains(&line) {
|
if keywords.contains(&line) {
|
||||||
if i != 0 {
|
if i != 0 {
|
||||||
println!("{verse_title}");
|
// println!("{verse_title}");
|
||||||
println!("{lyric}");
|
// println!("{lyric}");
|
||||||
lyric_map.insert(verse_title, lyric);
|
lyric_map.insert(verse_title, lyric);
|
||||||
lyric = String::from("");
|
lyric = String::from("");
|
||||||
verse_title = line.to_string();
|
verse_title = line.to_string();
|
||||||
|
@ -996,25 +996,25 @@ impl song_model::SongModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lyric_map.insert(verse_title, lyric);
|
lyric_map.insert(verse_title, lyric);
|
||||||
println!("da-map: {:?}", lyric_map);
|
// println!("da-map: {:?}", lyric_map);
|
||||||
|
|
||||||
for mut verse in vorder {
|
for mut verse in vorder {
|
||||||
let mut verse_name = "";
|
let mut verse_name = "";
|
||||||
debug!(verse = verse);
|
// debug!(verse = verse);
|
||||||
for word in keywords.clone() {
|
for word in keywords.clone() {
|
||||||
let end_verse =
|
let end_verse =
|
||||||
verse.get(1..2).unwrap_or_default();
|
verse.get(1..2).unwrap_or_default();
|
||||||
let beg_verse =
|
let beg_verse =
|
||||||
verse.get(0..1).unwrap_or_default();
|
verse.get(0..1).unwrap_or_default();
|
||||||
println!(
|
// println!(
|
||||||
"verse: {:?}, beginning: {:?}, end: {:?}, word: {:?}",
|
// "verse: {:?}, beginning: {:?}, end: {:?}, word: {:?}",
|
||||||
verse, beg_verse, end_verse, word
|
// verse, beg_verse, end_verse, word
|
||||||
);
|
// );
|
||||||
if word.starts_with(beg_verse)
|
if word.starts_with(beg_verse)
|
||||||
&& word.ends_with(end_verse)
|
&& word.ends_with(end_verse)
|
||||||
{
|
{
|
||||||
verse_name = word;
|
verse_name = word;
|
||||||
println!("TITLE: {verse_name}");
|
// println!("TITLE: {verse_name}");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1036,7 +1036,8 @@ impl song_model::SongModel {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
for lyric in lyric_list.iter() {
|
for lyric in lyric_list.iter() {
|
||||||
println!("da-list: {:?}", lyric);
|
// println!("da-list: {:?}", lyric);
|
||||||
|
debug!(lyric = ?lyric)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QStringList::from(&lyric_list)
|
QStringList::from(&lyric_list)
|
||||||
|
|
|
@ -2,11 +2,14 @@ use std::pin::Pin;
|
||||||
|
|
||||||
use time::macros::format_description;
|
use time::macros::format_description;
|
||||||
use tokio::runtime::Runtime;
|
use tokio::runtime::Runtime;
|
||||||
|
use tracing::{debug, info};
|
||||||
use tracing_subscriber::{
|
use tracing_subscriber::{
|
||||||
fmt::{self, time::LocalTime},
|
fmt::{self, time::LocalTime},
|
||||||
EnvFilter,
|
EnvFilter,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use self::utilities::QString;
|
||||||
|
|
||||||
mod db {
|
mod db {
|
||||||
use diesel::{Connection, SqliteConnection};
|
use diesel::{Connection, SqliteConnection};
|
||||||
use dirs::data_local_dir;
|
use dirs::data_local_dir;
|
||||||
|
@ -50,6 +53,11 @@ mod db {
|
||||||
|
|
||||||
#[cxx_qt::bridge]
|
#[cxx_qt::bridge]
|
||||||
mod utilities {
|
mod utilities {
|
||||||
|
unsafe extern "C++" {
|
||||||
|
include!("cxx-qt-lib/qstring.h");
|
||||||
|
type QString = cxx_qt_lib::QString;
|
||||||
|
}
|
||||||
|
|
||||||
unsafe extern "RustQt" {
|
unsafe extern "RustQt" {
|
||||||
#[qobject]
|
#[qobject]
|
||||||
#[qml_element]
|
#[qml_element]
|
||||||
|
@ -57,6 +65,12 @@ mod utilities {
|
||||||
|
|
||||||
#[qinvokable]
|
#[qinvokable]
|
||||||
fn setup(self: Pin<&mut Utils>);
|
fn setup(self: Pin<&mut Utils>);
|
||||||
|
|
||||||
|
#[qinvokable]
|
||||||
|
fn dbg(self: &Utils, message: QString);
|
||||||
|
|
||||||
|
#[qinvokable]
|
||||||
|
fn inf(self: &Utils, message: QString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,9 +88,17 @@ impl Default for UtilsRust {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl utilities::Utils {
|
impl utilities::Utils {
|
||||||
pub fn setup(mut self: Pin<&mut Self>) {
|
pub fn setup(self: Pin<&mut Self>) {
|
||||||
crate::utils::setup();
|
crate::utils::setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn dbg(self: &Self, message: QString) {
|
||||||
|
debug!(msg = ?message);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn inf(self: &Self, message: QString) {
|
||||||
|
info!(msg = ?message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setup() {
|
pub fn setup() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue