Adjustments to SEKRIT PROJEKT DELTA
Signed-off-by: Beeks <HgDelirium@gmail.com>
This commit is contained in:
@@ -22,9 +22,10 @@
|
|||||||
#include "lluictrlfactory.h" //Loads the XUI
|
#include "lluictrlfactory.h" //Loads the XUI
|
||||||
|
|
||||||
// project includes
|
// project includes
|
||||||
|
#include "llresmgr.h"
|
||||||
|
#include "llsdserialize.h" //XML Parsing - Probably not needed
|
||||||
#include "llviewercontrol.h"
|
#include "llviewercontrol.h"
|
||||||
#include "llviewerwindow.h"
|
#include "llviewerwindow.h"
|
||||||
#include "llsdserialize.h" //XML Parsing - Probably not needed
|
|
||||||
|
|
||||||
///----------------------------------------------------------------------------
|
///----------------------------------------------------------------------------
|
||||||
/// Local function declarations, constants, enums, and typedefs
|
/// Local function declarations, constants, enums, and typedefs
|
||||||
@@ -41,16 +42,38 @@ ASFloaterUploadBrowser* ASFloaterUploadBrowser::sInstance = NULL;
|
|||||||
ASFloaterUploadBrowser::ASFloaterUploadBrowser()
|
ASFloaterUploadBrowser::ASFloaterUploadBrowser()
|
||||||
: LLFloater(std::string("floater_upload_browser"), std::string("FloaterUploadRect"), LLStringUtil::null)
|
: LLFloater(std::string("floater_upload_browser"), std::string("FloaterUploadRect"), LLStringUtil::null)
|
||||||
{
|
{
|
||||||
mPathName = "C:\\Users\\Duncan\\Documents"+gDirUtilp->getDirDelimiter(); //(gDirUtilp->getSkinBaseDir()+gDirUtilp->getDirDelimiter());
|
|
||||||
mFilterType = "None";
|
|
||||||
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_upload_browser.xml");
|
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_upload_browser.xml");
|
||||||
|
mPathName = gDirUtilp->getSkinBaseDir();
|
||||||
|
mFilterType = "None";
|
||||||
mFileList = getChild<LLScrollListCtrl>("file_list");
|
mFileList = getChild<LLScrollListCtrl>("file_list");
|
||||||
|
mDriveCombo = getChild<LLComboBox>("drive_combo");
|
||||||
|
mBookmarkCombo = getChild<LLComboBox>("bookmark_combo");
|
||||||
|
|
||||||
childSetCommitCallback("file_list", onClickFile, this);
|
childSetCommitCallback("file_list", onClickFile, this);
|
||||||
childSetDoubleClickCallback("file_list", onDoubleClick);
|
childSetDoubleClickCallback("file_list", onDoubleClick);
|
||||||
childSetCommitCallback("file_filter_combo", onUpdateFilter, this);
|
childSetCommitCallback("file_filter_combo", onUpdateFilter, this);
|
||||||
|
|
||||||
|
//This is so unbelievably shitty I can't believe it -HgB
|
||||||
|
std::string drive_letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
S32 index;
|
||||||
|
mDriveCombo->removeall();
|
||||||
|
for (index = 0; index < 26; index++)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::string dir = drive_letters.substr(index, index) + ":" + gDirUtilp->getDirDelimiter();
|
||||||
|
S32 file_count = gDirUtilp->countFilesInDir(dir, "*.*");
|
||||||
|
llinfos << dir << " - " << file_count << llendl;
|
||||||
|
if(file_count)
|
||||||
|
{
|
||||||
|
mDriveCombo->add(dir, ADD_BOTTOM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
mFileList->sortByColumn(std::string("file_name"), TRUE);
|
mFileList->sortByColumn(std::string("file_name"), TRUE);
|
||||||
mFileList->sortByColumn(std::string("file_type"), TRUE);
|
mFileList->sortByColumn(std::string("file_type"), TRUE);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroys the object
|
// Destroys the object
|
||||||
@@ -67,32 +90,45 @@ void ASFloaterUploadBrowser::onClickFile(LLUICtrl* ctrl, void* user_data)
|
|||||||
|
|
||||||
void ASFloaterUploadBrowser::onUpdateFilter(LLUICtrl* ctrl, void* user_data)
|
void ASFloaterUploadBrowser::onUpdateFilter(LLUICtrl* ctrl, void* user_data)
|
||||||
{
|
{
|
||||||
llinfos << "Filter change triggered." << llendl;
|
|
||||||
ASFloaterUploadBrowser* panelp = (ASFloaterUploadBrowser*)user_data;
|
ASFloaterUploadBrowser* panelp = (ASFloaterUploadBrowser*)user_data;
|
||||||
LLComboBox* combo = panelp->getChild<LLComboBox>("file_filter_combo");
|
LLComboBox* combo = panelp->getChild<LLComboBox>("file_filter_combo");
|
||||||
if (combo->getSelectedValue().asString() != panelp->mFilterType)
|
if (combo->getSelectedValue().asString() != panelp->mFilterType)
|
||||||
{
|
{
|
||||||
llinfos << "Selection is new, rebuilding file list." << llendl;
|
panelp->mFilterType = "";
|
||||||
panelp->mFilterType.clear();
|
panelp->mFilterType = combo->getSelectedValue().asString();
|
||||||
panelp->mFilterType = combo->getSelectedValue().asString().c_str();
|
panelp->refresh();
|
||||||
panelp->refreshUploadOptions();
|
panelp->mFileList->selectFirstItem();
|
||||||
|
panelp->childSetValue("asset_name", "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASFloaterUploadBrowser::refreshUploadOptions()
|
void ASFloaterUploadBrowser::refreshUploadOptions()
|
||||||
{
|
{
|
||||||
|
if (!mFileList->isEmpty())
|
||||||
|
{
|
||||||
|
if(!mFileList->getSelectedIDs().count())
|
||||||
|
{
|
||||||
|
llinfos << "No selection, clearing field." << llendl;
|
||||||
|
childSetValue("asset_name", "");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (mFileList->getFirstSelected()->getColumn(LIST_FILE_TYPE)->getValue().asInteger() == LIST_TYPE_FILE)
|
if (mFileList->getFirstSelected()->getColumn(LIST_FILE_TYPE)->getValue().asInteger() == LIST_TYPE_FILE)
|
||||||
{
|
{
|
||||||
if (mFileList->getAllSelected().size() > 1)
|
if (mFileList->getAllSelected().size() > 1)
|
||||||
{
|
{
|
||||||
llinfos << "Selected multiple files." << llendl;
|
llinfos << "Selected multiple files." << llendl;
|
||||||
childSetValue("asset_name", "(Multiple)");
|
childSetValue("asset_name", "(Multiple)");
|
||||||
|
childSetLabelArg("upload_button", "[COST]", std::string("$L" + (10 * mFileList->getAllSelected().size())));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
llinfos << "Selected a file." << llendl;
|
llinfos << "Selected a file." << llendl;
|
||||||
std::string name = mFileList->getFirstSelected()->getColumn(LIST_FILE_NAME)->getValue().asString();
|
std::string name = mFileList->getFirstSelected()->getColumn(LIST_FILE_NAME)->getValue().asString();
|
||||||
childSetValue("asset_name", name);
|
childSetValue("asset_name", name);
|
||||||
|
childSetLabelArg("upload_button", "[COST]", std::string("$L10"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,36 +143,39 @@ void ASFloaterUploadBrowser::handleDoubleClick()
|
|||||||
{
|
{
|
||||||
if (mFileList->getFirstSelected()->getColumn(LIST_FILE_TYPE)->getValue().asInteger() == LIST_TYPE_PARENT)
|
if (mFileList->getFirstSelected()->getColumn(LIST_FILE_TYPE)->getValue().asInteger() == LIST_TYPE_PARENT)
|
||||||
{
|
{
|
||||||
llinfos << "Double-clicked Parent." << llendl;
|
S32 dirLimiterIndex = mPathName.find_last_of(gDirUtilp->getDirDelimiter());
|
||||||
|
mPathName = mPathName.substr(0, dirLimiterIndex);
|
||||||
|
refresh();
|
||||||
|
mFileList->selectFirstItem();
|
||||||
}
|
}
|
||||||
else if (mFileList->getFirstSelected()->getColumn(LIST_FILE_TYPE)->getValue().asInteger() == LIST_TYPE_FOLDER)
|
else if (mFileList->getFirstSelected()->getColumn(LIST_FILE_TYPE)->getValue().asInteger() == LIST_TYPE_FOLDER)
|
||||||
{
|
{
|
||||||
std::string newPath = (mFileList->getFirstSelected()->getColumn(LIST_FILE_NAME)->getValue().asString()+gDirUtilp->getDirDelimiter());
|
mPathName = mPathName + gDirUtilp->getDirDelimiter() + mFileList->getFirstSelected()->getColumn(LIST_FILE_NAME)->getValue().asString();
|
||||||
/*newPath = (mPathName+newPath);
|
|
||||||
mPathName = newPath.c_str();*/
|
|
||||||
llinfos << "Double-clicked Folder. Directory should change to " << mPathName << mFileList->getFirstSelected()->getColumn(LIST_FILE_NAME)->getValue().asString() << "!!" << llendl;
|
|
||||||
//mPathName.append(mFileList->getFirstSelected()->getColumn(LIST_FILE_NAME)->getValue().asString().c_str() + gDirUtilp->getDirDelimiter());
|
|
||||||
refresh();
|
refresh();
|
||||||
|
mFileList->selectFirstItem();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
childSetValue("asset_name", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ASFloaterUploadBrowser::refresh()
|
void ASFloaterUploadBrowser::refresh()
|
||||||
{
|
{
|
||||||
llinfos << "Emptying existing file list." << mPathName << llendl;
|
std::string filename;
|
||||||
|
std::string fullPath = mPathName + gDirUtilp->getDirDelimiter();
|
||||||
|
mFileList->deselectAllItems();
|
||||||
mFileList->deleteAllItems();
|
mFileList->deleteAllItems();
|
||||||
llinfos << "Getting file listing at " << mPathName << llendl;
|
llinfos << "Getting file listing at " << gDirUtilp->getDirName(fullPath) << " side note " << gDirUtilp->getDirName("C:\\") << llendl;
|
||||||
|
gDirUtilp->getNextFileInDir(gDirUtilp->getChatLogsDir(),"*", filename, false); //Clears the last file
|
||||||
bool found = true;
|
bool found = true;
|
||||||
U32 fileCount = gDirUtilp->countFilesInDir(mPathName, "*.*");
|
S32 file_count = 0;
|
||||||
while(found)
|
while(found)
|
||||||
{
|
{
|
||||||
std::string filename;
|
found = gDirUtilp->getNextFileInDir(fullPath, "*.*", filename, false);
|
||||||
found = gDirUtilp->getNextFileInDir(mPathName, "*.*", filename, false);
|
|
||||||
fileCount++;
|
|
||||||
//llinfo
|
|
||||||
if(found)
|
if(found)
|
||||||
{
|
{
|
||||||
S32 periodIndex = filename.find_last_of(".");
|
S32 periodIndex = filename.find_last_of(".");
|
||||||
std::string extension = filename.substr(periodIndex + 1, filename.length() - 1);
|
std::string extension = filename.substr(periodIndex + 1, filename.length() - 1);
|
||||||
|
std::string extensionL = utf8str_tolower(extension);
|
||||||
LLSD element;
|
LLSD element;
|
||||||
element["path"] = mPathName + filename;
|
element["path"] = mPathName + filename;
|
||||||
|
|
||||||
@@ -154,20 +193,20 @@ void ASFloaterUploadBrowser::refresh()
|
|||||||
invtype_column["type"] = "icon";
|
invtype_column["type"] = "icon";
|
||||||
invtype_column["value"] = "inv_folder_trash.tga";
|
invtype_column["value"] = "inv_folder_trash.tga";
|
||||||
|
|
||||||
if (((extension == "jpeg")||(extension == "jpg")||(extension == "tga")
|
if (((extensionL == "jpeg")||(extensionL == "jpg")||(extensionL == "tga")
|
||||||
||(extension == "png")||(extension == "bmp"))&&((mFilterType == "None")||(mFilterType == "Texture")))
|
||(extensionL == "png")||(extensionL == "bmp"))&&((mFilterType == "None")||(mFilterType == "Texture")))
|
||||||
{
|
{
|
||||||
invtype_column["value"] = "inv_item_texture.tga";
|
invtype_column["value"] = "inv_item_texture.tga";
|
||||||
filename_column["value"] = filename.substr(0, periodIndex);
|
filename_column["value"] = filename.substr(0, periodIndex);
|
||||||
filetype_column["value"] = LIST_TYPE_FILE;
|
filetype_column["value"] = LIST_TYPE_FILE;
|
||||||
}
|
}
|
||||||
else if ((extension == "wav")&&((mFilterType == "None")||(mFilterType == "Sound")))
|
else if ((extensionL == "wav")&&((mFilterType == "None")||(mFilterType == "Sound")))
|
||||||
{
|
{
|
||||||
invtype_column["value"] = "inv_item_sound.tga";
|
invtype_column["value"] = "inv_item_sound.tga";
|
||||||
filename_column["value"] = filename.substr(0, periodIndex);
|
filename_column["value"] = filename.substr(0, periodIndex);
|
||||||
filetype_column["value"] = LIST_TYPE_FILE;
|
filetype_column["value"] = LIST_TYPE_FILE;
|
||||||
}
|
}
|
||||||
else if (((extension == "bvh")||(extension == "anim"))&&((mFilterType == "None")||(mFilterType == "Animation")))
|
else if (((extensionL == "bvh")||(extensionL == "anim"))&&((mFilterType == "None")||(mFilterType == "Animation")))
|
||||||
{
|
{
|
||||||
invtype_column["value"] = "inv_item_animation.tga";
|
invtype_column["value"] = "inv_item_animation.tga";
|
||||||
filename_column["value"] = filename.substr(0, periodIndex);
|
filename_column["value"] = filename.substr(0, periodIndex);
|
||||||
@@ -188,9 +227,20 @@ void ASFloaterUploadBrowser::refresh()
|
|||||||
if (invtype_column["value"].asString() != "inv_folder_trash.tga")
|
if (invtype_column["value"].asString() != "inv_folder_trash.tga")
|
||||||
{
|
{
|
||||||
mFileList->addElement(element, ADD_BOTTOM);
|
mFileList->addElement(element, ADD_BOTTOM);
|
||||||
|
if (filetype_column["value"].asInteger() == LIST_TYPE_FILE)
|
||||||
|
{
|
||||||
|
file_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string result;
|
||||||
|
LLResMgr::getInstance()->getIntegerString(result, file_count);
|
||||||
|
childSetTextArg("result_label", "[COUNT]", result);
|
||||||
|
|
||||||
|
mFileList->sortItems();
|
||||||
|
llinfos << "Total files loaded: " << result << "." << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#define ASCENT_UPLOAD_BROWSER
|
#define ASCENT_UPLOAD_BROWSER
|
||||||
|
|
||||||
#include "llfloater.h"
|
#include "llfloater.h"
|
||||||
|
#include "llcombobox.h"
|
||||||
|
|
||||||
class LLScrollListCtrl;
|
class LLScrollListCtrl;
|
||||||
|
|
||||||
@@ -50,6 +51,9 @@ private:
|
|||||||
LIST_TYPE_FILE
|
LIST_TYPE_FILE
|
||||||
};
|
};
|
||||||
LLScrollListCtrl* mFileList;
|
LLScrollListCtrl* mFileList;
|
||||||
|
LLComboBox* mDriveCombo;
|
||||||
|
LLComboBox* mBookmarkCombo;
|
||||||
|
|
||||||
std::string mPathName;
|
std::string mPathName;
|
||||||
std::string mFilterType;
|
std::string mFilterType;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,14 +2,54 @@
|
|||||||
<floater can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true"
|
<floater can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true"
|
||||||
width="650" height="340" min_width="600" min_height="340" max_width="600"
|
width="650" height="340" min_width="600" min_height="340" max_width="600"
|
||||||
name="browser" title="Upload Browser" control_name="UploadBrowserFloater">
|
name="browser" title="Upload Browser" control_name="UploadBrowserFloater">
|
||||||
|
<combo_box allow_text_entry="false" bottom="-42" follows="left|top" height="18" left="10" max_chars="20"
|
||||||
|
mouse_opaque="true" enabled="true" width="108" name="bookmark_combo" tool_tip="Jump to a common folder">
|
||||||
|
<combo_item name="None" enabled="false" value="None">
|
||||||
|
Bookmarked:
|
||||||
|
</combo_item>
|
||||||
|
</combo_box>
|
||||||
|
<button bottom_delta="0" follows="top|left" height="18" label="+"
|
||||||
|
left_delta="113" name="add_bookmark_button" tool_tip="Add current folder to Bookmarks"
|
||||||
|
width="20" />
|
||||||
|
<button bottom_delta="0" follows="top|left" height="18" label="-"
|
||||||
|
left_delta="22" name="remove_bookmark_button" tool_tip="Remove selected folder from Bookmarks"
|
||||||
|
width="20" />
|
||||||
<text type="string" length="50" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
<text type="string" length="50" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||||
bottom="-35" drop_shadow_visible="true" enabled="true" follows="left|top"
|
bottom="-37" drop_shadow_visible="true" enabled="true" follows="left|top"
|
||||||
|
font="SansSerifSmall" h_pad="0" halign="left" height="12" left="210"
|
||||||
|
mouse_opaque="true" name="drive_label" v_pad="0" width="128">
|
||||||
|
Drive:
|
||||||
|
</text>
|
||||||
|
<combo_box allow_text_entry="false" bottom_delta="-5" follows="left|top" height="18" left_delta="35" max_chars="20"
|
||||||
|
mouse_opaque="true" enabled="true" width="40" name="drive_combo" tool_tip="Switch to another drive">
|
||||||
|
<combo_item name="None" enabled="false" value="None">
|
||||||
|
All
|
||||||
|
</combo_item>
|
||||||
|
<combo_item name="None" enabled="false" value="None">
|
||||||
|
Of
|
||||||
|
</combo_item>
|
||||||
|
<combo_item name="None" enabled="false" value="None">
|
||||||
|
Them
|
||||||
|
</combo_item>
|
||||||
|
</combo_box>
|
||||||
|
<scroll_list bottom="30" can_resize="true" column_padding="0" draw_heading="true"
|
||||||
|
follows="left|top|bottom" left="5" multi_select="true"
|
||||||
|
name="file_list" width="280" search_column="1"
|
||||||
|
tool_tip="Hold shift or control while clicking to select multiple files"
|
||||||
|
top="-46">
|
||||||
|
<column name="file_type" width="0" />
|
||||||
|
<column image="ff_edit_mine_button.tga" name="icon_inventory_type"
|
||||||
|
tool_tip="Inventory Type" width="20" />
|
||||||
|
<column dynamicwidth="true" label="Filename" name="file_name" tool_tip="Filename" />
|
||||||
|
</scroll_list>
|
||||||
|
<text type="string" length="50" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||||
|
bottom="12" drop_shadow_visible="true" enabled="true" follows="left|bottom"
|
||||||
font="SansSerifSmall" h_pad="0" halign="left" height="12" left="10"
|
font="SansSerifSmall" h_pad="0" halign="left" height="12" left="10"
|
||||||
mouse_opaque="true" name="filter_label" v_pad="0" width="128">
|
mouse_opaque="true" name="filter_label" v_pad="0" width="128">
|
||||||
Filter:
|
Filter:
|
||||||
</text>
|
</text>
|
||||||
<combo_box allow_text_entry="false" bottom_delta="-5" follows="top|left" height="18" left_delta="40" max_chars="20"
|
<combo_box allow_text_entry="false" bottom_delta="-5" follows="left|bottom" height="18" left_delta="40" max_chars="20"
|
||||||
mouse_opaque="true" enabled="true" width="108" name="file_filter_combo" tool_tip="Preview at a fixed aspect ratio">
|
mouse_opaque="true" enabled="true" width="108" name="file_filter_combo" tool_tip="Limit results to a specific type">
|
||||||
<combo_item name="None" value="None">
|
<combo_item name="None" value="None">
|
||||||
None
|
None
|
||||||
</combo_item>
|
</combo_item>
|
||||||
@@ -24,21 +64,11 @@
|
|||||||
</combo_item>
|
</combo_item>
|
||||||
</combo_box>
|
</combo_box>
|
||||||
<text type="string" length="50" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
<text type="string" length="50" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||||
bottom="-35" drop_shadow_visible="true" enabled="true" follows="left|top"
|
bottom_delta="5" drop_shadow_visible="true" enabled="true" follows="left|bottom"
|
||||||
font="SansSerifSmall" h_pad="0" halign="right" height="12" left="155"
|
font="SansSerifSmall" h_pad="0" halign="right" height="12" left="155"
|
||||||
mouse_opaque="true" name="result_label" v_pad="0" width="128">
|
mouse_opaque="true" name="result_label" v_pad="0" width="128">
|
||||||
Files: [COUNT]
|
Files: [COUNT]
|
||||||
</text>
|
</text>
|
||||||
<scroll_list bottom="10" can_resize="true" column_padding="0" draw_heading="true"
|
|
||||||
follows="left|top|bottom" left="5" multi_select="true"
|
|
||||||
name="file_list" width="280" search_column="1"
|
|
||||||
tool_tip="Hold shift or control while clicking to select multiple files"
|
|
||||||
top="-46">
|
|
||||||
<column name="file_type" width="0" />
|
|
||||||
<column image="ff_edit_mine_button.tga" name="icon_inventory_type"
|
|
||||||
tool_tip="Inventory Type" width="20" />
|
|
||||||
<column dynamicwidth="true" label="Filename" name="file_name" tool_tip="Filename" />
|
|
||||||
</scroll_list>
|
|
||||||
<text type="string" length="50" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
<text type="string" length="50" bg_visible="false" border_drop_shadow_visible="false" border_visible="false"
|
||||||
bottom="-35" drop_shadow_visible="true" enabled="true" follows="left|top"
|
bottom="-35" drop_shadow_visible="true" enabled="true" follows="left|top"
|
||||||
font="SansSerifSmall" h_pad="0" halign="left" height="12" left="302"
|
font="SansSerifSmall" h_pad="0" halign="left" height="12" left="302"
|
||||||
|
|||||||
Reference in New Issue
Block a user