Skip to content
Snippets Groups Projects
Commit 8eef8e16 authored by ¡Cinder! ㊝'s avatar ¡Cinder! ㊝ :speech_balloon:
Browse files

Why go out for hamburgers when you have PRIME RIB DIRECTORY SEARCH at home?

parent d81f9a14
No related branches found
No related tags found
No related merge requests found
Showing
with 2066 additions and 3631 deletions
......@@ -67,3 +67,4 @@ trivial_change_force_build
web/config.*
web/locale.*
web/secondlife.com.*
/Pipfile.lock
......@@ -141,7 +141,6 @@ set(viewer_SOURCE_FILES
altoolalign.cpp
alunzip.cpp
alviewermenu.cpp
fsfloatersearch.cpp
groupchatlistener.cpp
llagentwearablesfetch.cpp
llaccountingcostmanager.cpp
......@@ -274,6 +273,7 @@ set(viewer_SOURCE_FILES
llfloatercreatelandmark.cpp
llfloaterdeleteprefpreset.cpp
llfloaterdestinations.cpp
llfloaterdirectory.cpp
llfloaterdisplayname.cpp
llfloatereditenvironmentbase.cpp
llfloatereditextdaycycle.cpp
......@@ -482,6 +482,7 @@ set(viewer_SOURCE_FILES
llpaneleditwater.cpp
llpaneleditwearable.cpp
llpanelenvironment.cpp
llpaneleventinfo.cpp
llpanelexperiencelisteditor.cpp
llpanelexperiencelog.cpp
llpanelexperiencepicker.cpp
......@@ -532,6 +533,14 @@ set(viewer_SOURCE_FILES
llpanelprofile.cpp
llpanelprofileclassifieds.cpp
llpanelprofilepicks.cpp
llpanelsearchbase.cpp
llpanelsearchclassifieds.cpp
llpanelsearchevents.cpp
llpanelsearchgroups.cpp
llpanelsearchlandsales.cpp
llpanelsearchpeople.cpp
llpanelsearchplaces.cpp
llpanelsearchweb.cpp
llpanelsnapshot.cpp
llpanelsnapshotinventory.cpp
llpanelsnapshotlocal.cpp
......@@ -820,7 +829,6 @@ set(viewer_HEADER_FILES
altoolalign.h
alunzip.h
alviewermenu.h
fsfloatersearch.h
groupchatlistener.h
llaccountingcost.h
llagentwearablesfetch.h
......@@ -955,6 +963,7 @@ set(viewer_HEADER_FILES
llfloatercreatelandmark.h
llfloaterdeleteprefpreset.h
llfloaterdestinations.h
llfloaterdirectory.h
llfloaterdisplayname.h
llfloatereditenvironmentbase.h
llfloatereditextdaycycle.h
......@@ -1155,6 +1164,7 @@ set(viewer_HEADER_FILES
llpaneleditwater.h
llpaneleditwearable.h
llpanelenvironment.h
llpaneleventinfo.h
llpanelexperiencelisteditor.h
llpanelexperiencelog.h
llpanelexperiencepicker.h
......@@ -1206,6 +1216,14 @@ set(viewer_HEADER_FILES
llpanelprofile.h
llpanelprofileclassifieds.h
llpanelprofilepicks.h
llpanelsearchbase.h
llpanelsearchclassifieds.h
llpanelsearchevents.h
llpanelsearchgroups.h
llpanelsearchlandsales.h
llpanelsearchpeople.h
llpanelsearchplaces.h
llpanelsearchweb.h
llpanelsnapshot.h
llpanelteleporthistory.h
llpaneltiptoast.h
......
......@@ -1017,27 +1017,5 @@
<key>Value</key>
<string>8dcd4a48-2d37-4909-9f78-f7a9eb4ef903</string>
</map>
<key>FSLastSearchTab</key>
<map>
<key>Comment</key>
<string>Last selected tab in search window</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>S32</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>FSLegacySearchActionOnTeleport</key>
<map>
<key>Comment</key>
<string>Controls what action Legacy Search should take when teleporting: 0 = No effect, 1 = Close floater, 2 Minimise floater</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>1</integer>
</map>
</map>
</llsd>
This diff is collapsed.
/**
* @file fsfloatersearch.h
* @brief Firestorm search definitions
*
* $LicenseInfo:firstyear=2012&license=fsviewerlgpl$
* Phoenix Firestorm Viewer Source Code
* Copyright (C) 2012, Cinder Roxley <cinder.roxley@phoenixviewer.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* The Phoenix Firestorm Project, Inc., 1831 Oakwood Drive, Fairmont, Minnesota 56031-3225 USA
* http://www.firestormviewer.org
* $/LicenseInfo$
*/
#ifndef FS_FLOATERSEARCH_H
#define FS_FLOATERSEARCH_H
#include "llfloater.h"
#include "lliconctrl.h"
#include "lltexteditor.h"
#include "lltexturectrl.h"
#include "llremoteparcelrequest.h"
#include "llavatarpropertiesprocessor.h"
#include "llgroupmgr.h"
#include "llavatarnamecache.h"
#include "llmediactrl.h"
#include "llradiogroup.h"
#include "llsearchcombobox.h"
#include "llscrolllistctrl.h"
#include "lltabcontainer.h"
class FSSearchRemoteParcelInfoObserver;
class LLAvatarPropertiesObserver;
class LLGroupMgrObserver;
class LLSearchEditor;
class LLSearchComboBox;
class FSFloaterSearch;
class FSScrollListCtrl;
struct SearchQuery : public LLInitParam::Block<SearchQuery>
{
Optional<std::string> category;
Optional<std::string> query;
SearchQuery();
};
///////////////////////////////
// Search Panels //
///////////////////////////////
class FSSearchPanelBase : public LLPanel
{
public:
FSSearchPanelBase() : LLPanel() { }
virtual ~FSSearchPanelBase() = default;
virtual void focusDefaultElement() { }
};
class FSPanelSearchPeople : public FSSearchPanelBase
{
LOG_CLASS(FSFloaterSearch);
public:
FSPanelSearchPeople();
static void processSearchReply(LLMessageSystem* msg, void**);
/*virtual*/ void focusDefaultElement();
protected:
const S32& getNumResultsReturned() const { return mNumResultsReturned; };
const S32& getNumResultsReceived() const { return mResultsReceived; };
private:
/*virtual*/ BOOL postBuild();
virtual ~FSPanelSearchPeople();
void onBtnFind();
void onSelectItem();
void onBtnNext();
void onBtnBack();
void find();
void resetSearch();
S32 showNextButton(S32);
const LLUUID& getQueryID() const { return mQueryID; }
void onAvatarNameCallback(const LLUUID& id, const LLAvatarName& av_name);
typedef boost::signals2::connection avatar_name_callback_connection_t;
avatar_name_callback_connection_t mAvatarNameCallbackConnection;
S32 mNumResultsReturned;
S32 mStartSearch;
S32 mResultsReceived;
LLSD mResultsContent;
LLUUID mQueryID;
FSFloaterSearch* mParent;
LLSearchComboBox* mSearchComboBox;
LLScrollListCtrl* mSearchResults;
};
class FSPanelSearchGroups : public FSSearchPanelBase
{
LOG_CLASS(FSFloaterSearch);
public:
FSPanelSearchGroups();
static void processSearchReply(LLMessageSystem* msg, void**);
/*virtual*/ void focusDefaultElement();
private:
/*virtual*/ BOOL postBuild();
virtual ~FSPanelSearchGroups();
void onBtnFind();
void onSelectItem();
void onBtnNext();
void onBtnBack();
void find();
void resetSearch();
S32 showNextButton(S32);
const LLUUID& getQueryID() const { return mQueryID; }
S32 mNumResultsReturned;
S32 mStartSearch;
S32 mResultsReceived;
LLSD mResultsContent;
LLUUID mQueryID;
FSFloaterSearch* mParent;
LLSearchComboBox* mSearchComboBox;
LLScrollListCtrl* mSearchResults;
};
class FSPanelSearchPlaces : public FSSearchPanelBase
{
LOG_CLASS(FSFloaterSearch);
public:
FSPanelSearchPlaces();
static void processSearchReply(LLMessageSystem* msg, void**);
/*virtual*/ void focusDefaultElement();
private:
/*virtual*/ BOOL postBuild();
virtual ~FSPanelSearchPlaces();
void onBtnFind();
void onSelectItem();
void onBtnNext();
void onBtnBack();
void find();
void resetSearch();
S32 showNextButton(S32);
const LLUUID& getQueryID() const { return mQueryID; }
S32 mNumResultsReturned;
S32 mStartSearch;
S32 mResultsReceived;
LLSD mResultsContent;
LLUUID mQueryID;
FSFloaterSearch* mParent;
LLSearchComboBox* mSearchComboBox;
LLScrollListCtrl* mSearchResults;
LLComboBox* mPlacesCategory;
};
class FSPanelSearchLand : public FSSearchPanelBase
{
LOG_CLASS(FSFloaterSearch);
public:
FSPanelSearchLand();
static void processSearchReply(LLMessageSystem* msg, void**);
private:
/*virtual*/ BOOL postBuild();
virtual ~FSPanelSearchLand();
void onBtnFind();
void onSelectItem();
void onBtnNext();
void onBtnBack();
void find();
void resetSearch();
S32 showNextButton(S32);
const LLUUID& getQueryID() const { return mQueryID; }
S32 mNumResultsReturned;
S32 mStartSearch;
S32 mResultsReceived;
LLSD mResultsContent;
LLUUID mQueryID;
FSFloaterSearch* mParent;
LLLineEditor* mPriceEditor;
LLLineEditor* mAreaEditor;
LLScrollListCtrl* mSearchResults;
};
class FSPanelSearchClassifieds : public FSSearchPanelBase
{
LOG_CLASS(FSFloaterSearch);
public:
FSPanelSearchClassifieds();
static void processSearchReply(LLMessageSystem* msg, void**);
/*virtual*/ void focusDefaultElement();
private:
/*virtual*/ BOOL postBuild();
virtual ~FSPanelSearchClassifieds();
void onBtnFind();
void onSelectItem();
void onBtnNext();
void onBtnBack();
void find();
void resetSearch();
S32 showNextButton(S32);
const LLUUID& getQueryID() const { return mQueryID; }
S32 mNumResultsReturned;
S32 mStartSearch;
S32 mResultsReceived;
LLSD mResultsContent;
LLUUID mQueryID;
FSFloaterSearch* mParent;
LLSearchComboBox* mSearchComboBox;
LLScrollListCtrl* mSearchResults;
LLComboBox* mClassifiedsCategory;
};
class FSPanelSearchEvents : public FSSearchPanelBase
{
LOG_CLASS(FSFloaterSearch);
public:
FSPanelSearchEvents();
static void processSearchReply(LLMessageSystem* msg, void**);
/*virtual*/ void focusDefaultElement();
private:
/*virtual*/ BOOL postBuild();
virtual ~FSPanelSearchEvents();
void onBtnFind();
void onSelectItem();
void onBtnNext();
void onBtnBack();
void onBtnTomorrow();
void onBtnYesterday();
void onBtnToday();
void find();
void setDay(S32 day);
void onSearchModeChanged();
void resetSearch();
S32 showNextButton(S32);
const LLUUID& getQueryID() const { return mQueryID; }
S32 mNumResultsReturned;
S32 mResultsReceived;
S32 mStartSearch;
S32 mDay;
LLSD mResultsContent;
LLUUID mQueryID;
FSFloaterSearch* mParent;
LLSearchComboBox* mSearchComboBox;
LLScrollListCtrl* mSearchResults;
LLRadioGroup* mEventsMode;
};
class FSPanelSearchWeb : public FSSearchPanelBase
{
LOG_CLASS(FSFloaterSearch);
public:
FSPanelSearchWeb();
/*virtual*/ BOOL postBuild();
void loadURL(const SearchQuery &query);
/*virtual*/ void focusDefaultElement();
/*virtual*/ void draw();
void resetFocusOnLoad() { mResetFocusOnLoad = true; }
private:
virtual ~FSPanelSearchWeb() {};
LLMediaCtrl* mWebBrowser;
LLSD mCategoryPaths;
bool mResetFocusOnLoad;
};
class FSFloaterSearch : public LLFloater
{
LOG_CLASS(FSFloaterSearch);
public:
typedef enum e_search_category
{
SC_AVATAR,
SC_GROUP,
SC_PLACE,
SC_CLASSIFIED
} ESearchCategory;
struct _Params : public LLInitParam::Block<_Params, LLFloater::Params>
{
Optional<SearchQuery> search;
};
typedef LLSDParamAdapter<_Params> Params;
FSFloaterSearch(const Params& key);
~FSFloaterSearch();
void onOpen(const LLSD& key);
BOOL postBuild();
void avatarNameUpdatedCallback(const LLUUID& id, const LLAvatarName& av_name);
void groupNameUpdatedCallback(const LLUUID& id, const std::string& name, bool is_group);
void onSelectedItem(const LLUUID& selected_item, ESearchCategory type);
void onSelectedEvent(const S32 selected_event);
void displayParcelDetails(const LLParcelData& parcel_data);
void displayClassifiedDetails(LLAvatarClassifiedInfo*& c_info);
void displayAvatarDetails(LLAvatarData*& avatar_data);
void displayGroupDetails(LLGroupMgrGroupData*& group_data);
void displayEventDetails(U32 eventId,
F64 eventEpoch,
const std::string& eventDateStr,
const std::string &eventName,
const std::string &eventDesc,
const std::string &simName,
U32 eventDuration,
U32 eventFlags,
U32 eventCover,
LLVector3d eventGlobalPos);
void displayEventParcelImage(const LLParcelData& parcel_data);
void setLoadingProgress(bool started);
template <class T>
static T* getSearchPanel(const std::string& panel_name);
private:
virtual void onClose(bool app_quitting);
const LLUUID& getSelectedID() { return mSelectedID; }
LLVector3d mParcelGlobal;
LLUUID mSelectedID;
U32 mEventID;
bool mHasSelection;
void resetVerbs();
void flushDetails();
void onTabChange();
void onBtnPeopleProfile();
void onBtnPeopleIM();
void onBtnPeopleFriend();
void onBtnGroupProfile();
void onBtnGroupChat();
void onBtnGroupJoin();
void onBtnEventReminder();
void onBtnTeleport();
void onBtnMap();
void regionHandleCallback(U64 region_handle, LLVector3d pos_global);
FSSearchRemoteParcelInfoObserver* mRemoteParcelObserver;
FSSearchRemoteParcelInfoObserver* mRemoteParcelEventLocationObserver;
LLAvatarPropertiesObserver* mAvatarPropertiesObserver;
LLGroupMgrObserver* mGroupPropertiesRequest;
FSPanelSearchPeople* mPanelPeople;
FSPanelSearchGroups* mPanelGroups;
FSPanelSearchPlaces* mPanelPlaces;
FSPanelSearchEvents* mPanelEvents;
FSPanelSearchLand* mPanelLand;
FSPanelSearchClassifieds* mPanelClassifieds;
FSPanelSearchWeb* mPanelWeb;
LLPanel* mDetailsPanel;
LLTextEditor* mDetailTitle;
LLTextEditor* mDetailDesc;
LLTextEditor* mDetailAux1;
LLTextEditor* mDetailAux2;
LLTextEditor* mDetailLocation;
LLTextureCtrl* mDetailSnapshot;
LLTextureCtrl* mDetailSnapshotParcel;
LLIconCtrl* mDetailMaturity;
LLTabContainer* mTabContainer;
};
#endif // FS_FLOATERSEARCH_H
......@@ -380,8 +380,6 @@ void LLAvatarPropertiesProcessor::processClassifiedInfoReply(LLMessageSystem* ms
// Request processed, no longer pending
self->removePendingRequest(c_info.creator_id, APT_CLASSIFIED_INFO);
self->notifyObservers(c_info.creator_id, &c_info, APT_CLASSIFIED_INFO);
self->removePendingRequest(c_info.classified_id, APT_CLASSIFIED_INFO);
self->notifyObservers(c_info.classified_id, &c_info, APT_CLASSIFIED_INFO);
}
......
......@@ -103,7 +103,7 @@ LLEventNotifier::~LLEventNotifier()
for (iter = mEventNotifications.begin();
iter != mEventNotifications.end();
++iter)
iter++)
{
delete iter->second;
}
......@@ -124,7 +124,7 @@ void LLEventNotifier::update()
{
LLEventNotification *np = iter->second;
++iter;
iter++;
if (np->getEventDateEpoch() < alert_time)
{
LLSD args;
......@@ -166,7 +166,8 @@ bool LLEventNotifier::handleResponse(U32 eventId, const LLSD& notification, cons
bool LLEventNotifier::add(const LLEventStruct& event)
{
if (mNewEventSignal(event)) return false;
if (mNewEventSignal(event)) { return false; }
LLEventNotification *new_enp = new LLEventNotification(event.eventId, event.eventEpoch, event.eventDateStr, event.eventName);
LL_INFOS() << "Add event " << event.eventName << " id " << event.eventId << " date " << event.eventDateStr << LL_ENDL;
......@@ -205,21 +206,21 @@ void LLEventNotifier::processEventInfoReply(LLMessageSystem *msg, void **)
U32 event_time_utc;
msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
msg->getU32("EventData", "EventID", event_id);
msg->getString("EventData", "Name", event_name);
msg->getString("EventData", "Date", eventd_date);
msg->getU32("EventData", "DateUTC", event_time_utc);
msg->getU32Fast(_PREHASH_EventData, _PREHASH_EventID, event_id);
msg->getStringFast(_PREHASH_EventData, _PREHASH_Name, event_name);
msg->getStringFast(_PREHASH_EventData, _PREHASH_Date, eventd_date);
msg->getU32Fast(_PREHASH_EventData, _PREHASH_DateUTC, event_time_utc);
LLEventStruct event(event_id, (F64)event_time_utc, eventd_date, event_name);
msg->getString("EventData", "Creator", event.creator);
msg->getString("EventData", "Category", event.category);
msg->getString("EventData", "Desc", event.desc);
msg->getU32("EventData", "Duration", event.duration);
msg->getU32("EventData", "Cover", event.cover);
msg->getU32("EventData", "Amount", event.amount);
msg->getString("EventData", "SimName", event.simName);
msg->getVector3d("EventData", "GlobalPos", event.globalPos);
msg->getU32("EventData", "EventFlags", event.flags);
msg->getString(_PREHASH_EventData, _PREHASH_Creator, event.creator);
msg->getString(_PREHASH_EventData, _PREHASH_Category, event.category);
msg->getString(_PREHASH_EventData, _PREHASH_Desc, event.desc);
msg->getU32(_PREHASH_EventData, _PREHASH_Duration, event.duration);
msg->getU32(_PREHASH_EventData, _PREHASH_Cover, event.cover);
msg->getU32(_PREHASH_EventData, _PREHASH_Amount, event.amount);
msg->getString(_PREHASH_EventData, _PREHASH_SimName, event.simName);
msg->getVector3d(_PREHASH_EventData, _PREHASH_GlobalPos, event.globalPos);
msg->getU32(_PREHASH_EventData, _PREHASH_EventFlags, event.flags);
gEventNotifier.add(event);
}
......@@ -244,29 +245,22 @@ void LLEventNotifier::load(const LLSD& event_options)
is_iso8601_date = true;
}
std::string dateStr = response["event_date"].asString();
if (is_iso8601_date)
{
std::string dateStr;
dateStr = "[" + LLTrans::getString("LTimeYear") + "]-["
+ LLTrans::getString("LTimeMthNum") + "]-["
+ LLTrans::getString("LTimeDay") + "] ["
+ LLTrans::getString("LTimeHour") + "]:["
+ LLTrans::getString("LTimeMin") + "]:["
+ LLTrans::getString("LTimeSec") + "]";
std::string iso8601date =
"[" + LLTrans::getString("LTimeYear") + "]-[" + LLTrans::getString("LTimeMthNum") + "]-["
+ LLTrans::getString("LTimeDay") + "] [" + LLTrans::getString("LTimeHour") + "]:["
+ LLTrans::getString("LTimeMin") + "]:[" + LLTrans::getString("LTimeSec") + "]";
LLSD substitution;
substitution["datetime"] = date;
LLStringUtil::format(dateStr, substitution);
LLEventStruct event(response["event_id"].asInteger(), response["event_date_ut"], dateStr, response["event_name"].asString());
add(event);
}
else
{
LLEventStruct event(response["event_id"].asInteger(), response["event_date_ut"], response["event_date"].asString(), response["event_name"].asString());
add(event);
LLStringUtil::format(iso8601date, substitution);
dateStr = iso8601date;
}
add(LLEventStruct(response["event_id"].asInteger(), response["event_date_ut"], dateStr, response["event_name"].asString()));
}
}
......@@ -309,11 +303,11 @@ void LLEventNotifier::serverPushRequest(U32 event_id, bool add)
}
LLEventNotification::LLEventNotification(U32 eventId, F64 eventEpoch, std::string eventDateStr, std::string eventName) :
LLEventNotification::LLEventNotification(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName) :
mEventID(eventId),
mEventName(std::move(eventName)),
mEventName(eventName),
mEventDateEpoch(eventEpoch),
mEventDateStr(std::move(eventDateStr))
mEventDateStr(eventDateStr)
{
}
......
......@@ -27,7 +27,6 @@
#ifndef LL_LLEVENTNOTIFIER_H
#define LL_LLEVENTNOTIFIER_H
#include <utility>
#include "llframetimer.h"
#include "v3dmath.h"
......@@ -48,9 +47,9 @@ typedef struct event_st{
std::string simName;
LLVector3d globalPos;
U32 flags = 0;
event_st(U32 id, F64 epoch, std::string date_str, std::string name)
: eventId(id), eventEpoch(epoch), eventDateStr(std::move(date_str)), eventName(std::move(name)){}
event_st() = default;
event_st(U32 id, F64 epoch, const std::string& date_str, const std::string& name)
: eventId(id), eventEpoch(epoch), eventDateStr(date_str), eventName(name){}
event_st(){}
} LLEventStruct;
class LLEventNotifier
......@@ -91,12 +90,12 @@ class LLEventNotifier
class LLEventNotification
{
public:
LLEventNotification(U32 eventId, F64 eventEpoch, std::string eventDateStr, std::string eventName);
LLEventNotification(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName);
U32 getEventID() const { return mEventID; }
const std::string &getEventName() const { return mEventName; }
bool isValid() const { return mEventID > 0 && mEventDateEpoch != 0 && !mEventName.empty(); }
bool isValid() const { return mEventID > 0 && mEventDateEpoch != 0 && mEventName.size() > 0; }
const F64 &getEventDateEpoch() const { return mEventDateEpoch; }
const std::string &getEventDateStr() const { return mEventDateStr; }
......
This diff is collapsed.
/*
* @file llfloaterdirectory.h
* @brief Legacy search facility definitions
*
* Copyright (c) 2014, Cinder Roxley <cinder@sdf.org>
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
* Software, and to permit third-parties to whom the Software is furnished to
* do so, all subject to the following:
*
* The copyright notices in the Software and this entire statement, including
* the above license grant, this restriction and the following disclaimer,
* must be included in all copies of the Software, in whole or in part, and
* all derivative works of the Software, unless such copies or derivative
* works are solely in the form of machine-executable object code generated by
* a source language processor.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#ifndef LL_FLOATERDIRECTORY_H
#define LL_FLOATERDIRECTORY_H
#include "llfloater.h"
#include "llsdparam.h"
class LLUICtrl;
class LLPanel;
class LLPanelSearchWeb;
class LLScrollListCtrl;
class LLTabContainer;
class LLTextBase;
static const size_t MIN_SEARCH_STRING_SIZE = 3;
typedef enum {
SE_UNDEFINED = 0,
SE_PEOPLE,
SE_GROUPS,
SE_PLACES,
SE_LANDSALES,
SE_EVENTS,
SE_CLASSIFIEDS
} ESearch;
struct SearchQuery : public LLInitParam::Block<SearchQuery>
{
Optional<std::string> category;
Optional<std::string> query;
SearchQuery();
};
typedef struct dir_query
{
dir_query()
: type(SE_UNDEFINED), text(LLStringUtil::null), scope(0),
category_int(0), category_char(0x0), price(0), area(0), results_per_page(100) {}
ESearch type;
std::string text;
U32 scope;
U32 category_int;
S8 category_char;
S32 price;
S32 area;
U32 results_per_page;
} LLDirQuery;
class LLFloaterDirectory : public LLFloater
{
friend class LLPanelSearchClassifieds;
friend class LLPanelSearchEvents;
friend class LLPanelSearchGroups;
friend class LLPanelSearchLandSales;
friend class LLPanelSearchPeople;
friend class LLPanelSearchPlaces;
public:
struct _Params : LLInitParam::Block<_Params, LLFloater::Params>
{
Optional<SearchQuery> search;
};
typedef LLSDParamAdapter<_Params> Params;
LLFloaterDirectory(const Params& key);
BOOL postBuild() override;
void onOpen(const LLSD& key) override;
static void processSearchPeopleReply(LLMessageSystem* msg, void**);
static void processSearchGroupsReply(LLMessageSystem* msg, void**);
static void processSearchPlacesReply(LLMessageSystem* msg, void**);
static void processSearchClassifiedsReply(LLMessageSystem* msg, void**);
static void processSearchLandReply(LLMessageSystem* msg, void**);
static void processSearchEventsReply(LLMessageSystem* msg, void**);
protected:
void setProgress(bool working);
void queryDirectory(const LLDirQuery& query, bool new_search = false);
void setResultsComment(const std::string& message);
private:
~LLFloaterDirectory();
void onCommitSelection();
void choosePage(LLUICtrl* ctrl);
void onTabChanged();
void paginate();
void showDetailPanel(const std::string& panel_name);
void rebuildResultList();
ESearch mCurrentResultType;
LLDirQuery mCurrentQuery;
S32 mResultStart;
S32 mNumResultsReceived;
LLUUID mQueryID;
LLTabContainer* mTabContainer;
LLPanel* mDetailPeople;
LLPanelSearchWeb* mPanelWeb;
LLScrollListCtrl* mResultList;
LLTextBase* mResultsStatus;
};
#endif // LL_FLOATERDIRECTORY_H
......@@ -48,7 +48,7 @@
//static
LLPanelClassifiedInfo::panel_list_t LLPanelClassifiedInfo::sAllPanels;
static LLPanelInjector<LLPanelClassifiedInfo> t_panel_panel_classified_info("panel_classified_info");
static LLPanelInjector<LLPanelClassifiedInfo> t_panel_classified_info("panel_classified_info");
// "classifiedclickthrough"
// strings[0] = classified_id
......
......@@ -165,10 +165,8 @@ class LLPanelClassifiedInfo : public LLPanel, public LLAvatarPropertiesObserver
S32 mMapClicksNew;
S32 mProfileClicksNew;
public:
static void handleSearchStatResponse(LLUUID classifiedId, LLSD result);
private:
typedef std::list<LLPanelClassifiedInfo*> panel_list_t;
static panel_list_t sAllPanels;
......
/*
* @file llpaneleventinfo.cpp
* @brief Event info panel
*
* Copyright (c) 2014, Cinder Roxley <cinder@sdf.org>
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
* Software, and to permit third-parties to whom the Software is furnished to
* do so, all subject to the following:
*
* The copyright notices in the Software and this entire statement, including
* the above license grant, this restriction and the following disclaimer,
* must be included in all copies of the Software, in whole or in part, and
* all derivative works of the Software, unless such copies or derivative
* works are solely in the form of machine-executable object code generated by
* a source language processor.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#include "llviewerprecompiledheaders.h"
#include "llpaneleventinfo.h"
#include "llbutton.h"
#include "lleventflags.h"
#include "lliconctrl.h"
#include "llfloaterreg.h"
#include "llresmgr.h"
#include "llslurl.h"
#include "lltrans.h"
#include "llagent.h"
#include "llfloaterworldmap.h"
#include "llviewercontrol.h"
static LLPanelInjector<LLPanelEventInfo> t_event_info("panel_event_info");
LLPanelEventInfo::LLPanelEventInfo()
: LLPanel()
, mEvent()
, mEventID(0)
{
mEventNotifierConnection = gEventNotifier.setNewEventCallback(boost::bind(&LLPanelEventInfo::processEventReply, this, _1));
}
LLPanelEventInfo::~LLPanelEventInfo()
{
if (mEventNotifierConnection.connected())
{
mEventNotifierConnection.disconnect();
}
}
BOOL LLPanelEventInfo::postBuild()
{
childSetAction("teleport_btn", boost::bind(&LLPanelEventInfo::onBtnTeleport, this));
childSetAction("show_on_map_btn", boost::bind(&LLPanelEventInfo::onBtnMap, this));
childSetAction("remind_btn", boost::bind(&LLPanelEventInfo::onBtnRemind, this));
return TRUE;
}
void LLPanelEventInfo::onOpen(const LLSD& key)
{
U32 id(key.asInteger());
setEventID(id);
gEventNotifier.add(getEventID());
}
// *TODO: localize this bitch.
std::string LLPanelEventInfo::formatFromMinutes(U32 time)
{
U32 hours = time / 60;
U32 minutes = time % 60;
std::ostringstream output;
if (hours)
output << hours << " " << getString("hours") << " ";
if (minutes)
output << minutes << " " << getString("minutes");
return output.str();
}
bool LLPanelEventInfo::processEventReply(const LLEventStruct& event)
{
if (event.eventId != getEventID()) return false; // no
mEvent = event;
getChild<LLUICtrl>("name")->setValue(mEvent.eventName);
getChild<LLUICtrl>("desc")->setValue(mEvent.desc);
getChild<LLUICtrl>("duration")->setValue(formatFromMinutes(mEvent.duration));
getChild<LLUICtrl>("host")->setValue(LLSLURL("agent", LLUUID(mEvent.creator), "inspect").getSLURLString());
getChild<LLUICtrl>("time")->setValue(mEvent.eventDateStr);
// *TODO: Prettier
//std::string time;
//LLStringUtil::formatDatetime(time, "%a %d %b %Y %H:%M", "slt", mEvent.eventEpoch);
//getChild<LLUICtrl>("time")->setValue(time);
// *TODO: Add translation strings
//getChild<LLUICtrl>("category")->setValue(LLTrans::getString(mEvent.category));
getChild<LLUICtrl>("category")->setValue(mEvent.category);
getChild<LLUICtrl>("cover")->setValue(mEvent.cover
? LLResMgr::getInstance()->getMonetaryString(mEvent.amount)
: getString("free"));
bool mature = (mEvent.flags & EVENT_FLAG_MATURE);
getChild<LLUICtrl>("content_type")->setValue(getString(mature ? "type_mature" : "type_pg"));
getChild<LLIconCtrl>("content_type_moderate")->setVisible(mature);
getChild<LLIconCtrl>("content_type_general")->setVisible(!mature);
getChild<LLUICtrl>("location")->setValue(LLSLURL(mEvent.simName, mEvent.globalPos).getSLURLString());
getChild<LLButton>("remind_btn")->setLabel(getString(gEventNotifier.hasNotification(mEvent.eventId)
? "no_reminder"
: "reminder"));
return true;
}
void LLPanelEventInfo::onBtnTeleport()
{
if (!mEvent.globalPos.isExactlyZero())
{
gAgent.teleportViaLocation(mEvent.globalPos);
LLFloaterWorldMap* worldmap = LLFloaterWorldMap::getInstance();
if (worldmap)
worldmap->trackLocation(mEvent.globalPos);
}
}
void LLPanelEventInfo::onBtnMap()
{
LLFloaterWorldMap* worldmap = LLFloaterWorldMap::getInstance();
if (!mEvent.globalPos.isExactlyZero() && worldmap)
{
worldmap->trackLocation(mEvent.globalPos);
LLFloaterReg::showInstance("world_map", "center");
}
}
void LLPanelEventInfo::onBtnRemind()
{
if (gEventNotifier.hasNotification(mEvent.eventId))
{
gEventNotifier.remove(mEvent.eventId);
getChild<LLButton>("remind_btn")->setLabel(getString("reminder"));
}
else
{
gEventNotifier.add(mEvent.eventId);
getChild<LLButton>("remind_btn")->setLabel(getString("no_reminder"));
}
}
/*
* @file llpaneleventinfo.cpp
* @brief Event info panel
*
* Copyright (c) 2014, Cinder Roxley <cinder@sdf.org>
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
* Software, and to permit third-parties to whom the Software is furnished to
* do so, all subject to the following:
*
* The copyright notices in the Software and this entire statement, including
* the above license grant, this restriction and the following disclaimer,
* must be included in all copies of the Software, in whole or in part, and
* all derivative works of the Software, unless such copies or derivative
* works are solely in the form of machine-executable object code generated by
* a source language processor.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#ifndef LL_PANELEVENTINFO_H
#define LL_PANELEVENTINFO_H
#include "llpanel.h"
#include "lleventnotifier.h"
class LLPanelEventInfo : public LLPanel
{
public:
LLPanelEventInfo();
/*virtual*/ BOOL postBuild() override;
/*virtual*/ void onOpen(const LLSD& key) override;
private:
~LLPanelEventInfo();
bool processEventReply(const LLEventStruct& event);
std::string formatFromMinutes(U32 time);
void setEventID(U32 id) { mEventID = id; }
U32 getEventID() const { return mEventID; }
void onBtnTeleport();
void onBtnMap();
void onBtnRemind();
LLEventStruct mEvent;
U32 mEventID;
boost::signals2::connection mEventNotifierConnection;
};
#endif // LL_PANELEVENTINFO_H
/*
* @file llpanelsearchbase.cpp
* @brief Search panel base class
*
* Copyright (c) 2014, Cinder Roxley <cinder@sdf.org>
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
* Software, and to permit third-parties to whom the Software is furnished to
* do so, all subject to the following:
*
* The copyright notices in the Software and this entire statement, including
* the above license grant, this restriction and the following disclaimer,
* must be included in all copies of the Software, in whole or in part, and
* all derivative works of the Software, unless such copies or derivative
* works are solely in the form of machine-executable object code generated by
* a source language processor.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#include "llviewerprecompiledheaders.h"
#include "llpanelsearchbase.h"
#include "llfloaterdirectory.h"
LLPanelSearch::LLPanelSearch()
: LLPanel()
, mFloater(nullptr)
{
}
void LLPanelSearch::setSearchFloater(LLFloaterDirectory* floater)
{
mFloater = floater;
}
/*
* @file llpanelsearchbase.h
* @brief Search panel base class
*
* Copyright (c) 2014, Cinder Roxley <cinder@sdf.org>
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
* Software, and to permit third-parties to whom the Software is furnished to
* do so, all subject to the following:
*
* The copyright notices in the Software and this entire statement, including
* the above license grant, this restriction and the following disclaimer,
* must be included in all copies of the Software, in whole or in part, and
* all derivative works of the Software, unless such copies or derivative
* works are solely in the form of machine-executable object code generated by
* a source language processor.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#ifndef LL_PANELSEARCHBASE_H
#define LL_PANELSEARCHBASE_H
#include "llpanel.h"
class LLUICtrl;
class LLFloaterDirectory;
class LLPanelSearch : public LLPanel
{
public:
LLPanelSearch();
BOOL postBuild() override { return FALSE; }
void setSearchFloater(LLFloaterDirectory* floater);
protected:
virtual ~LLPanelSearch() = default;;
LLFloaterDirectory* mFloater;
private:
virtual void onCommitSearch(LLUICtrl* ctrl) {}
virtual void search() {}
};
#endif // LL_PANELSEARCHBASE_H
/*
* @file llpanelsearchclassifieds.cpp
* @brief Groups search panel
*
* Copyright (c) 2014, Cinder Roxley <cinder@sdf.org>
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
* Software, and to permit third-parties to whom the Software is furnished to
* do so, all subject to the following:
*
* The copyright notices in the Software and this entire statement, including
* the above license grant, this restriction and the following disclaimer,
* must be included in all copies of the Software, in whole or in part, and
* all derivative works of the Software, unless such copies or derivative
* works are solely in the form of machine-executable object code generated by
* a source language processor.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#include "llviewerprecompiledheaders.h"
#include "llpanelsearchclassifieds.h"
#include "llfloaterdirectory.h"
#include "llfloaterreg.h"
#include "llqueryflags.h"
#include "lltrans.h"
#include "llagent.h"
#include "llclassifiedflags.h"
#include "llclassifiedinfo.h"
#include "llcombobox.h"
#include "llnotificationsutil.h"
#include "llparcel.h"
#include "llsearcheditor.h"
#include "llsearchhistory.h"
static LLPanelInjector<LLPanelSearchClassifieds> t_panel_search_classifieds("panel_search_classifieds");
LLPanelSearchClassifieds::LLPanelSearchClassifieds()
: LLPanelSearch()
, mSearchEditor(nullptr)
, mClassifiedsCategory(nullptr)
{
mCommitCallbackRegistrar.add("Search.query", boost::bind(&LLPanelSearchClassifieds::onCommitSearch, this, _1));
}
BOOL LLPanelSearchClassifieds::postBuild()
{
mClassifiedsCategory = getChild<LLComboBox>("classifieds_category");
mClassifiedsCategory->add("All categories", LLSD("any"));
mClassifiedsCategory->addSeparator();
for (auto iter = LLClassifiedInfo::sCategories.cbegin();
iter != LLClassifiedInfo::sCategories.cend();
++iter)
{
mClassifiedsCategory->add(LLTrans::getString(iter->second));
}
mSearchEditor = getChild<LLSearchEditor>("search_bar");
//mSearchEditor->setKeystrokeCallback(boost::bind(&LLPanelSearchClassifieds::onCommitSearch, this, _1));
return TRUE;
}
void LLPanelSearchClassifieds::onCommitSearch(LLUICtrl* ctrl)
{
LLSearchEditor* pSearchEditor = dynamic_cast<LLSearchEditor*>(ctrl);
if (pSearchEditor)
{
std::string text = pSearchEditor->getText();
LLStringUtil::trim(text);
if (text.length() <= MIN_SEARCH_STRING_SIZE)
LLSearchHistory::getInstance()->addEntry(text);
}
search();
}
void LLPanelSearchClassifieds::search()
{
LLDirQuery query;
query.type = SE_CLASSIFIEDS;
query.results_per_page = 100;
query.text = mSearchEditor->getText();
LLStringUtil::trim(query.text);
query.category_int = mClassifiedsCategory->getValue().asInteger();
static LLUICachedControl<bool> inc_pg("ShowPGClassifieds", true);
static LLUICachedControl<bool> inc_mature("ShowMatureClassifieds", false);
static LLUICachedControl<bool> inc_adult("ShowAdultClassifieds", false);
if (!(inc_pg || inc_mature || inc_adult))
{
LLNotificationsUtil::add("NoContentToSearch");
return;
}
query.scope = pack_classified_flags_request(/*auto_renew*/ FALSE, inc_pg, inc_mature, inc_adult);
mFloater->queryDirectory(query, true);
}
/*
* @file llpanelsearchclassifieds.h
* @brief Groups search panel
*
* Copyright (c) 2014, Cinder Roxley <cinder@sdf.org>
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
* Software, and to permit third-parties to whom the Software is furnished to
* do so, all subject to the following:
*
* The copyright notices in the Software and this entire statement, including
* the above license grant, this restriction and the following disclaimer,
* must be included in all copies of the Software, in whole or in part, and
* all derivative works of the Software, unless such copies or derivative
* works are solely in the form of machine-executable object code generated by
* a source language processor.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#ifndef LL_PANELSEARCHCLASSIFIEDS_H
#define LL_PANELSEARCHCLASSIFIEDS_H
#include "llpanelsearchbase.h"
class LLComboBox;
class LLSearchEditor;
class LLPanelSearchClassifieds : public LLPanelSearch
{
public:
LLPanelSearchClassifieds();
/*virtual*/ BOOL postBuild() override;
private:
/*virtual*/ void onCommitSearch(LLUICtrl* ctrl) override;
/*virtual*/ void search() override;
LLSearchEditor* mSearchEditor;
LLComboBox* mClassifiedsCategory;
};
#endif // LL_PANELSEARCHCLASSIFIEDS_H
/*
* @file llpanelsearchevents.cpp
* @brief Events search panel
*
* Copyright (c) 2014, Cinder Roxley <cinder@sdf.org>
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
* Software, and to permit third-parties to whom the Software is furnished to
* do so, all subject to the following:
*
* The copyright notices in the Software and this entire statement, including
* the above license grant, this restriction and the following disclaimer,
* must be included in all copies of the Software, in whole or in part, and
* all derivative works of the Software, unless such copies or derivative
* works are solely in the form of machine-executable object code generated by
* a source language processor.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#include "llviewerprecompiledheaders.h"
#include "llpanelsearchevents.h"
#include "llfloaterdirectory.h"
#include "llfloaterreg.h"
#include "llqueryflags.h"
#include "llagent.h"
#include "llcombobox.h"
#include "llnotificationsutil.h"
#include "llparcel.h"
#include "llsearcheditor.h"
#include "llsearchhistory.h"
static LLPanelInjector<LLPanelSearchEvents> t_panel_search_events("panel_search_events");
LLPanelSearchEvents::LLPanelSearchEvents()
: LLPanelSearch()
, mDate(0)
{
mCommitCallbackRegistrar.add("Search.query", boost::bind(&LLPanelSearchEvents::onCommitSearch, this, _1));
mCommitCallbackRegistrar.add("Search.AddDay", boost::bind(&LLPanelSearchEvents::addDay, this));
mCommitCallbackRegistrar.add("Search.MinusDay", boost::bind(&LLPanelSearchEvents::minusDay, this));
}
BOOL LLPanelSearchEvents::postBuild()
{
mSearchEditor = getChild<LLSearchEditor>("search_bar");
//mSearchEditor->setKeystrokeCallback(boost::bind(&LLPanelSearchEvents::onCommitSearch, this, _1));
setDate(0);
return TRUE;
}
void LLPanelSearchEvents::onCommitSearch(LLUICtrl* ctrl)
{
LLSearchEditor* pSearchEditor = dynamic_cast<LLSearchEditor*>(ctrl);
if (pSearchEditor)
{
std::string text = pSearchEditor->getText();
LLStringUtil::trim(text);
if (text.length() <= MIN_SEARCH_STRING_SIZE)
LLSearchHistory::getInstance()->addEntry(text);
}
search();
}
void LLPanelSearchEvents::search()
{
LLDirQuery query;
query.type = SE_EVENTS;
query.results_per_page = 200;
std::string text = mSearchEditor->getText();
LLStringUtil::trim(text);
static LLUICachedControl<bool> inc_pg("ShowPGEvents", true);
static LLUICachedControl<bool> inc_mature("ShowMatureEvents", false);
static LLUICachedControl<bool> inc_adult("ShowAdultEvents", false);
if (!(inc_pg || inc_mature || inc_adult))
{
LLNotificationsUtil::add("NoContentToSearch");
return;
}
query.scope = DFQ_DATE_EVENTS;
if (inc_pg)
query.scope |= DFQ_INC_PG;
if (inc_mature && gAgent.canAccessMature())
query.scope |= DFQ_INC_MATURE;
if (inc_adult && gAgent.canAccessAdult())
query.scope |= DFQ_INC_ADULT;
std::ostringstream string;
string << (childGetValue("events_search_mode").asString() == "current" ? "u" : llformat("%d",mDate)) << "|"
<< getChild<LLComboBox>("events_category")->getSelectedValue().asInteger() << "|"
<< text;
query.text = string.str();
mFloater->queryDirectory(query, true);
}
void LLPanelSearchEvents::setDate(S32 day)
{
mDate = day;
time_t utc = time_corrected();
utc += day * 24 * 60 * 60;
struct tm * internal_time = utc_to_pacific_time(utc, is_daylight_savings());
const std::string date = llformat("%d/%d", 1 + internal_time->tm_mon, internal_time->tm_mday);
childSetValue("events_date", date);
}
void LLPanelSearchEvents::addDay()
{
setDate(++mDate);
if (childGetValue("events_search_mode").asString() == "date")
search();
}
void LLPanelSearchEvents::minusDay()
{
setDate(--mDate);
if (childGetValue("events_search_mode").asString() == "date")
search();
}
/*
* @file llpanelsearchevents.h
* @brief Events search panel
*
* Copyright (c) 2014, Cinder Roxley <cinder@sdf.org>
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
* Software, and to permit third-parties to whom the Software is furnished to
* do so, all subject to the following:
*
* The copyright notices in the Software and this entire statement, including
* the above license grant, this restriction and the following disclaimer,
* must be included in all copies of the Software, in whole or in part, and
* all derivative works of the Software, unless such copies or derivative
* works are solely in the form of machine-executable object code generated by
* a source language processor.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
* SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
* FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#ifndef LL_PANELSEARCHEVENTS_H
#define LL_PANELSEARCHEVENTS_H
#include "llpanelsearchbase.h"
class LLComboBox;
class LLSearchEditor;
class LLPanelSearchEvents : public LLPanelSearch
{
public:
LLPanelSearchEvents();
/*virtual*/ BOOL postBuild() override;
private:
/*virtual*/ void onCommitSearch(LLUICtrl* ctrl) override;
/*virtual*/ void search() override;
void setDate(S32 day);
void addDay();
void minusDay();
S32 mDate;
LLSearchEditor* mSearchEditor;
};
#endif // LL_PANELSEARCHEVENTS_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment