From 7bc410d990ce57e6db2a4f30a8198acc5dd51adc Mon Sep 17 00:00:00 2001 From: Lars Toenning Date: Mon, 24 Mar 2025 08:57:15 +0100 Subject: [PATCH] refactor: Remove unused window finder --- src/gui/CMakeLists.txt | 9 -------- src/gui/win/windowfinderwindows.cpp | 36 ----------------------------- src/gui/win/windowfinderwindows.h | 29 ----------------------- src/gui/windowfinder.cpp | 31 ------------------------- src/gui/windowfinder.h | 35 ---------------------------- 5 files changed, 140 deletions(-) delete mode 100644 src/gui/win/windowfinderwindows.cpp delete mode 100644 src/gui/win/windowfinderwindows.h delete mode 100644 src/gui/windowfinder.cpp delete mode 100644 src/gui/windowfinder.h diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index e87f05b33..d86ba0351 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -874,17 +874,8 @@ add_library(gui SHARED views/viewdbobjects.h views/viewtimestampobjects.cpp views/viewtimestampobjects.h - windowfinder.cpp - windowfinder.h ) -if(WIN32) - target_sources(gui PRIVATE - win/windowfinderwindows.cpp - win/windowfinderwindows.h - ) -endif() - # Copy resources add_custom_command(TARGET gui POST_BUILD diff --git a/src/gui/win/windowfinderwindows.cpp b/src/gui/win/windowfinderwindows.cpp deleted file mode 100644 index 94472c80a..000000000 --- a/src/gui/win/windowfinderwindows.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 - -#include "gui/win/windowfinderwindows.h" - -#include - -#include -#include - -namespace swift::gui -{ - QWindow *CWindowFinderWindows::findForeignWindow(const QString &windowName, const QString &className) - { - QScopedArrayPointer lpWindowName; - QScopedArrayPointer lpClassName; - - if (!windowName.isEmpty()) - { - lpWindowName.reset(new TCHAR[windowName.size() + 1]); - windowName.toWCharArray(lpWindowName.data()); - lpWindowName[windowName.size()] = 0; - } - if (!className.isEmpty()) - { - lpClassName.reset(new TCHAR[className.size() + 1]); - className.toWCharArray(lpClassName.data()); - lpClassName[className.size()] = 0; - } - - HWND hWindow = FindWindow(lpClassName.data(), lpWindowName.data()); - if (hWindow) { return QWindow::fromWinId(reinterpret_cast(hWindow)); } - - return nullptr; - } -} // namespace swift::gui diff --git a/src/gui/win/windowfinderwindows.h b/src/gui/win/windowfinderwindows.h deleted file mode 100644 index 450245a58..000000000 --- a/src/gui/win/windowfinderwindows.h +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 - -//! \file - -#ifndef SWIFT_GUI_WINDOWFINDERWINDOWS_H -#define SWIFT_GUI_WINDOWFINDERWINDOWS_H - -#include "gui/swiftguiexport.h" -#include "gui/windowfinder.h" - -namespace swift::gui -{ - //! Foreign windows - class SWIFT_GUI_EXPORT CWindowFinderWindows : public IWindowFinder - { - public: - //! Constructor - CWindowFinderWindows() {} - - //! Destructor - virtual ~CWindowFinderWindows() {} - - //! \copydoc IWindowFinder::findForeignWindow - virtual QWindow *findForeignWindow(const QString &windowName, const QString &className) override; - }; -} // namespace swift::gui - -#endif // SWIFT_GUI_WINDOWFINDERWINDOWS_H diff --git a/src/gui/windowfinder.cpp b/src/gui/windowfinder.cpp deleted file mode 100644 index 96b991867..000000000 --- a/src/gui/windowfinder.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 - -#include "gui/windowfinder.h" - -#include - -#if defined(Q_OS_WIN) -# include "win/windowfinderwindows.h" -#elif defined(Q_OS_LINUX) -#elif defined(Q_OS_MACOS) -#else -# error "Platform is not supported!" -#endif - -namespace swift::gui -{ - IWindowFinder *IWindowFinder::create() - { - -#if defined(Q_OS_WIN) - IWindowFinder *finder = new CWindowFinderWindows(); -#elif defined(Q_OS_LINUX) - IWindowFinder *finder = nullptr; -#elif defined(Q_OS_MACOS) - IWindowFinder *finder = nullptr; -#endif - - return finder; - } -} // namespace swift::gui diff --git a/src/gui/windowfinder.h b/src/gui/windowfinder.h deleted file mode 100644 index 40c115dcd..000000000 --- a/src/gui/windowfinder.h +++ /dev/null @@ -1,35 +0,0 @@ -// SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1 - -//! \file - -#ifndef SWIFT_GUI_WINDOWFINDER_H -#define SWIFT_GUI_WINDOWFINDER_H - -#include - -#include "gui/swiftguiexport.h" - -class QWindow; - -namespace swift::gui -{ - //! Finder for foreign windows - class SWIFT_GUI_EXPORT IWindowFinder - { - public: - //! Constructor - IWindowFinder() {} - - //! Destructor - virtual ~IWindowFinder() {} - - //! Find and return a foreign window owned by another process - virtual QWindow *findForeignWindow(const QString &windowName, const QString &className) = 0; - - //! Factory method - static IWindowFinder *create(); - }; -} // namespace swift::gui - -#endif // SWIFT_GUI_WINDOWFINDER_H