(cpn) Remove more un-unsed code, new set. add "Fav" lbl
This commit is contained in:
@@ -37,8 +37,10 @@ public:
|
|||||||
bool insertRows(int row, int count, const QModelIndex &parent) override;
|
bool insertRows(int row, int count, const QModelIndex &parent) override;
|
||||||
bool removeRows(int row, int count, const QModelIndex &parent) override;
|
bool removeRows(int row, int count, const QModelIndex &parent) override;
|
||||||
|
|
||||||
private slots:
|
public slots:
|
||||||
void buildLabelsList();
|
void buildLabelsList();
|
||||||
|
|
||||||
|
private slots:
|
||||||
void modelsSelectionChanged();
|
void modelsSelectionChanged();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@@ -576,19 +576,6 @@ void MdiChild::onCurrentItemChanged(const QModelIndex &, const QModelIndex &)
|
|||||||
void MdiChild::onDataChanged(const QModelIndex & index)
|
void MdiChild::onDataChanged(const QModelIndex & index)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO ***
|
|
||||||
/*if (!modelsListModel->isCategoryType(index))
|
|
||||||
return;
|
|
||||||
|
|
||||||
int categoryIndex = modelsListModel->getCategoryIndex(index);
|
|
||||||
if (categoryIndex < 0 || categoryIndex >= (int)radioData.categories.size()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
strcpy(radioData.categories[categoryIndex].name, modelsListModel->data(index, 0).toString().left(sizeof(CategoryData::name)-1).toStdString().c_str());
|
|
||||||
|
|
||||||
setWindowModified(true);
|
|
||||||
emit modified();*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -600,37 +587,6 @@ QModelIndex MdiChild::getCurrentIndex() const
|
|||||||
return ui->modelsList->selectionModel()->currentIndex();
|
return ui->modelsList->selectionModel()->currentIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*int MdiChild::getCurrentCategory() const
|
|
||||||
{
|
|
||||||
return modelsListModel->getCategoryIndex(getCurrentIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
int MdiChild::countSelectedCats() const
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
foreach (QModelIndex index, ui->modelsList->selectionModel()->selectedRows()) {
|
|
||||||
if (index.isValid() && modelsListModel->isCategoryType(index))
|
|
||||||
++ret;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MdiChild::hasSelectedCat()
|
|
||||||
{
|
|
||||||
return modelsListModel->isCategoryType(getCurrentIndex());
|
|
||||||
}
|
|
||||||
|
|
||||||
QVector<int> MdiChild::getSelectedCategories() const
|
|
||||||
{
|
|
||||||
QVector<int> cats;
|
|
||||||
foreach (QModelIndex index, ui->modelsList->selectionModel()->selectedRows()) {
|
|
||||||
if (index.isValid() && modelsListModel->isCategoryType(index))
|
|
||||||
cats.append(modelsListModel->getCategoryIndex(index));
|
|
||||||
}
|
|
||||||
return cats;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
int MdiChild::getCurrentModel() const
|
int MdiChild::getCurrentModel() const
|
||||||
{
|
{
|
||||||
return modelsListModel->getModelIndex(getCurrentIndex());
|
return modelsListModel->getModelIndex(getCurrentIndex());
|
||||||
@@ -857,7 +813,7 @@ int MdiChild::modelAppend(const ModelData model)
|
|||||||
return newIdx;
|
return newIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int MdiChild::newModel(int modelIndex, int categoryIndex)
|
int MdiChild::newModel(int modelIndex)
|
||||||
{
|
{
|
||||||
if (modelIndex < 0)
|
if (modelIndex < 0)
|
||||||
modelIndex = modelAppend(ModelData());
|
modelIndex = modelAppend(ModelData());
|
||||||
@@ -867,9 +823,6 @@ int MdiChild::newModel(int modelIndex, int categoryIndex)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (categoryIndex < 0)
|
|
||||||
categoryIndex = modelsListModel->getCategoryIndex(getCurrentIndex());
|
|
||||||
|
|
||||||
bool isNewModel = radioData.models[modelIndex].isEmpty();
|
bool isNewModel = radioData.models[modelIndex].isEmpty();
|
||||||
checkAndInitModel(modelIndex);
|
checkAndInitModel(modelIndex);
|
||||||
// Only set the default model if we just added the first one.
|
// Only set the default model if we just added the first one.
|
||||||
@@ -946,33 +899,7 @@ void MdiChild::deleteSelectedModels()
|
|||||||
deleteModels(getSelectedModels());
|
deleteModels(getSelectedModels());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
unsigned MdiChild::countUsedModels()
|
||||||
void MdiChild::moveModelsToCategory(const QVector<int> models, const int toCategoryId)
|
|
||||||
{
|
|
||||||
if (toCategoryId < 0 || !models.size())
|
|
||||||
return;
|
|
||||||
|
|
||||||
bool modified = false;
|
|
||||||
//QVector<int> models = getSelectedModels();
|
|
||||||
foreach(const int model, models) {
|
|
||||||
if (model < 0 || model >= (int)radioData.models.size())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (radioData.models[model].category != toCategoryId) {
|
|
||||||
radioData.models[model].category = toCategoryId;
|
|
||||||
modified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (modified)
|
|
||||||
setModified();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MdiChild::moveSelectedModelsToCat(const int toCategoryId)
|
|
||||||
{
|
|
||||||
moveModelsToCategory(getSelectedModels(), toCategoryId);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
unsigned MdiChild::countUsedModels(const int categoryId)
|
|
||||||
{
|
{
|
||||||
unsigned count = 0;
|
unsigned count = 0;
|
||||||
for (unsigned i=0; i < radioData.models.size(); ++i) {
|
for (unsigned i=0; i < radioData.models.size(); ++i) {
|
||||||
@@ -1226,18 +1153,6 @@ void MdiChild::modelDuplicate()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void MdiChild::onModelMoveToCategory()
|
|
||||||
{
|
|
||||||
if (!sender()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
bool ok = false;
|
|
||||||
int toCatId = sender()->property("categoryId").toInt(&ok);
|
|
||||||
if (ok && toCatId >= 0) {
|
|
||||||
moveSelectedModelsToCat(toCatId);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void MdiChild::modelEdit()
|
void MdiChild::modelEdit()
|
||||||
{
|
{
|
||||||
openModelEditWindow(getCurrentModel());
|
openModelEditWindow(getCurrentModel());
|
||||||
@@ -1333,6 +1248,8 @@ void MdiChild::newFile(bool createDefaults)
|
|||||||
isUntitled = true;
|
isUntitled = true;
|
||||||
curFile = QString("document%1.etx").arg(sequenceNumber++);
|
curFile = QString("document%1.etx").arg(sequenceNumber++);
|
||||||
updateTitle();
|
updateTitle();
|
||||||
|
radioData.addLabel(tr("Favorites"));
|
||||||
|
labelsListModel->buildLabelsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MdiChild::loadFile(const QString & filename, bool resetCurrentFile)
|
bool MdiChild::loadFile(const QString & filename, bool resetCurrentFile)
|
||||||
|
|||||||
@@ -169,11 +169,11 @@ class MdiChild : public QWidget
|
|||||||
void findNewDefaultModel(const unsigned startAt = 0);
|
void findNewDefaultModel(const unsigned startAt = 0);
|
||||||
bool insertModelRows(int atModelIdx, int count);
|
bool insertModelRows(int atModelIdx, int count);
|
||||||
int modelAppend(const ModelData model);
|
int modelAppend(const ModelData model);
|
||||||
int newModel(int modelIndex = -1, int categoryIndex = -1);
|
int newModel(int modelIndex = -1);
|
||||||
unsigned deleteModels(const QVector<int> modelIndices);
|
unsigned deleteModels(const QVector<int> modelIndices);
|
||||||
bool deleteModel(const int modelIndex);
|
bool deleteModel(const int modelIndex);
|
||||||
void deleteSelectedModels();
|
void deleteSelectedModels();
|
||||||
unsigned countUsedModels(const int categoryId = -1);
|
unsigned countUsedModels();
|
||||||
unsigned saveModels(const QVector<int> modelIndices);
|
unsigned saveModels(const QVector<int> modelIndices);
|
||||||
bool saveModel(const int modelIndex);
|
bool saveModel(const int modelIndex);
|
||||||
void saveSelectedModels();
|
void saveSelectedModels();
|
||||||
|
|||||||
Reference in New Issue
Block a user