summaryrefslogtreecommitdiff
path: root/indra/newview/llquickprefs.h
blob: b90333831c21d6443b89706258aabb99a2addaa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
 * @file   llquickprefs.h
 * @brief  Quick Preferences floater: hover height and bandwidth sliders.
 *
 * Ported from Firestorm Viewer (quickprefs.h / quickprefs.cpp).
 * Original authors: WoLf Loonie, Zi Ree, Ansariel Hiller @ Second Life.
 *
 * $LicenseInfo:firstyear=2011&license=viewerlgpl$
 * Phoenix Firestorm Viewer Source Code
 * Copyright (C) 2011, WoLf Loonie @ Second Life
 *
 * 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.
 * $/LicenseInfo$
 */

#ifndef LL_LLQUICKPREFS_H
#define LL_LLQUICKPREFS_H

#include "llfloater.h"

class LLSliderCtrl;
class LLCheckBoxCtrl;
class LLTextBox;

/**
 * @class LLFloaterQuickPrefs
 *
 * A lightweight "Quick Preferences" panel that lets the user adjust commonly
 * tweaked settings on the fly without opening the full Preferences dialog:
 *   - Avatar hover height
 *   - Maximum network bandwidth
 *
 * Hover-height logic is ported 1:1 from Firestorm's FloaterQuickPrefs so that
 * live-preview while dragging, final commit on mouse-up, and region-feature
 * gating all work exactly the same way.
 */
class LLFloaterQuickPrefs : public LLFloater
{
public:
    LLFloaterQuickPrefs(const LLSD& key);
    virtual ~LLFloaterQuickPrefs();

    bool postBuild() override;
    void onClose(bool app_quitting) override;

private:
    // ---- Hover height -------------------------------------------------------
    LLSliderCtrl* mAvatarZOffsetSlider;

    /** Called every frame while the slider thumb is being dragged.
     *  Sends a live (non-persistent) hover offset to the avatar so the user
     *  gets immediate visual feedback. */
    void onAvatarZOffsetSliderMoved();

    /** Called when the drag ends (mouse-up) or the user types a value.
     *  Persists the value to AvatarHoverOffsetZ. */
    void onAvatarZOffsetFinalCommit();

    /** Enable/disable the slider based on whether the current region supports
     *  server-side hover height. */
    void updateAvatarZOffsetEditEnabled();

    /** Called when the region changes so we can re-evaluate the above. */
    void onRegionChanged();
    void onSimulatorFeaturesReceived(const LLUUID& region_id);

    /** Pulls AvatarHoverOffsetZ from saved settings and pushes it to the slider
     *  without triggering a commit (avoids feedback loops). */
    void syncAvatarZOffsetFromPreferenceSetting();

    boost::signals2::connection mRegionChangedSlot;

    // OTS over-the-shoulder aim
    LLCheckBoxCtrl* mOTSEnabledCheck { nullptr };
    void onOTSEnabledChanged();
};

#endif // LL_LLQUICKPREFS_H