ACME-1243 : WIP : Populate filter drop down with filter list dynamically
parent
0c7cab771c
commit
2202150af4
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue