diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2023-07-12 10:08:56 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2023-07-12 10:08:56 -0400 |
commit | 73d90aa9dd87986dc2ef8f39db346b71c58b181b (patch) | |
tree | a2ec930f732aaed7d7addbb22bb34b15c78d408b /indra/newview/llviewermenufile.cpp | |
parent | 8e70575be833cf2056b1ceef7ef842cbc7700ce0 (diff) | |
parent | e80f0f331dbfca686e0a80c557e9b1e455c8d167 (diff) |
SL-18837: Merge branch 'DRTVWR-587-maint-V' into rm-cxxstd.
Diffstat (limited to 'indra/newview/llviewermenufile.cpp')
-rw-r--r-- | indra/newview/llviewermenufile.cpp | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index fdf1d04c09..27fe7a7018 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -123,7 +123,10 @@ std::queue<LLFilePickerThread*> LLFilePickerThread::sDeadQ; void LLFilePickerThread::getFile() { #if LL_WINDOWS + // Todo: get rid of LLFilePickerThread and make this modeless start(); +#elif LL_DARWIN + runModeless(); #else run(); #endif @@ -166,7 +169,82 @@ void LLFilePickerThread::run() LLMutexLock lock(sMutex); sDeadQ.push(this); } +} + +void LLFilePickerThread::runModeless() +{ + BOOL result = FALSE; + LLFilePicker picker; + + if (mIsSaveDialog) + { + result = picker.getSaveFileModeless(mSaveFilter, + mProposedName, + modelessStringCallback, + this); + } + else if (mIsGetMultiple) + { + result = picker.getMultipleOpenFilesModeless(mLoadFilter, modelessVectorCallback, this); + } + else + { + result = picker.getOpenFileModeless(mLoadFilter, modelessVectorCallback, this); + } + + if (!result) + { + LLMutexLock lock(sMutex); + sDeadQ.push(this); + } +} +void LLFilePickerThread::modelessStringCallback(bool success, + std::string &response, + void *user_data) +{ + LLFilePickerThread *picker = (LLFilePickerThread*)user_data; + if (success) + { + picker->mResponses.push_back(response); + } + + { + LLMutexLock lock(sMutex); + sDeadQ.push(picker); + } +} + +void LLFilePickerThread::modelessVectorCallback(bool success, + std::vector<std::string> &responses, + void *user_data) +{ + LLFilePickerThread *picker = (LLFilePickerThread*)user_data; + if (success) + { + if (picker->mIsGetMultiple) + { + picker->mResponses = responses; + } + else + { + std::vector<std::string>::iterator iter = responses.begin(); + while (iter != responses.end()) + { + if (!iter->empty()) + { + picker->mResponses.push_back(*iter); + break; + } + iter++; + } + } + } + + { + LLMutexLock lock(sMutex); + sDeadQ.push(picker); + } } //static |