mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
removed compat functions in SignalVector
This commit is contained in:
parent
e2c493f369
commit
2ebe07bace
17 changed files with 36 additions and 58 deletions
|
@ -98,7 +98,7 @@ public:
|
||||||
/// signals.
|
/// signals.
|
||||||
int append(const T &item, void *caller = nullptr)
|
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)
|
void removeAt(int index, void *caller = nullptr)
|
||||||
|
@ -122,26 +122,6 @@ public:
|
||||||
return this->items_;
|
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()
|
[[deprecated]] std::vector<T> cloneVector()
|
||||||
{
|
{
|
||||||
return *this->readOnly();
|
return *this->readOnly();
|
||||||
|
|
|
@ -153,12 +153,12 @@ public:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int vecRow = this->getVectorIndexFromModelIndex(row);
|
int vecRow = this->getVectorIndexFromModelIndex(row);
|
||||||
this->vector_->removeItem(vecRow, this);
|
this->vector_->removeAt(vecRow, this);
|
||||||
|
|
||||||
assert(this->rows_[row].original);
|
assert(this->rows_[row].original);
|
||||||
TVectorItem item = this->getItemFromRow(
|
TVectorItem item = this->getItemFromRow(
|
||||||
this->rows_[row].items, this->rows_[row].original.get());
|
this->rows_[row].items, this->rows_[row].original.get());
|
||||||
this->vector_->insertItem(item, vecRow, this);
|
this->vector_->insert(item, vecRow, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -225,7 +225,7 @@ public:
|
||||||
void deleteRow(int row)
|
void deleteRow(int row)
|
||||||
{
|
{
|
||||||
int signalVectorRow = this->getVectorIndexFromModelIndex(row);
|
int signalVectorRow = this->getVectorIndexFromModelIndex(row);
|
||||||
this->vector_->removeItem(signalVectorRow);
|
this->vector_->removeAt(signalVectorRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool removeRows(int row, int count, const QModelIndex &parent) override
|
bool removeRows(int row, int count, const QModelIndex &parent) override
|
||||||
|
@ -240,7 +240,7 @@ public:
|
||||||
assert(row >= 0 && row < this->rows_.size());
|
assert(row >= 0 && row < this->rows_.size());
|
||||||
|
|
||||||
int signalVectorRow = this->getVectorIndexFromModelIndex(row);
|
int signalVectorRow = this->getVectorIndexFromModelIndex(row);
|
||||||
this->vector_->removeItem(signalVectorRow);
|
this->vector_->removeAt(signalVectorRow);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -287,8 +287,8 @@ public:
|
||||||
if (from != to)
|
if (from != to)
|
||||||
{
|
{
|
||||||
auto item = this->vector_->raw()[from];
|
auto item = this->vector_->raw()[from];
|
||||||
this->vector_->removeItem(from);
|
this->vector_->removeAt(from);
|
||||||
this->vector_->insertItem(item, to);
|
this->vector_->insert(item, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We return false since we remove items ourselves.
|
// We return false since we remove items ourselves.
|
||||||
|
|
|
@ -9,8 +9,7 @@ namespace chatterino {
|
||||||
AccountController::AccountController()
|
AccountController::AccountController()
|
||||||
{
|
{
|
||||||
this->twitch.accounts.itemInserted.connect([this](const auto &args) {
|
this->twitch.accounts.itemInserted.connect([this](const auto &args) {
|
||||||
this->accounts_.insertItem(
|
this->accounts_.insert(std::dynamic_pointer_cast<Account>(args.item));
|
||||||
std::dynamic_pointer_cast<Account>(args.item));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this->twitch.accounts.itemRemoved.connect([this](const auto &args) {
|
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);
|
auto it = std::find(accs.begin(), accs.end(), args.item);
|
||||||
assert(it != accs.end());
|
assert(it != accs.end());
|
||||||
|
|
||||||
this->accounts_.removeItem(it - accs.begin(), this);
|
this->accounts_.removeAt(it - accs.begin(), this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ void CommandController::initialize(Settings &, Paths &paths)
|
||||||
// of commands)
|
// of commands)
|
||||||
for (const auto &command : this->commandsSetting_->getValue())
|
for (const auto &command : this->commandsSetting_->getValue())
|
||||||
{
|
{
|
||||||
this->items_.appendItem(command);
|
this->items_.append(command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ void IgnoreController::initialize(Settings &, Paths &)
|
||||||
|
|
||||||
for (const IgnorePhrase &phrase : this->ignoresSetting_.getValue())
|
for (const IgnorePhrase &phrase : this->ignoresSetting_.getValue())
|
||||||
{
|
{
|
||||||
this->phrases.appendItem(phrase);
|
this->phrases.append(phrase);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->phrases.delayedItemsChanged.connect([this] { //
|
this->phrases.delayedItemsChanged.connect([this] { //
|
||||||
|
|
|
@ -23,7 +23,7 @@ void ModerationActions::initialize(Settings &settings, Paths &paths)
|
||||||
|
|
||||||
for (auto &val : this->setting_->getValue())
|
for (auto &val : this->setting_->getValue())
|
||||||
{
|
{
|
||||||
this->items.insertItem(val);
|
this->items.insert(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->items.delayedItemsChanged.connect([this] { //
|
this->items.delayedItemsChanged.connect([this] { //
|
||||||
|
|
|
@ -26,12 +26,11 @@ void NotificationController::initialize(Settings &settings, Paths &paths)
|
||||||
this->initialized_ = true;
|
this->initialized_ = true;
|
||||||
for (const QString &channelName : this->twitchSetting_.getValue())
|
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->channelMap[Platform::Twitch].delayedItemsChanged.connect([this] { //
|
||||||
this->twitchSetting_.setValue(
|
this->twitchSetting_.setValue(this->channelMap[Platform::Twitch].raw());
|
||||||
this->channelMap[Platform::Twitch].raw());
|
|
||||||
});
|
});
|
||||||
/*
|
/*
|
||||||
for (const QString &channelName : this->mixerSetting_.getValue()) {
|
for (const QString &channelName : this->mixerSetting_.getValue()) {
|
||||||
|
@ -81,18 +80,18 @@ bool NotificationController::isChannelNotified(const QString &channelName,
|
||||||
void NotificationController::addChannelNotification(const QString &channelName,
|
void NotificationController::addChannelNotification(const QString &channelName,
|
||||||
Platform p)
|
Platform p)
|
||||||
{
|
{
|
||||||
channelMap[p].appendItem(channelName);
|
channelMap[p].append(channelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationController::removeChannelNotification(
|
void NotificationController::removeChannelNotification(
|
||||||
const QString &channelName, Platform p)
|
const QString &channelName, Platform p)
|
||||||
{
|
{
|
||||||
for (std::vector<int>::size_type i = 0;
|
for (std::vector<int>::size_type i = 0; i != channelMap[p].raw().size();
|
||||||
i != channelMap[p].raw().size(); i++)
|
i++)
|
||||||
{
|
{
|
||||||
if (channelMap[p].raw()[i].toLower() == channelName.toLower())
|
if (channelMap[p].raw()[i].toLower() == channelName.toLower())
|
||||||
{
|
{
|
||||||
channelMap[p].removeItem(i);
|
channelMap[p].removeAt(i);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ void PingController::initialize(Settings &settings, Paths &paths)
|
||||||
this->initialized_ = true;
|
this->initialized_ = true;
|
||||||
for (const QString &channelName : this->pingSetting_.getValue())
|
for (const QString &channelName : this->pingSetting_.getValue())
|
||||||
{
|
{
|
||||||
this->channelVector.appendItem(channelName);
|
this->channelVector.append(channelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->channelVector.delayedItemsChanged.connect([this] { //
|
this->channelVector.delayedItemsChanged.connect([this] { //
|
||||||
|
@ -37,7 +37,7 @@ bool PingController::isMuted(const QString &channelName)
|
||||||
|
|
||||||
void PingController::muteChannel(const QString &channelName)
|
void PingController::muteChannel(const QString &channelName)
|
||||||
{
|
{
|
||||||
channelVector.appendItem(channelName);
|
channelVector.append(channelName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PingController::unmuteChannel(const QString &channelName)
|
void PingController::unmuteChannel(const QString &channelName)
|
||||||
|
@ -47,7 +47,7 @@ void PingController::unmuteChannel(const QString &channelName)
|
||||||
{
|
{
|
||||||
if (channelVector.raw()[i].toLower() == channelName.toLower())
|
if (channelVector.raw()[i].toLower() == channelName.toLower())
|
||||||
{
|
{
|
||||||
channelVector.removeItem(i);
|
channelVector.removeAt(i);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -252,7 +252,7 @@ void Irc::load()
|
||||||
{
|
{
|
||||||
ids.insert(data.id);
|
ids.insert(data.id);
|
||||||
|
|
||||||
this->connections.appendItem(data);
|
this->connections.append(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,7 @@ TwitchAccountManager::AddUserResponse TwitchAccountManager::addUser(
|
||||||
|
|
||||||
// std::lock_guard<std::mutex> lock(this->mutex);
|
// std::lock_guard<std::mutex> lock(this->mutex);
|
||||||
|
|
||||||
this->accounts.insertItem(newUser);
|
this->accounts.insert(newUser);
|
||||||
|
|
||||||
return AddUserResponse::UserAdded;
|
return AddUserResponse::UserAdded;
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,7 @@ SelectChannelDialog::SelectChannelDialog(QWidget *parent)
|
||||||
auto editor = new IrcConnectionEditor(unique);
|
auto editor = new IrcConnectionEditor(unique);
|
||||||
if (editor->exec() == QDialog::Accepted)
|
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)
|
if (conn.id == data.id)
|
||||||
{
|
{
|
||||||
Irc::instance().connections.removeItem(
|
Irc::instance().connections.removeAt(
|
||||||
i, Irc::noEraseCredentialCaller);
|
i, Irc::noEraseCredentialCaller);
|
||||||
Irc::instance().connections.insertItem(data, i);
|
Irc::instance().connections.insert(data, i);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,7 +336,7 @@ void UserInfoPopup::installEvents()
|
||||||
|
|
||||||
if (checked)
|
if (checked)
|
||||||
{
|
{
|
||||||
getApp()->highlights->blacklistedUsers.insertItem(
|
getApp()->highlights->blacklistedUsers.insert(
|
||||||
HighlightBlacklistUser{this->userName_, false});
|
HighlightBlacklistUser{this->userName_, false});
|
||||||
this->ui_.ignoreHighlights->setEnabled(true);
|
this->ui_.ignoreHighlights->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ void UserInfoPopup::installEvents()
|
||||||
{
|
{
|
||||||
if (this->userName_ == vector[i].getPattern())
|
if (this->userName_ == vector[i].getPattern())
|
||||||
{
|
{
|
||||||
getApp()->highlights->blacklistedUsers.removeItem(i);
|
getApp()->highlights->blacklistedUsers.removeAt(i);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ CommandPage::CommandPage()
|
||||||
view->setTitles({"Trigger", "Command"});
|
view->setTitles({"Trigger", "Command"});
|
||||||
view->getTableView()->horizontalHeader()->setStretchLastSection(true);
|
view->getTableView()->horizontalHeader()->setStretchLastSection(true);
|
||||||
view->addButtonPressed.connect([] {
|
view->addButtonPressed.connect([] {
|
||||||
getApp()->commands->items_.appendItem(
|
getApp()->commands->items_.append(
|
||||||
Command{"/command", "I made a new command HeyGuys"});
|
Command{"/command", "I made a new command HeyGuys"});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ CommandPage::CommandPage()
|
||||||
{
|
{
|
||||||
if (int index = line.indexOf(' '); index != -1)
|
if (int index = line.indexOf(' '); index != -1)
|
||||||
{
|
{
|
||||||
getApp()->commands->items_.insertItem(
|
getApp()->commands->items_.insert(
|
||||||
Command(line.mid(0, index), line.mid(index + 1)));
|
Command(line.mid(0, index), line.mid(index + 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ HighlightingPage::HighlightingPage()
|
||||||
});
|
});
|
||||||
|
|
||||||
view->addButtonPressed.connect([] {
|
view->addButtonPressed.connect([] {
|
||||||
getApp()->highlights->phrases.appendItem(HighlightPhrase{
|
getApp()->highlights->phrases.append(HighlightPhrase{
|
||||||
"my phrase", true, false, false, false, "",
|
"my phrase", true, false, false, false, "",
|
||||||
*ColorProvider::instance().color(
|
*ColorProvider::instance().color(
|
||||||
ColorType::SelfHighlight)});
|
ColorType::SelfHighlight)});
|
||||||
|
@ -120,7 +120,7 @@ HighlightingPage::HighlightingPage()
|
||||||
});
|
});
|
||||||
|
|
||||||
view->addButtonPressed.connect([] {
|
view->addButtonPressed.connect([] {
|
||||||
getApp()->highlights->highlightedUsers.appendItem(
|
getApp()->highlights->highlightedUsers.append(
|
||||||
HighlightPhrase{"highlighted user", true, false, false,
|
HighlightPhrase{"highlighted user", true, false, false,
|
||||||
false, "",
|
false, "",
|
||||||
*ColorProvider::instance().color(
|
*ColorProvider::instance().color(
|
||||||
|
@ -162,7 +162,7 @@ HighlightingPage::HighlightingPage()
|
||||||
});
|
});
|
||||||
|
|
||||||
view->addButtonPressed.connect([] {
|
view->addButtonPressed.connect([] {
|
||||||
getApp()->highlights->blacklistedUsers.appendItem(
|
getApp()->highlights->blacklistedUsers.append(
|
||||||
HighlightBlacklistUser{"blacklisted user", false});
|
HighlightBlacklistUser{"blacklisted user", false});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ void addPhrasesTab(LayoutCreator<QVBoxLayout> layout)
|
||||||
});
|
});
|
||||||
|
|
||||||
view->addButtonPressed.connect([] {
|
view->addButtonPressed.connect([] {
|
||||||
getApp()->ignores->phrases.appendItem(
|
getApp()->ignores->phrases.append(
|
||||||
IgnorePhrase{"my pattern", false, false,
|
IgnorePhrase{"my pattern", false, false,
|
||||||
getSettings()->ignoredPhraseReplace.getValue(), true});
|
getSettings()->ignoredPhraseReplace.getValue(), true});
|
||||||
});
|
});
|
||||||
|
|
|
@ -184,7 +184,7 @@ ModerationPage::ModerationPage()
|
||||||
0, QHeaderView::Stretch);
|
0, QHeaderView::Stretch);
|
||||||
|
|
||||||
view->addButtonPressed.connect([] {
|
view->addButtonPressed.connect([] {
|
||||||
getApp()->moderationActions->items.appendItem(
|
getApp()->moderationActions->items.append(
|
||||||
ModerationAction("/timeout {user} 300"));
|
ModerationAction("/timeout {user} 300"));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ NotificationPage::NotificationPage()
|
||||||
view->addButtonPressed.connect([] {
|
view->addButtonPressed.connect([] {
|
||||||
getApp()
|
getApp()
|
||||||
->notifications->channelMap[Platform::Twitch]
|
->notifications->channelMap[Platform::Twitch]
|
||||||
.appendItem("channel");
|
.append("channel");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue