mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-30 22:29:13 +08:00
Ref T219, changed CForm so it can be used with/without DB User
This commit is contained in:
@@ -35,27 +35,33 @@ namespace BlackGui
|
|||||||
return CStatusMessageList();
|
return CStatusMessageList();
|
||||||
}
|
}
|
||||||
|
|
||||||
CAuthenticatedUser CForm::getSwiftDbUser() const
|
|
||||||
{
|
|
||||||
return this->m_swiftDbUser.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CForm::jsonPasted(const QString &json)
|
void CForm::jsonPasted(const QString &json)
|
||||||
{
|
{
|
||||||
Q_UNUSED(json);
|
Q_UNUSED(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForm::ps_userChanged()
|
void CForm::pasted()
|
||||||
{
|
|
||||||
// void
|
|
||||||
}
|
|
||||||
|
|
||||||
void CForm::ps_pasted()
|
|
||||||
{
|
{
|
||||||
if (!QApplication::clipboard()) { return; }
|
if (!QApplication::clipboard()) { return; }
|
||||||
const QString data = QApplication::clipboard()->text();
|
const QString data = QApplication::clipboard()->text();
|
||||||
if (!Json::looksLikeSwiftJson(data)) { return; }
|
if (!Json::looksLikeSwiftJson(data)) { return; }
|
||||||
this->jsonPasted(data);
|
this->jsonPasted(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CFormDbUser::CFormDbUser(QWidget *parent) : CForm(parent)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
CFormDbUser::~CFormDbUser()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
CAuthenticatedUser CFormDbUser::getSwiftDbUser() const
|
||||||
|
{
|
||||||
|
return m_swiftDbUser.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFormDbUser::userChanged()
|
||||||
|
{
|
||||||
|
// void
|
||||||
|
}
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
namespace Editors
|
namespace Editors
|
||||||
{
|
{
|
||||||
/*!
|
//! Form base class
|
||||||
* Form base class
|
|
||||||
*/
|
|
||||||
class BLACKGUI_EXPORT CForm : public COverlayMessagesFrame
|
class BLACKGUI_EXPORT CForm : public COverlayMessagesFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -53,23 +51,37 @@ namespace BlackGui
|
|||||||
//! Is read only?
|
//! Is read only?
|
||||||
bool isReadOnly() const { return m_readOnly; }
|
bool isReadOnly() const { return m_readOnly; }
|
||||||
|
|
||||||
//! Authenticated DB user
|
|
||||||
BlackMisc::Network::CAuthenticatedUser getSwiftDbUser() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! JSON string has been pasted
|
//! JSON string has been pasted
|
||||||
//! \remark The JSON string has been pre-checked
|
//! \remark The JSON string has been pre-checked
|
||||||
virtual void jsonPasted(const QString &json);
|
virtual void jsonPasted(const QString &json);
|
||||||
|
|
||||||
bool m_readOnly = false; //!< read only
|
|
||||||
BlackMisc::CDataReadOnly<BlackCore::Data::TAuthenticatedDbUser> m_swiftDbUser {this, &CForm::ps_userChanged}; //!< authenticated user
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
//! User has been changed
|
|
||||||
virtual void ps_userChanged();
|
|
||||||
|
|
||||||
//! Pasted from clipboard
|
//! Pasted from clipboard
|
||||||
void ps_pasted();
|
void pasted();
|
||||||
|
|
||||||
|
bool m_readOnly = false; //!< read only
|
||||||
|
};
|
||||||
|
|
||||||
|
//! Form base class
|
||||||
|
class BLACKGUI_EXPORT CFormDbUser : public CForm
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
explicit CFormDbUser(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
//! Destructor
|
||||||
|
virtual ~CFormDbUser();
|
||||||
|
|
||||||
|
//! Authenticated DB user
|
||||||
|
BlackMisc::Network::CAuthenticatedUser getSwiftDbUser() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//! User has been changed
|
||||||
|
virtual void userChanged();
|
||||||
|
|
||||||
|
BlackMisc::CDataReadOnly<BlackCore::Data::TAuthenticatedDbUser> m_swiftDbUser {this, &CFormDbUser::userChanged}; //!< authenticated user
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
Reference in New Issue
Block a user