mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-09-11 02:35:41 +03:00
Format code
This commit is contained in:
parent
975633c94f
commit
ead51fdb97
@ -155,7 +155,8 @@ Application::Application(int &argc, char **argv, bool haltOnParseError)
|
||||
|
||||
// Read translation settings.
|
||||
QSettings settings;
|
||||
if ((!settings.value(Setting::key(Setting::Id::DontTranslate), false).toBool()) &&
|
||||
if ((!settings.value(Setting::key(Setting::Id::DontTranslate), false)
|
||||
.toBool()) &&
|
||||
(!parser.isSet("no-translation"))) {
|
||||
// Load translation files.
|
||||
QLocale locale;
|
||||
@ -230,7 +231,9 @@ Application::Application(int &argc, char **argv, bool haltOnParseError)
|
||||
|
||||
void Application::autoUpdate() {
|
||||
// Check for updates.
|
||||
if (Settings::instance()->value(Setting::Id::CheckForUpdatesAutomatically).toBool()) {
|
||||
if (Settings::instance()
|
||||
->value(Setting::Id::CheckForUpdatesAutomatically)
|
||||
.toBool()) {
|
||||
// Check now.
|
||||
Updater::instance()->update(true);
|
||||
|
||||
@ -368,7 +371,9 @@ protected:
|
||||
#endif
|
||||
|
||||
bool Application::runSingleInstance() {
|
||||
if (Settings::instance()->value(Setting::Id::AllowSingleInstanceOnly).toBool()) {
|
||||
if (Settings::instance()
|
||||
->value(Setting::Id::AllowSingleInstanceOnly)
|
||||
.toBool()) {
|
||||
#if defined(Q_OS_LINUX)
|
||||
QDBusConnection bus = QDBusConnection::sessionBus();
|
||||
|
||||
|
@ -74,14 +74,7 @@ class Prompt : public SettingsTempl<Prompt> {
|
||||
Q_GADGET
|
||||
|
||||
public:
|
||||
enum class Kind {
|
||||
Stash,
|
||||
Merge,
|
||||
Revert,
|
||||
CherryPick,
|
||||
Directories,
|
||||
LargeFiles
|
||||
};
|
||||
enum class Kind { Stash, Merge, Revert, CherryPick, Directories, LargeFiles };
|
||||
Q_ENUM(Kind)
|
||||
|
||||
static void initialize(QMap<Kind, QString> &keys);
|
||||
|
@ -107,7 +107,7 @@ QVariant Settings::value(Setting::Id id) const {
|
||||
return value(Setting::key(id));
|
||||
}
|
||||
|
||||
QVariant Settings::value(Setting::Id id, const QVariant& defaultValue) const {
|
||||
QVariant Settings::value(Setting::Id id, const QVariant &defaultValue) const {
|
||||
return value(Setting::key(id), defaultValue);
|
||||
}
|
||||
|
||||
@ -186,12 +186,12 @@ QString Settings::promptDescription(Prompt::Kind kind) const {
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::setHotkey(const QString& action, const QString& hotkey) {
|
||||
setValue("hotkeys/"+action, hotkey);
|
||||
void Settings::setHotkey(const QString &action, const QString &hotkey) {
|
||||
setValue("hotkeys/" + action, hotkey);
|
||||
}
|
||||
|
||||
QString Settings::hotkey(const QString& action) const {
|
||||
return value("hotkeys/"+action, "").toString();
|
||||
QString Settings::hotkey(const QString &action) const {
|
||||
return value("hotkeys/" + action, "").toString();
|
||||
}
|
||||
|
||||
bool Settings::isWhitespaceIgnored() const {
|
||||
|
@ -33,8 +33,8 @@ public:
|
||||
void setPrompt(Prompt::Kind kind, bool prompt);
|
||||
QString promptDescription(Prompt::Kind kind) const;
|
||||
|
||||
void setHotkey(const QString& action, const QString& hotkey);
|
||||
QString hotkey(const QString& action) const;
|
||||
void setHotkey(const QString &action, const QString &hotkey);
|
||||
QString hotkey(const QString &action) const;
|
||||
|
||||
// ignore whitespace
|
||||
bool isWhitespaceIgnored() const;
|
||||
|
@ -146,10 +146,13 @@ public:
|
||||
// Read defaults from global settings.
|
||||
Settings *settings = Settings::instance();
|
||||
bool fetch = settings->value(Setting::Id::FetchAutomatically).toBool();
|
||||
int minutes = settings->value(Setting::Id::AutomaticFetchPeriodInMinutes).toInt();
|
||||
int minutes =
|
||||
settings->value(Setting::Id::AutomaticFetchPeriodInMinutes).toInt();
|
||||
|
||||
bool push = settings->value(Setting::Id::PushAfterEachCommit).toBool();
|
||||
bool update = settings->value(Setting::Id::UpdateSubmodulesAfterPullAndClone).toBool();
|
||||
bool update =
|
||||
settings->value(Setting::Id::UpdateSubmodulesAfterPullAndClone)
|
||||
.toBool();
|
||||
bool prune = settings->value(Setting::Id::PruneAfterFetch).toBool();
|
||||
|
||||
git::Config app = mRepo.appConfig();
|
||||
|
@ -88,13 +88,15 @@ DiffPanel::DiffPanel(const git::Repository &repo, QWidget *parent)
|
||||
// auto collapse
|
||||
Settings *settings = Settings::instance();
|
||||
QCheckBox *collapseAdded = new QCheckBox(tr("Added files"), this);
|
||||
collapseAdded->setChecked(settings->value(Setting::Id::AutoCollapseAddedFiles).toBool());
|
||||
collapseAdded->setChecked(
|
||||
settings->value(Setting::Id::AutoCollapseAddedFiles).toBool());
|
||||
connect(collapseAdded, &QCheckBox::toggled, [settings](bool checked) {
|
||||
settings->setValue(Setting::Id::AutoCollapseAddedFiles, checked);
|
||||
});
|
||||
|
||||
QCheckBox *collapseDeleted = new QCheckBox(tr("Deleted files"), this);
|
||||
collapseDeleted->setChecked(settings->value(Setting::Id::AutoCollapseDeletedFiles).toBool());
|
||||
collapseDeleted->setChecked(
|
||||
settings->value(Setting::Id::AutoCollapseDeletedFiles).toBool());
|
||||
connect(collapseDeleted, &QCheckBox::toggled, [settings](bool checked) {
|
||||
settings->setValue(Setting::Id::AutoCollapseDeletedFiles, checked);
|
||||
});
|
||||
|
@ -49,9 +49,12 @@ MergeDialog::MergeDialog(RepoView::MergeFlags flags,
|
||||
QLabel *label = new QLabel(labelText(), this);
|
||||
|
||||
QCheckBox *noCommit = new QCheckBox(tr("No commit"), this);
|
||||
noCommit->setChecked(!Settings::instance()->value(Setting::Id::CommitMergeImmediately).toBool());
|
||||
noCommit->setChecked(!Settings::instance()
|
||||
->value(Setting::Id::CommitMergeImmediately)
|
||||
.toBool());
|
||||
connect(noCommit, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::CommitMergeImmediately, !checked);
|
||||
Settings::instance()->setValue(Setting::Id::CommitMergeImmediately,
|
||||
!checked);
|
||||
});
|
||||
|
||||
noCommit->setVisible(flags & RepoView::Merge);
|
||||
@ -96,7 +99,9 @@ git::Reference MergeDialog::reference() const {
|
||||
RepoView::MergeFlags MergeDialog::flags() const {
|
||||
int action = mAction->itemData(mAction->currentIndex()).toInt();
|
||||
RepoView::MergeFlags flags = static_cast<RepoView::MergeFlags>(action);
|
||||
if (!Settings::instance()->value(Setting::Id::CommitMergeImmediately).toBool())
|
||||
if (!Settings::instance()
|
||||
->value(Setting::Id::CommitMergeImmediately)
|
||||
.toBool())
|
||||
flags |= RepoView::NoCommit;
|
||||
return flags;
|
||||
}
|
||||
|
@ -158,7 +158,8 @@ public:
|
||||
|
||||
auto signal = QOverload<int>::of(&QSpinBox::valueChanged);
|
||||
connect(mFetchMinutes, signal, [](int value) {
|
||||
Settings::instance()->setValue(Setting::Id::AutomaticFetchPeriodInMinutes, value);
|
||||
Settings::instance()->setValue(Setting::Id::AutomaticFetchPeriodInMinutes,
|
||||
value);
|
||||
});
|
||||
|
||||
connect(mPushCommit, &QCheckBox::toggled, [](bool checked) {
|
||||
@ -166,7 +167,8 @@ public:
|
||||
});
|
||||
|
||||
connect(mPullUpdate, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::UpdateSubmodulesAfterPullAndClone, checked);
|
||||
Settings::instance()->setValue(
|
||||
Setting::Id::UpdateSubmodulesAfterPullAndClone, checked);
|
||||
});
|
||||
|
||||
connect(mAutoPrune, &QCheckBox::toggled, [](bool checked) {
|
||||
@ -183,7 +185,8 @@ public:
|
||||
});
|
||||
|
||||
connect(mSingleInstance, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::AllowSingleInstanceOnly, checked);
|
||||
Settings::instance()->setValue(Setting::Id::AllowSingleInstanceOnly,
|
||||
checked);
|
||||
});
|
||||
}
|
||||
|
||||
@ -193,17 +196,26 @@ public:
|
||||
mEmail->setText(config.value<QString>("user.email"));
|
||||
|
||||
Settings *settings = Settings::instance();
|
||||
mFetch->setChecked(settings->value(Setting::Id::FetchAutomatically).toBool());
|
||||
mFetchMinutes->setValue(settings->value(Setting::Id::AutomaticFetchPeriodInMinutes).toInt());
|
||||
mFetch->setChecked(
|
||||
settings->value(Setting::Id::FetchAutomatically).toBool());
|
||||
mFetchMinutes->setValue(
|
||||
settings->value(Setting::Id::AutomaticFetchPeriodInMinutes).toInt());
|
||||
|
||||
mPushCommit->setChecked(settings->value(Setting::Id::PushAfterEachCommit).toBool());
|
||||
mPullUpdate->setChecked(settings->value(Setting::Id::UpdateSubmodulesAfterPullAndClone).toBool());
|
||||
mAutoPrune->setChecked(settings->value(Setting::Id::PruneAfterFetch).toBool());
|
||||
mPushCommit->setChecked(
|
||||
settings->value(Setting::Id::PushAfterEachCommit).toBool());
|
||||
mPullUpdate->setChecked(
|
||||
settings->value(Setting::Id::UpdateSubmodulesAfterPullAndClone)
|
||||
.toBool());
|
||||
mAutoPrune->setChecked(
|
||||
settings->value(Setting::Id::PruneAfterFetch).toBool());
|
||||
|
||||
mNoTranslation->setChecked(settings->value(Setting::Id::DontTranslate).toBool());
|
||||
mStoreCredentials->setChecked(settings->value(Setting::Id::StoreCredentials).toBool());
|
||||
mNoTranslation->setChecked(
|
||||
settings->value(Setting::Id::DontTranslate).toBool());
|
||||
mStoreCredentials->setChecked(
|
||||
settings->value(Setting::Id::StoreCredentials).toBool());
|
||||
|
||||
mSingleInstance->setChecked(settings->value(Setting::Id::AllowSingleInstanceOnly).toBool());
|
||||
mSingleInstance->setChecked(
|
||||
settings->value(Setting::Id::AllowSingleInstanceOnly).toBool());
|
||||
}
|
||||
|
||||
private:
|
||||
@ -271,12 +283,13 @@ public:
|
||||
fileManagerLayout->addWidget(new QLabel("\"%1\" = Repo Path", this));
|
||||
layout->addRow(tr("File manager command:"), fileManagerLayout);
|
||||
|
||||
connect(mFileManagerCommand, &QLineEdit::textChanged,
|
||||
[](const QString &text) {
|
||||
Settings::instance()->setValue(Setting::Id::FilemanagerCommand, text);
|
||||
});
|
||||
mFileManagerCommand->setText(
|
||||
Settings::instance()->value(Setting::Id::FilemanagerCommand).toString());
|
||||
connect(
|
||||
mFileManagerCommand, &QLineEdit::textChanged, [](const QString &text) {
|
||||
Settings::instance()->setValue(Setting::Id::FilemanagerCommand, text);
|
||||
});
|
||||
mFileManagerCommand->setText(Settings::instance()
|
||||
->value(Setting::Id::FilemanagerCommand)
|
||||
.toString());
|
||||
}
|
||||
|
||||
private:
|
||||
@ -361,7 +374,8 @@ public:
|
||||
|
||||
comboBox->insertSeparator(comboBox->count());
|
||||
|
||||
int index = comboBox->findText(settings->value(Setting::Id::ColorTheme).toString());
|
||||
int index =
|
||||
comboBox->findText(settings->value(Setting::Id::ColorTheme).toString());
|
||||
|
||||
// add theme
|
||||
comboBox->addItem(tr("Add New Theme"));
|
||||
@ -428,7 +442,8 @@ public:
|
||||
}
|
||||
|
||||
// Save theme
|
||||
Settings::instance()->setValue(Setting::Id::ColorTheme, comboBox->currentText());
|
||||
Settings::instance()->setValue(Setting::Id::ColorTheme,
|
||||
comboBox->currentText());
|
||||
|
||||
QMessageBox mb(QMessageBox::Information, tr("Restart?"),
|
||||
tr("The application must be restarted for "
|
||||
@ -455,25 +470,31 @@ public:
|
||||
});
|
||||
|
||||
QCheckBox *fullPath = new QCheckBox(tr("Show full repository path"));
|
||||
fullPath->setChecked(settings->value(Setting::Id::ShowFullRepoPath).toBool());
|
||||
fullPath->setChecked(
|
||||
settings->value(Setting::Id::ShowFullRepoPath).toBool());
|
||||
connect(fullPath, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::ShowFullRepoPath, checked);
|
||||
});
|
||||
|
||||
QCheckBox *hideLog = new QCheckBox(tr("Hide automatically"));
|
||||
hideLog->setChecked(settings->value(Setting::Id::HideLogAutomatically).toBool());
|
||||
hideLog->setChecked(
|
||||
settings->value(Setting::Id::HideLogAutomatically).toBool());
|
||||
connect(hideLog, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::HideLogAutomatically, checked);
|
||||
Settings::instance()->setValue(Setting::Id::HideLogAutomatically,
|
||||
checked);
|
||||
});
|
||||
|
||||
QCheckBox *smTabs = new QCheckBox(tr("Open submodules in tabs"));
|
||||
smTabs->setChecked(settings->value(Setting::Id::OpenSubmodulesInTabs).toBool());
|
||||
smTabs->setChecked(
|
||||
settings->value(Setting::Id::OpenSubmodulesInTabs).toBool());
|
||||
connect(smTabs, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::OpenSubmodulesInTabs, checked);
|
||||
Settings::instance()->setValue(Setting::Id::OpenSubmodulesInTabs,
|
||||
checked);
|
||||
});
|
||||
|
||||
QCheckBox *repoTabs = new QCheckBox(tr("Open all repositories in tabs"));
|
||||
repoTabs->setChecked(settings->value(Setting::Id::OpenAllReposInTabs).toBool());
|
||||
repoTabs->setChecked(
|
||||
settings->value(Setting::Id::OpenAllReposInTabs).toBool());
|
||||
connect(repoTabs, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::OpenAllReposInTabs, checked);
|
||||
});
|
||||
@ -489,35 +510,28 @@ public:
|
||||
Settings::instance()->setValue(Setting::Id::ShowAvatars, checked);
|
||||
});
|
||||
|
||||
QString mergeText =
|
||||
settings->promptDescription(Prompt::Kind::Merge);
|
||||
QString mergeText = settings->promptDescription(Prompt::Kind::Merge);
|
||||
QCheckBox *merge = new QCheckBox(mergeText, this);
|
||||
merge->setChecked(settings->prompt(Prompt::Kind::Merge));
|
||||
connect(merge, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setPrompt(Prompt::Kind::Merge, checked);
|
||||
});
|
||||
|
||||
QString revertText =
|
||||
settings->promptDescription(Prompt::Kind::Revert);
|
||||
QString revertText = settings->promptDescription(Prompt::Kind::Revert);
|
||||
QCheckBox *revert = new QCheckBox(revertText, this);
|
||||
revert->setChecked(settings->prompt(Prompt::Kind::Revert));
|
||||
connect(revert, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setPrompt(Prompt::Kind::Revert,
|
||||
checked);
|
||||
Settings::instance()->setPrompt(Prompt::Kind::Revert, checked);
|
||||
});
|
||||
|
||||
QString cpText =
|
||||
settings->promptDescription(Prompt::Kind::CherryPick);
|
||||
QString cpText = settings->promptDescription(Prompt::Kind::CherryPick);
|
||||
QCheckBox *cherryPick = new QCheckBox(cpText, this);
|
||||
cherryPick->setChecked(
|
||||
settings->prompt(Prompt::Kind::CherryPick));
|
||||
cherryPick->setChecked(settings->prompt(Prompt::Kind::CherryPick));
|
||||
connect(cherryPick, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setPrompt(Prompt::Kind::CherryPick,
|
||||
checked);
|
||||
Settings::instance()->setPrompt(Prompt::Kind::CherryPick, checked);
|
||||
});
|
||||
|
||||
QString stashText =
|
||||
settings->promptDescription(Prompt::Kind::Stash);
|
||||
QString stashText = settings->promptDescription(Prompt::Kind::Stash);
|
||||
QCheckBox *stash = new QCheckBox(stashText, this);
|
||||
stash->setChecked(settings->prompt(Prompt::Kind::Stash));
|
||||
connect(stash, &QCheckBox::toggled, [](bool checked) {
|
||||
@ -527,21 +541,17 @@ public:
|
||||
QString largeFilesText =
|
||||
settings->promptDescription(Prompt::Kind::LargeFiles);
|
||||
QCheckBox *largeFiles = new QCheckBox(largeFilesText, this);
|
||||
largeFiles->setChecked(
|
||||
settings->prompt(Prompt::Kind::LargeFiles));
|
||||
largeFiles->setChecked(settings->prompt(Prompt::Kind::LargeFiles));
|
||||
connect(largeFiles, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setPrompt(Prompt::Kind::LargeFiles,
|
||||
checked);
|
||||
Settings::instance()->setPrompt(Prompt::Kind::LargeFiles, checked);
|
||||
});
|
||||
|
||||
QString directoriesText =
|
||||
settings->promptDescription(Prompt::Kind::Directories);
|
||||
QCheckBox *directories = new QCheckBox(directoriesText, this);
|
||||
directories->setChecked(
|
||||
settings->prompt(Prompt::Kind::Directories));
|
||||
directories->setChecked(settings->prompt(Prompt::Kind::Directories));
|
||||
connect(directories, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setPrompt(Prompt::Kind::Directories,
|
||||
checked);
|
||||
Settings::instance()->setPrompt(Prompt::Kind::Directories, checked);
|
||||
});
|
||||
|
||||
QFormLayout *layout = new QFormLayout(this);
|
||||
@ -590,7 +600,8 @@ public:
|
||||
QComboBox *indent = new QComboBox(this);
|
||||
indent->addItem(tr("Tabs"));
|
||||
indent->addItem(tr("Spaces"));
|
||||
indent->setCurrentIndex(settings->value(Setting::Id::UseTabsForIndent).toBool() ? 0 : 1);
|
||||
indent->setCurrentIndex(
|
||||
settings->value(Setting::Id::UseTabsForIndent).toBool() ? 0 : 1);
|
||||
connect(indent, combo, [](int i) {
|
||||
Settings::instance()->setValue(Setting::Id::UseTabsForIndent, i == 0);
|
||||
});
|
||||
@ -610,9 +621,11 @@ public:
|
||||
});
|
||||
|
||||
QCheckBox *blameHeatMap = new QCheckBox(tr("Show heat map"), this);
|
||||
blameHeatMap->setChecked(settings->value(Setting::Id::ShowHeatmapInBlameMargin).toBool());
|
||||
blameHeatMap->setChecked(
|
||||
settings->value(Setting::Id::ShowHeatmapInBlameMargin).toBool());
|
||||
connect(blameHeatMap, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::ShowHeatmapInBlameMargin, checked);
|
||||
Settings::instance()->setValue(Setting::Id::ShowHeatmapInBlameMargin,
|
||||
checked);
|
||||
});
|
||||
|
||||
QFormLayout *layout = new QFormLayout(this);
|
||||
@ -634,9 +647,11 @@ public:
|
||||
|
||||
QString checkText = tr("Check for updates automatically");
|
||||
QCheckBox *check = new QCheckBox(checkText, this);
|
||||
check->setChecked(settings->value(Setting::Id::CheckForUpdatesAutomatically).toBool());
|
||||
check->setChecked(
|
||||
settings->value(Setting::Id::CheckForUpdatesAutomatically).toBool());
|
||||
connect(check, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::CheckForUpdatesAutomatically, checked);
|
||||
Settings::instance()->setValue(Setting::Id::CheckForUpdatesAutomatically,
|
||||
checked);
|
||||
});
|
||||
|
||||
#if !defined(Q_OS_LINUX) || defined(FLATPAK)
|
||||
@ -644,9 +659,11 @@ public:
|
||||
// no manual download is needed
|
||||
QString downloadText = tr("Automatically download and install updates");
|
||||
QCheckBox *download = new QCheckBox(downloadText, this);
|
||||
download->setChecked(settings->value(Setting::Id::InstallUpdatesAutomatically).toBool());
|
||||
download->setChecked(
|
||||
settings->value(Setting::Id::InstallUpdatesAutomatically).toBool());
|
||||
connect(download, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::InstallUpdatesAutomatically, checked);
|
||||
Settings::instance()->setValue(Setting::Id::InstallUpdatesAutomatically,
|
||||
checked);
|
||||
});
|
||||
#endif
|
||||
|
||||
@ -660,7 +677,6 @@ public:
|
||||
layout->addRow(QString(), download);
|
||||
#endif
|
||||
layout->addRow(QString(), button);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@ -671,14 +687,14 @@ public:
|
||||
MiscPanel(QWidget *parent = nullptr) : QWidget(parent) {
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
QLineEdit *sshConfigPathBox =
|
||||
new QLineEdit(settings->value(Setting::Id::SshConfigFilePath).toString(), this);
|
||||
QLineEdit *sshConfigPathBox = new QLineEdit(
|
||||
settings->value(Setting::Id::SshConfigFilePath).toString(), this);
|
||||
connect(sshConfigPathBox, &QLineEdit::textChanged, [](const QString &text) {
|
||||
Settings::instance()->setValue(Setting::Id::SshConfigFilePath, text);
|
||||
});
|
||||
|
||||
QLineEdit *sshKeyPathBox =
|
||||
new QLineEdit(settings->value(Setting::Id::SshKeyFilePath).toString(), this);
|
||||
QLineEdit *sshKeyPathBox = new QLineEdit(
|
||||
settings->value(Setting::Id::SshKeyFilePath).toString(), this);
|
||||
connect(sshKeyPathBox, &QLineEdit::textChanged, [](const QString &text) {
|
||||
Settings::instance()->setValue(Setting::Id::SshKeyFilePath, text);
|
||||
});
|
||||
@ -698,19 +714,20 @@ public:
|
||||
TerminalPanel(QWidget *parent = nullptr) : QWidget(parent) {
|
||||
Settings *settings = Settings::instance();
|
||||
|
||||
mNameBox = new QLineEdit(settings->value(Setting::Id::TerminalName).toString(), this);
|
||||
mNameBox = new QLineEdit(
|
||||
settings->value(Setting::Id::TerminalName).toString(), this);
|
||||
connect(mNameBox, &QLineEdit::textChanged, [this](const QString &text) {
|
||||
Settings::instance()->setValue(Setting::Id::TerminalName, text);
|
||||
updateInstallButton();
|
||||
});
|
||||
|
||||
mPathBox = new QLineEdit(settings->value(Setting::Id::TerminalPath).toString(), this);
|
||||
mPathBox = new QLineEdit(
|
||||
settings->value(Setting::Id::TerminalPath).toString(), this);
|
||||
connect(mPathBox, &QLineEdit::textChanged, [this](const QString &text) {
|
||||
Settings::instance()->setValue(Setting::Id::TerminalPath, text);
|
||||
updateInstallButton();
|
||||
});
|
||||
|
||||
|
||||
mInstallButton = new QPushButton(tr("Install"), this);
|
||||
connect(mInstallButton, &QPushButton::clicked, [this] {
|
||||
Installer installer(mNameBox->text(), mPathBox->text());
|
||||
|
@ -62,7 +62,9 @@ void BlameMargin::startBlame(const QString &name) {
|
||||
|
||||
void BlameMargin::setBlame(const git::Repository &repo,
|
||||
const git::Blame &blame) {
|
||||
if (Settings::instance()->value(Setting::Id::ShowHeatmapInBlameMargin).toBool()) {
|
||||
if (Settings::instance()
|
||||
->value(Setting::Id::ShowHeatmapInBlameMargin)
|
||||
.toBool()) {
|
||||
git::Commit first = repo.walker(GIT_SORT_TIME | GIT_SORT_REVERSE).next();
|
||||
git::Commit last = repo.walker(GIT_SORT_TIME).next();
|
||||
mMinTime = first ? first.committer().date().toTime_t() : -1;
|
||||
|
@ -608,7 +608,9 @@ public:
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption(&opt, index);
|
||||
|
||||
bool compact = Settings::instance()->value(Setting::Id::ShowCommitsInCompactMode).toBool();
|
||||
bool compact = Settings::instance()
|
||||
->value(Setting::Id::ShowCommitsInCompactMode)
|
||||
.toBool();
|
||||
LayoutConstants constants = layoutConstants(compact);
|
||||
|
||||
// Draw background.
|
||||
@ -962,7 +964,9 @@ public:
|
||||
|
||||
QSize sizeHint(const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override {
|
||||
bool compact = Settings::instance()->value(Setting::Id::ShowCommitsInCompactMode).toBool();
|
||||
bool compact = Settings::instance()
|
||||
->value(Setting::Id::ShowCommitsInCompactMode)
|
||||
.toBool();
|
||||
LayoutConstants constants = layoutConstants(compact);
|
||||
|
||||
int lineHeight = constants.lineSpacing + constants.vMargin;
|
||||
@ -981,7 +985,9 @@ public:
|
||||
|
||||
QRect starRect(const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const {
|
||||
bool compact = Settings::instance()->value(Setting::Id::ShowCommitsInCompactMode).toBool();
|
||||
bool compact = Settings::instance()
|
||||
->value(Setting::Id::ShowCommitsInCompactMode)
|
||||
.toBool();
|
||||
LayoutConstants constants = layoutConstants(compact);
|
||||
|
||||
QRect rect = option.rect;
|
||||
|
@ -166,9 +166,12 @@ CommitToolBar::CommitToolBar(QWidget *parent) : QToolBar(parent) {
|
||||
|
||||
QAction *compact = menu->addAction(tr("Compact Mode"));
|
||||
compact->setCheckable(true);
|
||||
compact->setChecked(Settings::instance()->value(Setting::Id::ShowCommitsInCompactMode).toBool());
|
||||
compact->setChecked(Settings::instance()
|
||||
->value(Setting::Id::ShowCommitsInCompactMode)
|
||||
.toBool());
|
||||
connect(compact, &QAction::triggered, [this](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::ShowCommitsInCompactMode, checked);
|
||||
Settings::instance()->setValue(Setting::Id::ShowCommitsInCompactMode,
|
||||
checked);
|
||||
emit settingsChanged();
|
||||
});
|
||||
}
|
||||
|
@ -433,11 +433,15 @@ FileWidget::FileWidget(DiffView *view, const git::Diff &diff,
|
||||
// Start hidden when the file is checked.
|
||||
bool expand = (mHeader->check()->checkState() == Qt::Unchecked);
|
||||
|
||||
if (Settings::instance()->value(Setting::Id::AutoCollapseAddedFiles).toBool() == true &&
|
||||
if (Settings::instance()
|
||||
->value(Setting::Id::AutoCollapseAddedFiles)
|
||||
.toBool() == true &&
|
||||
patch.status() == GIT_DELTA_ADDED)
|
||||
expand = false;
|
||||
|
||||
if (Settings::instance()->value(Setting::Id::AutoCollapseDeletedFiles).toBool() == true &&
|
||||
if (Settings::instance()
|
||||
->value(Setting::Id::AutoCollapseDeletedFiles)
|
||||
.toBool() == true &&
|
||||
patch.status() == GIT_DELTA_DELETED)
|
||||
expand = false;
|
||||
|
||||
|
@ -83,17 +83,22 @@ DoubleTreeWidget::DoubleTreeWidget(const git::Repository &repo, QWidget *parent)
|
||||
QAction *singleTree = new QAction(tr("Single Tree View"));
|
||||
singleTree->setCheckable(true);
|
||||
singleTree->setChecked(
|
||||
Settings::instance()->value(Setting::Id::ShowChangedFilesInSingleView, false).toBool());
|
||||
Settings::instance()
|
||||
->value(Setting::Id::ShowChangedFilesInSingleView, false)
|
||||
.toBool());
|
||||
connect(singleTree, &QAction::triggered, this, [this](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::ShowChangedFilesInSingleView, checked);
|
||||
Settings::instance()->setValue(Setting::Id::ShowChangedFilesInSingleView,
|
||||
checked);
|
||||
RepoView::parentView(this)->refresh();
|
||||
});
|
||||
QAction *listView = new QAction(tr("List View"));
|
||||
listView->setCheckable(true);
|
||||
listView->setChecked(
|
||||
Settings::instance()->value(Setting::Id::ShowChangedFilesAsList, false).toBool());
|
||||
listView->setChecked(Settings::instance()
|
||||
->value(Setting::Id::ShowChangedFilesAsList, false)
|
||||
.toBool());
|
||||
connect(listView, &QAction::triggered, this, [this](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::ShowChangedFilesAsList, checked);
|
||||
Settings::instance()->setValue(Setting::Id::ShowChangedFilesAsList,
|
||||
checked);
|
||||
RepoView::parentView(this)->refresh();
|
||||
});
|
||||
contextMenu->addAction(singleTree);
|
||||
@ -392,9 +397,12 @@ void DoubleTreeWidget::setDiff(const git::Diff &diff, const QString &file,
|
||||
|
||||
// Single tree & list view.
|
||||
bool singleTree =
|
||||
Settings::instance()->value(Setting::Id::ShowChangedFilesInSingleView, false).toBool();
|
||||
bool listView =
|
||||
Settings::instance()->value(Setting::Id::ShowChangedFilesAsList, false).toBool();
|
||||
Settings::instance()
|
||||
->value(Setting::Id::ShowChangedFilesInSingleView, false)
|
||||
.toBool();
|
||||
bool listView = Settings::instance()
|
||||
->value(Setting::Id::ShowChangedFilesAsList, false)
|
||||
.toBool();
|
||||
|
||||
// Widget modifications.
|
||||
model->enableListView(listView);
|
||||
|
@ -161,8 +161,7 @@ HotkeyManager::HotkeyManager(Settings *settings)
|
||||
|
||||
for (HotkeyManagerHandle *i = hotkeyRegistry; i; i = i->next) {
|
||||
mHandles[i->index] = i;
|
||||
mKeys[i->index] =
|
||||
getKeys(mSettings->hotkey(i->configPath), i);
|
||||
mKeys[i->index] = getKeys(mSettings->hotkey(i->configPath), i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,8 +181,7 @@ QKeySequence HotkeyManager::keys(const HotkeyManagerHandle *handle) const {
|
||||
void HotkeyManager::setKeys(const HotkeyManagerHandle *handle,
|
||||
const QKeySequence &keys) {
|
||||
mKeys[handle->index] = keys;
|
||||
mSettings->setHotkey(handle->configPath,
|
||||
keys.toString());
|
||||
mSettings->setHotkey(handle->configPath, keys.toString());
|
||||
|
||||
emit changed(handle);
|
||||
}
|
||||
|
@ -95,7 +95,8 @@ MainWindow::MainWindow(const git::Repository &repo, QWidget *parent,
|
||||
});
|
||||
|
||||
// Update title and refresh when settings change.
|
||||
mFullPath = Settings::instance()->value(Setting::Id::ShowFullRepoPath).toBool();
|
||||
mFullPath =
|
||||
Settings::instance()->value(Setting::Id::ShowFullRepoPath).toBool();
|
||||
connect(Settings::instance(), &Settings::settingsChanged, this,
|
||||
[this](bool refresh) {
|
||||
Settings *settings = Settings::instance();
|
||||
@ -105,7 +106,8 @@ MainWindow::MainWindow(const git::Repository &repo, QWidget *parent,
|
||||
if (mMenuBar->isHidden() != menuBarHidden)
|
||||
mMenuBar->setHidden(menuBarHidden);
|
||||
|
||||
bool fullPath = settings->value(Setting::Id::ShowFullRepoPath).toBool();
|
||||
bool fullPath =
|
||||
settings->value(Setting::Id::ShowFullRepoPath).toBool();
|
||||
if (mFullPath != fullPath) {
|
||||
mFullPath = fullPath;
|
||||
updateWindowTitle();
|
||||
@ -253,7 +255,8 @@ RepoView *MainWindow::addTab(const git::Repository &repo) {
|
||||
tabs->setCurrentIndex(tabs->addTab(view, dir.dirName()));
|
||||
|
||||
Settings *settings = Settings::instance();
|
||||
bool enable = settings->value(Setting::Id::UpdateSubmodulesAfterPullAndClone).toBool();
|
||||
bool enable =
|
||||
settings->value(Setting::Id::UpdateSubmodulesAfterPullAndClone).toBool();
|
||||
if (repo.appConfig().value<bool>("autoupdate.enable", enable)) {
|
||||
// update submodules
|
||||
view->updateSubmodules(repo.submodules(), true, true, false, nullptr);
|
||||
|
@ -308,8 +308,7 @@ RepoView::RepoView(const git::Repository &repo, MainWindow *parent)
|
||||
&RepoView::refresh, Qt::QueuedConnection);
|
||||
connect(notifier, &git::RepositoryNotifier::directoryAboutToBeStaged, this,
|
||||
[this](const QString &dir, int count, bool &allow) {
|
||||
if (!Settings::instance()->prompt(
|
||||
Prompt::Kind::Directories))
|
||||
if (!Settings::instance()->prompt(Prompt::Kind::Directories))
|
||||
return;
|
||||
|
||||
QString title = tr("Stage Directory?");
|
||||
@ -330,48 +329,45 @@ RepoView::RepoView(const git::Repository &repo, MainWindow *parent)
|
||||
dialog.exec();
|
||||
allow = (dialog.clickedButton() == button);
|
||||
if (cb->isChecked())
|
||||
Settings::instance()->setPrompt(
|
||||
Prompt::Kind::Directories, false);
|
||||
Settings::instance()->setPrompt(Prompt::Kind::Directories, false);
|
||||
});
|
||||
|
||||
// large file size warning
|
||||
connect(
|
||||
notifier, &git::RepositoryNotifier::largeFileAboutToBeStaged, this,
|
||||
[this](const QString &file, int size, bool &allow) {
|
||||
if (!Settings::instance()->prompt(Prompt::Kind::LargeFiles))
|
||||
return;
|
||||
connect(notifier, &git::RepositoryNotifier::largeFileAboutToBeStaged, this,
|
||||
[this](const QString &file, int size, bool &allow) {
|
||||
if (!Settings::instance()->prompt(Prompt::Kind::LargeFiles))
|
||||
return;
|
||||
|
||||
QString title = tr("Stage Large File?");
|
||||
QString fmt =
|
||||
tr("Are you sure you want to stage '%1' with a size of %2?");
|
||||
QString text = fmt.arg(file, locale().formattedDataSize(size));
|
||||
QMessageBox dialog(QMessageBox::Question, title, text,
|
||||
QMessageBox::Cancel, this);
|
||||
QPushButton *stage =
|
||||
dialog.addButton(tr("Stage"), QMessageBox::AcceptRole);
|
||||
QString title = tr("Stage Large File?");
|
||||
QString fmt =
|
||||
tr("Are you sure you want to stage '%1' with a size of %2?");
|
||||
QString text = fmt.arg(file, locale().formattedDataSize(size));
|
||||
QMessageBox dialog(QMessageBox::Question, title, text,
|
||||
QMessageBox::Cancel, this);
|
||||
QPushButton *stage =
|
||||
dialog.addButton(tr("Stage"), QMessageBox::AcceptRole);
|
||||
|
||||
QPushButton *track = nullptr;
|
||||
if (this->repo().lfsIsInitialized()) {
|
||||
track =
|
||||
dialog.addButton(tr("Track with LFS"), QMessageBox::RejectRole);
|
||||
dialog.setInformativeText(
|
||||
tr("This repository has LFS enabled. Do you "
|
||||
"want to track the file with LFS instead?"));
|
||||
}
|
||||
QPushButton *track = nullptr;
|
||||
if (this->repo().lfsIsInitialized()) {
|
||||
track = dialog.addButton(tr("Track with LFS"),
|
||||
QMessageBox::RejectRole);
|
||||
dialog.setInformativeText(
|
||||
tr("This repository has LFS enabled. Do you "
|
||||
"want to track the file with LFS instead?"));
|
||||
}
|
||||
|
||||
QString cbText = tr("Stop prompting to stage large files");
|
||||
QCheckBox *cb = new QCheckBox(cbText, &dialog);
|
||||
dialog.setCheckBox(cb);
|
||||
QString cbText = tr("Stop prompting to stage large files");
|
||||
QCheckBox *cb = new QCheckBox(cbText, &dialog);
|
||||
dialog.setCheckBox(cb);
|
||||
|
||||
dialog.exec();
|
||||
allow = (dialog.clickedButton() == stage);
|
||||
if (cb->isChecked())
|
||||
Settings::instance()->setPrompt(Prompt::Kind::LargeFiles,
|
||||
false);
|
||||
dialog.exec();
|
||||
allow = (dialog.clickedButton() == stage);
|
||||
if (cb->isChecked())
|
||||
Settings::instance()->setPrompt(Prompt::Kind::LargeFiles, false);
|
||||
|
||||
if (dialog.clickedButton() == track)
|
||||
configureSettings(ConfigDialog::Lfs);
|
||||
});
|
||||
if (dialog.clickedButton() == track)
|
||||
configureSettings(ConfigDialog::Lfs);
|
||||
});
|
||||
|
||||
// Refresh when the workdir changes.
|
||||
RepositoryWatcher *watcher = new RepositoryWatcher(repo, this);
|
||||
@ -924,7 +920,8 @@ void RepoView::startFetchTimer() {
|
||||
// Read defaults from global settings.
|
||||
Settings *settings = Settings::instance();
|
||||
bool enable = settings->value(Setting::Id::FetchAutomatically).toBool();
|
||||
int minutes = settings->value(Setting::Id::AutomaticFetchPeriodInMinutes).toInt();
|
||||
int minutes =
|
||||
settings->value(Setting::Id::AutomaticFetchPeriodInMinutes).toInt();
|
||||
|
||||
git::Config config = mRepo.appConfig();
|
||||
if (!config.value<bool>("autofetch.enable", enable))
|
||||
@ -957,7 +954,8 @@ void RepoView::fetchAll() {
|
||||
QFuture<git::Result> RepoView::fetch(const git::Remote &rmt, bool tags,
|
||||
bool interactive, LogEntry *parent,
|
||||
QStringList *submodules) {
|
||||
bool prune = Settings::instance()->value(Setting::Id::PruneAfterFetch).toBool();
|
||||
bool prune =
|
||||
Settings::instance()->value(Setting::Id::PruneAfterFetch).toBool();
|
||||
return fetch(rmt, tags, interactive, parent, submodules,
|
||||
mRepo.appConfig().value<bool>("autoprune.enable", prune));
|
||||
}
|
||||
@ -1080,7 +1078,8 @@ void RepoView::pull(MergeFlags flags, const git::Remote &rmt, bool tags,
|
||||
// Read submodule setting.
|
||||
QStringList *submodules = nullptr;
|
||||
Settings *settings = Settings::instance();
|
||||
bool enable = settings->value(Setting::Id::UpdateSubmodulesAfterPullAndClone).toBool();
|
||||
bool enable =
|
||||
settings->value(Setting::Id::UpdateSubmodulesAfterPullAndClone).toBool();
|
||||
if (mRepo.appConfig().value<bool>("autoupdate.enable", enable))
|
||||
submodules = new QStringList;
|
||||
|
||||
@ -1312,8 +1311,7 @@ void RepoView::merge(MergeFlags flags, const git::AnnotatedCommit &upstream,
|
||||
if (Settings::instance()->prompt(Prompt::Kind::Merge)) {
|
||||
// Prompt to edit message.
|
||||
bool suspended = suspendLogTimer();
|
||||
CommitDialog *dialog =
|
||||
new CommitDialog(msg, Prompt::Kind::Merge, this);
|
||||
CommitDialog *dialog = new CommitDialog(msg, Prompt::Kind::Merge, this);
|
||||
connect(dialog, &QDialog::rejected, this, [this, parent, suspended] {
|
||||
resumeLogTimer(suspended);
|
||||
mergeAbort(parent);
|
||||
@ -1541,8 +1539,7 @@ void RepoView::revert(const git::Commit &commit) {
|
||||
if (Settings::instance()->prompt(Prompt::Kind::Revert)) {
|
||||
// Prompt to edit message.
|
||||
bool suspended = suspendLogTimer();
|
||||
CommitDialog *dialog =
|
||||
new CommitDialog(msg, Prompt::Kind::Revert, this);
|
||||
CommitDialog *dialog = new CommitDialog(msg, Prompt::Kind::Revert, this);
|
||||
connect(dialog, &QDialog::rejected, this, [this, parent, suspended] {
|
||||
resumeLogTimer(suspended);
|
||||
mergeAbort(parent);
|
||||
@ -1867,7 +1864,8 @@ bool RepoView::commit(const git::Signature &author,
|
||||
}
|
||||
|
||||
// Automatically push if enabled.
|
||||
bool enable = Settings::instance()->value(Setting::Id::PushAfterEachCommit).toBool();
|
||||
bool enable =
|
||||
Settings::instance()->value(Setting::Id::PushAfterEachCommit).toBool();
|
||||
if (mRepo.appConfig().value<bool>("autopush.enable", enable))
|
||||
push(); // FIXME: Check for upstream before pushing?
|
||||
|
||||
@ -2055,8 +2053,7 @@ void RepoView::promptToStash() {
|
||||
QString id = commit.shortId();
|
||||
QString ref = head.isBranch() ? head.name() : tr("(no branch)");
|
||||
QString msg = tr("WIP on %1: %2 %3").arg(ref, id, commit.summary());
|
||||
CommitDialog *dialog =
|
||||
new CommitDialog(msg, Prompt::Kind::Stash, this);
|
||||
CommitDialog *dialog = new CommitDialog(msg, Prompt::Kind::Stash, this);
|
||||
connect(dialog, &QDialog::accepted, this, [this, msg, dialog] {
|
||||
QString userMsg = dialog->message();
|
||||
stash(msg != userMsg ? userMsg : QString());
|
||||
|
@ -85,9 +85,12 @@ UpdateDialog::UpdateDialog(const QString &platform, const QString &version,
|
||||
#if !defined(Q_OS_LINUX) || defined(FLATPAK) || defined(DEBUG_FLATPAK)
|
||||
QCheckBox *download =
|
||||
new QCheckBox(tr("Automatically download and install updates"), this);
|
||||
download->setChecked(Settings::instance()->value(Setting::Id::InstallUpdatesAutomatically).toBool());
|
||||
download->setChecked(Settings::instance()
|
||||
->value(Setting::Id::InstallUpdatesAutomatically)
|
||||
.toBool());
|
||||
connect(download, &QCheckBox::toggled, [](bool checked) {
|
||||
Settings::instance()->setValue(Setting::Id::InstallUpdatesAutomatically, checked);
|
||||
Settings::instance()->setValue(Setting::Id::InstallUpdatesAutomatically,
|
||||
checked);
|
||||
});
|
||||
#endif
|
||||
|
||||
@ -104,7 +107,8 @@ UpdateDialog::UpdateDialog(const QString &platform, const QString &version,
|
||||
|
||||
connect(skip, &QPushButton::clicked, [this, version] {
|
||||
Settings *settings = Settings::instance();
|
||||
QStringList skipped = settings->value(Setting::Id::SkippedUpdates).toStringList();
|
||||
QStringList skipped =
|
||||
settings->value(Setting::Id::SkippedUpdates).toStringList();
|
||||
if (!skipped.contains(version))
|
||||
settings->setValue(Setting::Id::SkippedUpdates, skipped << version);
|
||||
reject();
|
||||
|
@ -77,7 +77,9 @@ Updater::Updater(QObject *parent) : QObject(parent) {
|
||||
QCoreApplication::applicationVersion());
|
||||
QVersionNumber newVersion = QVersionNumber::fromString(version);
|
||||
|
||||
if (Settings::instance()->value(Setting::Id::InstallUpdatesAutomatically).toBool()) {
|
||||
if (Settings::instance()
|
||||
->value(Setting::Id::InstallUpdatesAutomatically)
|
||||
.toBool()) {
|
||||
// Skip the update dialog and just start downloading.
|
||||
if (Updater::DownloadRef download = this->download(link)) {
|
||||
DownloadDialog *dialog = new DownloadDialog(download);
|
||||
|
@ -32,16 +32,13 @@ private:
|
||||
};
|
||||
|
||||
void TestCommitAuthorCommitter::initTestCase() {
|
||||
promptCherryPick =
|
||||
Settings::instance()->prompt(Prompt::Kind::CherryPick);
|
||||
promptCherryPick = Settings::instance()->prompt(Prompt::Kind::CherryPick);
|
||||
promptRevert = Settings::instance()->prompt(Prompt::Kind::Revert);
|
||||
}
|
||||
|
||||
void TestCommitAuthorCommitter::cleanupTestCase() {
|
||||
Settings::instance()->setPrompt(Prompt::Kind::CherryPick,
|
||||
promptCherryPick);
|
||||
Settings::instance()->setPrompt(Prompt::Kind::Revert,
|
||||
promptRevert);
|
||||
Settings::instance()->setPrompt(Prompt::Kind::CherryPick, promptCherryPick);
|
||||
Settings::instance()->setPrompt(Prompt::Kind::Revert, promptRevert);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -12,9 +12,7 @@ private slots:
|
||||
void defines_each_settings_key_only_once();
|
||||
|
||||
private:
|
||||
|
||||
template <typename TId>
|
||||
QList<TId> ids() const {
|
||||
template <typename TId> QList<TId> ids() const {
|
||||
QList<TId> ids;
|
||||
QMetaEnum metaEnum = QMetaEnum::fromType<TId>();
|
||||
for (int i = 0; i < metaEnum.keyCount(); i++) {
|
||||
@ -23,17 +21,13 @@ private:
|
||||
return ids;
|
||||
}
|
||||
|
||||
template <class T, typename TId>
|
||||
QStringList settingsKeys() {
|
||||
template <class T, typename TId> QStringList settingsKeys() {
|
||||
QStringList settingsKeys;
|
||||
foreach (const TId id, ids<TId>()) {
|
||||
settingsKeys.append(T::key(id));
|
||||
}
|
||||
foreach (const TId id, ids<TId>()) { settingsKeys.append(T::key(id)); }
|
||||
return settingsKeys;
|
||||
}
|
||||
|
||||
template <class T, typename TId>
|
||||
void verifyNonEmptySettingsKeyForEachId() {
|
||||
template <class T, typename TId> void verifyNonEmptySettingsKeyForEachId() {
|
||||
QMetaEnum metaEnum = QMetaEnum::fromType<TId>();
|
||||
|
||||
foreach (const TId id, ids<TId>()) {
|
||||
@ -58,12 +52,11 @@ void TestSetting::defines_each_settings_key_only_once() {
|
||||
allSettingsKeys.append(settingsKeys<Prompt, Prompt::Kind>());
|
||||
|
||||
QStringList uniqueSettingsKeys;
|
||||
foreach (const QString& settingsKey, allSettingsKeys) {
|
||||
QVERIFY2(
|
||||
!uniqueSettingsKeys.contains(settingsKey),
|
||||
qPrintable(
|
||||
QString("the settings key '%1' is used for multiple settings")
|
||||
.arg(settingsKey)));
|
||||
foreach (const QString &settingsKey, allSettingsKeys) {
|
||||
QVERIFY2(!uniqueSettingsKeys.contains(settingsKey),
|
||||
qPrintable(
|
||||
QString("the settings key '%1' is used for multiple settings")
|
||||
.arg(settingsKey)));
|
||||
uniqueSettingsKeys.append(settingsKey);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user