diff options
author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
---|---|---|
committer | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 |
commit | 1b67dd855c41f5a0cda7ec2a68d98071986ca703 (patch) | |
tree | ab243607f74f78200787bba5b9b88f07ef1b966f /indra/newview/llpanelexperiencelog.cpp | |
parent | 6d6eabca44d08d5b97bfe3e941d2b9687c2246ea (diff) | |
parent | e1623bb276f83a43ce7a197e388720c05bdefe61 (diff) |
Merge remote-tracking branch 'origin/main' into DRTVWR-600-maint-A
# Conflicts:
# autobuild.xml
# indra/cmake/CMakeLists.txt
# indra/cmake/GoogleMock.cmake
# indra/llaudio/llaudioengine_fmodstudio.cpp
# indra/llaudio/llaudioengine_fmodstudio.h
# indra/llaudio/lllistener_fmodstudio.cpp
# indra/llaudio/lllistener_fmodstudio.h
# indra/llaudio/llstreamingaudio_fmodstudio.cpp
# indra/llaudio/llstreamingaudio_fmodstudio.h
# indra/llcharacter/llmultigesture.cpp
# indra/llcharacter/llmultigesture.h
# indra/llimage/llimage.cpp
# indra/llimage/llimagepng.cpp
# indra/llimage/llimageworker.cpp
# indra/llimage/tests/llimageworker_test.cpp
# indra/llmessage/tests/llmockhttpclient.h
# indra/llprimitive/llgltfmaterial.h
# indra/llrender/llfontfreetype.cpp
# indra/llui/llcombobox.cpp
# indra/llui/llfolderview.cpp
# indra/llui/llfolderviewmodel.h
# indra/llui/lllineeditor.cpp
# indra/llui/lllineeditor.h
# indra/llui/lltextbase.cpp
# indra/llui/lltextbase.h
# indra/llui/lltexteditor.cpp
# indra/llui/lltextvalidate.cpp
# indra/llui/lltextvalidate.h
# indra/llui/lluictrl.h
# indra/llui/llview.cpp
# indra/llwindow/llwindowmacosx.cpp
# indra/newview/app_settings/settings.xml
# indra/newview/llappearancemgr.cpp
# indra/newview/llappearancemgr.h
# indra/newview/llavatarpropertiesprocessor.cpp
# indra/newview/llavatarpropertiesprocessor.h
# indra/newview/llbreadcrumbview.cpp
# indra/newview/llbreadcrumbview.h
# indra/newview/llbreastmotion.cpp
# indra/newview/llbreastmotion.h
# indra/newview/llconversationmodel.h
# indra/newview/lldensityctrl.cpp
# indra/newview/lldensityctrl.h
# indra/newview/llface.inl
# indra/newview/llfloatereditsky.cpp
# indra/newview/llfloatereditwater.cpp
# indra/newview/llfloateremojipicker.h
# indra/newview/llfloaterimsessiontab.cpp
# indra/newview/llfloaterprofiletexture.cpp
# indra/newview/llfloaterprofiletexture.h
# indra/newview/llgesturemgr.cpp
# indra/newview/llgesturemgr.h
# indra/newview/llimpanel.cpp
# indra/newview/llimpanel.h
# indra/newview/llinventorybridge.cpp
# indra/newview/llinventorybridge.h
# indra/newview/llinventoryclipboard.cpp
# indra/newview/llinventoryclipboard.h
# indra/newview/llinventoryfunctions.cpp
# indra/newview/llinventoryfunctions.h
# indra/newview/llinventorygallery.cpp
# indra/newview/lllistbrowser.cpp
# indra/newview/lllistbrowser.h
# indra/newview/llpanelobjectinventory.cpp
# indra/newview/llpanelprofile.cpp
# indra/newview/llpanelprofile.h
# indra/newview/llpreviewgesture.cpp
# indra/newview/llsavedsettingsglue.cpp
# indra/newview/llsavedsettingsglue.h
# indra/newview/lltooldraganddrop.cpp
# indra/newview/llurllineeditorctrl.cpp
# indra/newview/llvectorperfoptions.cpp
# indra/newview/llvectorperfoptions.h
# indra/newview/llviewerparceloverlay.cpp
# indra/newview/llviewertexlayer.cpp
# indra/newview/llviewertexturelist.cpp
# indra/newview/macmain.h
# indra/test/test.cpp
Diffstat (limited to 'indra/newview/llpanelexperiencelog.cpp')
-rw-r--r-- | indra/newview/llpanelexperiencelog.cpp | 534 |
1 files changed, 267 insertions, 267 deletions
diff --git a/indra/newview/llpanelexperiencelog.cpp b/indra/newview/llpanelexperiencelog.cpp index c4a70b11a1..06c7045ab7 100644 --- a/indra/newview/llpanelexperiencelog.cpp +++ b/indra/newview/llpanelexperiencelog.cpp @@ -1,267 +1,267 @@ -/** - * @file llpanelexperiencelog.cpp - * @brief llpanelexperiencelog - * - * $LicenseInfo:firstyear=2014&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2014, Linden Research, Inc. - * - * 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 - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - - -#include "llviewerprecompiledheaders.h" -#include "llpanelexperiencelog.h" - -#include "llexperiencelog.h" -#include "llexperiencecache.h" -#include "llbutton.h" -#include "llscrolllistctrl.h" -#include "llcombobox.h" -#include "llspinctrl.h" -#include "llcheckboxctrl.h" -#include "llfloaterreg.h" -#include "llfloaterreporter.h" -#include "llinventoryfunctions.h" - - -#define BTN_PROFILE_XP "btn_profile_xp" -#define BTN_REPORT_XP "btn_report_xp" - -static LLPanelInjector<LLPanelExperienceLog> register_experiences_panel("experience_log"); - - -LLPanelExperienceLog::LLPanelExperienceLog( ) - : mEventList(NULL) - , mPageSize(25) - , mCurrentPage(0) -{ - buildFromFile("panel_experience_log.xml"); -} - -bool LLPanelExperienceLog::postBuild() -{ - LLExperienceLog* log = LLExperienceLog::getInstance(); - mEventList = getChild<LLScrollListCtrl>("experience_log_list"); - mEventList->setCommitCallback(boost::bind(&LLPanelExperienceLog::onSelectionChanged, this)); - mEventList->setDoubleClickCallback( boost::bind(&LLPanelExperienceLog::onProfileExperience, this)); - - getChild<LLButton>("btn_clear")->setCommitCallback(boost::bind(&LLExperienceLog::clear, log)); - getChild<LLButton>("btn_clear")->setCommitCallback(boost::bind(&LLPanelExperienceLog::refresh, this)); - - getChild<LLButton>(BTN_PROFILE_XP)->setCommitCallback(boost::bind(&LLPanelExperienceLog::onProfileExperience, this)); - getChild<LLButton>(BTN_REPORT_XP )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onReportExperience, this)); - getChild<LLButton>("btn_notify" )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onNotify, this)); - getChild<LLButton>("btn_next" )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onNext, this)); - getChild<LLButton>("btn_prev" )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onPrev, this)); - - LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("notify_all"); - check->set(log->getNotifyNewEvent()); - check->setCommitCallback(boost::bind(&LLPanelExperienceLog::notifyChanged, this)); - - - LLSpinCtrl* spin = getChild<LLSpinCtrl>("logsizespinner"); - spin->set(log->getMaxDays()); - spin->setCommitCallback(boost::bind(&LLPanelExperienceLog::logSizeChanged, this)); - - mPageSize = log->getPageSize(); - refresh(); - mNewEvent = LLExperienceLog::instance().addUpdateSignal(boost::bind(&LLPanelExperienceLog::refresh, this)); - return true; -} - -LLPanelExperienceLog* LLPanelExperienceLog::create() -{ - return new LLPanelExperienceLog(); -} - -void LLPanelExperienceLog::refresh() -{ - S32 selected = mEventList->getFirstSelectedIndex(); - mEventList->deleteAllItems(); - const LLSD events = LLExperienceLog::instance().getEvents(); - - if(events.size() == 0) - { - mEventList->setCommentText(getString("no_events")); - return; - } - - setAllChildrenEnabled(false); - - LLSD item; - bool waiting = false; - LLUUID waiting_id; - - int itemsToSkip = mPageSize*mCurrentPage; - int items = 0; - bool moreItems = false; - LLSD events_to_save = events; - if (events.isMap() && events.size() != 0) - { - LLSD::map_const_iterator day = events.endMap(); - do - { - --day; - const LLSD& dayArray = day->second; - - std::string date = day->first; - if(!LLExperienceLog::instance().isNotExpired(date)) - { - events_to_save.erase(day->first); - continue; - } - int size = dayArray.size(); - if(itemsToSkip > size) - { - itemsToSkip -= size; - continue; - } - if(items >= mPageSize && size > 0) - { - moreItems = true; - break; - } - for(int i = dayArray.size() - itemsToSkip - 1; i >= 0; i--) - { - if(items >= mPageSize) - { - moreItems = true; - break; - } - const LLSD event = dayArray[i]; - LLUUID id = event[LLExperienceCache::EXPERIENCE_ID].asUUID(); - const LLSD& experience = LLExperienceCache::instance().get(id); - if(experience.isUndefined()){ - waiting = true; - waiting_id = id; - } - if(!waiting) - { - item["id"] = event; - - LLSD& columns = item["columns"]; - columns[0]["column"] = "time"; - columns[0]["value"] = day->first+event["Time"].asString(); - columns[1]["column"] = "event"; - columns[1]["value"] = LLExperienceLog::getPermissionString(event, "ExperiencePermissionShort"); - columns[2]["column"] = "experience_name"; - columns[2]["value"] = experience[LLExperienceCache::NAME].asString(); - columns[3]["column"] = "object_name"; - columns[3]["value"] = event["ObjectName"].asString(); - mEventList->addElement(item); - } - ++items; - } - } while (day != events.beginMap()); - } - LLExperienceLog::getInstance()->setEventsToSave(events_to_save); - if(waiting) - { - mEventList->deleteAllItems(); - mEventList->setCommentText(getString("loading")); - LLExperienceCache::instance().get(waiting_id, boost::bind(&LLPanelExperienceLog::refresh, this)); - } - else - { - setAllChildrenEnabled(true); - - mEventList->setEnabled(true); - getChild<LLButton>("btn_next")->setEnabled(moreItems); - getChild<LLButton>("btn_prev")->setEnabled(mCurrentPage>0); - getChild<LLButton>("btn_clear")->setEnabled(mEventList->getItemCount()>0); - if(selected<0) - { - selected = 0; - } - mEventList->selectNthItem(selected); - onSelectionChanged(); - } -} - -void LLPanelExperienceLog::onProfileExperience() -{ - LLSD event = getSelectedEvent(); - if(event.isDefined()) - { - LLFloaterReg::showInstance("experience_profile", event[LLExperienceCache::EXPERIENCE_ID].asUUID(), true); - } -} - -void LLPanelExperienceLog::onReportExperience() -{ - LLSD event = getSelectedEvent(); - if(event.isDefined()) - { - LLFloaterReporter::showFromExperience(event[LLExperienceCache::EXPERIENCE_ID].asUUID()); - } -} - -void LLPanelExperienceLog::onNotify() -{ - LLSD event = getSelectedEvent(); - if(event.isDefined()) - { - LLExperienceLog::instance().notify(event); - } -} - -void LLPanelExperienceLog::onNext() -{ - mCurrentPage++; - refresh(); -} - -void LLPanelExperienceLog::onPrev() -{ - if(mCurrentPage>0) - { - mCurrentPage--; - refresh(); - } -} - -void LLPanelExperienceLog::notifyChanged() -{ - LLExperienceLog::instance().setNotifyNewEvent(getChild<LLCheckBoxCtrl>("notify_all")->get()); -} - -void LLPanelExperienceLog::logSizeChanged() -{ - int value = (int)(getChild<LLSpinCtrl>("logsizespinner")->get()); - LLExperienceLog::instance().setMaxDays(value); - refresh(); -} - -void LLPanelExperienceLog::onSelectionChanged() -{ - bool enabled = (1 == mEventList->getNumSelected()); - getChild<LLButton>(BTN_REPORT_XP)->setEnabled(enabled); - getChild<LLButton>(BTN_PROFILE_XP)->setEnabled(enabled); - getChild<LLButton>("btn_notify")->setEnabled(enabled); -} - -LLSD LLPanelExperienceLog::getSelectedEvent() -{ - LLScrollListItem* item = mEventList->getFirstSelected(); - if(item) - { - return item->getValue(); - } - return LLSD(); -} +/**
+ * @file llpanelexperiencelog.cpp
+ * @brief llpanelexperiencelog
+ *
+ * $LicenseInfo:firstyear=2014&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2014, Linden Research, Inc.
+ *
+ * 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
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ */
+
+
+#include "llviewerprecompiledheaders.h"
+#include "llpanelexperiencelog.h"
+
+#include "llexperiencelog.h"
+#include "llexperiencecache.h"
+#include "llbutton.h"
+#include "llscrolllistctrl.h"
+#include "llcombobox.h"
+#include "llspinctrl.h"
+#include "llcheckboxctrl.h"
+#include "llfloaterreg.h"
+#include "llfloaterreporter.h"
+#include "llinventoryfunctions.h"
+
+
+#define BTN_PROFILE_XP "btn_profile_xp"
+#define BTN_REPORT_XP "btn_report_xp"
+
+static LLPanelInjector<LLPanelExperienceLog> register_experiences_panel("experience_log");
+
+
+LLPanelExperienceLog::LLPanelExperienceLog( )
+ : mEventList(NULL)
+ , mPageSize(25)
+ , mCurrentPage(0)
+{
+ buildFromFile("panel_experience_log.xml");
+}
+
+bool LLPanelExperienceLog::postBuild()
+{
+ LLExperienceLog* log = LLExperienceLog::getInstance();
+ mEventList = getChild<LLScrollListCtrl>("experience_log_list");
+ mEventList->setCommitCallback(boost::bind(&LLPanelExperienceLog::onSelectionChanged, this));
+ mEventList->setDoubleClickCallback( boost::bind(&LLPanelExperienceLog::onProfileExperience, this));
+
+ getChild<LLButton>("btn_clear")->setCommitCallback(boost::bind(&LLExperienceLog::clear, log));
+ getChild<LLButton>("btn_clear")->setCommitCallback(boost::bind(&LLPanelExperienceLog::refresh, this));
+
+ getChild<LLButton>(BTN_PROFILE_XP)->setCommitCallback(boost::bind(&LLPanelExperienceLog::onProfileExperience, this));
+ getChild<LLButton>(BTN_REPORT_XP )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onReportExperience, this));
+ getChild<LLButton>("btn_notify" )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onNotify, this));
+ getChild<LLButton>("btn_next" )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onNext, this));
+ getChild<LLButton>("btn_prev" )->setCommitCallback(boost::bind(&LLPanelExperienceLog::onPrev, this));
+
+ LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("notify_all");
+ check->set(log->getNotifyNewEvent());
+ check->setCommitCallback(boost::bind(&LLPanelExperienceLog::notifyChanged, this));
+
+
+ LLSpinCtrl* spin = getChild<LLSpinCtrl>("logsizespinner");
+ spin->set(log->getMaxDays());
+ spin->setCommitCallback(boost::bind(&LLPanelExperienceLog::logSizeChanged, this));
+
+ mPageSize = log->getPageSize();
+ refresh();
+ mNewEvent = LLExperienceLog::instance().addUpdateSignal(boost::bind(&LLPanelExperienceLog::refresh, this));
+ return true;
+}
+
+LLPanelExperienceLog* LLPanelExperienceLog::create()
+{
+ return new LLPanelExperienceLog();
+}
+
+void LLPanelExperienceLog::refresh()
+{
+ S32 selected = mEventList->getFirstSelectedIndex();
+ mEventList->deleteAllItems();
+ const LLSD events = LLExperienceLog::instance().getEvents();
+
+ if(events.size() == 0)
+ {
+ mEventList->setCommentText(getString("no_events"));
+ return;
+ }
+
+ setAllChildrenEnabled(false);
+
+ LLSD item;
+ bool waiting = false;
+ LLUUID waiting_id;
+
+ int itemsToSkip = mPageSize*mCurrentPage;
+ int items = 0;
+ bool moreItems = false;
+ LLSD events_to_save = events;
+ if (events.isMap() && events.size() != 0)
+ {
+ LLSD::map_const_iterator day = events.endMap();
+ do
+ {
+ --day;
+ const LLSD& dayArray = day->second;
+
+ std::string date = day->first;
+ if(!LLExperienceLog::instance().isNotExpired(date))
+ {
+ events_to_save.erase(day->first);
+ continue;
+ }
+ int size = dayArray.size();
+ if(itemsToSkip > size)
+ {
+ itemsToSkip -= size;
+ continue;
+ }
+ if(items >= mPageSize && size > 0)
+ {
+ moreItems = true;
+ break;
+ }
+ for(int i = dayArray.size() - itemsToSkip - 1; i >= 0; i--)
+ {
+ if(items >= mPageSize)
+ {
+ moreItems = true;
+ break;
+ }
+ const LLSD event = dayArray[i];
+ LLUUID id = event[LLExperienceCache::EXPERIENCE_ID].asUUID();
+ const LLSD& experience = LLExperienceCache::instance().get(id);
+ if(experience.isUndefined()){
+ waiting = true;
+ waiting_id = id;
+ }
+ if(!waiting)
+ {
+ item["id"] = event;
+
+ LLSD& columns = item["columns"];
+ columns[0]["column"] = "time";
+ columns[0]["value"] = day->first+event["Time"].asString();
+ columns[1]["column"] = "event";
+ columns[1]["value"] = LLExperienceLog::getPermissionString(event, "ExperiencePermissionShort");
+ columns[2]["column"] = "experience_name";
+ columns[2]["value"] = experience[LLExperienceCache::NAME].asString();
+ columns[3]["column"] = "object_name";
+ columns[3]["value"] = event["ObjectName"].asString();
+ mEventList->addElement(item);
+ }
+ ++items;
+ }
+ } while (day != events.beginMap());
+ }
+ LLExperienceLog::getInstance()->setEventsToSave(events_to_save);
+ if(waiting)
+ {
+ mEventList->deleteAllItems();
+ mEventList->setCommentText(getString("loading"));
+ LLExperienceCache::instance().get(waiting_id, boost::bind(&LLPanelExperienceLog::refresh, this));
+ }
+ else
+ {
+ setAllChildrenEnabled(true);
+
+ mEventList->setEnabled(true);
+ getChild<LLButton>("btn_next")->setEnabled(moreItems);
+ getChild<LLButton>("btn_prev")->setEnabled(mCurrentPage>0);
+ getChild<LLButton>("btn_clear")->setEnabled(mEventList->getItemCount()>0);
+ if(selected<0)
+ {
+ selected = 0;
+ }
+ mEventList->selectNthItem(selected);
+ onSelectionChanged();
+ }
+}
+
+void LLPanelExperienceLog::onProfileExperience()
+{
+ LLSD event = getSelectedEvent();
+ if(event.isDefined())
+ {
+ LLFloaterReg::showInstance("experience_profile", event[LLExperienceCache::EXPERIENCE_ID].asUUID(), true);
+ }
+}
+
+void LLPanelExperienceLog::onReportExperience()
+{
+ LLSD event = getSelectedEvent();
+ if(event.isDefined())
+ {
+ LLFloaterReporter::showFromExperience(event[LLExperienceCache::EXPERIENCE_ID].asUUID());
+ }
+}
+
+void LLPanelExperienceLog::onNotify()
+{
+ LLSD event = getSelectedEvent();
+ if(event.isDefined())
+ {
+ LLExperienceLog::instance().notify(event);
+ }
+}
+
+void LLPanelExperienceLog::onNext()
+{
+ mCurrentPage++;
+ refresh();
+}
+
+void LLPanelExperienceLog::onPrev()
+{
+ if(mCurrentPage>0)
+ {
+ mCurrentPage--;
+ refresh();
+ }
+}
+
+void LLPanelExperienceLog::notifyChanged()
+{
+ LLExperienceLog::instance().setNotifyNewEvent(getChild<LLCheckBoxCtrl>("notify_all")->get());
+}
+
+void LLPanelExperienceLog::logSizeChanged()
+{
+ int value = (int)(getChild<LLSpinCtrl>("logsizespinner")->get());
+ LLExperienceLog::instance().setMaxDays(value);
+ refresh();
+}
+
+void LLPanelExperienceLog::onSelectionChanged()
+{
+ bool enabled = (1 == mEventList->getNumSelected());
+ getChild<LLButton>(BTN_REPORT_XP)->setEnabled(enabled);
+ getChild<LLButton>(BTN_PROFILE_XP)->setEnabled(enabled);
+ getChild<LLButton>("btn_notify")->setEnabled(enabled);
+}
+
+LLSD LLPanelExperienceLog::getSelectedEvent()
+{
+ LLScrollListItem* item = mEventList->getFirstSelected();
+ if(item)
+ {
+ return item->getValue();
+ }
+ return LLSD();
+}
|