forked from qt-creator/qt-creator
Adapt to upstream changes
Change-Id: Ibdbd3abcfd65b091744451830625e2135c6573d9 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
b418e205cf
commit
b6f137afef
@@ -28,32 +28,32 @@
|
||||
#include "fossilclient.h"
|
||||
#include "fossilsettings.h"
|
||||
#include "fossilplugin.h"
|
||||
#include "ui_optionspage.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
|
||||
#include <QTextStream>
|
||||
namespace Fossil {
|
||||
namespace Internal {
|
||||
|
||||
using namespace Fossil::Internal;
|
||||
using namespace Fossil;
|
||||
|
||||
OptionsPageWidget::OptionsPageWidget(QWidget *parent) :
|
||||
VcsClientOptionsPageWidget(parent)
|
||||
class OptionsPageWidget final : public Core::IOptionsPageWidget
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
m_ui.commandChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
m_ui.commandChooser->setPromptDialogTitle(tr("Fossil Command"));
|
||||
m_ui.commandChooser->setHistoryCompleter("Fossil.Command.History");
|
||||
m_ui.defaultRepoPathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
|
||||
m_ui.defaultRepoPathChooser->setPromptDialogTitle(tr("Fossil Repositories"));
|
||||
m_ui.sslIdentityFilePathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
m_ui.sslIdentityFilePathChooser->setPromptDialogTitle(tr("SSL/TLS Identity Key"));
|
||||
}
|
||||
Q_DECLARE_TR_FUNCTIONS(Fossil::Internal::OptionsPageWidget)
|
||||
|
||||
VcsBase::VcsBaseClientSettings OptionsPageWidget::settings() const
|
||||
public:
|
||||
OptionsPageWidget(Core::IVersionControl *control, FossilSettings *settings);
|
||||
void apply() final;
|
||||
|
||||
private:
|
||||
Ui::OptionsPage m_ui;
|
||||
Core::IVersionControl *m_control;
|
||||
FossilSettings *m_settings;
|
||||
};
|
||||
|
||||
void OptionsPageWidget::apply()
|
||||
{
|
||||
VcsBase::VcsBaseClientSettings s = FossilPlugin::instance()->client()->settings();
|
||||
FossilSettings s = *m_settings;
|
||||
s.setValue(FossilSettings::binaryPathKey, m_ui.commandChooser->rawPath());
|
||||
s.setValue(FossilSettings::defaultRepoPathKey, m_ui.defaultRepoPathChooser->path());
|
||||
s.setValue(FossilSettings::userNameKey, m_ui.defaultUsernameLineEdit->text().trimmed());
|
||||
@@ -62,25 +62,43 @@ VcsBase::VcsBaseClientSettings OptionsPageWidget::settings() const
|
||||
s.setValue(FossilSettings::timelineWidthKey, m_ui.logEntriesWidth->value());
|
||||
s.setValue(FossilSettings::timeoutKey, m_ui.timeout->value());
|
||||
s.setValue(FossilSettings::disableAutosyncKey, m_ui.disableAutosyncCheckBox->isChecked());
|
||||
return s;
|
||||
if (*m_settings == s)
|
||||
return;
|
||||
|
||||
*m_settings = s;
|
||||
emit m_control->configurationChanged();
|
||||
}
|
||||
|
||||
void OptionsPageWidget::setSettings(const VcsBase::VcsBaseClientSettings &s)
|
||||
OptionsPageWidget::OptionsPageWidget(Core::IVersionControl *control, FossilSettings *settings) :
|
||||
m_control(control),
|
||||
m_settings(settings)
|
||||
{
|
||||
m_ui.commandChooser->setPath(s.stringValue(FossilSettings::binaryPathKey));
|
||||
m_ui.defaultRepoPathChooser->setPath(s.stringValue(FossilSettings::defaultRepoPathKey));
|
||||
m_ui.defaultUsernameLineEdit->setText(s.stringValue(FossilSettings::userNameKey));
|
||||
m_ui.sslIdentityFilePathChooser->setPath(s.stringValue(FossilSettings::sslIdentityFileKey));
|
||||
m_ui.logEntriesCount->setValue(s.intValue(FossilSettings::logCountKey));
|
||||
m_ui.logEntriesWidth->setValue(s.intValue(FossilSettings::timelineWidthKey));
|
||||
m_ui.timeout->setValue(s.intValue(FossilSettings::timeoutKey));
|
||||
m_ui.disableAutosyncCheckBox->setChecked(s.boolValue(FossilSettings::disableAutosyncKey));
|
||||
m_ui.setupUi(this);
|
||||
m_ui.commandChooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
|
||||
m_ui.commandChooser->setPromptDialogTitle(tr("Fossil Command"));
|
||||
m_ui.commandChooser->setHistoryCompleter("Fossil.Command.History");
|
||||
m_ui.commandChooser->setPath(m_settings->stringValue(FossilSettings::binaryPathKey));
|
||||
m_ui.defaultRepoPathChooser->setExpectedKind(Utils::PathChooser::ExistingDirectory);
|
||||
m_ui.defaultRepoPathChooser->setPromptDialogTitle(tr("Fossil Repositories"));
|
||||
m_ui.defaultRepoPathChooser->setPath(m_settings->stringValue(FossilSettings::defaultRepoPathKey));
|
||||
m_ui.sslIdentityFilePathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||
m_ui.sslIdentityFilePathChooser->setPromptDialogTitle(tr("SSL/TLS Identity Key"));
|
||||
m_ui.sslIdentityFilePathChooser->setPath(m_settings->stringValue(FossilSettings::sslIdentityFileKey));
|
||||
m_ui.defaultUsernameLineEdit->setText(m_settings->stringValue(FossilSettings::userNameKey));
|
||||
m_ui.logEntriesCount->setValue(m_settings->intValue(FossilSettings::logCountKey));
|
||||
m_ui.logEntriesWidth->setValue(m_settings->intValue(FossilSettings::timelineWidthKey));
|
||||
m_ui.timeout->setValue(m_settings->intValue(FossilSettings::timeoutKey));
|
||||
m_ui.disableAutosyncCheckBox->setChecked(m_settings->boolValue(FossilSettings::disableAutosyncKey));
|
||||
}
|
||||
|
||||
OptionsPage::OptionsPage(Core::IVersionControl *control, QObject *parent) :
|
||||
VcsClientOptionsPage(control, FossilPlugin::instance()->client(), parent)
|
||||
OptionsPage::OptionsPage(Core::IVersionControl *control, FossilSettings *settings, QObject *parent) :
|
||||
Core::IOptionsPage(parent)
|
||||
{
|
||||
setId(Constants::VCS_ID_FOSSIL);
|
||||
setDisplayName(tr("Fossil"));
|
||||
setWidgetFactory([]() { return new OptionsPageWidget; });
|
||||
setDisplayName(OptionsPageWidget::tr("Fossil"));
|
||||
setWidgetCreator([control, settings]() { return new OptionsPageWidget(control, settings); });
|
||||
setCategory(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||
}
|
||||
|
||||
} // Internal
|
||||
} // Fossil
|
||||
|
||||
Reference in New Issue
Block a user