The Folder View now properly sorts folder entries
Multiple selection support in the Folder View. When multiple folders are selected, the file view switches to List mode FossilOrigin-Name: a2cba45b7a250bb1ad3ba4beb3a3a98dc7566ce0
This commit is contained in:
parent
160b04e762
commit
32da4986ae
@ -717,25 +717,26 @@ static void addPathToTree(QStandardItem &root, const QString &path)
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void MainWindow::updateDirView()
|
void MainWindow::updateDirView()
|
||||||
{
|
{
|
||||||
if(viewMode == VIEWMODE_TREE)
|
if(viewMode != VIEWMODE_TREE)
|
||||||
{
|
return;
|
||||||
// Directory View
|
|
||||||
repoDirModel.clear();
|
|
||||||
QStandardItem *root = new QStandardItem(QIcon(":icons/icons/My Documents-01.png"), projectName);
|
|
||||||
root->setData(""); // Empty Path
|
|
||||||
root->setEditable(false);
|
|
||||||
QString aa = root->data().toString();
|
|
||||||
repoDirModel.appendRow(root);
|
|
||||||
for(pathset_t::iterator it = pathSet.begin(); it!=pathSet.end(); ++it)
|
|
||||||
{
|
|
||||||
const QString &dir = *it;
|
|
||||||
if(dir.isEmpty())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
addPathToTree(*root, dir);
|
// Directory View
|
||||||
}
|
repoDirModel.clear();
|
||||||
ui->treeView->expandToDepth(0);
|
QStandardItem *root = new QStandardItem(QIcon(":icons/icons/My Documents-01.png"), projectName);
|
||||||
|
root->setData(""); // Empty Path
|
||||||
|
root->setEditable(false);
|
||||||
|
QString aa = root->data().toString();
|
||||||
|
repoDirModel.appendRow(root);
|
||||||
|
for(stringset_t::iterator it = pathSet.begin(); it!=pathSet.end(); ++it)
|
||||||
|
{
|
||||||
|
const QString &dir = *it;
|
||||||
|
if(dir.isEmpty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
addPathToTree(*root, dir);
|
||||||
}
|
}
|
||||||
|
ui->treeView->expandToDepth(0);
|
||||||
|
ui->treeView->sortByColumn(0, Qt::AscendingOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -748,7 +749,9 @@ void MainWindow::updateFileView()
|
|||||||
QStringList header;
|
QStringList header;
|
||||||
header << tr("S") << tr("File") << tr("Ext") << tr("Modified");
|
header << tr("S") << tr("File") << tr("Ext") << tr("Modified");
|
||||||
|
|
||||||
if(viewMode==VIEWMODE_LIST)
|
bool multiple_dirs = selectedDirs.count()>1;
|
||||||
|
|
||||||
|
if(viewMode==VIEWMODE_LIST || multiple_dirs)
|
||||||
header << tr("Path");
|
header << tr("Path");
|
||||||
|
|
||||||
repoFileModel.setHorizontalHeaderLabels(header);
|
repoFileModel.setHorizontalHeaderLabels(header);
|
||||||
@ -771,7 +774,7 @@ void MainWindow::updateFileView()
|
|||||||
QString path = e.getPath();
|
QString path = e.getPath();
|
||||||
|
|
||||||
// In Tree mode, filter all items not included in the current dir
|
// In Tree mode, filter all items not included in the current dir
|
||||||
if(viewMode==VIEWMODE_TREE && path != viewDir)
|
if(viewMode==VIEWMODE_TREE && !selectedDirs.contains(path))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Status Column
|
// Status Column
|
||||||
@ -797,7 +800,7 @@ void MainWindow::updateFileView()
|
|||||||
QFileInfo finfo = e.getFileInfo();
|
QFileInfo finfo = e.getFileInfo();
|
||||||
|
|
||||||
QStandardItem *filename_item = 0;
|
QStandardItem *filename_item = 0;
|
||||||
if(viewMode==VIEWMODE_LIST)
|
if(viewMode==VIEWMODE_LIST || multiple_dirs)
|
||||||
{
|
{
|
||||||
repoFileModel.setItem(item_id, COLUMN_PATH, new QStandardItem(path));
|
repoFileModel.setItem(item_id, COLUMN_PATH, new QStandardItem(path));
|
||||||
|
|
||||||
@ -1175,7 +1178,7 @@ void MainWindow::getSelectionFilenames(QStringList &filenames, int includeMask,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void MainWindow::getSelectionPaths(pathset_t &paths)
|
void MainWindow::getSelectionPaths(stringset_t &paths)
|
||||||
{
|
{
|
||||||
// Determine the directories selected
|
// Determine the directories selected
|
||||||
QModelIndexList selection = ui->treeView->selectionModel()->selectedIndexes();
|
QModelIndexList selection = ui->treeView->selectionModel()->selectedIndexes();
|
||||||
@ -1190,7 +1193,7 @@ void MainWindow::getSelectionPaths(pathset_t &paths)
|
|||||||
void MainWindow::getDirViewSelection(QStringList &filenames, int includeMask, bool allIfEmpty)
|
void MainWindow::getDirViewSelection(QStringList &filenames, int includeMask, bool allIfEmpty)
|
||||||
{
|
{
|
||||||
// Determine the directories selected
|
// Determine the directories selected
|
||||||
pathset_t paths;
|
stringset_t paths;
|
||||||
|
|
||||||
QModelIndexList selection = ui->treeView->selectionModel()->selectedIndexes();
|
QModelIndexList selection = ui->treeView->selectionModel()->selectedIndexes();
|
||||||
if(!(selection.empty() && allIfEmpty))
|
if(!(selection.empty() && allIfEmpty))
|
||||||
@ -1213,7 +1216,7 @@ void MainWindow::getDirViewSelection(QStringList &filenames, int includeMask, bo
|
|||||||
if(!paths.empty())
|
if(!paths.empty())
|
||||||
include = false;
|
include = false;
|
||||||
|
|
||||||
for(pathset_t::iterator p_it=paths.begin(); p_it!=paths.end(); ++p_it)
|
for(stringset_t::iterator p_it=paths.begin(); p_it!=paths.end(); ++p_it)
|
||||||
{
|
{
|
||||||
const QString &path = *p_it;
|
const QString &path = *p_it;
|
||||||
// An empty path is the root folder, so it includes all files
|
// An empty path is the root folder, so it includes all files
|
||||||
@ -1231,7 +1234,6 @@ void MainWindow::getDirViewSelection(QStringList &filenames, int includeMask, bo
|
|||||||
filenames.append(e.getFilePath());
|
filenames.append(e.getFilePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << filenames;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -1784,14 +1786,20 @@ QString MainWindow::getFossilHttpAddress()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void MainWindow::on_treeView_selectionChanged(const QItemSelection &selected, const QItemSelection &/*deselected*/)
|
void MainWindow::on_treeView_selectionChanged(const QItemSelection &/*selected*/, const QItemSelection &/*deselected*/)
|
||||||
{
|
{
|
||||||
if(selected.indexes().count()!=1)
|
selectedDirs.clear();
|
||||||
return;
|
|
||||||
|
QModelIndexList selection = ui->treeView->selectionModel()->selectedIndexes();
|
||||||
|
int num_selected = selection.count();
|
||||||
|
|
||||||
|
for(int i=0; i<num_selected; ++i)
|
||||||
|
{
|
||||||
|
QModelIndex index = selection.at(i);
|
||||||
|
QString dir = repoDirModel.data(index, REPODIRMODEL_ROLE_PATH).toString();
|
||||||
|
selectedDirs.insert(dir);
|
||||||
|
}
|
||||||
|
|
||||||
QModelIndex index = selected.indexes().at(0);
|
|
||||||
viewDir = repoDirModel.data(index, REPODIRMODEL_ROLE_PATH).toString();
|
|
||||||
setStatus(viewDir);
|
|
||||||
updateFileView();
|
updateFileView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1814,7 +1822,7 @@ void MainWindow::on_actionOpenFolder_triggered()
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void MainWindow::on_actionRenameFolder_triggered()
|
void MainWindow::on_actionRenameFolder_triggered()
|
||||||
{
|
{
|
||||||
pathset_t paths;
|
stringset_t paths;
|
||||||
getSelectionPaths(paths);
|
getSelectionPaths(paths);
|
||||||
|
|
||||||
if(paths.size()!=1)
|
if(paths.size()!=1)
|
||||||
|
15
MainWindow.h
15
MainWindow.h
@ -17,6 +17,9 @@ namespace Ui {
|
|||||||
|
|
||||||
class QStringList;
|
class QStringList;
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// RepoFile
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
struct RepoFile
|
struct RepoFile
|
||||||
{
|
{
|
||||||
enum EntryType
|
enum EntryType
|
||||||
@ -107,6 +110,9 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
// MainWindow
|
||||||
|
//////////////////////////////////////////////////////////////////////////
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -117,7 +123,7 @@ public:
|
|||||||
bool diffFile(QString repoFile);
|
bool diffFile(QString repoFile);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef QSet<QString> pathset_t;
|
typedef QSet<QString> stringset_t;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool refresh();
|
bool refresh();
|
||||||
@ -134,7 +140,7 @@ private:
|
|||||||
void getSelectionFilenames(QStringList &filenames, int includeMask=RepoFile::TYPE_ALL, bool allIfEmpty=false);
|
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 getFileViewSelection(QStringList &filenames, int includeMask=RepoFile::TYPE_ALL, bool allIfEmpty=false);
|
||||||
void getDirViewSelection(QStringList &filenames, int includeMask=RepoFile::TYPE_ALL, bool allIfEmpty=false);
|
void getDirViewSelection(QStringList &filenames, int includeMask=RepoFile::TYPE_ALL, bool allIfEmpty=false);
|
||||||
void getSelectionPaths(pathset_t &paths);
|
void getSelectionPaths(stringset_t &paths);
|
||||||
bool startUI();
|
bool startUI();
|
||||||
void stopUI();
|
void stopUI();
|
||||||
void enableActions(bool on);
|
void enableActions(bool on);
|
||||||
@ -170,7 +176,6 @@ private slots:
|
|||||||
|
|
||||||
// Designer slots
|
// Designer slots
|
||||||
void on_actionRefresh_triggered();
|
void on_actionRefresh_triggered();
|
||||||
|
|
||||||
void on_actionDiff_triggered();
|
void on_actionDiff_triggered();
|
||||||
void on_actionFossilUI_triggered();
|
void on_actionFossilUI_triggered();
|
||||||
void on_actionQuit_triggered();
|
void on_actionQuit_triggered();
|
||||||
@ -226,13 +231,13 @@ private:
|
|||||||
QString currentWorkspace;
|
QString currentWorkspace;
|
||||||
QStringList commitMessages;
|
QStringList commitMessages;
|
||||||
ViewMode viewMode;
|
ViewMode viewMode;
|
||||||
QString viewDir; // The directory selected in the tree
|
stringset_t selectedDirs; // The directory selected in the tree
|
||||||
|
|
||||||
// Repo State
|
// Repo State
|
||||||
typedef QList<RepoFile*> filelist_t;
|
typedef QList<RepoFile*> filelist_t;
|
||||||
typedef QMap<QString, RepoFile*> filemap_t;
|
typedef QMap<QString, RepoFile*> filemap_t;
|
||||||
filemap_t workspaceFiles;
|
filemap_t workspaceFiles;
|
||||||
pathset_t pathSet;
|
stringset_t pathSet;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
@ -200,8 +200,8 @@
|
|||||||
<addaction name="actionDiff"/>
|
<addaction name="actionDiff"/>
|
||||||
<addaction name="actionHistory"/>
|
<addaction name="actionHistory"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionTimeline"/>
|
|
||||||
<addaction name="actionFossilUI"/>
|
<addaction name="actionFossilUI"/>
|
||||||
|
<addaction name="actionTimeline"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionOpenContaining"/>
|
<addaction name="actionOpenContaining"/>
|
||||||
<addaction name="actionSettings"/>
|
<addaction name="actionSettings"/>
|
||||||
|
16
manifest
16
manifest
@ -1,14 +1,14 @@
|
|||||||
C Reorganized\sthe\smenus.\nRemoved\sdistinction\sbetween\srepositories\sand\sworkspaces\nOpen\sWorkspace\saction\smaps\sto\sFile|Open\nOpen\sWorkspace\snow\salso\s"opens"\sthe\sfossil\srepo\sif\sno\sworkspace\sis\sdetected\nAdded\s"Close\sRepo"\saction\s(File|Close)
|
C The\sFolder\sView\snow\sproperly\ssorts\sfolder\sentries\nMultiple\sselection\ssupport\sin\sthe\sFolder\sView.\sWhen\smultiple\sfolders\sare\sselected,\sthe\sfile\sview\sswitches\sto\sList\smode\n
|
||||||
D 2011-10-18T12:35:37.610
|
D 2011-10-18T13:21:14.225
|
||||||
F CommitDialog.cpp 8965e52d077c300cf1acb1b16fb2dcca5c7070f8
|
F CommitDialog.cpp 8965e52d077c300cf1acb1b16fb2dcca5c7070f8
|
||||||
F CommitDialog.h a9596d99865cf312b419d01d51334ffc916f5508
|
F CommitDialog.h a9596d99865cf312b419d01d51334ffc916f5508
|
||||||
F CommitDialog.ui 5067623f6af6f5a42c87df903278e383e945e154
|
F CommitDialog.ui 5067623f6af6f5a42c87df903278e383e945e154
|
||||||
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 1d32a9a2a76833f7d16a6507ca97b7169eb1dd09
|
F MainWindow.cpp 7d9f8914b3a16e3ab72e255f40b4c13f4e32cca3
|
||||||
F MainWindow.h 43030bed3c400aea93e988ad437ca783db7e2aa2
|
F MainWindow.h 632c5ba933ed77bf9dbe144224e1e6c16fec83e2
|
||||||
F MainWindow.ui 868c2ab8910467cfb410f3e140d997b57fc7d425
|
F MainWindow.ui c00f9d35aaf659fafee25a5504bd23b0b2ec4eb5
|
||||||
F RepoDialog.cpp 8f20e1511526973555c774350ec413dcecf51c9e
|
F RepoDialog.cpp 8f20e1511526973555c774350ec413dcecf51c9e
|
||||||
F RepoDialog.h a958c5f98f1e6882bf41dbdd2e4df3cb89700802
|
F RepoDialog.h a958c5f98f1e6882bf41dbdd2e4df3cb89700802
|
||||||
F RepoDialog.ui be7b18199c04a3003f3c7534a616cd7441b7bb0c
|
F RepoDialog.ui be7b18199c04a3003f3c7534a616cd7441b7bb0c
|
||||||
@ -175,7 +175,7 @@ F installer/fuel.iss 13b6a938bcdf273cbd3649d2549887baa1577214
|
|||||||
F installer/license.txt 4cc77b90af91e615a64ae04893fdffa7939db84c
|
F installer/license.txt 4cc77b90af91e615a64ae04893fdffa7939db84c
|
||||||
F main.cpp f67a9b5c9ca0b634b19ef08e7136032372d37f93
|
F main.cpp f67a9b5c9ca0b634b19ef08e7136032372d37f93
|
||||||
F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53
|
F resources.qrc e98383ed205f4e37100c60057e0129c3b86dea53
|
||||||
P 5fc925ac68148c69db66e88e23be196807ffec22
|
P 1fb5f07f1b18c3d7f9cf16f54cd790294001940f
|
||||||
R dd14deeace107d9d603384c1b8303b02
|
R 0460063d9dd585b587a4d174a7da0ca4
|
||||||
U kostas
|
U kostas
|
||||||
Z c13eaf4b3637295f43452645e51a80da
|
Z 0eee338bd957dfec8c6a14b15b9a11ba
|
||||||
|
@ -1 +1 @@
|
|||||||
1fb5f07f1b18c3d7f9cf16f54cd790294001940f
|
a2cba45b7a250bb1ad3ba4beb3a3a98dc7566ce0
|
Loading…
x
Reference in New Issue
Block a user