Refactored and unified workspace path functions
FossilOrigin-Name: 5e89247bf2fa2cf6d5720ddf51e091319ab66459
This commit is contained in:
parent
0f4ff6d3c9
commit
48ed97dc10
22
manifest
22
manifest
@ -1,5 +1,5 @@
|
||||
C Fixed\sissue\swith\sFossil\ssettings\scontaining\sspaces\n
|
||||
D 2015-08-14T09:53:59.650
|
||||
C Refactored\sand\sunified\sworkspace\spath\sfunctions\n
|
||||
D 2015-08-14T10:00:31.654
|
||||
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
||||
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
||||
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
||||
@ -225,14 +225,14 @@ F src/FileActionDialog.cpp fcaebf9986f789b3440d5390b3458ad5f86fe0c8
|
||||
F src/FileActionDialog.h 15db1650b3a13d70bc338371e4c033c66e3b79ce
|
||||
F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
|
||||
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
||||
F src/Fossil.cpp 7127fcab4764d21dbc997630134f324e9ff76f9d
|
||||
F src/Fossil.h 40a44d2cdc7fcc39c09f8017d175cc71eac2aa96
|
||||
F src/Fossil.cpp 3cd636a3bbb73fefbb6cb2039e14b06a04bbe20e
|
||||
F src/Fossil.h 85fdba2fafe735f22ef9dee20f4fbb3f3c31e47a
|
||||
F src/FslSettingsDialog.cpp e00907d493fba469e48a008aecda88426350b5ac
|
||||
F src/FslSettingsDialog.h dfe2a61884a55a74cbb9206b6f6b482b979725e7
|
||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||
F src/MainWindow.cpp bbf6d5529f520ed80c1cea37f28cd42c52c1e85e
|
||||
F src/MainWindow.h c4518a0ba8d5ba2a128449bd8a50adff8402049d
|
||||
F src/MainWindow.cpp 02e95be5ebcd8970b3f63e3a2bcdfa269df41746
|
||||
F src/MainWindow.h f4cffbe4d360d30aa2eeaa25fc6d50d0a39c617f
|
||||
F src/RemoteDialog.cpp 8540cc5e2e41c4127ed8a028d84691604fa6ecac
|
||||
F src/RemoteDialog.h 5e0438c2bd7c79b1bb44bfbd58c2181b544a9e5d
|
||||
F src/RevisionDialog.cpp e58c4f8a704f00addebb15d521b76620fdafda79
|
||||
@ -245,8 +245,8 @@ F src/SettingsDialog.cpp 042bd3dbe715b0497541b6853a32c4d1f9ac1da9
|
||||
F src/SettingsDialog.h 5eb3ae2cbb00ab5544e1889860f5376f69fe47cd
|
||||
F src/Utils.cpp 84dab142439845a15dc6a6e8586dc5470ebdd59b
|
||||
F src/Utils.h c6341ee49a8fc35f215facb196d70bf9b1f2fc0f
|
||||
F src/Workspace.cpp 8bcbfcda28f3ae8244c29b5f2b6e6eae171bf6ca
|
||||
F src/Workspace.h 842c195cf830422f2066c7190156e7c8b82a93a1
|
||||
F src/Workspace.cpp feab8b238a99cf1a60731aedf07af96010d9795d
|
||||
F src/Workspace.h 5eccaec693bdad0e85f7f05eab4d4ba1fb70f3f2
|
||||
F src/main.cpp d8c65ea5e54102e4989fef9fd8cfd4f13ef8a8f0
|
||||
F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x
|
||||
F tools/pack.sh d7f38a498c4e9327fecd6a6e5ac27be270d43008 x
|
||||
@ -260,7 +260,7 @@ F ui/MainWindow.ui 10181826a25056ed5aba2b23a7d110159be7c043
|
||||
F ui/RemoteDialog.ui 95a4750d972ed8c49bb10b95db91ff16cfe2dd0b
|
||||
F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd
|
||||
F ui/SettingsDialog.ui 47b9a31e28ad523f14a1c4cd361270b6babbdf7d
|
||||
P 79337d9af5942ca7ace8ec49610e524a4561d3a0
|
||||
R 67d38cf40c7ebdb86a0dbe76249d8d44
|
||||
P bc8becb1aa02ed969a3330a756e6c54ab1a2a67a
|
||||
R 0d3af1bb2213b21e86edd60b6ede2498
|
||||
U Kostas
|
||||
Z bfa56307a7ad95d9ee48555c26181faf
|
||||
Z bf85cbde772d71d5ed8810b59851bc5a
|
||||
|
@ -1 +1 @@
|
||||
bc8becb1aa02ed969a3330a756e6c54ab1a2a67a
|
||||
5e89247bf2fa2cf6d5720ddf51e091319ab66459
|
@ -82,7 +82,7 @@ bool Fossil::openRepository(const QString& repositoryPath, const QString& worksp
|
||||
return false;
|
||||
|
||||
QString abspath = fi.absoluteFilePath();
|
||||
setCurrentWorkspace(workspacePath);
|
||||
setWorkspacePath(workspacePath);
|
||||
setRepositoryFile(abspath);
|
||||
|
||||
if(!runFossil(QStringList() << "open" << QuotePath(abspath)))
|
||||
@ -111,7 +111,7 @@ bool Fossil::closeRepository()
|
||||
return false;
|
||||
|
||||
stopUI();
|
||||
setCurrentWorkspace("");
|
||||
setWorkspacePath("");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -309,7 +309,7 @@ bool Fossil::removeFiles(const QStringList& fileList, bool deleteLocal)
|
||||
{
|
||||
for(int i=0; i<fileList.size(); ++i)
|
||||
{
|
||||
QFileInfo fi(getCurrentWorkspace() + QDir::separator() + fileList[i]);
|
||||
QFileInfo fi(getWorkspacePath() + QDir::separator() + fileList[i]);
|
||||
if(fi.exists())
|
||||
QFile::remove(fi.filePath());
|
||||
}
|
||||
@ -339,7 +339,7 @@ bool Fossil::renameFile(const QString &beforePath, const QString &afterPath, boo
|
||||
if(!runFossil(QStringList() << "mv" << QuotePath(beforePath) << QuotePath(afterPath)))
|
||||
return false;
|
||||
|
||||
QString wkdir = getCurrentWorkspace() + QDir::separator();
|
||||
QString wkdir = getWorkspacePath() + QDir::separator();
|
||||
|
||||
// Also rename the file
|
||||
if(renameLocal && !QFile::rename(wkdir+beforePath, wkdir+afterPath))
|
||||
@ -720,7 +720,7 @@ bool Fossil::runFossilRaw(const QStringList &args, QStringList *output, int *exi
|
||||
log("<b>> fossil "+params+"</b><br>", true);
|
||||
}
|
||||
|
||||
QString wkdir = getCurrentWorkspace();
|
||||
QString wkdir = getWorkspacePath();
|
||||
|
||||
QString fossil = getFossilPath();
|
||||
|
||||
@ -1079,7 +1079,7 @@ bool Fossil::startUI(const QString &httpPort)
|
||||
//fossilUI.setParent(parentWidget);
|
||||
|
||||
fossilUI.setProcessChannelMode(QProcess::MergedChannels);
|
||||
fossilUI.setWorkingDirectory(getCurrentWorkspace());
|
||||
fossilUI.setWorkingDirectory(getWorkspacePath());
|
||||
|
||||
log("<b>> fossil ui</b><br>", true);
|
||||
log(QObject::tr("Starting Fossil browser UI. Please wait.")+"\n");
|
||||
|
12
src/Fossil.h
12
src/Fossil.h
@ -40,7 +40,7 @@ public:
|
||||
{
|
||||
uiCallback = callback;
|
||||
fossilPath.clear();
|
||||
currentWorkspace.clear();
|
||||
workspacePath.clear();
|
||||
}
|
||||
|
||||
bool runFossil(const QStringList &args, QStringList *output=0, int runFlags=RUNFLAGS_NONE);
|
||||
@ -50,14 +50,14 @@ public:
|
||||
|
||||
RepoStatus getRepoStatus();
|
||||
|
||||
void setCurrentWorkspace(const QString &workspace)
|
||||
void setWorkspacePath(const QString &workspace)
|
||||
{
|
||||
currentWorkspace = workspace;
|
||||
workspacePath = workspace;
|
||||
}
|
||||
|
||||
const QString &getCurrentWorkspace() const
|
||||
const QString &getWorkspacePath() const
|
||||
{
|
||||
return currentWorkspace;
|
||||
return workspacePath;
|
||||
}
|
||||
|
||||
const QString &getProjectName() const
|
||||
@ -138,7 +138,7 @@ private:
|
||||
|
||||
bool operationAborted;
|
||||
UICallback *uiCallback;
|
||||
QString currentWorkspace;
|
||||
QString workspacePath;
|
||||
QString fossilPath; // The value from the settings
|
||||
QString repositoryFile;
|
||||
QString projectName;
|
||||
|
@ -321,19 +321,13 @@ MainWindow::~MainWindow()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
const QString &MainWindow::getCurrentWorkspace()
|
||||
{
|
||||
return fossil().getCurrentWorkspace();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void MainWindow::setCurrentWorkspace(const QString &workspace)
|
||||
{
|
||||
if(!getWorkspace().switchWorkspace(workspace, *settings.GetStore()))
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not change current directory to '%0'").arg(workspace), QMessageBox::Ok );
|
||||
else
|
||||
addWorkspaceHistory(fossil().getCurrentWorkspace());
|
||||
addWorkspaceHistory(getWorkspace().getPath());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -1169,7 +1163,7 @@ void MainWindow::updateSettings()
|
||||
{
|
||||
store->setArrayIndex(i);
|
||||
store->setValue("Path", workspaceHistory[i]);
|
||||
if(getCurrentWorkspace() == workspaceHistory[i])
|
||||
if(getWorkspace().getPath() == workspaceHistory[i])
|
||||
store->setValue("Active", true);
|
||||
else
|
||||
store->remove("Active");
|
||||
@ -1500,7 +1494,7 @@ void MainWindow::on_actionOpenFile_triggered()
|
||||
|
||||
for(QStringList::iterator it = selection.begin(); it!=selection.end(); ++it)
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(getCurrentWorkspace()+QDir::separator()+*it));
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(getWorkspace().getPath()+QDir::separator()+*it));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1598,7 +1592,7 @@ void MainWindow::on_actionDelete_triggered()
|
||||
{
|
||||
for(int i=0; i<unknown_files.size(); ++i)
|
||||
{
|
||||
QFileInfo fi(getCurrentWorkspace() + QDir::separator() + unknown_files[i]);
|
||||
QFileInfo fi(getWorkspace().getPath() + QDir::separator() + unknown_files[i]);
|
||||
if(fi.exists())
|
||||
QFile::remove(fi.filePath());
|
||||
}
|
||||
@ -1663,7 +1657,7 @@ void MainWindow::on_actionOpenContaining_triggered()
|
||||
QString target;
|
||||
|
||||
if(selection.empty())
|
||||
target = QDir::toNativeSeparators(getCurrentWorkspace());
|
||||
target = QDir::toNativeSeparators(getWorkspace().getPath());
|
||||
else
|
||||
{
|
||||
QFileInfo file_info(selection[0]);
|
||||
@ -1909,7 +1903,7 @@ void MainWindow::on_workspaceTreeView_doubleClicked(const QModelIndex &index)
|
||||
|
||||
if(tv.Type==WorkspaceItem::TYPE_FOLDER || tv.Type==WorkspaceItem::TYPE_WORKSPACE)
|
||||
{
|
||||
QString target = getCurrentWorkspace() + PATH_SEPARATOR + tv.Value;
|
||||
QString target = getWorkspace().getPath() + PATH_SEPARATOR + tv.Value;
|
||||
QUrl url = QUrl::fromLocalFile(target);
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
@ -2019,13 +2013,13 @@ void MainWindow::on_actionRenameFolder_triggered()
|
||||
// First ensure that the target directories exist, and if not make them
|
||||
for(int i=0; i<files_to_move.length(); ++i)
|
||||
{
|
||||
QString target_path = QDir::cleanPath(getCurrentWorkspace() + PATH_SEPARATOR + new_paths[i] + PATH_SEPARATOR);
|
||||
QString target_path = QDir::cleanPath(getWorkspace().getPath() + PATH_SEPARATOR + new_paths[i] + PATH_SEPARATOR);
|
||||
QDir target(target_path);
|
||||
|
||||
if(target.exists())
|
||||
continue;
|
||||
|
||||
QDir wkdir(getCurrentWorkspace());
|
||||
QDir wkdir(getWorkspace().getPath());
|
||||
Q_ASSERT(wkdir.exists());
|
||||
|
||||
log(tr("Creating folder '%0'").arg(target_path)+"\n");
|
||||
@ -2244,7 +2238,7 @@ void MainWindow::onFileViewDragOut()
|
||||
|
||||
QList<QUrl> urls;
|
||||
foreach(QString f, filenames)
|
||||
urls.append(QUrl::fromLocalFile(getCurrentWorkspace()+QDir::separator()+f));
|
||||
urls.append(QUrl::fromLocalFile(getWorkspace().getPath()+QDir::separator()+f));
|
||||
|
||||
QMimeData *mime_data = new QMimeData;
|
||||
mime_data->setUrls(urls);
|
||||
@ -2276,7 +2270,7 @@ void MainWindow::on_fileTableView_customContextMenuRequested(const QPoint &pos)
|
||||
|
||||
if(fnames.size()==1)
|
||||
{
|
||||
QString fname = getCurrentWorkspace() + PATH_SEPARATOR + fnames[0];
|
||||
QString fname = getWorkspace().getPath() + PATH_SEPARATOR + fnames[0];
|
||||
fname = QDir::toNativeSeparators(fname);
|
||||
if(ShowExplorerMenu((HWND)winId(), fname, gpos))
|
||||
refresh();
|
||||
@ -2361,11 +2355,11 @@ void MainWindow::dropEvent(QDropEvent *event)
|
||||
QString abspath = finfo.absoluteFilePath();
|
||||
|
||||
// Within the current workspace ?
|
||||
if(abspath.indexOf(getCurrentWorkspace())!=0)
|
||||
if(abspath.indexOf(getWorkspace().getPath())!=0)
|
||||
continue; // skip
|
||||
|
||||
// Remove workspace from full path
|
||||
QString wkpath = abspath.right(abspath.length()-getCurrentWorkspace().length()-1);
|
||||
QString wkpath = abspath.right(abspath.length()-getWorkspace().getPath().length()-1);
|
||||
|
||||
newfiles.append(wkpath);
|
||||
}
|
||||
@ -2885,7 +2879,7 @@ void MainWindow::invokeCustomAction(int actionId)
|
||||
}
|
||||
}
|
||||
|
||||
const QString &wkdir = fossil().getCurrentWorkspace();
|
||||
const QString &wkdir = getWorkspace().getPath();
|
||||
|
||||
SpawnExternalProcess(this, cust_action.Command, file_selection, path_selection, wkdir, uiCallback);
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ private:
|
||||
void applySettings();
|
||||
void updateSettings();
|
||||
void updateRevision(const QString& revision);
|
||||
const QString &getCurrentWorkspace();
|
||||
void setCurrentWorkspace(const QString &workspace);
|
||||
void log(const QString &text, bool isHTML=false);
|
||||
void setStatus(const QString &text);
|
||||
|
@ -32,7 +32,7 @@ void Workspace::clearState()
|
||||
//------------------------------------------------------------------------------
|
||||
void Workspace::storeWorkspace(QSettings &store)
|
||||
{
|
||||
QString workspace = fossil().getCurrentWorkspace();
|
||||
QString workspace = fossil().getWorkspacePath();
|
||||
if(workspace.isEmpty())
|
||||
return;
|
||||
|
||||
@ -66,7 +66,7 @@ bool Workspace::switchWorkspace(const QString& workspace, QSettings &store)
|
||||
clearState();
|
||||
remotes.clear();
|
||||
|
||||
fossil().setCurrentWorkspace("");
|
||||
fossil().setWorkspacePath("");
|
||||
if(workspace.isEmpty())
|
||||
return true;
|
||||
|
||||
@ -75,7 +75,7 @@ bool Workspace::switchWorkspace(const QString& workspace, QSettings &store)
|
||||
if(!QDir::setCurrent(new_workspace))
|
||||
return false;
|
||||
|
||||
fossil().setCurrentWorkspace(new_workspace);
|
||||
fossil().setWorkspacePath(new_workspace);
|
||||
|
||||
// Load Remotes
|
||||
QString workspace_hash = HashString(QDir::toNativeSeparators(new_workspace));
|
||||
@ -161,7 +161,7 @@ void Workspace::scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModifie
|
||||
{
|
||||
// Scan all workspace files
|
||||
QFileInfoList all_files;
|
||||
QString wkdir = fossil().getCurrentWorkspace();
|
||||
QString wkdir = fossil().getWorkspacePath();
|
||||
|
||||
if(wkdir.isEmpty())
|
||||
return;
|
||||
|
@ -122,7 +122,6 @@ class Workspace
|
||||
{
|
||||
public:
|
||||
Workspace();
|
||||
|
||||
~Workspace();
|
||||
|
||||
typedef QList<WorkspaceFile*> filelist_t;
|
||||
@ -133,6 +132,7 @@ public:
|
||||
Fossil & fossil() { return bridge; }
|
||||
const Fossil & fossil() const { return bridge; }
|
||||
|
||||
const QString & getPath() const { return fossil().getWorkspacePath(); }
|
||||
bool switchWorkspace(const QString &workspace, QSettings &store);
|
||||
void scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModified, bool scanUnchanged, const QString &ignoreGlob, UICallback &uiCallback, bool &operationAborted);
|
||||
|
||||
@ -155,8 +155,7 @@ public:
|
||||
QUrl getRemoteDefault() const;
|
||||
Remote * findRemote(const QUrl& url);
|
||||
|
||||
|
||||
void storeWorkspace(QSettings &store);
|
||||
void storeWorkspace(QSettings &store);
|
||||
private:
|
||||
static bool scanDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir, const QString ignoreSpec, const bool& abort, UICallback &uiCallback);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user