7 #include <QRadioButton>
10 #include "ui_ownmodelsetform.h"
20 using namespace swift::misc::simulation;
24 namespace swift::gui::editors
29 ui->tvp_Distributors->setDistributorMode(CDistributorListModel::Minimal);
30 ui->comp_SimulatorSelector->setMode(CSimulatorSelector::RadioButtons);
31 ui->comp_SimulatorSelector->setLeftMargin(0);
33 connect(ui->comp_SimulatorSelector, &CSimulatorSelector::changed,
this, &COwnModelSetForm::onSimulatorChanged,
34 Qt::QueuedConnection);
35 connect(ui->rb_DisplayAllDistributors, &QRadioButton::clicked,
this,
36 &COwnModelSetForm::changeDistributorDisplay);
37 connect(ui->rb_DisplayPreferencesDistributors, &QRadioButton::clicked,
this,
38 &COwnModelSetForm::changeDistributorDisplay);
40 QPointer<COwnModelSetForm> myself(
this);
42 if (!myself) {
return; }
43 this->onSimulatorChanged(ui->comp_SimulatorSelector->getValue());
55 ui->cb_SortByPreferences->setChecked(hasPreferences);
57 ui->comp_SimulatorSelector->setValue(m_simulator);
58 this->setDistributorView(hasPreferences);
59 this->initDistributorDisplay();
77 return ui->cb_ConsolidateModelSet->isChecked();
80 void COwnModelSetForm::onPreferencesChanged()
85 void COwnModelSetForm::onSimulatorChanged(
const CSimulatorInfo &simulator)
87 Q_ASSERT_X(simulator.
isSingleSimulator(), Q_FUNC_INFO,
"Expect single simulator");
93 void COwnModelSetForm::changeDistributorDisplay()
95 if (ui->rb_DisplayAllDistributors->isChecked())
98 ui->cb_SortByPreferences->setChecked(
false);
100 this->setDistributorView(
false);
105 ui->cb_SortByPreferences->setChecked(
true);
107 this->setDistributorView(
true);
111 void COwnModelSetForm::initDistributorDisplay()
114 else { ui->rb_DisplayAllDistributors->setChecked(
true); }
115 this->changeDistributorDisplay();
118 void COwnModelSetForm::setDistributorView(
bool hasPreferences)
120 ui->tvp_Distributors->setDistributorMode(hasPreferences ? CDistributorListModel::MinimalWithOrder :
121 CDistributorListModel::Minimal);
122 ui->tvp_Distributors->fullResizeToContents();
125 ui->tvp_Distributors->sortByPropertyIndex(i);
130 Q_ASSERT_X(m_simulator.
isSingleSimulator(), Q_FUNC_INFO,
"Need single simulator");
138 Q_ASSERT_X(m_simulator.
isSingleSimulator(), Q_FUNC_INFO,
"Need single simulator");
148 Q_ASSERT_X(
false, Q_FUNC_INFO,
"Wrong option");
156 return ui->tvp_Distributors->selectedObjects();
161 return ui->tvp_Distributors->containerOrFilteredContainer();
171 m_simulator.
isSingleSimulator() ? m_simulator : CSimulatorInfo::guessDefaultSimulator();
173 QStringLiteral(
"Set invalid simulator, continue to use '%1'").arg(resetSim.
toQString(
true));
175 m_simulator = resetSim;
bool hasWebDataServices() const
Web data services available?
CWebDataServices * getWebDataServices() const
Get the web data services.
swift::misc::simulation::CDistributorList getDistributors() const
Distributors.
static void checkBoxReadOnly(QCheckBox *checkBox, bool readOnly)
Pseudo readonly state for checkbox.
bool showOverlayHTMLMessage(const QString &htmlMessage, std::chrono::milliseconds timeout=std::chrono::milliseconds(0))
HTML message.
T get() const
Get a copy of the current value.
bool isEmpty() const
Synonym for empty.
QString toQString(bool i18n=false) const
Cast as QString.
Value object encapsulating information of software distributor.
Value object encapsulating a list of distributors.
CDistributorList matchesSimulator(const CSimulatorInfo &simulator) const
Find for given simulator.
Preferences for distributors.
const CDistributorList & getDistributors(const CSimulatorInfo &simulator) const
Get distributors.
Simple hardcoded info about the corresponding simulator.
bool isSingleSimulator() const
Single simulator selected.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
High level reusable GUI components.
Models to be used with views, mainly QTableView.
Free functions in swift::misc.
auto singleShot(int msec, QObject *target, F &&task)
Starts a single-shot timer which will call a task in the thread of the given object when it times out...