some more refactoring

This commit is contained in:
fourtf
2020-02-23 17:45:59 +01:00
parent e1838154ff
commit 4a5dc80bc6
12 changed files with 62 additions and 75 deletions
+21 -18
View File
@@ -115,30 +115,33 @@ public:
this->itemsChanged_();
}
// compatability
[[deprecated]] int insertItem(const T &item, int proposedIndex = -1,
void *caller = nullptr)
{
return this->insert(item, proposedIndex, caller);
}
[[deprecated]] int appendItem(const T &item, void *caller = nullptr)
{
return this->append(item, caller);
}
[[deprecated]] void removeItem(int index, void *caller = nullptr)
{
this->removeAt(index, caller);
}
[[deprecated]] const std::vector<T> &getVector() const
const std::vector<T> &raw() const
{
assertInGuiThread();
return this->items_;
}
// compatability
[[deprecated("use insert")]] int insertItem(const T &item,
int proposedIndex = -1,
void *caller = nullptr)
{
return this->insert(item, proposedIndex, caller);
}
[[deprecated("use append")]] int appendItem(const T &item,
void *caller = nullptr)
{
return this->append(item, caller);
}
[[deprecated("use removeAt")]] void removeItem(int index,
void *caller = nullptr)
{
this->removeAt(index, caller);
}
[[deprecated]] std::vector<T> cloneVector()
{
return *this->readOnly();
+4 -4
View File
@@ -52,7 +52,7 @@ public:
};
int i = 0;
for (const TVectorItem &item : vec->getVector())
for (const TVectorItem &item : vec->raw())
{
SignalVectorItemArgs<TVectorItem> args{item, i++, 0};
@@ -272,15 +272,15 @@ public:
int from = data->data("chatterino_row_id").toInt();
int to = parent.row();
if (from < 0 || from > this->vector_->getVector().size() ||
to < 0 || to > this->vector_->getVector().size())
if (from < 0 || from > this->vector_->raw().size() ||
to < 0 || to > this->vector_->raw().size())
{
return false;
}
if (from != to)
{
auto item = this->vector_->getVector()[from];
auto item = this->vector_->raw()[from];
this->vector_->removeItem(from);
this->vector_->insertItem(item, to);
}