Commit Dialog: Pressing Ctrl-Enter within the comment box starts the commit whereas pressing Escape aborts it
FossilOrigin-Name: 6e3077fa1905ed6a669038d3336ae4f98fd483ee
This commit is contained in:
		| @@ -1,14 +1,16 @@ | |||||||
| Fuel V0.9.7 (2012-XX-XX) | Fuel V0.9.7 (2012-XX-XX) | ||||||
| ============ | ============ | ||||||
| - Distribution: Fuel is now available in the Arch User Repository |  | ||||||
| - Feature: Optionally use the internal browser for the Fossil UI | - Feature: Optionally use the internal browser for the Fossil UI | ||||||
| - UI: Support for persisting the state (Column order and sizes) of the File View  | - Feature: Support for persisting the state (Column order and sizes) of the File View | ||||||
| - UI: Dropping a fossil workspace file or folder on Fuel now opens that workspace | - Feature: Dropping a fossil checkout file or workspace folder on Fuel now opens that workspace | ||||||
|  | - Feature: Commit Dialog: Pressing Ctrl-Enter within the comment box starts the commit | ||||||
|  |   whereas pressing Escape aborts it | ||||||
| - Feature: Support for localization | - Feature: Support for localization | ||||||
| - Localisations: | - Localisations: | ||||||
| 	Greek | 	Greek | ||||||
| 	German (thanks stayawake) | 	German (Thanks stayawake) | ||||||
| 	Spanish (thanks djnavas) | 	Spanish (Thanks djnavas) | ||||||
|  | - Distribution: Fuel is now available in the Arch User Repository | ||||||
|  |  | ||||||
| Fuel V0.9.6 (2012-05-13) | Fuel V0.9.6 (2012-05-13) | ||||||
| ============ | ============ | ||||||
| @@ -27,4 +29,3 @@ Fuel V0.9.6 (2012-05-13) | |||||||
| - Bug Fix: Fixed issue where a complete repository would be committed even when | - Bug Fix: Fixed issue where a complete repository would be committed even when | ||||||
|   the user has a specific set of files marked for commit |   the user has a specific set of files marked for commit | ||||||
| - Misc: Minor GUI bug fixes and usability enhancements | - Misc: Minor GUI bug fixes and usability enhancements | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								manifest
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								manifest
									
									
									
									
									
								
							| @@ -1,9 +1,9 @@ | |||||||
