diff options
26 files changed, 612 insertions, 149 deletions
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 0ed700b9da..0272c55db2 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -775,33 +775,6 @@ void LLMemoryInfo::stream(std::ostream& s) const #endif } -S32 LLDisplayInfo::getDisplayWidth() const -{ -#if LL_WINDOWS - return ::GetSystemMetrics(SM_CXVIRTUALSCREEN); -#elif LL_DARWIN - return 1024; //*FIXME -#elif LL_SOLARIS - return 1024; //*FIXME -#else - return 1024; //*FIXME -#endif -} - -S32 LLDisplayInfo::getDisplayHeight() const -{ -#if LL_WINDOWS - return ::GetSystemMetrics(SM_CYVIRTUALSCREEN); -#elif LL_DARWIN - return 768; //*FIXME -#elif LL_SOLARIS - return 768; //*FIXME -#else - return 768; //*FIXME -#endif -} - - std::ostream& operator<<(std::ostream& s, const LLOSInfo& info) { info.stream(s); diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index aa3fdd485b..f1dda1b2e2 100644 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -122,22 +122,6 @@ public: U32 getPhysicalMemoryClamped() const; ///< Memory size in clamped bytes }; -//============================================================================= -// -// CLASS LLDisplayInfo -class LL_COMMON_API LLDisplayInfo - -/*! @brief Class to query the information about some display settings -*/ -{ -public: - LLDisplayInfo(){}; ///< Default constructor - - S32 getDisplayWidth() const; ///< display width - S32 getDisplayHeight() const; ///< display height - -}; - LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLOSInfo& info); LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLCPUInfo& info); LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLMemoryInfo& info); diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index ce25ee32b3..c1d512e148 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -323,15 +323,19 @@ void LLComboBox::setValue(const LLSD& value) LLScrollListItem* item = mList->getFirstSelected(); if (item) { - setLabel( mList->getSelectedItemLabel() ); + setLabel(getSelectedItemLabel()); } mLastSelectedIndex = mList->getFirstSelectedIndex(); } + else + { + mLastSelectedIndex = -1; + } } const std::string LLComboBox::getSimple() const { - const std::string res = mList->getSelectedItemLabel(); + const std::string res = getSelectedItemLabel(); if (res.empty() && mAllowTextEntry) { return mTextEntry->getText(); @@ -410,7 +414,7 @@ BOOL LLComboBox::remove(S32 index) if (index < mList->getItemCount()) { mList->deleteSingleItem(index); - setLabel(mList->getSelectedItemLabel()); + setLabel(getSelectedItemLabel()); return TRUE; } return FALSE; @@ -451,7 +455,7 @@ BOOL LLComboBox::setCurrentByIndex( S32 index ) BOOL found = mList->selectNthItem( index ); if (found) { - setLabel(mList->getSelectedItemLabel()); + setLabel(getSelectedItemLabel()); mLastSelectedIndex = index; } return found; @@ -904,7 +908,7 @@ void LLComboBox::updateSelection() } else if (mList->selectItemByPrefix(left_wstring, FALSE)) { - LLWString selected_item = utf8str_to_wstring(mList->getSelectedItemLabel()); + LLWString selected_item = utf8str_to_wstring(getSelectedItemLabel()); LLWString wtext = left_wstring + selected_item.substr(left_wstring.size(), selected_item.size()); mTextEntry->setText(wstring_to_utf8str(wtext)); mTextEntry->setSelection(left_wstring.size(), mTextEntry->getWText().size()); @@ -1006,7 +1010,7 @@ BOOL LLComboBox::setCurrentByID(const LLUUID& id) if (found) { - setLabel(mList->getSelectedItemLabel()); + setLabel(getSelectedItemLabel()); mLastSelectedIndex = mList->getFirstSelectedIndex(); } @@ -1022,7 +1026,7 @@ BOOL LLComboBox::setSelectedByValue(const LLSD& value, BOOL selected) BOOL found = mList->setSelectedByValue(value, selected); if (found) { - setLabel(mList->getSelectedItemLabel()); + setLabel(getSelectedItemLabel()); } return found; } @@ -1084,10 +1088,19 @@ void LLIconsComboBox::setValue(const LLSD& value) LLScrollListItem* item = mList->getFirstSelected(); if (item) { - mButton->setImageOverlay(mList->getSelectedItemLabel(mIconColumnIndex), mButton->getImageOverlayHAlign()); - - setLabel(mList->getSelectedItemLabel(mLabelColumnIndex)); + setLabel(getSelectedItemLabel()); } mLastSelectedIndex = mList->getFirstSelectedIndex(); } + else + { + mLastSelectedIndex = -1; + } +} + +const std::string LLIconsComboBox::getSelectedItemLabel(S32 column) const +{ + mButton->setImageOverlay(LLComboBox::getSelectedItemLabel(mIconColumnIndex), mButton->getImageOverlayHAlign()); + + return LLComboBox::getSelectedItemLabel(mLabelColumnIndex); } diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index c694724248..965061ead2 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -150,7 +150,7 @@ public: // Get name of current item. Returns an empty string if not found. const std::string getSimple() const; // Get contents of column x of selected row - const std::string getSelectedItemLabel(S32 column = 0) const; + virtual const std::string getSelectedItemLabel(S32 column = 0) const; // Sets the label, which doesn't have to exist in the label. // This is probably a UI abuse. @@ -248,6 +248,7 @@ public: }; /*virtual*/ void setValue(const LLSD& value); + /*virtual*/ const std::string getSelectedItemLabel(S32 column = 0) const; private: enum EColumnIndex diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 1c6c9e6e9d..b77deb003f 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -407,3 +407,30 @@ BOOL LLWindowManager::isWindowValid(LLWindow *window) { return sWindowList.find(window) != sWindowList.end(); } + +S32 LLDisplayInfo::getDisplayWidth() const +{ +#if LL_WINDOWS + return LLWindowWin32::getDisplayWidth(); +#elif LL_DARWIN + return LLWindowMacOSX::getDisplayWidth(); +#elif LL_SDL + return LLWindowSDL::getDisplayWidth(); +#else + return 1024; //*FIXME +#endif +} + +S32 LLDisplayInfo::getDisplayHeight() const +{ +#if LL_WINDOWS + return LLWindowWin32::getDisplayHeight(); +#elif LL_DARWIN + return LLWindowMacOSX::getDisplayHeight(); +#elif LL_SDL + return LLWindowSDL::getDisplayHeight(); +#else + return 768; //*FIXME +#endif +} + diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 55b221e716..b769f5071b 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -281,4 +281,19 @@ extern const std::string gURLProtocolWhitelistHandler[]; void simpleEscapeString ( std::string& stringIn ); +//============================================================================= +// +// CLASS LLDisplayInfo +class LLDisplayInfo + +/*! @brief Class to query the information about some display settings +*/ +{ +public: + LLDisplayInfo(){}; ///< Default constructor + + S32 getDisplayWidth() const; ///< display width + S32 getDisplayHeight() const; ///< display height +}; + #endif // _LL_window_h_ diff --git a/indra/llwindow/llwindowmacosx-objc.h b/indra/llwindow/llwindowmacosx-objc.h index ed5d7b1e74..ed8c874dcb 100644 --- a/indra/llwindow/llwindowmacosx-objc.h +++ b/indra/llwindow/llwindowmacosx-objc.h @@ -40,4 +40,5 @@ void setupCocoa(); CursorRef createImageCursor(const char *fullpath, int hotspotX, int hotspotY); OSErr releaseImageCursor(CursorRef ref); OSErr setImageCursor(CursorRef ref); - +void getScreenSize(int* width, int* height); +void getVisibleScreen(int *x, int *y, int* width, int* height); diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 59b25e1726..5cab2619fd 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -116,3 +116,22 @@ OSErr setImageCursor(CursorRef ref) return noErr; } +void getScreenSize(int* width, int* height) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSRect screen_rect = [[NSScreen mainScreen] frame]; + if (width) *width = (int)(screen_rect.size.width); + if (height) *height = (int)(screen_rect.size.height); + [pool release]; +} + +void getVisibleScreen(int *x, int *y, int* width, int* height) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSRect visible_rect = [[NSScreen mainScreen] visibleFrame]; + if (width) *width = (int)(visible_rect.size.width); + if (height) *height = (int)(visible_rect.size.height); + if (x) *x = (int)(visible_rect.origin.x); + if (y) *y = (int)(visible_rect.origin.y); + [pool release]; +} diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index ad97bc45fc..924acaf148 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1122,7 +1122,33 @@ BOOL LLWindowMacOSX::getMaximized() BOOL LLWindowMacOSX::maximize() { - // TODO + if (mWindow) + { + // *HACK: Because Mac OSX doesn't have a concept of a "maximized" window, we just + // stretch it out to the visible screen size. + Rect win_rect; + + int visible_x; + int visible_y; + int visible_width; + int visible_height; + int screen_width; + int screen_height; + + getScreenSize(&screen_width, &screen_height); + getVisibleScreen(&visible_x, &visible_y, &visible_width, &visible_height); + + int mac_os_menu_bar_height = screen_height - (visible_height + visible_y); + ::SetRect(&win_rect, + visible_x, + mac_os_menu_bar_height, + visible_width + visible_x, + visible_height + mac_os_menu_bar_height); + + ::SetWindowBounds(mWindow, kWindowStructureRgn, &win_rect); + + return TRUE; + } return FALSE; } @@ -3464,6 +3490,26 @@ MASK LLWindowMacOSX::modifiersToMask(SInt16 modifiers) return mask; } +// static +S32 LLWindowMacOSX::getDisplayWidth() +{ + S32 width = 1024; + // Need to invoke cocoa before use getScreenSize() + setupCocoa(); + getScreenSize(&width, NULL); + return width; +} + +// static +S32 LLWindowMacOSX::getDisplayHeight() +{ + S32 height = 768; + // Need to invoke cocoa before use getScreenSize() + setupCocoa(); + getScreenSize(NULL, &height); + return height; +} + #if LL_OS_DRAGDROP_ENABLED OSErr LLWindowMacOSX::dragTrackingHandler(DragTrackingMessage message, WindowRef theWindow, diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 7c6b324029..86036a261c 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -123,6 +123,8 @@ public: // Provide native key event data /*virtual*/ LLSD getNativeKeyData(); + static S32 getDisplayWidth(); + static S32 getDisplayHeight(); protected: LLWindowMacOSX(LLWindowCallbacks* callbacks, diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 1f705f9e60..cb4e04511c 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -187,6 +187,47 @@ Display* LLWindowSDL::get_SDL_Display(void) } #endif // LL_X11 +// static +S32 LLWindowSDL::getDisplayWidth() +{ +#if LL_GTK + if (LLWindowSDL::ll_try_gtk_init()) + { + return gdk_screen_width(); + } +#endif // LL_GTK + +#if LL_X11 + Display *display = XOpenDisplay(NULL); + int screen_num = DefaultScreen(display); + S32 width = DisplayWidth(display, screen_num); + XCloseDisplay(display); + return width; +#endif //LL_X11 + + return 1024; +} + +// static +S32 LLWindowSDL::getDisplayHeight() +{ +#if LL_GTK + if (LLWindowSDL::ll_try_gtk_init()) + { + return gdk_screen_height(); + } +#endif // LL_GTK + +#if LL_X11 + Display *display = XOpenDisplay(NULL); + int screen_num = DefaultScreen(display); + S32 height = DisplayHeight(display, screen_num); + XCloseDisplay(display); + return height; +#endif //LL_X11 + + return 768; +} LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, const std::string& title, S32 x, S32 y, S32 width, @@ -909,7 +950,68 @@ BOOL LLWindowSDL::getMaximized() if (mWindow) { - // TODO +#if LL_X11 + if (mSDL_Display) + { + maybe_lock_display(); + + // Return data in the specified format, XA_ATOM. + U8* prop; + // Actual format of the property. + int format; + // Actual number of items stored in the prop return data. + unsigned long nitems; + // Number of bytes remaining to be read in the property if a partial read was performed. + unsigned long bytes_after; + // Atom identifier that defines the actual type of the property. + Atom type; + + // Atom used to obtain list of hints describing the window state. + Atom wm_state = XInternAtom(mSDL_Display, "_NET_WM_STATE", False); + + // Atoms indicates that the window is vertically/horizontally maximized. + Atom max_vert = XInternAtom(mSDL_Display, "_NET_WM_STATE_MAXIMIZED_VERT", False); + Atom max_horz = XInternAtom(mSDL_Display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); + + // How many atoms in which we interested are present in list of hints. + U32 pass = 0; + + do + { + nitems = 0; + bytes_after = 0; + type = None; + if ( (XGetWindowProperty (mSDL_Display, + mSDL_XWindowID, + wm_state, + 0, UINT_MAX, + False, XA_ATOM, + &type, &format, + &nitems, &bytes_after, + &prop) == Success) + && type != None ) + { + Atom *atoms = (Atom *)prop; + for (unsigned long i=0; i<nitems; ++i) + { + if (atoms[i] == max_horz) + ++pass; + else if (atoms[i] == max_vert) + ++pass; + } + XFree (atoms); + } + else + { + break; + } + } while (bytes_after > 0); + + result = (pass == 2); + + maybe_unlock_display(); + } +#endif // LL_X11 } return(result); @@ -917,7 +1019,103 @@ BOOL LLWindowSDL::getMaximized() BOOL LLWindowSDL::maximize() { - // TODO +#if LL_X11 + if (mSDL_Display && !mFullscreen) + { + maybe_lock_display(); + + BOOL is_maximize_allowed = FALSE; + + // Check if maximize is allowed + { + // Return data in the specified format, XA_ATOM. + U8* prop; + // Actual format of the property. + int format; + // Actual number of items stored in the prop return data. + unsigned long nitems; + // Number of bytes remaining to be read in the property if a partial read was performed. + unsigned long bytes_after; + // Atom identifier that defines the actual type of the property. + Atom type; + + // Atom used to obtain a list of atoms indicating user operations that the Window Manager supports for this window. + Atom allowed_act = XInternAtom(mSDL_Display, "_NET_WM_ALLOWED_ACTIONS", False); + + // Atoms that indicates that the window may be vertically/horizontally maximized. + Atom max_vert_act = XInternAtom(mSDL_Display, "_NET_WM_ACTION_MAXIMIZE_HORZ", False); + Atom max_horz_act = XInternAtom(mSDL_Display, "_NET_WM_ACTION_MAXIMIZE_VERT", False); + + // How many atoms in which we interested are present in list of hints. + U32 pass = 0; + + do + { + nitems = 0; + bytes_after = 0; + type = None; + if ( (XGetWindowProperty (mSDL_Display, + mSDL_XWindowID, + allowed_act, + 0, UINT_MAX, + False, XA_ATOM, + &type, &format, + &nitems, &bytes_after, + &prop) == Success) + && type != None ) + { + Atom *atoms = (Atom *)prop; + for (unsigned long i=0; i<nitems; ++i) + { + if (atoms[i] == max_vert_act) + ++pass; + else if (atoms[i] == max_horz_act) + ++pass; + } + XFree (atoms); + } + else + { + break; + } + } while (bytes_after > 0); + + is_maximize_allowed = (pass == 2); + } + + // Send maximize event to X11 system + if (is_maximize_allowed) + { + XEvent xev; + + // Atom describing the window state. + Atom wm_state = XInternAtom(mSDL_Display, "_NET_WM_STATE", False); + + // Atoms indicates that the window is vertically/horizontally maximized. + Atom max_vert = XInternAtom(mSDL_Display, "_NET_WM_STATE_MAXIMIZED_VERT", False); + Atom max_horz = XInternAtom(mSDL_Display, "_NET_WM_STATE_MAXIMIZED_HORZ", False); + + memset(&xev, 0, sizeof(xev)); + xev.type = ClientMessage; + xev.xclient.window = mSDL_XWindowID; + xev.xclient.message_type = wm_state; + xev.xclient.format = 32; + xev.xclient.data.l[0] = 1; // add/set property + xev.xclient.data.l[1] = max_vert; + xev.xclient.data.l[2] = max_horz; + xev.xclient.data.l[3] = 0; + xev.xclient.data.l[4] = 0; + + XSendEvent(mSDL_Display, + DefaultRootWindow(mSDL_Display), + False, + SubstructureNotifyMask, &xev); + } + + maybe_unlock_display(); + return is_maximize_allowed; + } +#endif // LL_X11 return FALSE; } diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index e6bdd46a77..2311a361fa 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -148,6 +148,9 @@ public: static Display* get_SDL_Display(void); #endif // LL_X11 + static S32 getDisplayWidth(); + static S32 getDisplayHeight(); + protected: LLWindowSDL(LLWindowCallbacks* callbacks, const std::string& title, int x, int y, int width, int height, U32 flags, diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index c80392ad45..4be5d06c2b 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -3714,5 +3714,16 @@ std::vector<std::string> LLWindowWin32::getDynamicFallbackFontList() return std::vector<std::string>(); } +// static +S32 LLWindowWin32::getDisplayWidth() +{ + return ::GetSystemMetrics(SM_CXVIRTUALSCREEN); +} + +// static +S32 LLWindowWin32::getDisplayHeight() +{ + return ::GetSystemMetrics(SM_CYVIRTUALSCREEN); +} #endif // LL_WINDOWS diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 9d57735772..c221ec0192 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -120,6 +120,9 @@ public: static std::vector<std::string> getDynamicFallbackFontList(); + static S32 getDisplayWidth(); + static S32 getDisplayHeight(); + protected: LLWindowWin32(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags, diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 36faeb100f..bdfe0d9142 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -305,7 +305,7 @@ static std::string gLaunchFileOnQuit; // Used on Win32 for other apps to identify our window (eg, win_setup) const char* const VIEWER_WINDOW_CLASSNAME = "Second Life"; static const S32 FIRST_RUN_WINDOW_WIDTH = 1024; -static const S32 FIRST_RUN_WINDOW_HRIGHT = 768; +static const S32 FIRST_RUN_WINDOW_HIGHT = 768; //---------------------------------------------------------------------------- // List of entries from strings.xml to always replace @@ -2382,12 +2382,12 @@ bool LLAppViewer::initWindow() if (first_run)//for first login { window_width = FIRST_RUN_WINDOW_WIDTH;//yep hardcoded - window_height = FIRST_RUN_WINDOW_HRIGHT; + window_height = FIRST_RUN_WINDOW_HIGHT; //if screen resolution is lower then 1024*768 then show maximized LLDisplayInfo display_info; if(display_info.getDisplayWidth() <= FIRST_RUN_WINDOW_WIDTH - || display_info.getDisplayHeight()<=FIRST_RUN_WINDOW_HRIGHT) + || display_info.getDisplayHeight()<=FIRST_RUN_WINDOW_HIGHT) { show_maximized = true; } diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 26c6db9652..7051447409 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -102,6 +102,10 @@ public: virtual void changed() { LLFloaterLand::refreshAll(); } }; +// fills target textbox with maturity info(icon and text) +// names_floater - pointer to floater which contains strings with maturity icons filenames +void FillMaturityTextBox(LLTextBox* target_textbox, LLFloater* names_floater); + //--------------------------------------------------------------------------- // LLFloaterLand //--------------------------------------------------------------------------- @@ -554,7 +558,7 @@ void LLPanelLandGeneral::refresh() if (regionp) { - mContentRating->setText(regionp->getSimAccessString()); + FillMaturityTextBox(mContentRating, gFloaterView->getParentFloater(this)); mLandType->setText(regionp->getSimProductName()); } @@ -2858,7 +2862,7 @@ void LLPanelLandCovenant::refresh() LLTextBox* region_maturity = getChild<LLTextBox>("region_maturity_text"); if (region_maturity) { - region_maturity->setText(region->getSimAccessString()); + FillMaturityTextBox(region_maturity, gFloaterView->getParentFloater(this)); } LLTextBox* resellable_clause = getChild<LLTextBox>("resellable_clause"); @@ -2939,3 +2943,38 @@ void LLPanelLandCovenant::updateEstateOwnerName(const std::string& name) if (editor) editor->setText(name); } } + +// fills target textbox with maturity info(icon and text) +// names_floater - pointer to floater which contains strings with maturity icons filenames +void FillMaturityTextBox(LLTextBox* target_textbox, LLFloater* names_floater) +{ + LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); + if (!region) + return; + + LLStyle::Params style; + + U8 sim_access = region->getSimAccess(); + + switch(sim_access) + { + case SIM_ACCESS_PG: + style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_general"))); + break; + + case SIM_ACCESS_ADULT: + style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_adult"))); + break; + + case SIM_ACCESS_MATURE: + style.image(LLUI::getUIImage(names_floater->getString("maturity_icon_moderate"))); + break; + + default: + break; + } + + // any text may be here instead of "icon" except "" + target_textbox->setText(std::string("icon"),style); + target_textbox->appendText(LLViewerParcelMgr::getInstance()->getSelectionRegion()->getSimAccessString(), false); +} diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index 9f24ddc799..115c7a1aa5 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -114,6 +114,23 @@ public: }; static LLDispatchClassifiedClickThrough sClassifiedClickThrough; +// Just to debug errors. Can be thrown away later. +class LLClassifiedClickMessageResponder : public LLHTTPClient::Responder +{ + LOG_CLASS(LLClassifiedClickMessageResponder); + +public: + // If we get back an error (not found, etc...), handle it here + virtual void errorWithContent( + U32 status, + const std::string& reason, + const LLSD& content) + { + llwarns << "Sending click message failed (" << status << "): [" << reason << "]" << llendl; + llwarns << "Content: [" << content << "]" << llendl; + } +}; + /* Re-expose this if we need to have classified ad HTML detail pages. JC @@ -1237,7 +1254,7 @@ void LLPanelClassifiedInfo::reshape(S32 width, S32 height, BOOL called_from_pare void LLPanelClassifiedInfo::onOpen(const LLSD& key) { - LLUUID avatar_id = key["avatar_id"]; + LLUUID avatar_id = key["classified_creator_id"]; if(avatar_id.isNull()) { return; @@ -1255,9 +1272,12 @@ void LLPanelClassifiedInfo::onOpen(const LLSD& key) scrollToTop(); setClassifiedId(key["classified_id"]); - setClassifiedName(key["name"]); - setDescription(key["desc"]); - setSnapshotId(key["snapshot_id"]); + setClassifiedName(key["classified_name"]); + setDescription(key["classified_desc"]); + setSnapshotId(key["classified_snapshot_id"]); + setFromSearch(key["from_search"]); + + llinfos << "Opening classified [" << getClassifiedName() << "] (" << getClassifiedId() << ")" << llendl; LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); LLAvatarPropertiesProcessor::getInstance()->sendClassifiedInfoRequest(getClassifiedId()); @@ -1274,6 +1294,10 @@ void LLPanelClassifiedInfo::onOpen(const LLSD& key) LLHTTPClient::post(url, body, new LLClassifiedStatsResponder(getClassifiedId())); } + // Update classified click stats. + // *TODO: Should we do this when opening not from search? + sendClickMessage("profile"); + setInfoLoaded(false); } @@ -1289,6 +1313,8 @@ void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType t setSnapshotId(c_info->snapshot_id); setParcelId(c_info->parcel_id); setPosGlobal(c_info->pos_global); + setSimName(c_info->sim_name); + setClassifiedLocation(createLocationText(c_info->parcel_name, c_info->sim_name, c_info->pos_global)); childSetValue("category", LLClassifiedInfo::sCategories[c_info->category]); @@ -1299,6 +1325,8 @@ void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType t bool mature = is_cf_mature(c_info->flags); childSetValue("content_type", mature ? mature_str : pg_str); + getChild<LLIconCtrl>("content_type_moderate")->setVisible(mature); + getChild<LLIconCtrl>("content_type_general")->setVisible(!mature); std::string auto_renew_str = is_cf_auto_renew(c_info->flags) ? getString("auto_renew_on") : getString("auto_renew_off"); @@ -1323,7 +1351,19 @@ void LLPanelClassifiedInfo::resetData() setClassifiedLocation(LLStringUtil::null); setClassifiedId(LLUUID::null); setSnapshotId(LLUUID::null); - mPosGlobal.clearVec(); + setPosGlobal(LLVector3d::zero); + setParcelId(LLUUID::null); + setSimName(LLStringUtil::null); + setFromSearch(false); + + // reset click stats + mTeleportClicksOld = 0; + mMapClicksOld = 0; + mProfileClicksOld = 0; + mTeleportClicksNew = 0; + mMapClicksNew = 0; + mProfileClicksNew = 0; + childSetText("category", LLStringUtil::null); childSetText("content_type", LLStringUtil::null); childSetText("click_through_text", LLStringUtil::null); @@ -1331,6 +1371,8 @@ void LLPanelClassifiedInfo::resetData() childSetText("auto_renew", LLStringUtil::null); childSetText("creation_date", LLStringUtil::null); childSetText("click_through_text", LLStringUtil::null); + getChild<LLIconCtrl>("content_type_moderate")->setVisible(FALSE); + getChild<LLIconCtrl>("content_type_general")->setVisible(FALSE); } void LLPanelClassifiedInfo::resetControls() @@ -1444,6 +1486,13 @@ void LLPanelClassifiedInfo::setClickThrough( ct_str.setArg("[PROFILE]", llformat("%d", self->mProfileClicksNew + self->mProfileClicksOld)); self->childSetText("click_through_text", ct_str.getString()); + // *HACK: remove this when there is enough room for click stats in the info panel + self->childSetToolTip("click_through_text", ct_str.getString()); + + llinfos << "teleport: " << llformat("%d", self->mTeleportClicksNew + self->mTeleportClicksOld) + << ", map: " << llformat("%d", self->mMapClicksNew + self->mMapClicksOld) + << ", profile: " << llformat("%d", self->mProfileClicksNew + self->mProfileClicksOld) + << llendl; } } @@ -1532,8 +1581,46 @@ void LLPanelClassifiedInfo::scrollToTop() scrollContainer->goToTop(); } +// static +// *TODO: move out of the panel +void LLPanelClassifiedInfo::sendClickMessage( + const std::string& type, + bool from_search, + const LLUUID& classified_id, + const LLUUID& parcel_id, + const LLVector3d& global_pos, + const std::string& sim_name) +{ + // You're allowed to click on your own ads to reassure yourself + // that the system is working. + LLSD body; + body["type"] = type; + body["from_search"] = from_search; + body["classified_id"] = classified_id; + body["parcel_id"] = parcel_id; + body["dest_pos_global"] = global_pos.getValue(); + body["region_name"] = sim_name; + + std::string url = gAgent.getRegion()->getCapability("SearchStatTracking"); + llinfos << "Sending click msg via capability (url=" << url << ")" << llendl; + llinfos << "body: [" << body << "]" << llendl; + LLHTTPClient::post(url, body, new LLClassifiedClickMessageResponder()); +} + +void LLPanelClassifiedInfo::sendClickMessage(const std::string& type) +{ + sendClickMessage( + type, + fromSearch(), + getClassifiedId(), + getParcelId(), + getPosGlobal(), + getSimName()); +} + void LLPanelClassifiedInfo::onMapClick() { + sendClickMessage("map"); LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal()); LLFloaterReg::showInstance("world_map", "center"); } @@ -1542,6 +1629,7 @@ void LLPanelClassifiedInfo::onTeleportClick() { if (!getPosGlobal().isExactlyZero()) { + sendClickMessage("teleport"); gAgent.teleportViaLocation(getPosGlobal()); LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal()); } @@ -1703,7 +1791,7 @@ void LLPanelClassifiedEdit::processProperties(void* data, EAvatarProcessorType t bool mature = is_cf_mature(c_info->flags); bool auto_renew = is_cf_auto_renew(c_info->flags); - getChild<LLComboBox>("content_type")->setCurrentByIndex(mature ? CB_ITEM_MATURE : CB_ITEM_PG); + getChild<LLIconsComboBox>("content_type")->setCurrentByIndex(mature ? CB_ITEM_MATURE : CB_ITEM_PG); childSetValue("auto_renew", auto_renew); childSetValue("price_for_listing", c_info->price_for_listing); childSetEnabled("price_for_listing", isNew()); @@ -1762,7 +1850,7 @@ void LLPanelClassifiedEdit::resetControls() LLPanelClassifiedInfo::resetControls(); getChild<LLComboBox>("category")->setCurrentByIndex(0); - getChild<LLComboBox>("content_type")->setCurrentByIndex(0); + getChild<LLIconsComboBox>("content_type")->setCurrentByIndex(0); childSetValue("auto_renew", false); childSetValue("price_for_listing", MINIMUM_PRICE_FOR_LISTING); childSetEnabled("price_for_listing", TRUE); @@ -1826,7 +1914,7 @@ U8 LLPanelClassifiedEdit::getFlags() { bool auto_renew = childGetValue("auto_renew").asBoolean(); - LLComboBox* content_cb = getChild<LLComboBox>("content_type"); + LLComboBox* content_cb = getChild<LLIconsComboBox>("content_type"); bool mature = content_cb->getCurrentIndex() == CB_ITEM_MATURE; return pack_classified_flags_request(auto_renew, false, mature, false); diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h index 78f095a9bb..58e7c9a4b4 100644 --- a/indra/newview/llpanelclassified.h +++ b/indra/newview/llpanelclassified.h @@ -221,6 +221,7 @@ private: class LLPanelClassifiedInfo : public LLPanel, public LLAvatarPropertiesObserver { + LOG_CLASS(LLPanelClassifiedInfo); public: static LLPanelClassifiedInfo* create(); @@ -263,6 +264,14 @@ public: LLUUID getParcelId() { return mParcelId; } + void setSimName(const std::string& sim_name) { mSimName = sim_name; } + + std::string getSimName() { return mSimName; } + + void setFromSearch(bool val) { mFromSearch = val; } + + bool fromSearch() { return mFromSearch; } + bool getInfoLoaded() { return mInfoLoaded; } void setInfoLoaded(bool loaded) { mInfoLoaded = loaded; } @@ -274,6 +283,14 @@ public: S32 profile, bool from_new_table); + static void sendClickMessage( + const std::string& type, + bool from_search, + const LLUUID& classified_id, + const LLUUID& parcel_id, + const LLVector3d& global_pos, + const std::string& sim_name); + void setExitCallback(const commit_callback_t& cb); void setEditClassifiedCallback(const commit_callback_t& cb); @@ -296,6 +313,7 @@ protected: const LLVector3d& pos_global); void stretchSnapshot(); + void sendClickMessage(const std::string& type); LLRect getDefaultSnapshotRect(); @@ -315,6 +333,8 @@ private: LLUUID mClassifiedId; LLVector3d mPosGlobal; LLUUID mParcelId; + std::string mSimName; + bool mFromSearch; bool mInfoLoaded; LLScrollContainer* mScrollContainer; @@ -337,6 +357,7 @@ private: class LLPanelClassifiedEdit : public LLPanelClassifiedInfo { + LOG_CLASS(LLPanelClassifiedEdit); public: static LLPanelClassifiedEdit* create(); diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 2ff2597f08..f0860e7027 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -140,10 +140,11 @@ public: params["open_tab_name"] = "panel_picks"; params["show_tab_panel"] = "classified_details"; params["classified_id"] = c_info->classified_id; - params["classified_avatar_id"] = c_info->creator_id; + params["classified_creator_id"] = c_info->creator_id; params["classified_snapshot_id"] = c_info->snapshot_id; params["classified_name"] = c_info->name; params["classified_desc"] = c_info->description; + params["from_search"] = true; LLSideTray::getInstance()->showPanel("panel_profile_view", params); } @@ -174,31 +175,6 @@ LLClassifiedHandler gClassifiedHandler; ////////////////////////////////////////////////////////////////////////// -/** - * Copy&Pasted from old LLPanelClassified. This class does nothing at the moment. - * Subscribing to "classifiedclickthrough" removes a few warnings. - */ -class LLClassifiedClickThrough : public LLDispatchHandler -{ -public: - - // "classifiedclickthrough" - // strings[0] = classified_id - // strings[1] = teleport_clicks - // strings[2] = map_clicks - // strings[3] = profile_clicks - virtual bool operator()( - const LLDispatcher* dispatcher, - const std::string& key, - const LLUUID& invoice, - const sparam_t& strings) - { - if (strings.size() != 4) - return false; - - return true; - } -}; //----------------------------------------------------------------------------- // LLPanelPicks @@ -217,12 +193,9 @@ LLPanelPicks::LLPanelPicks() mClassifiedsAccTab(NULL), mPanelClassifiedInfo(NULL), mPanelClassifiedEdit(NULL), - mClickThroughDisp(NULL), mNoClassifieds(false), mNoPicks(false) { - mClickThroughDisp = new LLClassifiedClickThrough(); - gGenericDispatcher.addHandler("classifiedclickthrough", mClickThroughDisp); } LLPanelPicks::~LLPanelPicks() @@ -231,8 +204,6 @@ LLPanelPicks::~LLPanelPicks() { LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); } - - delete mClickThroughDisp; } void* LLPanelPicks::create(void* data /* = NULL */) @@ -607,7 +578,11 @@ void LLPanelPicks::onClickTeleport() if(pick_item) pos = pick_item->getPosGlobal(); else if(c_item) + { pos = c_item->getPosGlobal(); + LLPanelClassifiedInfo::sendClickMessage("teleport", false, + c_item->getClassifiedId(), LLUUID::null, pos, LLStringUtil::null); + } if (!pos.isExactlyZero()) { @@ -626,7 +601,11 @@ void LLPanelPicks::onClickMap() if (pick_item) pos = pick_item->getPosGlobal(); else if(c_item) + { + LLPanelClassifiedInfo::sendClickMessage("map", false, + c_item->getClassifiedId(), LLUUID::null, pos, LLStringUtil::null); pos = c_item->getPosGlobal(); + } LLFloaterWorldMap::getInstance()->trackLocation(pos); LLFloaterReg::showInstance("world_map", "center"); @@ -756,26 +735,20 @@ void LLPanelPicks::openClassifiedInfo() if (selected_value.isUndefined()) return; LLClassifiedItem* c_item = getSelectedClassifiedItem(); + LLSD params; + params["classified_id"] = c_item->getClassifiedId(); + params["classified_creator_id"] = c_item->getAvatarId(); + params["classified_snapshot_id"] = c_item->getSnapshotId(); + params["classified_name"] = c_item->getClassifiedName(); + params["classified_desc"] = c_item->getDescription(); + params["from_search"] = false; - openClassifiedInfo(c_item->getClassifiedId(), c_item->getAvatarId(), - c_item->getSnapshotId(), c_item->getClassifiedName(), - c_item->getDescription()); + openClassifiedInfo(params); } -void LLPanelPicks::openClassifiedInfo(const LLUUID &classified_id, - const LLUUID &avatar_id, - const LLUUID &snapshot_id, - const std::string &name, const std::string &desc) +void LLPanelPicks::openClassifiedInfo(const LLSD ¶ms) { createClassifiedInfoPanel(); - - LLSD params; - params["classified_id"] = classified_id; - params["avatar_id"] = avatar_id; - params["snapshot_id"] = snapshot_id; - params["name"] = name; - params["desc"] = desc; - getProfilePanel()->openPanel(mPanelClassifiedInfo, params); } diff --git a/indra/newview/llpanelpicks.h b/indra/newview/llpanelpicks.h index 3f757e482e..11e811275b 100644 --- a/indra/newview/llpanelpicks.h +++ b/indra/newview/llpanelpicks.h @@ -55,7 +55,6 @@ class LLPanelPickEdit; class LLToggleableMenu; class LLPanelClassifiedInfo; class LLPanelClassifiedEdit; -class LLClassifiedClickThrough; // *TODO // Panel Picks has been consolidated with Classifieds (EXT-2095), give LLPanelPicks @@ -120,9 +119,7 @@ private: void openPickInfo(); void openClassifiedInfo(); - void openClassifiedInfo(const LLUUID &classified_id, const LLUUID &avatar_id, - const LLUUID &snapshot_id, const std::string &name, - const std::string &desc); + void openClassifiedInfo(const LLSD& params); friend class LLPanelProfile; void showAccordion(const std::string& name, bool show); @@ -159,8 +156,6 @@ private: LLAccordionCtrlTab* mPicksAccTab; LLAccordionCtrlTab* mClassifiedsAccTab; - LLClassifiedClickThrough* mClickThroughDisp; - //true if picks list is empty after processing picks bool mNoPicks; //true if classifieds list is empty after processing classifieds diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index b5d85dfd4b..18da8dd48c 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -171,15 +171,13 @@ void LLPanelProfile::onOpen(const LLSD& key) } else if (panel == "classified_details") { - LLUUID classified_id = key["classified_id"].asUUID(); - LLUUID avatar_id = key["classified_avatar_id"].asUUID(); - LLUUID snapshot_id = key["classified_snapshot_id"].asUUID(); - std::string name = key["classified_name"].asString(); - std::string desc = key["classified_desc"].asString(); LLPanelPicks* picks = dynamic_cast<LLPanelPicks *>(getTabContainer()[PANEL_PICKS]); if (picks) { - picks->openClassifiedInfo(classified_id, avatar_id, snapshot_id, name, desc); + LLSD params = key; + params.erase("show_tab_panel"); + params.erase("open_tab_name"); + picks->openClassifiedInfo(params); } } } diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml index 3297150c7f..2b0cb66f61 100644 --- a/indra/newview/skins/default/xui/en/floater_about_land.xml +++ b/indra/newview/skins/default/xui/en/floater_about_land.xml @@ -9,6 +9,18 @@ title="ABOUT LAND" width="490"> <floater.string + name="maturity_icon_general"> + "Parcel_PG_Dark" + </floater.string> + <floater.string + name="maturity_icon_moderate"> + "Parcel_M_Dark" + </floater.string> + <floater.string + name="maturity_icon_adult"> + "Parcel_R_Dark" + </floater.string> + <floater.string name="Minutes"> [MINUTES] minutes </floater.string> diff --git a/indra/newview/skins/default/xui/en/panel_classified_info.xml b/indra/newview/skins/default/xui/en/panel_classified_info.xml index 1535ce2978..e3b331799c 100644 --- a/indra/newview/skins/default/xui/en/panel_classified_info.xml +++ b/indra/newview/skins/default/xui/en/panel_classified_info.xml @@ -24,7 +24,7 @@ </panel.string> <panel.string name="click_through_text_fmt"> - [TELEPORT] teleport, [MAP] map, [MAP] profile + [TELEPORT] teleport, [MAP] map, [PROFILE] profile </panel.string> <panel.string name="date_fmt"> @@ -156,6 +156,24 @@ top_pad="10" value="Content Type:" width="140" /> + <icon + follows="top|left" + height="16" + image_name="Parcel_M_Light" + layout="topleft" + left_pad="0" + name="content_type_moderate" + top_pad="-11" + width="18" /> + <icon + follows="top|left" + height="16" + image_name="Parcel_PG_Light" + layout="topleft" + left_delta="0" + name="content_type_general" + top_delta="0" + width="18" /> <text_editor allow_scroll="false" bg_visible="false" @@ -163,11 +181,11 @@ h_pad="0" height="18" layout="topleft" - left_pad="0" + left_pad="2" name="content_type" read_only="true" - width="150" - top_pad="-10" + width="130" + top_delta="1" v_pad="0" value="[content type]" /> <text diff --git a/indra/newview/skins/default/xui/en/panel_edit_classified.xml b/indra/newview/skins/default/xui/en/panel_edit_classified.xml index c1b352031f..74d63ab328 100644 --- a/indra/newview/skins/default/xui/en/panel_edit_classified.xml +++ b/indra/newview/skins/default/xui/en/panel_edit_classified.xml @@ -217,25 +217,41 @@ top_pad="15" value="Content type:" width="250" /> - <combo_box - allow_text_entry="false" - follows="left|top" - height="23" + <icons_combo_box + follows="left|top" + height="23" + label="General Content" + layout="topleft" left="10" - name="content_type" + name="content_type" top_pad="5" width="156"> - <combo_item - name="mature_ci" - value="Mature"> - Moderate Content - </combo_item> - <combo_item - name="pg_ci" - value="PG"> - General Content - </combo_item> - </combo_box> + <icons_combo_box.drop_down_button + image_overlay="Parcel_PG_Light" + image_overlay_alignment="left" + imgoverlay_label_space="3" + pad_left="3"/> + <icons_combo_box.item + label="Moderate Content" + name="mature_ci" + value="Mature"> + <item.columns + halign="center" + type="icon" + value="Parcel_M_Light" + width="20"/> + </icons_combo_box.item> + <icons_combo_box.item + label="General Content" + name="pg_ci" + value="PG"> + <item.columns + halign="center" + type="icon" + value="Parcel_PG_Light" + width="20"/> + </icons_combo_box.item> + </icons_combo_box> <text follows="left|top" font.style="BOLD" diff --git a/indra/newview/skins/default/xui/en/panel_place_profile.xml b/indra/newview/skins/default/xui/en/panel_place_profile.xml index 01a27a08c7..1e7c51259c 100644 --- a/indra/newview/skins/default/xui/en/panel_place_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_place_profile.xml @@ -325,6 +325,7 @@ top_pad="10" width="313"> <accordion_tab + height="170" layout="topleft" name="parcel_characteristics_tab" title="Parcel"> @@ -537,6 +538,7 @@ </accordion_tab> <accordion_tab expanded="false" + height="150" layout="topleft" name="region_information_tab" title="Region"> @@ -664,6 +666,7 @@ </accordion_tab> <accordion_tab expanded="false" + height="190" layout="topleft" name="estate_information_tab" title="Estate"> @@ -753,6 +756,7 @@ </accordion_tab> <accordion_tab expanded="false" + height="320" layout="topleft" name="sales_tab" title="For Sale"> diff --git a/indra/newview/skins/default/xui/en/panel_region_general.xml b/indra/newview/skins/default/xui/en/panel_region_general.xml index 4acfa42c23..ca9579284b 100644 --- a/indra/newview/skins/default/xui/en/panel_region_general.xml +++ b/indra/newview/skins/default/xui/en/panel_region_general.xml @@ -187,6 +187,7 @@ pad_left="3"/> <icons_combo_box.item label="Adult" + name="Adult" value="42"> <item.columns halign="center" @@ -196,6 +197,7 @@ </icons_combo_box.item> <icons_combo_box.item label="Moderate" + name="Mature" value="21"> <item.columns halign="center" @@ -205,6 +207,7 @@ </icons_combo_box.item> <icons_combo_box.item label="General" + name="PG" value="13"> <item.columns halign="center" |