Make FilePicker context sensitive default paths persistent over logins.
Also, make newview/statemachine a separate project.
This commit is contained in:
@@ -106,6 +106,7 @@ if (VIEWER)
|
||||
add_dependencies(viewer solaris-crash-logger)
|
||||
endif (LINUX)
|
||||
|
||||
add_subdirectory(${VIEWER_PREFIX}newview/statemachine)
|
||||
add_subdirectory(${VIEWER_PREFIX}newview)
|
||||
add_dependencies(viewer secondlife-bin)
|
||||
endif (VIEWER)
|
||||
|
||||
4
indra/cmake/AIStateMachine.cmake
Normal file
4
indra/cmake/AIStateMachine.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
# -*- cmake -*-
|
||||
|
||||
set(AISTATEMACHINE_INCLUDE_DIRS statemachine)
|
||||
set(AISTATEMACHINE_LIBRARIES statemachine)
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <deque>
|
||||
#include "stdtypes.h" // llcommon/stdtypes.h, needed for S32 and U32.
|
||||
|
||||
// Use to compare the first element only of a pair
|
||||
// e.g. typedef std::set<std::pair<int, Data*>, compare_pair<int, Data*> > some_pair_set_t;
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#define LL_LLPLUGINCLASSMEDIA_H
|
||||
|
||||
#include "llpluginclassbasic.h"
|
||||
#include "llgltypes.h"
|
||||
#include "llrect.h"
|
||||
#include "v4color.h"
|
||||
|
||||
@@ -232,9 +231,9 @@ protected:
|
||||
|
||||
bool mTextureParamsReceived; // the mRequestedTexture* fields are only valid when this is true
|
||||
S32 mRequestedTextureDepth;
|
||||
LLGLenum mRequestedTextureInternalFormat;
|
||||
LLGLenum mRequestedTextureFormat;
|
||||
LLGLenum mRequestedTextureType;
|
||||
U32 mRequestedTextureInternalFormat;
|
||||
U32 mRequestedTextureFormat;
|
||||
U32 mRequestedTextureType;
|
||||
bool mRequestedTextureSwapBytes;
|
||||
bool mRequestedTextureCoordsOpenGL;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ include(LLInventory)
|
||||
include(LLMath)
|
||||
include(LLMessage)
|
||||
include(LLPlugin)
|
||||
include(AIStateMachine)
|
||||
include(LLPrimitive)
|
||||
include(LLRender)
|
||||
include(LLUI)
|
||||
@@ -43,6 +44,7 @@ if (WINDOWS)
|
||||
endif (WINDOWS)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/newview
|
||||
${DBUSGLIB_INCLUDE_DIRS}
|
||||
${HUNSPELL_INCLUDE_DIR}
|
||||
${ELFIO_INCLUDE_DIR}
|
||||
@@ -1006,18 +1008,6 @@ set(viewer_HEADER_FILES
|
||||
|
||||
source_group("CMake Rules" FILES ViewerInstall.cmake)
|
||||
|
||||
set(statemachine_SOURCE_FILES
|
||||
statemachine/aistatemachine.cpp
|
||||
statemachine/aifilepicker.cpp
|
||||
)
|
||||
set(statemachine_HEADER_FILES
|
||||
statemachine/aistatemachine.h
|
||||
statemachine/aifilepicker.h
|
||||
statemachine/aidirpicker.h
|
||||
)
|
||||
list(APPEND viewer_SOURCE_FILES ${statemachine_SOURCE_FILES})
|
||||
list(APPEND viewer_HEADER_FILES ${statemachine_HEADER_FILES})
|
||||
|
||||
if (DARWIN)
|
||||
LIST(APPEND viewer_SOURCE_FILES llappviewermacosx.cpp)
|
||||
|
||||
@@ -1434,6 +1424,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
|
||||
${LLINVENTORY_LIBRARIES}
|
||||
${LLMESSAGE_LIBRARIES}
|
||||
${LLPLUGIN_LIBRARIES}
|
||||
${AISTATEMACHINE_LIBRARIES}
|
||||
${LLPRIMITIVE_LIBRARIES}
|
||||
${LLRENDER_LIBRARIES}
|
||||
${FREETYPE_LIBRARIES}
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
#include "llmutelist.h"
|
||||
#include "llurldispatcher.h"
|
||||
#include "llurlhistory.h"
|
||||
#include "statemachine/aifilepicker.h"
|
||||
#include "llfirstuse.h"
|
||||
#include "llrender.h"
|
||||
#include "llfont.h"
|
||||
@@ -1353,6 +1354,9 @@ bool LLAppViewer::cleanup()
|
||||
// Save URL history file
|
||||
LLURLHistory::saveFile("url_history.xml");
|
||||
|
||||
// Save file- and dirpicker {context, default paths} map.
|
||||
AIFilePicker::saveFile("filepicker_contexts.xml");
|
||||
|
||||
// save mute list. gMuteList used to also be deleted here too.
|
||||
LLMuteList::getInstance()->cache(gAgent.getID());
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "hippogridmanager.h"
|
||||
#include "hippolimits.h"
|
||||
#include "floaterao.h"
|
||||
#include "statemachine/aifilepicker.h"
|
||||
|
||||
#include "llares.h"
|
||||
#include "llcachename.h"
|
||||
@@ -636,6 +637,12 @@ bool idle_startup()
|
||||
|
||||
LLStartUp::handleSocksProxy(false);
|
||||
|
||||
//-------------------------------------------------
|
||||
// Load file- and dirpicker {context, default path} map.
|
||||
//-------------------------------------------------
|
||||
|
||||
AIFilePicker::loadFile("filepicker_contexts.xml");
|
||||
|
||||
//-------------------------------------------------
|
||||
// Init audio, which may be needed for prefs dialog
|
||||
// or audio cues in connection UI.
|
||||
|
||||
@@ -810,6 +810,16 @@ template <> eControlType get_control_type<LLSD>(const LLSD& in, LLSD& out)
|
||||
return TYPE_LLSD;
|
||||
}
|
||||
|
||||
void onCommitControlSetting_gSavedSettings(LLUICtrl* ctrl, void* name)
|
||||
{
|
||||
gSavedSettings.setValue((const char*)name,ctrl->getValue());
|
||||
}
|
||||
|
||||
void onCommitControlSetting_gSavedPerAccountSettings(LLUICtrl* ctrl, void* name)
|
||||
{
|
||||
gSavedPerAccountSettings.setValue((const char*)name,ctrl->getValue());
|
||||
}
|
||||
|
||||
#if TEST_CACHED_CONTROL
|
||||
|
||||
#define DECL_LLCC(T, V) static LLCachedControl<T> mySetting_##T("TestCachedControl"#T, V)
|
||||
|
||||
@@ -35,9 +35,10 @@
|
||||
|
||||
#include <map>
|
||||
#include "llcontrol.h"
|
||||
#include "lluictrl.h"
|
||||
#include "aithreadsafe.h"
|
||||
|
||||
class LLUICtrl;
|
||||
|
||||
// Enabled this definition to compile a 'hacked' viewer that
|
||||
// allows a hacked godmode to be toggled on and off.
|
||||
#define TOGGLE_HACKED_GODLIKE_VIEWER
|
||||
@@ -75,8 +76,8 @@ bool handleCloudSettingsChanged(const LLSD& newvalue);
|
||||
|
||||
|
||||
//A template would be a little awkward to use here.. so.. a preprocessor macro. Alas. onCommitControlSetting(gSavedSettings) etc.
|
||||
inline void onCommitControlSetting_gSavedSettings(LLUICtrl* ctrl, void* name) {gSavedSettings.setValue((const char*)name,ctrl->getValue());}
|
||||
inline void onCommitControlSetting_gSavedPerAccountSettings(LLUICtrl* ctrl, void* name) {gSavedPerAccountSettings.setValue((const char*)name,ctrl->getValue());}
|
||||
void onCommitControlSetting_gSavedSettings(LLUICtrl* ctrl, void* name);
|
||||
void onCommitControlSetting_gSavedPerAccountSettings(LLUICtrl* ctrl, void* name);
|
||||
#define onCommitControlSetting(controlgroup) onCommitControlSetting_##controlgroup
|
||||
|
||||
//#define TEST_CACHED_CONTROL 1
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
#include "llviewerpluginmanager.h"
|
||||
#include "llnotifications.h"
|
||||
|
||||
void LLViewerPluginManager::destroyPlugin()
|
||||
{
|
||||
@@ -54,3 +55,12 @@ void LLViewerPluginManager::update()
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void LLViewerPluginManager::send_plugin_failure_warning(std::string const& plugin_basename)
|
||||
{
|
||||
LL_WARNS("Plugin") << "plugin intialization failed for plugin: " << plugin_basename << LL_ENDL;
|
||||
LLSD args;
|
||||
args["MIME_TYPE"] = plugin_basename; // FIXME: Use different notification.
|
||||
LLNotifications::instance().add("NoPlugin", args);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "lldir.h"
|
||||
#include "llfile.h"
|
||||
#include "llviewercontrol.h"
|
||||
#include "llnotifications.h"
|
||||
#include "llpluginclassbasic.h"
|
||||
|
||||
class LLViewerPluginManager : public LLRefCount
|
||||
@@ -65,6 +64,10 @@ public:
|
||||
// Return pointer to plugin.
|
||||
LLPluginClassBasic* getPlugin(void) const { return mPluginBase; }
|
||||
|
||||
private:
|
||||
// Called from createPlugin.
|
||||
void send_plugin_failure_warning(std::string const& plugin_basename);
|
||||
|
||||
protected:
|
||||
LLPluginClassBasic* mPluginBase; //!< Pointer to the base class of the underlaying plugin.
|
||||
};
|
||||
@@ -104,11 +107,7 @@ LLPluginClassBasic* LLViewerPluginManager::createPlugin(T* user_data)
|
||||
if (mPluginBase)
|
||||
return mPluginBase;
|
||||
|
||||
LL_WARNS("Plugin") << "plugin intialization failed for plugin: " << PLUGIN_TYPE::plugin_basename() << LL_ENDL;
|
||||
LLSD args;
|
||||
args["MIME_TYPE"] = PLUGIN_TYPE::plugin_basename(); // FIXME: Use different notification.
|
||||
LLNotifications::instance().add("NoPlugin", args);
|
||||
|
||||
send_plugin_failure_warning(PLUGIN_TYPE::plugin_basename());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
41
indra/newview/statemachine/CMakeLists.txt
Normal file
41
indra/newview/statemachine/CMakeLists.txt
Normal file
@@ -0,0 +1,41 @@
|
||||
# -*- cmake -*-
|
||||
|
||||
project(statemachine)
|
||||
|
||||
include(00-Common)
|
||||
include(LLCommon)
|
||||
include(LLPlugin)
|
||||
include(LLMessage) # This is needed by LLPlugin.
|
||||
include(LLMath)
|
||||
include(LLVFS)
|
||||
include(LLXML)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/newview
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
${LLPLUGIN_INCLUDE_DIRS}
|
||||
${LLMESSAGE_INCLUDE_DIRS}
|
||||
${LLMATH_INCLUDE_DIRS}
|
||||
${LLVFS_INCLUDE_DIRS}
|
||||
${LLXML_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(statemachine_SOURCE_FILES
|
||||
aistatemachine.cpp
|
||||
aifilepicker.cpp
|
||||
)
|
||||
|
||||
set(statemachine_HEADER_FILES
|
||||
CMakeLists.txt
|
||||
aistatemachine.h
|
||||
aifilepicker.h
|
||||
aidirpicker.h
|
||||
)
|
||||
|
||||
set_source_files_properties(${statemachine_HEADER_FILES}
|
||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||
|
||||
list(APPEND statemachine_SOURCE_FILES ${statemachine_HEADER_FILES})
|
||||
|
||||
add_library (statemachine ${statemachine_SOURCE_FILES})
|
||||
add_dependencies(statemachine prepare)
|
||||
@@ -28,14 +28,14 @@
|
||||
* Initial version, written by Aleric Inglewood @ SL
|
||||
*/
|
||||
|
||||
#include "../llviewerprecompiledheaders.h"
|
||||
#include "../llviewermedia.h"
|
||||
#include "../lltrans.h"
|
||||
#include "linden_common.h"
|
||||
#include "lltrans.h"
|
||||
#include "llpluginclassmedia.h"
|
||||
#include "llpluginmessageclasses.h"
|
||||
#include "llsdserialize.h"
|
||||
#include "aifilepicker.h"
|
||||
#if LL_WINDOWS
|
||||
#include "../llviewerwindow.h"
|
||||
#include "llviewerwindow.h"
|
||||
#endif
|
||||
#if LL_GTK && LL_X11
|
||||
#include "llwindowsdl.h"
|
||||
@@ -456,3 +456,62 @@ std::string AIFilePicker::getFolder(void) const
|
||||
return gDirUtilp->getDirName(getFilename());
|
||||
}
|
||||
|
||||
// static
|
||||
bool AIFilePicker::loadFile(std::string const& filename)
|
||||
{
|
||||
LLSD data;
|
||||
std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename);
|
||||
llifstream file(filepath);
|
||||
if (file.is_open())
|
||||
{
|
||||
llinfos << "Loading filepicker context file at \"" << filepath << "\"." << llendl;
|
||||
LLSDSerialize::fromXML(data, file);
|
||||
}
|
||||
|
||||
if (!data.isMap())
|
||||
{
|
||||
llinfos << "File missing, ill-formed, or simply undefined; not changing the file (" << filepath << ")." << llendl;
|
||||
return false;
|
||||
}
|
||||
|
||||
AIAccess<context_map_type> wContextMap(sContextMap);
|
||||
|
||||
for (LLSD::map_const_iterator iter = data.beginMap(); iter != data.endMap(); ++iter)
|
||||
{
|
||||
wContextMap->insert(context_map_type::value_type(iter->first, iter->second.asString()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool AIFilePicker::saveFile(std::string const& filename)
|
||||
{
|
||||
AIAccess<context_map_type> wContextMap(sContextMap);
|
||||
if (wContextMap->empty())
|
||||
return false;
|
||||
|
||||
LLSD context;
|
||||
|
||||
for (context_map_type::iterator iter = wContextMap->begin(); iter != wContextMap->end(); ++iter)
|
||||
{
|
||||
context[iter->first] = iter->second;
|
||||
}
|
||||
|
||||
std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename);
|
||||
llofstream file;
|
||||
file.open(filepath.c_str());
|
||||
if (!file.is_open())
|
||||
{
|
||||
llwarns << "Unable to open filepicker context file for save: \"" << filepath << "\"." << llendl;
|
||||
return false;
|
||||
}
|
||||
|
||||
LLSDSerialize::toPrettyXML(context, file);
|
||||
|
||||
file.close();
|
||||
llinfos << "Saved default paths to \"" << filepath << "\"." << llendl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "aistatemachine.h"
|
||||
#include "llpluginclassmedia.h"
|
||||
#include "../llviewermedia.h"
|
||||
#include "llviewerpluginmanager.h"
|
||||
#include <vector>
|
||||
|
||||
enum ELoadFilter
|
||||
@@ -165,6 +165,11 @@ public:
|
||||
std::string getFolder(void) const;
|
||||
std::vector<std::string> const& getFilenames(void) const { return mFilenames; }
|
||||
|
||||
// Load the sContextMap from disk.
|
||||
static bool loadFile(std::string const& filename);
|
||||
// Save the sContextMap to disk.
|
||||
static bool saveFile(std::string const& filename);
|
||||
|
||||
private:
|
||||
friend class AIPluginFilePicker;
|
||||
|
||||
|
||||
@@ -28,17 +28,18 @@
|
||||
* Initial version, written by Aleric Inglewood @ SL
|
||||
*/
|
||||
|
||||
#include "../llviewerprecompiledheaders.h"
|
||||
#include "linden_common.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "../llcallbacklist.h"
|
||||
#include "../llviewercontrol.h"
|
||||
|
||||
#include "llcallbacklist.h"
|
||||
#include "llcontrol.h"
|
||||
#include "llfasttimer.h"
|
||||
#include "aithreadsafe.h"
|
||||
#include "aistatemachine.h"
|
||||
|
||||
extern LLControlGroup gSavedSettings;
|
||||
|
||||
// Local variables.
|
||||
namespace {
|
||||
struct QueueElementComp;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "aithreadsafe.h"
|
||||
#include "llfasttimer.h"
|
||||
#include <boost/signal.hpp>
|
||||
|
||||
//!
|
||||
// A AIStateMachine is a base class that allows derived classes to
|
||||
|
||||
Reference in New Issue
Block a user