From 456e03c0e942e8082f1fd67c6f852524fe300710 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 14 Jun 2015 17:53:34 +0300 Subject: Rename CREATEWIDGET* macroses. --- src/gui/dialogsmanager.cpp | 12 ++++++------ src/gui/widgets/createwidget.h | 8 ++++---- src/gui/windowmanager.cpp | 18 +++++++++--------- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/gui') diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp index 6604d0586..745ef2cc2 100644 --- a/src/gui/dialogsmanager.cpp +++ b/src/gui/dialogsmanager.cpp @@ -85,7 +85,7 @@ void DialogsManager::closeDialogs() void DialogsManager::createUpdaterWindow() { - CREATEWIDGET(updaterWindow, UpdaterWindow, + CREATEWIDGETV(updaterWindow, UpdaterWindow, settings.updateHost, settings.oldUpdates, false, @@ -98,7 +98,7 @@ Window *DialogsManager::openErrorDialog(const std::string &header, { if (settings.supportUrl.empty() || config.getBoolValue("hidesupport")) { - OkDialog *const dialog = CREATEWIDGET2(OkDialog, + OkDialog *const dialog = CREATEWIDGETR(OkDialog, header, message, // TRANSLATORS: ok dialog button @@ -112,7 +112,7 @@ Window *DialogsManager::openErrorDialog(const std::string &header, } else { - ConfirmDialog *const dialog = CREATEWIDGET2(ConfirmDialog, + ConfirmDialog *const dialog = CREATEWIDGETR(ConfirmDialog, header, strprintf("%s %s", message.c_str(), // TRANSLATORS: error message question @@ -129,7 +129,7 @@ void DialogsManager::playerDeath() if (!deathNotice) { // TRANSLATORS: message header - CREATEWIDGET(deathNotice, OkDialog, + CREATEWIDGETV(deathNotice, OkDialog, _("Message"), DeadDB::getRandomString(), // TRANSLATORS: ok dialog button @@ -157,7 +157,7 @@ void DialogsManager::attributeChanged(const AttributesT id, if (newVal >= max && total < max) { weightNoticeTime = cur_time + 5; - CREATEWIDGET(weightNotice, OkDialog, + CREATEWIDGETV(weightNotice, OkDialog, // TRANSLATORS: message header _("Message"), // TRANSLATORS: weight message @@ -177,7 +177,7 @@ void DialogsManager::attributeChanged(const AttributesT id, else if (newVal < max && total >= max) { weightNoticeTime = cur_time + 5; - CREATEWIDGET(weightNotice, OkDialog, + CREATEWIDGETV(weightNotice, OkDialog, // TRANSLATORS: message header _("Message"), // TRANSLATORS: weight message diff --git a/src/gui/widgets/createwidget.h b/src/gui/widgets/createwidget.h index 70722a9e3..54d92d2cb 100644 --- a/src/gui/widgets/createwidget.h +++ b/src/gui/widgets/createwidget.h @@ -21,18 +21,18 @@ #ifndef GUI_WIDGETS_CREATEWIDGET_H #define GUI_WIDGETS_CREATEWIDGET_H -#define CREATEWIDGET(var, type, ...) \ +#define CREATEWIDGETV(var, type, ...) \ var = new type(__VA_ARGS__); \ var->postInit() -#define CREATEWIDGET0(type, ...) \ +#define CREATEWIDGET(type, ...) \ (new type(__VA_ARGS__))->postInit() -#define CREATEWIDGET1(var, type) \ +#define CREATEWIDGETV0(var, type) \ var = new type; \ var->postInit() -#define CREATEWIDGET2(type, ...) \ +#define CREATEWIDGETR(type, ...) \ static_cast(Widget::callPostInit(new type(__VA_ARGS__))) #define CREATEWIDGETR0(type) \ diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index 6f1f223bc..d61ffea6e 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -95,15 +95,15 @@ void WindowManager::init() void WindowManager::createWindows() { userPalette = new UserPalette; - CREATEWIDGET1(setupWindow, SetupWindow); - CREATEWIDGET1(helpWindow, HelpWindow); - CREATEWIDGET1(didYouKnowWindow, DidYouKnowWindow); - CREATEWIDGET1(popupMenu, PopupMenu); - CREATEWIDGET1(beingPopup, BeingPopup); - CREATEWIDGET1(textPopup, TextPopup); - CREATEWIDGET1(textBoxPopup, TextBoxPopup); - CREATEWIDGET1(itemPopup, ItemPopup); - CREATEWIDGET1(spellPopup, SpellPopup); + CREATEWIDGETV0(setupWindow, SetupWindow); + CREATEWIDGETV0(helpWindow, HelpWindow); + CREATEWIDGETV0(didYouKnowWindow, DidYouKnowWindow); + CREATEWIDGETV0(popupMenu, PopupMenu); + CREATEWIDGETV0(beingPopup, BeingPopup); + CREATEWIDGETV0(textPopup, TextPopup); + CREATEWIDGETV0(textBoxPopup, TextBoxPopup); + CREATEWIDGETV0(itemPopup, ItemPopup); + CREATEWIDGETV0(spellPopup, SpellPopup); } void WindowManager::deleteWindows() -- cgit v1.2.3-60-g2f50