adding basic filemanager plumbing
This commit is contained in:
parent
04e3d95a0c
commit
e4d4cfe8c3
9 changed files with 121 additions and 3 deletions
|
@ -27,7 +27,7 @@ include(ECMPoQmTools)
|
||||||
kde_enable_exceptions()
|
kde_enable_exceptions()
|
||||||
|
|
||||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui QuickControls2 Widgets Sql X11Extras)
|
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui QuickControls2 Widgets Sql X11Extras)
|
||||||
find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 I18n CoreAddons)
|
find_package(KF5 ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami2 I18n Archive CoreAddons)
|
||||||
|
|
||||||
find_package(Libmpv)
|
find_package(Libmpv)
|
||||||
set_package_properties(Libmpv PROPERTIES TYPE REQUIRED)
|
set_package_properties(Libmpv PROPERTIES TYPE REQUIRED)
|
||||||
|
|
|
@ -61,9 +61,11 @@ stdenv.mkDerivation rec {
|
||||||
# breeze-icons
|
# breeze-icons
|
||||||
# breeze-qt5
|
# breeze-qt5
|
||||||
# qqc2-desktop-style
|
# qqc2-desktop-style
|
||||||
|
libsForQt5.karchive
|
||||||
libsForQt5.ki18n
|
libsForQt5.ki18n
|
||||||
libsForQt5.kcoreaddons
|
libsForQt5.kcoreaddons
|
||||||
# lightly-qt
|
# lightly-qt
|
||||||
|
podofo
|
||||||
mpv
|
mpv
|
||||||
# libsForQt5.kconfig
|
# libsForQt5.kconfig
|
||||||
# ffmpeg-full
|
# ffmpeg-full
|
||||||
|
|
|
@ -20,6 +20,7 @@ mkShell rec {
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
clang-tools
|
clang-tools
|
||||||
|
# clang-format
|
||||||
qt5.full
|
qt5.full
|
||||||
qt5.qttools
|
qt5.qttools
|
||||||
qt5.qtquickcontrols2
|
qt5.qtquickcontrols2
|
||||||
|
@ -30,6 +31,7 @@ mkShell rec {
|
||||||
libsForQt5.breeze-icons
|
libsForQt5.breeze-icons
|
||||||
libsForQt5.breeze-qt5
|
libsForQt5.breeze-qt5
|
||||||
libsForQt5.qqc2-desktop-style
|
libsForQt5.qqc2-desktop-style
|
||||||
|
libsForQt5.karchive
|
||||||
# libsForQt5.kirigami-addons
|
# libsForQt5.kirigami-addons
|
||||||
libsForQt5.ki18n
|
libsForQt5.ki18n
|
||||||
libsForQt5.kcoreaddons
|
libsForQt5.kcoreaddons
|
||||||
|
|
|
@ -9,6 +9,7 @@ target_sources(presenter
|
||||||
slide.cpp slide.h
|
slide.cpp slide.h
|
||||||
videosqlmodel.cpp videosqlmodel.h
|
videosqlmodel.cpp videosqlmodel.h
|
||||||
imagesqlmodel.cpp imagesqlmodel.h
|
imagesqlmodel.cpp imagesqlmodel.h
|
||||||
|
filemanager.cpp filemanager.h
|
||||||
presentationsqlmodel.cpp presentationsqlmodel.h
|
presentationsqlmodel.cpp presentationsqlmodel.h
|
||||||
mpv/mpvobject.h mpv/mpvobject.cpp
|
mpv/mpvobject.h mpv/mpvobject.cpp
|
||||||
mpv/qthelper.hpp mpv/mpvhelpers.h
|
mpv/qthelper.hpp mpv/mpvhelpers.h
|
||||||
|
@ -24,6 +25,7 @@ target_link_libraries(presenter
|
||||||
Qt5::X11Extras
|
Qt5::X11Extras
|
||||||
KF5::Kirigami2
|
KF5::Kirigami2
|
||||||
KF5::I18n
|
KF5::I18n
|
||||||
|
KF5::Archive
|
||||||
podofo
|
podofo
|
||||||
mpv
|
mpv
|
||||||
)
|
)
|
||||||
|
|
52
src/filemanager.cpp
Normal file
52
src/filemanager.cpp
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
#include "filemanager.h"
|
||||||
|
#include <ktar.h>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
File::File(QObject *parent)
|
||||||
|
: QObject{parent}
|
||||||
|
{
|
||||||
|
qDebug() << "Initializing empty file";
|
||||||
|
}
|
||||||
|
|
||||||
|
File::File(const QString &name, const QString &filePath, QObject *parent)
|
||||||
|
: QObject(parent),m_name(name),m_filePath(filePath)
|
||||||
|
{
|
||||||
|
qDebug() << "Initializing file with defaults";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString File::name() const {
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString File::filePath() const {
|
||||||
|
return m_filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void File::setName(QString name)
|
||||||
|
{
|
||||||
|
if (m_name == name)
|
||||||
|
return;
|
||||||
|
|
||||||
|
qDebug() << "####changing name to: " << name;
|
||||||
|
m_name = name;
|
||||||
|
emit nameChanged(m_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void File::setFilePath(QString filePath)
|
||||||
|
{
|
||||||
|
if (m_filePath == filePath)
|
||||||
|
return;
|
||||||
|
|
||||||
|
qDebug() << "####changing filePath to: " << filePath;
|
||||||
|
m_filePath = filePath;
|
||||||
|
emit filePathChanged(m_filePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool File::save(QUrl file, QVariantList serviceList) {
|
||||||
|
qDebug() << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
|
||||||
|
qDebug() << "Saving...";
|
||||||
|
qDebug() << "File path is: " << file;
|
||||||
|
qDebug() << "serviceList is: " << serviceList;
|
||||||
|
qDebug() << "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
|
||||||
|
return true;
|
||||||
|
}
|
38
src/filemanager.h
Normal file
38
src/filemanager.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#ifndef FILEMANAGER_H
|
||||||
|
#define FILEMANAGER_H
|
||||||
|
|
||||||
|
#include <qobjectdefs.h>
|
||||||
|
#include <qqml.h>
|
||||||
|
#include <QObject>
|
||||||
|
#include <qobject.h>
|
||||||
|
|
||||||
|
class File : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
|
||||||
|
Q_PROPERTY(QString filePath READ filePath WRITE setFilePath NOTIFY filePathChanged)
|
||||||
|
// QML_ELEMENT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit File(QObject *parent = nullptr);
|
||||||
|
File(const QString &name, const QString &filePath,
|
||||||
|
QObject * parent = nullptr);
|
||||||
|
|
||||||
|
QString name() const;
|
||||||
|
QString filePath() const;
|
||||||
|
|
||||||
|
Q_INVOKABLE void setName(QString name);
|
||||||
|
Q_INVOKABLE void setFilePath(QString filePath);
|
||||||
|
|
||||||
|
Q_INVOKABLE bool save(QUrl file, QVariantList serviceList);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
Q_INVOKABLE void nameChanged(QString name);
|
||||||
|
Q_INVOKABLE void filePathChanged(QString filePath);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_name;
|
||||||
|
QString m_filePath;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //FILEMANAGER_H
|
|
@ -39,6 +39,7 @@
|
||||||
#include "videosqlmodel.h"
|
#include "videosqlmodel.h"
|
||||||
#include "imagesqlmodel.h"
|
#include "imagesqlmodel.h"
|
||||||
#include "presentationsqlmodel.h"
|
#include "presentationsqlmodel.h"
|
||||||
|
#include "filemanager.h"
|
||||||
#include "slide.h"
|
#include "slide.h"
|
||||||
|
|
||||||
static void connectToDatabase() {
|
static void connectToDatabase() {
|
||||||
|
@ -96,6 +97,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
//Need to instantiate our slide
|
//Need to instantiate our slide
|
||||||
QScopedPointer<Slide> slide(new Slide);
|
QScopedPointer<Slide> slide(new Slide);
|
||||||
|
QScopedPointer<File> filemanager(new File);
|
||||||
|
|
||||||
// apparently mpv needs this class set
|
// apparently mpv needs this class set
|
||||||
// let's register mpv as well
|
// let's register mpv as well
|
||||||
|
@ -109,6 +111,7 @@ int main(int argc, char *argv[])
|
||||||
qmlRegisterType<PresentationSqlModel>("org.presenter", 1, 0, "PresentationSqlModel");
|
qmlRegisterType<PresentationSqlModel>("org.presenter", 1, 0, "PresentationSqlModel");
|
||||||
qmlRegisterType<ServiceItemModel>("org.presenter", 1, 0, "ServiceItemModel");
|
qmlRegisterType<ServiceItemModel>("org.presenter", 1, 0, "ServiceItemModel");
|
||||||
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideObject", slide.get());
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "SlideObject", slide.get());
|
||||||
|
qmlRegisterSingletonInstance("org.presenter", 1, 0, "FileManager", filemanager.get());
|
||||||
|
|
||||||
connectToDatabase();
|
connectToDatabase();
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,16 @@ Kirigami.ApplicationWindow {
|
||||||
title: qsTr("File")
|
title: qsTr("File")
|
||||||
Labs.MenuItem { text: qsTr("New...") }
|
Labs.MenuItem { text: qsTr("New...") }
|
||||||
Labs.MenuItem { text: qsTr("Open...") }
|
Labs.MenuItem { text: qsTr("Open...") }
|
||||||
Labs.MenuItem { text: qsTr("Save") }
|
Labs.MenuItem {
|
||||||
Labs.MenuItem { text: qsTr("Save As...") }
|
text: qsTr("Save")
|
||||||
|
shortcut: "Ctrl+S"
|
||||||
|
onTriggered: save()
|
||||||
|
}
|
||||||
|
Labs.MenuItem {
|
||||||
|
text: qsTr("Save As...")
|
||||||
|
shortcut: "Ctrl+Shift+S"
|
||||||
|
onTriggered: saveAs()
|
||||||
|
}
|
||||||
Labs.MenuSeparator { }
|
Labs.MenuSeparator { }
|
||||||
Labs.MenuItem { text: qsTr("Quit") }
|
Labs.MenuItem { text: qsTr("Quit") }
|
||||||
}
|
}
|
||||||
|
@ -111,6 +119,15 @@ Kirigami.ApplicationWindow {
|
||||||
settingsSheet.open()
|
settingsSheet.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function save() {
|
||||||
|
const saved = FileManager.save("/home/chris/blah.pres", mainPage.serviceList);
|
||||||
|
saved ? showPassiveNotification("SAVED!") : showPassiveNotification("FAILED!");
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveAs() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
/* showPassiveNotification(Kirigami.Settings.style); */
|
/* showPassiveNotification(Kirigami.Settings.style); */
|
||||||
/* Kirigami.Settings.style = "Plasma"; */
|
/* Kirigami.Settings.style = "Plasma"; */
|
||||||
|
|
|
@ -37,6 +37,8 @@ Controls.Page {
|
||||||
property var song
|
property var song
|
||||||
property var draggedLibraryItem
|
property var draggedLibraryItem
|
||||||
|
|
||||||
|
property var serviceList: ["testing", "data"]
|
||||||
|
|
||||||
property bool songDragged: false
|
property bool songDragged: false
|
||||||
|
|
||||||
property string editType
|
property string editType
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue