Added support for stashes
Generalized the commit dialog to support stashes Parameters are now quoted in the log if necessary Fixed another issue with the folderview show/hide logic Various minor ui tweaks FossilOrigin-Name: ce70efe67a1fe0087cc6d3aa79757a5011c57db2
This commit is contained in:
		| @@ -3,7 +3,7 @@ | ||||
| #include "ui_CommitDialog.h" | ||||
| #include "MainWindow.h" // Ugly. I know. | ||||
|  | ||||
| CommitDialog::CommitDialog(QWidget *parent, const QStringList &commitMsgHistory, QStringList &files) : | ||||
| CommitDialog::CommitDialog(QWidget *parent, QString title, QStringList &files, const QStringList *history, bool singleLineEntry, const QString *checkBoxText, bool *checkBoxValue) : | ||||
| 	QDialog(parent, Qt::Sheet), | ||||
|     ui(new Ui::CommitDialog) | ||||
| { | ||||
| @@ -11,8 +11,27 @@ CommitDialog::CommitDialog(QWidget *parent, const QStringList &commitMsgHistory, | ||||
| 	ui->plainTextEdit->clear(); | ||||
| 	ui->listView->setModel(&itemModel); | ||||
|  | ||||
| 	setWindowTitle(title); | ||||
|  | ||||
| 	// Activate the appropriate control based on mode | ||||
| 	ui->plainTextEdit->setVisible(!singleLineEntry); | ||||
| 	ui->lineEdit->setVisible(singleLineEntry); | ||||
|  | ||||
| 	// Activate the checkbox if we have some text | ||||
| 	ui->checkBox->setVisible(checkBoxText!=0); | ||||
| 	if(checkBoxText) | ||||
| 	{ | ||||
| 		Q_ASSERT(checkBoxValue); | ||||
| 		ui->checkBox->setText(*checkBoxText); | ||||
| 		ui->checkBox->setCheckState(*checkBoxValue ? Qt::Checked : Qt::Unchecked); | ||||
| 	} | ||||
|  | ||||
| 	// Activate the combo if we have history | ||||
| 	ui->comboBox->setVisible(history!=0); | ||||
| 	if(history) | ||||
| 	{ | ||||
| 		// Generate the history combo | ||||
| 	foreach(const QString msg, commitMsgHistory) | ||||
| 		foreach(const QString msg, *history) | ||||
| 		{ | ||||
| 			QString trimmed = msg.trimmed(); | ||||
| 			if(trimmed.isEmpty()) | ||||
| @@ -26,6 +45,7 @@ CommitDialog::CommitDialog(QWidget *parent, const QStringList &commitMsgHistory, | ||||
|  | ||||
| 			ui->comboBox->addItem(first_line); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// Populate file list | ||||
| 	for(QStringList::const_iterator it=files.begin(); it!=files.end(); ++it) | ||||
| @@ -44,12 +64,17 @@ CommitDialog::~CommitDialog() | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| bool CommitDialog::run(QWidget *parent, QString &commitMsg, const QStringList &commitMsgHistory, QStringList &files) | ||||
| bool CommitDialog::run(QWidget *parent, QString title, QStringList &files, QString &commitMsg, const QStringList *history, bool singleLineEntry, const QString *checkBoxText, bool *checkBoxValue) | ||||
| { | ||||
| 	CommitDialog dlg(parent, commitMsgHistory, files); | ||||
| 	CommitDialog dlg(parent, title, files, history, singleLineEntry, checkBoxText, checkBoxValue); | ||||
| 	int res = dlg.exec(); | ||||
|  | ||||
| 	if(singleLineEntry) | ||||
| 		commitMsg = dlg.ui->lineEdit->text(); | ||||
| 	else | ||||
| 		commitMsg = dlg.ui->plainTextEdit->toPlainText(); | ||||
|  | ||||
|  | ||||
| 	if(res!=QDialog::Accepted) | ||||
| 		return false; | ||||
|  | ||||
| @@ -62,6 +87,12 @@ bool CommitDialog::run(QWidget *parent, QString &commitMsg, const QStringList &c | ||||
| 		files.append(si->text()); | ||||
| 	} | ||||
|  | ||||
| 	if(checkBoxText) | ||||
| 	{ | ||||
| 		Q_ASSERT(checkBoxValue); | ||||
| 		*checkBoxValue = dlg.ui->checkBox->checkState() == Qt::Checked; | ||||
| 	} | ||||
|  | ||||
| 	return true; | ||||
| } | ||||
|  | ||||
| @@ -69,7 +100,12 @@ bool CommitDialog::run(QWidget *parent, QString &commitMsg, const QStringList &c | ||||
| void CommitDialog::on_comboBox_activated(int index) | ||||
| { | ||||
| 	Q_ASSERT(index < commitMessages.length()); | ||||
|  | ||||
| 	if(ui->plainTextEdit->isVisible()) | ||||
| 		ui->plainTextEdit->setPlainText(commitMessages[index]); | ||||
|  | ||||
| 	if(ui->lineEdit->isVisible()) | ||||
| 		ui->lineEdit->setText(commitMessages[index]); | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
|   | ||||
| @@ -13,10 +13,10 @@ class CommitDialog : public QDialog | ||||
|     Q_OBJECT | ||||
|  | ||||
| public: | ||||
| 	explicit CommitDialog(QWidget *parent, const QStringList &commitMsgHistory, QStringList &files); | ||||
| 	explicit CommitDialog(QWidget *parent, QString title, QStringList &files, const QStringList *history=0, bool singleLineEntry=false, const QString *checkBoxText=0, bool *checkBoxValue=0); | ||||
|     ~CommitDialog(); | ||||
|  | ||||
| 	static bool run(QWidget *parent, QString &commitMsg, const QStringList &commitMsgHistory, QStringList &files); | ||||
| 	static bool run(QWidget *parent, QString title, QStringList &files, QString &commitMsg, const QStringList *history=0, bool singleLineEntry=false, const QString *checkBoxText=0, bool *checkBoxValue=0); | ||||
|  | ||||
| private slots: | ||||
| 	void on_comboBox_activated(int index); | ||||
|   | ||||
| @@ -23,6 +23,9 @@ | ||||
|    <item> | ||||
|     <widget class="QComboBox" name="comboBox"/> | ||||
|    </item> | ||||
|    <item> | ||||
|     <widget class="QLineEdit" name="lineEdit"/> | ||||
|    </item> | ||||
|    <item> | ||||
|     <widget class="QSplitter" name="splitter"> | ||||
|      <property name="orientation"> | ||||
| @@ -58,6 +61,13 @@ | ||||
|      </widget> | ||||
|     </widget> | ||||
|    </item> | ||||
|    <item> | ||||
|     <widget class="QCheckBox" name="checkBox"> | ||||
|      <property name="text"> | ||||
|       <string>CheckBox</string> | ||||
|      </property> | ||||
|     </widget> | ||||
|    </item> | ||||
|    <item> | ||||
|     <widget class="QDialogButtonBox" name="buttonBox"> | ||||
|      <property name="orientation"> | ||||
|   | ||||
							
								
								
									
										244
									
								
								MainWindow.cpp
									
									
									
									
									
								
							
							
						
						
									
										244
									
								
								MainWindow.cpp
									
									
									
									
									
								
							| @@ -124,6 +124,12 @@ MainWindow::MainWindow(QWidget *parent) : | ||||
| 	ui->treeView->addAction(ui->actionRenameFolder); | ||||
| 	ui->treeView->addAction(ui->actionOpenFolder); | ||||
|  | ||||
| 	// StashView | ||||
| 	ui->tableViewStash->setModel(&repoStashModel); | ||||
| 	ui->tableViewStash->addAction(ui->actionApplyStash); | ||||
| 	ui->tableViewStash->addAction(ui->actionDiffStash); | ||||
| 	ui->tableViewStash->addAction(ui->actionDeleteStash); | ||||
|  | ||||
| 	// Recent Workspaces | ||||
| 	// Locate a sequence of two separator actions in file menu | ||||
| 	QList<QAction*> file_actions = ui->menuFile->actions(); | ||||
| @@ -632,9 +638,40 @@ void MainWindow::scanWorkspace() | ||||
| 		pathSet.insert(path); | ||||
| 	} | ||||
|  | ||||
| 	// Load the stash | ||||
| 	stashMap.clear(); | ||||
| 	res.clear(); | ||||
| 	if(!runFossil(QStringList() << "stash" << "ls", &res, RUNGLAGS_SILENT_ALL)) | ||||
| 		return; | ||||
|  | ||||
| 	for(QStringList::iterator line_it=res.begin(); line_it!=res.end(); ++line_it) | ||||
| 	{ | ||||
| 		QString l = (*line_it).trimmed(); | ||||
| 		int colon = l.indexOf(':'); | ||||
|  | ||||
| 		// When no colon we have no stash to process | ||||
| 		if(colon==-1) | ||||
| 			break; | ||||
|  | ||||
| 		QString id = l.left(colon); | ||||
|  | ||||
| 		// Parse stash name | ||||
| 		++line_it; | ||||
|  | ||||
| 		// Invalid stash, exit | ||||
| 		if(line_it==res.end()) | ||||
| 			break; | ||||
|  | ||||
| 		QString name = (*line_it); | ||||
| 		name = name.trimmed(); | ||||
| 		stashMap.insert(name, id); | ||||
| 	} | ||||
|  | ||||
|  | ||||
| 	// Update the file item model | ||||
| 	updateDirView(); | ||||
| 	updateFileView(); | ||||
| 	updateStashView(); | ||||
|  | ||||
| 	setEnabled(true); | ||||
| 	setStatus(""); | ||||
| @@ -682,6 +719,11 @@ void MainWindow::updateDirView() | ||||
| { | ||||
| 	// Directory View | ||||
| 	repoDirModel.clear(); | ||||
|  | ||||
| 	QStringList header; | ||||
| 	header << tr("Folders"); | ||||
| 	repoDirModel.setHorizontalHeaderLabels(header); | ||||
|  | ||||
| 	QStandardItem *root = new QStandardItem(QIcon(":icons/icons/My Documents-01.png"), projectName); | ||||
| 	root->setData(""); // Empty Path | ||||
| 	root->setEditable(false); | ||||
| @@ -825,6 +867,24 @@ MainWindow::RepoStatus MainWindow::getRepoStatus() | ||||
|  | ||||
| 	return run_ok ? REPO_OK : REPO_NOT_FOUND; | ||||
| } | ||||
| //------------------------------------------------------------------------------ | ||||
| void MainWindow::updateStashView() | ||||
| { | ||||
| 	repoStashModel.clear(); | ||||
|  | ||||
| 	QStringList header; | ||||
| 	header << tr("Stashes"); | ||||
| 	repoStashModel.setHorizontalHeaderLabels(header); | ||||
|  | ||||
| 	for(stashmap_t::iterator it=stashMap.begin(); it!=stashMap.end(); ++it) | ||||
| 	{ | ||||
| 		QStandardItem *item = new QStandardItem(it.key()); | ||||
| 		repoStashModel.appendRow(item); | ||||
| 	} | ||||
| 	ui->tableViewStash->resizeColumnsToContents(); | ||||
| 	ui->tableViewStash->resizeRowsToContents(); | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| void MainWindow::log(const QString &text, bool isHTML) | ||||
| { | ||||
| @@ -885,7 +945,17 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int | ||||
| 	bool detached = (runFlags & RUNGLAGS_DETACHED) != 0; | ||||
|  | ||||
| 	if(!silent_input) | ||||
| 		log("<b>> fossil "+args.join(" ")+"</b><br>", true); | ||||
| 	{ | ||||
| 		QString params; | ||||
| 		foreach(QString p, args) | ||||
| 		{ | ||||
| 			if(p.indexOf(' ')!=-1) | ||||
| 				params += '"' + p + "\" "; | ||||
| 			else | ||||
| 				params += p + ' '; | ||||
| 		} | ||||
| 		log("<b>> fossil "+params+"</b><br>", true); | ||||
| 	} | ||||
|  | ||||
| 	QString wkdir = getCurrentWorkspace(); | ||||
|  | ||||
| @@ -914,13 +984,19 @@ bool MainWindow::runFossilRaw(const QStringList &args, QStringList *output, int | ||||
| 	fossilAbort = false; | ||||
| 	QString buffer; | ||||
|  | ||||
| 	while(process.state()==QProcess::Running || process.bytesAvailable()>0) | ||||
| 	while(true) | ||||
| 	{ | ||||
| 		QProcess::ProcessState state = process.state(); | ||||
| 		qint64 bytes_avail = process.bytesAvailable(); | ||||
|  | ||||
| 		if(state!=QProcess::Running && bytes_avail<1) | ||||
| 			break; | ||||
|  | ||||
| 		if(fossilAbort) | ||||
| 		{ | ||||
| 			log("\n* "+tr("Terminated")+" *\n"); | ||||
| 			#ifdef Q_WS_WIN | ||||
| 				fossilUI.kill(); // QT on windows cannot terminate console processes with QProcess::terminate | ||||
| 				process.kill(); // QT on windows cannot terminate console processes with QProcess::terminate | ||||
| 			#else | ||||
| 				process.terminate(); | ||||
| 			#endif | ||||
| @@ -1137,8 +1213,13 @@ void MainWindow::loadSettings() | ||||
| 	if(qsettings.contains("ViewAsList")) | ||||
| 	{ | ||||
| 		ui->actionViewAsList->setChecked(qsettings.value("ViewAsList").toBool()); | ||||
| 		ui->treeView->setVisible(qsettings.value("ViewAsList").toBool() == VIEWMODE_LIST); | ||||
| 		viewMode = qsettings.value("ViewAsList").toBool()? VIEWMODE_LIST : VIEWMODE_TREE; | ||||
| 	} | ||||
| 	ui->treeView->setVisible(viewMode == VIEWMODE_TREE); | ||||
|  | ||||
| 	if(qsettings.contains("ViewStash")) | ||||
| 		ui->actionViewStash->setChecked(qsettings.value("ViewStash").toBool()); | ||||
| 	ui->tableViewStash->setVisible(ui->actionViewStash->isChecked()); | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| @@ -1173,6 +1254,7 @@ void MainWindow::saveSettings() | ||||
| 	qsettings.setValue("ViewUnchanged", ui->actionViewUnchanged->isChecked()); | ||||
| 	qsettings.setValue("ViewIgnored", ui->actionViewIgnored->isChecked()); | ||||
| 	qsettings.setValue("ViewAsList", ui->actionViewAsList->isChecked()); | ||||
| 	qsettings.setValue("ViewStash", ui->actionViewStash->isChecked()); | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| @@ -1285,6 +1367,28 @@ void MainWindow::getFileViewSelection(QStringList &filenames, int includeMask, b | ||||
| 		filenames.append(filename); | ||||
| 	} | ||||
| } | ||||
| //------------------------------------------------------------------------------ | ||||
| void MainWindow::getStashViewSelection(QStringList &stashNames, bool allIfEmpty) | ||||
| { | ||||
| 	QModelIndexList selection = ui->tableViewStash->selectionModel()->selectedIndexes(); | ||||
| 	if(selection.empty() && allIfEmpty) | ||||
| 	{ | ||||
| 		ui->tableViewStash->selectAll(); | ||||
| 		selection = ui->tableViewStash->selectionModel()->selectedIndexes(); | ||||
| 		ui->tableViewStash->clearSelection(); | ||||
| 	} | ||||
|  | ||||
| 	for(QModelIndexList::iterator mi_it = selection.begin(); mi_it!=selection.end(); ++mi_it) | ||||
| 	{ | ||||
| 		const QModelIndex &mi = *mi_it; | ||||
|  | ||||
| 		if(mi.column()!=0) | ||||
| 			continue; | ||||
| 		QString name = repoStashModel.data(mi).toString(); | ||||
| 		stashNames.append(name); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| bool MainWindow::diffFile(QString repoFile) | ||||
| { | ||||
| @@ -1462,7 +1566,7 @@ void MainWindow::on_actionCommit_triggered() | ||||
| 	QStringList commit_msgs = settings.Mappings[FUEL_SETTING_COMMIT_MSG].Value.toStringList(); | ||||
|  | ||||
| 	QString msg; | ||||
| 	bool aborted = !CommitDialog::run(this, msg, commit_msgs, modified_files); | ||||
| 	bool aborted = !CommitDialog::run(this, tr("Commit Changes"), modified_files, msg, &commit_msgs); | ||||
|  | ||||
| 	// Aborted or not we always keep the commit messages. | ||||
| 	// (This has saved me way too many times on TortoiseSVN) | ||||
| @@ -2046,3 +2150,133 @@ QMenu * MainWindow::createPopupMenu() | ||||
| 	return NULL; | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| void MainWindow::on_actionViewStash_triggered() | ||||
| { | ||||
| 	ui->tableViewStash->setVisible(ui->actionViewStash->isChecked()); | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| void MainWindow::on_actionNewStash_triggered() | ||||
| { | ||||
| 	QStringList stashed_files; | ||||
| 	getSelectionFilenames(stashed_files, RepoFile::TYPE_MODIFIED, true); | ||||
|  | ||||
| 	if(stashed_files.empty()) | ||||
| 		return; | ||||
| 	 | ||||
| 	QString stash_name; | ||||
| 	bool revert = false; | ||||
| 	QString checkbox_text = tr("Revert stashed files"); | ||||
| 	if(!CommitDialog::run(this, tr("Stash Changes"), stashed_files, stash_name, 0, true, &checkbox_text, &revert) || stashed_files.empty()) | ||||
| 		return; | ||||
|  | ||||
| 	stash_name = stash_name.trimmed(); | ||||
|  | ||||
| 	if(stash_name.indexOf("\"")!=-1 || stash_name.isEmpty()) | ||||
| 	{ | ||||
| 		QMessageBox::critical(this, tr("Error"), tr("Invalid stash name")); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	// Check that this stash does not exist | ||||
| 	for(stashmap_t::iterator it=stashMap.begin(); it!=stashMap.end(); ++it) | ||||
| 	{ | ||||
| 		if(stash_name == it.key()) | ||||
| 		{ | ||||
| 			QMessageBox::critical(this, tr("Error"), tr("This stash already exists"));			 | ||||
| 			return; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	// Do Stash | ||||
| 	QString command = "snapshot"; | ||||
| 	if(revert) | ||||
| 		command = "save"; | ||||
|  | ||||
| 	runFossil(QStringList() << "stash" << command << "-m" << stash_name << QuotePaths(stashed_files) ); | ||||
| 	refresh(); | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| void MainWindow::on_actionApplyStash_triggered() | ||||
| { | ||||
| 	QStringList stashes; | ||||
| 	getStashViewSelection(stashes); | ||||
|  | ||||
| 	bool delete_stashes = false; | ||||
| 	if(!FileActionDialog::run(this, tr("Apply Stash"), tr("The following stashes will be applied. Are you sure?"), stashes, tr("Delete after applying"), &delete_stashes)) | ||||
| 		return; | ||||
|  | ||||
| 	// Apply stashes | ||||
| 	for(QStringList::iterator it=stashes.begin(); it!=stashes.end(); ++it) | ||||
| 	{ | ||||
| 		stashmap_t::iterator id_it = stashMap.find(*it); | ||||
| 		Q_ASSERT(id_it!=stashMap.end()); | ||||
|  | ||||
| 		if(!runFossil(QStringList() << "stash" << "apply" << *id_it)) | ||||
| 		{ | ||||
| 			log(tr("Stash application aborted due to errors\n")); | ||||
| 			return; | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	// Delete stashes | ||||
| 	for(QStringList::iterator it=stashes.begin(); delete_stashes && it!=stashes.end(); ++it) | ||||
| 	{ | ||||
| 		stashmap_t::iterator id_it = stashMap.find(*it); | ||||
| 		Q_ASSERT(id_it!=stashMap.end()); | ||||
|  | ||||
| 		if(!runFossil(QStringList() << "stash" << "drop" << *id_it)) | ||||
| 		{ | ||||
| 			log(tr("Stash deletion aborted due to errors\n")); | ||||
| 			return; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	refresh(); | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| void MainWindow::on_actionDeleteStash_triggered() | ||||
| { | ||||
| 	QStringList stashes; | ||||
| 	getStashViewSelection(stashes); | ||||
|  | ||||
| 	if(stashes.empty()) | ||||
| 		return; | ||||
|  | ||||
| 	if(!FileActionDialog::run(this, tr("Delete Stashes"), tr("The following stashes will be deleted. Are you sure?"), stashes)) | ||||
| 		return; | ||||
|  | ||||
| 	// Delete stashes | ||||
| 	for(QStringList::iterator it=stashes.begin(); it!=stashes.end(); ++it) | ||||
| 	{ | ||||
| 		stashmap_t::iterator id_it = stashMap.find(*it); | ||||
| 		Q_ASSERT(id_it!=stashMap.end()); | ||||
|  | ||||
| 		if(!runFossil(QStringList() << "stash" << "drop" << *id_it)) | ||||
| 		{ | ||||
| 			log(tr("Stash deletion aborted due to errors\n")); | ||||
| 			return; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	refresh(); | ||||
| } | ||||
|  | ||||
| //------------------------------------------------------------------------------ | ||||
| void MainWindow::on_actionDiffStash_triggered() | ||||
| { | ||||
| 	QStringList stashes; | ||||
| 	getStashViewSelection(stashes); | ||||
|  | ||||
| 	if(stashes.length() != 1) | ||||
| 		return; | ||||
| 	 | ||||
| 	stashmap_t::iterator id_it = stashMap.find(*stashes.begin()); | ||||
| 	Q_ASSERT(id_it!=stashMap.end()); | ||||
| 	 | ||||
| 	// Run diff | ||||
| 	runFossil(QStringList() << "stash" << "diff" << *id_it, 0); | ||||
| } | ||||
|   | ||||
							
								
								
									
										13
									
								
								MainWindow.h
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								MainWindow.h
									
									
									
									
									
								
							| @@ -108,8 +108,6 @@ private: | ||||
| 	QString		Path; | ||||
| }; | ||||
|  | ||||
|  | ||||
|  | ||||
| ////////////////////////////////////////////////////////////////////////// | ||||
| // MainWindow | ||||
| ////////////////////////////////////////////////////////////////////////// | ||||
| @@ -148,6 +146,7 @@ private: | ||||
| 	void getSelectionFilenames(QStringList &filenames, int includeMask=RepoFile::TYPE_ALL, bool allIfEmpty=false); | ||||
| 	void getFileViewSelection(QStringList &filenames, int includeMask=RepoFile::TYPE_ALL, bool allIfEmpty=false); | ||||
| 	void getDirViewSelection(QStringList &filenames, int includeMask=RepoFile::TYPE_ALL, bool allIfEmpty=false); | ||||
| 	void getStashViewSelection(QStringList &stashNames, bool allIfEmpty=false); | ||||
| 	void getSelectionPaths(stringset_t &paths); | ||||
| 	bool startUI(); | ||||
| 	void stopUI(); | ||||
| @@ -161,7 +160,9 @@ private: | ||||
| 	bool scanDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir, const QString ignoreSpec); | ||||
| 	void updateDirView(); | ||||
| 	void updateFileView(); | ||||
| 	void updateStashView(); | ||||
| 	void selectRootDir(); | ||||
|  | ||||
| 	virtual QMenu *createPopupMenu(); | ||||
|  | ||||
| 	enum RepoStatus | ||||
| @@ -218,6 +219,11 @@ private slots: | ||||
| 	void on_actionNewRepository_triggered(); | ||||
| 	void on_actionOpenRepository_triggered(); | ||||
| 	void on_actionCloseRepository_triggered(); | ||||
| 	void on_actionViewStash_triggered(); | ||||
| 	void on_actionNewStash_triggered(); | ||||
| 	void on_actionApplyStash_triggered(); | ||||
| 	void on_actionDeleteStash_triggered(); | ||||
| 	void on_actionDiffStash_triggered(); | ||||
|  | ||||
| private: | ||||
| 	enum | ||||
| @@ -229,6 +235,7 @@ private: | ||||
| 	Ui::MainWindow		*ui; | ||||
| 	QStandardItemModel	repoFileModel; | ||||
| 	QStandardItemModel	repoDirModel; | ||||
| 	QStandardItemModel	repoStashModel; | ||||
| 	QProcess			fossilUI; | ||||
| 	QString				fossilUIPort; | ||||
| 	class QAction		*recentWorkspaceActs[MAX_RECENT]; | ||||
| @@ -246,8 +253,10 @@ private: | ||||
| 	// Repo State | ||||
| 	typedef QList<RepoFile*> filelist_t; | ||||
| 	typedef QMap<QString, RepoFile*> filemap_t; | ||||
| 	typedef QMap<QString, QString> stashmap_t; | ||||
| 	filemap_t			workspaceFiles; | ||||
| 	stringset_t			pathSet; | ||||
| 	stashmap_t			stashMap; | ||||
| }; | ||||
|  | ||||
| #endif // MAINWINDOW_H | ||||
|   | ||||
							
								
								
									
										152
									
								
								MainWindow.ui
									
									
									
									
									
								
							
							
						
						
									
										152
									
								
								MainWindow.ui
									
									
									
									
									
								
							| @@ -32,7 +32,7 @@ | ||||
|       </property> | ||||
|       <widget class="QSplitter" name="splitter"> | ||||
|        <property name="sizePolicy"> | ||||
|         <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> | ||||
|         <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> | ||||
|          <horstretch>0</horstretch> | ||||
|          <verstretch>80</verstretch> | ||||
|         </sizepolicy> | ||||
| @@ -42,7 +42,7 @@ | ||||
|        </property> | ||||
|        <widget class="QTreeView" name="treeView"> | ||||
|         <property name="sizePolicy"> | ||||
|          <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> | ||||
|          <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> | ||||
|           <horstretch>20</horstretch> | ||||
|           <verstretch>0</verstretch> | ||||
|          </sizepolicy> | ||||
| @@ -65,6 +65,9 @@ | ||||
|         <attribute name="headerVisible"> | ||||
|          <bool>false</bool> | ||||
|         </attribute> | ||||
|         <attribute name="headerShowSortIndicator" stdset="0"> | ||||
|          <bool>false</bool> | ||||
|         </attribute> | ||||
|        </widget> | ||||
|        <widget class="QTableView" name="tableView"> | ||||
|         <property name="sizePolicy"> | ||||
| @@ -94,9 +97,15 @@ | ||||
|         <property name="wordWrap"> | ||||
|          <bool>false</bool> | ||||
|         </property> | ||||
|         <attribute name="horizontalHeaderHighlightSections"> | ||||
|          <bool>false</bool> | ||||
|         </attribute> | ||||
|         <attribute name="horizontalHeaderMinimumSectionSize"> | ||||
|          <number>20</number> | ||||
|         </attribute> | ||||
|         <attribute name="horizontalHeaderShowSortIndicator" stdset="0"> | ||||
|          <bool>false</bool> | ||||
|         </attribute> | ||||
|         <attribute name="verticalHeaderVisible"> | ||||
|          <bool>false</bool> | ||||
|         </attribute> | ||||
| @@ -104,6 +113,44 @@ | ||||
|          <number>30</number> | ||||
|         </attribute> | ||||
|        </widget> | ||||
|        <widget class="QTableView" name="tableViewStash"> | ||||
|         <property name="sizePolicy"> | ||||
|          <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> | ||||
|           <horstretch>20</horstretch> | ||||
|           <verstretch>0</verstretch> | ||||
|          </sizepolicy> | ||||
|         </property> | ||||
|         <property name="contextMenuPolicy"> | ||||
|          <enum>Qt::ActionsContextMenu</enum> | ||||
|         </property> | ||||
|         <property name="editTriggers"> | ||||
|          <set>QAbstractItemView::NoEditTriggers</set> | ||||
|         </property> | ||||
|         <property name="alternatingRowColors"> | ||||
|          <bool>true</bool> | ||||
|         </property> | ||||
|         <property name="selectionBehavior"> | ||||
|          <enum>QAbstractItemView::SelectRows</enum> | ||||
|         </property> | ||||
|         <property name="showGrid"> | ||||
|          <bool>false</bool> | ||||
|         </property> | ||||
|         <property name="sortingEnabled"> | ||||
|          <bool>true</bool> | ||||
|         </property> | ||||
|         <property name="wordWrap"> | ||||
|          <bool>false</bool> | ||||
|         </property> | ||||
|         <attribute name="horizontalHeaderHighlightSections"> | ||||
|          <bool>false</bool> | ||||
|         </attribute> | ||||
|         <attribute name="horizontalHeaderStretchLastSection"> | ||||
|          <bool>true</bool> | ||||
|         </attribute> | ||||
|         <attribute name="verticalHeaderVisible"> | ||||
|          <bool>false</bool> | ||||
|         </attribute> | ||||
|        </widget> | ||||
|       </widget> | ||||
|       <widget class="QTextBrowser" name="textBrowser"> | ||||
|        <property name="sizePolicy"> | ||||
| @@ -128,7 +175,7 @@ | ||||
|    </property> | ||||
|    <widget class="QMenu" name="menuFile"> | ||||
|     <property name="title"> | ||||
|      <string>File</string> | ||||
|      <string>&File</string> | ||||
|     </property> | ||||
|     <addaction name="actionNewRepository"/> | ||||
|     <addaction name="actionOpenRepository"/> | ||||
| @@ -141,19 +188,21 @@ | ||||
|    </widget> | ||||
|    <widget class="QMenu" name="menuHelp"> | ||||
|     <property name="title"> | ||||
|      <string>Help</string> | ||||
|      <string>&Help</string> | ||||
|     </property> | ||||
|     <addaction name="actionAbout"/> | ||||
|    </widget> | ||||
|    <widget class="QMenu" name="menuView"> | ||||
|     <property name="title"> | ||||
|      <string>View</string> | ||||
|      <string>&View</string> | ||||
|     </property> | ||||
|     <addaction name="actionViewModified"/> | ||||
|     <addaction name="actionViewUnchanged"/> | ||||
|     <addaction name="actionViewUnknown"/> | ||||
|     <addaction name="actionViewIgnored"/> | ||||
|     <addaction name="separator"/> | ||||
|     <addaction name="actionViewStash"/> | ||||
|     <addaction name="separator"/> | ||||
|     <addaction name="actionViewAsList"/> | ||||
|    </widget> | ||||
|    <addaction name="menuFile"/> | ||||
| @@ -199,6 +248,8 @@ | ||||
|    <addaction name="actionRevert"/> | ||||
|    <addaction name="actionDelete"/> | ||||
|    <addaction name="separator"/> | ||||
|    <addaction name="actionNewStash"/> | ||||
|    <addaction name="separator"/> | ||||
|    <addaction name="actionDiff"/> | ||||
|    <addaction name="actionHistory"/> | ||||
|    <addaction name="separator"/> | ||||
| @@ -305,7 +356,7 @@ | ||||
|      <normaloff>:/icons/icons/Document Blank-01.png</normaloff>:/icons/icons/Document Blank-01.png</iconset> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>New...</string> | ||||
|     <string>&New...</string> | ||||
|    </property> | ||||
|    <property name="toolTip"> | ||||
|     <string>Make a new Fossil repository</string> | ||||
| @@ -323,7 +374,7 @@ | ||||
|      <normaloff>:/icons/icons/My Documents-01.png</normaloff>:/icons/icons/My Documents-01.png</iconset> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Open...</string> | ||||
|     <string>&Open...</string> | ||||
|    </property> | ||||
|    <property name="toolTip"> | ||||
|     <string>Open a Fossil repository or workspace folder</string> | ||||
| @@ -340,7 +391,7 @@ | ||||
|   </action> | ||||
|   <action name="actionCloseRepository"> | ||||
|    <property name="text"> | ||||
|     <string>Close</string> | ||||
|     <string>&Close</string> | ||||
|    </property> | ||||
|    <property name="toolTip"> | ||||
|     <string>Close the current workspace</string> | ||||
| @@ -418,7 +469,7 @@ | ||||
|      <normaloff>:/icons/icons/Button Turn Off-01.png</normaloff>:/icons/icons/Button Turn Off-01.png</iconset> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Quit</string> | ||||
|     <string>&Quit</string> | ||||
|    </property> | ||||
|    <property name="statusTip"> | ||||
|     <string>Quit</string> | ||||
| @@ -532,7 +583,7 @@ | ||||
|   <action name="actionOpenContaining"> | ||||
|    <property name="icon"> | ||||
|     <iconset resource="resources.qrc"> | ||||
|      <normaloff>:/icons/icons/My Documents-01.png</normaloff>:/icons/icons/My Documents-01.png</iconset> | ||||
|      <normaloff>:/icons/icons/Folder-01.png</normaloff>:/icons/icons/Folder-01.png</iconset> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Open Containing</string> | ||||
| @@ -571,7 +622,7 @@ | ||||
|      <normaloff>:/icons/icons/Battery-01.png</normaloff>:/icons/icons/Battery-01.png</iconset> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>About...</string> | ||||
|     <string>&About...</string> | ||||
|    </property> | ||||
|    <property name="statusTip"> | ||||
|     <string>About Fuel</string> | ||||
| @@ -601,7 +652,7 @@ | ||||
|      <normaloff>:/icons/icons/Gear-01.png</normaloff>:/icons/icons/Gear-01.png</iconset> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Preferences...</string> | ||||
|     <string>&Preferences...</string> | ||||
|    </property> | ||||
|    <property name="toolTip"> | ||||
|     <string>Fuel Preferences</string> | ||||
| @@ -618,7 +669,7 @@ | ||||
|     <bool>true</bool> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Modified</string> | ||||
|     <string>&Modified</string> | ||||
|    </property> | ||||
|    <property name="statusTip"> | ||||
|     <string>Show modifed files</string> | ||||
| @@ -632,7 +683,7 @@ | ||||
|     <bool>true</bool> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Unchanged</string> | ||||
|     <string>&Unchanged</string> | ||||
|    </property> | ||||
|    <property name="statusTip"> | ||||
|     <string>Show unchanged files</string> | ||||
| @@ -646,7 +697,7 @@ | ||||
|     <bool>true</bool> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Unknown</string> | ||||
|     <string>Un&known</string> | ||||
|    </property> | ||||
|    <property name="statusTip"> | ||||
|     <string>Show unknown files</string> | ||||
| @@ -657,7 +708,7 @@ | ||||
|     <bool>true</bool> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Ignored</string> | ||||
|     <string>&Ignored</string> | ||||
|    </property> | ||||
|    <property name="statusTip"> | ||||
|     <string>Show ignored files</string> | ||||
| @@ -668,7 +719,13 @@ | ||||
|     <bool>true</bool> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>View as List</string> | ||||
|     <string>File &List</string> | ||||
|    </property> | ||||
|    <property name="iconText"> | ||||
|     <string>View as files as a list</string> | ||||
|    </property> | ||||
|    <property name="toolTip"> | ||||
|     <string>View as files as a list</string> | ||||
|    </property> | ||||
|    <property name="statusTip"> | ||||
|     <string>View the workspace as a list of files</string> | ||||
| @@ -677,7 +734,7 @@ | ||||
|   <action name="actionOpenFolder"> | ||||
|    <property name="icon"> | ||||
|     <iconset resource="resources.qrc"> | ||||
|      <normaloff>:/icons/icons/My Documents-01.png</normaloff>:/icons/icons/My Documents-01.png</iconset> | ||||
|      <normaloff>:/icons/icons/Folder-01.png</normaloff>:/icons/icons/Folder-01.png</iconset> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Open Folder</string> | ||||
| @@ -704,6 +761,65 @@ | ||||
|     <string>Rename the selected folder</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionNewStash"> | ||||
|    <property name="icon"> | ||||
|     <iconset resource="resources.qrc"> | ||||
|      <normaloff>:/icons/icons/Folder Add-01.png</normaloff>:/icons/icons/Folder Add-01.png</iconset> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Stash changes</string> | ||||
|    </property> | ||||
|    <property name="statusTip"> | ||||
|     <string>Show the stash</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionApplyStash"> | ||||
|    <property name="icon"> | ||||
|     <iconset resource="resources.qrc"> | ||||
|      <normaloff>:/icons/icons/Folder Open-01.png</normaloff>:/icons/icons/Folder Open-01.png</iconset> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Apply Stash</string> | ||||
|    </property> | ||||
|    <property name="iconText"> | ||||
|     <string>Apply stashed changes</string> | ||||
|    </property> | ||||
|    <property name="toolTip"> | ||||
|     <string>Apply stashed changes</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionViewStash"> | ||||
|    <property name="checkable"> | ||||
|     <bool>true</bool> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>&Stashed Changes</string> | ||||
|    </property> | ||||
|    <property name="iconText"> | ||||
|     <string>View the Stash</string> | ||||
|    </property> | ||||
|    <property name="toolTip"> | ||||
|     <string>Show the list of stashed changes</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionDeleteStash"> | ||||
|    <property name="icon"> | ||||
|     <iconset resource="resources.qrc"> | ||||
|      <normaloff>:/icons/icons/Folder Delete-01.png</normaloff>:/icons/icons/Folder Delete-01.png</iconset> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Delete Stash</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionDiffStash"> | ||||
|    <property name="icon"> | ||||
|     <iconset resource="resources.qrc"> | ||||
|      <normaloff>:/icons/icons/Folder Explorer-01.png</normaloff>:/icons/icons/Folder Explorer-01.png</iconset> | ||||
|    </property> | ||||
|    <property name="text"> | ||||
|     <string>Diff Stash</string> | ||||
|    </property> | ||||
|   </action> | ||||
|  </widget> | ||||
|  <layoutdefault spacing="6" margin="11"/> | ||||
|  <resources> | ||||
|   | ||||
							
								
								
									
										22
									
								
								manifest
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								manifest
									
									
									
									
									
								
							| @@ -1,14 +1,14 @@ | ||||
| C Allow\sfor\sopening\sworkspaces\svia\sthe\scheckout\sfile.\s[Thanks\sChris]\nAdded\ssupport\sfor\sthe\snew\s".fslckout"\sfile\nFixed\san\sissue\swhere\sthe\s\stree\sview\swas\snot\sbeing\supdated\swhen\shidden\sand\sa\sdifferent\sworkspace\swas\sopened\nMinor\sdialog\stext\simprovements\n | ||||
| D 2012-04-14T09:16:30.450 | ||||
| F CommitDialog.cpp bc05504be08d9ffe2b24d341a18e37035e1941b7 | ||||
| F CommitDialog.h 65a7238dcdd41b578536a0b0ac2a65f2e7f23c9a | ||||
| F CommitDialog.ui 5067623f6af6f5a42c87df903278e383e945e154 | ||||
| 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 | ||||
| D 2012-04-15T06:56:51.575 | ||||
| F CommitDialog.cpp a46020a9361151d8d286a2670257d01d8967bf69 | ||||
| F CommitDialog.h f1ee8db92103164e7db55a8407ccdcff24571b72 | ||||
| F CommitDialog.ui 813d7cba316e226de1a22b7e480bb969fbe9b0c4 | ||||
| F FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8 | ||||
| F FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce | ||||
| F FileActionDialog.ui c63644428579741aeb5fa052e237ba799ced9ad7 | ||||
| F MainWindow.cpp f6ee64df8e4d275e3ed60462904566154758e9e1 | ||||
| F MainWindow.h 643f13d4b5615c51c38b164768bf62258ccb94b1 | ||||
| F MainWindow.ui 0afb7d2a8e9ce2cff2966295f9eefaed01f1ed51 | ||||
| F MainWindow.cpp 36e0fa67dbae7db5612d00e28267a2f8240353d0 | ||||
| F MainWindow.h 552f6bd4061ae15be90e52402bcde6a8d7fbb7ad | ||||
| F MainWindow.ui b96e3126e2966f8fdeda1dd063efbbc731c7338e | ||||
| F SettingsDialog.cpp e1fad18cc020d08b82c6d35dc94f6624deec9a3b | ||||
| F SettingsDialog.h f5da6cab4ccc82e2eb78ec835fb849c4c104d6cc | ||||
| F SettingsDialog.ui 8964629ea80c61971c0601624c84d1927902b1fd | ||||
| @@ -174,7 +174,7 @@ F installer/fuel.iss 13b6a938bcdf273cbd3649d2549887baa1577214 | ||||
| F installer/license.txt 4cc77b90af91e615a64ae04893fdffa7939db84c | ||||
| F main.cpp 46bf5ddc90fca01c9ef2e8e3d14b4d32217945dd | ||||
| F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53 | ||||
| P b04aa4a2a385325b9b50e4ce700a364b05c7b70b | ||||
| R ba6b4795a2456f34d550ae60fa343370 | ||||
| P d0520ae5050524145697206927a579823b8920d0 | ||||
| R b055358a254079018cada6a15162fbb7 | ||||
| U kostas | ||||
| Z 6b958dff62628f63360ab69f37796e8d | ||||
| Z c15f935758986542ce2828f4282ddc7a | ||||
|   | ||||
| @@ -1 +1 @@ | ||||
| d0520ae5050524145697206927a579823b8920d0 | ||||
| ce70efe67a1fe0087cc6d3aa79757a5011c57db2 | ||||
		Reference in New Issue
	
	Block a user