Initial work on workspace folder state visualization
FossilOrigin-Name: a2d5250064d0499d5ceea87b5eadaa8b90057ba8
This commit is contained in:
parent
0191b4ba5b
commit
a953856ea7
19
manifest
19
manifest
@ -1,5 +1,5 @@
|
||||
C Minor\srefactoring
|
||||
D 2015-07-10T18:43:33.614
|
||||
C Initial\swork\son\sworkspace\sfolder\sstate\svisualization\n
|
||||
D 2015-07-10T19:52:55.124
|
||||
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
||||
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
||||
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
||||
@ -224,7 +224,7 @@ F src/FslSettingsDialog.cpp 2531d3709f0eab66651671e3edead2ca720d07d5
|
||||
F src/FslSettingsDialog.h dfe2a61884a55a74cbb9206b6f6b482b979725e7
|
||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||
F src/MainWindow.cpp 764eb76c1c420ea4677639baae925e5e8fc203d6
|
||||
F src/MainWindow.cpp c8157260127f662ec1e9f613840552d3fdf53ce0
|
||||
F src/MainWindow.h 765c362ad4937da808276ec321adf4a351ab5b28
|
||||
F src/RemoteDialog.cpp 8540cc5e2e41c4127ed8a028d84691604fa6ecac
|
||||
F src/RemoteDialog.h 5e0438c2bd7c79b1bb44bfbd58c2181b544a9e5d
|
||||
@ -238,8 +238,8 @@ F src/SettingsDialog.cpp cab739fb0569bd26550e57f97136c7515fe757fe
|
||||
F src/SettingsDialog.h 5eb3ae2cbb00ab5544e1889860f5376f69fe47cd
|
||||
F src/Utils.cpp e047c7aaeb4fb4b64c1383df5cb35d269abb87ed
|
||||
F src/Utils.h cb0499ead8dd5662b184dbeabb6e66c3ae65eebc
|
||||
F src/Workspace.cpp 7004c2c30f79d2e64691aa9b2c55ee72a84d978b
|
||||
F src/Workspace.h 0ab9b941a537134a7c43cfccee5299b8ccda143a
|
||||
F src/Workspace.cpp 32ddf5ff2b5f92d9921aedb422bb906edcf601a8
|
||||
F src/Workspace.h 731ec8ae7e97d500f85ee13b18024efbd3d55516
|
||||
F src/main.cpp d8c65ea5e54102e4989fef9fd8cfd4f13ef8a8f0
|
||||
F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x
|
||||
F tools/pack.sh d7f38a498c4e9327fecd6a6e5ac27be270d43008 x
|
||||
@ -252,7 +252,10 @@ F ui/MainWindow.ui 10181826a25056ed5aba2b23a7d110159be7c043
|
||||
F ui/RemoteDialog.ui 95a4750d972ed8c49bb10b95db91ff16cfe2dd0b
|
||||
F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd
|
||||
F ui/SettingsDialog.ui 47b9a31e28ad523f14a1c4cd361270b6babbdf7d
|
||||
P 7cd82ba8f02f659d13a370043f256212f55669db
|
||||
R b1470ef543fad9773da5e4edf313b8fb
|
||||
P ccbdbff89e2354c6d8f38d994587328a04112eaa
|
||||
R ed08a22c30e3753dc2cddf745977971b
|
||||
T *branch * folder-state
|
||||
T *sym-folder-state *
|
||||
T -sym-trunk *
|
||||
U kostas
|
||||
Z 032611050518136012ef63aed85ba8cb
|
||||
Z 79996f85066e37f8eb88b62ea7d82f6a
|
||||
|
@ -1 +1 @@
|
||||
ccbdbff89e2354c6d8f38d994587328a04112eaa
|
||||
a2d5250064d0499d5ceea87b5eadaa8b90057ba8
|
@ -703,7 +703,7 @@ void MainWindow::scanWorkspace()
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static void addPathToTree(QStandardItem &root, const QString &path, const QIcon &folderIcon)
|
||||
static void addPathToTree(QStandardItem &root, const QString &path, const QIcon &folderDefaultIcon, const QIcon &folderIconClean, const QIcon &folderIconDirty, const pathstate_map_t &pathState)
|
||||
{
|
||||
QStringList dirs = path.split('/');
|
||||
QStandardItem *parent = &root;
|
||||
@ -729,11 +729,44 @@ static void addPathToTree(QStandardItem &root, const QString &path, const QIcon
|
||||
|
||||
if(!found) // Generate it
|
||||
{
|
||||
QStandardItem *child = new QStandardItem(folderIcon, dir);
|
||||
const QIcon *icon = &folderDefaultIcon;
|
||||
|
||||
pathstate_map_t::const_iterator state_it = pathState.find(fullpath);
|
||||
if(state_it != pathState.end())
|
||||
{
|
||||
WorkspaceFile::Type type = state_it.value();
|
||||
|
||||
if(type & (WorkspaceFile::TYPE_MODIFIED))
|
||||
icon = &folderIconDirty;
|
||||
else
|
||||
icon = &folderIconClean;
|
||||
}
|
||||
|
||||
QStandardItem *child = new QStandardItem(*icon, dir);
|
||||
child->setData(WorkspaceItem(WorkspaceItem::TYPE_FOLDER, fullpath), ROLE_WORKSPACE_ITEM);
|
||||
parent->appendRow(child);
|
||||
parent = child;
|
||||
|
||||
// Update icons of parents
|
||||
if(icon != &folderDefaultIcon) // Default Icon is not inherited by parent
|
||||
{
|
||||
QStandardItem *p = parent;
|
||||
while(p && p != &root) // Ascend parents except the root node
|
||||
{
|
||||
const QIcon &parent_icon = p->icon();
|
||||
|
||||
// Dirty is inherited
|
||||
if(icon == &folderIconDirty)
|
||||
p->setIcon(*icon);
|
||||
// Clean is inherited if not dirty
|
||||
else if(icon == &folderIconClean && (&parent_icon != &folderIconDirty))
|
||||
p->setIcon(*icon);
|
||||
|
||||
p = p->parent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fullpath += '/';
|
||||
}
|
||||
}
|
||||
@ -769,13 +802,16 @@ void MainWindow::updateWorkspaceView()
|
||||
getWorkspace().getTreeModel().appendRow(workspace);
|
||||
if(viewMode == VIEWMODE_TREE)
|
||||
{
|
||||
for(stringset_t::iterator it = getWorkspace().getPaths().begin(); it!=getWorkspace().getPaths().end(); ++it)
|
||||
// FIXME: Change paths to map to allow for automatic sorting
|
||||
QStringList paths = getWorkspace().getPaths().toList();
|
||||
paths.sort();
|
||||
|
||||
foreach(const QString &dir, paths)
|
||||
{
|
||||
const QString &dir = *it;
|
||||
if(dir.isEmpty())
|
||||
continue;
|
||||
|
||||
addPathToTree(*workspace, dir, getInternalIcon(":icons/icon-item-folder"));
|
||||
addPathToTree(*workspace, dir, getInternalIcon(":icons/icon-item-folder"), getInternalIcon(":icons/icons/Folder Generic Green-01.png"), getInternalIcon(":icons/icons/Folder Generic Red-01.png"), getWorkspace().getPathState());
|
||||
}
|
||||
|
||||
// Expand root folder
|
||||
|
@ -22,6 +22,7 @@ void Workspace::clearState()
|
||||
|
||||
getFiles().clear();
|
||||
getPaths().clear();
|
||||
getPathState().clear();
|
||||
stashMap.clear();
|
||||
branchList.clear();
|
||||
tags.clear();
|
||||
@ -278,6 +279,14 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
|
||||
|
||||
QString path = rf->getPath();
|
||||
getPaths().insert(path);
|
||||
|
||||
// Add or merge file state into directory state
|
||||
pathstate_map_t::iterator state_it = getPathState().find(path);
|
||||
if(state_it != getPathState().end())
|
||||
state_it.value() = static_cast<WorkspaceFile::Type>(state_it.value() | type);
|
||||
else
|
||||
getPathState().insert(path, type);
|
||||
|
||||
}
|
||||
|
||||
// Check if the repository needs integration
|
||||
|
@ -112,6 +112,7 @@ public:
|
||||
};
|
||||
|
||||
typedef QMap<QUrl, Remote> remote_map_t;
|
||||
typedef QMap<QString, WorkspaceFile::Type> pathstate_map_t;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -140,6 +141,7 @@ public:
|
||||
|
||||
filemap_t &getFiles() { return workspaceFiles; }
|
||||
stringset_t &getPaths() { return pathSet; }
|
||||
pathstate_map_t &getPathState() { return pathState; }
|
||||
stashmap_t &getStashes() { return stashMap; }
|
||||
QStringMap &getTags() { return tags; }
|
||||
QStringList &getBranches() { return branchList; }
|
||||
@ -162,6 +164,7 @@ private:
|
||||
Fossil bridge;
|
||||
filemap_t workspaceFiles;
|
||||
stringset_t pathSet;
|
||||
pathstate_map_t pathState;
|
||||
stashmap_t stashMap;
|
||||
QStringList branchList;
|
||||
QStringMap tags;
|
||||
|
Loading…
x
Reference in New Issue
Block a user