Skip to content

Commit

Permalink
#2696 Viewer crashes on gestures : add checkbox 'Play all infinitely'
Browse files Browse the repository at this point in the history
  • Loading branch information
LLGuru committed Nov 21, 2024
1 parent 5590735 commit aae4281
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 6 deletions.
49 changes: 47 additions & 2 deletions indra/newview/llfloatergesture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include "llagent.h"
#include "llappearancemgr.h"
#include "llcheckboxctrl.h"
#include "llclipboard.h"
#include "llgesturemgr.h"
#include "llkeyboard.h"
Expand Down Expand Up @@ -208,9 +209,12 @@ bool LLFloaterGesture::postBuild()
getChild<LLUICtrl>("new_gesture_btn")->setCommitCallback(boost::bind(&LLFloaterGesture::onClickNew, this));
getChild<LLButton>("del_btn")->setClickedCallback(boost::bind(&LLFloaterGesture::onDeleteSelected, this));

getChildView("play_btn")->setVisible( true);
getChildView("stop_btn")->setVisible( false);
getChildView("play_btn")->setVisible(true);
getChildView("stop_btn")->setVisible(false);
setDefaultBtn("play_btn");

mPlayAllInfinitely = getChild<LLCheckBoxCtrl>("play_all_infinitely");

mGestureFolderID = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);

uuid_vec_t folders;
Expand All @@ -237,6 +241,47 @@ bool LLFloaterGesture::postBuild()
return true;
}

void LLFloaterGesture::draw()
{
LLFloater::draw();

static LLCachedControl<bool> sQAMode(gSavedSettings, "QAMode", false);
if (!sQAMode)
{
mPlayAllInfinitely->setVisible(false);
}
else
{
if (!mPlayAllInfinitely->getVisible())
{
mPlayAllInfinitely->setValue(false);
mPlayAllInfinitely->setVisible(true);
}
else if (mPlayAllInfinitely->getValue().asBoolean())
{
static U8 frame_nr = 0;
if (++frame_nr > 3)
{
frame_nr = 0;
}
else if (frame_nr == 1)
{
onClickPlay();
}
else if (frame_nr == 3)
{
LLScrollListItem* prev_item = mGestureList->getFirstSelected();
mGestureList->selectNextItem();
LLScrollListItem* next_item = mGestureList->getFirstSelected();
if (next_item == prev_item)
{
mGestureList->selectFirstItem();
}
mGestureList->scrollToShowSelected();
}
}
}
}

void LLFloaterGesture::refreshAll()
{
Expand Down
9 changes: 6 additions & 3 deletions indra/newview/llfloatergesture.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class LLView;
class LLButton;
class LLLineEditor;
class LLComboBox;
class LLCheckBoxCtrl;
class LLViewerGesture;
class LLGestureOptions;
class LLScrollListCtrl;
Expand All @@ -57,20 +58,22 @@ class LLFloaterGesture
virtual ~LLFloaterGesture();

virtual bool postBuild();
virtual void done ();
virtual void draw();
virtual void done();
void refreshAll();
/**
* @brief Add new scrolllistitem into gesture_list.
* @param item_id inventory id of gesture
* @param gesture can be NULL , if item was not loaded yet
*/
void addGesture(const LLUUID& item_id, LLMultiGesture* gesture, LLCtrlListInterface * list);
void addGesture(const LLUUID& item_id, LLMultiGesture* gesture, LLCtrlListInterface* list);

protected:
// Reads from the gesture manager's list of active gestures
// and puts them in this list.
void buildGestureList();
void playGesture(LLUUID item_id);

private:
void addToCurrentOutFit();
/**
Expand Down Expand Up @@ -102,7 +105,7 @@ class LLFloaterGesture
LLUUID mSelectedID;
LLUUID mGestureFolderID;
LLScrollListCtrl* mGestureList;

LLCheckBoxCtrl* mPlayAllInfinitely;
LLFloaterGestureObserver* mObserver;
};

Expand Down
9 changes: 8 additions & 1 deletion indra/newview/skins/default/xui/en/floater_gesture.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
label="Places"
layout="topleft"
min_height="350"
min_width="240"
min_width="313"
width="313">
<floater.string
name="loading">
Expand Down Expand Up @@ -144,4 +144,11 @@
name="stop_btn"
top_delta="0"
width="83" />
<check_box
name="play_all_infinitely"
label="Play all infinitely"
follows="bottom|right"
left_pad="5"
height="15"
width="100"/>
</floater>

0 comments on commit aae4281

Please sign in to comment.