diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-14 20:31:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-14 20:31:31 +0300 |
commit | 43fbbfe4a5a0f1027847208ce8255a566eee09ad (patch) | |
tree | 09d2e5419b6c6ec5e2d0c451c26d0376005801f7 /src | |
parent | cf6339994460d9cb58bcf2c4ea55d2299fecd9bf (diff) | |
download | mv-43fbbfe4a5a0f1027847208ce8255a566eee09ad.tar.gz mv-43fbbfe4a5a0f1027847208ce8255a566eee09ad.tar.bz2 mv-43fbbfe4a5a0f1027847208ce8255a566eee09ad.tar.xz mv-43fbbfe4a5a0f1027847208ce8255a566eee09ad.zip |
Use CREATEWIDGET macro in shopwindow.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/windows/shopwindow.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index 9e45a9b71..b8e31ead8 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -44,6 +44,7 @@ #include "gui/widgets/button.h" #include "gui/widgets/checkbox.h" #include "gui/widgets/containerplacer.h" +#include "gui/widgets/createwidget.h" #include "gui/widgets/layout.h" #include "gui/widgets/layouttype.h" #include "gui/widgets/scrollarea.h" @@ -112,8 +113,10 @@ ShopWindow::ShopWindow() : mBuyShopItems(new ShopItems), mSellShopItems(new ShopItems), mTradeItem(nullptr), - mBuyShopItemList(new ShopListBox(this, mBuyShopItems, mBuyShopItems)), - mSellShopItemList(new ShopListBox(this, mSellShopItems, mSellShopItems)), + mBuyShopItemList(CREATEWIDGETR(ShopListBox, + this, mBuyShopItems, mBuyShopItems)), + mSellShopItemList(CREATEWIDGETR(ShopListBox, + this, mSellShopItems, mSellShopItems)), mCurrentShopItemList(nullptr), mScrollArea(new ScrollArea(this, mBuyShopItemList, getOptionBool("showbuybackground"), "shop_buy_background.xml")), @@ -142,9 +145,6 @@ ShopWindow::ShopWindow() : mEnableBuyingStore(false), mEnableVending(false) { - mBuyShopItemList->postInit(); - mSellShopItemList->postInit(); - setWindowName("Personal Shop"); setResizable(true); setCloseButton(true); @@ -368,9 +368,11 @@ void ShopWindow::action(const ActionEvent &event) } else if (eventId == "rename") { - EditDialog *const dialog = new EditDialog( - _("Please enter new shop name"), mSellShopName, "OK"); - dialog->postInit(); + EditDialog *const dialog = CREATEWIDGETR(EditDialog, + // TRANSLATORS: shop rename dialog title + _("Please enter new shop name"), + mSellShopName, + "OK"); shopRenameListener.setDialog(dialog); dialog->addActionListener(&shopRenameListener); } @@ -811,14 +813,12 @@ void ShopWindow::showList(const std::string &nick, std::string data) if (data.find("B1") == 0) { data = data.substr(2); - buyDialog = new BuyDialog(nick); - buyDialog->postInit(); + CREATEWIDGETV(buyDialog, BuyDialog, nick); } else if (data.find("S1") == 0) { data = data.substr(2); - sellDialog = new ShopSellDialog(nick); - sellDialog->postInit(); + CREATEWIDGETV(sellDialog, ShopSellDialog, nick); } else { @@ -954,15 +954,14 @@ void ShopWindow::processRequest(const std::string &nick, std::string data, } else { - ConfirmDialog *const confirmDlg = new ConfirmDialog + ConfirmDialog *const confirmDlg = CREATEWIDGETR(ConfirmDialog, // TRANSLATORS: shop window dialog - (_("Request for Trade"), + _("Request for Trade"), strprintf(_("%s wants to %s %s do you accept?"), nick.c_str(), msg.c_str(), mTradeItem->getInfo().getName().c_str()), SOUND_REQUEST, true); - confirmDlg->postInit(); confirmDlg->addActionListener(this); } } |