SL-19929 New inventory feature notification should appear on top

master
Andrey Kleshchev 2023-07-03 23:29:01 +03:00
parent 35d68ce737
commit d3233e787a
3 changed files with 25 additions and 15 deletions

View File

@ -582,7 +582,12 @@ void LLAgent::showLatestFeatureNotification()
S32 feature_version = gSavedSettings.getS32("LastUIFeatureVersion");
if (feature_version < UI_FEATURE_VERSION)
{
LLFloaterReg::showInstance("new_feature_notification");
// Need to open on top even if called from onOpen,
// do on idle to make sure it's on top
doOnIdleOneTime([]()
{
LLFloaterReg::showInstance("new_feature_notification");
});
gSavedSettings.setS32("LastUIFeatureVersion", UI_FEATURE_VERSION);
}
}

View File

@ -30,7 +30,7 @@
LLFloaterNewFeatureNotification::LLFloaterNewFeatureNotification(const LLSD& key)
: LLFloater(key)
: LLFloater(key)
{
}
@ -40,24 +40,29 @@ LLFloaterNewFeatureNotification::~LLFloaterNewFeatureNotification()
BOOL LLFloaterNewFeatureNotification::postBuild()
{
setCanDrag(FALSE);
getChild<LLButton>("close_btn")->setCommitCallback(boost::bind(&LLFloaterNewFeatureNotification::onCloseBtn, this));
return TRUE;
setCanDrag(FALSE);
getChild<LLButton>("close_btn")->setCommitCallback(boost::bind(&LLFloaterNewFeatureNotification::onCloseBtn, this));
return TRUE;
}
void LLFloaterNewFeatureNotification::onOpen(const LLSD& key)
{
centerOnScreen();
centerOnScreen();
}
void LLFloaterNewFeatureNotification::onCloseBtn()
{
closeFloater();
closeFloater();
}
void LLFloaterNewFeatureNotification::centerOnScreen()
{
LLVector2 window_size = LLUI::getInstance()->getWindowSize();
centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY])));
LLVector2 window_size = LLUI::getInstance()->getWindowSize();
centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY])));
LLFloaterView* parent = dynamic_cast<LLFloaterView*>(getParent());
if (parent)
{
parent->bringToFront(this);
}
}

View File

@ -30,20 +30,20 @@
#include "llfloater.h"
class LLFloaterNewFeatureNotification:
public LLFloater
public LLFloater
{
friend class LLFloaterReg;
friend class LLFloaterReg;
public:
BOOL postBuild() override;
void onOpen(const LLSD& key) override;
BOOL postBuild() override;
void onOpen(const LLSD& key) override;
private:
LLFloaterNewFeatureNotification(const LLSD& key);
/*virtual*/ ~LLFloaterNewFeatureNotification();
void centerOnScreen();
void centerOnScreen();
void onCloseBtn();
void onCloseBtn();
};
#endif