diff --git a/CMakeLists.txt b/CMakeLists.txt
index d8e6a51af5..2a81a0b8a5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,6 +55,11 @@ include(GNUInstallDirs)
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools)
+find_package(KDDockWidgets)
+
+if(KDDockWidgets_FOUND)
+ add_compile_definitions(USE_KDDOCKWIDGETS)
+endif()
if(Qt5Widgets_VERSION VERSION_LESS 5.15.2)
message(FATAL_ERROR "Minimum supported Qt 5.15.2")
@@ -208,7 +213,14 @@ add_definitions(-DQT_NO_KEYWORDS)
set(CMAKE_VERBOSE_MAKEFILE ON)
target_include_directories(${PROJECT_NAME} PUBLIC scopy-gui scopy-core)
-target_link_libraries(${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets ${SCOPY_DEPENDENCIES} scopy-core scopy-gui)
+target_link_libraries(
+ ${PROJECT_NAME}
+ PRIVATE Qt${QT_VERSION_MAJOR}::Widgets
+ ${SCOPY_DEPENDENCIES}
+ scopy-core
+ scopy-gui
+ KDAB::kddockwidgets
+)
# Compiler options
target_compile_options(${PROJECT_NAME} PUBLIC -Wall)
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt
index 5901481ce0..338718065f 100644
--- a/gui/CMakeLists.txt
+++ b/gui/CMakeLists.txt
@@ -44,6 +44,7 @@ file(
SRC_LIST
src/*.cpp
src/widgets/*.cpp
+ src/docking/*.cpp
src/*.cc
src/binding/*.cpp
src/prop/*.cpp
@@ -54,6 +55,7 @@ file(
include/${SCOPY_MODULE}/*.h
include/${SCOPY_MODULE}/*.hpp
include/${SCOPY_MODULE}/widgets/*.h
+ include/${SCOPY_MODULE}/docking/*.h
include/${SCOPY_MODULE}/binding/*.hpp
include/${SCOPY_MODULE}/prop/*.hpp
)
@@ -106,6 +108,7 @@ endif()
set(PROJECT_SOURCES ${SRC_LIST} ${HEADER_LIST} ${UI_LIST})
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Xml Svg REQUIRED)
+find_package(KDDockWidgets)
add_definitions(-DBOOST_ALL_DYN_LINK)
find_package(Boost COMPONENTS system filesystem thread chrono REQUIRED)
@@ -145,6 +148,7 @@ target_link_libraries(
${Boost_LIBRARIES}
scopy-common
scopy-pluginbase
+ KDAB::kddockwidgets
)
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${SCOPY_DLL_INSTALL_PATH} COMPONENT ${SCOPY_PDK}
diff --git a/gui/include/gui/docking/dockablearea.h b/gui/include/gui/docking/dockablearea.h
new file mode 100644
index 0000000000..e4729c40a1
--- /dev/null
+++ b/gui/include/gui/docking/dockablearea.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2024 Analog Devices Inc.
+ *
+ * This file is part of Scopy
+ * (see https://www.github.com/analogdevicesinc/scopy).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef DOCKABLEAREA_H
+#define DOCKABLEAREA_H
+
+#ifdef USE_KDDOCKWIDGETS
+#include "docking/dockableareakdab.h"
+namespace scopy {
+using DockableArea = kdab::DockableArea;
+}
+#else
+#include "docking/dockableareaclassic.h"
+namespace scopy {
+using DockableArea = classic::DockableArea;
+}
+#endif
+
+#endif // DOCKABLEAREA_H
diff --git a/gui/include/gui/docking/dockableareaclassic.h b/gui/include/gui/docking/dockableareaclassic.h
new file mode 100644
index 0000000000..171b886ca1
--- /dev/null
+++ b/gui/include/gui/docking/dockableareaclassic.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2024 Analog Devices Inc.
+ *
+ * This file is part of Scopy
+ * (see https://www.github.com/analogdevicesinc/scopy).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef DOCKABLEAREACLASSIC_H
+#define DOCKABLEAREACLASSIC_H
+
+#include "scopy-gui_export.h"
+#include
+#include "docking/dockableareainterface.h"
+
+namespace scopy::classic {
+class SCOPY_GUI_EXPORT DockableArea : public QWidget, public DockableAreaInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(scopy::DockableAreaInterface)
+public:
+ explicit DockableArea(QWidget *parent = nullptr);
+ ~DockableArea() override = default;
+
+ void addDockWrapper(DockWrapperInterface *wrapper) override;
+ void setAllDockWrappers(const QList &wrappers) override;
+
+private:
+ void init();
+};
+} // namespace scopy::classic
+
+#endif // DOCKABLEAREACLASSIC_H
diff --git a/gui/include/gui/docking/dockableareainterface.h b/gui/include/gui/docking/dockableareainterface.h
new file mode 100644
index 0000000000..6bd4a17afa
--- /dev/null
+++ b/gui/include/gui/docking/dockableareainterface.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2024 Analog Devices Inc.
+ *
+ * This file is part of Scopy
+ * (see https://www.github.com/analogdevicesinc/scopy).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef DOCKABLEAREAINTERFACE_H
+#define DOCKABLEAREAINTERFACE_H
+
+#include "docking/dockwrapperinterface.h"
+#include "scopy-gui_export.h"
+#include
+
+namespace scopy {
+class SCOPY_GUI_EXPORT DockableAreaInterface
+{
+public:
+ virtual ~DockableAreaInterface() = default;
+ virtual void addDockWrapper(DockWrapperInterface *wrapper) = 0;
+ virtual void setAllDockWrappers(const QList &wrappers) = 0;
+};
+} // namespace scopy
+
+Q_DECLARE_INTERFACE(scopy::DockableAreaInterface, "scopy::DockableAreaInterface")
+#endif // DOCKABLEAREAINTERFACE_H
diff --git a/gui/include/gui/docking/dockableareakdab.h b/gui/include/gui/docking/dockableareakdab.h
new file mode 100644
index 0000000000..1f71dac636
--- /dev/null
+++ b/gui/include/gui/docking/dockableareakdab.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2024 Analog Devices Inc.
+ *
+ * This file is part of Scopy
+ * (see https://www.github.com/analogdevicesinc/scopy).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef DOCKABLEAREAKDAB_H
+#define DOCKABLEAREAKDAB_H
+
+#include "scopy-gui_export.h"
+#include
+#include
+#include "docking/dockableareainterface.h"
+#include "docking/dockwrapperinterface.h"
+#include
+
+namespace scopy::kdab {
+class SCOPY_GUI_EXPORT DockableArea : public KDDockWidgets::QtWidgets::MainWindow, public DockableAreaInterface
+{
+ Q_OBJECT
+public:
+ explicit DockableArea(QWidget *parent = nullptr);
+ ~DockableArea() override = default;
+
+ // Does not set affinities
+ void addDockWrapper(DockWrapperInterface *wrapper) override;
+
+ // Preffered as it also sets affinities
+ void setAllDockWrappers(const QList &wrappers) override;
+
+private:
+ static int s_dockableAreaId;
+};
+} // namespace scopy::kdab
+#endif // DOCKABLEAREAKDAB_H
diff --git a/gui/include/gui/docking/docksettings.h b/gui/include/gui/docking/docksettings.h
new file mode 100644
index 0000000000..a559f51b3d
--- /dev/null
+++ b/gui/include/gui/docking/docksettings.h
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2024 Analog Devices Inc.
+ *
+ * This file is part of Scopy
+ * (see https://www.github.com/analogdevicesinc/scopy).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef DOCKSETTINGS_H
+#define DOCKSETTINGS_H
+
+#ifndef USE_KDDOCKWIDGETS
+namespace scopy {
+static void initDockWidgets() {}
+} // namespace scopy
+#else
+#include "scopy-gui_export.h"
+#include "style.h"
+#include "style_attributes.h"
+
+#include
+#include
+#include
+#include
+
+namespace scopy {
+// All of this just to hide a button
+class SCOPY_GUI_EXPORT NoCloseTitleBar : public KDDockWidgets::QtWidgets::TitleBar
+{
+public:
+ explicit NoCloseTitleBar(KDDockWidgets::Core::TitleBar *controller, KDDockWidgets::Core::View *parent = nullptr)
+ : KDDockWidgets::QtWidgets::TitleBar(controller, parent)
+ , m_controller(controller)
+ {
+ Style::setBackgroundColor(this, json::theme::background_subtle, true);
+ }
+
+ void init() override
+ {
+ m_controller->setHideDisabledButtons(KDDockWidgets::TitleBarButtonType::Close);
+ KDDockWidgets::QtWidgets::TitleBar::init();
+ }
+
+private:
+ KDDockWidgets::Core::TitleBar *const m_controller;
+};
+
+class SCOPY_GUI_EXPORT TitleBarFactory : public KDDockWidgets::QtWidgets::ViewFactory
+{
+ Q_OBJECT
+public:
+ KDDockWidgets::Core::View *createTitleBar(KDDockWidgets::Core::TitleBar *controller,
+ KDDockWidgets::Core::View *parent) const override
+ {
+ return new NoCloseTitleBar(controller, parent);
+ }
+};
+
+// Mark as static or inline to avoid ODR violation, this should only be used once in main.cpp anyway
+static void initDockWidgets()
+{
+ KDDockWidgets::initFrontend(KDDockWidgets::FrontendType::QtWidgets);
+ KDDockWidgets::Config::self().setViewFactory(new TitleBarFactory());
+}
+} // namespace scopy
+
+#endif // USE_KDDOCKWIDGETS
+#endif // DOCKSETTINGS_H
diff --git a/gui/include/gui/docking/dockwrapper.h b/gui/include/gui/docking/dockwrapper.h
new file mode 100644
index 0000000000..ff99d05dd7
--- /dev/null
+++ b/gui/include/gui/docking/dockwrapper.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2024 Analog Devices Inc.
+ *
+ * This file is part of Scopy
+ * (see https://www.github.com/analogdevicesinc/scopy).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef DOCKWRAPPER_H
+#define DOCKWRAPPER_H
+
+#ifdef USE_KDDOCKWIDGETS
+#include "docking/dockwrapperkdab.h"
+using DockWrapper = scopy::kdab::DockWrapper;
+#else
+#include "docking/dockwrapperclassic.h"
+using DockWrapper = scopy::classic::DockWrapper;
+#endif // USE_KDDOCKWIDGETS
+#endif // DOCKWRAPPER_H
diff --git a/gui/include/gui/docking/dockwrapperclassic.h b/gui/include/gui/docking/dockwrapperclassic.h
new file mode 100644
index 0000000000..8443d9609a
--- /dev/null
+++ b/gui/include/gui/docking/dockwrapperclassic.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2024 Analog Devices Inc.
+ *
+ * This file is part of Scopy
+ * (see https://www.github.com/analogdevicesinc/scopy).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef DOCKWRAPPERCLASSIC_H
+#define DOCKWRAPPERCLASSIC_H
+
+#include "scopy-gui_export.h"
+#include
+#include "docking/dockwrapperinterface.h"
+
+namespace scopy::classic {
+class SCOPY_GUI_EXPORT DockWrapper : public QWidget, public DockWrapperInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(scopy::DockWrapperInterface)
+public:
+ explicit DockWrapper(QString name, QWidget *parent = nullptr);
+
+ void setInnerWidget(QWidget *innerWidget) override;
+ QWidget *innerWidget() const override;
+
+ void setActivated(bool isActivated) override;
+
+private:
+ void init();
+ QWidget *m_innerWidget;
+};
+} // namespace scopy::classic
+
+#endif // DOCKWRAPPERCLASSIC_H
diff --git a/gui/include/gui/docking/dockwrapperinterface.h b/gui/include/gui/docking/dockwrapperinterface.h
new file mode 100644
index 0000000000..a7d3e5856e
--- /dev/null
+++ b/gui/include/gui/docking/dockwrapperinterface.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2024 Analog Devices Inc.
+ *
+ * This file is part of Scopy
+ * (see https://www.github.com/analogdevicesinc/scopy).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef DOCKWRAPPERINTERFACE_H
+#define DOCKWRAPPERINTERFACE_H
+
+#include "scopy-gui_export.h"
+#include
+
+namespace scopy {
+class SCOPY_GUI_EXPORT DockWrapperInterface
+{
+public:
+ virtual void setInnerWidget(QWidget *) = 0;
+ virtual QWidget *innerWidget() const = 0;
+
+ virtual void setActivated(bool) = 0;
+
+protected:
+ DockWrapperInterface() = default;
+};
+} // namespace scopy
+
+Q_DECLARE_INTERFACE(scopy::DockWrapperInterface, "scopy::DockWrapperInterface")
+#endif // DOCKWRAPPERINTERFACE_H
diff --git a/gui/include/gui/docking/dockwrapperkdab.h b/gui/include/gui/docking/dockwrapperkdab.h
new file mode 100644
index 0000000000..14c83d6490
--- /dev/null
+++ b/gui/include/gui/docking/dockwrapperkdab.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2024 Analog Devices Inc.
+ *
+ * This file is part of Scopy
+ * (see https://www.github.com/analogdevicesinc/scopy).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef DOCKWRAPPERKDAB_H
+#define DOCKWRAPPERKDAB_H
+
+#include "scopy-gui_export.h"
+#include
+#include "docking/dockwrapperinterface.h"
+#include
+
+namespace scopy::kdab {
+class SCOPY_GUI_EXPORT DockWrapper : public KDDockWidgets::QtWidgets::DockWidget, public DockWrapperInterface
+{
+ Q_OBJECT
+public:
+ explicit DockWrapper(QString name, QWidget *parent = nullptr);
+
+ void setInnerWidget(QWidget *innerWidget) override;
+ QWidget *innerWidget() const override;
+ void setActivated(bool isActive) override;
+
+private:
+ static int s_dockWrapperId;
+ bool m_isActive;
+ QWidget *m_innerWidget;
+};
+} // namespace scopy::kdab
+
+#endif // DOCKWRAPPERKDAB_H
diff --git a/gui/src/docking/dockableareaclassic.cpp b/gui/src/docking/dockableareaclassic.cpp
new file mode 100644
index 0000000000..67fb551e90
--- /dev/null
+++ b/gui/src/docking/dockableareaclassic.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2024 Analog Devices Inc.
+ *
+ * This file is part of Scopy
+ * (see https://www.github.com/analogdevicesinc/scopy).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "docking/dockableareaclassic.h"
+#include
+#include
+
+using namespace scopy::classic;
+
+DockableArea::DockableArea(QWidget *parent)
+ : QWidget(parent)
+{
+ init();
+}
+
+void DockableArea::addDockWrapper(DockWrapperInterface *dockWrapper)
+{
+ QWidget *dockWrapperWidget = dynamic_cast(dockWrapper);
+ if(dockWrapperWidget) {
+ layout()->addWidget(dockWrapperWidget);
+ } else {
+ qWarning() << "Cannot cast dockWrapperInterface to QWidget*";
+ }
+}
+
+void DockableArea::setAllDockWrappers(const QList &wrappers)
+{
+ for(DockWrapperInterface *dockWrapper : wrappers) {
+ addDockWrapper(dockWrapper);
+ }
+}
+
+void DockableArea::init()
+{
+ setLayout(new QHBoxLayout(this));
+ layout()->setContentsMargins(0, 0, 0, 0);
+}
diff --git a/gui/src/docking/dockableareakdab.cpp b/gui/src/docking/dockableareakdab.cpp
new file mode 100644
index 0000000000..2734fcf2b0
--- /dev/null
+++ b/gui/src/docking/dockableareakdab.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2024 Analog Devices Inc.
+ *
+ * This file is part of Scopy
+ * (see https://www.github.com/analogdevicesinc/scopy).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "docking/dockableareakdab.h"
+#include "docking/dockwrapperinterface.h"
+
+#include
+#include
+#include
+
+using namespace scopy::kdab;
+
+int DockableArea::s_dockableAreaId{0};
+
+DockableArea::DockableArea(QWidget *parent)
+ : KDDockWidgets::QtWidgets::MainWindow("DockableArea" + QString::number(s_dockableAreaId++))
+{
+ setAffinities({uniqueName()});
+}
+
+void DockableArea::addDockWrapper(DockWrapperInterface *dockWrapper)
+{
+ KDDockWidgets::QtWidgets::DockWidget *dockWrapperWidget =
+ dynamic_cast(dockWrapper);
+ if(dockWrapperWidget) {
+ addDockWidget(dockWrapperWidget, KDDockWidgets::Location_OnRight);
+ } else {
+ qWarning() << "Cannot cast dockWrapperInterface to DockWidget";
+ }
+}
+
+void DockableArea::setAllDockWrappers(const QList &wrappers)
+{
+ QString affinitiesName = uniqueName(); // Set this uname as affinity to all DockWidgets
+ for(DockWrapperInterface *dockWrapper : wrappers) {
+ KDDockWidgets::QtWidgets::DockWidget *dockWrapperWidget =
+ dynamic_cast(dockWrapper);
+ if(dockWrapperWidget) {
+ dockWrapperWidget->setAffinities({affinitiesName});
+ addDockWidget(dockWrapperWidget, KDDockWidgets::Location_OnRight);
+ } else {
+ qWarning() << "Cannot cast dockWrapperInterface to DockWidget";
+ }
+ }
+}
diff --git a/gui/src/docking/dockwrapperclassic.cpp b/gui/src/docking/dockwrapperclassic.cpp
new file mode 100644
index 0000000000..569627899e
--- /dev/null
+++ b/gui/src/docking/dockwrapperclassic.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2024 Analog Devices Inc.
+ *
+ * This file is part of Scopy
+ * (see https://www.github.com/analogdevicesinc/scopy).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "docking/dockwrapperclassic.h"
+#include
+
+using namespace scopy::classic;
+
+DockWrapper::DockWrapper(QString name, QWidget *parent)
+ : QWidget(parent)
+{
+ init();
+}
+
+void DockWrapper::setInnerWidget(QWidget *innerWidget)
+{
+ m_innerWidget = innerWidget;
+ layout()->addWidget(m_innerWidget);
+}
+
+QWidget *DockWrapper::innerWidget() const { return m_innerWidget; }
+
+void DockWrapper::init()
+{
+ setLayout(new QHBoxLayout(this));
+ layout()->setContentsMargins(0, 0, 0, 0);
+}
+
+void DockWrapper::setActivated(bool isActivated) { setVisible(isActivated); }
diff --git a/gui/src/docking/dockwrapperkdab.cpp b/gui/src/docking/dockwrapperkdab.cpp
new file mode 100644
index 0000000000..69f9922be8
--- /dev/null
+++ b/gui/src/docking/dockwrapperkdab.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2024 Analog Devices Inc.
+ *
+ * This file is part of Scopy
+ * (see https://www.github.com/analogdevicesinc/scopy).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "docking/dockwrapperkdab.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace scopy::kdab;
+
+int DockWrapper::s_dockWrapperId{0};
+
+DockWrapper::DockWrapper(QString name, QWidget *parent)
+ : KDDockWidgets::QtWidgets::DockWidget(name + QString::number(s_dockWrapperId++),
+ KDDockWidgets::DockWidgetOption_NotClosable)
+{
+ this->setTitle(name); // Not unique name
+ // HACKISH: This connect is required as the DockWrapper cannot be closed (hidden) until it is
+ // added to a layout (and gets a parent). So any call to setActivated has not effect. This is
+ // just to propagate the effect set before the layouting.
+ m_isActive = true;
+ connect(this, &DockWrapper::isFloatingChanged, this, [this]() { setActivated(m_isActive); });
+}
+
+void DockWrapper::setInnerWidget(QWidget *innerWidget)
+{
+ m_innerWidget = innerWidget;
+ KDDockWidgets::QtWidgets::DockWidget::setWidget(m_innerWidget);
+}
+
+QWidget *DockWrapper::innerWidget() const { return m_innerWidget; }
+
+void DockWrapper::setActivated(bool isActivated)
+{
+ m_isActive = isActivated;
+ if(isActivated) {
+ KDDockWidgets::QtWidgets::DockWidget::open();
+ KDDockWidgets::Core::MainWindow *mainWindow = asDockWidgetController()->mainWindow();
+ if(mainWindow) {
+ mainWindow->layoutEqually();
+ }
+ } else {
+ KDDockWidgets::QtWidgets::DockWidget::close();
+ }
+}
diff --git a/main.cpp b/main.cpp
index 0f71d5959c..76393d1bfc 100644
--- a/main.cpp
+++ b/main.cpp
@@ -29,8 +29,9 @@
#include
#include
#include
-#include
#include
+#include
+#include
using namespace scopy;
@@ -126,7 +127,7 @@ int main(int argc, char *argv[])
printRuntimeEnvironmentInfo();
ApplicationRestarter restarter(QString::fromLocal8Bit(argv[0]));
a.setWindowIcon(QIcon(":/gui/icon.ico"));
-
+ scopy::initDockWidgets();
ScopyMainWindow w;
w.show();