Moved currentWorkspace to Bridge

FossilOrigin-Name: a7ac992f6f87abee63c74696cb372a1564250103
This commit is contained in:
kostas
2015-04-26 11:13:24 +00:00
parent 39745ab55a
commit 17736bd719
5 changed files with 35 additions and 15 deletions

View File

@ -56,6 +56,15 @@ public:
RepoStatus getRepoStatus();
void setCurrentWorkspace(const QString &workspace)
{
currentWorkspace = workspace;
}
const QString &getCurrentWorkspace()
{
return currentWorkspace;
}
bool uiRunning() const;
@ -72,10 +81,6 @@ private:
(*logCallback)(logTextBrowser, text, isHTML);
}
const QString &getCurrentWorkspace()
{
return currentWorkspace;
}
QString getFossilPath();

View File

@ -262,7 +262,11 @@ MainWindow::~MainWindow()
//-----------------------------------------------------------------------------
const QString &MainWindow::getCurrentWorkspace()
{
#ifndef BRIDGE_ENABLED
return currentWorkspace;
#else
return bridge.getCurrentWorkspace();
#endif
}
//-----------------------------------------------------------------------------
@ -270,13 +274,22 @@ void MainWindow::setCurrentWorkspace(const QString &workspace)
{
if(workspace.isEmpty())
{
#ifndef BRIDGE_ENABLED
currentWorkspace.clear();
#else
bridge.setCurrentWorkspace("");
#endif
return;
}
QString new_workspace = QFileInfo(workspace).absoluteFilePath();
#ifndef BRIDGE_ENABLED
currentWorkspace = new_workspace;
#else
bridge.setCurrentWorkspace(new_workspace);
#endif
addWorkspace(new_workspace);
if(!QDir::setCurrent(new_workspace))
@ -2736,11 +2749,11 @@ void MainWindow::dropEvent(QDropEvent *event)
QString abspath = finfo.absoluteFilePath();
// Within the current workspace ?
if(abspath.indexOf(currentWorkspace)!=0)
if(abspath.indexOf(getCurrentWorkspace())!=0)
continue; // skip
// Remove workspace from full path
QString wkpath = abspath.right(abspath.length()-currentWorkspace.length()-1);
QString wkpath = abspath.right(abspath.length()-getCurrentWorkspace().length()-1);
newfiles.append(wkpath);
}

View File

@ -261,7 +261,9 @@ private:
QString projectName;
QString repositoryFile;
QStringList workspaceHistory;
#ifndef BRIDGE_ENABLED
QString currentWorkspace;
#endif
ViewMode viewMode;
stringset_t selectedDirs; // The directory selected in the tree