removed compat functions in SignalVector

This commit is contained in:
fourtf 2020-02-23 19:44:13 +01:00
parent e2c493f369
commit 2ebe07bace
17 changed files with 36 additions and 58 deletions

View file

@ -98,7 +98,7 @@ public:
/// signals.
int append(const T &item, void *caller = nullptr)
{
return this->insertItem(item, -1, caller);
return this->insert(item, -1, caller);
}
void removeAt(int index, void *caller = nullptr)
@ -122,26 +122,6 @@ public:
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();

View file

@ -153,12 +153,12 @@ public:
else
{
int vecRow = this->getVectorIndexFromModelIndex(row);
this->vector_->removeItem(vecRow, this);
this->vector_->removeAt(vecRow, this);
assert(this->rows_[row].original);
TVectorItem item = this->getItemFromRow(
this->rows_[row].items, this->rows_[row].original.get());
this->vector_->insertItem(item, vecRow, this);
this->vector_->insert(item, vecRow, this);
}
return true;
@ -225,7 +225,7 @@ public:
void deleteRow(int row)
{
int signalVectorRow = this->getVectorIndexFromModelIndex(row);
this->vector_->removeItem(signalVectorRow);
this->vector_->removeAt(signalVectorRow);
}
bool removeRows(int row, int count, const QModelIndex &parent) override
@ -240,7 +240,7 @@ public:
assert(row >= 0 && row < this->rows_.size());
int signalVectorRow = this->getVectorIndexFromModelIndex(row);
this->vector_->removeItem(signalVectorRow);
this->vector_->removeAt(signalVectorRow);
return true;
}
@ -287,8 +287,8 @@ public:
if (from != to)
{
auto item = this->vector_->raw()[from];
this->vector_->removeItem(from);
this->vector_->insertItem(item, to);
this->vector_->removeAt(from);
this->vector_->insert(item, to);
}
// We return false since we remove items ourselves.

View file

@ -9,8 +9,7 @@ namespace chatterino {
AccountController::AccountController()
{
this->twitch.accounts.itemInserted.connect([this](const auto &args) {
this->accounts_.insertItem(
std::dynamic_pointer_cast<Account>(args.item));
this->accounts_.insert(std::dynamic_pointer_cast<Account>(args.item));
});
this->twitch.accounts.itemRemoved.connect([this](const auto &args) {
@ -20,7 +19,7 @@ AccountController::AccountController()
auto it = std::find(accs.begin(), accs.end(), args.item);
assert(it != accs.end());
this->accounts_.removeItem(it - accs.begin(), this);
this->accounts_.removeAt(it - accs.begin(), this);
}
});

View file

@ -222,7 +222,7 @@ void CommandController::initialize(Settings &, Paths &paths)
// of commands)
for (const auto &command : this->commandsSetting_->getValue())
{
this->items_.appendItem(command);
this->items_.append(command);
}
}

View file