| C Dropping\sa\sfossil\sworkspace\sfile\sor\sfolder\son\sFuel\snow\sopens\sthat\sworkspace\nRefactored\ssome\slocalizations | C Commit\sDialog:\sPressing\sCtrl-Enter\swithin\sthe\scomment\sbox\sstarts\sthe\scommit\swhereas\spressing\sEscape\saborts\sit | ||||||
| D 2012-12-15T15:37:11.939 | D 2012-12-15T16:13:02.050 | ||||||
| F dist/arch/PKGBUILD dd21073c035af4e6a4ecb3842c1fd7ae45c5e93d | F dist/arch/PKGBUILD dd21073c035af4e6a4ecb3842c1fd7ae45c5e93d | ||||||
| F dist/win/fuel.iss ef3558dbba409eb194938b930377fc9ee27d319e | F dist/win/fuel.iss ef3558dbba409eb194938b930377fc9ee27d319e | ||||||
| F doc/Building.txt 7c0f1060d4a08ed330058d4a3a68905c05228381 | F doc/Building.txt 7c0f1060d4a08ed330058d4a3a68905c05228381 | ||||||
| F doc/Changes.txt a77f20af09130f7e7da9fdeb3ee5fc0252d6005e | F doc/Changes.txt b4494e409960f22705c8624eaa935e3f195df10b | ||||||
| F doc/License.txt 4cc77b90af91e615a64ae04893fdffa7939db84c | F doc/License.txt 4cc77b90af91e615a64ae04893fdffa7939db84c | ||||||
| F fuel.pro f2bda42ff7c3258dce38e679107687b16007f5a0 | F fuel.pro f2bda42ff7c3258dce38e679107687b16007f5a0 | ||||||
| F intl/convert.sh 5694496585ff5f4363c90ff8b6f48e19e0b6b4aa x | F intl/convert.sh 5694496585ff5f4363c90ff8b6f48e19e0b6b4aa x | ||||||
| @@ -172,7 +172,7 @@ F rsrc/icons/fuel.png 40daf53b7f6bdcdd0d6aa5ef433d078ec5ea4342 | |||||||
| F rsrc/resources.qrc 64f1e9ab75d3631ad65fac5c0653839e0cdda979 | F rsrc/resources.qrc 64f1e9ab75d3631ad65fac5c0653839e0cdda979 | ||||||
| F src/CloneDialog.cpp 8652480baa3f13f0f0e7df019751338c7cbeb1b5 | F src/CloneDialog.cpp 8652480baa3f13f0f0e7df019751338c7cbeb1b5 | ||||||
| F src/CloneDialog.h c97e8c266819292622ca3e84b68e04e81ec05ba3 | F src/CloneDialog.h c97e8c266819292622ca3e84b68e04e81ec05ba3 | ||||||
| F src/CommitDialog.cpp c62ce7fb234e43ca8641c16522c750e6419bf947 | F src/CommitDialog.cpp 5300522ac11bc1096a11a6ce22f8c1665d4afc05 | ||||||
| F src/CommitDialog.h f1ee8db92103164e7db55a8407ccdcff24571b72 | F src/CommitDialog.h f1ee8db92103164e7db55a8407ccdcff24571b72 | ||||||
| F src/FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8 | F src/FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8 | ||||||
| F src/FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce | F src/FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce | ||||||
| @@ -193,7 +193,7 @@ F ui/CommitDialog.ui 6200f6cabdcf40a20812e811be28e0793f82516f | |||||||
| F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d | F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d | ||||||
| F ui/MainWindow.ui 23e4827461cf91218c22c65e44d8aa32d04313f7 | F ui/MainWindow.ui 23e4827461cf91218c22c65e44d8aa32d04313f7 | ||||||
| F ui/SettingsDialog.ui 55aefad7145c40d936c43759789d1b50e361b020 | F ui/SettingsDialog.ui 55aefad7145c40d936c43759789d1b50e361b020 | ||||||
| P 007750beaa643fdb136db346a647f43c0d14a30e | P 0d190dea85179af6c22225f5d443fd363d4d8842 | ||||||
| R 4912490d8f6d2fe0469bcbef6ae2df32 | R fd82f4f216d2b75f27c3718e2e80f568 | ||||||
| U kostas | U kostas | ||||||
| Z 724b932c55f6478883d57feb84372293 | Z 7422a8dc912ecd62dea48b68e5b12f36 | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| 0d190dea85179af6c22225f5d443fd363d4d8842 | 6e3077fa1905ed6a669038d3336ae4f98fd483ee | ||||||
| @@ -1,130 +1,144 @@ | |||||||
| #include "CommitDialog.h" | #include "CommitDialog.h" | ||||||
| #include <QPushButton> | #include <QPushButton> | ||||||
| #include "ui_CommitDialog.h" | #include <QShortcut> | ||||||
| #include "MainWindow.h" // Ugly. I know. | #include "ui_CommitDialog.h" | ||||||
|  | #include "MainWindow.h" // Ugly. I know. | ||||||
| CommitDialog::CommitDialog(QWidget *parent, QString title, QStringList &files, const QStringList *history, bool singleLineEntry, const QString *checkBoxText, bool *checkBoxValue) : |  | ||||||
| 	QDialog(parent, Qt::Sheet), | CommitDialog::CommitDialog(QWidget *parent, QString title, QStringList &files, const QStringList *history, bool singleLineEntry, const QString *checkBoxText, bool *checkBoxValue) : | ||||||
|     ui(new Ui::CommitDialog) | 	QDialog(parent, Qt::Sheet), | ||||||
| { | 	ui(new Ui::CommitDialog) | ||||||
| 	ui->setupUi(this); | { | ||||||
| 	ui->plainTextEdit->clear(); | 	ui->setupUi(this); | ||||||
| 	ui->listView->setModel(&itemModel); | 	ui->plainTextEdit->clear(); | ||||||
|  | 	ui->listView->setModel(&itemModel); | ||||||
| 	setWindowTitle(title); |  | ||||||
|  | 	setWindowTitle(title); | ||||||
| 	// Activate the appropriate control based on mode |  | ||||||
| 	ui->plainTextEdit->setVisible(!singleLineEntry); | 	// Activate the appropriate control based on mode | ||||||
| 	ui->lineEdit->setVisible(singleLineEntry); | 	ui->plainTextEdit->setVisible(!singleLineEntry); | ||||||
|  | 	ui->lineEdit->setVisible(singleLineEntry); | ||||||
| 	// Activate the checkbox if we have some text |  | ||||||
| 	ui->checkBox->setVisible(checkBoxText!=0); | 	// Activate the checkbox if we have some text | ||||||
| 	if(checkBoxText && checkBoxValue) | 	ui->checkBox->setVisible(checkBoxText!=0); | ||||||
| 	{ | 	if(checkBoxText && checkBoxValue) | ||||||
| 		ui->checkBox->setText(*checkBoxText); | 	{ | ||||||
| 		ui->checkBox->setCheckState(*checkBoxValue ? Qt::Checked : Qt::Unchecked); | 		ui->checkBox->setText(*checkBoxText); | ||||||
| 	} | 		ui->checkBox->setCheckState(*checkBoxValue ? Qt::Checked : Qt::Unchecked); | ||||||
|  | 	} | ||||||
| 	// Activate the combo if we have history |  | ||||||
| 	ui->comboBox->setVisible(history!=0); | 	// Activate the combo if we have history | ||||||
| 	if(history) | 	ui->comboBox->setVisible(history!=0); | ||||||
| 	{ | 	if(history) | ||||||
| 		// Generate the history combo | 	{ | ||||||
| 		foreach(const QString msg, *history) | 		// Generate the history combo | ||||||
| 		{ | 		foreach(const QString msg, *history) | ||||||
| 			QString trimmed = msg.trimmed(); | 		{ | ||||||
| 			if(trimmed.isEmpty()) | 			QString trimmed = msg.trimmed(); | ||||||
| 				continue; | 			if(trimmed.isEmpty()) | ||||||
|  | 				continue; | ||||||
| 			commitMessages.append(trimmed); |  | ||||||
| 			QStringList lines = trimmed.split('\n'); | 			commitMessages.append(trimmed); | ||||||
| 			QString first_line; | 			QStringList lines = trimmed.split('\n'); | ||||||
| 			if(!lines.empty()) | 			QString first_line; | ||||||
| 				first_line = lines[0] + "..."; | 			if(!lines.empty()) | ||||||
|  | 				first_line = lines[0] + "..."; | ||||||
| 			ui->comboBox->addItem(first_line); |  | ||||||
| 		} | 			ui->comboBox->addItem(first_line); | ||||||
| 	} | 		} | ||||||
|  | 	} | ||||||
| 	// Populate file list |  | ||||||
| 	for(QStringList::const_iterator it=files.begin(); it!=files.end(); ++it) | 	// Populate file list | ||||||
| 	{ | 	for(QStringList::const_iterator it=files.begin(); it!=files.end(); ++it) | ||||||
| 		QStandardItem *si = new QStandardItem(*it); | 	{ | ||||||
| 		si->setCheckable(true); | 		QStandardItem *si = new QStandardItem(*it); | ||||||
| 		si->setCheckState(Qt::Checked); | 		si->setCheckable(true); | ||||||
| 		itemModel.appendRow(si); | 		si->setCheckState(Qt::Checked); | ||||||
| 	} | 		itemModel.appendRow(si); | ||||||
| } | 	} | ||||||
|  |  | ||||||
| //------------------------------------------------------------------------------ |  | ||||||
| CommitDialog::~CommitDialog() | 	// Trigger commit with a Ctrl-Return from the comment box | ||||||
| { | 	QAction* action = new QAction(ui->plainTextEdit); | ||||||
| 	delete ui; | 	QShortcut* shortcut = new QShortcut(QKeySequence("Ctrl+Return"), ui->plainTextEdit); | ||||||
| } | 	action->setAutoRepeat(false); | ||||||
|  | 	connect(shortcut, SIGNAL(activated()), ui->buttonBox->button(QDialogButtonBox::Ok), SLOT(click())); | ||||||
| //------------------------------------------------------------------------------ |  | ||||||
| bool CommitDialog::run(QWidget *parent, QString title, QStringList &files, QString &commitMsg, const QStringList *history, bool singleLineEntry, const QString *checkBoxText, bool *checkBoxValue) | 	// Abort commit with an Escape key from the comment box | ||||||
| { | 	action = new QAction(ui->plainTextEdit); | ||||||
| 	CommitDialog dlg(parent, title, files, history, singleLineEntry, checkBoxText, checkBoxValue); | 	shortcut = new QShortcut(QKeySequence("Escape"), ui->plainTextEdit); | ||||||
| 	int res = dlg.exec(); | 	action->setAutoRepeat(false); | ||||||
|  | 	connect(shortcut, SIGNAL(activated()), ui->buttonBox->button(QDialogButtonBox::Cancel), SLOT(click())); | ||||||
| 	if(singleLineEntry) | } | ||||||
| 		commitMsg = dlg.ui->lineEdit->text(); |  | ||||||
| 	else | //------------------------------------------------------------------------------ | ||||||
| 		commitMsg = dlg.ui->plainTextEdit->toPlainText(); | CommitDialog::~CommitDialog() | ||||||
|  | { | ||||||
|  | 	delete ui; | ||||||
| 	if(res!=QDialog::Accepted) | } | ||||||
| 		return false; |  | ||||||
|  | //------------------------------------------------------------------------------ | ||||||
| 	files.clear(); | bool CommitDialog::run(QWidget *parent, QString title, QStringList &files, QString &commitMsg, const QStringList *history, bool singleLineEntry, const QString *checkBoxText, bool *checkBoxValue) | ||||||
| 	for(int i=0; i<dlg.itemModel.rowCount(); ++i) | { | ||||||
| 	{ | 	CommitDialog dlg(parent, title, files, history, singleLineEntry, checkBoxText, checkBoxValue); | ||||||
| 		QStandardItem *si = dlg.itemModel.item(i); | 	int res = dlg.exec(); | ||||||
| 		if(si->checkState()!=Qt::Checked) |  | ||||||
| 			continue; | 	if(singleLineEntry) | ||||||
| 		files.append(si->text()); | 		commitMsg = dlg.ui->lineEdit->text(); | ||||||
| 	} | 	else | ||||||
|  | 		commitMsg = dlg.ui->plainTextEdit->toPlainText(); | ||||||
| 	if(checkBoxText) |  | ||||||
| 	{ |  | ||||||
| 		Q_ASSERT(checkBoxValue); | 	if(res!=QDialog::Accepted) | ||||||
| 		*checkBoxValue = dlg.ui->checkBox->checkState() == Qt::Checked; | 		return false; | ||||||
| 	} |  | ||||||
|  | 	files.clear(); | ||||||
| 	return true; | 	for(int i=0; i<dlg.itemModel.rowCount(); ++i) | ||||||
| } | 	{ | ||||||
|  | 		QStandardItem *si = dlg.itemModel.item(i); | ||||||
| //------------------------------------------------------------------------------ | 		if(si->checkState()!=Qt::Checked) | ||||||
| void CommitDialog::on_comboBox_activated(int index) | 			continue; | ||||||
| { | 		files.append(si->text()); | ||||||
| 	Q_ASSERT(index < commitMessages.length()); | 	} | ||||||
|  |  | ||||||
| 	if(ui->plainTextEdit->isVisible()) | 	if(checkBoxText) | ||||||
| 		ui->plainTextEdit->setPlainText(commitMessages[index]); | 	{ | ||||||
|  | 		Q_ASSERT(checkBoxValue); | ||||||
| 	if(ui->lineEdit->isVisible()) | 		*checkBoxValue = dlg.ui->checkBox->checkState() == Qt::Checked; | ||||||
| 		ui->lineEdit->setText(commitMessages[index]); | 	} | ||||||
| } |  | ||||||
|  | 	return true; | ||||||
| //------------------------------------------------------------------------------ | } | ||||||
| void CommitDialog::on_listView_doubleClicked(const QModelIndex &index) |  | ||||||
| { | //------------------------------------------------------------------------------ | ||||||
| 	QVariant data = itemModel.data(index); | void CommitDialog::on_comboBox_activated(int index) | ||||||
| 	QString filename = data.toString(); | { | ||||||
| 	reinterpret_cast<MainWindow*>(parent())->diffFile(filename); | 	Q_ASSERT(index < commitMessages.length()); | ||||||
| } |  | ||||||
|  | 	if(ui->plainTextEdit->isVisible()) | ||||||
| //------------------------------------------------------------------------------ | 		ui->plainTextEdit->setPlainText(commitMessages[index]); | ||||||
| void CommitDialog::on_listView_clicked(const QModelIndex &) |  | ||||||
| { | 	if(ui->lineEdit->isVisible()) | ||||||
| 	int num_selected = 0; | 		ui->lineEdit->setText(commitMessages[index]); | ||||||
| 	for(int i=0; i<itemModel.rowCount(); ++i) | } | ||||||
| 	{ |  | ||||||
| 		QStandardItem *si = itemModel.item(i); | //------------------------------------------------------------------------------ | ||||||
| 		if(si->checkState()==Qt::Checked) | void CommitDialog::on_listView_doubleClicked(const QModelIndex &index) | ||||||
| 			++num_selected; | { | ||||||
| 	} | 	QVariant data = itemModel.data(index); | ||||||
|  | 	QString filename = data.toString(); | ||||||
| 	ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(num_selected>0); | 	reinterpret_cast<MainWindow*>(parent())->diffFile(filename); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | //------------------------------------------------------------------------------ | ||||||
|  | void CommitDialog::on_listView_clicked(const QModelIndex &) | ||||||
|  | { | ||||||
|  | 	int num_selected = 0; | ||||||
|  | 	for(int i=0; i<itemModel.rowCount(); ++i) | ||||||
|  | 	{ | ||||||
|  | 		QStandardItem *si = itemModel.item(i); | ||||||
|  | 		if(si->checkState()==Qt::Checked) | ||||||
|  | 			++num_selected; | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(num_selected>0); | ||||||
|  | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user