mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-11 12:15:36 +08:00
refactor: Remove unused window finder
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 <windows.h>
|
||||
|
||||
#include <QScopedArrayPointer>
|
||||
#include <QWindow>
|
||||
|
||||
namespace swift::gui
|
||||
{
|
||||
QWindow *CWindowFinderWindows::findForeignWindow(const QString &windowName, const QString &className)
|
||||
{
|
||||
QScopedArrayPointer<TCHAR> lpWindowName;
|
||||
QScopedArrayPointer<TCHAR> 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<WId>(hWindow)); }
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
} // namespace swift::gui
|
||||
@@ -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
|
||||
@@ -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 <QtGlobal>
|
||||
|
||||
#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
|
||||
@@ -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 <QString>
|
||||
|
||||
#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
|
||||
Reference in New Issue
Block a user