hbfloateruploadasset.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /**
  2. * @file hbfloateruploadasset.h
  3. * @brief HBFloaterUploadAsset class definition
  4. * This is a full rewrite of LL's LLFloaterNameDesc class.
  5. *
  6. * $LicenseInfo:firstyear=2023&license=viewergpl$
  7. *
  8. * Copyright (c) 2023, Henri Beauchamp.
  9. *
  10. * Second Life Viewer Source Code
  11. * The source code in this file ("Source Code") is provided by Linden Lab
  12. * to you under the terms of the GNU General Public License, version 2.0
  13. * ("GPL"), unless you have obtained a separate licensing agreement
  14. * ("Other License"), formally executed by you and Linden Lab. Terms of
  15. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  16. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  17. *
  18. * There are special exceptions to the terms and conditions of the GPL as
  19. * it is applied to this Source Code. View the full text of the exception
  20. * in the file doc/FLOSS-exception.txt in this software distribution, or
  21. * online at
  22. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  23. *
  24. * By copying, modifying or distributing this software, you acknowledge
  25. * that you have read and understood your obligations described above,
  26. * and agree to abide by those obligations.
  27. *
  28. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  29. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  30. * COMPLETENESS OR PERFORMANCE.
  31. * $/LicenseInfo$
  32. */
  33. #ifndef LL_HBFLOATERUPLOADASSET_H
  34. #define LL_HBFLOATERUPLOADASSET_H
  35. #include "llfloater.h"
  36. class LLButton;
  37. class LLLineEditor;
  38. class HBFloaterUploadAsset : public LLFloater
  39. {
  40. protected:
  41. LOG_CLASS(HBFloaterUploadAsset);
  42. public:
  43. // Note inventory_type is to pick in the LLInventoryType::Etype enum;
  44. // passed here as a S32 (since this is also what it is), to avoid including
  45. // llinventorytype.h here... It is currently only used to determine the
  46. // expected cost of the upload.
  47. HBFloaterUploadAsset(const std::string& filename, S32 inventory_type);
  48. bool postBuild() override;
  49. protected:
  50. // Override for specific (cost-variable) assets. Called in postBuild(), so
  51. // the overriding method must be capable to return the asset cost at this
  52. // point. HB
  53. virtual S32 getExpectedUploadCost() const;
  54. // This method uploads the file as an inventory asset, which will be
  55. // charged for mCost. Override if needed, like for image uploads to deal
  56. // with temporary (free) assets in OpenSim (mTempAsset is set true if
  57. // needed in the override), and with inventory thumbnails since they are
  58. // not inventory assets (the upload is then handed over to the thumbnail
  59. // floater). HB
  60. virtual void uploadAsset();
  61. private:
  62. static void onBtnOK(void*);
  63. static void onBtnCancel(void*);
  64. protected:
  65. LLButton* mUploadButton;
  66. LLLineEditor* mNameEditor;
  67. LLLineEditor* mDescEditor;
  68. std::string mFilenameAndPath;
  69. std::string mFilename;
  70. S32 mCost;
  71. S32 mInventoryType;
  72. bool mTempAsset;
  73. };
  74. // HBFloaterUploadSound derived class, in which only the constructor differs
  75. // from the base class (it just passes the adequate inventory type and uses the
  76. // floater XML definition for sounds upload).
  77. class HBFloaterUploadSound final : HBFloaterUploadAsset
  78. {
  79. protected:
  80. LOG_CLASS(HBFloaterUploadSound);
  81. public:
  82. HBFloaterUploadSound(const std::string& filename);
  83. };
  84. #endif // LL_HBFLOATERUPLOADASSET_H