From d59e1f135d045a02f548c4f42ee19c3a32ad5b07 Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Sat, 17 Jan 2015 18:04:06 +0100 Subject: [PATCH] Refactored Chat Settings tab - removed heap alloc --- cockatrice/src/dlg_settings.cpp | 9 ++++----- cockatrice/src/dlg_settings.h | 5 +++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cockatrice/src/dlg_settings.cpp b/cockatrice/src/dlg_settings.cpp index 2dae4baa..1e216e63 100644 --- a/cockatrice/src/dlg_settings.cpp +++ b/cockatrice/src/dlg_settings.cpp @@ -572,11 +572,10 @@ void DeckEditorSettingsPage::radioPriceTagSourceClicked(bool checked) MessagesSettingsPage::MessagesSettingsPage() { - chatMentionCheckBox = new QCheckBox; - chatMentionCheckBox->setChecked(settingsCache->getChatMention()); - connect(chatMentionCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setChatMention(int))); + chatMentionCheckBox.setChecked(settingsCache->getChatMention()); + connect(&chatMentionCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setChatMention(int))); QGridLayout *chatGrid = new QGridLayout; - chatGrid->addWidget(chatMentionCheckBox, 0, 0); + chatGrid->addWidget(&chatMentionCheckBox, 0, 0); chatGroupBox = new QGroupBox; chatGroupBox->setLayout(chatGrid); @@ -646,7 +645,7 @@ void MessagesSettingsPage::retranslateUi() aAdd->setText(tr("&Add")); aRemove->setText(tr("&Remove")); chatGroupBox->setTitle(tr("Chat settings")); - chatMentionCheckBox->setText(tr("Enable chat mentions ('@yourusername' in chat log will be highlighted)")); + chatMentionCheckBox.setText(tr("Enable chat mentions ('@yourusername' in chat log will be highlighted)")); messageShortcuts->setTitle(tr("In-game message macros")); } diff --git a/cockatrice/src/dlg_settings.h b/cockatrice/src/dlg_settings.h index 2939911e..b6fd730e 100644 --- a/cockatrice/src/dlg_settings.h +++ b/cockatrice/src/dlg_settings.h @@ -158,8 +158,9 @@ private slots: void actRemove(); private: QListWidget *messageList; - QAction *aAdd, *aRemove; - QCheckBox *chatMentionCheckBox; + QAction *aAdd; + QAction *aRemove; + QCheckBox chatMentionCheckBox; QGroupBox *chatGroupBox; QGroupBox *messageShortcuts;