Skip to content

Commit

Permalink
gui/docking: Fix mingw compilation error
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei-Fabian-Pop <[email protected]>

squash later

Signed-off-by: Andrei-Fabian-Pop <[email protected]>
  • Loading branch information
Andrei-Fabian-Pop committed Jan 22, 2025
1 parent 0bfb1e7 commit f4a54ff
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 20 deletions.
25 changes: 5 additions & 20 deletions gui/include/gui/docking/docksettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ static void initDockWidgets() {}
} // namespace scopy
#else
#include "scopy-gui_export.h"
#include "style.h"
#include "style_attributes.h"

#include <kddockwidgets/KDDockWidgets.h>
#include <kddockwidgets/Config.h>
Expand All @@ -47,18 +45,9 @@ namespace scopy {
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();
}
explicit NoCloseTitleBar(KDDockWidgets::Core::TitleBar *controller,
KDDockWidgets::Core::View *parent = nullptr);
void init() override;

private:
KDDockWidgets::Core::TitleBar *const m_controller;
Expand All @@ -67,13 +56,9 @@ class SCOPY_GUI_EXPORT NoCloseTitleBar : public KDDockWidgets::QtWidgets::TitleB
class SCOPY_GUI_EXPORT TitleBarFactory : public KDDockWidgets::QtWidgets::ViewFactory
{
public:
TitleBarFactory() = default;

explicit TitleBarFactory();
KDDockWidgets::Core::View *createTitleBar(KDDockWidgets::Core::TitleBar *controller,
KDDockWidgets::Core::View *parent) const override
{
return new NoCloseTitleBar(controller, parent);
}
KDDockWidgets::Core::View *parent) const override;
};

// Mark as static or inline to avoid ODR violation, this should only be used once in main.cpp anyway
Expand Down
49 changes: 49 additions & 0 deletions gui/src/docking/docksettings.cpp
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/

#include "docking/docksettings.h"
#include "style.h"

using namespace scopy;

NoCloseTitleBar::NoCloseTitleBar(KDDockWidgets::Core::TitleBar *controller, KDDockWidgets::Core::View *parent)
: KDDockWidgets::QtWidgets::TitleBar(controller, parent)
, m_controller(controller)
{
Style::setBackgroundColor(this, json::theme::background_subtle, true);
}

void NoCloseTitleBar::init()
{
m_controller->setHideDisabledButtons(KDDockWidgets::TitleBarButtonType::Close);
KDDockWidgets::QtWidgets::TitleBar::init();
}

TitleBarFactory::TitleBarFactory()
: KDDockWidgets::QtWidgets::ViewFactory()
{
setObjectName("TitleBarFactory");
}

KDDockWidgets::Core::View *TitleBarFactory::createTitleBar(KDDockWidgets::Core::TitleBar *controller,
KDDockWidgets::Core::View *parent) const
{
return new NoCloseTitleBar(controller, parent);
}

0 comments on commit f4a54ff

Please sign in to comment.