<commit_before>import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtQuick.Controls.Styles 1.0
import QtQuick.Window 2.3

ListView 
{
	id : listview
	
	clip: true
	
	ScrollBar.vertical: ScrollBar {}
	spacing : 10
	
	model : dataLibraryListModel
	
	delegate: libraryDelegate 
	
	function toolTipText(type, associated_datafile, mousearea)
	{
		//model type: JASP = 0, CSV = 1, SPSS = 2, Folder = 3, Other = 4, NoOfTypes = 5
		
		if (type === 3)  
			return "Press to navigate to folder"
		
		if ( (associated_datafile === "" && type === 0) || (associated_datafile !== "" && mousearea === "commonMouseArea") )
			return "Double click to open JASP file"	
		
		var a = ""
		if (associated_datafile !== "") a =" associated"
		return "Double click to open" + a + " data file"				
		
	}
	
	Component {
		id: libraryDelegate
		
		Rectangle {
			
			id: rectTitleAndDescripton
			
			width: listview.width
			height: rectTitle.height + rectDescription.height + 3
			border.width: 1
			border.color: "darkgray"
			
			color: "#ececec"  
			
			Rectangle {
				
				id: rectTitle
				
				height: 40 
				width: parent.width 
				anchors.left: parent.left
				anchors.right: parent.right
				anchors.top: parent.top
				anchors.margins: 1
				
				color: commonMouseArea.containsMouse ?  "darkgray" : "#dcdadb"
				
				Image {
					id : firstFileOrFolderImage
					
					height: 0.95 * parent.height
					width: height
					anchors.left: model.type===3 ? rectTitle.left : undefined
					anchors.right: model.type!==3 ? associatedDatafileImage.left : undefined 
					anchors.top:rectTitle.top
					anchors.leftMargin: 10
					
					fillMode: Image.PreserveAspectFit
					source: model.iconsource
					MouseArea {
						id: firstFileOrFolderMouseArea
						z:-2
						anchors.fill: parent
						hoverEnabled: true
						cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor
						
						onDoubleClicked: {
							dataLibraryListModel.openFile(model.path)				
						}
						
						
					}
					
					ToolTip {
						id: firstFileOrFolderTooltip
						delay: 500
						text: commonToolTip.text
						visible: firstFileOrFolderMouseArea.containsMouse
					}					
				}
				
				Image {
					id : associatedDatafileImage
					
					height: 0.95 * parent.height
					width: model.associated_datafile === "" ? 0 : height
					anchors.right : parent.right
					anchors.top:rectTitle.top
					anchors.rightMargin: 10
					<commit_msg>Data Library Improvements<commit_after>import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtQuick.Controls.Styles 1.0
import QtQuick.Window 2.3

ListView 
{
	id : listview
	
	clip: true
	
	ScrollBar.vertical: ScrollBar {}
	spacing : 10
	
	model : dataLibraryListModel
	
	delegate: libraryDelegate 
	
	function toolTipText(type, associated_datafile, mousearea)
	{
		//model type: JASP = 0, CSV = 1, SPSS = 2, Folder = 3, Other = 4, NoOfTypes = 5
		
		if (type === 3)  
			return "Press to navigate to folder"
		
		if ( (associated_datafile === "" && type === 0) || (associated_datafile !== "" && mousearea === "commonMouseArea") )
			return "Double click to open JASP file"	
		
		var a = ""
		if (associated_datafile !== "") a =" associated"
		return "Double click to open" + a + " data file"				
		
	}
	
	Component {
		id: libraryDelegate
		
		Rectangle {
			
			id: rectTitleAndDescripton
			
			width: listview.width
			height: rectTitle.height + rectDescription.height + 3
			border.width: 1
			border.color: "darkgray"
			
			color: "#ececec"  
			
			Rectangle {
				
				id: rectTitle
				
				height: 40 
				width: parent.width 
				anchors.left: parent.left
				anchors.right: parent.right
				anchors.top: parent.top
				anchors.margins: 1
				
				color: commonMouseArea.containsMouse ?  "darkgray" : "#dcdadb"
				
				Image {
					id : firstFileOrFolderImage
					
					height: 0.95 * parent.height
					width: height
					anchors.left: model.type===3 ? rectTitle.left : undefined
					anchors.right: model.type!==3 ? associatedDatafileImage.left : undefined 
					anchors.top:rectTitle.top
					anchors.leftMargin: 10
					
					fillMode: Image.PreserveAspectFit
					source: model.iconsource
					MouseArea {
						id: firstFileOrFolderMouseArea
						z:-2
						anchors.fill: parent
						hoverEnabled: true
						cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor
						
						onClicked: {
							if (model.type === 3) //Folder type
								dataLibraryListModel.changePath(model.name, model.path);
						}
						
						onDoubleClicked: {
							if (model.type !== 3) //Other then folder type
								dataLibraryListModel.openFile(model.path)				
						}
						
						
					}
					
					ToolTip {
						id: firstFileOrFolderTooltip
						delay: 500
						text: commonToolTip.text
						visible: firstFileOrFolderMouseArea.containsMouse
					}					
				}
				
				Image {
					id : associatedDatafileImage
					
					height: 0.95 * parent.height
					width: model.associated_datafile === "" ? 0 : height
					anchors.right : parent.right
					anchors.top:rectTitle.top
					anchors.rightMargin: 10
					
{'fraction_non_alphanumeric': 0.09607498535442296, 'fraction_numerical': 0.016793595000976373, 'mean_word_length': 2.435278336686787, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3858252', 'n_tokens_mistral': 2306, 'n_tokens_neox': 1573, 'n_words': 379}