Fuel

Diff
Login

Differences From Artifact [0c0a9edf7a]:

To Artifact [ec6143d24b]:


124
125
126
127
128
129
130
131

132
133
134
135

136
137
138
139
140
141
142
124
125
126
127
128
129
130

131
132
133
134

135
136
137
138
139
140
141
142







-
+



-
+







	ui->fileTableView->horizontalHeader()->setMovable(true);
#else
	ui->fileTableView->horizontalHeader()->setSectionsMovable(true);
#endif
	ui->fileTableView->horizontalHeader()->setStretchLastSection(true);

	// workspaceTreeView
	ui->workspaceTreeView->setModel(&getWorkspace().getDirModel());
	ui->workspaceTreeView->setModel(&getWorkspace().getTreeModel());

	header.clear();
	header << tr("Workspace");
	getWorkspace().getDirModel().setHorizontalHeaderLabels(header);
	getWorkspace().getTreeModel().setHorizontalHeaderLabels(header);

	connect( ui->workspaceTreeView->selectionModel(),
		SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ),
		SLOT( onWorkspaceTreeViewSelectionChanged(const QItemSelection &, const QItemSelection &) ),
		Qt::DirectConnection );

	// Workspace Menus
587
588
589
590
591
592
593
594

595
596
597
598
599
600
601
602
603

604
605
606
607
608
609
610
587
588
589
590
591
592
593

594
595
596
597
598
599
600
601
602

603
604
605
606
607
608
609
610







-
+








-
+







	RepoStatus st = fossil().getRepoStatus();

	if(st==REPO_NOT_FOUND)
	{
		setStatus(tr("No workspace detected."));
		enableActions(false);
		getWorkspace().getFileModel().removeRows(0, getWorkspace().getFileModel().rowCount());
		getWorkspace().getDirModel().removeRows(0, getWorkspace().getFileModel().rowCount());
		getWorkspace().getTreeModel().removeRows(0, getWorkspace().getFileModel().rowCount());
		setWindowTitle(title);
		return false;
	}
	else if(st==REPO_OLD_SCHEMA)
	{
		setStatus(tr("Old repository schema detected. Consider running 'fossil rebuild'"));
		enableActions(false);
		getWorkspace().getFileModel().removeRows(0, getWorkspace().getFileModel().rowCount());
		getWorkspace().getDirModel().removeRows(0, getWorkspace().getFileModel().rowCount());
		getWorkspace().getTreeModel().removeRows(0, getWorkspace().getFileModel().rowCount());
		setWindowTitle(title);
		return true;
	}

	loadFossilSettings();
	scanWorkspace();
	setStatus("");
687
688
689
690
691
692
693
694

695
696
697
698
699
700

701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717

718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737

738
739
740
741
742
743
744
687
688
689
690
691
692
693

694
695
696
697
698
699

700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716

717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736

737
738
739
740
741
742
743
744







-
+





-
+
















-
+



















-
+







	}
}

