Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
codeschrat committed Dec 5, 2022
1 parent 975633c commit ead51fd
Show file tree
Hide file tree
Showing 20 changed files with 229 additions and 187 deletions.
11 changes: 8 additions & 3 deletions src/app/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -368,7 +371,9 @@ class CopyDataWindow : public QWindow {
#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();

Expand Down
9 changes: 1 addition & 8 deletions src/conf/Setting.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions src/conf/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/conf/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class Settings : public QObject {
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;
Expand Down
7 changes: 5 additions & 2 deletions src/dialogs/ConfigDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,13 @@ class GeneralPanel : public QWidget {
// 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();
Expand Down
6 changes: 4 additions & 2 deletions src/dialogs/DiffPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand Down
11 changes: 8 additions & 3 deletions src/dialogs/MergeDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
Loading

0 comments on commit ead51fd

Please sign in to comment.