Fossil: Inline configuredialog.ui

Change-Id: I74e7372ef4839788f4cf9bf0595c9f0a41c0a604
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2023-02-06 21:37:32 +01:00
parent 0c1b59fb1a
commit 02777c4179
5 changed files with 55 additions and 161 deletions

View File

@@ -6,7 +6,7 @@ add_qtc_plugin(Fossil
annotationhighlighter.cpp annotationhighlighter.h
branchinfo.h
commiteditor.cpp commiteditor.h
configuredialog.cpp configuredialog.h configuredialog.ui
configuredialog.cpp configuredialog.h
constants.h
fossil.qrc
fossilclient.cpp fossilclient.h

View File

@@ -2,13 +2,16 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "configuredialog.h"
#include "ui_configuredialog.h"
#include "fossilsettings.h"
#include <utils/layoutbuilder.h>
#include <utils/pathchooser.h>
#include <QDialogButtonBox>
#include <QCheckBox>
#include <QDir>
#include <QLineEdit>
namespace Fossil {
namespace Internal {
@@ -17,30 +20,68 @@ class ConfigureDialogPrivate {
public:
RepositorySettings settings() const
{
return {m_ui.userLineEdit->text().trimmed(),
m_ui.sslIdentityFilePathChooser->filePath().toString(),
m_ui.disableAutosyncCheckBox->isChecked()
return {m_userLineEdit->text().trimmed(),
m_sslIdentityFilePathChooser->filePath().toString(),
m_disableAutosyncCheckBox->isChecked()
? RepositorySettings::AutosyncOff : RepositorySettings::AutosyncOn};
}
void updateUi() {
m_ui.userLineEdit->setText(m_settings.user.trimmed());
m_ui.userLineEdit->selectAll();
m_ui.sslIdentityFilePathChooser->setPath(QDir::toNativeSeparators(m_settings.sslIdentityFile));
m_ui.disableAutosyncCheckBox->setChecked(m_settings.autosync == RepositorySettings::AutosyncOff);
m_userLineEdit->setText(m_settings.user.trimmed());
m_userLineEdit->selectAll();
m_sslIdentityFilePathChooser->setPath(QDir::toNativeSeparators(m_settings.sslIdentityFile));
m_disableAutosyncCheckBox->setChecked(m_settings.autosync == RepositorySettings::AutosyncOff);
}
Ui::ConfigureDialog m_ui;
QLineEdit *m_userLineEdit;
Utils::PathChooser *m_sslIdentityFilePathChooser;
QCheckBox *m_disableAutosyncCheckBox;
RepositorySettings m_settings;
};
ConfigureDialog::ConfigureDialog(QWidget *parent) : QDialog(parent),
d(new ConfigureDialogPrivate)
{
d->m_ui.setupUi(this);
d->m_ui.sslIdentityFilePathChooser->setExpectedKind(Utils::PathChooser::File);
d->m_ui.sslIdentityFilePathChooser->setPromptDialogTitle(tr("SSL/TLS Identity Key"));
setWindowTitle(tr("Configure Repository"));
resize(600, 0);
d->m_userLineEdit = new QLineEdit;
d->m_userLineEdit->setToolTip(
tr("Existing user to become an author of changes made to the repository."));
d->m_sslIdentityFilePathChooser = new Utils::PathChooser;
d->m_sslIdentityFilePathChooser->setExpectedKind(Utils::PathChooser::File);
d->m_sslIdentityFilePathChooser->setPromptDialogTitle(tr("SSL/TLS Identity Key"));
d->m_sslIdentityFilePathChooser->setToolTip(
tr("SSL/TLS client identity key to use if requested by the server."));
d->m_disableAutosyncCheckBox = new QCheckBox(tr("Disable auto-sync"));
d->m_disableAutosyncCheckBox->setToolTip(
tr("Disable automatic pull prior to commit or update and automatic push "
"after commit or tag or branch creation."));
auto buttonBox = new QDialogButtonBox;
buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
using namespace Utils::Layouting;
Column {
Group {
title(tr("Repository User")),
Form { tr("User:"), d->m_userLineEdit, },
},
Group {
title(tr("Repository Settings")),
Form {
tr("SSL/TLS identity:"), d->m_sslIdentityFilePathChooser, br,
d->m_disableAutosyncCheckBox,
},
},
buttonBox,
}.attachTo(this);
d->updateUi();
}
@@ -60,17 +101,5 @@ void ConfigureDialog::setSettings(const RepositorySettings &settings)
d->updateUi();
}
void ConfigureDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
d->m_ui.retranslateUi(this);
break;
default:
break;
}
}
} // namespace Internal
} // namespace Fossil

View File

@@ -22,9 +22,6 @@ public:
const RepositorySettings settings() const;
void setSettings(const RepositorySettings &settings);
protected:
void changeEvent(QEvent *e) final;
private:
ConfigureDialogPrivate *d = nullptr;
};

View File

@@ -1,132 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Fossil::Internal::ConfigureDialog</class>
<widget class="QDialog" name="Fossil::Internal::ConfigureDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>385</width>
<height>202</height>
</rect>
</property>
<property name="windowTitle">
<string>Configure Repository</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="repoUserGroupBox">
<property name="title">
<string>Repository User</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="userLabel">
<property name="text">
<string>User:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="userLineEdit">
<property name="toolTip">
<string>Existing user to become an author of changes made to the repository.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="repoSettingsGroupBox">
<property name="title">
<string>Repository Settings</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="sslIdentityFileLabel">
<property name="text">
<string>SSL/TLS identity:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="sslIdentityFilePathChooser" native="true">
<property name="toolTip">
<string>SSL/TLS client identity key to use if requested by the server.</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="disableAutosyncCheckBox">
<property name="toolTip">
<string>Disable automatic pull prior to commit or update and automatic push after commit or tag or branch creation.</string>
</property>
<property name="text">
<string>Disable auto-sync</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
<slots>
<signal>editingFinished()</signal>
<signal>browsingFinished()</signal>
</slots>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Fossil::Internal::ConfigureDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Fossil::Internal::ConfigureDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -22,7 +22,7 @@ QtcPlugin {
"annotationhighlighter.cpp", "annotationhighlighter.h",
"pullorpushdialog.cpp", "pullorpushdialog.h", "pullorpushdialog.ui",
"branchinfo.h",
"configuredialog.cpp", "configuredialog.h", "configuredialog.ui",
"configuredialog.cpp", "configuredialog.h",
"revisioninfo.h",
"fossil.qrc",
"revertdialog.ui",