summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authormerov <none@none>2014-01-11 01:00:35 +0000
committermerov <none@none>2014-01-11 01:00:35 +0000
commit2202150af43a44ecf3d989f21ebf4ce5f79a23cc (patch)
tree0acf03e9078f1e9a1bb31519d556f9de035522da /indra
parent0c7cab771cb7972ed44eedf0c16133ef082eb9e1 (diff)
ACME-1243 : WIP : Populate filter drop down with filter list dynamically
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloaterflickr.cpp9
-rw-r--r--indra/newview/llimagefiltersmanager.cpp24
-rw-r--r--indra/newview/llimagefiltersmanager.h27
3 files changed, 38 insertions, 22 deletions
diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp
index 675266143d..8395c0db5a 100644
--- a/indra/newview/llfloaterflickr.cpp
+++ b/indra/newview/llfloaterflickr.cpp
@@ -36,6 +36,7 @@
#include "llflickrconnect.h"
#include "llfloaterreg.h"
#include "lliconctrl.h"
+#include "llimagefiltersmanager.h"
#include "llresmgr.h" // LLLocale
#include "llsdserialize.h"
#include "llloadingindicator.h"
@@ -106,6 +107,14 @@ BOOL LLFlickrPhotoPanel::postBuild()
mPostButton = getChild<LLUICtrl>("post_photo_btn");
mCancelButton = getChild<LLUICtrl>("cancel_photo_btn");
+ // Update filter list
+ std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList();
+ LLComboBox* filterbox = static_cast<LLComboBox *>(mFilterComboBox);
+ for (U32 i = 0; i < filter_list.size(); i++)
+ {
+ filterbox->add(filter_list[i]);
+ }
+
return LLPanel::postBuild();
}
diff --git a/indra/newview/llimagefiltersmanager.cpp b/indra/newview/llimagefiltersmanager.cpp
index efc4f56ad3..888e5ec5dd 100644
--- a/indra/newview/llimagefiltersmanager.cpp
+++ b/indra/newview/llimagefiltersmanager.cpp
@@ -1,5 +1,5 @@
/**
- * @file llimagefilters.cpp
+ * @file llimagefiltersmanager.cpp
* @brief Load and execute image filters. Mostly used for Flickr at the moment.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
@@ -26,7 +26,7 @@
#include "llviewerprecompiledheaders.h"
-#include "llimagefilters.h"
+#include "llimagefiltersmanager.h"
#include "lldiriterator.h"
@@ -35,34 +35,36 @@
// LLImageFilters
//---------------------------------------------------------------------------
-LLImageFilters::LLImageFilters()
+LLImageFiltersManager::LLImageFiltersManager()
{
}
-LLImageFilters::~LLImageFilters()
+LLImageFiltersManager::~LLImageFiltersManager()
{
}
// virtual static
-void LLImageFilters::initSingleton()
+void LLImageFiltersManager::initSingleton()
{
loadAllFilters();
}
// static
-std::string LLImageFilters::getSysDir()
+std::string LLImageFiltersManager::getSysDir()
{
return gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "filters", "");
}
-void LLImageFilters::loadAllFilters()
+void LLImageFiltersManager::loadAllFilters()
{
// Load system (coming out of the box) filters
loadFiltersFromDir(getSysDir());
}
-void LLImageFilters::loadFiltersFromDir(const std::string& dir)
+void LLImageFiltersManager::loadFiltersFromDir(const std::string& dir)
{
+ mFiltersList.clear();
+
LLDirIterator dir_iter(dir, "*.xml");
while (1)
{
@@ -71,11 +73,15 @@ void LLImageFilters::loadFiltersFromDir(const std::string& dir)
{
break; // no more files
}
+
+ // Get the ".xml" out of the file name to get the filter name
+ std::string filter_name = file.substr(0,file.length()-4);
+ mFiltersList.push_back(filter_name);
std::string path = gDirUtilp->add(dir, file);
// For the moment, just output the file found to the log
- llinfos << "Merov : loadFiltersFromDir, filter = " << path << llendl;
+ llinfos << "Merov : loadFiltersFromDir, filter = " << file << ",path = " << path << llendl;
}
}
diff --git a/indra/newview/llimagefiltersmanager.h b/indra/newview/llimagefiltersmanager.h
index 52b4a56b9b..e916dc7187 100644
--- a/indra/newview/llimagefiltersmanager.h
+++ b/indra/newview/llimagefiltersmanager.h
@@ -1,5 +1,5 @@
/**
- * @file llimagefilters.h
+ * @file llimagefiltersmanager.h
* @brief Load and execute image filters. Mostly used for Flickr at the moment.
*
* $LicenseInfo:firstyear=2000&license=viewerlgpl$
@@ -24,8 +24,8 @@
* $/LicenseInfo$
*/
-#ifndef LL_LLIMAGEFILTERS_H
-#define LL_LLIMAGEFILTERS_H
+#ifndef LL_LLIMAGEFILTERSMANAGER_H
+#define LL_LLIMAGEFILTERSMANAGER_H
#include "llsingleton.h"
#include "llimage.h"
@@ -46,29 +46,30 @@ typedef enum e_screen_mode
//============================================================================
// library initialization class
-class LLImageFilters : public LLSingleton<LLImageFilters>
+class LLImageFiltersManager : public LLSingleton<LLImageFiltersManager>
{
- LOG_CLASS(LLImageFilters);
+ LOG_CLASS(LLImageFiltersManager);
public:
// getFilters(); get a vector of std::string containing the filter names
//LLSD loadFilter(const std::string& filter_name);
//void executeFilter(const LLSD& filter_data, LLPointer<LLImageRaw> raw_image);
-
+ const std::vector<std::string> &getFiltersList() const { return mFiltersList; }
+
protected:
private:
void loadAllFilters();
void loadFiltersFromDir(const std::string& dir);
- LLSD loadFilter(const std::string& path);
+// LLSD loadFilter(const std::string& path);
static std::string getSysDir();
- friend class LLSingleton<LLImageFilters>;
+ friend class LLSingleton<LLImageFiltersManager>;
/*virtual*/ void initSingleton();
- LLImageFilters();
- ~LLImageFilters();
+ LLImageFiltersManager();
+ ~LLImageFiltersManager();
- // Needed here:
- // - a map of filter files with name and path
+ // List of filters
+ std::vector<std::string> mFiltersList;
};
-#endif
+#endif // LL_LLIMAGEFILTERSMANAGER_H