Skip to content

Commit

Permalink
refactor: Remove attach to sim feature
Browse files Browse the repository at this point in the history
This feature is not documented and not implemented for new simulators
  • Loading branch information
ltoenning committed Dec 23, 2024
1 parent 3c896f2 commit a866b7e
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 201 deletions.
2 changes: 0 additions & 2 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

add_library(gui SHARED
showhidebar.cpp
foreignwindows.h
dockwidget.cpp
labelandicon.cpp
altitudeedit.cpp
Expand Down Expand Up @@ -794,7 +793,6 @@ add_library(gui SHARED
elidedpushbutton.h
enableforframelesswindow.cpp
overlaymessages.cpp
foreignwindows.cpp
stylesheetutility.cpp
dropbase.h
eventfilter.cpp
Expand Down
1 change: 0 additions & 1 deletion src/gui/enableforframelesswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <QWidget>
#include <QtGlobal>

#include "gui/foreignwindows.h"
#include "gui/guiutility.h"
#include "misc/icons.h"
#include "misc/stringutils.h"
Expand Down
106 changes: 0 additions & 106 deletions src/gui/foreignwindows.cpp

This file was deleted.

57 changes: 0 additions & 57 deletions src/gui/foreignwindows.h

This file was deleted.

6 changes: 0 additions & 6 deletions src/swiftguistandard/swiftguistd.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,6 @@ class SwiftGuiStd :
//! Menu item clicked
void onMenuClicked();

//! Attach the simulator window
void attachSimulatorWindow();

//! Detach simulator window
void detachSimulatorWindow();

//! Kicked from network
void onKickedFromNetwork(const QString &kickMessage);

Expand Down
30 changes: 1 addition & 29 deletions src/swiftguistandard/swiftguistdmenus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "gui/components/maininfoareacomponent.h"
#include "gui/components/settingscomponent.h"
#include "gui/copyxswiftbusdialog.h"
#include "gui/foreignwindows.h"
#include "gui/guiactionbind.h"
#include "gui/guiapplication.h"
#include "misc/aviation/altitude.h"
Expand Down Expand Up @@ -86,26 +85,6 @@ void SwiftGuiStd::onMenuClicked()
}
}

void SwiftGuiStd::attachSimulatorWindow()
{
this->activateWindow(); // attaching requires active window
QWindow *w = CForeignWindows::getFirstFoundSimulatorWindow();
if (!w)
{
CLogMessage(this).warning(u"No simulator window found");
return;
}
const bool a = CForeignWindows::setSimulatorAsParent(w, this);
if (a) { CLogMessage(this).info(u"Attached to simulator"); }
else { CLogMessage(this).warning(u"No simulator window found"); }
}

void SwiftGuiStd::detachSimulatorWindow()
{
if (CForeignWindows::unsetSimulatorAsParent(this)) { CLogMessage(this).info(u"Detached simulator window"); }
else { CLogMessage(this).info(u"No simulator window to detach"); }
}

void SwiftGuiStd::initMenus()
{
Q_ASSERT_X(ui->menu_InfoAreas, Q_FUNC_INFO, "No menu");
Expand All @@ -114,13 +93,6 @@ void SwiftGuiStd::initMenus()
sGui->addMenuFile(*ui->menu_File);
sGui->addMenuInternals(*ui->menu_Internals);
sGui->addMenuWindow(*ui->menu_Window);
ui->menu_Window->addSeparator();
QAction *a = ui->menu_Window->addAction("Attach simulator window");
bool c = connect(a, &QAction::triggered, this, &SwiftGuiStd::attachSimulatorWindow);
Q_ASSERT_X(c, Q_FUNC_INFO, "connect failed");
a = ui->menu_Window->addAction("Detach simulator window");
c = connect(a, &QAction::triggered, this, &SwiftGuiStd::detachSimulatorWindow);
Q_ASSERT_X(c, Q_FUNC_INFO, "connect failed");

sGui->addMenuHelp(*ui->menu_Help);
ui->menu_InfoAreas->addActions(ui->comp_MainInfoArea->getInfoAreaSelectActions(true, ui->menu_InfoAreas));
Expand All @@ -130,7 +102,7 @@ void SwiftGuiStd::initMenus()
QAction *act = new QAction(CIcons::swift16(), "Copy xswiftbus dialog");
ui->menu_File->insertAction(ui->menu_File->actions().at(5), act);
// clang-format off
c = connect(act, &QAction::triggered, this,
bool c = connect(act, &QAction::triggered, this,
[=] { this->copyXSwiftBusDialog(false); }, Qt::QueuedConnection);
// clang-format on
Q_ASSERT_X(c, Q_FUNC_INFO, "connect failed");
Expand Down

0 comments on commit a866b7e

Please sign in to comment.