mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
refs #573, added exclude/include combo box in UI
* access to user, only admin may edit include/exclude * updated UI
This commit is contained in:
@@ -19,5 +19,15 @@ namespace BlackGui
|
||||
|
||||
CForm::~CForm() { }
|
||||
|
||||
const BlackMisc::Network::CAuthenticatedUser &CForm::getUser() const
|
||||
{
|
||||
return this->m_user.get();
|
||||
}
|
||||
|
||||
void CForm::ps_userChanged()
|
||||
{
|
||||
// void
|
||||
}
|
||||
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#ifndef BLACKGUI_EDITORS_FORM_H
|
||||
#define BLACKGUI_EDITORS_FORM_H
|
||||
|
||||
#include "blackmisc/network/authenticateduser.h"
|
||||
#include "blackcore/data/authenticateduser.h"
|
||||
#include <QFrame>
|
||||
|
||||
namespace BlackGui
|
||||
@@ -42,8 +44,16 @@ namespace BlackGui
|
||||
//! Is read only?
|
||||
bool isReadOnly() const { return m_readOnly; }
|
||||
|
||||
//! Authenticated user
|
||||
const BlackMisc::Network::CAuthenticatedUser &getUser() const;
|
||||
|
||||
protected:
|
||||
bool m_readOnly = false; //!< read only
|
||||
BlackMisc::CData<BlackCore::Data::AuthenticatedUser> m_user {this, &CForm::ps_userChanged}; //!< authenticated user
|
||||
|
||||
protected slots:
|
||||
//! User has been changed
|
||||
virtual void ps_userChanged();
|
||||
};
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "ui_modelmappingform.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Simulation;
|
||||
|
||||
namespace BlackGui
|
||||
@@ -26,6 +27,8 @@ namespace BlackGui
|
||||
ui->le_Id->setReadOnly(true);
|
||||
ui->lai_Id->set(CIcons::appMappings16(), "Id:");
|
||||
connect(ui->pb_Stash, &QPushButton::clicked, this, &CModelMappingForm::requestStash);
|
||||
|
||||
this->ps_userChanged();
|
||||
}
|
||||
|
||||
CModelMappingForm::~CModelMappingForm()
|
||||
@@ -38,6 +41,7 @@ namespace BlackGui
|
||||
model.setDescription(this->ui->le_Description->text());
|
||||
model.setModelString(this->ui->le_ModelKey->text());
|
||||
model.setName(this->ui->le_Name->text());
|
||||
model.setModelModeAsString(this->ui->cb_Include->currentText());
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -68,8 +72,24 @@ namespace BlackGui
|
||||
ui->le_Id->setText(model.getDbKeyAsString());
|
||||
ui->le_Description->setText(model.getDescription());
|
||||
ui->le_Name->setText(model.getName());
|
||||
ui->cb_Include->setCurrentText(model.getModelModeAsString());
|
||||
ui->selector_Simulator->setValue(model.getSimulatorInfo());
|
||||
m_originalModel = model;
|
||||
}
|
||||
|
||||
void CModelMappingForm::ps_userChanged()
|
||||
{
|
||||
const CAuthenticatedUser user(this->getUser());
|
||||
if (user.isAdmin())
|
||||
{
|
||||
ui->cb_Include->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->cb_Include->setEnabled(false);
|
||||
}
|
||||
|
||||
CForm::ps_userChanged();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -59,6 +59,10 @@ namespace BlackGui
|
||||
//! Request stashing for model
|
||||
void requestStash();
|
||||
|
||||
protected slots:
|
||||
//! User has been changed
|
||||
virtual void ps_userChanged() override;
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CModelMappingForm> ui;
|
||||
BlackMisc::Simulation::CAircraftModel m_originalModel;
|
||||
|
||||
@@ -161,6 +161,28 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<widget class="QComboBox" name="cb_Include">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Include</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
<normaloff>:/diagona/icons/diagona/icons/paper-plane--plus.png</normaloff>:/diagona/icons/diagona/icons/paper-plane--plus.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Exclude</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../blackmisc/blackmisc.qrc">
|
||||
<normaloff>:/diagona/icons/diagona/icons/paper-plane--minus.png</normaloff>:/diagona/icons/diagona/icons/paper-plane--minus.png</iconset>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -194,6 +216,8 @@
|
||||
<tabstop>pb_Stash</tabstop>
|
||||
<tabstop>le_LastUpdated</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user