Skip to content

Commit

Permalink
6
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba160 committed Sep 10, 2023
1 parent 5d2cf2a commit 638f4c0
Show file tree
Hide file tree
Showing 93 changed files with 5,728 additions and 1,321 deletions.
12 changes: 7 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ set(CMAKE_CXX_FLAGS_INIT "-gdwarf-4")

set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/qml)
add_subdirectory(dbapi)
include_directories(dbapi/include)


project(ddb_gui_q LANGUAGES CXX)
Expand All @@ -28,7 +29,8 @@ endif()
set (CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

find_package(Qt6 COMPONENTS REQUIRED Core Concurrent Gui Quick Svg Charts)
find_package(Qt6 COMPONENTS REQUIRED Core Gui Concurrent Quick Svg Charts)

if (USE_WIDGETS)
find_package(Qt6 COMPONENTS REQUIRED Widgets QuickWidgets)
endif()
Expand All @@ -51,12 +53,14 @@ if (USE_WIDGETS)
widgets/plugins/ActionsTree.h widgets/plugins/ActionsTree.cpp
widgets/plugins/QueueManager.cpp widgets/plugins/QueueManager.h
widgets/DBActionMenu.h widgets/DBActionMenu.cpp
widgets/ActionHandlers.cpp widgets/ActionHandlers.h
)
endif()

set(SOURCES
${SOURCES_WIDGETS}
PluginLoader.cpp
#PluginDB.cpp
WidgetLibraryModel.cpp
QtGui.cpp)
qt_add_resources(SOURCES Images.qrc)
Expand All @@ -73,17 +77,15 @@ add_subdirectory(qml/DDB2)
# add_subdirectory(qml/Material)



target_link_libraries(ddb_gui_qt5 dbapiplugin DDB2 GuiCommon DDB2plugin GuiCommonplugin Qt6::Core Qt::Concurrent Qt::Gui Qt::Quick)
target_link_libraries(ddb_gui_qt5 dbapiplugin DDB2 GuiCommon DDB2plugin GuiCommonplugin Qt6::Core Qt::Gui Qt::Quick Qt::Concurrent)
if (USE_WIDGETS)
target_link_libraries(ddb_gui_qt5 dbapi Qt6::Widgets Qt6::QuickWidgets)
endif()

target_include_directories(ddb_gui_qt5 PRIVATE ".")

target_compile_definitions(ddb_gui_qt5 PRIVATE USE_WIDGETS=${USE_WIDGETS} QT_USE_STRINGBUILDER)
target_compile_definitions(ddb_gui_qt5 PRIVATE USE_
_CACHE=${USE_COVERART_CACHE})
target_compile_definitions(ddb_gui_qt5 PRIVATE USE_CACHE=${USE_COVERART_CACHE})

target_compile_options(ddb_gui_qt5 PRIVATE "-gdwarf-4")

Expand Down
13 changes: 10 additions & 3 deletions PluginLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <QDir>
#include "PluginLoader.h"
#include <QQmlEngine>
#include <QThread>

#include "WidgetLibraryModel.h"

Expand All @@ -34,9 +35,11 @@ PluginQmlWrapper::PluginQmlWrapper(QObject *parent, QUrl source) : QObject(paren
engine.rootContext()->setContextProperty("_db_bg_override", true);
engine.rootContext()->setContextProperty("_db_bg", "transparent");
engine.rootContext()->setContextProperty("_db_do_not_load", true);

QObject *plugin = component.create();
if (plugin) {
while(!component.isReady()) {
QThread::usleep(1000);
}
PluginQmlWrapper::extractPluginInfo(plugin);
}
delete plugin;
Expand All @@ -58,8 +61,12 @@ PluginLoader::PluginLoader(QObject *parent) : QObject(parent) {

// Load local Qt Quick widgets (TODO load from deadbeef dir)
QStringList default_qml_list;
for (QString &str : QDir(":/qml").entryList()) {
default_qml_list.append(QString("qrc:/qml/").append(str));
for (QString &str : QDir(":/qt/qml/DeaDBeeF/Q/GuiCommon").entryList()) {
qDebug() << "Found built-in qml widget" << str;
// TODO FIX
#if USE_WIDGETS
default_qml_list.append(QString("qrc:/qt/qml/DeaDBeeF/Q/GuiCommon/").append(str));
#endif
}
insertPlugins(default_qml_list);

Expand Down
39 changes: 0 additions & 39 deletions Qml.qrc

This file was deleted.

2 changes: 1 addition & 1 deletion QtGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static void unloadWidgets() {

static void startQuick() {
engine = new QQmlApplicationEngine();
engine->addImportPath(":/qt/qml");
//engine->addImportPath(":/qt/qml");

const QUrl url(u"qrc:/qt/qml/DeaDBeeF/Q/DDB2/main.qml"_qs);
//const QUrl url(QStringLiteral("qrc:/qml/DDB2/main.qml"));
Expand Down
7 changes: 7 additions & 0 deletions dbapi/ActionOwner.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "ActionOwner.h"

ActionOwner::ActionOwner(QObject *parent)
: QObject{parent}
{

}
25 changes: 25 additions & 0 deletions dbapi/ActionOwner.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef ACTIONOWNER_H
#define ACTIONOWNER_H

#include "Actions.h"
#include <QObject>

class DBAction;

class ActionOwner : public QObject
{
Q_OBJECT
public:
explicit ActionOwner(QObject *parent = nullptr);

virtual QList<DBAction*> getActions() = 0;
virtual DBAction* getAction(QString action_id) = 0;
public slots:
virtual void actionSafeToDeleted(QString action_id) {}
signals:
void actionCreated(QString action_id);
void actionAboutToBeDeleted(QString action_id);

};

#endif // ACTIONOWNER_H
Loading

0 comments on commit 638f4c0

Please sign in to comment.