Added support for dragging files from the file list
Upped version to 0.9.6 FossilOrigin-Name: a5a77363fdcadd2bea991228289a87fa73a98fb9
This commit is contained in:
		
							
								
								
									
										33
									
								
								FileTableView.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								FileTableView.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | |||||||
|  | #include "FileTableView.h" | ||||||
|  | #include <QMouseEvent> | ||||||
|  | //#include <QMimeData> | ||||||
|  | #include <QApplication> | ||||||
|  | //#include <QUrl> | ||||||
|  |  | ||||||
|  | FileTableView::FileTableView(QWidget *parent) : | ||||||
|  | 	QTableView(parent) | ||||||
|  | { | ||||||
|  | } | ||||||
|  |  | ||||||
|  | //------------------------------------------------------------------------------ | ||||||
|  | void FileTableView::mousePressEvent(QMouseEvent *event) | ||||||
|  | { | ||||||
|  | 	if (event->button() == Qt::LeftButton) | ||||||
|  | 		dragStartPos = event->pos(); | ||||||
|  |  | ||||||
|  | 	QTableView::mousePressEvent(event); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | //------------------------------------------------------------------------------ | ||||||
|  | void FileTableView::mouseMoveEvent(QMouseEvent *event) | ||||||
|  | { | ||||||
|  | 	int distance = (event->pos() - dragStartPos).manhattanLength(); | ||||||
|  | 	if (event->buttons() & Qt::LeftButton && distance >= QApplication::startDragDistance()) | ||||||
|  | 	{ | ||||||
|  | 		dragOutEvent(); | ||||||
|  | 		QTableView::mouseReleaseEvent(event); | ||||||
|  | 	} | ||||||
|  | 	else | ||||||
|  | 		QTableView::mouseMoveEvent(event); | ||||||
|  |  | ||||||
|  | } | ||||||
							
								
								
									
										24
									
								
								FileTableView.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								FileTableView.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | |||||||
|  | #ifndef FILETABLEVIEW_H | ||||||
|  | #define FILETABLEVIEW_H | ||||||
|  |  | ||||||
|  | #include <QTableView> | ||||||
|  | #include <QPoint> | ||||||
|  |  | ||||||
|  | class FileTableView : public QTableView | ||||||
|  | { | ||||||
|  | 	Q_OBJECT | ||||||
|  | public: | ||||||
|  | 	explicit FileTableView(QWidget *parent = 0); | ||||||
|  | 	 | ||||||
|  | signals: | ||||||
|  | 	void dragOutEvent(); | ||||||
|  |  | ||||||
|  | private: | ||||||
|  | 	void mousePressEvent(QMouseEvent *event); | ||||||
|  | 	void mouseMoveEvent(QMouseEvent *event); | ||||||
|  |  | ||||||
|  | private: | ||||||
|  | 	QPoint				dragStartPos; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | #endif // FILETABLEVIEW_H | ||||||
| @@ -11,6 +11,8 @@ | |||||||
| #include <QMessageBox> | #include <QMessageBox> | ||||||
| #include <QUrl> | #include <QUrl> | ||||||
| #include <QInputDialog> | #include <QInputDialog> | ||||||
|  | #include <QDrag> | ||||||
|  | #include <QMimeData> | ||||||
| #include "CommitDialog.h" | #include "CommitDialog.h" | ||||||
| #include "FileActionDialog.h" | #include "FileActionDialog.h" | ||||||
| #include <QDebug> | #include <QDebug> | ||||||
| @@ -107,6 +109,11 @@ MainWindow::MainWindow(QWidget *parent) : | |||||||
| 	ui->tableView->addAction(ui->actionRevert); | 	ui->tableView->addAction(ui->actionRevert); | ||||||
| 	ui->tableView->addAction(ui->actionRename); | 	ui->tableView->addAction(ui->actionRename); | ||||||
| 	ui->tableView->addAction(ui->actionDelete); | 	ui->tableView->addAction(ui->actionDelete); | ||||||
|  | 	connect( ui->tableView, | ||||||
|  | 		SIGNAL( dragOutEvent() ), | ||||||
|  | 		SLOT( on_fileView_dragOut() ), | ||||||
|  | 		Qt::DirectConnection ); | ||||||
|  |  | ||||||
|  |  | ||||||
| 	// TreeView | 	// TreeView | ||||||
| 	ui->treeView->setModel(&repoDirModel); | 	ui->treeView->setModel(&repoDirModel); | ||||||
| @@ -2280,3 +2287,25 @@ void MainWindow::on_actionDiffStash_triggered() | |||||||
| 	// Run diff | 	// Run diff | ||||||
| 	runFossil(QStringList() << "stash" << "diff" << *id_it, 0); | 	runFossil(QStringList() << "stash" << "diff" << *id_it, 0); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | //------------------------------------------------------------------------------ | ||||||
|  | void MainWindow::on_fileView_dragOut() | ||||||
|  | { | ||||||
|  | 	QStringList filenames; | ||||||
|  | 	getFileViewSelection(filenames); | ||||||
|  | 	QString uris; | ||||||
|  |  | ||||||
|  | 	// text/uri-list is a new-line separate list of uris | ||||||
|  | 	foreach(QString f, filenames) | ||||||
|  | 	{ | ||||||
|  | 		uris += QUrl::fromLocalFile(getCurrentWorkspace()+QDir::separator()+f).toString() + '\n'; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	QMimeData *mime_data = new QMimeData; | ||||||
|  | 	mime_data->setData("text/uri-list", uris.toUtf8()); | ||||||
|  |  | ||||||
|  | 	QDrag drag(this); | ||||||
|  | 	drag.setMimeData(mime_data); | ||||||
|  | 	drag.exec(Qt::CopyAction); | ||||||
|  | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -184,6 +184,7 @@ private slots: | |||||||
| 	// Manual slots | 	// Manual slots | ||||||
| 	void on_openRecent(); | 	void on_openRecent(); | ||||||
| 	void on_treeView_selectionChanged(const class QItemSelection &selected, const class QItemSelection &deselected); | 	void on_treeView_selectionChanged(const class QItemSelection &selected, const class QItemSelection &deselected); | ||||||
|  | 	void on_fileView_dragOut(); | ||||||
|  |  | ||||||
| 	// Designer slots | 	// Designer slots | ||||||
| 	void on_actionRefresh_triggered(); | 	void on_actionRefresh_triggered(); | ||||||
|   | |||||||
| @@ -69,7 +69,7 @@ | |||||||
|          <bool>false</bool> |          <bool>false</bool> | ||||||
|         </attribute> |         </attribute> | ||||||
|        </widget> |        </widget> | ||||||
|        <widget class="QTableView" name="tableView"> |        <widget class="FileTableView" name="tableView"> | ||||||
|         <property name="sizePolicy"> |         <property name="sizePolicy"> | ||||||
|          <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> |          <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> | ||||||
|           <horstretch>80</horstretch> |           <horstretch>80</horstretch> | ||||||
| @@ -822,6 +822,13 @@ | |||||||
|   </action> |   </action> | ||||||
|  </widget> |  </widget> | ||||||
|  <layoutdefault spacing="6" margin="11"/> |  <layoutdefault spacing="6" margin="11"/> | ||||||
|  |  <customwidgets> | ||||||
|  |   <customwidget> | ||||||
|  |    <class>FileTableView</class> | ||||||
|  |    <extends>QTableView</extends> | ||||||
|  |    <header>FileTableView.h</header> | ||||||
|  |   </customwidget> | ||||||
|  |  </customwidgets> | ||||||
|  <resources> |  <resources> | ||||||
|   <include location="resources.qrc"/> |   <include location="resources.qrc"/> | ||||||
|  </resources> |  </resources> | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								fuel.pro
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								fuel.pro
									
									
									
									
									
								
							| @@ -20,13 +20,15 @@ SOURCES += main.cpp\ | |||||||
|     CommitDialog.cpp \ |     CommitDialog.cpp \ | ||||||
|     FileActionDialog.cpp \ |     FileActionDialog.cpp \ | ||||||
|     SettingsDialog.cpp \ |     SettingsDialog.cpp \ | ||||||
|     Utils.cpp |     Utils.cpp \ | ||||||
|  |     FileTableView.cpp | ||||||
|  |  | ||||||
| HEADERS  += MainWindow.h \ | HEADERS  += MainWindow.h \ | ||||||
|     CommitDialog.h \ |     CommitDialog.h \ | ||||||
|     FileActionDialog.h \ |     FileActionDialog.h \ | ||||||
|     SettingsDialog.h \ |     SettingsDialog.h \ | ||||||
|     Utils.h |     Utils.h \ | ||||||
|  |     FileTableView.h | ||||||
|  |  | ||||||
| FORMS    += MainWindow.ui \ | FORMS    += MainWindow.ui \ | ||||||
|     CommitDialog.ui \ |     CommitDialog.ui \ | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								main.cpp
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								main.cpp
									
									
									
									
									
								
							| @@ -5,9 +5,9 @@ int main(int argc, char *argv[]) | |||||||
| { | { | ||||||
|     QApplication a(argc, argv); |     QApplication a(argc, argv); | ||||||
| 	a.setApplicationName("Fuel"); | 	a.setApplicationName("Fuel"); | ||||||
| 	a.setApplicationVersion("0.9.5"); | 	a.setApplicationVersion("0.9.6"); | ||||||
| 	a.setOrganizationDomain("karanik.com"); | 	a.setOrganizationDomain("fuel-scm.org"); | ||||||
| 	a.setOrganizationName("Karanik"); | 	a.setOrganizationName("fuel-scm"); | ||||||
|  |  | ||||||
| 	// Native OSX applications don't use menu icons | 	// Native OSX applications don't use menu icons | ||||||
| 	#ifdef Q_WS_MACX | 	#ifdef Q_WS_MACX | ||||||
|   | |||||||
							
								
								
									
										22
									
								
								manifest
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								manifest
									
									
									
									
									
								
							| @@ -1,20 +1,22 @@ | |||||||
| C Added\ssupport\sfor\sstashes\nGeneralized\sthe\scommit\sdialog\sto\ssupport\sstashes\nParameters\sare\snow\squoted\sin\sthe\slog\sif\snecessary\nFixed\sanother\sissue\swith\sthe\sfolderview\sshow/hide\slogic\nVarious\sminor\sui\stweaks | C Added\ssupport\sfor\sdragging\sfiles\sfrom\sthe\sfile\slist\nUpped\sversion\sto\s0.9.6\n | ||||||
| D 2012-04-15T06:56:51.575 | D 2012-04-15T09:08:58.949 | ||||||
| F CommitDialog.cpp a46020a9361151d8d286a2670257d01d8967bf69 | F CommitDialog.cpp a46020a9361151d8d286a2670257d01d8967bf69 | ||||||
| F CommitDialog.h f1ee8db92103164e7db55a8407ccdcff24571b72 | F CommitDialog.h f1ee8db92103164e7db55a8407ccdcff24571b72 | ||||||
| F CommitDialog.ui 813d7cba316e226de1a22b7e480bb969fbe9b0c4 | F CommitDialog.ui 813d7cba316e226de1a22b7e480bb969fbe9b0c4 | ||||||
| F FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8 | F FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8 | ||||||
| F FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce | F FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce | ||||||
| F FileActionDialog.ui c63644428579741aeb5fa052e237ba799ced9ad7 | F FileActionDialog.ui c63644428579741aeb5fa052e237ba799ced9ad7 | ||||||
| F MainWindow.cpp 36e0fa67dbae7db5612d00e28267a2f8240353d0 | F FileTableView.cpp 04b793f93b47717cc482dd684ee2b4976e1340fc | ||||||
| F MainWindow.h 552f6bd4061ae15be90e52402bcde6a8d7fbb7ad | F FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df | ||||||
| F MainWindow.ui b96e3126e2966f8fdeda1dd063efbbc731c7338e | F MainWindow.cpp 6b8caf49d9c0f4e9768fd5c860a92cae638bb353 | ||||||
|  | F MainWindow.h 987fa4ae0604373778184501f4f71f07ac614a16 | ||||||
|  | F MainWindow.ui 726175dba24957cdf9884326c3948dffe01a4a3d | ||||||
| F SettingsDialog.cpp e1fad18cc020d08b82c6d35dc94f6624deec9a3b | F SettingsDialog.cpp e1fad18cc020d08b82c6d35dc94f6624deec9a3b | ||||||
| F SettingsDialog.h f5da6cab4ccc82e2eb78ec835fb849c4c104d6cc | F SettingsDialog.h f5da6cab4ccc82e2eb78ec835fb849c4c104d6cc | ||||||
| F SettingsDialog.ui 8964629ea80c61971c0601624c84d1927902b1fd | F SettingsDialog.ui 8964629ea80c61971c0601624c84d1927902b1fd | ||||||
| F Utils.cpp 2587d8073d6c2c1da49622c387cc457a0081f7b5 | F Utils.cpp 2587d8073d6c2c1da49622c387cc457a0081f7b5 | ||||||
| F Utils.h a71d82474747466f4c225128d26a703b510230d4 | F Utils.h a71d82474747466f4c225128d26a703b510230d4 | ||||||
| F fuel.pro 3dc8e31fde8137143dea0ae44a81eb6733d86168 | F fuel.pro 880b013acb1136d97c7414372c4e58053cfb153d | ||||||
| F fuel.rc 8e9ac966f283102c11a77cd7f936cdc09e09bd79 | F fuel.rc 8e9ac966f283102c11a77cd7f936cdc09e09bd79 | ||||||
| F icons/Address\sBook-01.png ef2cec80ea5a559b72e8be4a344a1869fe69cbd8 | F icons/Address\sBook-01.png ef2cec80ea5a559b72e8be4a344a1869fe69cbd8 | ||||||
| F icons/Adobe\sIllustrator\sCS3\sDocument-01.png 2e44e933d58eefee7ccfa1650fed4ceadcf3c2be | F icons/Adobe\sIllustrator\sCS3\sDocument-01.png 2e44e933d58eefee7ccfa1650fed4ceadcf3c2be | ||||||
| @@ -172,9 +174,9 @@ F icons/fuel.icns 81e535004b62db801a02f3e15d0a33afc9d4070b | |||||||
| F icons/fuel.ico eb529ab3332a17b9302ef3e851db5b9ebce2a038 | F icons/fuel.ico eb529ab3332a17b9302ef3e851db5b9ebce2a038 | ||||||
| F installer/fuel.iss 13b6a938bcdf273cbd3649d2549887baa1577214 | F installer/fuel.iss 13b6a938bcdf273cbd3649d2549887baa1577214 | ||||||
| F installer/license.txt 4cc77b90af91e615a64ae04893fdffa7939db84c | F installer/license.txt 4cc77b90af91e615a64ae04893fdffa7939db84c | ||||||
| F main.cpp 46bf5ddc90fca01c9ef2e8e3d14b4d32217945dd | F main.cpp 581c2b64cb8ed88aabcdd6b6482d28f3f3935232 | ||||||
| F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53 | F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53 | ||||||
| P d0520ae5050524145697206927a579823b8920d0 | P ce70efe67a1fe0087cc6d3aa79757a5011c57db2 | ||||||
| R b055358a254079018cada6a15162fbb7 | R 3ef0842f9e81c70e0425f1d683d72d06 | ||||||
| U kostas | U kostas | ||||||
| Z c15f935758986542ce2828f4282ddc7a | Z 843fc316a0eadf4fed3bcf121554dcb2 | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| ce70efe67a1fe0087cc6d3aa79757a5011c57db2 | a5a77363fdcadd2bea991228289a87fa73a98fb9 | ||||||
		Reference in New Issue
	
	Block a user