summaryrefslogtreecommitdiffstats
path: root/plugins/fossil/wizard
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/fossil/wizard')
-rw-r--r--plugins/fossil/wizard/fossiljsextension.cpp128
-rw-r--r--plugins/fossil/wizard/fossiljsextension.h61
-rw-r--r--plugins/fossil/wizard/projects/vcs/icon.pngbin0 -> 14500 bytes
-rw-r--r--plugins/fossil/wizard/projects/vcs/wizard.json255
4 files changed, 444 insertions, 0 deletions
diff --git a/plugins/fossil/wizard/fossiljsextension.cpp b/plugins/fossil/wizard/fossiljsextension.cpp
new file mode 100644
index 0000000..664e1c2
--- /dev/null
+++ b/plugins/fossil/wizard/fossiljsextension.cpp
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (c) 2016 Artur Shepilko
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "fossiljsextension.h"
+#include "../constants.h"
+#include "../fossilclient.h"
+#include "../fossilplugin.h"
+
+#include <coreplugin/iversioncontrol.h>
+#include <coreplugin/vcsmanager.h>
+
+#include <vcsbase/vcsbaseclientsettings.h>
+#include <vcsbase/vcsbaseconstants.h>
+
+using namespace Core;
+
+namespace Fossil {
+namespace Internal {
+
+
+class FossilJsExtensionPrivate {
+
+public:
+ FossilJsExtensionPrivate() :
+ m_vscId(Constants::VCS_ID_FOSSIL) { }
+
+ FossilClient *client() const {
+ return FossilPlugin::instance()->client();
+ }
+
+ Core::Id m_vscId;
+};
+
+
+void FossilJsExtension::parseArgOptions(const QStringList &args, QMap<QString, QString> &options)
+{
+ options.clear();
+
+ foreach (const QString &arg, args) {
+ if (arg.isEmpty()) continue;
+
+ QStringList opt = arg.split('|', QString::KeepEmptyParts);
+ options.insert(opt[0], opt.size() > 1 ? opt[1] : QString());
+ }
+}
+
+FossilJsExtension::FossilJsExtension() :
+ d(new FossilJsExtensionPrivate)
+{ }
+
+FossilJsExtension::~FossilJsExtension()
+{
+ delete d;
+}
+
+bool FossilJsExtension::isConfigured() const
+{
+ IVersionControl *vc = VcsManager::versionControl(d->m_vscId);
+ return vc && vc->isConfigured();
+}
+
+QString FossilJsExtension::displayName() const
+{
+ IVersionControl *vc = VcsManager::versionControl(d->m_vscId);
+ return vc ? vc->displayName() : QString();
+}
+
+QString FossilJsExtension::defaultAdminUser() const
+{
+ if (!isConfigured())
+ return QString();
+
+ VcsBase::VcsBaseClientSettings &settings = d->client()->settings();
+ return settings.stringValue(FossilSettings::userNameKey);
+}
+
+QString FossilJsExtension::defaultSslIdentityFile() const
+{
+ if (!isConfigured())
+ return QString();
+
+ VcsBase::VcsBaseClientSettings &settings = d->client()->settings();
+ return settings.stringValue(FossilSettings::sslIdentityFileKey);
+}
+
+QString FossilJsExtension::defaultLocalRepoPath() const
+{
+ if (!isConfigured())
+ return QString();
+
+ VcsBase::VcsBaseClientSettings &settings = d->client()->settings();
+ return settings.stringValue(FossilSettings::defaultRepoPathKey);
+}
+
+bool FossilJsExtension::defaultDisableAutosync() const
+{
+ if (!isConfigured())
+ return false;
+
+ VcsBase::VcsBaseClientSettings &settings = d->client()->settings();
+ return settings.boolValue(FossilSettings::disableAutosyncKey);
+}
+
+} // namespace Internal
+} // namespace Fossil
+
diff --git a/plugins/fossil/wizard/fossiljsextension.h b/plugins/fossil/wizard/fossiljsextension.h
new file mode 100644
index 0000000..d1f90d2
--- /dev/null
+++ b/plugins/fossil/wizard/fossiljsextension.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (c) 2016 Artur Shepilko
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <vcsbase/wizard/vcsjsextension.h>
+
+#include <QStringList>
+#include <QMap>
+#include <QObject>
+
+namespace Fossil {
+namespace Internal {
+
+class FossilJsExtensionPrivate;
+
+class FossilJsExtension : public QObject
+{
+ Q_OBJECT
+
+public:
+ static void parseArgOptions(const QStringList &args, QMap<QString, QString> &options);
+
+ FossilJsExtension();
+ ~FossilJsExtension();
+
+ Q_INVOKABLE bool isConfigured() const;
+ Q_INVOKABLE QString displayName() const;
+ Q_INVOKABLE QString defaultAdminUser() const;
+ Q_INVOKABLE QString defaultSslIdentityFile() const;
+ Q_INVOKABLE QString defaultLocalRepoPath() const;
+ Q_INVOKABLE bool defaultDisableAutosync() const;
+
+private:
+ FossilJsExtensionPrivate *d = nullptr;
+};
+
+} // namespace Internal
+} // namespace Fossil
diff --git a/plugins/fossil/wizard/projects/vcs/icon.png b/plugins/fossil/wizard/projects/vcs/icon.png
new file mode 100644
index 0000000..496f881
--- /dev/null
+++ b/plugins/fossil/wizard/projects/vcs/icon.png
Binary files differ
diff --git a/plugins/fossil/wizard/projects/vcs/wizard.json b/plugins/fossil/wizard/projects/vcs/wizard.json
new file mode 100644
index 0000000..30423ed
--- /dev/null
+++ b/plugins/fossil/wizard/projects/vcs/wizard.json
@@ -0,0 +1,255 @@
+{
+ "version": 1,
+ "kind": "project",
+ "id": "I.Fossil",
+ "category": "T.Import",
+ "trDescription": "Clones a Fossil repository and tries to load the contained project.",
+ "trDisplayName": "Fossil Clone",
+ "trDisplayCategory": "Import Project",
+ "icon": "icon.png",
+ "enabled": "%{JS: [ %{Plugins} ].indexOf('Fossil') >= 0}",
+
+ "options":
+ [
+ { "key": "vcsId", "value": "I.Fossil" },
+ { "key": "vcsName", "value": "%{JS: Vcs.displayName('%{vcsId}')}" },
+ { "key": "isCloneRepo", "value": "%{JS: '%{RepoType}' === 'cloneRepo' }" },
+ { "key": "isLocalRepo", "value": "%{JS: '%{RepoType}' === 'localRepo' }" },
+ { "key": "SR", "value": "%{JS: '%{Repo}'.replace(/\\.(fossil|fsl)$/, '') }"},
+ { "key": "defaultDir", "value": "%{JS: %{isCloneRepo} ? '%{SR}'.substr('%{SR}'.lastIndexOf('/') + 1).replace(/\\./, '-') : %{isLocalRepo} ? Util.baseName('%{LocalRepo}') : '' }"},
+ { "key": "defaultFossilName", "value": "%{JS: %{isCloneRepo} ? '%{defaultDir}' : %{isLocalRepo} ? Util.completeBaseName('%{LocalRepo}') : '' }" },
+ { "key": "defaultLocalRepoPath", "value": "%{JS: Fossil.defaultLocalRepoPath() }" },
+ { "key": "defaultSslIdentityFile", "value": "%{JS: Fossil.defaultSslIdentityFile() }" },
+ { "key": "defaultDisableAutosync", "value": "%{JS: Fossil.defaultDisableAutosync() }" },
+ { "key": "SourceRepo", "value": "%{JS: %{isCloneRepo} ? '%{Repo}' : %{isLocalRepo} ? '%{LocalRepo}' : '' }" },
+ { "key": "TargetPath", "value": "%{Path}/%{Dir}" },
+ { "key": "FossilFile", "value": "%{defaultLocalRepoPath}/%{FossilName}.fossil" },
+ { "key": "argRepoType", "value": "repository-type|%{RepoType}" },
+ { "key": "argBranchTag", "value": "%{JS: '%{Branch}' ? 'branch-tag|%{Branch}' : '' }" },
+ { "key": "argAdminUser", "value": "%{JS: '%{AdminUser}' ? 'admin-user|%{AdminUser}' : '' }" },
+ { "key": "argSslIdentity", "value": "%{JS: '%{SslIdentity}' ? 'ssl-identity|%{SslIdentity}' : '' }" },
+ { "key": "argIncludePrivate", "value": "%{JS: '%{IncludePrivate}' ? 'include-private|%{IncludePrivate}' : '' }" },
+ { "key": "argDisableAutosync", "value": "%{JS: '%{DisableAutosync}' ? 'settings-autosync|%{DisableAutosync}' : '' }" },
+ { "key": "argFossilFile", "value": "fossil-file|%{FossilFile}" }
+ ],
+
+ "pages":
+ [
+ {
+ "trDisplayName": "Configuration",
+ "trShortTitle": "Configuration",
+ "trSubTitle": "Please configure <b>%{vcsName}</b> now.",
+ "typeId": "VcsConfiguration",
+ "enabled": "%{JS: !Vcs.isConfigured('%{vcsId}')}",
+ "data": { "vcsId": "%{vcsId}" }
+ },
+ {
+ "trDisplayName": "Select repository location type",
+ "trShortTitle": "Repository",
+ "typeId": "Fields",
+ "data":
+ [
+ {
+ "name": "RepoType",
+ "type": "ComboBox",
+ "data":
+ {
+ "index": 0,
+ "items":
+ [
+ { "trKey": "Remote repository clone", "value": "cloneRepo" },
+ { "trKey": "Local repository checkout", "value": "localRepo" }
+ ]
+ }
+ }
+ ]
+ },
+ {
+ "trDisplayName": "Location",
+ "trShortTitle": "Location",
+ "trSubTitle": "Specify repository location, branch, checkout destination, and options.",
+ "typeId": "Fields",
+ "data" :
+ [
+ {
+ "name": "GotSource",
+ "type": "LineEdit",
+ "visible": false,
+ "mandatory": true,
+ "isComplete": "%{JS: '%{FossilName}' === '' || (%{isCloneRepo} && !Util.exists('%{FossilFile}')) }",
+ "trIncompleteMessage": "The clone fossil already exists in local repositories path.",
+ "data":
+ {
+ "trText": "%{JS: (%{isCloneRepo} && '%{Repo}' !== '' && '%{FossilName}' !== '') || (%{isLocalRepo} && '%{LocalRepo}' !== '') ? 'true' : '' }"
+ }
+ },
+ {
+ "name": "Repo",
+ "trDisplayName": "Remote repository:",
+ "trToolTip": "For example: https://[user[:pass]@]host[:port]/[path]",
+ "type": "LineEdit",
+ "enabled": "%{isCloneRepo}",
+ "mandatory": false
+ },
+ {
+ "name": "FossilName",
+ "trDisplayName": "Local clone:",
+ "trToolTip": "Base name of a new local fossil file to clone into.",
+ "type": "LineEdit",
+ "enabled": "%{isCloneRepo}",
+ "mandatory": false,
+ "data":
+ {
+ "trText": "%{defaultFossilName}"
+ }
+ },
+ {
+ "name": "LocalRepo",
+ "trDisplayName": "Local repository:",
+ "trToolTip": "Path of an existing local fossil file to check out from.",
+ "type": "PathChooser",
+ "enabled": "%{isLocalRepo}",
+ "mandatory": false,
+ "data":
+ {
+ "kind": "file",
+ "basePath": "%{defaultLocalRepoPath}"
+ }
+ },
+ {
+ "name": "Branch",
+ "trDisplayName": "Branch:",
+ "type": "LineEdit",
+ "mandatory": false,
+ "data":
+ {
+ "trPlaceholder": "<default branch>"
+ }
+ },
+ {
+ "name": "Sp1",
+ "type": "Spacer",
+ "data": { "factor": 2 }
+ },
+ {
+ "name": "Dir",
+ "trDisplayName": "Checkout directory:",
+ "type": "LineEdit",
+ "isComplete": "%{JS: '%{Dir}' === '' || !Util.exists('%{TargetPath}')}",
+ "trIncompleteMessage": "The checkout directory already exists in the filesystem.",
+ "data":
+ {
+ "trText": "%{defaultDir}"
+ }
+ },
+ {
+ "name": "Path",
+ "trDisplayName": "Create in:",
+ "type": "PathChooser",
+ "data":
+ {
+ "kind": "existingDirectory",
+ "basePath": "%{InitialPath}",
+ "path": "%{InitialPath}"
+ }
+ },
+ {
+ "name": "Sp2",
+ "type": "Spacer",
+ "data": { "factor": 2 }
+ },
+ {
+ "name": "AdminUser",
+ "trDisplayName": "Admin user:",
+ "trToolTip": "Privileged user added automatically to the created local repository.",
+ "type": "LineEdit",
+ "mandatory": false,
+ "enabled": "%{isCloneRepo}",
+ "data":
+ {
+ "trText": "%{JS: Fossil.defaultAdminUser()}"
+ }
+ },
+ {
+ "name": "SslIdentity",
+ "trDisplayName": "SSL/TLS identity:",
+ "trToolTip": "SSL/TLS client identity key to use if requested by the server.",
+ "type": "PathChooser",
+ "mandatory": false,
+ "enabled": "%{isCloneRepo}",
+ "data":
+ {
+ "kind": "file",
+ "path": "%{defaultSslIdentityFile}"
+ }
+ },
+ {
+ "name": "IncludePrivate",
+ "trDisplayName": "Include private branches",
+ "trToolTip": "Allow transfer of private branches.",
+ "type": "CheckBox",
+ "enabled": "%{isCloneRepo}",
+ "data":
+ {
+ "checkedValue": "true",
+ "uncheckedValue": ""
+ }
+ },
+ {
+ "name": "DisableAutosync",
+ "trDisplayName": "Disable auto-sync",
+ "trToolTip": "Disable automatic pull prior to commit or update and automatic push after commit or tag or branch creation.",
+ "type": "CheckBox",
+ "enabled": "%{isCloneRepo}",
+ "data":
+ {
+ "checkedValue": "off",
+ "uncheckedValue": "",
+ "checked": "%{defaultDisableAutosync}"
+ }
+ }
+
+ ]
+ },
+ {
+ "trDisplayName": "Checkout",
+ "trShortTitle": "Checkout",
+ "typeId": "VcsCommand",
+ "data" :
+ {
+ "vcsId": "%{vcsId}",
+ "trRunMessage": "Running Fossil clone...",
+ "repository": "%{SourceRepo}",
+ "baseDirectory": "%{Path}",
+ "checkoutName": "%{Dir}",
+ "extraArguments":
+ [
+ "%{argRepoType}",
+ "%{argBranchTag}",
+ "%{argAdminUser}",
+ "%{argSslIdentity}",
+ "%{argIncludePrivate}",
+ "%{argDisableAutosync}",
+ "%{argFossilFile}"
+ ],
+ "extraJobs" :
+ [
+ {
+ "command": "fossil",
+ "arguments": [ "version" ]
+ }
+ ]
+ }
+ }
+ ],
+
+ "generators":
+ [
+ {
+ "typeId": "Scanner",
+ "data": {
+ "subdirectoryPatterns": [ "^src$" ]
+ }
+ }
+ ]
+}