forked from qt-creator/qt-creator
GitLab: Tr::tr()
Change-Id: I1f51fbada9d18b6e6e2dae90801de472b3e086d7 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "gitlabclonedialog.h"
|
||||
|
||||
#include "gitlabprojectsettings.h"
|
||||
#include "gitlabtr.h"
|
||||
#include "resultparser.h"
|
||||
|
||||
#include <coreplugin/documentmanager.h>
|
||||
@@ -48,28 +49,28 @@ namespace GitLab {
|
||||
GitLabCloneDialog::GitLabCloneDialog(const Project &project, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle(tr("Clone Repository"));
|
||||
setWindowTitle(Tr::tr("Clone Repository"));
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
layout->addWidget(new QLabel(tr("Specify repository URL, checkout path and directory.")));
|
||||
layout->addWidget(new QLabel(Tr::tr("Specify repository URL, checkout path and directory.")));
|
||||
QHBoxLayout *centerLayout = new QHBoxLayout;
|
||||
QFormLayout *form = new QFormLayout;
|
||||
m_repositoryCB = new QComboBox(this);
|
||||
m_repositoryCB->addItems({project.sshUrl, project.httpUrl});
|
||||
form->addRow(tr("Repository"), m_repositoryCB);
|
||||
form->addRow(Tr::tr("Repository"), m_repositoryCB);
|
||||
m_pathChooser = new PathChooser(this);
|
||||
m_pathChooser->setExpectedKind(PathChooser::ExistingDirectory);
|
||||
form->addRow(tr("Path"), m_pathChooser);
|
||||
form->addRow(Tr::tr("Path"), m_pathChooser);
|
||||
m_directoryLE = new FancyLineEdit(this);
|
||||
m_directoryLE->setValidationFunction([this](FancyLineEdit *e, QString *msg) {
|
||||
const FilePath fullPath = m_pathChooser->filePath().pathAppended(e->text());
|
||||
bool alreadyExists = fullPath.exists();
|
||||
if (alreadyExists && msg)
|
||||
*msg = tr("Path \"%1\" already exists.").arg(fullPath.toUserOutput());
|
||||
*msg = Tr::tr("Path \"%1\" already exists.").arg(fullPath.toUserOutput());
|
||||
return !alreadyExists;
|
||||
});
|
||||
form->addRow(tr("Directory"), m_directoryLE);
|
||||
form->addRow(Tr::tr("Directory"), m_directoryLE);
|
||||
m_submodulesCB = new QCheckBox(this);
|
||||
form->addRow(tr("Recursive"), m_submodulesCB);
|
||||
form->addRow(Tr::tr("Recursive"), m_submodulesCB);
|
||||
form->addItem(new QSpacerItem(10, 10));
|
||||
centerLayout->addLayout(form);
|
||||
m_cloneOutput = new QPlainTextEdit(this);
|
||||
@@ -79,7 +80,7 @@ GitLabCloneDialog::GitLabCloneDialog(const Project &project, QWidget *parent)
|
||||
m_infoLabel = new InfoLabel(this);
|
||||
layout->addWidget(m_infoLabel);
|
||||
auto buttons = new QDialogButtonBox(QDialogButtonBox::Cancel, this);
|
||||
m_cloneButton = new QPushButton(tr("Clone"), this);
|
||||
m_cloneButton = new QPushButton(Tr::tr("Clone"), this);
|
||||
buttons->addButton(m_cloneButton, QDialogButtonBox::ActionRole);
|
||||
m_cancelButton = buttons->button(QDialogButtonBox::Cancel);
|
||||
layout->addWidget(buttons);
|
||||
@@ -161,7 +162,7 @@ void GitLabCloneDialog::cloneProject()
|
||||
void GitLabCloneDialog::cancel()
|
||||
{
|
||||
if (m_commandRunning) {
|
||||
m_cloneOutput->appendPlainText(tr("User canceled process."));
|
||||
m_cloneOutput->appendPlainText(Tr::tr("User canceled process."));
|
||||
m_cancelButton->setEnabled(false);
|
||||
m_command->cancel(); // FIXME does not cancel the git processes... QTCREATORBUG-27567
|
||||
} else {
|
||||
@@ -194,7 +195,7 @@ void GitLabCloneDialog::cloneFinished(bool success)
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
||||
if (success) {
|
||||
m_cloneOutput->appendPlainText(tr("Cloning succeeded.") + emptyLine);
|
||||
m_cloneOutput->appendPlainText(Tr::tr("Cloning succeeded.") + emptyLine);
|
||||
m_cloneButton->setEnabled(false);
|
||||
|
||||
const FilePath base = m_pathChooser->filePath().pathAppended(m_directoryLE->text());
|
||||
@@ -215,8 +216,8 @@ void GitLabCloneDialog::cloneFinished(bool success)
|
||||
|
||||
hide(); // avoid to many dialogs.. FIXME: maybe change to some wizard approach?
|
||||
if (filesWeMayOpen.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Warning"),
|
||||
tr("Cloned project does not have a project file that can be "
|
||||
QMessageBox::warning(this, Tr::tr("Warning"),
|
||||
Tr::tr("Cloned project does not have a project file that can be "
|
||||
"opened. Try importing the project as a generic project."));
|
||||
accept();
|
||||
} else {
|
||||
@@ -225,15 +226,15 @@ void GitLabCloneDialog::cloneFinished(bool success)
|
||||
});
|
||||
bool ok = false;
|
||||
const QString fileToOpen
|
||||
= QInputDialog::getItem(this, tr("Open Project"),
|
||||
tr("Choose the project file to be opened."),
|
||||
= QInputDialog::getItem(this, Tr::tr("Open Project"),
|
||||
Tr::tr("Choose the project file to be opened."),
|
||||
pFiles, 0, false, &ok);
|
||||
accept();
|
||||
if (ok && !fileToOpen.isEmpty())
|
||||
ProjectExplorer::ProjectExplorerPlugin::openProject(base.pathAppended(fileToOpen));
|
||||
}
|
||||
} else {
|
||||
m_cloneOutput->appendPlainText(tr("Cloning failed.") + emptyLine);
|
||||
m_cloneOutput->appendPlainText(Tr::tr("Cloning failed.") + emptyLine);
|
||||
const FilePath fullPath = m_pathChooser->filePath().pathAppended(m_directoryLE->text());
|
||||
fullPath.removeRecursively();
|
||||
m_cloneButton->setEnabled(true);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -27,7 +26,6 @@ class Project;
|
||||
|
||||
class GitLabCloneDialog : public QDialog
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(GitLab::GitLabCloneDialog)
|
||||
public:
|
||||
explicit GitLabCloneDialog(const Project &project, QWidget *parent = nullptr);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "gitlabparameters.h"
|
||||
#include "gitlabplugin.h"
|
||||
#include "gitlabprojectsettings.h"
|
||||
#include "gitlabtr.h"
|
||||
|
||||
#include <projectexplorer/session.h>
|
||||
|
||||
@@ -46,7 +47,7 @@ GitLabDialog::GitLabDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, m_lastTreeViewQuery(Query::NoQuery)
|
||||
{
|
||||
setWindowTitle(tr("GitLab"));
|
||||
setWindowTitle(Tr::tr("GitLab"));
|
||||
resize(665, 530);
|
||||
|
||||
m_mainLabel = new QLabel;
|
||||
@@ -59,9 +60,9 @@ GitLabDialog::GitLabDialog(QWidget *parent)
|
||||
|
||||
m_searchLineEdit = new QLineEdit(this);
|
||||
m_searchLineEdit->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
m_searchLineEdit->setPlaceholderText(tr("Search"));
|
||||
m_searchLineEdit->setPlaceholderText(Tr::tr("Search"));
|
||||
|
||||
auto searchPB = new QPushButton(tr("Search"));
|
||||
auto searchPB = new QPushButton(Tr::tr("Search"));
|
||||
searchPB->setDefault(true);
|
||||
|
||||
m_treeView = new QTreeView(this);
|
||||
@@ -75,18 +76,18 @@ GitLabDialog::GitLabDialog(QWidget *parent)
|
||||
m_firstToolButton->setText(QString::fromUtf8("|<"));
|
||||
|
||||
m_previousToolButton = new QToolButton(this);
|
||||
m_previousToolButton->setText(tr("..."));
|
||||
m_previousToolButton->setText(Tr::tr("..."));
|
||||
|
||||
m_currentPageLabel = new QLabel(this);
|
||||
m_currentPageLabel->setText(tr("0"));
|
||||
m_currentPageLabel->setText(Tr::tr("0"));
|
||||
|
||||
m_nextToolButton = new QToolButton(this);
|
||||
m_nextToolButton->setText(tr("..."));
|
||||
m_nextToolButton->setText(Tr::tr("..."));
|
||||
|
||||
m_lastToolButton = new QToolButton(this);
|
||||
m_lastToolButton->setText(QString::fromUtf8(">|"));
|
||||
|
||||
m_clonePB = new QPushButton(Utils::Icons::DOWNLOAD.icon(), tr("Clone..."), this);
|
||||
m_clonePB = new QPushButton(Utils::Icons::DOWNLOAD.icon(), Tr::tr("Clone..."), this);
|
||||
m_clonePB->setEnabled(false);
|
||||
|
||||
auto buttonBox = new QDialogButtonBox(this);
|
||||
@@ -102,7 +103,7 @@ GitLabDialog::GitLabDialog(QWidget *parent)
|
||||
m_detailsLabel
|
||||
},
|
||||
st,
|
||||
tr("Remote:"),
|
||||
Tr::tr("Remote:"),
|
||||
m_remoteComboBox
|
||||
},
|
||||
Space(40),
|
||||
@@ -293,34 +294,34 @@ void GitLabDialog::handleUser(const User &user)
|
||||
m_currentUserId = user.id;
|
||||
|
||||
if (!user.error.message.isEmpty()) {
|
||||
m_mainLabel->setText(tr("Not logged in."));
|
||||
m_mainLabel->setText(Tr::tr("Not logged in."));
|
||||
if (user.error.code == 1) {
|
||||
m_detailsLabel->setText(tr("Insufficient access token."));
|
||||
m_detailsLabel->setText(Tr::tr("Insufficient access token."));
|
||||
m_detailsLabel->setToolTip(user.error.message + QLatin1Char('\n')
|
||||
+ tr("Permission scope read_api or api needed."));
|
||||
+ Tr::tr("Permission scope read_api or api needed."));
|
||||
} else if (user.error.code >= 300 && user.error.code < 400) {
|
||||
m_detailsLabel->setText(tr("Check settings for misconfiguration."));
|
||||
m_detailsLabel->setText(Tr::tr("Check settings for misconfiguration."));
|
||||
m_detailsLabel->setToolTip(user.error.message);
|
||||
} else {
|
||||
m_detailsLabel->setText({});
|
||||
m_detailsLabel->setToolTip({});
|
||||
}
|
||||
updatePageButtons();
|
||||
m_treeViewTitle->setText(tr("Projects (%1)").arg(0));
|
||||
m_treeViewTitle->setText(Tr::tr("Projects (%1)").arg(0));
|
||||
return;
|
||||
}
|
||||
|
||||
if (user.id != -1) {
|
||||
if (user.bot) {
|
||||
m_mainLabel->setText(tr("Using project access token."));
|
||||
m_mainLabel->setText(Tr::tr("Using project access token."));
|
||||
m_detailsLabel->setText({});
|
||||
} else {
|
||||
m_mainLabel->setText(tr("Logged in as %1").arg(user.name));
|
||||
m_detailsLabel->setText(tr("Id: %1 (%2)").arg(user.id).arg(user.email));
|
||||
m_mainLabel->setText(Tr::tr("Logged in as %1").arg(user.name));
|
||||
m_detailsLabel->setText(Tr::tr("Id: %1 (%2)").arg(user.id).arg(user.email));
|
||||
}
|
||||
m_detailsLabel->setToolTip({});
|
||||
} else {
|
||||
m_mainLabel->setText(tr("Not logged in."));
|
||||
m_mainLabel->setText(Tr::tr("Not logged in."));
|
||||
m_detailsLabel->setText({});
|
||||
m_detailsLabel->setToolTip({});
|
||||
}
|
||||
@@ -344,7 +345,7 @@ void GitLabDialog::handleProjects(const Projects &projects)
|
||||
});
|
||||
resetTreeView(m_treeView, listModel);
|
||||
int count = projects.error.message.isEmpty() ? projects.pageInfo.total : 0;
|
||||
m_treeViewTitle->setText(tr("Projects (%1)").arg(count));
|
||||
m_treeViewTitle->setText(Tr::tr("Projects (%1)").arg(count));
|
||||
|
||||
m_lastPageInformation = projects.pageInfo;
|
||||
updatePageButtons();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "gitlaboptionspage.h"
|
||||
|
||||
#include "gitlabparameters.h"
|
||||
#include "gitlabtr.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
@@ -47,27 +48,27 @@ GitLabServerWidget::GitLabServerWidget(Mode m, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_mode(m)
|
||||
{
|
||||
m_host.setLabelText(GitLabOptionsPage::tr("Host:"));
|
||||
m_host.setLabelText(Tr::tr("Host:"));
|
||||
m_host.setDisplayStyle(m == Display ? Utils::StringAspect::LabelDisplay
|
||||
: Utils::StringAspect::LineEditDisplay);
|
||||
m_host.setValidationFunction([](Utils::FancyLineEdit *l, QString *) {
|
||||
return hostValid(l->text());
|
||||
});
|
||||
|
||||
m_description.setLabelText(GitLabOptionsPage::tr("Description:"));
|
||||
m_description.setLabelText(Tr::tr("Description:"));
|
||||
m_description.setDisplayStyle(m == Display ? Utils::StringAspect::LabelDisplay
|
||||
: Utils::StringAspect::LineEditDisplay);
|
||||
|
||||
m_token.setLabelText(GitLabOptionsPage::tr("Access token:"));
|
||||
m_token.setLabelText(Tr::tr("Access token:"));
|
||||
m_token.setDisplayStyle(m == Display ? Utils::StringAspect::LabelDisplay
|
||||
: Utils::StringAspect::LineEditDisplay);
|
||||
m_token.setVisible(m == Edit);
|
||||
|
||||
m_port.setLabelText(GitLabOptionsPage::tr("Port:"));
|
||||
m_port.setLabelText(Tr::tr("Port:"));
|
||||
m_port.setRange(1, 65535);
|
||||
m_port.setValue(GitLabServer::defaultPort);
|
||||
m_port.setEnabled(m == Edit);
|
||||
m_secure.setLabelText(GitLabOptionsPage::tr("HTTPS:"));
|
||||
m_secure.setLabelText(Tr::tr("HTTPS:"));
|
||||
m_secure.setLabelPlacement(Utils::BoolAspect::LabelPlacement::InExtraLabel);
|
||||
m_secure.setDefaultValue(true);
|
||||
m_secure.setEnabled(m == Edit);
|
||||
@@ -110,20 +111,20 @@ void GitLabServerWidget::setGitLabServer(const GitLabServer &server)
|
||||
GitLabOptionsWidget::GitLabOptionsWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
auto defaultLabel = new QLabel(tr("Default:"), this);
|
||||
auto defaultLabel = new QLabel(Tr::tr("Default:"), this);
|
||||
m_defaultGitLabServer = new QComboBox(this);
|
||||
m_curl.setDisplayStyle(Utils::StringAspect::DisplayStyle::PathChooserDisplay);
|
||||
m_curl.setLabelText(tr("curl:"));
|
||||
m_curl.setLabelText(Tr::tr("curl:"));
|
||||
m_curl.setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
|
||||
m_gitLabServerWidget = new GitLabServerWidget(GitLabServerWidget::Display, this);
|
||||
|
||||
m_edit = new QPushButton(tr("Edit..."), this);
|
||||
m_edit->setToolTip(tr("Edit current selected GitLab server configuration."));
|
||||
m_remove = new QPushButton(tr("Remove"), this);
|
||||
m_remove->setToolTip(tr("Remove current selected GitLab server configuration."));
|
||||
m_add = new QPushButton(tr("Add..."), this);
|
||||
m_add->setToolTip(tr("Add new GitLab server configuration."));
|
||||
m_edit = new QPushButton(Tr::tr("Edit..."), this);
|
||||
m_edit->setToolTip(Tr::tr("Edit current selected GitLab server configuration."));
|
||||
m_remove = new QPushButton(Tr::tr("Remove"), this);
|
||||
m_remove->setToolTip(Tr::tr("Remove current selected GitLab server configuration."));
|
||||
m_add = new QPushButton(Tr::tr("Add..."), this);
|
||||
m_add->setToolTip(Tr::tr("Add new GitLab server configuration."));
|
||||
|
||||
using namespace Utils::Layouting;
|
||||
|
||||
@@ -177,13 +178,13 @@ void GitLabOptionsWidget::showEditServerDialog()
|
||||
{
|
||||
const GitLabServer old = m_defaultGitLabServer->currentData().value<GitLabServer>();
|
||||
QDialog d;
|
||||
d.setWindowTitle(tr("Edit Server..."));
|
||||
d.setWindowTitle(Tr::tr("Edit Server..."));
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
GitLabServerWidget *serverWidget = new GitLabServerWidget(GitLabServerWidget::Edit, this);
|
||||
serverWidget->setGitLabServer(old);
|
||||
layout->addWidget(serverWidget);
|
||||
auto buttons = new QDialogButtonBox(QDialogButtonBox::Cancel, this);
|
||||
auto modifyButton = buttons->addButton(tr("Modify"), QDialogButtonBox::AcceptRole);
|
||||
auto modifyButton = buttons->addButton(Tr::tr("Modify"), QDialogButtonBox::AcceptRole);
|
||||
connect(modifyButton, &QPushButton::clicked, &d, &QDialog::accept);
|
||||
connect(buttons->button(QDialogButtonBox::Cancel), &QPushButton::clicked, &d, &QDialog::reject);
|
||||
layout->addWidget(buttons);
|
||||
@@ -199,12 +200,12 @@ void GitLabOptionsWidget::showEditServerDialog()
|
||||
void GitLabOptionsWidget::showAddServerDialog()
|
||||
{
|
||||
QDialog d;
|
||||
d.setWindowTitle(tr("Add Server..."));
|
||||
d.setWindowTitle(Tr::tr("Add Server..."));
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
GitLabServerWidget *serverWidget = new GitLabServerWidget(GitLabServerWidget::Edit, this);
|
||||
layout->addWidget(serverWidget);
|
||||
auto buttons = new QDialogButtonBox(QDialogButtonBox::Cancel, this);
|
||||
auto addButton = buttons->addButton(tr("Add"), QDialogButtonBox::AcceptRole);
|
||||
auto addButton = buttons->addButton(Tr::tr("Add"), QDialogButtonBox::AcceptRole);
|
||||
connect(addButton, &QPushButton::clicked, &d, &QDialog::accept);
|
||||
connect(buttons->button(QDialogButtonBox::Cancel), &QPushButton::clicked, &d, &QDialog::reject);
|
||||
layout->addWidget(buttons);
|
||||
@@ -257,7 +258,7 @@ GitLabOptionsPage::GitLabOptionsPage(GitLabParameters *p, QObject *parent)
|
||||
, m_parameters(p)
|
||||
{
|
||||
setId(Constants::GITLAB_SETTINGS);
|
||||
setDisplayName(tr("GitLab"));
|
||||
setDisplayName(Tr::tr("GitLab"));
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "gitlaboptionspage.h"
|
||||
#include "gitlabparameters.h"
|
||||
#include "gitlabprojectsettings.h"
|
||||
#include "gitlabtr.h"
|
||||
#include "queryrunner.h"
|
||||
#include "resultparser.h"
|
||||
|
||||
@@ -73,12 +74,12 @@ void GitLabPlugin::initialize()
|
||||
dd->parameters.fromSettings(Core::ICore::settings());
|
||||
auto panelFactory = new ProjectExplorer::ProjectPanelFactory;
|
||||
panelFactory->setPriority(999);
|
||||
panelFactory->setDisplayName(tr("GitLab"));
|
||||
panelFactory->setDisplayName(Tr::tr("GitLab"));
|
||||
panelFactory->setCreateWidgetFunction([](ProjectExplorer::Project *project) {
|
||||
return new GitLabProjectSettingsWidget(project);
|
||||
});
|
||||
ProjectExplorer::ProjectPanelFactory::registerFactory(panelFactory);
|
||||
QAction *openViewAction = new QAction(tr("GitLab..."), this);
|
||||
QAction *openViewAction = new QAction(Tr::tr("GitLab..."), this);
|
||||
auto gitlabCommand = Core::ActionManager::registerAction(openViewAction,
|
||||
Constants::GITLAB_OPEN_VIEW);
|
||||
connect(openViewAction, &QAction::triggered, this, &GitLabPlugin::openView);
|
||||
@@ -97,8 +98,8 @@ void GitLabPlugin::openView()
|
||||
{
|
||||
if (dd->dialog.isNull()) {
|
||||
while (!dd->parameters.isValid()) {
|
||||
QMessageBox::warning(Core::ICore::dialogParent(), tr("Error"),
|
||||
tr("Invalid GitLab configuration. For a fully functional "
|
||||
QMessageBox::warning(Core::ICore::dialogParent(), Tr::tr("Error"),
|
||||
Tr::tr("Invalid GitLab configuration. For a fully functional "
|
||||
"configuration, you need to set up host name or address and "
|
||||
"an access token. Providing the path to curl is mandatory."));
|
||||
if (!Core::ICore::showOptionsDialog("GitLab"))
|
||||
@@ -290,10 +291,8 @@ bool GitLabPlugin::handleCertificateIssue(const Utils::Id &serverId)
|
||||
|
||||
GitLabServer server = dd->parameters.serverForId(serverId);
|
||||
if (QMessageBox::question(Core::ICore::dialogParent(),
|
||||
QCoreApplication::translate(
|
||||
"GitLab::GitLabDialog", "Certificate Error"),
|
||||
QCoreApplication::translate(
|
||||
"GitLab::GitLabDialog",
|
||||
Tr::tr("Certificate Error"),
|
||||
Tr::tr(
|
||||
"Server certificate for %1 cannot be authenticated.\n"
|
||||
"Do you want to disable SSL verification for this server?\n"
|
||||
"Note: This can expose you to man-in-the-middle attack.")
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "gitlaboptionspage.h"
|
||||
#include "gitlabplugin.h"
|
||||
#include "gitlabtr.h"
|
||||
#include "queryrunner.h"
|
||||
#include "resultparser.h"
|
||||
|
||||
@@ -31,13 +32,12 @@ const char PSK_LAST_REQ[] = "GitLab.LastRequest";
|
||||
|
||||
static QString accessLevelString(int accessLevel)
|
||||
{
|
||||
const char trContext[] = "GitLab::GitLabProjectSettingsWidget";
|
||||
switch (accessLevel) {
|
||||
case 10: return QCoreApplication::translate(trContext, "Guest");
|
||||
case 20: return QCoreApplication::translate(trContext, "Reporter");
|
||||
case 30: return QCoreApplication::translate(trContext, "Developer");
|
||||
case 40: return QCoreApplication::translate(trContext, "Maintainer");
|
||||
case 50: return QCoreApplication::translate(trContext, "Owner");
|
||||
case 10: return Tr::tr("Guest");
|
||||
case 20: return Tr::tr("Reporter");
|
||||
case 30: return Tr::tr("Developer");
|
||||
case 40: return Tr::tr("Maintainer");
|
||||
case 50: return Tr::tr("Owner");
|
||||
}
|
||||
return {};
|
||||
}
|
||||
@@ -120,27 +120,28 @@ GitLabProjectSettingsWidget::GitLabProjectSettingsWidget(ProjectExplorer::Projec
|
||||
verticalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
auto formLayout = new QFormLayout;
|
||||
m_hostCB = new QComboBox;
|
||||
formLayout->addRow(tr("Host:"), m_hostCB);
|
||||
formLayout->addRow(Tr::tr("Host:"), m_hostCB);
|
||||
m_linkedGitLabServer = new QComboBox;
|
||||
formLayout->addRow(tr("Linked GitLab Configuration:"), m_linkedGitLabServer);
|
||||
formLayout->addRow(Tr::tr("Linked GitLab Configuration:"), m_linkedGitLabServer);
|
||||
verticalLayout->addLayout(formLayout);
|
||||
m_infoLabel = new Utils::InfoLabel;
|
||||
m_infoLabel->setVisible(false);
|
||||
verticalLayout->addWidget(m_infoLabel);
|
||||
auto horizontalLayout = new QHBoxLayout;
|
||||
horizontalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
m_linkWithGitLab = new QPushButton(tr("Link with GitLab"));
|
||||
m_linkWithGitLab = new QPushButton(Tr::tr("Link with GitLab"));
|
||||
horizontalLayout->addWidget(m_linkWithGitLab);
|
||||
m_unlink = new QPushButton(tr("Unlink from GitLab"));
|
||||
m_unlink = new QPushButton(Tr::tr("Unlink from GitLab"));
|
||||
m_unlink->setEnabled(false);
|
||||
horizontalLayout->addWidget(m_unlink);
|
||||
m_checkConnection = new QPushButton(tr("Test Connection"));
|
||||
m_checkConnection = new QPushButton(Tr::tr("Test Connection"));
|
||||
m_checkConnection->setEnabled(false);
|
||||
horizontalLayout->addWidget(m_checkConnection);
|
||||
horizontalLayout->addStretch(1);
|
||||
verticalLayout->addLayout(horizontalLayout);
|
||||
verticalLayout->addWidget(new QLabel(tr("Projects linked with GitLab receive event "
|
||||
"notifications in the Version Control output pane.")));
|
||||
verticalLayout->addWidget(new QLabel(Tr::tr("Projects linked with GitLab receive event "
|
||||
"notifications in the Version Control output "
|
||||
"pane.")));
|
||||
|
||||
connect(m_linkWithGitLab, &QPushButton::clicked, this, [this] {
|
||||
checkConnection(Link);
|
||||
@@ -178,7 +179,7 @@ void GitLabProjectSettingsWidget::checkConnection(CheckMode mode)
|
||||
const auto [remoteHost, projName, port] = GitLabProjectSettings::remotePartsFromRemote(remote);
|
||||
if (remoteHost != server.host) { // port check as well
|
||||
m_infoLabel->setType(Utils::InfoLabel::NotOk);
|
||||
m_infoLabel->setText(tr("Remote host does not match chosen GitLab configuration."));
|
||||
m_infoLabel->setText(Tr::tr("Remote host does not match chosen GitLab configuration."));
|
||||
m_infoLabel->setVisible(true);
|
||||
return;
|
||||
}
|
||||
@@ -210,17 +211,17 @@ void GitLabProjectSettingsWidget::onConnectionChecked(const Project &project,
|
||||
bool linkable = false;
|
||||
if (!project.error.message.isEmpty()) {
|
||||
m_infoLabel->setType(Utils::InfoLabel::Error);
|
||||
m_infoLabel->setText(tr("Check settings for misconfiguration.")
|
||||
m_infoLabel->setText(Tr::tr("Check settings for misconfiguration.")
|
||||
+ " (" + project.error.message + ')');
|
||||
} else {
|
||||
if (project.accessLevel != -1) {
|
||||
m_infoLabel->setType(Utils::InfoLabel::Ok);
|
||||
m_infoLabel->setText(tr("Accessible (%1).")
|
||||
m_infoLabel->setText(Tr::tr("Accessible (%1).")
|
||||
.arg(accessLevelString(project.accessLevel)));
|
||||
linkable = true;
|
||||
} else {
|
||||
m_infoLabel->setType(Utils::InfoLabel::Warning);
|
||||
m_infoLabel->setText(tr("Read only access."));
|
||||
m_infoLabel->setText(Tr::tr("Read only access."));
|
||||
}
|
||||
}
|
||||
m_infoLabel->setVisible(true);
|
||||
@@ -294,9 +295,9 @@ void GitLabProjectSettingsWidget::updateEnabledStates()
|
||||
const Utils::FilePath repository = gitClient
|
||||
? gitClient->findRepositoryForDirectory(projectDirectory) : Utils::FilePath();
|
||||
if (repository.isEmpty())
|
||||
m_infoLabel->setText(tr("Not a git repository."));
|
||||
m_infoLabel->setText(Tr::tr("Not a git repository."));
|
||||
else
|
||||
m_infoLabel->setText(tr("Local git repository without remotes."));
|
||||
m_infoLabel->setText(Tr::tr("Local git repository without remotes."));
|
||||
m_infoLabel->setType(Utils::InfoLabel::None);
|
||||
m_infoLabel->setVisible(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user