Refactored openRepository
FossilOrigin-Name: 02a7b672e1d634b703ee5f30258153c3f4610886
This commit is contained in:
parent
68575b95cd
commit
b97434a2a4
20
manifest
20
manifest
@ -1,5 +1,5 @@
|
||||
C Fixed\sstatus\sbar\supdates
|
||||
D 2015-04-26T13:57:13.333
|
||||
C Refactored\sopenRepository
|
||||
D 2015-04-26T17:13:29.338
|
||||
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
||||
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
||||
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
||||
@ -184,8 +184,8 @@ F rsrc/icons/fuel.icns 81e535004b62db801a02f3e15d0a33afc9d4070b
|
||||
F rsrc/icons/fuel.ico eb529ab3332a17b9302ef3e851db5b9ebce2a038
|
||||
F rsrc/icons/fuel.png 40daf53b7f6bdcdd0d6aa5ef433d078ec5ea4342
|
||||
F rsrc/resources.qrc 4098be128fd6c045db933d041fe8844b14643a6f
|
||||
F src/Bridge.cpp 7c4c368c8c8923122116f9f8e1d0d3cfb037444b
|
||||
F src/Bridge.h 4e32aaea72c4ca2e5703cb8a19b67e233a7b735a
|
||||
F src/Bridge.cpp faf3de171463d77ba28948e5f40a6593090b973f
|
||||
F src/Bridge.h 78f856817740777eafc2cb3ebde876eefb8d97cb
|
||||
F src/BrowserWidget.cpp 8b8f545cdff4a4188edc698a1b4777f5df46f056
|
||||
F src/BrowserWidget.h 764d66aa9a93b890298bd0301097739cb4e16597
|
||||
F src/CloneDialog.cpp 812ef7d361c16da21540b7047c9d4d5e74f18539
|
||||
@ -200,12 +200,12 @@ F src/FileTableView.cpp 5ddf8c391c9a3ac449ec61fb1db837b577afeec2
|
||||
F src/FileTableView.h 03e56d87c2d46411b9762b87f4d301619aaf18df
|
||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||
F src/MainWindow.cpp 664178a97f540e6015efc302f019efdd90db7b1c
|
||||
F src/MainWindow.cpp 6115f40df16453946c2d1531d9f073744474dc7e
|
||||
F src/MainWindow.h 3e19e5af60fa9bf0b7049fce70e2f030f8514ac9
|
||||
F src/SettingsDialog.cpp a46cff5e5dd425e3dbdd15632abfd5829f5562b4
|
||||
F src/SettingsDialog.h 4e2790f581e991c744ae9f86580f1972b8c7ff43
|
||||
F src/Utils.cpp 9aff456712e4276b49083426301b3b96d3819c77
|
||||
F src/Utils.h c546e478a1225a28c99cd4c30f70cf9be9804a2a
|
||||
F src/Utils.cpp f78728e0817b1db23007ba0d2c5c26980ee7ebca
|
||||
F src/Utils.h 9c9ee6c918fccaded2ae212d45514de7c9527f82
|
||||
F src/main.cpp 2ac8badc2a63fa123ceae53382ce24cfe1b5a54b
|
||||
F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x
|
||||
F tools/pack.sh d7f38a498c4e9327fecd6a6e5ac27be270d43008 x
|
||||
@ -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 880213d7d5ad220ae0a8c453e367d87f069c67b7
|
||||
R 68848428b73aa9c48d56ef567d781a32
|
||||
P bf0e885bf80d28fda92ed20315d93445bb2b42a6
|
||||
R 5dd6a3a3a992f4b262039fc6c8121b23
|
||||
U kostas
|
||||
Z 42c2887151fe2c1da8c90c1b39de078e
|
||||
Z 1d7b8fe8bfa0d1e122d9f1d78dba5383
|
||||
|
@ -1 +1 @@
|
||||
bf0e885bf80d28fda92ed20315d93445bb2b42a6
|
||||
02a7b672e1d634b703ee5f30258153c3f4610886
|
@ -7,6 +7,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
#include <QTemporaryFile>
|
||||
#include "Utils.h"
|
||||
|
||||
static const unsigned char UTF8_BOM[] = { 0xEF, 0xBB, 0xBF };
|
||||
|
||||
@ -52,6 +53,25 @@ Bridge::RepoStatus Bridge::getRepoStatus()
|
||||
|
||||
return run_ok ? REPO_OK : REPO_NOT_FOUND;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
bool Bridge::openRepository(const QString& repositoryPath, const QString& workspacePath)
|
||||
{
|
||||
QFileInfo fi(repositoryPath);
|
||||
|
||||
if(!QDir::setCurrent(workspacePath) || !fi.isFile())
|
||||
return false;
|
||||
|
||||
QString abspath = fi.absoluteFilePath();
|
||||
setCurrentWorkspace(workspacePath);
|
||||
setRepositoryFile(abspath);
|
||||
|
||||
if(!runFossil(QStringList() << "open" << QuotePath(abspath)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
static QString ParseFossilQuery(QString line)
|
||||
{
|
||||
|
@ -20,9 +20,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
bool runFossil(const QStringList &args, QStringList *output, int runFlags);
|
||||
bool runFossilRaw(const QStringList &args, QStringList *output, int *exitCode, int runFlags);
|
||||
|
||||
enum RunFlags
|
||||
{
|
||||
RUNFLAGS_NONE = 0<<0,
|
||||
@ -45,6 +42,8 @@ public:
|
||||
currentWorkspace = workspace;
|
||||
}
|
||||
|
||||
bool runFossil(const QStringList &args, QStringList *output=0, int runFlags=RUNFLAGS_NONE);
|
||||
bool runFossilRaw(const QStringList &args, QStringList *output, int *exitCode, int runFlags);
|
||||
|
||||
static bool isWorkspace(const QString &path);
|
||||
enum RepoStatus
|
||||
@ -83,6 +82,8 @@ public:
|
||||
}
|
||||
|
||||
|
||||
bool openRepository(const QString &repositoryPath, const QString& workspacePath);
|
||||
|
||||
bool uiRunning() const;
|
||||
bool startUI(const QString &httpPort);
|
||||
void stopUI();
|
||||
|
@ -55,21 +55,6 @@ enum
|
||||
REPODIRMODEL_ROLE_PATH = Qt::UserRole+1
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
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;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef QMap<QString, QString> QStringMap;
|
||||
static QStringMap MakeKeyValues(QStringList lines)
|
||||
@ -347,14 +332,15 @@ bool MainWindow::openWorkspace(const QString &path)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef BRIDGE_ENABLED
|
||||
// Ok open the fossil
|
||||
setCurrentWorkspace(wkspace);
|
||||
if(!QDir::setCurrent(wkspace))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not change current directory"), QMessageBox::Ok );
|
||||
return false;
|
||||
}
|
||||
|
||||
setCurrentWorkspace(wkspace);
|
||||
setRepositoryFile(fi.absoluteFilePath());
|
||||
|
||||
if(!runFossil(QStringList() << "open" << QuotePath(getRepositoryFile())))
|
||||
@ -362,6 +348,13 @@ bool MainWindow::openWorkspace(const QString &path)
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if(!bridge.openRepository(fi.absoluteFilePath(), wkspace))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"), tr("Could not open repository."), QMessageBox::Ok );
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -14,6 +14,21 @@ QMessageBox::StandardButton DialogQuery(QWidget *parent, const QString &title, c
|
||||
return res;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
QString QuotePath(const QString &path)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
QStringList QuotePaths(const QStringList &paths)
|
||||
{
|
||||
QStringList res;
|
||||
for(int i=0; i<paths.size(); ++i)
|
||||
res.append(QuotePath(paths[i]));
|
||||
return res;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
#if 0 // Unused
|
||||
#include <QInputDialog>
|
||||
@ -158,7 +173,7 @@ bool ShowExplorerMenu(HWND hwnd, const QString &path, const QPoint &qpoint)
|
||||
// IShellFolder interface.
|
||||
//
|
||||
bool bResult = false;
|
||||
|
||||
|
||||
LPMALLOC pMalloc;
|
||||
if (!SUCCEEDED (SHGetMalloc (&pMalloc)))
|
||||
return bResult;
|
||||
|
@ -5,6 +5,9 @@
|
||||
#include <QMessageBox>
|
||||
|
||||
QMessageBox::StandardButton DialogQuery(QWidget *parent, const QString &title, const QString &query, QMessageBox::StandardButtons buttons = QMessageBox::Yes|QMessageBox::No);
|
||||
QString QuotePath(const QString &path);
|
||||
QStringList QuotePaths(const QStringList &paths);
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
bool ShowExplorerMenu(HWND hwnd, const QString &path, const QPoint &qpoint);
|
||||
|
Loading…
x
Reference in New Issue
Block a user