Refactored repositoryFile
FossilOrigin-Name: 880213d7d5ad220ae0a8c453e367d87f069c67b7
This commit is contained in:
16
src/Bridge.h
16
src/Bridge.h
@ -72,12 +72,21 @@ public:
|
||||
return projectName;
|
||||
}
|
||||
|
||||
const QString &getRepositoryFile() const
|
||||
{
|
||||
return repositoryFile;
|
||||
}
|
||||
|
||||
void setRepositoryFile(const QString &filename)
|
||||
{
|
||||
repositoryFile = filename;
|
||||
}
|
||||
|
||||
|
||||
bool uiRunning() const;
|
||||
bool startUI(const QString &httpPort);
|
||||
void stopUI();
|
||||
|
||||
QString repositoryFile;
|
||||
|
||||
private:
|
||||
void log(const QString &text, bool isHTML=false)
|
||||
@ -96,9 +105,8 @@ private:
|
||||
QTextBrowser *logTextBrowser;
|
||||
QString currentWorkspace;
|
||||
QString fossilPath; // The value from the settings
|
||||
|
||||
QString projectName;
|
||||
|
||||
QString repositoryFile;
|
||||
QString projectName;
|
||||
|
||||
QProcess fossilUI;
|
||||
};
|
||||
|
@ -355,9 +355,9 @@ bool MainWindow::openWorkspace(const QString &path)
|
||||
return false;
|
||||
}
|
||||
|
||||
repositoryFile = fi.absoluteFilePath();
|
||||
setRepositoryFile(fi.absoluteFilePath());
|
||||
|
||||
if(!runFossil(QStringList() << "open" << QuotePath(repositoryFile)))
|
||||
if(!runFossil(QStringList() << "open" << QuotePath(getRepositoryFile())))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
|
||||
return false;
|
||||
@ -458,10 +458,10 @@ void MainWindow::on_actionNewRepository_triggered()
|
||||
stopUI();
|
||||
on_actionClearLog_triggered();
|
||||
|
||||
repositoryFile = repo_path_info.absoluteFilePath();
|
||||
setRepositoryFile(repo_path_info.absoluteFilePath());
|
||||
|
||||
// Create repository
|
||||
if(!runFossil(QStringList() << "new" << QuotePath(repositoryFile)))
|
||||
if(!runFossil(QStringList() << "new" << QuotePath(getRepositoryFile())))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not create repository."), QMessageBox::Ok );
|
||||
return;
|
||||
@ -480,7 +480,7 @@ void MainWindow::on_actionNewRepository_triggered()
|
||||
ui->actionViewUnknown->setChecked(true);
|
||||
|
||||
// Open repo
|
||||
if(!runFossil(QStringList() << "open" << QuotePath(repositoryFile)))
|
||||
if(!runFossil(QStringList() << "open" << QuotePath(getRepositoryFile())))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
|
||||
return;
|
||||
@ -733,7 +733,7 @@ void MainWindow::scanWorkspace()
|
||||
QString fullpath = it->absoluteFilePath();
|
||||
|
||||
// Skip fossil files
|
||||
if(filename == FOSSIL_CHECKOUT1 || filename == FOSSIL_CHECKOUT2 || (!repositoryFile.isEmpty() && QFileInfo(fullpath) == QFileInfo(repositoryFile)))
|
||||
if(filename == FOSSIL_CHECKOUT1 || filename == FOSSIL_CHECKOUT2 || (!getRepositoryFile().isEmpty() && QFileInfo(fullpath) == QFileInfo(getRepositoryFile())))
|
||||
continue;
|
||||
|
||||
RepoFile *rf = new RepoFile(*it, RepoFile::TYPE_UNKNOWN, wkdir);
|
||||
@ -1033,7 +1033,7 @@ MainWindow::RepoStatus MainWindow::getRepoStatus()
|
||||
if(key=="project-name")
|
||||
projectName = value;
|
||||
else if(key=="repository")
|
||||
repositoryFile = value;
|
||||
setRepositoryFile(value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -258,15 +258,21 @@ private:
|
||||
bool abortOperation;
|
||||
|
||||
Settings &settings;
|
||||
QString repositoryFile;
|
||||
QStringList workspaceHistory;
|
||||
#ifndef BRIDGE_ENABLED
|
||||
QString projectName;
|
||||
QString currentWorkspace;
|
||||
QString repositoryFile;
|
||||
|
||||
const QString & getRepositoryFile() const { return repositoryFile; }
|
||||
void setRepositoryFile(const QString &filename) { repositoryFile = filename; }
|
||||
const QString & getProjectName() const { return projectName; }
|
||||
#else
|
||||
Bridge bridge;
|
||||
const QString & getProjectName() const { return bridge.getProjectName(); }
|
||||
const QString & getRepositoryFile() const { return bridge.getRepositoryFile(); }
|
||||
void setRepositoryFile(const QString &filename) { bridge.setRepositoryFile(filename); }
|
||||
|
||||
#endif
|
||||
ViewMode viewMode;
|
||||
stringset_t selectedDirs; // The directory selected in the tree
|
||||
|
Reference in New Issue
Block a user