Add support for flushing messages from plugin to viewer.

Actually flush messages before terminating a plugin (upon
the shutdown message) and flush messages in the file- and
dirpicker before opening the blocking dialog. Flush debug
messages too (deeper into the code, just prior to the actual
blocking call).

Also, fix the context folder map to be a thread-safe
singleton and *attempt* to add support for default folders
to windows and Mac. The latter might even not compile yet
and definitely have to be tested (and fixed):
Opening a DirPicker in preferences --> Network and Set
the directory location of the cache. It should open a
Dialog window where you are already in the folder that
is the current cache directory setting (you can click
Cancel after verifying that this worked).
And, start to upload an image, select a file is some
directory (other than what it starts in). You can omit
the actual upload by clicking cancel in the preview.
Then upload again and now it should start in the same
folder as that you were just in. Possibly you need to
first open a file picker elsewhere with a different context
though, or windows might choose to open in the last
folder anyway while the code doesn't really work. Uploading
a sound before the second texture upload should do the
trick.
This commit is contained in:
Aleric Inglewood
2011-05-12 18:22:51 +02:00
parent 38b33328e6
commit 5f72cbb103
15 changed files with 258 additions and 91 deletions

View File

@@ -115,6 +115,20 @@ void BasicPluginBase::sendLogMessage(std::string const& message, LLPluginMessage
logmessage.setValue("message", message);
logmessage.setValueS32("log_level",level);
mSendMessageFunction(logmessage.generate().c_str(), &mPluginInstance);
// Theoretically we should flush here (that's what PLS_ENDL means), but we don't because
// that interfers with how the code would act without debug messages. Instead, the developer
// is responsible to call flushMessages themselves at the appropriate places.
}
/**
* Flush all messages to the viewer.
*
* This blocks if necessary, up till 10 seconds, before it gives up.
*/
void BasicPluginBase::flushMessages(void)
{
LLPluginMessage logmessage(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "flush");
mSendMessageFunction(logmessage.generate().c_str(), &mPluginInstance);
}
/**
@@ -124,6 +138,9 @@ void BasicPluginBase::sendLogMessage(std::string const& message, LLPluginMessage
*/
void BasicPluginBase::sendShutdownMessage(void)
{
// Do a double flush. First flush all messages so far, then send the shutdown message,
// which also will try to flush itself before terminating the process.
flushMessages();
LLPluginMessage shutdownmessage(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "shutdown");
sendMessage(shutdownmessage);
}