summaryrefslogtreecommitdiff
path: root/indra/newview/llfilepicker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfilepicker.cpp')
-rw-r--r--indra/newview/llfilepicker.cpp355
1 files changed, 264 insertions, 91 deletions
diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp
index b5f6f80b39..b61afcbbc9 100644
--- a/indra/newview/llfilepicker.cpp
+++ b/indra/newview/llfilepicker.cpp
@@ -285,6 +285,15 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking)
return success;
}
+BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter,
+ void (*callback)(bool, std::vector<std::string> &, void*),
+ void *userdata)
+{
+ // not supposed to be used yet, use LLFilePickerThread
+ LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL;
+ return FALSE;
+}
+
BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking)
{
if( mLocked )
@@ -362,6 +371,15 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking)
return success;
}
+BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter,
+ void (*callback)(bool, std::vector<std::string> &, void*),
+ void *userdata )
+{
+ // not supposed to be used yet, use LLFilePickerThread
+ LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL;
+ return FALSE;
+}
+
BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, bool blocking)
{
if( mLocked )
@@ -584,6 +602,16 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename,
return success;
}
+BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter,
+ const std::string& filename,
+ void (*callback)(bool, std::string&, void*),
+ void *userdata)
+{
+ // not supposed to be used yet, use LLFilePickerThread
+ LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL;
+ return FALSE;
+}
+
#elif LL_DARWIN
std::unique_ptr<std::vector<std::string>> LLFilePicker::navOpenFilterProc(ELoadFilter filter) //(AEDesc *theItem, void *info, void *callBackUD, NavFilterModes filterMode)
@@ -678,105 +706,123 @@ bool LLFilePicker::doNavChooseDialog(ELoadFilter filter)
return false;
}
-bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filename)
+bool LLFilePicker::doNavChooseDialogModeless(ELoadFilter filter,
+ void (*callback)(bool, std::vector<std::string> &,void*),
+ void *userdata)
{
-
- // Setup the type, creator, and extension
- std::string extension, type, creator;
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return false;
+ }
- switch (filter)
- {
- case FFSAVE_WAV:
- type = "WAVE";
- creator = "TVOD";
- extension = "wav";
- break;
- case FFSAVE_TGA:
- type = "TPIC";
- creator = "prvw";
- extension = "tga";
- break;
- case FFSAVE_TGAPNG:
- type = "PNG";
- creator = "prvw";
- extension = "png,tga";
- break;
- case FFSAVE_BMP:
- type = "BMPf";
- creator = "prvw";
- extension = "bmp";
- break;
- case FFSAVE_JPEG:
- type = "JPEG";
- creator = "prvw";
- extension = "jpeg";
- break;
- case FFSAVE_PNG:
- type = "PNG ";
- creator = "prvw";
- extension = "png";
- break;
- case FFSAVE_AVI:
- type = "\?\?\?\?";
- creator = "\?\?\?\?";
- extension = "mov";
- break;
+ std::unique_ptr<std::vector<std::string>> allowed_types=navOpenFilterProc(filter);
+
+ doLoadDialogModeless(allowed_types.get(),
+ mPickOptions,
+ callback,
+ userdata);
+
+ return true;
+}
- case FFSAVE_ANIM:
- type = "\?\?\?\?";
- creator = "\?\?\?\?";
- extension = "xaf";
- break;
+void set_nav_save_data(LLFilePicker::ESaveFilter filter, std::string &extension, std::string &type, std::string &creator)
+{
+ switch (filter)
+ {
+ case LLFilePicker::FFSAVE_WAV:
+ type = "WAVE";
+ creator = "TVOD";
+ extension = "wav";
+ break;
+ case LLFilePicker::FFSAVE_TGA:
+ type = "TPIC";
+ creator = "prvw";
+ extension = "tga";
+ break;
+ case LLFilePicker::FFSAVE_TGAPNG:
+ type = "PNG";
+ creator = "prvw";
+ extension = "png,tga";
+ break;
+ case LLFilePicker::FFSAVE_BMP:
+ type = "BMPf";
+ creator = "prvw";
+ extension = "bmp";
+ break;
+ case LLFilePicker::FFSAVE_JPEG:
+ type = "JPEG";
+ creator = "prvw";
+ extension = "jpeg";
+ break;
+ case LLFilePicker::FFSAVE_PNG:
+ type = "PNG ";
+ creator = "prvw";
+ extension = "png";
+ break;
+ case LLFilePicker::FFSAVE_AVI:
+ type = "\?\?\?\?";
+ creator = "\?\?\?\?";
+ extension = "mov";
+ break;
+
+ case LLFilePicker::FFSAVE_ANIM:
+ type = "\?\?\?\?";
+ creator = "\?\?\?\?";
+ extension = "xaf";
+ break;
#ifdef _CORY_TESTING
- case FFSAVE_GEOMETRY:
- type = "\?\?\?\?";
- creator = "\?\?\?\?";
- extension = "slg";
- break;
-#endif
-
- case FFSAVE_XML:
- type = "\?\?\?\?";
- creator = "\?\?\?\?";
- extension = "xml";
- break;
-
- case FFSAVE_RAW:
- type = "\?\?\?\?";
- creator = "\?\?\?\?";
- extension = "raw";
- break;
+ case LLFilePicker::FFSAVE_GEOMETRY:
+ type = "\?\?\?\?";
+ creator = "\?\?\?\?";
+ extension = "slg";
+ break;
+#endif
+
+ case LLFilePicker::FFSAVE_XML:
+ type = "\?\?\?\?";
+ creator = "\?\?\?\?";
+ extension = "xml";
+ break;
+
+ case LLFilePicker::FFSAVE_RAW:
+ type = "\?\?\?\?";
+ creator = "\?\?\?\?";
+ extension = "raw";
+ break;
- case FFSAVE_J2C:
- type = "\?\?\?\?";
- creator = "prvw";
- extension = "j2c";
- break;
-
- case FFSAVE_SCRIPT:
- type = "LSL ";
- creator = "\?\?\?\?";
- extension = "lsl";
- break;
-
- case FFSAVE_ALL:
- default:
- type = "\?\?\?\?";
- creator = "\?\?\?\?";
- extension = "";
- break;
- }
+ case LLFilePicker::FFSAVE_J2C:
+ type = "\?\?\?\?";
+ creator = "prvw";
+ extension = "j2c";
+ break;
+
+ case LLFilePicker::FFSAVE_SCRIPT:
+ type = "LSL ";
+ creator = "\?\?\?\?";
+ extension = "lsl";
+ break;
+
+ case LLFilePicker::FFSAVE_ALL:
+ default:
+ type = "\?\?\?\?";
+ creator = "\?\?\?\?";
+ extension = "";
+ break;
+ }
+}
+
+bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filename)
+{
+ // Setup the type, creator, and extension
+ std::string extension, type, creator;
+
+ set_nav_save_data(filter, extension, type, creator);
std::string namestring = filename;
if (namestring.empty()) namestring="Untitled";
-// if (! boost::algorithm::ends_with(namestring, extension) )
-// {
-// namestring = namestring + "." + extension;
-//
-// }
-
gViewerWindow->getWindow()->beforeDialog();
// Run the dialog
@@ -797,6 +843,30 @@ bool LLFilePicker::doNavSaveDialog(ESaveFilter filter, const std::string& filena
return false;
}
+bool LLFilePicker::doNavSaveDialogModeless(ESaveFilter filter,
+ const std::string& filename,
+ void (*callback)(bool, std::string&, void*),
+ void *userdata)
+{
+ // Setup the type, creator, and extension
+ std::string extension, type, creator;
+
+ set_nav_save_data(filter, extension, type, creator);
+
+ std::string namestring = filename;
+ if (namestring.empty()) namestring="Untitled";
+
+ // Run the dialog
+ doSaveDialogModeless(&namestring,
+ &type,
+ &creator,
+ &extension,
+ mPickOptions,
+ callback,
+ userdata);
+ return true;
+}
+
BOOL LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking)
{
if( mLocked )
@@ -852,18 +922,52 @@ BOOL LLFilePicker::getOpenFile(ELoadFilter filter, bool blocking)
return success;
}
+
+BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter,
+ void (*callback)(bool, std::vector<std::string> &, void*),
+ void *userdata)
+{
+ if( mLocked )
+ return FALSE;
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
+ reset();
+
+ mPickOptions &= ~F_MULTIPLE;
+ mPickOptions |= F_FILE;
+
+ if (filter == FFLOAD_DIRECTORY) //This should only be called from lldirpicker.
+ {
+
+ mPickOptions |= ( F_NAV_SUPPORT | F_DIRECTORY );
+ mPickOptions &= ~F_FILE;
+ }
+
+ if (filter == FFLOAD_ALL) // allow application bundles etc. to be traversed; important for DEV-16869, but generally useful
+ {
+ mPickOptions |= F_NAV_SUPPORT;
+ }
+
+ return doNavChooseDialogModeless(filter, callback, userdata);
+}
+
BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking)
{
if( mLocked )
return FALSE;
- BOOL success = FALSE;
-
// if local file browsing is turned off, return without opening dialog
if ( check_local_file_access_enabled() == false )
{
return FALSE;
}
+
+ BOOL success = FALSE;
reset();
@@ -897,6 +1001,29 @@ BOOL LLFilePicker::getMultipleOpenFiles(ELoadFilter filter, bool blocking)
return success;
}
+
+BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter,
+ void (*callback)(bool, std::vector<std::string> &, void*),
+ void *userdata )
+{
+ if( mLocked )
+ return FALSE;
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return FALSE;
+ }
+
+ reset();
+
+ mPickOptions |= F_FILE;
+
+ mPickOptions |= F_MULTIPLE;
+
+ return doNavChooseDialogModeless(filter, callback, userdata);
+}
+
BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename, bool blocking)
{
@@ -937,6 +1064,27 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename,
LLFrameTimer::updateFrameTime();
return success;
}
+
+BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter,
+ const std::string& filename,
+ void (*callback)(bool, std::string&, void*),
+ void *userdata)
+{
+ if( mLocked )
+ return false;
+
+ // if local file browsing is turned off, return without opening dialog
+ if ( check_local_file_access_enabled() == false )
+ {
+ return false;
+ }
+
+ reset();
+
+ mPickOptions &= ~F_MULTIPLE;
+
+ return doNavSaveDialogModeless(filter, filename, callback, userdata);
+}
//END LL_DARWIN
#elif LL_LINUX
@@ -1444,6 +1592,15 @@ BOOL LLFilePicker::getSaveFile( ESaveFilter filter, const std::string& filename,
return FALSE;
}
+BOOL LLFilePicker::getSaveFileModeless(ESaveFilter filter,
+ const std::string& filename,
+ void (*callback)(bool, std::string&, void*),
+ void *userdata)
+{
+ LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL;
+ return FALSE;
+}
+
BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking )
{
// if local file browsing is turned off, return without opening dialog
@@ -1469,6 +1626,14 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter, bool blocking )
return TRUE;
}
+BOOL LLFilePicker::getOpenFileModeless(ELoadFilter filter,
+ void (*callback)(bool, std::vector<std::string> &, void*),
+ void *userdata)
+{
+ LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL;
+ return FALSE;
+}
+
BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking)
{
// if local file browsing is turned off, return without opening dialog
@@ -1482,6 +1647,14 @@ BOOL LLFilePicker::getMultipleOpenFiles( ELoadFilter filter, bool blocking)
return FALSE;
}
+BOOL LLFilePicker::getMultipleOpenFilesModeless(ELoadFilter filter,
+ void (*callback)(bool, std::vector<std::string> &, void*),
+ void *userdata )
+{
+ LL_ERRS() << "NOT IMPLEMENTED" << LL_ENDL;
+ return FALSE;
+}
+
#endif // LL_GTK
#else // not implemented