@ -14,7 +14,7 @@ void IgnoreController::initialize(Settings &, Paths &)
for (const IgnorePhrase &phrase : this->ignoresSetting_.getValue())
{
this->phrases.appendItem(phrase);
this->phrases.append(phrase);
}
this->phrases.delayedItemsChanged.connect([this] { //

View file

@ -23,7 +23,7 @@ void ModerationActions::initialize(Settings &settings, Paths &paths)
for (auto &val : this->setting_->getValue())
{
this->items.insertItem(val);
this->items.insert(val);
}
this->items.delayedItemsChanged.connect([this] { //

View file

@ -26,12 +26,11 @@ void NotificationController::initialize(Settings &settings, Paths &paths)
this->initialized_ = true;
for (const QString &channelName : this->twitchSetting_.getValue())
{
this->channelMap[Platform::Twitch].appendItem(channelName);
this->channelMap[Platform::Twitch].append(channelName);
}
this->channelMap[Platform::Twitch].delayedItemsChanged.connect([this] { //
this->twitchSetting_.setValue(
this->channelMap[Platform::Twitch].raw());
this->twitchSetting_.setValue(this->channelMap[Platform::Twitch].raw());
});
/*
for (const QString &channelName : this->mixerSetting_.getValue()) {
@ -81,18 +80,18 @@ bool NotificationController::isChannelNotified(const QString &channelName,
void NotificationController::addChannelNotification(const QString &channelName,
Platform p)
{
channelMap[p].appendItem(channelName);
channelMap[p].append(channelName);
}
void NotificationController::removeChannelNotification(
const QString &channelName, Platform p)
{
for (std::vector<int>::size_type i = 0;
i != channelMap[p].raw().size(); i++)
for (std::vector<int>::size_type i = 0; i != channelMap[p].raw().size();
i++)
{
if (channelMap[p].raw()[i].toLower() == channelName.toLower())
{
channelMap[p].removeItem(i);
channelMap[p].removeAt(i);
i--;
}
}

View file

@ -8,7 +8,7 @@ void PingController::initialize(Settings &settings, Paths &paths)
this->initialized_ = true;
for (const QString &channelName : this->pingSetting_.getValue())
{
this->channelVector.appendItem(channelName);
this->channelVector.append(channelName);
}
this->channelVector.delayedItemsChanged.connect([this] { //
@ -37,7 +37,7 @@ bool PingController::isMuted(const QString &channelName)
void PingController::muteChannel(const QString &channelName)
{
channelVector.appendItem(channelName);
channelVector.append(channelName);
}
void PingController::unmuteChannel(const QString &channelName)
@ -47,7 +47,7 @@ void PingController::unmuteChannel(const QString &channelName)
{
if (channelVector.raw()[i].toLower() == channelName.toLower())
{
channelVector.removeItem(i);
channelVector.removeAt(i);
i--;
}
}

View file

@ -252,7 +252,7 @@ void Irc::load()
{
ids.insert(data.id);
this->connections.appendItem(data);
this->connections.append(data);
}
}
}

View file

@ -221,7 +221,7 @@ TwitchAccountManager::AddUserResponse TwitchAccountManager::addUser(
// std::lock_guard<std::mutex> lock(this->mutex);
this->accounts.insertItem(newUser);
this->accounts.insert(newUser);
return AddUserResponse::UserAdded;
}

View file

@ -152,7 +152,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
auto editor = new IrcConnectionEditor(unique);
if (editor->exec() == QDialog::Accepted)
{
Irc::instance().connections.appendItem(editor->data());
Irc::instance().connections.append(editor->data());
}
});
@ -171,9 +171,9 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
{
if (conn.id == data.id)
{
Irc::instance().connections.removeItem(
Irc::instance().connections.removeAt(
i, Irc::noEraseCredentialCaller);
Irc::instance().connections.insertItem(data, i);
Irc::instance().connections.insert(data, i);
}
i++;
}

View file

@ -336,7 +336,7 @@ void UserInfoPopup::installEvents()
if (checked)
{
getApp()->highlights->blacklistedUsers.insertItem(
getApp()->highlights->blacklistedUsers.insert(
HighlightBlacklistUser{this->userName_, false});
this->ui_.ignoreHighlights->setEnabled(true);
}
@ -349,7 +349,7 @@ void UserInfoPopup::installEvents()
{
if (this->userName_ == vector[i].getPattern())
{
getApp()->highlights->blacklistedUsers.removeItem(i);
getApp()->highlights->blacklistedUsers.removeAt(i);
i--;
}
}

View file

@ -46,7 +46,7 @@ CommandPage::CommandPage()
view->setTitles({"Trigger", "Command"});
view->getTableView()->horizontalHeader()->setStretchLastSection(true);
view->addButtonPressed.connect([] {
getApp()->commands->items_.appendItem(
getApp()->commands->items_.append(
Command{"/command", "I made a new command HeyGuys"});
});
@ -65,7 +65,7 @@ CommandPage::CommandPage()
{
if (int index = line.indexOf(' '); index != -1)
{
getApp()->commands->items_.insertItem(
getApp()->commands->items_.insert(
Command(line.mid(0, index), line.mid(index + 1)));
}
}

View file

@ -72,7 +72,7 @@ HighlightingPage::HighlightingPage()
});
view->addButtonPressed.connect([] {
getApp()->highlights->phrases.appendItem(HighlightPhrase{
getApp()->highlights->phrases.append(HighlightPhrase{
"my phrase", true, false, false, false, "",
*ColorProvider::instance().color(
ColorType::SelfHighlight)});
@ -120,7 +120,7 @@ HighlightingPage::HighlightingPage()
});
view->addButtonPressed.connect([] {
getApp()->highlights->highlightedUsers.appendItem(
getApp()->highlights->highlightedUsers.append(
HighlightPhrase{"highlighted user", true, false, false,
false, "",
*ColorProvider::instance().color(
@ -162,7 +162,7 @@ HighlightingPage::HighlightingPage()
});
view->addButtonPressed.connect([] {
getApp()->highlights->blacklistedUsers.appendItem(
getApp()->highlights->blacklistedUsers.append(
HighlightBlacklistUser{"blacklisted user", false});
});
}

View file

@ -60,7 +60,7 @@ void addPhrasesTab(LayoutCreator<QVBoxLayout> layout)
});
view->addButtonPressed.connect([] {
getApp()->ignores->phrases.appendItem(
getApp()->ignores->phrases.append(
IgnorePhrase{"my pattern", false, false,
getSettings()->ignoredPhraseReplace.getValue(), true});
});

View file

@ -184,7 +184,7 @@ ModerationPage::ModerationPage()
0, QHeaderView::Stretch);
view->addButtonPressed.connect([] {
getApp()->moderationActions->items.appendItem(
getApp()->moderationActions->items.append(
ModerationAction("/timeout {user} 300"));
});

View file

@ -100,7 +100,7 @@ NotificationPage::NotificationPage()
view->addButtonPressed.connect([] {
getApp()
->notifications->channelMap[Platform::Twitch]
.appendItem("channel");
.append("channel");
});
}
/*