diff --git a/src/cpp/songsqlmodel.cpp b/src/cpp/songsqlmodel.cpp index 4f758fd..1132928 100644 --- a/src/cpp/songsqlmodel.cpp +++ b/src/cpp/songsqlmodel.cpp @@ -757,6 +757,10 @@ QVariantMap SongProxyModel::getSong(const int &row) { return song; } +void SongProxyModel::newSong() { + m_songModel->newSong(); +} + void SongProxyModel::deleteSong(const int &row) { auto model = qobject_cast(sourceModel()); model->removeItem(row); diff --git a/src/cpp/songsqlmodel.h b/src/cpp/songsqlmodel.h index a2db8b6..929cb02 100644 --- a/src/cpp/songsqlmodel.h +++ b/src/cpp/songsqlmodel.h @@ -131,6 +131,7 @@ public: public slots: Q_INVOKABLE QVariantMap getSong(const int &row); + Q_INVOKABLE void newSong(); Q_INVOKABLE void deleteSong(const int &row); Q_INVOKABLE void deleteSongs(const QVector &rows); Q_INVOKABLE QStringList getLyricList(const int &row); diff --git a/src/main.cpp b/src/main.cpp index 600dd38..1f0f22e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -56,6 +56,9 @@ #include "cxx-qt-gen/settings.cxxqt.h" #include "cxx-qt-gen/ytdl.cxxqt.h" #include "cxx-qt-gen/presentation_model.cxxqt.h" +#include "cxx-qt-gen/song_model.cxxqt.h" +#include "cxx-qt-gen/video_model.cxxqt.h" +#include "cxx-qt-gen/image_model.cxxqt.h" // #include "cxx-qt-gen/image_model.cxxqt.h" static QWindow *windowFromEngine(QQmlApplicationEngine *engine) @@ -202,11 +205,14 @@ int main(int argc, char *argv[]) qmlRegisterType("org.presenter", 1, 0, "VideoProxyModel"); qmlRegisterType("org.presenter", 1, 0, "ImageProxyModel"); qmlRegisterType("org.presenter", 1, 0, "PresentationProxyModel"); + qmlRegisterType("org.presenter", 1, 0, "SongModel"); + qmlRegisterType("org.presenter", 1, 0, "VideoModel"); + qmlRegisterType("org.presenter", 1, 0, "ImageModel"); qmlRegisterType("org.presenter", 1, 0, "PresentationModel"); - qmlRegisterType("org.presenter", 1, 0, "SongSqlModel"); - qmlRegisterType("org.presenter", 1, 0, "VideoSqlModel"); - qmlRegisterType("org.presenter", 1, 0, "ImageSqlModel"); - qmlRegisterType("org.presenter", 1, 0, "PresentationSqlModel"); + // qmlRegisterType("org.presenter", 1, 0, "SongSqlModel"); + // qmlRegisterType("org.presenter", 1, 0, "VideoSqlModel"); + // qmlRegisterType("org.presenter", 1, 0, "ImageSqlModel"); + // qmlRegisterType("org.presenter", 1, 0, "PresentationSqlModel"); qmlRegisterType("org.presenter", 1, 0, "FileHelper"); qmlRegisterType("org.presenter", 1, 0, "Ytdl"); qmlRegisterType("org.presenter", 1, 0, "ServiceThing");