mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 11:05:33 +08:00
refs #560, allow to load / save from view/model
* added load/save functions * changed menu from multiple bool members to flag * shortcut for save * cleaned up filter dialog handling
This commit is contained in:
@@ -604,6 +604,18 @@ namespace BlackGui
|
||||
return mimeData;
|
||||
}
|
||||
|
||||
template <typename ObjectType, typename ContainerType, bool UseCompare>
|
||||
QJsonObject CListModelBase<ObjectType, ContainerType, UseCompare>::toJson() const
|
||||
{
|
||||
return container().toJson();
|
||||
}
|
||||
|
||||
template <typename ObjectType, typename ContainerType, bool UseCompare>
|
||||
QString CListModelBase<ObjectType, ContainerType, UseCompare>::toJsonString(QJsonDocument::JsonFormat format) const
|
||||
{
|
||||
return container().toJsonString(format);
|
||||
}
|
||||
|
||||
// see here for the reason of thess forward instantiations
|
||||
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html
|
||||
template class CListModelBase<BlackMisc::Aviation::CLivery, BlackMisc::Aviation::CLiveryList, true>;
|
||||
|
||||
@@ -100,6 +100,12 @@ namespace BlackGui
|
||||
//! \note Meant for scenarios where the container is directly updated and a subsequent signal is required
|
||||
void sendDataChanged(int startRowIndex, int endRowIndex);
|
||||
|
||||
//! Convert to JSON
|
||||
virtual QJsonObject toJson() const = 0;
|
||||
|
||||
//! Convert to JSON string
|
||||
virtual QString toJsonString(QJsonDocument::JsonFormat format = QJsonDocument::Indented) const = 0;
|
||||
|
||||
signals:
|
||||
//! Asynchronous update finished
|
||||
void asyncUpdateFinished();
|
||||
@@ -225,6 +231,12 @@ namespace BlackGui
|
||||
//! \copydoc QStandardItemModel::mimeData
|
||||
virtual QMimeData *mimeData(const QModelIndexList &indexes) const override;
|
||||
|
||||
//! \copydoc CListModelBaseNonTemplate::toJosn
|
||||
virtual QJsonObject toJson() const override;
|
||||
|
||||
//! \copydoc CListModelBaseNonTemplate::toJsonString
|
||||
virtual QString toJsonString(QJsonDocument::JsonFormat format = QJsonDocument::Indented) const override;
|
||||
|
||||
//! Filter available
|
||||
bool hasFilter() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user