Implemented CommitAction, DeleteAction, RevertAction, NewRepository, OpenRepository
New Action: Open containing folder New filetypes ADDED, DELETED We now detect invalid or outdated repositories FossilOrigin-Name: 2ac3cf9717f3529f809ffde1e802295988dfda05
This commit is contained in:
389
MainWindow.cpp
389
MainWindow.cpp
@ -6,9 +6,20 @@
|
||||
#include <QSettings>
|
||||
#include <QDesktopServices>
|
||||
#include <QDateTime>
|
||||
#include <QLabel>
|
||||
#include <QTemporaryFile>
|
||||
#include <QMessageBox>
|
||||
#include <QUrl>
|
||||
#include "CommitDialog.h"
|
||||
#include "FileActionDialog.h"
|
||||
|
||||
#define SILENT_STATUS true
|
||||
#define COUNTOF(array) (sizeof(array)/sizeof(array[0]))
|
||||
|
||||
#define DEV_SETTINGS
|
||||
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_STATUS,
|
||||
@ -18,6 +29,20 @@ enum
|
||||
COLUMN_MODIFIED
|
||||
};
|
||||
|
||||
static QString QuotePath(const QString &path)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
static QStringList QuotePaths(const QStringList &paths)
|
||||
{
|
||||
QStringList res;
|
||||
for(int i=0; i<paths.size(); ++i)
|
||||
res.append(QuotePath(paths[i]));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
@ -25,19 +50,31 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->tableView->setModel(&itemModel);
|
||||
itemModel.setHorizontalHeaderLabels(QStringList() << tr("S") << tr("Path") << tr("File") << tr("Ext") << tr("Modified") );
|
||||
|
||||
ui->tableView->addAction(ui->actionDiff);
|
||||
ui->tableView->addAction(ui->actionHistory);
|
||||
ui->tableView->addAction(ui->actionOpenFile);
|
||||
ui->tableView->addAction(ui->actionOpenContaining);
|
||||
ui->tableView->addAction(ui->actionAdd);
|
||||
ui->tableView->addAction(ui->actionDelete);
|
||||
ui->tableView->addAction(ui->actionRename);
|
||||
|
||||
statusLabel = new QLabel();
|
||||
statusLabel->setMinimumSize( statusLabel->sizeHint() );
|
||||
ui->statusBar->addWidget( statusLabel, 1 );
|
||||
|
||||
settingsFile = QDir::homePath() + QDir::separator() + ".fuelrc";
|
||||
currentWorkspace = 0;
|
||||
loadSettings();
|
||||
|
||||
#ifdef DEV_SETTINGS
|
||||
if(workspaces.empty())
|
||||
workspaces.append("/home/kostas/tmp/cheesy-fos");
|
||||
workspaces.append("/home/kostas/tmp/testfossil");
|
||||
|
||||
fossilPath = "fossil";
|
||||
#else
|
||||
loadSettings();
|
||||
#endif
|
||||
|
||||
refresh();
|
||||
}
|
||||
@ -46,7 +83,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
stopUI();
|
||||
#ifndef DEV_SETTINGS
|
||||
saveSettings();
|
||||
#endif
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@ -59,11 +98,12 @@ void MainWindow::on_actionRefresh_triggered()
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionOpen_triggered()
|
||||
{
|
||||
QString path = QFileDialog::getExistingDirectory (this, tr("Fossil Checkout"));
|
||||
QString path = QFileDialog::getExistingDirectory(this, tr("Fossil Checkout"));
|
||||
if(!path.isNull())
|
||||
{
|
||||
workspaces.append(path);
|
||||
currentWorkspace = workspaces.size()-1;
|
||||
on_actionClearLog_triggered();
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
@ -94,12 +134,58 @@ static void RecurseDirectory(QFileInfoList &entries, const QString& dirPath, con
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::enableActions(bool on)
|
||||
{
|
||||
ui->actionCommit->setEnabled(on);
|
||||
ui->actionDiff->setEnabled(on);
|
||||
ui->actionAdd->setEnabled(on);
|
||||
ui->actionDelete->setEnabled(on);
|
||||
ui->actionPush->setEnabled(on);
|
||||
ui->actionPull->setEnabled(on);
|
||||
ui->actionRename->setEnabled(on);
|
||||
ui->actionHistory->setEnabled(on);
|
||||
ui->actionFossilUI->setEnabled(on);
|
||||
ui->actionRevert->setEnabled(on);
|
||||
ui->actionTimeline->setEnabled(on);
|
||||
ui->actionOpenFile->setEnabled(on);
|
||||
ui->actionOpenContaining->setEnabled(on);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::refresh()
|
||||
{
|
||||
// Load repository info
|
||||
updateStatus();
|
||||
RepoStatus st = getRepoStatus();
|
||||
|
||||
if(st==REPO_NOT_FOUND)
|
||||
{
|
||||
setStatus(tr("No checkout detected."));
|
||||
enableActions(false);
|
||||
itemModel.removeRows(0, itemModel.rowCount());
|
||||
return;
|
||||
}
|
||||
else if(st==REPO_OLD_SCHEMA)
|
||||
{
|
||||
setStatus(tr("Old fossil schema detected. Consider running rebuild."));
|
||||
enableActions(false);
|
||||
itemModel.removeRows(0, itemModel.rowCount());
|
||||
return;
|
||||
}
|
||||
|
||||
scanWorkspace();
|
||||
setStatus("");
|
||||
enableActions(true);
|
||||
|
||||
QString title = "Fuel";
|
||||
if(!projectName.isEmpty())
|
||||
title += " - "+projectName;
|
||||
|
||||
setWindowTitle(title);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::scanWorkspace()
|
||||
{
|
||||
// Scan all workspace files
|
||||
QFileInfoList all_files;
|
||||
QString wkdir = getCurrentWorkspace();
|
||||
@ -109,7 +195,6 @@ void MainWindow::refresh()
|
||||
for(QFileInfoList::iterator it=all_files.begin(); it!=all_files.end(); ++it)
|
||||
{
|
||||
QString filename = it->fileName();
|
||||
QString qqq = it->absoluteFilePath();
|
||||
|
||||
// Skip fossil files
|
||||
if(filename == "_FOSSIL_" || (!repositoryFile.isEmpty() && it->absoluteFilePath()==repositoryFile))
|
||||
@ -122,7 +207,7 @@ void MainWindow::refresh()
|
||||
|
||||
// Retrieve the status of files tracked by fossil
|
||||
QStringList res;
|
||||
if(!runFossil(res, QStringList() << "ls" << "-l"))
|
||||
if(!runFossil(res, QStringList() << "ls" << "-l", SILENT_STATUS))
|
||||
return;
|
||||
|
||||
for(QStringList::iterator it=res.begin(); it!=res.end(); ++it)
|
||||
@ -136,6 +221,10 @@ void MainWindow::refresh()
|
||||
|
||||
if(status_text=="EDITED")
|
||||
type = FileEntry::TYPE_EDITTED;
|
||||
if(status_text=="ADDED")
|
||||
type = FileEntry::TYPE_ADDED;
|
||||
if(status_text=="DELETED")
|
||||
type = FileEntry::TYPE_DELETED;
|
||||
else if(status_text=="UNCHANGED")
|
||||
type = FileEntry::TYPE_UNCHANGED;
|
||||
|
||||
@ -148,35 +237,39 @@ void MainWindow::refresh()
|
||||
}
|
||||
|
||||
// Update the model
|
||||
itemModel.clear();
|
||||
itemModel.setHorizontalHeaderLabels(QStringList() << "S" << "Path" << "File" << "Ext" << "Modified" );
|
||||
// Clear all rows (except header)
|
||||
itemModel.removeRows(0, itemModel.rowCount());
|
||||
|
||||
struct { FileEntry::EntryType type; const char *tag; const char *icon; }
|
||||
stats[]=
|
||||
{
|
||||
{ FileEntry::TYPE_EDITTED, "E", ":icons/icons/Button Blank Yellow-01.png" },
|
||||
{ FileEntry::TYPE_UNCHANGED, "U", ":icons/icons/Button Blank Green-01.png" },
|
||||
{ FileEntry::TYPE_ADDED, "A", ":icons/icons/Button Add-01.png" },
|
||||
{ FileEntry::TYPE_DELETED, "D", ":icons/icons/Button Close-01.png" },
|
||||
};
|
||||
|
||||
size_t i=0;
|
||||
for(filemap_t::iterator it = workspaceFiles.begin(); it!=workspaceFiles.end(); ++it, ++i)
|
||||
{
|
||||
const FileEntry &e = it.value();
|
||||
switch(e.getType())
|
||||
{
|
||||
case FileEntry::TYPE_EDITTED:
|
||||
{
|
||||
QIcon modicon(":icons/icons/Button Blank Yellow-01.png");
|
||||
itemModel.setItem(i, COLUMN_STATUS, new QStandardItem(modicon, "E"));
|
||||
break;
|
||||
}
|
||||
case FileEntry::TYPE_UNCHANGED:
|
||||
{
|
||||
QIcon modicon(":icons/icons/Button Blank Green-01.png");
|
||||
itemModel.setItem(i, COLUMN_STATUS, new QStandardItem(modicon, "U"));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
QIcon modicon(":icons/icons/Button Blank Gray-01.png");
|
||||
itemModel.setItem(i, COLUMN_STATUS, new QStandardItem(modicon, "?"));
|
||||
}
|
||||
|
||||
// Status Column
|
||||
const char *tag = "?"; // Default Tag
|
||||
const char *icon = ":icons/icons/Button Blank Gray-01.png"; // Default icon
|
||||
|
||||
for(size_t t=0; t<COUNTOF(stats); ++t)
|
||||
{
|
||||
if(e.getType() == stats[t].type)
|
||||
{
|
||||
tag = stats[t].tag;
|
||||
icon = stats[t].icon;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
itemModel.setItem(i, COLUMN_STATUS, new QStandardItem(QIcon(icon), tag));
|
||||
|
||||
QString path = e.getFilename();
|
||||
path = path.left(path.indexOf(e.getFileInfo().fileName()));
|
||||
QFileInfo finfo = e.getFileInfo();
|
||||
@ -190,19 +283,63 @@ void MainWindow::refresh()
|
||||
|
||||
ui->tableView->resizeColumnsToContents();
|
||||
ui->tableView->resizeRowsToContents();
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
MainWindow::RepoStatus MainWindow::getRepoStatus()
|
||||
{
|
||||
QStringList res;
|
||||
int exit_code = EXIT_FAILURE;
|
||||
|
||||
QString title = "Fuel";
|
||||
if(!projectName.isEmpty())
|
||||
title += " - "+projectName;
|
||||
// We need to differentiate the reason why fossil has failed
|
||||
// so we delay processing of the exit_code
|
||||
if(!runFossil(res, QStringList() << "info", exit_code, SILENT_STATUS))
|
||||
return REPO_NOT_FOUND;
|
||||
|
||||
setWindowTitle(title);
|
||||
bool run_ok = exit_code == EXIT_SUCCESS;
|
||||
|
||||
for(QStringList::iterator it=res.begin(); it!=res.end(); ++it)
|
||||
{
|
||||
QStringList tokens = it->split(":");
|
||||
if(tokens.length()!=2)
|
||||
continue;
|
||||
QString key = tokens[0].trimmed();
|
||||
QString value = tokens[1].trimmed();
|
||||
|
||||
if(key=="fossil")
|
||||
{
|
||||
if(value=="incorrect repository schema version")
|
||||
return REPO_OLD_SCHEMA;
|
||||
else if(value=="not within an open checkout")
|
||||
return REPO_NOT_FOUND;
|
||||
}
|
||||
|
||||
if(run_ok)
|
||||
{
|
||||
if(key=="project-name")
|
||||
projectName = value;
|
||||
else if(key=="repository")
|
||||
repositoryFile = value;
|
||||
}
|
||||
}
|
||||
|
||||
return run_ok ? REPO_OK : REPO_NOT_FOUND;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::log(const QString &text)
|
||||
{
|
||||
ui->textBrowser->insertPlainText(text);
|
||||
QTextCursor c = ui->textBrowser->textCursor();
|
||||
c.movePosition(QTextCursor::End);
|
||||
ui->textBrowser->setTextCursor(c);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::Log(const QString &text)
|
||||
void MainWindow::setStatus(const QString &text)
|
||||
{
|
||||
ui->textBrowser->append(text);
|
||||
Q_ASSERT(statusLabel);
|
||||
statusLabel->setText(text);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionClearLog_triggered()
|
||||
{
|
||||
@ -210,22 +347,32 @@ void MainWindow::on_actionClearLog_triggered()
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool MainWindow::runFossil(QStringList &result, const QStringList &args)
|
||||
bool MainWindow::runFossil(QStringList &result, const QStringList &args, bool silent)
|
||||
{
|
||||
QProcess process;
|
||||
int exit_code = EXIT_FAILURE;
|
||||
if(!runFossil(result, args, exit_code, silent))
|
||||
return false;
|
||||
|
||||
return exit_code == EXIT_SUCCESS;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
// Run fossil. Returns true if execution was succesfull regardless if fossil
|
||||
// issued an error
|
||||
bool MainWindow::runFossil(QStringList &result, const QStringList &args, int &exitCode, bool silent)
|
||||
{
|
||||
QProcess process(this);
|
||||
|
||||
process.setProcessChannelMode(QProcess::MergedChannels);
|
||||
process.setWorkingDirectory(getCurrentWorkspace());
|
||||
QString wkdir = getCurrentWorkspace();
|
||||
process.setWorkingDirectory(wkdir);
|
||||
|
||||
QStringList rargs;
|
||||
rargs << args;
|
||||
if(!silent)
|
||||
log("> fossil "+args.join(" ")+"\n");
|
||||
|
||||
Log("> fossil "+rargs.join(" "));
|
||||
|
||||
process.start(fossilPath, rargs);
|
||||
process.start(fossilPath, args);
|
||||
if(!process.waitForStarted())
|
||||
{
|
||||
Log(fossilPath + " does not exist\n");
|
||||
log("Could not start fossil executable '"+fossilPath + "''\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -238,15 +385,25 @@ bool MainWindow::runFossil(QStringList &result, const QStringList &args)
|
||||
{
|
||||
QString line = it->trimmed();
|
||||
result.append(line);
|
||||
Log(line);
|
||||
if(!silent)
|
||||
log(line+"\n");
|
||||
}
|
||||
|
||||
if(process.exitStatus()!=QProcess::NormalExit)
|
||||
QProcess::ExitStatus es = process.exitStatus();
|
||||
|
||||
if(es!=QProcess::NormalExit)
|
||||
return false;
|
||||
|
||||
return process.exitCode() == EXIT_SUCCESS;
|
||||
exitCode = process.exitCode();
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::addWorkspace(const QString &dir)
|
||||
{
|
||||
workspaces.append(dir);
|
||||
currentWorkspace = workspaces.size()-1;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::loadSettings()
|
||||
{
|
||||
@ -314,9 +471,16 @@ void MainWindow::saveSettings()
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::getSelectionFilenames(QStringList &filenames, int includeMask)
|
||||
void MainWindow::getSelectionFilenames(QStringList &filenames, int includeMask, bool allIfEmpty)
|
||||
{
|
||||
QModelIndexList selection = ui->tableView->selectionModel()->selectedIndexes();
|
||||
if(selection.empty() && allIfEmpty)
|
||||
{
|
||||
ui->tableView->selectAll();
|
||||
selection = ui->tableView->selectionModel()->selectedIndexes();
|
||||
ui->tableView->clearSelection();
|
||||
}
|
||||
|
||||
for(QModelIndexList::iterator mi_it = selection.begin(); mi_it!=selection.end(); ++mi_it)
|
||||
{
|
||||
const QModelIndex &mi = *mi_it;
|
||||
@ -348,7 +512,7 @@ void MainWindow::on_actionDiff_triggered()
|
||||
for(QStringList::iterator it = selection.begin(); it!=selection.end(); ++it)
|
||||
{
|
||||
QStringList res;
|
||||
if(!runFossil(res, QStringList() << "gdiff" << *it))
|
||||
if(!runFossil(res, QStringList() << "gdiff" << QuotePath(*it)))
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -362,12 +526,12 @@ bool MainWindow::startUI()
|
||||
fossilUI.setProcessChannelMode(QProcess::MergedChannels);
|
||||
fossilUI.setWorkingDirectory(getCurrentWorkspace());
|
||||
|
||||
Log("> fossil ui");
|
||||
log("> fossil ui\n");
|
||||
|
||||
fossilUI.start(fossilPath, QStringList() << "ui");
|
||||
if(!fossilUI.waitForStarted())
|
||||
{
|
||||
Log(fossilPath + " does not exist\n");
|
||||
log(fossilPath + tr(" does not exist") +"\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -457,32 +621,12 @@ void MainWindow::on_actionPull_triggered()
|
||||
runFossil(res, QStringList() << "pull");
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::updateStatus()
|
||||
{
|
||||
QStringList res;
|
||||
if(!runFossil(res, QStringList() << "info"))
|
||||
return;
|
||||
|
||||
for(QStringList::iterator it=res.begin(); it!=res.end(); ++it)
|
||||
{
|
||||
QStringList tokens = it->split(":");
|
||||
if(tokens.length()!=2)
|
||||
continue;
|
||||
QString key = tokens[0].trimmed();
|
||||
QString value = tokens[1].trimmed();
|
||||
if(key=="project-name")
|
||||
projectName = value;
|
||||
else if(key=="repository")
|
||||
repositoryFile = value;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionCommit_triggered()
|
||||
{
|
||||
QStringList modified_files;
|
||||
getSelectionFilenames(modified_files, FileEntry::TYPE_EDITTED);
|
||||
getSelectionFilenames(modified_files, FileEntry::TYPE_REPO_MODIFIED, true);
|
||||
|
||||
if(modified_files.empty())
|
||||
return;
|
||||
@ -493,6 +637,18 @@ void MainWindow::on_actionCommit_triggered()
|
||||
|
||||
// Do commit
|
||||
commitMessages.push_front(msg);
|
||||
|
||||
{
|
||||
QTemporaryFile comment_file;
|
||||
comment_file.open();
|
||||
comment_file.write(msg.toUtf8());
|
||||
comment_file.close();
|
||||
|
||||
QStringList res;
|
||||
runFossil(res, QStringList() << "commit" << "--message-file" << QuotePath(comment_file.fileName()) << QuotePaths(modified_files) );
|
||||
}
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -505,17 +661,21 @@ void MainWindow::on_actionAdd_triggered()
|
||||
if(selection.empty())
|
||||
return;
|
||||
|
||||
if(!FileActionDialog::run("Add files", "The following files will be added. Are you sure?", selection, this))
|
||||
if(!FileActionDialog::run(tr("Add files"), tr("The following files will be added. Are you sure?"), selection, this))
|
||||
return;
|
||||
|
||||
// Do Add
|
||||
QStringList res;
|
||||
runFossil(res, QStringList() << "add" << QuotePaths(selection) );
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionDelete_triggered()
|
||||
{
|
||||
QStringList repo_files;
|
||||
getSelectionFilenames(repo_files, FileEntry::TYPE_EDITTED|FileEntry::TYPE_UNCHANGED);
|
||||
getSelectionFilenames(repo_files, FileEntry::TYPE_REPO);
|
||||
|
||||
QStringList unknown_files;
|
||||
getSelectionFilenames(unknown_files, FileEntry::TYPE_UNKNOWN);
|
||||
@ -523,24 +683,103 @@ void MainWindow::on_actionDelete_triggered()
|
||||
if(repo_files.empty() && unknown_files.empty())
|
||||
return;
|
||||
|
||||
if(!FileActionDialog::run("Delete files", "The following files will be deleted. Are you sure?", repo_files+unknown_files, this))
|
||||
if(!FileActionDialog::run(tr("Delete files"), tr("The following files will be deleted. Are you sure?"), repo_files+unknown_files, this))
|
||||
return;
|
||||
|
||||
// Do Delete
|
||||
QStringList res;
|
||||
runFossil(res, QStringList() << "delete" << QuotePaths(repo_files) );
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionRevert_triggered()
|
||||
{
|
||||
QStringList modified_files;
|
||||
getSelectionFilenames(modified_files, FileEntry::TYPE_EDITTED);
|
||||
getSelectionFilenames(modified_files, FileEntry::TYPE_ADDED|FileEntry::TYPE_EDITTED);
|
||||
|
||||
if(modified_files.empty())
|
||||
return;
|
||||
|
||||
if(!FileActionDialog::run("Revert files", "The following files will be reverted. Are you sure?", modified_files, this))
|
||||
if(!FileActionDialog::run(tr("Revert files"), tr("The following files will be reverted. Are you sure?"), modified_files, this))
|
||||
return;
|
||||
|
||||
// Do Revert
|
||||
QStringList res;
|
||||
runFossil(res, QStringList() << "revert" << QuotePaths(modified_files) );
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionNew_triggered()
|
||||
{
|
||||
QString filter(tr("Fossil Repositories (*.fossil)"));
|
||||
|
||||
QString path = QFileDialog::getSaveFileName(
|
||||
this,
|
||||
tr("New Fossil Repository"),
|
||||
QString(),
|
||||
filter,
|
||||
&filter);
|
||||
|
||||
if(path.isEmpty())
|
||||
return;
|
||||
|
||||
if(QFile::exists(path))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("A repository file already exists.\nRepository creation aborted."), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
QFileInfo path_info(path);
|
||||
Q_ASSERT(path_info.dir().exists());
|
||||
QString wkdir = path_info.absoluteDir().absolutePath();
|
||||
addWorkspace(wkdir);
|
||||
repositoryFile = path_info.absoluteFilePath();
|
||||
|
||||
// Create repo
|
||||
QStringList res;
|
||||
if(!runFossil(res, QStringList() << "new" << QuotePath(repositoryFile), false))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Repository creation failed."), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
// Open repo
|
||||
if(!runFossil(res, QStringList() << "open" << QuotePath(repositoryFile), false))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Repository checkout failed."), QMessageBox::Ok );
|
||||
return;
|
||||
}
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionClone_triggered()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionOpenContaining_triggered()
|
||||
{
|
||||
QStringList selection;
|
||||
getSelectionFilenames(selection);
|
||||
|
||||
QString target;
|
||||
|
||||
if(selection.empty())
|
||||
target = QDir::toNativeSeparators(getCurrentWorkspace());
|
||||
else
|
||||
{
|
||||
QFileInfo file_info(selection[0]);
|
||||
target = QDir::toNativeSeparators(file_info.absoluteDir().absolutePath());
|
||||
}
|
||||
|
||||
QUrl url = QUrl::fromLocalFile(target);
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
||||
|
Reference in New Issue
Block a user