refactor: Remove most raw accesses into Application (#5104)

This commit is contained in:
pajlada
2024-01-19 17:59:55 +01:00
committed by GitHub
parent 326a402710
commit 4380ef8c5f
82 changed files with 552 additions and 452 deletions
+6 -5
View File
@@ -38,16 +38,17 @@ CommandPage::CommandPage()
LayoutCreator<CommandPage> layoutCreator(this);
auto layout = layoutCreator.setLayoutType<QVBoxLayout>();
EditableModelView *view =
layout.emplace<EditableModelView>(app->commands->createModel(nullptr))
.getElement();
EditableModelView *view = layout
.emplace<EditableModelView>(
app->getCommands()->createModel(nullptr))
.getElement();
view->setTitles({"Trigger", "Command", "Show In\nMessage Menu"});
view->getTableView()->horizontalHeader()->setSectionResizeMode(
1, QHeaderView::Stretch);
// We can safely ignore this signal connection since we own the view
std::ignore = view->addButtonPressed.connect([] {
getApp()->commands->items.append(
getIApp()->getCommands()->items.append(
Command{"/command", "I made a new command HeyGuys"});
});
@@ -66,7 +67,7 @@ CommandPage::CommandPage()
{
if (int index = line.indexOf(' '); index != -1)
{
getApp()->commands->items.insert(
getIApp()->getCommands()->items.insert(
Command(line.mid(0, index), line.mid(index + 1)));
}
}