//------------------------------------------------------------------------------
void MainWindow::updateWorkspaceView()
{
	// Clear content except headers
	getWorkspace().getDirModel().removeRows(0, getWorkspace().getDirModel().rowCount());
	getWorkspace().getTreeModel().removeRows(0, getWorkspace().getTreeModel().rowCount());

	QStandardItem *workspace = new QStandardItem(getInternalIcon(":icons/icons/Folder-01.png"), tr("Files") );
	workspace->setData(WorkspaceItem(WorkspaceItem::TYPE_WORKSPACE, ""), ROLE_WORKSPACE_ITEM);
	workspace->setEditable(false);

	getWorkspace().getDirModel().appendRow(workspace);
	getWorkspace().getTreeModel().appendRow(workspace);
	if(viewMode == VIEWMODE_TREE)
	{
		for(stringset_t::iterator it = getWorkspace().getPaths().begin(); it!=getWorkspace().getPaths().end(); ++it)
		{
			const QString &dir = *it;
			if(dir.isEmpty())
				continue;

			addPathToTree(*workspace, dir, getInternalIcon(":icons/icons/Folder-01.png"));
		}
	}

	// Branches
	QStandardItem *branches = new QStandardItem(getInternalIcon(":icons/icons/Document Organization Chart-01.png"), "Branches");
	branches->setData(WorkspaceItem(WorkspaceItem::TYPE_BRANCHES, ""), ROLE_WORKSPACE_ITEM);
	branches->setEditable(false);
	getWorkspace().getDirModel().appendRow(branches);
	getWorkspace().getTreeModel().appendRow(branches);
	foreach(const QString &branch_name, getWorkspace().getBranches())
	{
		QStandardItem *branch = new QStandardItem(getInternalIcon(":icons/icons/Document Organization Chart-01.png"), branch_name);
		branch->setData(WorkspaceItem(WorkspaceItem::TYPE_BRANCH, branch_name), ROLE_WORKSPACE_ITEM);

		bool active = fossil().getCurrentTags().contains(branch_name);
		if(active)
		{
			QFont font = branch->font();
			font.setBold(true);
			branch->setFont(font);
		}
		branches->appendRow(branch);
	}

	// Tags
	QStandardItem *tags = new QStandardItem(getInternalIcon(":icons/icons/Book-01.png"), "Tags");
	tags->setData(WorkspaceItem(WorkspaceItem::TYPE_TAGS, ""), ROLE_WORKSPACE_ITEM);
	tags->setEditable(false);
	getWorkspace().getDirModel().appendRow(tags);
	getWorkspace().getTreeModel().appendRow(tags);
	for(QStringMap::const_iterator it=getWorkspace().getTags().begin(); it!=getWorkspace().getTags().end(); ++it)
	{
		const QString &tag_name = it.key();


		QStandardItem *tag = new QStandardItem(getInternalIcon(":icons/icons/Book-01.png"), tag_name);
		tag->setData(WorkspaceItem(WorkspaceItem::TYPE_TAG, tag_name), ROLE_WORKSPACE_ITEM);
753
754
755
756
757
758
759
760

761
762
763
764
765
766
767
753
754
755
756
757
758
759

760
761
762
763
764
765
766
767







-
+







		tags->appendRow(tag);
	}

	// Stashes
	QStandardItem *stashes = new QStandardItem(getInternalIcon(":icons/icons/My Documents-01.png"), "Stashes");
	stashes->setData(WorkspaceItem(WorkspaceItem::TYPE_STASHES, ""), ROLE_WORKSPACE_ITEM);
	stashes->setEditable(false);
	getWorkspace().getDirModel().appendRow(stashes);
	getWorkspace().getTreeModel().appendRow(stashes);
	for(stashmap_t::const_iterator it= getWorkspace().getStashes().begin(); it!=getWorkspace().getStashes().end(); ++it)
	{
		QStandardItem *stash = new QStandardItem(getInternalIcon(":icons/icons/My Documents-01.png"), it.key());
		stash->setData(WorkspaceItem(WorkspaceItem::TYPE_STASH, it.value()), ROLE_WORKSPACE_ITEM);
		stashes->appendRow(stash);
	}

2093
2094
2095
2096
2097
2098
2099
2100

2101
2102
2103
2104
2105
2106
2107
2093
2094
2095
2096
2097
2098
2099

2100
2101
2102
2103
2104
2105
2106
2107







-
+







	if(indices.empty())
		return;

	QMenu *menu = 0;

	// Get first selected item
	const QModelIndex &mi = indices.first();
	QVariant data = getWorkspace().getDirModel().data(mi, ROLE_WORKSPACE_ITEM);
	QVariant data = getWorkspace().getTreeModel().data(mi, ROLE_WORKSPACE_ITEM);
	Q_ASSERT(data.isValid());
	WorkspaceItem tv = data.value<WorkspaceItem>();

	if(tv.Type == WorkspaceItem::TYPE_FOLDER ||  tv.Type == WorkspaceItem::TYPE_WORKSPACE)
		menu = menuWorkspace;
	else if (tv.Type == WorkspaceItem::TYPE_STASH || tv.Type == WorkspaceItem::TYPE_STASHES)
		menu = menuStashes;