diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2023-05-17 23:57:11 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2023-05-17 23:57:11 +0300 |
commit | 53ed0ec70ce5c774c57c9783050c7e1b35885eec (patch) | |
tree | 62015d4736d86dc1cebc378ff59c33b1e01f42bc /indra/newview/llviewermenufile.cpp | |
parent | 784436a5b89062df69251c9ac28904f06a018011 (diff) | |
parent | 5a70639b7992842a9f74ec81b11bac56608b8f2e (diff) |
Merge branch 'main' into DRTVWR-567
# Conflicts:
# doc/contributions.txt
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 6c07c28d81..ac6b8b2aa7 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 |