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