mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-11 06:25:33 +08:00
Ref T478, removed the critical functions + adjustments
The code was never used as we decided not to translate swift, but do it all in English. So that code branch was never executed and I have removed the above 4 function + required adjustments. * getTranslationContextChar * getColumnNameChar * getColumnToolTipChar * getTranslationContextChar
This commit is contained in:
committed by
Mat Sutcliffe
parent
da0e021332
commit
4aec50ccfc
@@ -44,36 +44,6 @@ namespace BlackGui
|
|||||||
m_columnToolTip(toolTip), m_formatter(new CPixmapFormatter()), m_propertyIndex(propertyIndex)
|
m_columnToolTip(toolTip), m_formatter(new CPixmapFormatter()), m_propertyIndex(propertyIndex)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
const char *CColumn::getTranslationContextChar() const
|
|
||||||
{
|
|
||||||
//! \fixme MS 2018-12 Undefined behaviour: returning pointer to temporary data deleted when function returns.
|
|
||||||
return m_translationContext.toUtf8().constData();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *CColumn::getColumnNameChar() const
|
|
||||||
{
|
|
||||||
//! \fixme MS 2018-12 Undefined behaviour: returning pointer to temporary data deleted when function returns.
|
|
||||||
return m_columnName.toUtf8().constData();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *CColumn::getColumnToolTipChar() const
|
|
||||||
{
|
|
||||||
//! \fixme MS 2018-12 Undefined behaviour: returning pointer to temporary data deleted when function returns.
|
|
||||||
return m_columnToolTip.toUtf8().constData();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CColumn::getColumnName(bool i18n) const
|
|
||||||
{
|
|
||||||
if (!i18n || m_translationContext.isEmpty()) return m_columnName;
|
|
||||||
return QCoreApplication::translate(this->getTranslationContextChar(), this->getColumnNameChar());
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CColumn::getColumnToolTip(bool i18n) const
|
|
||||||
{
|
|
||||||
if (!i18n || m_columnToolTip.isEmpty()) return m_columnToolTip;
|
|
||||||
return QCoreApplication::translate(this->getTranslationContextChar(), this->getColumnToolTipChar());
|
|
||||||
}
|
|
||||||
|
|
||||||
CColumn CColumn::standardValueObject(const QString &headerName, const CPropertyIndex &propertyIndex, int alignment)
|
CColumn CColumn::standardValueObject(const QString &headerName, const CPropertyIndex &propertyIndex, int alignment)
|
||||||
{
|
{
|
||||||
return CColumn(headerName, propertyIndex, new CValueObjectFormatter(alignment));
|
return CColumn(headerName, propertyIndex, new CValueObjectFormatter(alignment));
|
||||||
@@ -122,13 +92,15 @@ namespace BlackGui
|
|||||||
QString CColumns::propertyIndexToColumnName(const CPropertyIndex &propertyIndex, bool i18n) const
|
QString CColumns::propertyIndexToColumnName(const CPropertyIndex &propertyIndex, bool i18n) const
|
||||||
{
|
{
|
||||||
int column = this->propertyIndexToColumn(propertyIndex);
|
int column = this->propertyIndexToColumn(propertyIndex);
|
||||||
return m_columns.at(column).getColumnName(i18n);
|
Q_UNUSED(i18n); // not implemented
|
||||||
|
return m_columns.at(column).getColumnName();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CColumns::columnToName(int column, bool i18n) const
|
QString CColumns::columnToName(int column, bool i18n) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(isValidColumn(column));
|
Q_ASSERT(isValidColumn(column));
|
||||||
return m_columns.at(column).getColumnName(i18n);
|
Q_UNUSED(i18n); // not implemented
|
||||||
|
return m_columns.at(column).getColumnName();
|
||||||
}
|
}
|
||||||
|
|
||||||
CPropertyIndex CColumns::columnToPropertyIndex(int column) const
|
CPropertyIndex CColumns::columnToPropertyIndex(int column) const
|
||||||
@@ -163,8 +135,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < m_columns.size(); i++)
|
for (int i = 0; i < m_columns.size(); i++)
|
||||||
{
|
{
|
||||||
if (m_columns.at(i).getColumnName(false) == name)
|
if (m_columns.at(i).getColumnName() == name) { return i; }
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -219,11 +190,5 @@ namespace BlackGui
|
|||||||
if (!isValidColumn(index)) { return nullptr; }
|
if (!isValidColumn(index)) { return nullptr; }
|
||||||
return m_columns.at(index.column()).getFormatter();
|
return m_columns.at(index.column()).getFormatter();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *CColumns::getTranslationContextChar() const
|
|
||||||
{
|
|
||||||
//! \fixme MS 2018-12 Undefined behaviour: returning pointer to temporary data deleted when function returns.
|
|
||||||
return m_translationContext.toUtf8().constData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -81,10 +81,10 @@ namespace BlackGui
|
|||||||
BlackMisc::CVariant getAlignment() const;
|
BlackMisc::CVariant getAlignment() const;
|
||||||
|
|
||||||
//! Column name
|
//! Column name
|
||||||
QString getColumnName(bool i18n = false) const;
|
const QString &getColumnName() const { return m_columnName; }
|
||||||
|
|
||||||
//! Column tooltip
|
//! Column tooltip
|
||||||
QString getColumnToolTip(bool i18n = false) const;
|
const QString &getColumnToolTip() const { return m_columnToolTip; }
|
||||||
|
|
||||||
//! Property index
|
//! Property index
|
||||||
const BlackMisc::CPropertyIndex &getPropertyIndex() const { return m_propertyIndex;}
|
const BlackMisc::CPropertyIndex &getPropertyIndex() const { return m_propertyIndex;}
|
||||||
@@ -120,9 +120,6 @@ namespace BlackGui
|
|||||||
|
|
||||||
bool m_editable = false;
|
bool m_editable = false;
|
||||||
bool m_sortable = true;
|
bool m_sortable = true;
|
||||||
const char *getTranslationContextChar() const;
|
|
||||||
const char *getColumnNameChar() const;
|
|
||||||
const char *getColumnToolTipChar() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -188,9 +185,6 @@ namespace BlackGui
|
|||||||
//! Aligment as CVariant
|
//! Aligment as CVariant
|
||||||
BlackMisc::CVariant getAlignment(const QModelIndex &index) const;
|
BlackMisc::CVariant getAlignment(const QModelIndex &index) const;
|
||||||
|
|
||||||
//! Translation context
|
|
||||||
const QString &getTranslationContext() const { return m_translationContext; }
|
|
||||||
|
|
||||||
//! Formatter
|
//! Formatter
|
||||||
const CDefaultFormatter *getFormatter(const QModelIndex &index) const;
|
const CDefaultFormatter *getFormatter(const QModelIndex &index) const;
|
||||||
|
|
||||||
@@ -210,8 +204,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QList<CColumn> m_columns;
|
QList<CColumn> m_columns;
|
||||||
QString m_translationContext;
|
QString m_translationContext; //!< for future usage
|
||||||
const char *getTranslationContextChar() const;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} // namespace BlackGui
|
} // namespace BlackGui
|
||||||
|
|||||||
@@ -52,13 +52,11 @@ namespace BlackGui
|
|||||||
|
|
||||||
if (role == Qt::DisplayRole)
|
if (role == Qt::DisplayRole)
|
||||||
{
|
{
|
||||||
const QString header = m_columns.at(section).getColumnName(false);
|
return QVariant(m_columns.at(section).getColumnName());
|
||||||
return QVariant(header);
|
|
||||||
}
|
}
|
||||||
if (role == Qt::ToolTipRole)
|
if (role == Qt::ToolTipRole)
|
||||||
{
|
{
|
||||||
const QString header = m_columns.at(section).getColumnToolTip(false);
|
return QVariant(m_columns.at(section).getColumnToolTip());
|
||||||
return header.isEmpty() ? QVariant() : QVariant(header);
|
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@@ -135,11 +133,6 @@ namespace BlackGui
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CListModelBaseNonTemplate::getTranslationContext() const
|
|
||||||
{
|
|
||||||
return m_columns.getTranslationContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt::DropActions CListModelBaseNonTemplate::supportedDragActions() const
|
Qt::DropActions CListModelBaseNonTemplate::supportedDragActions() const
|
||||||
{
|
{
|
||||||
return isOrderable() ? Qt::CopyAction | Qt::MoveAction : Qt::CopyAction;
|
return isOrderable() ? Qt::CopyAction | Qt::MoveAction : Qt::CopyAction;
|
||||||
|
|||||||
@@ -93,9 +93,6 @@ namespace BlackGui
|
|||||||
//! Get sort order
|
//! Get sort order
|
||||||
virtual Qt::SortOrder getSortOrder() const { return m_sortOrder; }
|
virtual Qt::SortOrder getSortOrder() const { return m_sortOrder; }
|
||||||
|
|
||||||
//! Translation context
|
|
||||||
virtual const QString &getTranslationContext() const;
|
|
||||||
|
|
||||||
//! Orderable, normally use a container BlackMisc::IOrderableList
|
//! Orderable, normally use a container BlackMisc::IOrderableList
|
||||||
virtual bool isOrderable() const = 0;
|
virtual bool isOrderable() const = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -497,8 +497,7 @@ namespace BlackGui
|
|||||||
// then name here is mainly set for debugging purposes so each model can be identified
|
// then name here is mainly set for debugging purposes so each model can be identified
|
||||||
Q_ASSERT(m_model);
|
Q_ASSERT(m_model);
|
||||||
QTableView::setObjectName(name);
|
QTableView::setObjectName(name);
|
||||||
const QString modelName = QString(name).append(':').append(m_model->getTranslationContext());
|
m_model->setObjectName(name);
|
||||||
m_model->setObjectName(modelName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|||||||
Reference in New Issue
Block a user