Initial work on multiple remotes
FossilOrigin-Name: 9674708cb5f2e8543e01d64211b6768d2cb726d6
This commit is contained in:
parent
b1276a7cd1
commit
06695db9fe
7
fuel.pro
7
fuel.pro
@ -7,10 +7,6 @@ QT = core gui webkit
|
|||||||
contains(QT_VERSION, ^5\\..*) {
|
contains(QT_VERSION, ^5\\..*) {
|
||||||
QT += widgets webkitwidgets
|
QT += widgets webkitwidgets
|
||||||
QT -= quick multimediawidgets opengl printsupport qml multimedia positioning sensors
|
QT -= quick multimediawidgets opengl printsupport qml multimedia positioning sensors
|
||||||
|
|
||||||
unix:!macx {
|
|
||||||
QT += dbus
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TARGET = Fuel
|
TARGET = Fuel
|
||||||
@ -104,11 +100,12 @@ HEADERS += ext/qtkeychain/keychain.h \
|
|||||||
ext/qtkeychain/qkeychain_export.h
|
ext/qtkeychain/qkeychain_export.h
|
||||||
|
|
||||||
unix:!macx {
|
unix:!macx {
|
||||||
|
QT += dbus
|
||||||
|
|
||||||
SOURCES += ext/qtkeychain/keychain_unix.cpp \
|
SOURCES += ext/qtkeychain/keychain_unix.cpp \
|
||||||
ext/qtkeychain/gnomekeyring.cpp
|
ext/qtkeychain/gnomekeyring.cpp
|
||||||
|
|
||||||
HEADERS += ext/qtkeychain/gnomekeyring_p.h
|
HEADERS += ext/qtkeychain/gnomekeyring_p.h
|
||||||
|
|
||||||
DBUS_INTERFACES += ext/qtkeychain/org.kde.KWallet.xml
|
DBUS_INTERFACES += ext/qtkeychain/org.kde.KWallet.xml
|
||||||
}
|
}
|
||||||
|
|
||||||
|
28
manifest
28
manifest
@ -1,5 +1,5 @@
|
|||||||
C Working\sFuel-managed\sremote-url\nNo\smore\sFOSSIL_SETTING_REMOTE_URL\suglyness\n
|
C Initial\swork\son\smultiple\sremotes\n
|
||||||
D 2015-05-25T19:59:37.320
|
D 2015-05-28T19:29:09.765
|
||||||
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
F .travis.yml 77966888a81c4ceee1fcc79bce842c9667ad8a35
|
||||||
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
F debian/changelog eb4304dfcb6bb66850ec740838090eb50ce1249b
|
||||||
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
F debian/compat b6abd567fa79cbe0196d093a067271361dc6ca8b
|
||||||
@ -37,7 +37,7 @@ F ext/qtkeychain/qkeychain_export.h d756528188ef9bf3c4461ecc80048f06c362b54b
|
|||||||
F ext/qtkeychain/testclient.cpp cb1290a9584b627306a7bfdf1c02a8bbae503f5f
|
F ext/qtkeychain/testclient.cpp cb1290a9584b627306a7bfdf1c02a8bbae503f5f
|
||||||
F ext/qtkeychain/translations/qtkeychain_de.ts 0a70c8205c066c30ed8172f0670942de1fc5eede
|
F ext/qtkeychain/translations/qtkeychain_de.ts 0a70c8205c066c30ed8172f0670942de1fc5eede
|
||||||
F ext/qtkeychain/translations/qtkeychain_ro.ts f16939382fd1a047b0692426bc82847347f14b32
|
F ext/qtkeychain/translations/qtkeychain_ro.ts f16939382fd1a047b0692426bc82847347f14b32
|
||||||
F fuel.pro 0522a3f57fa34122d47ccd0a62bf14aeb1caeb03
|
F fuel.pro d67b78b5257d5d39bf4d0c2a4b9fbba1dbdd7005
|
||||||
F intl/convert.bat 4222ae403418381452b843929d15259ea9850ab1 x
|
F intl/convert.bat 4222ae403418381452b843929d15259ea9850ab1 x
|
||||||
F intl/convert.sh 2ca2179ff53e727f241925b75e19182607883c45 x
|
F intl/convert.sh 2ca2179ff53e727f241925b75e19182607883c45 x
|
||||||
F intl/de_DE.ts e2faceab920ac60c97bbc6fba038e261d51fc741
|
F intl/de_DE.ts e2faceab920ac60c97bbc6fba038e261d51fc741
|
||||||
@ -224,22 +224,22 @@ F src/FslSettingsDialog.cpp 2531d3709f0eab66651671e3edead2ca720d07d5
|
|||||||
F src/FslSettingsDialog.h dfe2a61884a55a74cbb9206b6f6b482b979725e7
|
F src/FslSettingsDialog.h dfe2a61884a55a74cbb9206b6f6b482b979725e7
|
||||||
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
F src/LoggedProcess.cpp 2a1e5c94bc1e57c8984563e66c210e43a14dc60c
|
||||||
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
F src/LoggedProcess.h 85df7c635c807a5a0e8c4763f17a0752aaff7261
|
||||||
F src/MainWindow.cpp 08e207cc8ef8d59ab1ce92157d8a243bd932ae06
|
F src/MainWindow.cpp 351608ee4b8c21add1bdac28cf939e9cd6624924
|
||||||
F src/MainWindow.h f5981b4144debe4b624afd52223f24fb7b7f2324
|
F src/MainWindow.h 7695cd800ee82df10dd7c17016152aff92572d39
|
||||||
F src/RemoteDialog.cpp 03a6cf213d6dde68ee0ceb8d122e05da2d491724
|
F src/RemoteDialog.cpp 7f4272117080260c31c748e2ada3e33adc024826
|
||||||
F src/RemoteDialog.h 364e867210ec55d8d6d23d0c8078f2517b2389ec
|
F src/RemoteDialog.h 5e0438c2bd7c79b1bb44bfbd58c2181b544a9e5d
|
||||||
F src/RevisionDialog.cpp 51065c65a07c118dd1a7363da4a55a135d1c6c9c
|
F src/RevisionDialog.cpp 51065c65a07c118dd1a7363da4a55a135d1c6c9c
|
||||||
F src/RevisionDialog.h b718c3009342eaabad39c8a11a253a4e4fef7a73
|
F src/RevisionDialog.h b718c3009342eaabad39c8a11a253a4e4fef7a73
|
||||||
F src/SearchBox.cpp d4209c575baa9933e1ce5ed376e785b289a145ba
|
F src/SearchBox.cpp d4209c575baa9933e1ce5ed376e785b289a145ba
|
||||||
F src/SearchBox.h 0c78d3a68136dab3e0e71b83ae36f22bd2688ab2
|
F src/SearchBox.h 0c78d3a68136dab3e0e71b83ae36f22bd2688ab2
|
||||||
F src/Settings.cpp 7a674604caa9d9f5ffb6b73d95745bde09525389
|
F src/Settings.cpp 7a674604caa9d9f5ffb6b73d95745bde09525389
|
||||||
F src/Settings.h 376d0a115237edfb91dee774b10996d35ed197ec
|
F src/Settings.h 883ac5c0f38a6ac93b400b7b96447b017ee50c06
|
||||||
F src/SettingsDialog.cpp 25be4c351dd21ea9132321944f42dc0bc22fb128
|
F src/SettingsDialog.cpp 25be4c351dd21ea9132321944f42dc0bc22fb128
|
||||||
F src/SettingsDialog.h b324dfd77ca3ad24fd83588aaf79a7e4c291e716
|
F src/SettingsDialog.h b324dfd77ca3ad24fd83588aaf79a7e4c291e716
|
||||||
F src/Utils.cpp abfd679b8a4a320207abe385b8f3a4af8f646a55
|
F src/Utils.cpp abfd679b8a4a320207abe385b8f3a4af8f646a55
|
||||||
F src/Utils.h c293175ea08801aa4f0513bf2820213f8958f704
|
F src/Utils.h c293175ea08801aa4f0513bf2820213f8958f704
|
||||||
F src/Workspace.cpp f68a4ca05d1b7c5c345fbd89527691813593c663
|
F src/Workspace.cpp 3722904319b7ad7c172cfe6fa56712308e5d2fd6
|
||||||
F src/Workspace.h d6649a3ae1cd0fbad55237030313e85530417271
|
F src/Workspace.h 7ae2e63196433ae34864d182e49e3a2f0726fb78
|
||||||
F src/main.cpp d8c65ea5e54102e4989fef9fd8cfd4f13ef8a8f0
|
F src/main.cpp d8c65ea5e54102e4989fef9fd8cfd4f13ef8a8f0
|
||||||
F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x
|
F tools/git-push.sh 62cc58434cae5b7bcd6bd9d4cce8b08739f31cd7 x
|
||||||
F tools/pack.sh d7f38a498c4e9327fecd6a6e5ac27be270d43008 x
|
F tools/pack.sh d7f38a498c4e9327fecd6a6e5ac27be270d43008 x
|
||||||
@ -249,10 +249,10 @@ F ui/CommitDialog.ui aea77347eef82b6b591f31fb058a1bb96193c728
|
|||||||
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
|
F ui/FileActionDialog.ui 89bb4dc2d0b8adcd41adcb11ec65f2028a09a12d
|
||||||
F ui/FslSettingsDialog.ui eb3d4cb764cab90b01e82922237d8c42d6ce1749
|
F ui/FslSettingsDialog.ui eb3d4cb764cab90b01e82922237d8c42d6ce1749
|
||||||
F ui/MainWindow.ui d51fe6d742278eafffedfd13dd543a3daf30c4a8
|
F ui/MainWindow.ui d51fe6d742278eafffedfd13dd543a3daf30c4a8
|
||||||
F ui/RemoteDialog.ui aa738503e4f6625ed8d7cc46169a319a39b0e575
|
F ui/RemoteDialog.ui 95a4750d972ed8c49bb10b95db91ff16cfe2dd0b
|
||||||
F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd
|
F ui/RevisionDialog.ui 27c3b98c665fec014a50cbf3352c0627f75e68cd
|
||||||
F ui/SettingsDialog.ui 4c480cd595a32664d01c85bf74845c4282fc0068
|
F ui/SettingsDialog.ui 4c480cd595a32664d01c85bf74845c4282fc0068
|
||||||
P 7c068aa8acdae1b86dee004d2d4cd7fb42904186
|
P 54518e5519ad4d5d478c815cc78859c9120997fe
|
||||||
R 0b17bbb41582e9b9eaa8683364460607
|
R 10cdbc5cfc32fc545a4e7e4dafc82685
|
||||||
U kostas
|
U kostas
|
||||||
Z 108dbf16cab161c35c5ff6a9ffa4b8af
|
Z 3161499b5cec5757d1886c4cd078bc1c
|
||||||
|
@ -1 +1 @@
|
|||||||
54518e5519ad4d5d478c815cc78859c9120997fe
|
9674708cb5f2e8543e01d64211b6768d2cb726d6
|
@ -285,6 +285,7 @@ MainWindow::MainWindow(Settings &_settings, QWidget *parent, QString *workspaceP
|
|||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
{
|
{
|
||||||
stopUI();
|
stopUI();
|
||||||
|
getWorkspace().storeWorkspace(*settings.GetStore());
|
||||||
updateSettings();
|
updateSettings();
|
||||||
|
|
||||||
delete ui;
|
delete ui;
|
||||||
@ -299,24 +300,14 @@ const QString &MainWindow::getCurrentWorkspace()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void MainWindow::setCurrentWorkspace(const QString &workspace)
|
void MainWindow::setCurrentWorkspace(const QString &workspace)
|
||||||
{
|
{
|
||||||
if(workspace.isEmpty())
|
if(!getWorkspace().switchWorkspace(workspace, *settings.GetStore()))
|
||||||
{
|
QMessageBox::critical(this, tr("Error"), tr("Could not change current directory to '%0'").arg(workspace), QMessageBox::Ok );
|
||||||
fossil().setCurrentWorkspace("");
|
else
|
||||||
return;
|
addWorkspaceHistory(fossil().getCurrentWorkspace());
|
||||||
}
|
|
||||||
|
|
||||||
QString new_workspace = QFileInfo(workspace).absoluteFilePath();
|
|
||||||
|
|
||||||
fossil().setCurrentWorkspace(new_workspace);
|
|
||||||
|
|
||||||
addWorkspace(new_workspace);
|
|
||||||
|
|
||||||
if(!QDir::setCurrent(new_workspace))
|
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not change current directory to '%0'").arg(new_workspace), QMessageBox::Ok );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void MainWindow::addWorkspace(const QString &dir)
|
void MainWindow::addWorkspaceHistory(const QString &dir)
|
||||||
{
|
{
|
||||||
if(dir.isEmpty())
|
if(dir.isEmpty())
|
||||||
return;
|
return;
|
||||||
@ -794,7 +785,6 @@ void MainWindow::updateWorkspaceView()
|
|||||||
tags->appendRow(tag);
|
tags->appendRow(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Unique Icon name
|
|
||||||
// Stashes
|
// Stashes
|
||||||
QStandardItem *stashes = new QStandardItem(getInternalIcon(":icons/icon-action-repo-open"), tr("Stashes"));
|
QStandardItem *stashes = new QStandardItem(getInternalIcon(":icons/icon-action-repo-open"), tr("Stashes"));
|
||||||
stashes->setData(WorkspaceItem(WorkspaceItem::TYPE_STASHES, ""), ROLE_WORKSPACE_ITEM);
|
stashes->setData(WorkspaceItem(WorkspaceItem::TYPE_STASHES, ""), ROLE_WORKSPACE_ITEM);
|
||||||
@ -812,15 +802,20 @@ void MainWindow::updateWorkspaceView()
|
|||||||
remotes->setData(WorkspaceItem(WorkspaceItem::TYPE_REMOTES, ""), ROLE_WORKSPACE_ITEM);
|
remotes->setData(WorkspaceItem(WorkspaceItem::TYPE_REMOTES, ""), ROLE_WORKSPACE_ITEM);
|
||||||
remotes->setEditable(false);
|
remotes->setEditable(false);
|
||||||
getWorkspace().getTreeModel().appendRow(remotes);
|
getWorkspace().getTreeModel().appendRow(remotes);
|
||||||
|
for(remote_map_t::const_iterator it=getWorkspace().getRemotes().begin(); it!=getWorkspace().getRemotes().end(); ++it)
|
||||||
{
|
{
|
||||||
QUrl default_url = fossil().getDefaultRemoteUrl();
|
QStandardItem *remote_item = new QStandardItem(getInternalIcon(":icons/icon-item-remote"), it->name);
|
||||||
if(!default_url.isEmpty())
|
remote_item->setData(WorkspaceItem(WorkspaceItem::TYPE_REMOTE, it->url.toString()), ROLE_WORKSPACE_ITEM);
|
||||||
|
remote_item->setToolTip(it->url.toDisplayString());
|
||||||
|
|
||||||
|
// Mark the default url as bold
|
||||||
|
if(it->isDefault)
|
||||||
{
|
{
|
||||||
QUrl url = default_url;
|
QFont font = remote_item->font();
|
||||||
QStandardItem *remote_item = new QStandardItem(getInternalIcon(":icons/icon-item-remote"), url.toDisplayString());
|
font.setBold(true);
|
||||||
remote_item->setData(WorkspaceItem(WorkspaceItem::TYPE_REMOTE, default_url.toString()), ROLE_WORKSPACE_ITEM);
|
remote_item->setFont(font);
|
||||||
remotes->appendRow(remote_item);
|
|
||||||
}
|
}
|
||||||
|
remotes->appendRow(remote_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expand previously selected nodes
|
// Expand previously selected nodes
|
||||||
@ -974,7 +969,7 @@ void MainWindow::applySettings()
|
|||||||
if(wk.isEmpty() || !QDir(wk).exists())
|
if(wk.isEmpty() || !QDir(wk).exists())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
addWorkspace(wk);
|
addWorkspaceHistory(wk);
|
||||||
|
|
||||||
if(store->contains("Active") && store->value("Active").toBool())
|
if(store->contains("Active") && store->value("Active").toBool())
|
||||||
setCurrentWorkspace(wk);
|
setCurrentWorkspace(wk);
|
||||||
@ -2463,20 +2458,41 @@ void MainWindow::on_actionEditRemote_triggered()
|
|||||||
if(remotes.empty())
|
if(remotes.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QUrl url(remotes.first());
|
QUrl old_url(remotes.first());
|
||||||
bool exists = KeychainGet(this, url);
|
|
||||||
|
|
||||||
if(!RemoteDialog::run(this, url))
|
QString name;
|
||||||
|
Remote *remote = getWorkspace().findRemote(old_url);
|
||||||
|
if(remote)
|
||||||
|
name = remote->name;
|
||||||
|
|
||||||
|
bool exists = KeychainGet(this, old_url);
|
||||||
|
|
||||||
|
QUrl new_url = old_url;
|
||||||
|
if(!RemoteDialog::run(this, new_url, name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!url.isLocalFile())
|
if(!new_url.isLocalFile())
|
||||||
{
|
{
|
||||||
if(exists)
|
if(exists)
|
||||||
KeychainDelete(this, url);
|
KeychainDelete(this, new_url);
|
||||||
|
|
||||||
if(!KeychainSet(this, url))
|
if(!KeychainSet(this, new_url))
|
||||||
QMessageBox::critical(this, tr("Error"), tr("Could not store information to keychain."), QMessageBox::Ok );
|
QMessageBox::critical(this, tr("Error"), tr("Could not store information to keychain."), QMessageBox::Ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove password
|
||||||
|
new_url.setPassword("");
|
||||||
|
old_url.setPassword("");
|
||||||
|
// Url changed?
|
||||||
|
if(new_url != old_url)
|
||||||
|
{
|
||||||
|
getWorkspace().removeRemote(old_url);
|
||||||
|
getWorkspace().addRemote(new_url, name);
|
||||||
|
}
|
||||||
|
else // Just data changed
|
||||||
|
remote->name = name;
|
||||||
|
|
||||||
|
updateWorkspaceView();
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -2516,7 +2532,7 @@ void MainWindow::on_actionPullRemote_triggered()
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void MainWindow::on_actionPush_triggered()
|
void MainWindow::on_actionPush_triggered()
|
||||||
{
|
{
|
||||||
QUrl url = fossil().getDefaultRemoteUrl();
|
QUrl url = getWorkspace().getRemoteDefault();
|
||||||
|
|
||||||
if(url.isEmpty())
|
if(url.isEmpty())
|
||||||
{
|
{
|
||||||
@ -2528,14 +2544,13 @@ void MainWindow::on_actionPush_triggered()
|
|||||||
if(!url.isLocalFile())
|
if(!url.isLocalFile())
|
||||||
KeychainGet(this, url);
|
KeychainGet(this, url);
|
||||||
|
|
||||||
|
|
||||||
fossil().pushRepository(url);
|
fossil().pushRepository(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void MainWindow::on_actionPull_triggered()
|
void MainWindow::on_actionPull_triggered()
|
||||||
{
|
{
|
||||||
QUrl url = fossil().getDefaultRemoteUrl();
|
QUrl url = getWorkspace().getRemoteDefault();
|
||||||
|
|
||||||
if(url.isEmpty())
|
if(url.isEmpty())
|
||||||
{
|
{
|
||||||
@ -2560,11 +2575,7 @@ void MainWindow::on_actionSetDefaultRemote_triggered()
|
|||||||
|
|
||||||
QUrl url(remotes.first());
|
QUrl url(remotes.first());
|
||||||
|
|
||||||
// Retrieve password from keychain
|
getWorkspace().setRemoteDefault(url);
|
||||||
if(!url.isLocalFile())
|
|
||||||
KeychainGet(this, url);
|
|
||||||
|
|
||||||
fossil().setRemoteUrl(url);
|
|
||||||
updateWorkspaceView();
|
updateWorkspaceView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2572,7 +2583,8 @@ void MainWindow::on_actionSetDefaultRemote_triggered()
|
|||||||
void MainWindow::on_actionAddRemote_triggered()
|
void MainWindow::on_actionAddRemote_triggered()
|
||||||
{
|
{
|
||||||
QUrl url;
|
QUrl url;
|
||||||
if(!RemoteDialog::run(this, url))
|
QString name;
|
||||||
|
if(!RemoteDialog::run(this, url, name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!url.isLocalFile())
|
if(!url.isLocalFile())
|
||||||
@ -2583,6 +2595,7 @@ void MainWindow::on_actionAddRemote_triggered()
|
|||||||
QMessageBox::critical(this, tr("Error"), tr("Could not store information to keychain."), QMessageBox::Ok );
|
QMessageBox::critical(this, tr("Error"), tr("Could not store information to keychain."), QMessageBox::Ok );
|
||||||
}
|
}
|
||||||
|
|
||||||
fossil().setRemoteUrl(url);
|
getWorkspace().addRemote(url, name);
|
||||||
updateWorkspaceView();
|
updateWorkspaceView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ private:
|
|||||||
bool startUI();
|
bool startUI();
|
||||||
void stopUI();
|
void stopUI();
|
||||||
void enableActions(bool on);
|
void enableActions(bool on);
|
||||||
void addWorkspace(const QString &dir);
|
void addWorkspaceHistory(const QString &dir);
|
||||||
void rebuildRecent();
|
void rebuildRecent();
|
||||||
bool openWorkspace(const QString &path);
|
bool openWorkspace(const QString &path);
|
||||||
void loadFossilSettings();
|
void loadFossilSettings();
|
||||||
|
@ -22,7 +22,7 @@ RemoteDialog::~RemoteDialog()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
bool RemoteDialog::run(QWidget *parent, QUrl &url)
|
bool RemoteDialog::run(QWidget *parent, QUrl &url, QString &name)
|
||||||
{
|
{
|
||||||
RemoteDialog dlg(parent);
|
RemoteDialog dlg(parent);
|
||||||
|
|
||||||
@ -33,6 +33,7 @@ bool RemoteDialog::run(QWidget *parent, QUrl &url)
|
|||||||
dlg.ui->lineURL->setText(url_no_credentials);
|
dlg.ui->lineURL->setText(url_no_credentials);
|
||||||
dlg.ui->lineUserName->setText(url.userName());
|
dlg.ui->lineUserName->setText(url.userName());
|
||||||
dlg.ui->linePassword->setText(url.password());
|
dlg.ui->linePassword->setText(url.password());
|
||||||
|
dlg.ui->lineName->setText(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dlg.exec() != QDialog::Accepted)
|
if(dlg.exec() != QDialog::Accepted)
|
||||||
@ -53,6 +54,10 @@ bool RemoteDialog::run(QWidget *parent, QUrl &url)
|
|||||||
if(!dlg.ui->linePassword->text().trimmed().isEmpty())
|
if(!dlg.ui->linePassword->text().trimmed().isEmpty())
|
||||||
url.setPassword(dlg.ui->linePassword->text());
|
url.setPassword(dlg.ui->linePassword->text());
|
||||||
|
|
||||||
|
name =dlg.ui->lineName->text().trimmed();
|
||||||
|
if(name.isEmpty())
|
||||||
|
name = url.toString(QUrl::PrettyDecoded|QUrl::RemoveUserInfo);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public:
|
|||||||
explicit RemoteDialog(QWidget *parent = 0);
|
explicit RemoteDialog(QWidget *parent = 0);
|
||||||
~RemoteDialog();
|
~RemoteDialog();
|
||||||
|
|
||||||
static bool run(QWidget *parent, class QUrl &url);
|
static bool run(QWidget *parent, class QUrl &url, QString &name);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_btnSelectSourceRepo_clicked();
|
void on_btnSelectSourceRepo_clicked();
|
||||||
|
@ -34,8 +34,7 @@ struct Settings
|
|||||||
enum SettingType
|
enum SettingType
|
||||||
{
|
{
|
||||||
TYPE_FOSSIL_GLOBAL,
|
TYPE_FOSSIL_GLOBAL,
|
||||||
TYPE_FOSSIL_LOCAL,
|
TYPE_FOSSIL_LOCAL
|
||||||
TYPE_FOSSIL_COMMAND
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Setting(QVariant value, SettingType type) : Value(value), Type(type)
|
Setting(QVariant value, SettingType type) : Value(value), Type(type)
|
||||||
|
@ -2,10 +2,15 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
Workspace::Workspace()
|
||||||
|
{
|
||||||
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
Workspace::~Workspace()
|
Workspace::~Workspace()
|
||||||
{
|
{
|
||||||
clearState();
|
clearState();
|
||||||
|
remotes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
@ -23,6 +28,80 @@ void Workspace::clearState()
|
|||||||
isIntegrated = false;
|
isIntegrated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
void Workspace::storeWorkspace(QSettings &store)
|
||||||
|
{
|
||||||
|
QString workspace = fossil().getCurrentWorkspace();
|
||||||
|
if(workspace.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
store.beginGroup("Remotes");
|
||||||
|
store.beginWriteArray(QDir::toNativeSeparators(workspace));
|
||||||
|
int index = 0;
|
||||||
|
for(remote_map_t::iterator it=remotes.begin(); it!=remotes.end(); ++it, ++index)
|
||||||
|
{
|
||||||
|
store.setArrayIndex(index);
|
||||||
|
store.setValue("Name", it->name);
|
||||||
|
QUrl url = it->url;
|
||||||
|
url.setPassword("");
|
||||||
|
store.setValue("Url", url);
|
||||||
|
if(it->isDefault)
|
||||||
|
store.setValue("Default", it->isDefault);
|
||||||
|
else
|
||||||
|
store.remove("Default");
|
||||||
|
}
|
||||||
|
store.endArray();
|
||||||
|
store.endGroup();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
bool Workspace::switchWorkspace(const QString& workspace, QSettings &store)
|
||||||
|
{
|
||||||
|
// Save Remotes
|
||||||
|
storeWorkspace(store);
|
||||||
|
clearState();
|
||||||
|
remotes.clear();
|
||||||
|
|
||||||
|
fossil().setCurrentWorkspace("");
|
||||||
|
if(workspace.isEmpty())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
QString new_workspace = QFileInfo(workspace).absoluteFilePath();
|
||||||
|
|
||||||
|
if(!QDir::setCurrent(new_workspace))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
fossil().setCurrentWorkspace(new_workspace);
|
||||||
|
|
||||||
|
// Load Remotes
|
||||||
|
store.beginGroup("Remotes");
|
||||||
|
int num_remotes = store.beginReadArray(QDir::toNativeSeparators(new_workspace));
|
||||||
|
for(int i=0; i<num_remotes; ++i)
|
||||||
|
{
|
||||||
|
store.setArrayIndex(i);
|
||||||
|
|
||||||
|
QString name = store.value("name").toString();
|
||||||
|
QUrl url = store.value("Url").toUrl();
|
||||||
|
bool def = store.value("Default", false).toBool();
|
||||||
|
addRemote(url, name);
|
||||||
|
if(def)
|
||||||
|
setRemoteDefault(url);
|
||||||
|
}
|
||||||
|
store.endArray();
|
||||||
|
store.endGroup();
|
||||||
|
|
||||||
|
// Add the default url from fossil
|
||||||
|
QUrl default_remote;
|
||||||
|
if(fossil().getRemoteUrl(default_remote) && default_remote.isValid() && !default_remote.isEmpty())
|
||||||
|
{
|
||||||
|
addRemote(default_remote, default_remote.toDisplayString());
|
||||||
|
setRemoteDefault(default_remote);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
bool Workspace::scanDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir, const QString ignoreSpec, const bool &abort, UICallback &uiCallback)
|
bool Workspace::scanDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir, const QString ignoreSpec, const bool &abort, UICallback &uiCallback)
|
||||||
{
|
{
|
||||||
@ -216,3 +295,56 @@ _done:
|
|||||||
uiCallback.endProcess();
|
uiCallback.endProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
bool Workspace::addRemote(const QUrl& url, const QString& name)
|
||||||
|
{
|
||||||
|
if(remotes.contains(url))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Q_ASSERT(url.password().isEmpty());
|
||||||
|
|
||||||
|
Remote r(name, url);
|
||||||
|
remotes.insert(r.name, r);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
bool Workspace::removeRemote(const QUrl& url)
|
||||||
|
{
|
||||||
|
return remotes.remove(url) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
bool Workspace::setRemoteDefault(const QUrl& url)
|
||||||
|
{
|
||||||
|
Q_ASSERT(url.password().isEmpty());
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
|
for(remote_map_t::iterator it=remotes.begin(); it!=remotes.end(); ++it)
|
||||||
|
{
|
||||||
|
if(it->url == url)
|
||||||
|
{
|
||||||
|
it->isDefault = true;
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
it->isDefault = false;
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
const QUrl & Workspace::getRemoteDefault() const
|
||||||
|
{
|
||||||
|
return fossil().getDefaultRemoteUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
Remote * Workspace::findRemote(const QUrl& url)
|
||||||
|
{
|
||||||
|
remote_map_t::iterator it = remotes.find(url);
|
||||||
|
if(it!=remotes.end())
|
||||||
|
return &(*it);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
#include <QSettings>
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "Fossil.h"
|
#include "Fossil.h"
|
||||||
|
|
||||||
@ -99,13 +100,31 @@ private:
|
|||||||
|
|
||||||
typedef QSet<QString> stringset_t;
|
typedef QSet<QString> stringset_t;
|
||||||
|
|
||||||
|
class Remote
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Remote(const QString &_name, const QUrl &_url, bool _isDefault=false)
|
||||||
|
: name(_name), url(_url), isDefault(_isDefault)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QString name;
|
||||||
|
QUrl url;
|
||||||
|
bool isDefault;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef QMap<QUrl, Remote> remote_map_t;
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// Workspace
|
// Workspace
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class Workspace
|
class Workspace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Workspace();
|
||||||
|
|
||||||
~Workspace();
|
~Workspace();
|
||||||
|
|
||||||
typedef QList<WorkspaceFile*> filelist_t;
|
typedef QList<WorkspaceFile*> filelist_t;
|
||||||
@ -116,7 +135,7 @@ public:
|
|||||||
Fossil & fossil() { return bridge; }
|
Fossil & fossil() { return bridge; }
|
||||||
const Fossil & fossil() const { return bridge; }
|
const Fossil & fossil() const { return bridge; }
|
||||||
|
|
||||||
static bool scanDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir, const QString ignoreSpec, const bool& abort, UICallback &uiCallback);
|
bool switchWorkspace(const QString &workspace, QSettings &store);
|
||||||
void scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModified, bool scanUnchanged, const QString &ignoreGlob, UICallback &uiCallback, bool &operationAborted);
|
void scanWorkspace(bool scanLocal, bool scanIgnored, bool scanModified, bool scanUnchanged, const QString &ignoreGlob, UICallback &uiCallback, bool &operationAborted);
|
||||||
|
|
||||||
QStandardItemModel &getFileModel() { return repoFileModel; }
|
QStandardItemModel &getFileModel() { return repoFileModel; }
|
||||||
@ -129,6 +148,19 @@ public:
|
|||||||
QStringList &getBranches() { return branchList; }
|
QStringList &getBranches() { return branchList; }
|
||||||
bool otherChanges() const { return isIntegrated; }
|
bool otherChanges() const { return isIntegrated; }
|
||||||
|
|
||||||
|
// Remotes
|
||||||
|
const remote_map_t &getRemotes() const { return remotes; }
|
||||||
|
bool addRemote(const QUrl &url, const QString &name);
|
||||||
|
bool removeRemote(const QUrl &url);
|
||||||
|
bool setRemoteDefault(const QUrl& url);
|
||||||
|
const QUrl &getRemoteDefault() const;
|
||||||
|
Remote * findRemote(const QUrl& url);
|
||||||
|
|
||||||
|
|
||||||
|
void storeWorkspace(QSettings &store);
|
||||||
|
private:
|
||||||
|
static bool scanDirectory(QFileInfoList &entries, const QString& dirPath, const QString &baseDir, const QString ignoreSpec, const bool& abort, UICallback &uiCallback);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Fossil bridge;
|
Fossil bridge;
|
||||||
filemap_t workspaceFiles;
|
filemap_t workspaceFiles;
|
||||||
@ -136,6 +168,7 @@ private:
|
|||||||
stashmap_t stashMap;
|
stashmap_t stashMap;
|
||||||
QStringList branchList;
|
QStringList branchList;
|
||||||
QStringMap tags;
|
QStringMap tags;
|
||||||
|
remote_map_t remotes;
|
||||||
bool isIntegrated;
|
bool isIntegrated;
|
||||||
|
|
||||||
QStandardItemModel repoFileModel;
|
QStandardItemModel repoFileModel;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>478</width>
|
<width>478</width>
|
||||||
<height>142</height>
|
<height>189</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -25,14 +25,14 @@
|
|||||||
<property name="fieldGrowthPolicy">
|
<property name="fieldGrowthPolicy">
|
||||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_1">
|
<widget class="QLabel" name="label_1">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>URL</string>
|
<string>URL</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="1" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineURL">
|
<widget class="QLineEdit" name="lineURL">
|
||||||
@ -62,28 +62,28 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>User Name</string>
|
<string>User Name</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QLineEdit" name="lineUserName">
|
<widget class="QLineEdit" name="lineUserName">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>The user name used to access the remote repository. Leave blank if not required</string>
|
<string>The user name used to access the remote repository. Leave blank if not required</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Password</string>
|
<string>Password</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QLineEdit" name="linePassword">
|
<widget class="QLineEdit" name="linePassword">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>The password used to access the remote repository. Leave blank if not required</string>
|
<string>The password used to access the remote repository. Leave blank if not required</string>
|
||||||
@ -93,6 +93,20 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QLineEdit" name="lineName">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The password used to access the remote repository. Leave blank if not required</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="Name">
|
||||||
|
<property name="text">
|
||||||
|
<string>Name</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user