diff options
-rwxr-xr-x | indra/llui/llcommandmanager.cpp | 19 | ||||
-rwxr-xr-x | indra/llui/llcommandmanager.h | 1 | ||||
-rwxr-xr-x | indra/newview/app_settings/commands.xml | 6 | ||||
-rwxr-xr-x | indra/newview/app_settings/settings.xml | 22 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.cpp | 22 | ||||
-rwxr-xr-x | indra/newview/llmarketplacefunctions.h | 1 | ||||
-rwxr-xr-x | indra/newview/llstartup.cpp | 8 | ||||
-rwxr-xr-x | indra/newview/lltoolmgr.cpp | 20 | ||||
-rwxr-xr-x | indra/newview/lltoolmgr.h | 2 | ||||
-rwxr-xr-x | indra/newview/llviewermenu.cpp | 33 | ||||
-rwxr-xr-x | indra/newview/llviewermenu.h | 1 |
11 files changed, 118 insertions, 17 deletions
diff --git a/indra/llui/llcommandmanager.cpp b/indra/llui/llcommandmanager.cpp index 74ef8dd0c3..3e159365e5 100755 --- a/indra/llui/llcommandmanager.cpp +++ b/indra/llui/llcommandmanager.cpp @@ -131,6 +131,25 @@ LLCommand * LLCommandManager::getCommand(const LLCommandId& commandId) return command_match; } +LLCommand * LLCommandManager::getCommand(const std::string& name) +{ + LLCommand * command_match = NULL; + + CommandVector::const_iterator it = mCommands.begin(); + + while (it != mCommands.end()) + { + if ((*it)->name() == name) + { + command_match = *it; + break; + } + it++; + } + + return command_match; +} + void LLCommandManager::addCommand(LLCommand * command) { LLCommandId command_id = command->id(); diff --git a/indra/llui/llcommandmanager.h b/indra/llui/llcommandmanager.h index ff5a8a3257..f2f2145953 100755 --- a/indra/llui/llcommandmanager.h +++ b/indra/llui/llcommandmanager.h @@ -190,6 +190,7 @@ public: U32 commandCount() const; LLCommand * getCommand(U32 commandIndex); LLCommand * getCommand(const LLCommandId& commandId); + LLCommand * getCommand(const std::string& name); static bool load(); diff --git a/indra/newview/app_settings/commands.xml b/indra/newview/app_settings/commands.xml index 9b12254ce3..2cd6638042 100755 --- a/indra/newview/app_settings/commands.xml +++ b/indra/newview/app_settings/commands.xml @@ -123,8 +123,10 @@ icon="Command_MktListings_Icon" label_ref="Command_MarketplaceListings_Label" tooltip_ref="Command_MarketplaceListings_Tooltip" - execute_function="Floater.ToggleOrBringToFront" - execute_parameters="marketplace_listings" + execute_function="Marketplace.Toggle" + execute_parameters="marketplace" + is_enabled_function="Marketplace.Enabled" + is_enabled_parameters="marketplace" is_running_function="Floater.IsOpen" is_running_parameters="marketplace_listings" /> diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index abe477f38d..a666c72686 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4621,17 +4621,6 @@ <key>Value</key> <integer>0</integer> </map> - <key>InventoryDisplayOutbox</key> - <map> - <key>Comment</key> - <string>Override merchant inventory outbox display</string> - <key>Persist</key> - <integer>0</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> <key>InventoryInboxToggleState</key> <map> <key>Comment</key> @@ -4654,6 +4643,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>InventoryOutboxDisplayBoth</key> + <map> + <key>Comment</key> + <string>Show the legacy Merchant Outbox UI as well as the Marketplace Listings UI</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>InventoryOutboxLogging</key> <map> <key>Comment</key> diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 794bb62834..58a946e4e4 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -153,6 +153,11 @@ protected: log_SLM_infos("Get /merchant", getStatus(), "User is not a merchant"); LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_PLACE_NOT_MERCHANT); } + else if (HTTP_SERVICE_UNAVAILABLE == getStatus()) + { + log_SLM_infos("Get /merchant", getStatus(), "Merchant is not migrated"); + LLMarketplaceData::instance().setSLMStatus(MarketplaceStatusCodes::MARKET_MERCHANT_NOT_MIGRATED); + } else { log_SLM_warning("Get /merchant", getStatus(), getReason(), getContent().get("error_code"), getContent().get("error_description")); @@ -1133,16 +1138,25 @@ LLMarketplaceData::~LLMarketplaceData() void LLMarketplaceData::initializeSLM(const status_updated_signal_t::slot_type& cb) { - mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING; if (mStatusUpdatedSignal == NULL) { mStatusUpdatedSignal = new status_updated_signal_t(); } mStatusUpdatedSignal->connect(cb); - std::string url = getSLMConnectURL("/merchant"); - log_SLM_infos("LLHTTPClient::get", url, ""); - LLHTTPClient::get(url, new LLSLMGetMerchantResponder(), LLSD()); + if (mMarketPlaceStatus != MarketplaceStatusCodes::MARKET_PLACE_NOT_INITIALIZED) + { + // If already initialized, just confirm the status so the callback gets called + setSLMStatus(mMarketPlaceStatus); + } + else + { + // Initiate SLM connection and set responder + mMarketPlaceStatus = MarketplaceStatusCodes::MARKET_PLACE_INITIALIZING; + std::string url = getSLMConnectURL("/merchant"); + log_SLM_infos("LLHTTPClient::get", url, ""); + LLHTTPClient::get(url, new LLSLMGetMerchantResponder(), LLSD()); + } } // Get/Post/Put requests to the SLM Server using the SLM API diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h index d9e222e05d..ae58f5fc3c 100755 --- a/indra/newview/llmarketplacefunctions.h +++ b/indra/newview/llmarketplacefunctions.h @@ -68,6 +68,7 @@ namespace MarketplaceStatusCodes MARKET_PLACE_CONNECTION_FAILURE = 2, MARKET_PLACE_MERCHANT = 3, MARKET_PLACE_NOT_MERCHANT = 4, + MARKET_MERCHANT_NOT_MIGRATED = 5 }; } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 74df18810c..77a5f4989b 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1875,6 +1875,14 @@ bool idle_startup() } display_startup(); + + // Init SLM Marketplace connection so we know which UI should be used for the user as a merchant + // Note: Eventually, all merchant will be migrated to the new SLM system and there will be no + // reason to show the old UI at all. + // *TODO : Suppress the Merchant Outbox UI completely + check_merchant_status(); + + display_startup(); if (gSavedSettings.getBOOL("HelpFloaterOpen")) { diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index 175227173f..f040a28837 100755 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -37,6 +37,7 @@ #include "llfloaterinspect.h" #include "lltool.h" #include "llmanipscale.h" +#include "llmarketplacefunctions.h" #include "llselectmgr.h" #include "lltoolbrush.h" #include "lltoolcomp.h" @@ -83,6 +84,8 @@ LLToolMgr::LLToolMgr() LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Active", boost::bind(&LLToolMgr::inEdit, this)); LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Build.Enabled", boost::bind(&LLToolMgr::canEdit, this)); LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Build.Toggle", boost::bind(&LLToolMgr::toggleBuildMode, this, _2)); + LLUICtrl::EnableCallbackRegistry::currentRegistrar().add("Marketplace.Enabled", boost::bind(&LLToolMgr::canAccessMarketplace, this)); + LLUICtrl::CommitCallbackRegistry::currentRegistrar().add("Marketplace.Toggle", boost::bind(&LLToolMgr::toggleMarketplace, this, _2)); gToolNull = new LLTool(LLStringUtil::null); // Does nothing setCurrentTool(gToolNull); @@ -345,6 +348,23 @@ bool LLToolMgr::inBuildMode() return b; } +bool LLToolMgr::canAccessMarketplace() +{ + return (LLMarketplaceData::instance().getSLMStatus() != MarketplaceStatusCodes::MARKET_MERCHANT_NOT_MIGRATED) || gSavedSettings.getBOOL("InventoryOutboxDisplayBoth"); +} + +void LLToolMgr::toggleMarketplace(const LLSD& sdname) +{ + const std::string& param = sdname.asString(); + + if ((param != "marketplace") || !canAccessMarketplace()) + { + return; + } + + LLFloaterReg::toggleInstanceOrBringToFront("marketplace_listings"); +} + void LLToolMgr::setTransientTool(LLTool* tool) { if (!tool) diff --git a/indra/newview/lltoolmgr.h b/indra/newview/lltoolmgr.h index e7d1c56c83..a3c1045aac 100755 --- a/indra/newview/lltoolmgr.h +++ b/indra/newview/lltoolmgr.h @@ -54,7 +54,9 @@ public: bool inEdit(); bool canEdit(); + bool canAccessMarketplace(); void toggleBuildMode(const LLSD& sdname); + void toggleMarketplace(const LLSD& sdname); /* Determines if we are in Build mode or not. */ bool inBuildMode(); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 38aaff9279..613ad00809 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -88,6 +88,7 @@ #include "llinventoryfunctions.h" #include "llpanellogin.h" #include "llpanelblockedlist.h" +#include "llmarketplacefunctions.h" #include "llmenuoptionpathfindingrebakenavmesh.h" #include "llmoveview.h" #include "llparcel.h" @@ -98,6 +99,7 @@ #include "llspellcheckmenuhandler.h" #include "llstatusbar.h" #include "lltextureview.h" +#include "lltoolbarview.h" #include "lltoolcomp.h" #include "lltoolmgr.h" #include "lltoolpie.h" @@ -386,6 +388,37 @@ void set_underclothes_menu_options() } } +void set_merchant_menu() +{ + if (LLMarketplaceData::instance().getSLMStatus() == MarketplaceStatusCodes::MARKET_MERCHANT_NOT_MIGRATED) + { + // Merchant not migrated: show only the old Merchant Outbox menu + gMenuHolder->getChild<LLView>("MerchantOutbox")->setVisible(TRUE); + } + else + { + // All other cases (new merchant, not merchant, migrated merchant): show the new Marketplace Listings menu and enable the tool + gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(TRUE); + LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings"); + gToolBarView->enableCommand(command->id(), true); + } +} + +void check_merchant_status() +{ + if (!gSavedSettings.getBOOL("InventoryOutboxDisplayBoth")) + { + // Hide both merchant related menu items + gMenuHolder->getChild<LLView>("MerchantOutbox")->setVisible(FALSE); + gMenuHolder->getChild<LLView>("MarketplaceListings")->setVisible(FALSE); + // Also disable the toolbar button for Marketplace Listings + LLCommand* command = LLCommandManager::instance().getCommand("marketplacelistings"); + gToolBarView->enableCommand(command->id(), false); + // Launch an SLM test connection to get the merchant status + LLMarketplaceData::instance().initializeSLM(boost::bind(&set_merchant_menu)); + } +} + void init_menus() { // Initialize actions diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 7f09fc2d8f..b7bdf00157 100755 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -83,6 +83,7 @@ BOOL enable_god_full(void* user_data); BOOL enable_god_liaison(void* user_data); BOOL enable_god_basic(void* user_data); void set_underclothes_menu_options(); +void check_merchant_status(); void exchange_callingcard(const LLUUID& dest_id); |