[companion] Remove no longer relevant EEPROM size column heading (#1381)
This commit is contained in:
@@ -697,10 +697,6 @@ QVector<int> MdiChild::getSelectedModels() const
|
||||
void MdiChild::updateTitle()
|
||||
{
|
||||
QString title = "[*]" + userFriendlyCurrentFile(); // + " (" + firmware->getName() + QString(")");
|
||||
int availableEEpromSize = modelsListModel->getAvailableEEpromSize();
|
||||
if (availableEEpromSize >= 0) {
|
||||
title += QString(" - %1 ").arg(availableEEpromSize) + tr("free bytes");
|
||||
}
|
||||
QFileInfo fi(curFile);
|
||||
if (!isUntitled && !fi.isWritable()) {
|
||||
title += QString(" (%1)").arg(tr("read only"));
|
||||
|
||||
@@ -136,18 +136,13 @@ bool TreeItem::isModel() const
|
||||
|
||||
TreeModel::TreeModel(RadioData * radioData, QObject * parent):
|
||||
QAbstractItemModel(parent),
|
||||
radioData(radioData),
|
||||
availableEEpromSize(-1)
|
||||
radioData(radioData)
|
||||
{
|
||||
Board::Type board = getCurrentBoard();
|
||||
hasCategories = getCurrentFirmware()->getCapability(Capability::HasModelCategories);
|
||||
QVector<QVariant> labels;
|
||||
if (!hasCategories)
|
||||
labels << tr("Index");
|
||||
labels << tr("Name");
|
||||
if (!(IS_FAMILY_HORUS_OR_T16(board) || IS_SKY9X(board))) {
|
||||
labels << tr("Size");
|
||||
}
|
||||
labels << tr("RX #");
|
||||
rootItem = new TreeItem(labels);
|
||||
// uniqueId and version for drag/drop operations (see encodeHeaderData())
|
||||
@@ -558,7 +553,7 @@ TreeItem * TreeModel::getItem(const QModelIndex & index) const
|
||||
// recursive
|
||||
QModelIndex TreeModel::getIndexForModel(const int modelIndex, QModelIndex parent)
|
||||
{
|
||||
for (int i=0; i < rowCount(parent); ++i) {
|
||||
for (int i = 0; i < rowCount(parent); ++i) {
|
||||
QModelIndex idx = index(i, 0, parent);
|
||||
if (hasChildren(idx) && (idx = getIndexForModel(modelIndex, idx)).isValid())
|
||||
return idx;
|
||||
@@ -570,18 +565,13 @@ QModelIndex TreeModel::getIndexForModel(const int modelIndex, QModelIndex parent
|
||||
|
||||
QModelIndex TreeModel::getIndexForCategory(const int categoryIndex)
|
||||
{
|
||||
for (int i=0; i < rowCount(); ++i) {
|
||||
for (int i = 0; i < rowCount(); ++i) {
|
||||
if (getItem(index(i, 0))->getCategoryIndex() == categoryIndex)
|
||||
return index(i, 0);
|
||||
}
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
int TreeModel::getAvailableEEpromSize()
|
||||
{
|
||||
return availableEEpromSize;
|
||||
}
|
||||
|
||||
int TreeModel::getModelIndex(const QModelIndex & index) const
|
||||
{
|
||||
return getItem(index)->getModelIndex();
|
||||
@@ -648,15 +638,7 @@ void TreeModel::onRowsRemoved(const QModelIndex & parent, int first, int last)
|
||||
|
||||
void TreeModel::refresh()
|
||||
{
|
||||
EEPROMInterface * eepromInterface = getCurrentEEpromInterface();
|
||||
Board::Type board = eepromInterface->getBoard();
|
||||
TreeItem * defaultCategoryItem = NULL;
|
||||
bool hasEepromSizeData = false; // not necessary with move to YAML storage for all boards TODO: remove unused code
|
||||
|
||||
if (hasEepromSizeData) {
|
||||
availableEEpromSize = Boards::getEEpromSize(board) - 64; // let's consider fat
|
||||
availableEEpromSize -= 16 * ((eepromInterface->getSize(radioData->generalSettings) + 14) / 15);
|
||||
}
|
||||
|
||||
this->blockSignals(true); // make sure onRowsRemoved is not triggered
|
||||
removeRows(0, rowCount());
|
||||
@@ -669,7 +651,7 @@ void TreeModel::refresh()
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned i=0; i<radioData->models.size(); i++) {
|
||||
for (unsigned i = 0; i < radioData->models.size(); i++) {
|
||||
ModelData & model = radioData->models[i];
|
||||
int currentColumn = 0;
|
||||
TreeItem * current = NULL;
|
||||
@@ -710,16 +692,7 @@ void TreeModel::refresh()
|
||||
modelName = tr("Model %1").arg(uint(i+1), 2, 10, QChar('0'));
|
||||
}
|
||||
current->setData(currentColumn++, modelName);
|
||||
if (hasEepromSizeData) {
|
||||
int size = eepromInterface->getSize(model);
|
||||
current->setData(currentColumn++, QString().sprintf("%5d", size));
|
||||
size = 16 * ((size + 14) / 15);
|
||||
availableEEpromSize -= size;
|
||||
if (i == radioData->generalSettings.currModelIndex) {
|
||||
// Because we need this space for a TEMP model each time we have to write it again
|
||||
availableEEpromSize -= size;
|
||||
}
|
||||
}
|
||||
|
||||
int protocol;
|
||||
QString rxs;
|
||||
unsigned moduleIdx = 0;
|
||||
@@ -742,10 +715,6 @@ void TreeModel::refresh()
|
||||
current->setData(currentColumn++, rxs);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasEepromSizeData) {
|
||||
availableEEpromSize = (availableEEpromSize / 16) * 15;
|
||||
}
|
||||
}
|
||||
|
||||
bool TreeModel::isModelIdUnique(unsigned modelIdx, unsigned module, unsigned protocol)
|
||||
|
||||
@@ -18,8 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _MODELSLIST_H_
|
||||
#define _MODELSLIST_H_
|
||||
#pragma once
|
||||
|
||||
#include "eeprominterface.h"
|
||||
#include <QAbstractItemModel>
|
||||
@@ -126,7 +125,6 @@ class TreeModel : public QAbstractItemModel
|
||||
|
||||
QModelIndex getIndexForModel(const int modelIndex, QModelIndex parent = QModelIndex());
|
||||
QModelIndex getIndexForCategory(const int categoryIndex);
|
||||
int getAvailableEEpromSize();
|
||||
int getModelIndex(const QModelIndex & index) const;
|
||||
int getCategoryIndex(const QModelIndex & index) const;
|
||||
int rowNumber(const QModelIndex & index = QModelIndex()) const;
|
||||
@@ -153,9 +151,6 @@ class TreeModel : public QAbstractItemModel
|
||||
|
||||
TreeItem * rootItem;
|
||||
RadioData * radioData;
|
||||
int availableEEpromSize;
|
||||
MimeHeaderData mimeHeaderData;
|
||||
bool hasCategories;
|
||||
};
|
||||
|
||||
#endif // _MODELSLIST_H_
|
||||
|
||||
Reference in New Issue
Block a user