summaryrefslogtreecommitdiff
path: root/indra/newview/llsettingspicker.h
blob: b3637fd59ab3707a02e98986eae8d91d0e1bcb1e (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/** 
 * @file llsettingspicker.h
 * @author Rider Linden
 * @brief LLSettingsPicker class header file including related functions
 *
 * $LicenseInfo:firstyear=2018&license=viewerlgpl$
 * Second Life Viewer Source Code
 * Copyright (C) 2018, 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$
 */

#ifndef LL_SETTINGSPICKER_H
#define LL_SETTINGSPICKER_H

#include "llinventorysettings.h"
#include "llfloater.h"
#include "llpermissionsflags.h"
#include "llfolderview.h"
#include "llinventory.h"

#include <boost/signals2.hpp>

//=========================================================================
class LLFilterEditor;
class LLInventoryPanel;

//=========================================================================
class LLFloaterSettingsPicker : public LLFloater
{
public:
    typedef std::function<void (LLUUID id)>                 commit_callback_t;
    typedef std::function<void()>                           close_callback_t;
    typedef std::function<void(const LLUUID& asset_id)>     id_changed_callback_t;

    LLFloaterSettingsPicker(LLView * owner, LLUUID setting_asset_id, const std::string &label, const LLSD &params = LLSD());

    virtual                 ~LLFloaterSettingsPicker() override;

    void                    setActive(bool active);

    virtual BOOL            postBuild() override;
    virtual void	        onClose(bool app_quitting) override;
    virtual void            draw() override;

    void                    setSettingsAssetId(const LLUUID &settings_id, bool set_selection = true);
    LLUUID                  getSettingsAssetId() const              { return mSettingAssetID; }

    void                    setDefaultSettingsAssetID(LLUUID id)    { mDefaultSettingsAssetID = id; }
    LLUUID                  getDefaultSettingsAssetID() const       { return mDefaultSettingsAssetID; }

    void                    setSettingsFilter(LLSettingsType::type_e type);
    LLSettingsType::type_e  getSettingsFilter() const { return mSettingsType; }

    // Takes a UUID, wraps get/setImageAssetID
    virtual void            setValue(const LLSD& value) override;
    virtual LLSD            getValue() const override;

    LLUUID                  findItemID(const LLUUID& asset_id, bool copyable_only, bool ignore_library = false) 
    {
        LLInventoryItem *pitem = findItem(asset_id, copyable_only, ignore_library);
        if (pitem)
            return pitem->getUUID();
        return LLUUID::null;
    }

    std::string             findItemName(const LLUUID& asset_id, bool copyable_only, bool ignore_library = false)
    {
        LLInventoryItem *pitem = findItem(asset_id, copyable_only, ignore_library);
        if (pitem)
            return pitem->getName();
        return std::string();
    }

    LLInventoryItem *       findItem(const LLUUID& asset_id, bool copyable_only, bool ignore_library);

private:
    typedef std::deque<LLFolderViewItem *>  itemlist_t;

    void                    onFilterEdit(const std::string& search_string);
    void                    onSelectionChange(const itemlist_t &items, bool user_action);
    void                    onButtonCancel();
    void                    onButtonSelect();


    LLView*				    mOwner;
    std::string             mLabel;
    LLUUID				    mSettingAssetID; 
    LLUUID                  mDefaultSettingsAssetID;

    LLFilterEditor *        mFilterEdit;
    LLInventoryPanel *      mInventoryPanel;
    LLSettingsType::type_e  mSettingsType;

    F32                     mContextConeOpacity;
    PermissionMask          mImmediateFilterPermMask;
//     PermissionMask          mDnDFilterPermMask;
//     PermissionMask          mNonImmediateFilterPermMask;

    bool                    mActive;
    bool				    mNoCopySettingsSelected;

    LLSaveFolderState	    mSavedFolderState;

//     boost::signals2::signal<void(LLUUID id)>                mCommitSignal;
    boost::signals2::signal<void()>                         mCloseSignal;
    boost::signals2::signal<void(const LLUUID& asset_id)>   mChangeIDSignal;
};

#endif  // LL_LLTEXTURECTRL_H