mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 00:25:35 +08:00
refactor(ui): Remove plugin details window
This commit is contained in:
@@ -61,7 +61,6 @@ namespace swift::gui::components
|
|||||||
|
|
||||||
// connects
|
// connects
|
||||||
connect(ui->pluginSelector_EnabledSimulators, &CPluginSelector::pluginStateChanged, this, &CSettingsSimulatorComponent::pluginStateChanged);
|
connect(ui->pluginSelector_EnabledSimulators, &CPluginSelector::pluginStateChanged, this, &CSettingsSimulatorComponent::pluginStateChanged);
|
||||||
connect(ui->pluginSelector_EnabledSimulators, &CPluginSelector::pluginDetailsRequested, this, &CSettingsSimulatorComponent::showPluginDetails);
|
|
||||||
connect(ui->pluginSelector_EnabledSimulators, &CPluginSelector::pluginConfigRequested, this, &CSettingsSimulatorComponent::showPluginConfig);
|
connect(ui->pluginSelector_EnabledSimulators, &CPluginSelector::pluginConfigRequested, this, &CSettingsSimulatorComponent::showPluginConfig);
|
||||||
|
|
||||||
connect(ui->pb_Reload, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::onReload, Qt::QueuedConnection);
|
connect(ui->pb_Reload, &QCheckBox::pressed, this, &CSettingsSimulatorComponent::onReload, Qt::QueuedConnection);
|
||||||
@@ -393,26 +392,6 @@ namespace swift::gui::components
|
|||||||
this->setGuiValues();
|
this->setGuiValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsSimulatorComponent::showPluginDetails(const QString &identifier)
|
|
||||||
{
|
|
||||||
const CSimulatorPluginInfoList simDrivers(this->getAvailablePlugins());
|
|
||||||
const CSimulatorPluginInfo selected = simDrivers.findByIdentifier(identifier);
|
|
||||||
|
|
||||||
QWidget *aw = qApp->activeWindow();
|
|
||||||
Q_ASSERT_X(aw, Q_FUNC_INFO, "Missing active window");
|
|
||||||
|
|
||||||
CPluginDetailsWindow *w = new CPluginDetailsWindow(aw);
|
|
||||||
SWIFT_VERIFY_X(w, Q_FUNC_INFO, "Missing window");
|
|
||||||
if (!w) { return; }
|
|
||||||
|
|
||||||
w->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
w->setPluginIdentifier(selected.getIdentifier());
|
|
||||||
w->setPluginName(selected.getName());
|
|
||||||
w->setPluginDescription(selected.getDescription());
|
|
||||||
|
|
||||||
w->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSettingsSimulatorComponent::showPluginConfig(const QString &identifier)
|
void CSettingsSimulatorComponent::showPluginConfig(const QString &identifier)
|
||||||
{
|
{
|
||||||
const CSimulatorPluginInfoList simDrivers(getAvailablePlugins());
|
const CSimulatorPluginInfoList simDrivers(getAvailablePlugins());
|
||||||
|
|||||||
@@ -80,9 +80,6 @@ namespace swift::gui::components
|
|||||||
//! Simulator plugin changed
|
//! Simulator plugin changed
|
||||||
void simulatorPluginChanged(const swift::misc::simulation::CSimulatorPluginInfo &info);
|
void simulatorPluginChanged(const swift::misc::simulation::CSimulatorPluginInfo &info);
|
||||||
|
|
||||||
//! Open plugin details window
|
|
||||||
void showPluginDetails(const QString &identifier);
|
|
||||||
|
|
||||||
//! Show plugin config
|
//! Show plugin config
|
||||||
void showPluginConfig(const QString &identifier);
|
void showPluginConfig(const QString &identifier);
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ namespace swift::gui
|
|||||||
QVBoxLayout *layout = new QVBoxLayout;
|
QVBoxLayout *layout = new QVBoxLayout;
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
connect(m_detailsButtonMapper, &QSignalMapper::mappedString, this, &CPluginSelector::pluginDetailsRequested);
|
|
||||||
connect(m_configButtonMapper, &QSignalMapper::mappedString, this, &CPluginSelector::pluginConfigRequested);
|
connect(m_configButtonMapper, &QSignalMapper::mappedString, this, &CPluginSelector::pluginConfigRequested);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,15 +61,8 @@ namespace swift::gui
|
|||||||
pw->layout()->addWidget(config);
|
pw->layout()->addWidget(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPushButton *details = new QPushButton("?");
|
|
||||||
details->setToolTip("Plugin details");
|
|
||||||
m_detailsButtonMapper->setMapping(details, identifier);
|
|
||||||
connect(details, &QPushButton::clicked, m_detailsButtonMapper, qOverload<>(&QSignalMapper::map));
|
|
||||||
pw->layout()->addWidget(details);
|
|
||||||
|
|
||||||
layout->setStretch(0, 1);
|
layout->setStretch(0, 1);
|
||||||
layout->setStretch(1, 0);
|
layout->setStretch(1, 0);
|
||||||
layout->setStretch(2, 0);
|
|
||||||
|
|
||||||
this->layout()->addWidget(pw);
|
this->layout()->addWidget(pw);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,16 +41,12 @@ namespace swift::gui
|
|||||||
//! Emitted when user enables/disables the particular plugin
|
//! Emitted when user enables/disables the particular plugin
|
||||||
void pluginStateChanged(const QString &identifier, bool enabled);
|
void pluginStateChanged(const QString &identifier, bool enabled);
|
||||||
|
|
||||||
//! Emitted when user clicks the "Details" button
|
|
||||||
void pluginDetailsRequested(const QString &identifier);
|
|
||||||
|
|
||||||
//! Emitted when user clicks the "Settings" button
|
//! Emitted when user clicks the "Settings" button
|
||||||
void pluginConfigRequested(const QString &identifier);
|
void pluginConfigRequested(const QString &identifier);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handlePluginStateChange();
|
void handlePluginStateChange();
|
||||||
|
|
||||||
QSignalMapper *m_detailsButtonMapper = new QSignalMapper(this);
|
|
||||||
QSignalMapper *m_configButtonMapper = new QSignalMapper(this);
|
QSignalMapper *m_configButtonMapper = new QSignalMapper(this);
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
Reference in New Issue
Block a user