Wrapped bridge member via function

FossilOrigin-Name: c48861c93293aafa6b1193a4b6892342e0ca0159
This commit is contained in:
kostas 2015-04-30 08:44:45 +00:00
parent f882d80dc0
commit a43eac0ae3
4 changed files with 57 additions and 54 deletions

View File

@ -1,5 +1,5 @@
C Moved\srepository\smodel\sdata\sto\sRepository\sclass\n
D 2015-04-30T08:34:11.227
C Wrapped\sbridge\smember\svia\sfunction
D 2015-04-30T08:44:45.045
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
@ -200,8 +200,8 @@ F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
F src/MainWindow.cpp b73396d7d6ead5421e4a2776c73eb3909fe2b36b
F src/MainWindow.h fc1a2a7afee8cea6f7d86c3a477d1687b6be3f3a
F src/MainWindow.cpp 2ba210d3d8a0a1c73c781a579b644b823af0503a
F src/MainWindow.h daf3bd6132ffb547639dda436389601450366d4b
F src/SettingsDialog.cpp a46cff5e5dd425e3dbdd15632abfd5829f5562b4
F src/SettingsDialog.h 4e2790f581e991c744ae9f86580f1972b8c7ff43
F src/Utils.cpp f78728e0817b1db23007ba0d2c5c26980ee7ebca
@ -215,7 +215,7 @@ F ui/CommitDialog.ui 6200f6cabdcf40a20812e811be28e0793f82516f
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
F ui/MainWindow.ui 8677f5c8bca5bf7561d5f64bfdd0cef5157c6ac7
F ui/SettingsDialog.ui 2b7c2870e0054b0f4106f495d85d02c0b814df8b
P f791fda7d73f7e7b71b28ecbaefd93330090a834
R 23d93d1e0a50531951ca9e8e511e4bcb
P 2e2faf9770ecdb644a4e9aaad0cc7dc050ef5f98
R fa89b242d21bce26120a2513c04b20dd
U kostas
Z 7b020d5baf7830f0328eb54332f8b242
Z 57e92e99d50c4e8ff5d8194583af8368

View File

@ -1 +1 @@
2e2faf9770ecdb644a4e9aaad0cc7dc050ef5f98
c48861c93293aafa6b1193a4b6892342e0ca0159

View File

@ -190,7 +190,7 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
uiCallback.init(this);
// Need to be before applySettings which sets the last workspace
bridge.Init(&uiCallback);
fossil().Init(&uiCallback);
applySettings();
@ -218,7 +218,7 @@ MainWindow::~MainWindow()
//-----------------------------------------------------------------------------
const QString &MainWindow::getCurrentWorkspace()
{
return bridge.getCurrentWorkspace();
return fossil().getCurrentWorkspace();
}
//-----------------------------------------------------------------------------
@ -226,13 +226,13 @@ void MainWindow::setCurrentWorkspace(const QString &workspace)
{
if(workspace.isEmpty())
{
bridge.setCurrentWorkspace("");
fossil().setCurrentWorkspace("");
return;
}
QString new_workspace = QFileInfo(workspace).absoluteFilePath();
bridge.setCurrentWorkspace(new_workspace);
fossil().setCurrentWorkspace(new_workspace);
addWorkspace(new_workspace);
@ -291,7 +291,7 @@ bool MainWindow::openWorkspace(const QString &path)
}
// Ok open the repository file
if(!bridge.openRepository(fi.absoluteFilePath(), wkspace))
if(!fossil().openRepository(fi.absoluteFilePath(), wkspace))
{
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
return false;
@ -396,13 +396,13 @@ void MainWindow::on_actionNewRepository_triggered()
// Create repository
QString repo_abs_path = repo_path_info.absoluteFilePath();
if(!bridge.newRepository(repo_abs_path))
if(!fossil().newRepository(repo_abs_path))
{
QMessageBox::critical(this, tr("Error"), tr("Could not create repository."), QMessageBox::Ok );
return;
}
if(!bridge.openRepository(repo_abs_path, wkdir))
if(!fossil().openRepository(repo_abs_path, wkdir))
{
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
return;
@ -418,14 +418,14 @@ void MainWindow::on_actionNewRepository_triggered()
//------------------------------------------------------------------------------
void MainWindow::on_actionCloseRepository_triggered()
{
if(bridge.getRepoStatus()!=REPO_OK)
if(fossil().getRepoStatus()!=REPO_OK)
return;
if(QMessageBox::Yes !=DialogQuery(this, tr("Close Workspace"), tr("Are you sure you want to close this workspace?")))
return;
// Close Repo
if(!bridge.closeRepository())
if(!fossil().closeRepository())
{
QMessageBox::critical(this, tr("Error"), tr("Cannot close the workspace.\nAre there still uncommitted changes available?"), QMessageBox::Ok );
return;
@ -447,7 +447,7 @@ void MainWindow::on_actionCloneRepository_triggered()
stopUI();
if(!bridge.cloneRepository(repository, url, url_proxy))
if(!fossil().cloneRepository(repository, url, url_proxy))
{
QMessageBox::critical(this, tr("Error"), tr("Could not clone the repository"), QMessageBox::Ok);
return;
@ -551,7 +551,7 @@ bool MainWindow::refresh()
QString title = "Fuel";
// Load repository info
RepoStatus st = bridge.getRepoStatus();
RepoStatus st = fossil().getRepoStatus();
if(st==REPO_NOT_FOUND)
{
@ -577,8 +577,8 @@ bool MainWindow::refresh()
setStatus("");
enableActions(true);
if(!bridge.getProjectName().isEmpty())
title += " - " + bridge.getProjectName();
if(!fossil().getProjectName().isEmpty())
title += " - " + fossil().getProjectName();
setWindowTitle(title);
return true;
@ -596,7 +596,7 @@ void MainWindow::scanWorkspace()
// Retrieve the status of files tracked by fossil
QStringList res;
if(!bridge.listFiles(res))
if(!fossil().listFiles(res))
return;
bool scan_files = ui->actionViewUnknown->isChecked();
@ -635,7 +635,7 @@ void MainWindow::scanWorkspace()
QString fullpath = it->absoluteFilePath();
// Skip fossil files
if(filename == FOSSIL_CHECKOUT1 || filename == FOSSIL_CHECKOUT2 || (!bridge.getRepositoryFile().isEmpty() && QFileInfo(fullpath) == QFileInfo(bridge.getRepositoryFile())))
if(filename == FOSSIL_CHECKOUT1 || filename == FOSSIL_CHECKOUT2 || (!fossil().getRepositoryFile().isEmpty() && QFileInfo(fullpath) == QFileInfo(fossil().getRepositoryFile())))
continue;
RepoFile *rf = new RepoFile(*it, RepoFile::TYPE_UNKNOWN, wkdir);
@ -718,7 +718,7 @@ void MainWindow::scanWorkspace()
}
// Load the stash
bridge.stashList(getRepo().stashMap);
fossil().stashList(getRepo().stashMap);
// Update the file item model
_done:
@ -777,7 +777,7 @@ void MainWindow::updateDirView()
header << tr("Folders");
getRepo().repoDirModel.setHorizontalHeaderLabels(header);
QStandardItem *root = new QStandardItem(QIcon(":icons/icons/My Documents-01.png"), bridge.getProjectName());
QStandardItem *root = new QStandardItem(QIcon(":icons/icons/My Documents-01.png"), fossil().getProjectName());
root->setData(""); // Empty Path
root->setEditable(false);
@ -1201,7 +1201,7 @@ void MainWindow::getStashViewSelection(QStringList &stashNames, bool allIfEmpty)
//------------------------------------------------------------------------------
bool MainWindow::diffFile(const QString &repoFile)
{
return bridge.diffFile(repoFile);
return fossil().diffFile(repoFile);
}
//------------------------------------------------------------------------------
@ -1219,14 +1219,14 @@ void MainWindow::on_actionDiff_triggered()
bool MainWindow::startUI()
{
QString port = settings.GetValue(FUEL_SETTING_HTTP_PORT).toString();
bool started = bridge.startUI(port);
bool started = fossil().startUI(port);
ui->actionFossilUI->setChecked(started);
return started;
}
//------------------------------------------------------------------------------
void MainWindow::stopUI()
{
bridge.stopUI();
fossil().stopUI();
ui->webView->load(QUrl("about:blank"));
ui->actionFossilUI->setChecked(false);
}
@ -1234,7 +1234,7 @@ void MainWindow::stopUI()
//------------------------------------------------------------------------------
bool MainWindow::uiRunning() const
{
return bridge.uiRunning();
return fossil().uiRunning();
}
//------------------------------------------------------------------------------
@ -1306,7 +1306,7 @@ void MainWindow::on_actionPush_triggered()
return;
}
bridge.pushRepository();
fossil().pushRepository();
}
//------------------------------------------------------------------------------
@ -1320,7 +1320,7 @@ void MainWindow::on_actionPull_triggered()
return;
}
bridge.pullRepository();
fossil().pullRepository();
}
//------------------------------------------------------------------------------
@ -1365,7 +1365,7 @@ void MainWindow::on_actionCommit_triggered()
if(commit_files.size() != all_modified_files.size())
files = commit_files;
bridge.commitFiles(files, msg);
fossil().commitFiles(files, msg);
refresh();
}
@ -1383,7 +1383,7 @@ void MainWindow::on_actionAdd_triggered()
return;
// Do Add
bridge.addFiles(selection);
fossil().addFiles(selection);
refresh();
}
@ -1408,7 +1408,7 @@ void MainWindow::on_actionDelete_triggered()
// Remove repository files
if(!repo_files.empty())
bridge.removeFiles(repo_files, remove_local);
fossil().removeFiles(repo_files, remove_local);
// Remove unknown local files if selected
if(remove_local)
@ -1437,7 +1437,7 @@ void MainWindow::on_actionRevert_triggered()
return;
// Do Revert
bridge.revertFiles(modified_files);
fossil().revertFiles(modified_files);
refresh();
}
@ -1466,7 +1466,7 @@ void MainWindow::on_actionRename_triggered()
}
// Do Rename
bridge.renameFile(fi_before.filePath(), fi_after.filePath(), true);
fossil().renameFile(fi_before.filePath(), fi_after.filePath(), true);
refresh();
}
@ -1498,7 +1498,7 @@ void MainWindow::on_actionUndo_triggered()
QStringList res;
// Do test Undo
bridge.undoRepository(res, true);
fossil().undoRepository(res, true);
if(res.length()>0 && res[0]=="No undo or redo is available")
return;
@ -1507,7 +1507,7 @@ void MainWindow::on_actionUndo_triggered()
return;
// Do Undo
bridge.undoRepository(res, false);
fossil().undoRepository(res, false);
refresh();
}
@ -1517,7 +1517,7 @@ void MainWindow::on_actionAbout_triggered()
{
QString fossil_ver;
if(bridge.getFossilVersion(fossil_ver))
if(fossil().getFossilVersion(fossil_ver))
fossil_ver = tr("Fossil version %0").arg(fossil_ver) + "\n";
QString qt_ver = tr("QT version %0").arg(QT_VERSION_STR) + "\n\n";
@ -1546,7 +1546,7 @@ void MainWindow::on_actionUpdate_triggered()
QStringList res;
// Do test update
if(!bridge.updateRepository(res, true))
if(!fossil().updateRepository(res, true))
return;
// Fixme: parse "changes: None. Already up-to-date" and avoid dialog
@ -1558,7 +1558,7 @@ void MainWindow::on_actionUpdate_triggered()
return;
// Do update
bridge.updateRepository(res, false);
fossil().updateRepository(res, false);
refresh();
}
@ -1569,7 +1569,7 @@ void MainWindow::loadFossilSettings()
// Also retrieve the fossil global settings
QStringList out;
if(!bridge.getFossilSettings(out))
if(!fossil().getFossilSettings(out))
return;
QStringMap kv = MakeKeyValues(out);
@ -1585,7 +1585,7 @@ void MainWindow::loadFossilSettings()
{
// Retrieve existing url
QString url;
if(bridge.getRemoteUrl(url))
if(fossil().getRemoteUrl(url))
it.value().Value = url;
continue;
}
@ -1632,14 +1632,14 @@ void MainWindow::on_actionSettings_triggered()
if(name == FOSSIL_SETTING_REMOTE_URL)
{
// Run as silent to avoid displaying credentials in the log
bridge.setRemoteUrl(it.value().Value.toString());
fossil().setRemoteUrl(it.value().Value.toString());
continue;
}
Q_ASSERT(type == Settings::Setting::TYPE_FOSSIL_GLOBAL || type == Settings::Setting::TYPE_FOSSIL_LOCAL);
QString value = it.value().Value.toString();
bridge.setFossilSetting(name, value, type == Settings::Setting::TYPE_FOSSIL_GLOBAL);
fossil().setFossilSetting(name, value, type == Settings::Setting::TYPE_FOSSIL_GLOBAL);
}
}
@ -1813,7 +1813,7 @@ void MainWindow::on_actionRenameFolder_triggered()
RepoFile *r = files_to_move[i];
const QString &new_file_path = new_paths[i] + PATH_SEPARATOR + r->getFilename();
if(!bridge.renameFile(r->getFilePath(), new_file_path, false))
if(!fossil().renameFile(r->getFilePath(), new_file_path, false))
{
log(tr("Move aborted due to errors")+"\n");
goto _exit;
@ -1936,7 +1936,7 @@ void MainWindow::on_actionNewStash_triggered()
}
// Do Stash
bridge.stashNew(stashed_files, stash_name, revert);
fossil().stashNew(stashed_files, stash_name, revert);
refresh();
}
@ -1957,7 +1957,7 @@ void MainWindow::on_actionApplyStash_triggered()
stashmap_t::iterator id_it = getRepo().stashMap.find(*it);
Q_ASSERT(id_it!=getRepo().stashMap.end());
if(!bridge.stashApply(*id_it))
if(!fossil().stashApply(*id_it))
{
log(tr("Stash application aborted due to errors")+"\n");
return;
@ -1970,7 +1970,7 @@ void MainWindow::on_actionApplyStash_triggered()
stashmap_t::iterator id_it = getRepo().stashMap.find(*it);
Q_ASSERT(id_it!=getRepo().stashMap.end());
if(!bridge.stashDrop(*id_it))
if(!fossil().stashDrop(*id_it))
{
log(tr("Stash deletion aborted due to errors")+"\n");
return;
@ -1998,7 +1998,7 @@ void MainWindow::on_actionDeleteStash_triggered()
stashmap_t::iterator id_it = getRepo().stashMap.find(*it);
Q_ASSERT(id_it!=getRepo().stashMap.end());
if(!bridge.stashDrop(*id_it))
if(!fossil().stashDrop(*id_it))
{
log(tr("Stash deletion aborted due to errors")+"\n");
return;
@ -2021,7 +2021,7 @@ void MainWindow::on_actionDiffStash_triggered()
Q_ASSERT(id_it!=getRepo().stashMap.end());
// Run diff
bridge.stashDiff(*id_it);
fossil().stashDiff(*id_it);
}
//------------------------------------------------------------------------------
@ -2134,7 +2134,7 @@ void MainWindow::dropEvent(QDropEvent *event)
return;
// Do Add
bridge.addFiles(newfiles);
fossil().addFiles(newfiles);
refresh();
}
@ -2155,7 +2155,7 @@ void MainWindow::setBusy(bool busy)
void MainWindow::onAbort()
{
operationAborted = true;
bridge.abortOperation();
fossil().abortOperation();
// FIXME: Rename this to something better, Operation Aborted
log("<br><b>* "+tr("Terminated")+" *</b><br>", true);
}

View File

@ -265,6 +265,10 @@ private:
class QShortcut *abortShortcut;
bool operationAborted;
Bridge bridge;
Bridge & fossil() { return bridge; }
const Bridge & fossil() const { return bridge; }
Repository repo;
Repository & getRepo() { return repo; }
@ -272,7 +276,6 @@ private:
QStringList workspaceHistory;
MainWinUICallback uiCallback;
Bridge bridge;
ViewMode viewMode;
};