summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloater360capture.cpp1
-rw-r--r--indra/newview/llmediactrl.cpp23
-rw-r--r--indra/newview/llmediactrl.h5
-rw-r--r--indra/newview/llviewermedia.cpp45
-rw-r--r--indra/newview/llviewermenufile.cpp20
-rw-r--r--indra/newview/llviewermenufile.h14
6 files changed, 63 insertions, 45 deletions
diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp
index c469356cb0..c075f7e8bd 100644
--- a/indra/newview/llfloater360capture.cpp
+++ b/indra/newview/llfloater360capture.cpp
@@ -102,6 +102,7 @@ BOOL LLFloater360Capture::postBuild()
mWebBrowser = getChild<LLMediaCtrl>("360capture_contents");
mWebBrowser->addObserver(this);
+ mWebBrowser->setAllowFileDownload(true);
// There is a group of radio buttons that define the quality
// by each having a 'value' that is returns equal to the pixel
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 0affe8efb4..5393d0b0b7 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -46,6 +46,7 @@
#include "lluictrlfactory.h" // LLDefaultChildRegistry
#include "llkeyboard.h"
#include "llviewermenu.h"
+#include "llviewermenufile.h" // LLFilePickerThread
// linden library includes
#include "llfocusmgr.h"
@@ -105,7 +106,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
mTrusted(p.trusted_content),
mWindowShade(NULL),
mHoverTextChanged(false),
- mContextMenu(NULL)
+ mContextMenu(NULL),
+ mAllowFileDownload(false)
{
{
LLColor4 color = p.caret_color().get();
@@ -1129,8 +1131,23 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
case MEDIA_EVENT_FILE_DOWNLOAD:
{
- //llinfos << "Media event - file download requested - filename is " << self->getFileDownloadFilename() << llendl;
- //LLNotificationsUtil::add("MediaFileDownloadUnsupported");
+ if (mAllowFileDownload)
+ {
+ // pick a file from SAVE FILE dialog
+ // for now the only thing that should be allowed to save is 360s
+ std::string suggested_filename = self->getFileDownloadFilename();
+ LLFilePicker::ESaveFilter filter = LLFilePicker::FFSAVE_ALL;
+ if (suggested_filename.find(".jpg") != std::string::npos || suggested_filename.find(".jpeg") != std::string::npos)
+ filter = LLFilePicker::FFSAVE_JPEG;
+ if (suggested_filename.find(".png") != std::string::npos)
+ filter = LLFilePicker::FFSAVE_PNG;
+
+ (new LLMediaFilePicker(self, filter, suggested_filename))->getFile();
+ }
+ else
+ {
+ LLNotificationsUtil::add("MediaFileDownloadUnsupported");
+ }
};
break;
diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h
index bd24c47a4f..bc4cbaae68 100644
--- a/indra/newview/llmediactrl.h
+++ b/indra/newview/llmediactrl.h
@@ -151,6 +151,8 @@ public:
void setTrustedContent(bool trusted);
+ void setAllowFileDownload(bool allow) { mAllowFileDownload = allow; }
+
// over-rides
virtual BOOL handleKeyHere( KEY key, MASK mask);
virtual BOOL handleKeyUpHere(KEY key, MASK mask);
@@ -205,7 +207,8 @@ public:
mClearCache,
mHoverTextChanged,
mDecoupleTextureSize,
- mUpdateScrolls;
+ mUpdateScrolls,
+ mAllowFileDownload;
std::string mHomePageUrl,
mHomePageMimeType,
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 54c2099ac9..b314c78839 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -78,41 +78,12 @@
#include <boost/bind.hpp> // for SkinFolder listener
#include <boost/signals2.hpp>
-class LLMediaFilePicker : public LLFilePickerThread // deletes itself when done
-{
-public:
- LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ELoadFilter filter, bool get_multiple)
- : LLFilePickerThread(filter, get_multiple),
- mPlugin(plugin->getSharedPrt())
- {
- }
-
- LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ESaveFilter filter, const std::string &proposed_name)
- : LLFilePickerThread(filter, proposed_name),
- mPlugin(plugin->getSharedPrt())
- {
- }
-
- virtual void notify(const std::vector<std::string>& filenames)
- {
- mPlugin->sendPickFileResponse(mResponses);
- mPlugin = NULL;
- }
-
-private:
- boost::shared_ptr<LLPluginClassMedia> mPlugin;
-};
void init_threaded_picker_load_dialog(LLPluginClassMedia* plugin, LLFilePicker::ELoadFilter filter, bool get_multiple)
{
(new LLMediaFilePicker(plugin, filter, get_multiple))->getFile(); // will delete itself
}
-void init_threaded_picker_save_dialog(LLPluginClassMedia* plugin, LLFilePicker::ESaveFilter filter, std::string &proposed_name)
-{
- (new LLMediaFilePicker(plugin, filter, proposed_name))->getFile(); // will delete itself
-}
-
///////////////////////////////////////////////////////////////////////////////
// Move this to its own file.
@@ -3237,18 +3208,10 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
case LLViewerMediaObserver::MEDIA_EVENT_FILE_DOWNLOAD:
{
LL_DEBUGS("Media") << "Media event - file download requested - filename is " << plugin->getFileDownloadFilename() << LL_ENDL;
- // pick a file from SAVE FILE dialog
-
- // need a better algorithm that this or else, pass in type of save type
- // from event that initiated it - this is okay for now - only thing
- // that saves is 360s
- std::string suggested_filename = plugin->getFileDownloadFilename();
- LLFilePicker::ESaveFilter filter = LLFilePicker::FFSAVE_ALL;
- if (suggested_filename.find(".jpg") != std::string::npos || suggested_filename.find(".jpeg") != std::string::npos)
- filter = LLFilePicker::FFSAVE_JPEG;
- if (suggested_filename.find(".png") != std::string::npos)
- filter = LLFilePicker::FFSAVE_PNG;
- init_threaded_picker_save_dialog(plugin, filter, suggested_filename);
+
+ //unblock media plugin
+ const std::vector<std::string> empty_response;
+ plugin->sendPickFileResponse(empty_response);
}
break;
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index 4efc3d1cb3..bb3e80c3ad 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -46,6 +46,7 @@
#include "llimagejpeg.h"
#include "llimagetga.h"
#include "llinventorymodel.h" // gInventory
+#include "llpluginclassmedia.h"
#include "llresourcedata.h"
#include "lltoast.h"
#include "llfloaterperms.h"
@@ -251,6 +252,25 @@ void LLFilePickerReplyThread::notify(const std::vector<std::string>& filenames)
}
}
+
+LLMediaFilePicker::LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ELoadFilter filter, bool get_multiple)
+ : LLFilePickerThread(filter, get_multiple),
+ mPlugin(plugin->getSharedPrt())
+{
+}
+
+LLMediaFilePicker::LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ESaveFilter filter, const std::string &proposed_name)
+ : LLFilePickerThread(filter, proposed_name),
+ mPlugin(plugin->getSharedPrt())
+{
+}
+
+void LLMediaFilePicker::notify(const std::vector<std::string>& filenames)
+{
+ mPlugin->sendPickFileResponse(mResponses);
+ mPlugin = NULL;
+}
+
//============================================================================
#if LL_WINDOWS
diff --git a/indra/newview/llviewermenufile.h b/indra/newview/llviewermenufile.h
index 4e6250d9b4..beeac418d9 100644
--- a/indra/newview/llviewermenufile.h
+++ b/indra/newview/llviewermenufile.h
@@ -37,6 +37,7 @@
#include "llviewerassetupload.h"
class LLTransactionID;
+class LLPluginClassMedia;
void init_menu_file();
@@ -71,6 +72,7 @@ void assign_defaults_and_show_upload_message(
const std::string& display_name,
std::string& description);
+//consider moving all file pickers below to more suitable place
class LLFilePickerThread : public LLThread
{ //multi-threaded file picker (runs system specific file picker in background and calls "notify" from main thread)
public:
@@ -127,5 +129,17 @@ private:
file_picked_signal_t* mFailureSignal;
};
+class LLMediaFilePicker : public LLFilePickerThread
+{
+public:
+ LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ELoadFilter filter, bool get_multiple);
+ LLMediaFilePicker(LLPluginClassMedia* plugin, LLFilePicker::ESaveFilter filter, const std::string &proposed_name);
+
+ virtual void notify(const std::vector<std::string>& filenames);
+
+private:
+ boost::shared_ptr<LLPluginClassMedia> mPlugin;
+};
+
#endif