mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 18:25:42 +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() { }
|
CForm::~CForm() { }
|
||||||
|
|
||||||
|
const BlackMisc::Network::CAuthenticatedUser &CForm::getUser() const
|
||||||
|
{
|
||||||
|
return this->m_user.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CForm::ps_userChanged()
|
||||||
|
{
|
||||||
|
// void
|
||||||
|
}
|
||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -12,6 +12,8 @@
|
|||||||
#ifndef BLACKGUI_EDITORS_FORM_H
|
#ifndef BLACKGUI_EDITORS_FORM_H
|
||||||
#define BLACKGUI_EDITORS_FORM_H
|
#define BLACKGUI_EDITORS_FORM_H
|
||||||
|
|
||||||
|
#include "blackmisc/network/authenticateduser.h"
|
||||||
|
#include "blackcore/data/authenticateduser.h"
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -42,8 +44,16 @@ namespace BlackGui
|
|||||||
//! Is read only?
|
//! Is read only?
|
||||||
bool isReadOnly() const { return m_readOnly; }
|
bool isReadOnly() const { return m_readOnly; }
|
||||||
|
|
||||||
|
//! Authenticated user
|
||||||
|
const BlackMisc::Network::CAuthenticatedUser &getUser() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_readOnly = false; //!< read only
|
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
|
} // ns
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "ui_modelmappingform.h"
|
#include "ui_modelmappingform.h"
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackMisc::Network;
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -26,6 +27,8 @@ namespace BlackGui
|
|||||||
ui->le_Id->setReadOnly(true);
|
ui->le_Id->setReadOnly(true);
|
||||||
ui->lai_Id->set(CIcons::appMappings16(), "Id:");
|
ui->lai_Id->set(CIcons::appMappings16(), "Id:");
|
||||||
connect(ui->pb_Stash, &QPushButton::clicked, this, &CModelMappingForm::requestStash);
|
connect(ui->pb_Stash, &QPushButton::clicked, this, &CModelMappingForm::requestStash);
|
||||||
|
|
||||||
|
this->ps_userChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
CModelMappingForm::~CModelMappingForm()
|
CModelMappingForm::~CModelMappingForm()
|
||||||
@@ -38,6 +41,7 @@ namespace BlackGui
|
|||||||
model.setDescription(this->ui->le_Description->text());
|
model.setDescription(this->ui->le_Description->text());
|
||||||
model.setModelString(this->ui->le_ModelKey->text());
|
model.setModelString(this->ui->le_ModelKey->text());
|
||||||
model.setName(this->ui->le_Name->text());
|
model.setName(this->ui->le_Name->text());
|
||||||
|
model.setModelModeAsString(this->ui->cb_Include->currentText());
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,8 +72,24 @@ namespace BlackGui
|
|||||||
ui->le_Id->setText(model.getDbKeyAsString());
|
ui->le_Id->setText(model.getDbKeyAsString());
|
||||||
ui->le_Description->setText(model.getDescription());
|
ui->le_Description->setText(model.getDescription());
|
||||||
ui->le_Name->setText(model.getName());
|
ui->le_Name->setText(model.getName());
|
||||||
|
ui->cb_Include->setCurrentText(model.getModelModeAsString());
|
||||||
ui->selector_Simulator->setValue(model.getSimulatorInfo());
|
ui->selector_Simulator->setValue(model.getSimulatorInfo());
|
||||||
m_originalModel = model;
|
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
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ namespace BlackGui
|
|||||||
//! Request stashing for model
|
//! Request stashing for model
|
||||||
void requestStash();
|
void requestStash();
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
//! User has been changed
|
||||||
|
virtual void ps_userChanged() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CModelMappingForm> ui;
|
QScopedPointer<Ui::CModelMappingForm> ui;
|
||||||
BlackMisc::Simulation::CAircraftModel m_originalModel;
|
BlackMisc::Simulation::CAircraftModel m_originalModel;
|
||||||
|
|||||||
@@ -161,6 +161,28 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -194,6 +216,8 @@
|
|||||||
<tabstop>pb_Stash</tabstop>
|
<tabstop>pb_Stash</tabstop>
|
||||||
<tabstop>le_LastUpdated</tabstop>
|
<tabstop>le_LastUpdated</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user