Compare commits
	
		
			No commits in common. "0bd84213329d1a1517617f18612d0e252e078831" and "9fdb6822f6c3140399c99cdc41a67a07f07ab247" have entirely different histories.
		
	
	
		
			0bd8421332
			...
			9fdb6822f6
		
	
		
							
								
								
									
										10
									
								
								Main.qml
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								Main.qml
									
									
									
									
									
								
							|  | @ -54,11 +54,7 @@ ApplicationWindow { | ||||||
|                 Layout.alignment: Qt.AlignHCenter |                 Layout.alignment: Qt.AlignHCenter | ||||||
|                 text: qsTr("Craft!") |                 text: qsTr("Craft!") | ||||||
| 
 | 
 | ||||||
|                 onClicked: { |                 onClicked: crafter.packChannels([texSlotR.filePath, texSlotG.filePath, texSlotB.filePath]) | ||||||
|                     var outUrl = crafter.packChannels([texSlotR.filePath, texSlotG.filePath, texSlotB.filePath]); |  | ||||||
| 
 |  | ||||||
|                     outSlot.filePath = outUrl; |  | ||||||
|                 } |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  | @ -68,9 +64,9 @@ ApplicationWindow { | ||||||
|             Layout.alignment: Qt.AlignHCenter |             Layout.alignment: Qt.AlignHCenter | ||||||
| 
 | 
 | ||||||
|             TexSlot { |             TexSlot { | ||||||
|                 id: outSlot |  | ||||||
| 
 | 
 | ||||||
|                 rectColor: "gray" | 
 | ||||||
|  |                 rectColor: "green" | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
							
								
								
									
										33
									
								
								TexSlot.qml
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								TexSlot.qml
									
									
									
									
									
								
							|  | @ -11,6 +11,7 @@ DropArea { | ||||||
|     width: 128 |     width: 128 | ||||||
|     height: 128 |     height: 128 | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|     Rectangle { |     Rectangle { | ||||||
|         id: rectangle |         id: rectangle | ||||||
|         anchors.fill: parent |         anchors.fill: parent | ||||||
|  | @ -21,35 +22,10 @@ DropArea { | ||||||
| 
 | 
 | ||||||
|             anchors.centerIn: parent |             anchors.centerIn: parent | ||||||
| 
 | 
 | ||||||
|             source: filePath |  | ||||||
| 
 |  | ||||||
|             width: 96 |             width: 96 | ||||||
|             height: 96 |             height: 96 | ||||||
| 
 | 
 | ||||||
|             MouseArea { |  | ||||||
|                 id: imageMouseArea |  | ||||||
| 
 | 
 | ||||||
|                 anchors.fill: parent |  | ||||||
| 
 |  | ||||||
|                 Drag.dragType: Drag.Automatic |  | ||||||
|                 Drag.supportedActions: Qt.CopyAction |  | ||||||
|                 Drag.mimeData: { |  | ||||||
|                     "text/uri-list": filePath |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 DragHandler { |  | ||||||
|                     id: dragHandler |  | ||||||
|                     onActiveChanged: |  | ||||||
|                         if (active) { |  | ||||||
|                             parent.grabToImage(function(result) { |  | ||||||
|                                 parent.Drag.imageSource = result.url |  | ||||||
|                                 parent.Drag.active = true |  | ||||||
|                             }) |  | ||||||
|                         } else { |  | ||||||
|                             parent.Drag.active = false |  | ||||||
|                         } |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -71,15 +47,12 @@ DropArea { | ||||||
|         console.log(drop.urls); |         console.log(drop.urls); | ||||||
| 
 | 
 | ||||||
|             filePath = drop.urls[0]; |             filePath = drop.urls[0]; | ||||||
| 
 |         huh.text = drop.urls[0]; | ||||||
|  |         image.source = drop.urls[0]; | ||||||
|         } |         } | ||||||
|         rectangle.color = rectColor; |         rectangle.color = rectColor; | ||||||
|     } |     } | ||||||
|     onExited: { |     onExited: { | ||||||
|         rectangle.color = rectColor; |         rectangle.color = rectColor; | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|     onFilePathChanged: { |  | ||||||
|         huh.text = filePath; |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -4,7 +4,7 @@ TextureCrafter::TextureCrafter(QObject *parent) | ||||||
|     : QObject{parent} |     : QObject{parent} | ||||||
| {} | {} | ||||||
| 
 | 
 | ||||||
| QUrl TextureCrafter::packChannels(QVector<QUrl> imagePaths) { | void TextureCrafter::packChannels(QVector<QUrl> imagePaths) { | ||||||
| 
 | 
 | ||||||
|     QVector<QImage> sourceImages; |     QVector<QImage> sourceImages; | ||||||
|     int width = 0, height = 0; |     int width = 0, height = 0; | ||||||
|  | @ -55,7 +55,6 @@ QUrl TextureCrafter::packChannels(QVector<QUrl> imagePaths) { | ||||||
| 	//TODO: use libpng and do progressive write to update the progress bar
 | 	//TODO: use libpng and do progressive write to update the progress bar
 | ||||||
|         if (outImage.save(outFileName)) { |         if (outImage.save(outFileName)) { | ||||||
|             printf("cool ^-^\n"); |             printf("cool ^-^\n"); | ||||||
|             return QUrl::fromLocalFile(outFileName); |  | ||||||
|         } else { |         } else { | ||||||
|             //TODO: return some error value to show the user
 |             //TODO: return some error value to show the user
 | ||||||
|             printf("that dream is fucked it is fucking fucked\n"); |             printf("that dream is fucked it is fucking fucked\n"); | ||||||
|  | @ -64,6 +63,5 @@ QUrl TextureCrafter::packChannels(QVector<QUrl> imagePaths) { | ||||||
|         printf("chat its so over\n"); |         printf("chat its so over\n"); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return QUrl(); |  | ||||||
|     //do we need to close these??? idk lets hope qt handles it
 |     //do we need to close these??? idk lets hope qt handles it
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -13,7 +13,7 @@ class TextureCrafter : public QObject | ||||||
| public: | public: | ||||||
|     explicit TextureCrafter(QObject *parent = nullptr); |     explicit TextureCrafter(QObject *parent = nullptr); | ||||||
| 
 | 
 | ||||||
|     Q_INVOKABLE QUrl packChannels(QVector<QUrl> images); |     Q_INVOKABLE void packChannels(QVector<QUrl> images); | ||||||
| 
 | 
 | ||||||
| signals: | signals: | ||||||
| private: | private: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue