making songeditor funcitonal but not yet
This commit is contained in:
parent
d5515d4c52
commit
f755190e40
6 changed files with 39 additions and 16 deletions
|
@ -30,6 +30,9 @@ Kirigami.ApplicationWindow {
|
|||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
showPassiveNotification(Kirigami.Settings.style);
|
||||
Kirigami.Settings.style = "Plasma";
|
||||
showPassiveNotification(Kirigami.Settings.style);
|
||||
print("checking screens");
|
||||
print("Present Mode is " + presentMode);
|
||||
screens = Qt.application.screens;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import QtQuick 2.13
|
||||
import QtQuick.Dialogs 1.0
|
||||
import QtQuick.Controls 2.0 as Controls
|
||||
import QtQuick.Layouts 1.2
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
@ -79,7 +78,6 @@ Item {
|
|||
delegate: songDelegate
|
||||
state: "selected"
|
||||
|
||||
Component.onCompleted: songList = songLibraryList
|
||||
states: [
|
||||
State {
|
||||
name: "deselected"
|
||||
|
@ -143,7 +141,7 @@ Item {
|
|||
onClicked: {
|
||||
showPassiveNotification(title, 3000)
|
||||
songLibraryList.currentIndex = index
|
||||
song = songLibraryList.selected
|
||||
song = index
|
||||
songTitle = title
|
||||
songLyrics = lyrics
|
||||
songAuthor = author
|
||||
|
@ -412,4 +410,8 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
function updateSongLyrics(lyrics) {
|
||||
showPassiveNotification("library function" + lyrics)
|
||||
showPassiveNotification("WE DID IT!")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@ import QtQuick.Dialogs 1.0
|
|||
import QtQuick.Controls 2.15 as Controls
|
||||
import QtQuick.Window 2.13
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtMultimedia 5.15
|
||||
import QtAudioEngine 1.15
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
import "./" as Presenter
|
||||
import org.presenter 1.0
|
||||
|
@ -20,13 +18,16 @@ Controls.Page {
|
|||
property string songLyrics: ""
|
||||
property string songAuthor: ""
|
||||
property int blurRadius: 0
|
||||
property ListView songList
|
||||
|
||||
property Item slideItem
|
||||
property var song
|
||||
property var draggedLibraryItem
|
||||
|
||||
signal songUpdated(string title, string lyrics, string author, string ccli, string audio)
|
||||
signal songLyricsUpdated(string lyrics)
|
||||
|
||||
Component.onCompleted: {
|
||||
mainPage.songLyricsUpdated.connect(library.updateSongLyrics)
|
||||
}
|
||||
|
||||
Item {
|
||||
id: mainItem
|
||||
|
@ -139,14 +140,15 @@ Controls.Page {
|
|||
|
||||
}
|
||||
|
||||
|
||||
SongSqlModel {
|
||||
id: songsqlmodel
|
||||
}
|
||||
|
||||
function updateLyrics(lyrics) {
|
||||
showPassiveNotification("adding lyrics...")
|
||||
songList.model.lyrics = lyrics;
|
||||
showPassiveNotification("added lyrics:\n " + lyrics)
|
||||
showPassiveNotification("song id " + song);
|
||||
|
||||
songsqlmodel.setLyrics(song, lyrics);
|
||||
|
||||
showPassiveNotification("did we do it?");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import QtQuick 2.13
|
||||
import QtQuick.Dialogs 1.0
|
||||
import QtQuick.Controls 2.15 as Controls
|
||||
import QtQuick.Window 2.13
|
||||
import QtQuick.Layouts 1.2
|
||||
import QtAudioEngine 1.15
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
import "./" as Presenter
|
||||
|
||||
|
@ -137,7 +134,7 @@ Item {
|
|||
textFormat: TextEdit.MarkdownText
|
||||
padding: 10
|
||||
onEditingFinished: mainPage.updateLyrics(text)
|
||||
onPressed: editorTimer.running = true
|
||||
/* onPressed: editorTimer.running = true */
|
||||
}
|
||||
}
|
||||
Controls.TextField {
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
#include <QSqlQuery>
|
||||
#include <QSql>
|
||||
#include <QSqlDatabase>
|
||||
#include <qabstractitemmodel.h>
|
||||
#include <qdebug.h>
|
||||
#include <qobjectdefs.h>
|
||||
#include <qsqlrecord.h>
|
||||
|
||||
static const char *songsTableName = "songs";
|
||||
|
||||
|
@ -110,6 +114,18 @@ void SongSqlModel::setLyrics(const QString &lyrics) {
|
|||
emit lyricsChanged();
|
||||
}
|
||||
|
||||
void SongSqlModel::setLyrics(const int &row, const QString &lyrics) {
|
||||
qDebug() << "Row is " << row;
|
||||
QSqlRecord rowdata = record(row);
|
||||
rowdata.setValue("lyrics", lyrics);
|
||||
setRecord(row, rowdata);
|
||||
submitAll();
|
||||
|
||||
select();
|
||||
emit lyricsChanged();
|
||||
|
||||
}
|
||||
|
||||
QString SongSqlModel::ccli() const {
|
||||
return m_ccli;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
#define SONGSQLMODEL_H
|
||||
|
||||
#include <QSqlTableModel>
|
||||
#include <qabstractitemmodel.h>
|
||||
#include <qqml.h>
|
||||
#include <qvariant.h>
|
||||
|
||||
class SongSqlModel : public QSqlTableModel
|
||||
{
|
||||
|
@ -25,6 +27,7 @@ public:
|
|||
|
||||
void setTitle(const QString &title);
|
||||
void setLyrics(const QString &lyrics);
|
||||
void setLyrics(const int &row, const QString &lyrics);
|
||||
void setAuthor(const QString &author);
|
||||
void setCcli(const QString &ccli);
|
||||
void setAudio(const QString &audio);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue