summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterlagmeter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloaterlagmeter.cpp')
-rw-r--r--indra/newview/llfloaterlagmeter.cpp92
1 files changed, 48 insertions, 44 deletions
diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp
index 5d6c06f1a6..82deaef4a9 100644
--- a/indra/newview/llfloaterlagmeter.cpp
+++ b/indra/newview/llfloaterlagmeter.cpp
@@ -53,21 +53,22 @@ const std::string LAG_GOOD_IMAGE_NAME = "lag_status_good.tga";
LLFloaterLagMeter::LLFloaterLagMeter(const LLSD& key)
: LLFloater()
{
- LLUICtrlFactory::getInstance()->buildFloater(this, "floater_lagmeter.xml");
+// LLUICtrlFactory::getInstance()->buildFloater(this, "floater_lagmeter.xml");
+ mCommitCallbackRegistrar.add("LagMeter.ClickShrink", boost::bind(&LLFloaterLagMeter::onClickShrink, this));
+}
+BOOL LLFloaterLagMeter::postBuild()
+{
// Don't let this window take keyboard focus -- it's confusing to
// lose arrow-key driving when testing lag.
setIsChrome(TRUE);
-
+
// were we shrunk last time?
if (gSavedSettings.getBOOL("LagMeterShrunk"))
{
- onClickShrink(this);
+ onClickShrink();
}
-}
-
-BOOL LLFloaterLagMeter::postBuild()
-{
+
mClientButton = getChild<LLButton>("client_lagmeter");
mClientText = getChild<LLTextBox>("client_text");
mClientCause = getChild<LLTextBox>("client_lag_cause");
@@ -102,7 +103,7 @@ BOOL LLFloaterLagMeter::postBuild()
config_string = getString("server_single_process_max_time_ms", mStringArgs);
mServerSingleProcessMaxTime = (float)atof( config_string.c_str() );
- mShrunk = false;
+// mShrunk = false;
config_string = getString("max_width_px", mStringArgs);
mMaxWidth = atoi( config_string.c_str() );
config_string = getString("min_width_px", mStringArgs);
@@ -120,18 +121,18 @@ BOOL LLFloaterLagMeter::postBuild()
mStringArgs["[SERVER_FRAME_RATE_CRITICAL]"] = getString("server_frame_rate_critical_fps");
mStringArgs["[SERVER_FRAME_RATE_WARNING]"] = getString("server_frame_rate_warning_fps");
- childSetAction("minimize", onClickShrink, this);
+// childSetAction("minimize", onClickShrink, this);
return TRUE;
}
LLFloaterLagMeter::~LLFloaterLagMeter()
{
// save shrunk status for next time
- gSavedSettings.setBOOL("LagMeterShrunk", mShrunk);
+// gSavedSettings.setBOOL("LagMeterShrunk", mShrunk);
// expand so we save the large window rectangle
- if (mShrunk)
+ if (gSavedSettings.getBOOL("LagMeterShrunk"))
{
- onClickShrink(this);
+ onClickShrink();
}
}
@@ -184,7 +185,7 @@ void LLFloaterLagMeter::determineClient()
{
mClientCause->setText( getString("client_texture_loading_cause_msg", mStringArgs) );
}
- else if((LLViewerImage::sBoundTextureMemory >> 20) > LLViewerImage::sMaxBoundTextureMem)
+ else if((BYTES_TO_MEGA_BYTES(LLViewerImage::sBoundTextureMemoryInBytes)) > LLViewerImage::sMaxBoundTextureMemInMegaBytes)
{
mClientCause->setText( getString("client_texture_memory_cause_msg", mStringArgs) );
}
@@ -311,58 +312,61 @@ void LLFloaterLagMeter::determineServer()
}
}
-//static
-void LLFloaterLagMeter::onClickShrink(void * data)
+
+void LLFloaterLagMeter::onClickShrink() // toggle "LagMeterShrunk"
{
- LLFloaterLagMeter * self = (LLFloaterLagMeter*)data;
+// LLFloaterLagMeter * self = (LLFloaterLagMeter*)data;
+
+ LLButton * button = getChild<LLButton>("minimize");
+ S32 delta_width = mMaxWidth -mMinWidth;
+ LLRect r = getRect();
+ bool shrunk = gSavedSettings.getBOOL("LagMeterShrunk");
- LLButton * button = self->getChild<LLButton>("minimize");
- S32 delta_width = self->mMaxWidth - self->mMinWidth;
- LLRect r = self->getRect();
- if(self->mShrunk)
+ if(shrunk)
{
- self->setTitle( self->getString("max_title_msg", self->mStringArgs) );
+ setTitle(getString("max_title_msg", mStringArgs) );
// make left edge appear to expand
r.translate(-delta_width, 0);
- self->setRect(r);
- self->reshape(self->mMaxWidth, self->getRect().getHeight());
+ setRect(r);
+ reshape(mMaxWidth, getRect().getHeight());
- self->childSetText("client", self->getString("client_text_msg", self->mStringArgs) + ":");
- self->childSetText("network", self->getString("network_text_msg", self->mStringArgs) + ":");
- self->childSetText("server", self->getString("server_text_msg", self->mStringArgs) + ":");
+ childSetText("client", getString("client_text_msg", mStringArgs) + ":");
+ childSetText("network", getString("network_text_msg",mStringArgs) + ":");
+ childSetText("server", getString("server_text_msg", mStringArgs) + ":");
// usually "<<"
- button->setLabel( self->getString("smaller_label", self->mStringArgs) );
+ button->setLabel( getString("smaller_label", mStringArgs) );
}
else
{
- self->setTitle( self->getString("min_title_msg", self->mStringArgs) );
+ setTitle( getString("min_title_msg", mStringArgs) );
// make left edge appear to collapse
r.translate(delta_width, 0);
- self->setRect(r);
- self->reshape(self->mMinWidth, self->getRect().getHeight());
+ setRect(r);
+ reshape(mMinWidth, getRect().getHeight());
- self->childSetText("client", self->getString("client_text_msg", self->mStringArgs) );
- self->childSetText("network", self->getString("network_text_msg", self->mStringArgs) );
- self->childSetText("server", self->getString("server_text_msg", self->mStringArgs) );
+ childSetText("client", getString("client_text_msg", mStringArgs) );
+ childSetText("network",getString("network_text_msg",mStringArgs) );
+ childSetText("server", getString("server_text_msg", mStringArgs) );
// usually ">>"
- button->setLabel( self->getString("bigger_label", self->mStringArgs) );
+ button->setLabel( getString("bigger_label", mStringArgs) );
}
// Don't put keyboard focus on the button
button->setFocus(FALSE);
- self->mClientText->setVisible(self->mShrunk);
- self->mClientCause->setVisible(self->mShrunk);
- self->childSetVisible("client_help", self->mShrunk);
+// self->mClientText->setVisible(self->mShrunk);
+// self->mClientCause->setVisible(self->mShrunk);
+// self->childSetVisible("client_help", self->mShrunk);
- self->mNetworkText->setVisible(self->mShrunk);
- self->mNetworkCause->setVisible(self->mShrunk);
- self->childSetVisible("network_help", self->mShrunk);
+// self->mNetworkText->setVisible(self->mShrunk);
+// self->mNetworkCause->setVisible(self->mShrunk);
+// self->childSetVisible("network_help", self->mShrunk);
- self->mServerText->setVisible(self->mShrunk);
- self->mServerCause->setVisible(self->mShrunk);
- self->childSetVisible("server_help", self->mShrunk);
+// self->mServerText->setVisible(self->mShrunk);
+// self->mServerCause->setVisible(self->mShrunk);
+// self->childSetVisible("server_help", self->mShrunk);
- self->mShrunk = !self->mShrunk;
+// self->mShrunk = !self->mShrunk;
+ gSavedSettings.setBOOL("LagMeterShrunk", !gSavedSettings.getBOOL("LagMeterShrunk"));
}