Skip to content

UI refactoring #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions samples/miscdbus/servicetool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ namespace swift::sample
<< tsqv.userType() << Qt::endl;

// Aviation
const CComSystem comSystem =
CComSystem("DBUS COM1", CPhysicalQuantitiesConstants::FrequencyInternationalAirDistress(),
CPhysicalQuantitiesConstants::FrequencyUnicom());
const CComSystem comSystem = CComSystem("DBUS COM1", CPhysicalQuantitiesConstants::FrequencyUnicom(),
CPhysicalQuantitiesConstants::FrequencyUnicom());
testServiceInterface.receiveComUnit(comSystem);
qtout << "Send COM via interface " << comSystem << Qt::endl;

Expand Down
20 changes: 0 additions & 20 deletions src/gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,6 @@ add_library(gui SHARED
components/usercomponent.cpp
components/usercomponent.h
components/usercomponent.ui
copyxswiftbusdialog.cpp
copyxswiftbusdialog.h
dockwidget.cpp
dockwidget.h
dockwidgetinfoarea.cpp
Expand Down Expand Up @@ -568,8 +566,6 @@ add_library(gui SHARED
editors/validationindicator.cpp
editors/validationindicator.h
editors/validationindicator.ui
elidedpushbutton.cpp
elidedpushbutton.h
enablefordockwidgetinfoarea.cpp
enablefordockwidgetinfoarea.h
enableforframelesswindow.cpp
Expand Down Expand Up @@ -618,8 +614,6 @@ add_library(gui SHARED
guiapplication.h
guiutility.cpp
guiutility.h
horizontalcombobox.cpp
horizontalcombobox.h
infoarea.cpp
infoarea.h
labelandicon.cpp
Expand All @@ -633,9 +627,6 @@ add_library(gui SHARED
lineedithistory.h
loadindicator.cpp
loadindicator.h
loginmodebuttons.cpp
loginmodebuttons.h
loginmodebuttons.ui
mainwindowaccess.cpp
mainwindowaccess.h
managedstatusbar.cpp
Expand Down Expand Up @@ -779,8 +770,6 @@ add_library(gui SHARED
showhidebar.cpp
showhidebar.h
showhidebar.ui
singleapplicationui.cpp
singleapplicationui.h
splashscreen.cpp
splashscreen.h
stylesheetutility.cpp
Expand Down Expand Up @@ -874,17 +863,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
Expand Down
402 changes: 0 additions & 402 deletions src/gui/components/dbownmodelscomponent.cpp

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions src/gui/components/dbownmodelscomponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,6 @@ namespace swift::gui
virtual void customMenu(menus::CMenuActions &menuActions) override;

private:
QList<QAction *> m_loadActions; //!< load actions
QList<QAction *> m_reloadActions; //!< reload actions
QList<QAction *> m_clearCacheActions; //!< clear own models cahce if ever needed
QAction *m_csl2xsbAction = nullptr; //!< run csl2xsb script
};
};
Expand Down
6 changes: 0 additions & 6 deletions src/gui/components/flightplancomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,11 @@ namespace swift::gui::components
ui->le_SsrEquipment->setReadOnly(true);

CUpperCaseEventFilter *ef = new CUpperCaseEventFilter(ui->pte_Route);
ef->setOnlyAscii();
ui->pte_Route->installEventFilter(ef);
ef = new CUpperCaseEventFilter(ui->pte_Remarks);
ef->setOnlyAscii();
ui->pte_Remarks->installEventFilter(ef);
ef = new CUpperCaseEventFilter(ui->pte_AdditionalRemarks);
ef->setOnlyAscii();
ui->pte_AdditionalRemarks->installEventFilter(ef);
// readonly
// ef = new CUpperCaseEventFilter(ui->pte_RemarksGenerated);
// ui->pte_RemarksGenerated->installEventFilter(ef);

// connect
connect(ui->pb_Send, &QPushButton::pressed, this, &CFlightPlanComponent::sendFlightPlan, Qt::QueuedConnection);
Expand Down
6 changes: 1 addition & 5 deletions src/gui/components/hotkeydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace swift::gui::components

CHotkeyDialog::~CHotkeyDialog() {}

CKeySelectionBox::CKeySelectionBox(QWidget *parent) : CHorizontalComboBox(parent)
CKeySelectionBox::CKeySelectionBox(QWidget *parent) : QComboBox(parent)
{
connect(this, qOverload<int>(&CKeySelectionBox::currentIndexChanged), this,
&CKeySelectionBox::updateSelectedIndex);
Expand Down Expand Up @@ -199,7 +199,6 @@ namespace swift::gui::components
const CKeyboardKey &keyboardKey)
{
int currentIndex = 0;
const int width = qRound(1.5 * this->width());
const bool select = !keyboardKey.isUnknown();

CKeySelectionBox *ksb = new CKeySelectionBox(ui->qf_Advanced);
Expand All @@ -211,7 +210,6 @@ namespace swift::gui::components
}

ksb->setSelectedIndex(currentIndex);
ksb->setPopupWidth(qMin(width, 600));
ksb->addItem(noKeyButton(), QVariant::fromValue(CKeyboardKey())); // at back (easier to find it is there twice)

ui->qf_Advanced->layout()->addWidget(ksb);
Expand All @@ -226,7 +224,6 @@ namespace swift::gui::components
const CJoystickButton &joystickButton)
{
int currentIndex = -1;
const int width = qRound(1.5 * this->width());

CKeySelectionBox *ksb = new CKeySelectionBox(ui->qf_Advanced);
ksb->addItem(noKeyButton(), QVariant::fromValue(CJoystickButton())); // at front
Expand All @@ -241,7 +238,6 @@ namespace swift::gui::components
}

ksb->setSelectedIndex(currentIndex);
ksb->setPopupWidth(qMin(width, 600));
ksb->addItem(noKeyButton(),
QVariant::fromValue(CJoystickButton())); // at back (easier to find it is there twice)

Expand Down
3 changes: 1 addition & 2 deletions src/gui/components/hotkeydialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <QObject>
#include <QScopedPointer>

#include "gui/horizontalcombobox.h"
#include "gui/models/actionmodel.h"
#include "gui/swiftguiexport.h"
#include "misc/identifierlist.h"
Expand All @@ -36,7 +35,7 @@ namespace swift::gui::components
/*!
* ComboBox for selecting keyboard keys
*/
class SWIFT_GUI_EXPORT CKeySelectionBox : public CHorizontalComboBox
class SWIFT_GUI_EXPORT CKeySelectionBox : public QComboBox
{
Q_OBJECT

Expand Down
1 change: 0 additions & 1 deletion src/gui/components/logincomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "gui/editors/pilotform.h"
#include "gui/editors/serverform.h"
#include "gui/guiapplication.h"
#include "gui/loginmodebuttons.h"
#include "gui/ticklabel.h"
#include "gui/uppercasevalidator.h"
#include "misc/aviation/aircrafticaocode.h"
Expand Down
6 changes: 0 additions & 6 deletions src/gui/components/logincomponent.ui
Original file line number Diff line number Diff line change
Expand Up @@ -392,12 +392,6 @@
<header>gui/components/ownaircraftcomponent.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>swift::gui::CLoginModeButtons</class>
<extends>QFrame</extends>
<header>gui/loginmodebuttons.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>swift::gui::CTickLabel</class>
<extends>QLabel</extends>
Expand Down
11 changes: 9 additions & 2 deletions src/gui/components/networkdetailscomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,16 @@ namespace swift::gui::components

CNetworkDetailsComponent::~CNetworkDetailsComponent() {}

CLoginMode CNetworkDetailsComponent::getLoginMode() const { return ui->frp_LoginMode->getLoginMode(); }
CLoginMode CNetworkDetailsComponent::getLoginMode() const
{
return ui->cb_observer->isChecked() ? CLoginMode::Observer : CLoginMode::Pilot;
}

void CNetworkDetailsComponent::setLoginMode(CLoginMode mode) { ui->frp_LoginMode->setLoginMode(mode); }
void CNetworkDetailsComponent::setLoginMode(CLoginMode mode)
{
if (mode == CLoginMode::Observer) { ui->cb_observer->setChecked(true); }
else { ui->cb_observer->setChecked(false); }
}

bool CNetworkDetailsComponent::isVatsimServerSelected() const
{
Expand Down
15 changes: 3 additions & 12 deletions src/gui/components/networkdetailscomponent.ui
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,9 @@
</widget>
</item>
<item row="0" column="1">
<widget class="swift::gui::CLoginModeButtons" name="frp_LoginMode">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
<widget class="QCheckBox" name="cb_observer">
<property name="text">
<string>Observer (co-pilot)</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -259,12 +256,6 @@
<extends>QComboBox</extends>
<header>gui/components/serverlistselector.h</header>
</customwidget>
<customwidget>
<class>swift::gui::CLoginModeButtons</class>
<extends>QFrame</extends>
<header>gui/loginmodebuttons.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tw_Network</tabstop>
Expand Down
3 changes: 1 addition & 2 deletions src/gui/components/settingsguicomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ using namespace swift::core::context;

namespace swift::gui::components
{
CSettingsGuiComponent::CSettingsGuiComponent(QWidget *parent)
: QFrame(parent), swift::gui::CSingleApplicationUi(this), ui(new Ui::CSettingsGuiComponent)
CSettingsGuiComponent::CSettingsGuiComponent(QWidget *parent) : QFrame(parent), ui(new Ui::CSettingsGuiComponent)
{
ui->setupUi(this);

Expand Down
3 changes: 1 addition & 2 deletions src/gui/components/settingsguicomponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <QScopedPointer>

#include "gui/settings/guisettings.h"
#include "gui/singleapplicationui.h"

namespace Ui
{
Expand All @@ -21,7 +20,7 @@ namespace swift::gui::components
/*!
* General GUI settings
*/
class CSettingsGuiComponent : public QFrame, public swift::gui::CSingleApplicationUi
class CSettingsGuiComponent : public QFrame
{
Q_OBJECT

Expand Down
45 changes: 0 additions & 45 deletions src/gui/copyxswiftbusdialog.cpp

This file was deleted.

25 changes: 0 additions & 25 deletions src/gui/copyxswiftbusdialog.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/gui/dropbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace swift::gui
virtual void allowDrop(bool allowed) { m_allowDrop = allowed; }

//! Allow JSON file drop
virtual void allowFileDrop(bool allow) { m_acceptJsonFile = allow; }
virtual void allowJsonFileDrop(bool allow) { m_acceptJsonFile = allow; }

//! Accept drop?
bool acceptDrop(const QMimeData *mime) const;
Expand Down
37 changes: 0 additions & 37 deletions src/gui/elidedpushbutton.cpp

This file was deleted.

Loading