Rename some methods from FrameworkWidget to View
This commit is contained in:
@@ -36,13 +36,13 @@ class Config::Private
|
||||
{
|
||||
public:
|
||||
Private()
|
||||
: m_frameworkWidgetFactory(Platform::instance()->createDefaultFrameworkWidgetFactory())
|
||||
: m_viewFactory(Platform::instance()->createDefaultViewFactory())
|
||||
{
|
||||
}
|
||||
|
||||
~Private()
|
||||
{
|
||||
delete m_frameworkWidgetFactory;
|
||||
delete m_viewFactory;
|
||||
}
|
||||
|
||||
void fixFlags();
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
MainWindowFactoryFunc m_mainWindowFactoryFunc = nullptr;
|
||||
TabbingAllowedFunc m_tabbingAllowedFunc = nullptr;
|
||||
DropIndicatorAllowedFunc m_dropIndicatorAllowedFunc = nullptr;
|
||||
ViewFactory *m_frameworkWidgetFactory = nullptr;
|
||||
ViewFactory *m_viewFactory = nullptr;
|
||||
Flags m_flags = Flag_Default;
|
||||
InternalFlags m_internalFlags = InternalFlag_None;
|
||||
CustomizableWidgets m_disabledPaintEvents = CustomizableWidget_None;
|
||||
@@ -67,7 +67,7 @@ Config::Config()
|
||||
|
||||
// stuff in multisplitter/ can't include the framework widget factory, so set it here
|
||||
auto separatorCreator = [](Controllers::Separator *controller, View *parent) {
|
||||
return Config::self().frameworkWidgetFactory()->createSeparator(controller, parent);
|
||||
return Config::self().viewFactory()->createSeparator(controller, parent);
|
||||
};
|
||||
|
||||
Layouting::Config::self().setSeparatorFactoryFunc(separatorCreator);
|
||||
@@ -127,16 +127,16 @@ MainWindowFactoryFunc Config::mainWindowFactoryFunc() const
|
||||
return d->m_mainWindowFactoryFunc;
|
||||
}
|
||||
|
||||
void Config::setFrameworkWidgetFactory(ViewFactory *wf)
|
||||
void Config::setViewFactory(ViewFactory *wf)
|
||||
{
|
||||
Q_ASSERT(wf);
|
||||
delete d->m_frameworkWidgetFactory;
|
||||
d->m_frameworkWidgetFactory = wf;
|
||||
delete d->m_viewFactory;
|
||||
d->m_viewFactory = wf;
|
||||
}
|
||||
|
||||
ViewFactory *Config::frameworkWidgetFactory() const
|
||||
ViewFactory *Config::viewFactory() const
|
||||
{
|
||||
return d->m_frameworkWidgetFactory;
|
||||
return d->m_viewFactory;
|
||||
}
|
||||
|
||||
int Config::separatorThickness() const
|
||||
|
||||
@@ -185,10 +185,10 @@ public:
|
||||
* Also potentially useful to return QtQuick classes instead of the QtWidget based ones.
|
||||
* Ownership is taken.
|
||||
*/
|
||||
void setFrameworkWidgetFactory(ViewFactory *);
|
||||
void setViewFactory(ViewFactory *);
|
||||
|
||||
///@brief getter for the framework widget factory
|
||||
ViewFactory *frameworkWidgetFactory() const;
|
||||
ViewFactory *viewFactory() const;
|
||||
|
||||
/**
|
||||
* @brief Returns the thickness of the separator.
|
||||
|
||||
@@ -79,7 +79,7 @@ void Platform::tests_initPlatform(int &argc, char **argv, KDDockWidgets::Fronten
|
||||
Platform::instance()->tests_initPlatform_impl();
|
||||
|
||||
/// Reset the default framework factory, so we can test several frontends in the same test run
|
||||
Config::self().setFrameworkWidgetFactory(Platform::instance()->createDefaultFrameworkWidgetFactory());
|
||||
Config::self().setViewFactory(Platform::instance()->createDefaultViewFactory());
|
||||
}
|
||||
|
||||
/*static */
|
||||
|
||||
@@ -64,8 +64,8 @@ public:
|
||||
/// @brief Returns all windows
|
||||
virtual QVector<std::shared_ptr<Window>> windows() const = 0;
|
||||
|
||||
/// @brief Creates and returns the default FrameworkWidgetFactory
|
||||
virtual ViewFactory *createDefaultFrameworkWidgetFactory() = 0;
|
||||
/// @brief Creates and returns the default ViewFactory
|
||||
virtual ViewFactory *createDefaultViewFactory() = 0;
|
||||
|
||||
/// @brief Returns the window at the specified global coordinates
|
||||
virtual std::shared_ptr<Window> windowAt(QPoint globalPos) const = 0;
|
||||
|
||||
@@ -46,7 +46,7 @@ using namespace KDDockWidgets::Controllers;
|
||||
|
||||
DockWidget::DockWidget(const QString &name, Options options,
|
||||
LayoutSaverOptions layoutSaverOptions)
|
||||
: Controller(Type::DockWidget, Config::self().frameworkWidgetFactory()->createDockWidget(this, Qt::Tool))
|
||||
: Controller(Type::DockWidget, Config::self().viewFactory()->createDockWidget(this, Qt::Tool))
|
||||
, d(new Private(name, options, layoutSaverOptions, this))
|
||||
{
|
||||
d->init();
|
||||
|
||||
@@ -59,7 +59,7 @@ static Controllers::DropIndicatorOverlay *createDropIndicatorOverlay(Controllers
|
||||
}
|
||||
|
||||
DropArea::DropArea(View *parent, MainWindowOptions options, bool isMDIWrapper)
|
||||
: Layout(Type::DropArea, Config::self().frameworkWidgetFactory()->createDropArea(this, parent))
|
||||
: Layout(Type::DropArea, Config::self().viewFactory()->createDropArea(this, parent))
|
||||
, m_isMDIWrapper(isMDIWrapper)
|
||||
, m_dropIndicatorOverlay(createDropIndicatorOverlay(this))
|
||||
, m_centralFrame(createCentralFrame(options))
|
||||
|
||||
@@ -97,7 +97,7 @@ MainWindow *actualParent(MainWindow *candidate)
|
||||
}
|
||||
|
||||
FloatingWindow::FloatingWindow(QRect suggestedGeometry, MainWindow *parent)
|
||||
: Controller(Type::FloatingWindow, Config::self().frameworkWidgetFactory()->createFloatingWindow(this, actualParent(parent), windowFlagsToUse()))
|
||||
: Controller(Type::FloatingWindow, Config::self().viewFactory()->createFloatingWindow(this, actualParent(parent), windowFlagsToUse()))
|
||||
, Draggable(view(), KDDockWidgets::usesNativeDraggingAndResizing()) // FloatingWindow is only draggable when using a native title bar. Otherwise the KDDockWidgets::TitleBar is the draggable
|
||||
, m_dropArea(new DropArea(view(), MainWindowOption_None))
|
||||
, m_titleBar(new Controllers::TitleBar(this))
|
||||
|
||||
@@ -68,7 +68,7 @@ static StackOptions tabWidgetOptions(FrameOptions options)
|
||||
}
|
||||
|
||||
Frame::Frame(View *parent, FrameOptions options, int userType)
|
||||
: Controller(Type::Frame, Config::self().frameworkWidgetFactory()->createFrame(this, parent))
|
||||
: Controller(Type::Frame, Config::self().viewFactory()->createFrame(this, parent))
|
||||
, FocusScope(view())
|
||||
, m_tabWidget(new Controllers::Stack(this, tabWidgetOptions(options)))
|
||||
, m_titleBar(new Controllers::TitleBar(this))
|
||||
|
||||
@@ -20,7 +20,7 @@ using namespace KDDockWidgets;
|
||||
using namespace KDDockWidgets::Controllers;
|
||||
|
||||
MDILayout::MDILayout(View *parent)
|
||||
: Layout(Type::MDILayout, Config::self().frameworkWidgetFactory()->createMDILayout(this, parent))
|
||||
: Layout(Type::MDILayout, Config::self().viewFactory()->createMDILayout(this, parent))
|
||||
, m_rootItem(new Layouting::ItemFreeContainer(view()))
|
||||
{
|
||||
setRootItem(m_rootItem);
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
|
||||
MainWindow::MainWindow(const QString &uniqueName, KDDockWidgets::MainWindowOptions options,
|
||||
View *parent, Qt::WindowFlags flags)
|
||||
: Controller(Type::MainWindow, Config::self().frameworkWidgetFactory()->createMainWindow(this, parent, flags))
|
||||
: Controller(Type::MainWindow, Config::self().viewFactory()->createMainWindow(this, parent, flags))
|
||||
, d(new Private(this, uniqueName, options))
|
||||
{
|
||||
init(uniqueName, true);
|
||||
|
||||
@@ -22,7 +22,7 @@ using namespace KDDockWidgets;
|
||||
using namespace KDDockWidgets::Controllers;
|
||||
|
||||
SideBar::SideBar(SideBarLocation location, MainWindow *parent)
|
||||
: Controller(Type::SideBar, Config::self().frameworkWidgetFactory()->createSideBar(this, parent))
|
||||
: Controller(Type::SideBar, Config::self().viewFactory()->createSideBar(this, parent))
|
||||
, m_mainWindow(parent)
|
||||
, m_location(location)
|
||||
, m_orientation((location == SideBarLocation::North || location == SideBarLocation::South) ? Qt::Horizontal
|
||||
|
||||
@@ -28,7 +28,7 @@ using namespace KDDockWidgets;
|
||||
using namespace KDDockWidgets::Controllers;
|
||||
|
||||
Stack::Stack(Frame *frame, StackOptions options)
|
||||
: Controller(Type::Stack, Config::self().frameworkWidgetFactory()->createTabWidget(this, frame))
|
||||
: Controller(Type::Stack, Config::self().viewFactory()->createTabWidget(this, frame))
|
||||
, Draggable(view(), Config::self().flags() & (Config::Flag_HideTitleBarWhenTabsVisible | Config::Flag_AlwaysShowTabs))
|
||||
, m_tabBar(new TabBar(this))
|
||||
, m_frame(frame)
|
||||
|
||||
@@ -26,7 +26,7 @@ using namespace KDDockWidgets;
|
||||
using namespace KDDockWidgets::Controllers;
|
||||
|
||||
Controllers::TabBar::TabBar(Stack *tabWidget)
|
||||
: Controller(Type::TabBar, Config::self().frameworkWidgetFactory()->createTabBar(this, tabWidget->view()))
|
||||
: Controller(Type::TabBar, Config::self().viewFactory()->createTabBar(this, tabWidget->view()))
|
||||
, Draggable(view())
|
||||
, m_tabWidget(tabWidget)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ using namespace KDDockWidgets::Controllers;
|
||||
|
||||
|
||||
TitleBar::TitleBar(Frame *parent)
|
||||
: Controller(Type::TitleBar, Config::self().frameworkWidgetFactory()->createTitleBar(this, parent))
|
||||
: Controller(Type::TitleBar, Config::self().viewFactory()->createTitleBar(this, parent))
|
||||
, Draggable(view())
|
||||
, m_frame(parent)
|
||||
, m_floatingWindow(nullptr)
|
||||
@@ -45,7 +45,7 @@ TitleBar::TitleBar(Frame *parent)
|
||||
}
|
||||
|
||||
TitleBar::TitleBar(FloatingWindow *parent)
|
||||
: Controller(Type::TitleBar, Config::self().frameworkWidgetFactory()->createTitleBar(this, parent))
|
||||
: Controller(Type::TitleBar, Config::self().viewFactory()->createTitleBar(this, parent))
|
||||
, Draggable(view())
|
||||
, m_frame(nullptr)
|
||||
, m_floatingWindow(parent)
|
||||
|
||||
@@ -35,7 +35,7 @@ static IndicatorWindow_qtwidgets *createIndicatorWindow(ClassicIndicators *class
|
||||
|
||||
ClassicIndicators::ClassicIndicators(Controllers::DropArea *dropArea)
|
||||
: DropIndicatorOverlay(dropArea) // Is parented on the drop-area, not a toplevel.
|
||||
, m_rubberBand(Config::self().frameworkWidgetFactory()->createRubberBand(rubberBandIsTopLevel() ? nullptr : dropArea->view()))
|
||||
, m_rubberBand(Config::self().viewFactory()->createRubberBand(rubberBandIsTopLevel() ? nullptr : dropArea->view()))
|
||||
, m_indicatorWindow(createIndicatorWindow(this))
|
||||
{
|
||||
if (rubberBandIsTopLevel())
|
||||
|
||||
@@ -74,7 +74,7 @@ std::shared_ptr<Window> Platform_qtquick::windowFromQWindow(QWindow *qwindow) co
|
||||
return std::shared_ptr<Window>(new Window_qtquick(qwindow));
|
||||
}
|
||||
|
||||
ViewFactory *Platform_qtquick::createDefaultFrameworkWidgetFactory()
|
||||
ViewFactory *Platform_qtquick::createDefaultViewFactory()
|
||||
{
|
||||
return new ViewFactory_qtquick();
|
||||
}
|
||||
@@ -137,12 +137,12 @@ void Platform_qtquick::setQmlEngine(QQmlEngine *qmlEngine)
|
||||
context->setContextProperty(QStringLiteral("_kddwHelpers"), &m_qquickHelpers);
|
||||
context->setContextProperty(QStringLiteral("_kddwDockRegistry"), dr);
|
||||
context->setContextProperty(QStringLiteral("_kddwDragController"), DragController::instance());
|
||||
context->setContextProperty(QStringLiteral("_kddw_widgetFactory"), Config::self().frameworkWidgetFactory());
|
||||
context->setContextProperty(QStringLiteral("_kddw_widgetFactory"), Config::self().viewFactory());
|
||||
}
|
||||
|
||||
ViewFactory_qtquick *Platform_qtquick::frameworkWidgetFactory() const
|
||||
ViewFactory_qtquick *Platform_qtquick::viewFactory() const
|
||||
{
|
||||
return static_cast<ViewFactory_qtquick *>(Config::self().frameworkWidgetFactory());
|
||||
return static_cast<ViewFactory_qtquick *>(Config::self().viewFactory());
|
||||
}
|
||||
|
||||
View *Platform_qtquick::createView(View *parent) const
|
||||
|
||||
@@ -31,8 +31,8 @@ public:
|
||||
const char *name() const override;
|
||||
std::shared_ptr<ViewWrapper> qobjectAsView(QObject *) const override;
|
||||
std::shared_ptr<Window> windowFromQWindow(QWindow *) const override;
|
||||
ViewFactory *createDefaultFrameworkWidgetFactory() override;
|
||||
ViewFactory_qtquick *frameworkWidgetFactory() const;
|
||||
ViewFactory *createDefaultViewFactory() override;
|
||||
ViewFactory_qtquick *viewFactory() const;
|
||||
Window::Ptr windowAt(QPoint globalPos) const override;
|
||||
using Platform_qt::screenNumberFor;
|
||||
int screenNumberFor(View *) const override;
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
: q(view)
|
||||
, dockWidget(controller)
|
||||
, m_visualItem(q->createItem(qmlengine,
|
||||
plat()->frameworkWidgetFactory()->dockwidgetFilename().toString()))
|
||||
plat()->viewFactory()->dockwidgetFilename().toString()))
|
||||
, m_qmlEngine(qmlengine)
|
||||
{
|
||||
Q_ASSERT(m_visualItem);
|
||||
|
||||
@@ -197,7 +197,7 @@ void FloatingWindow_qtquick::init()
|
||||
m_controller->maybeCreateResizeHandler();
|
||||
|
||||
m_visualItem = createItem(m_quickWindow->engine(),
|
||||
plat()->frameworkWidgetFactory()->floatingWindowFilename().toString());
|
||||
plat()->viewFactory()->floatingWindowFilename().toString());
|
||||
Q_ASSERT(m_visualItem);
|
||||
|
||||
// Ensure our window size is never smaller than our min-size
|
||||
|
||||
@@ -58,7 +58,7 @@ Frame_qtquick::Frame_qtquick(Controllers::Frame *controller, QQuickItem *parent)
|
||||
});*/
|
||||
|
||||
QQmlComponent component(plat()->qmlEngine(),
|
||||
plat()->frameworkWidgetFactory()->frameFilename());
|
||||
plat()->viewFactory()->frameFilename());
|
||||
|
||||
m_visualItem = static_cast<QQuickItem *>(component.create());
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ std::shared_ptr<Window> Platform_qtwidgets::windowFromQWindow(QWindow *qwindow)
|
||||
return std::shared_ptr<Window>(new Window_qtwidgets(qwindow));
|
||||
}
|
||||
|
||||
ViewFactory *Platform_qtwidgets::createDefaultFrameworkWidgetFactory()
|
||||
ViewFactory *Platform_qtwidgets::createDefaultViewFactory()
|
||||
{
|
||||
return new ViewFactory_qtwidgets();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
bool hasActivePopup() const override;
|
||||
std::shared_ptr<ViewWrapper> qobjectAsView(QObject *) const override;
|
||||
std::shared_ptr<Window> windowFromQWindow(QWindow *) const override;
|
||||
ViewFactory *createDefaultFrameworkWidgetFactory() override;
|
||||
ViewFactory *createDefaultViewFactory() override;
|
||||
std::shared_ptr<Window> windowAt(QPoint globalPos) const override;
|
||||
|
||||
using Platform_qt::screenNumberFor;
|
||||
|
||||
@@ -155,7 +155,7 @@ void Stack_qtwidgets::setupTabBarButtons()
|
||||
return;
|
||||
|
||||
// TODOv2: Make sure people can only inherit from the Default*variants
|
||||
auto factory = static_cast<ViewFactory_qtwidgets *>(Config::self().frameworkWidgetFactory());
|
||||
auto factory = static_cast<ViewFactory_qtwidgets *>(Config::self().viewFactory());
|
||||
m_closeButton = factory->createTitleBarButton(this, TitleBarButtonType::Close);
|
||||
m_floatButton = factory->createTitleBarButton(this, TitleBarButtonType::Float);
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ void TitleBar_qtwidgets::init()
|
||||
m_layout->addStretch();
|
||||
updateMargins();
|
||||
|
||||
auto factory = static_cast<ViewFactory_qtwidgets *>(Config::self().frameworkWidgetFactory());
|
||||
auto factory = static_cast<ViewFactory_qtwidgets *>(Config::self().viewFactory());
|
||||
|
||||
m_maximizeButton = factory->createTitleBarButton(this, TitleBarButtonType::Maximize);
|
||||
m_minimizeButton = factory->createTitleBarButton(this, TitleBarButtonType::Minimize);
|
||||
@@ -196,7 +196,7 @@ void TitleBar_qtwidgets::updateMinimizeButton()
|
||||
void TitleBar_qtwidgets::updateAutoHideButton()
|
||||
{
|
||||
if (Config::self().flags() & Config::Flag_AutoHideSupport) {
|
||||
auto factory = Config::self().frameworkWidgetFactory();
|
||||
auto factory = Config::self().viewFactory();
|
||||
if (const Controllers::Frame *f = m_controller->frame()) {
|
||||
if (f->isInMainWindow()) {
|
||||
m_autoHideButton->setIcon(factory->iconForButtonType(TitleBarButtonType::AutoHide, devicePixelRatioF()));
|
||||
@@ -214,7 +214,7 @@ void TitleBar_qtwidgets::updateAutoHideButton()
|
||||
void TitleBar_qtwidgets::updateMaximizeButton()
|
||||
{
|
||||
if (auto fw = m_controller->floatingWindow()) {
|
||||
auto factory = Config::self().frameworkWidgetFactory();
|
||||
auto factory = Config::self().viewFactory();
|
||||
const TitleBarButtonType iconType = fw->isMaximizedOverride() ? TitleBarButtonType::Normal
|
||||
: TitleBarButtonType::Maximize;
|
||||
m_maximizeButton->setIcon(factory->iconForButtonType(iconType, devicePixelRatioF()));
|
||||
|
||||
@@ -61,7 +61,7 @@ public Q_SLOTS:
|
||||
s_testObject = this;
|
||||
|
||||
Layouting::Config::self().setSeparatorFactoryFunc([](Controllers::Separator *controller, View *parent) -> View * {
|
||||
return KDDockWidgets::Config::self().frameworkWidgetFactory()->createSeparator(controller, parent);
|
||||
return KDDockWidgets::Config::self().viewFactory()->createSeparator(controller, parent);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user