Skip to content

Commit 15c69c4

Browse files
authored
Use upstream code style (#42)
1 parent 23c6d5d commit 15c69c4

32 files changed

+473
-288
lines changed

.clang-format

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,40 @@ BasedOnStyle: LLVM
1313
# Turn off LLVM default alignment of params with the opening bracket,
1414
# which can be less readable in some cases in our code base.
1515
#
16-
# Using `AlwaysBreak` will result in:
16+
# Using `BlockIndent` will result in:
1717
# void fooBarBazQuxHelloWorld(
1818
# int a,
19-
# int b);
19+
# int b
20+
# );
2021
#
2122
# Instead of:
2223
# void fooBarBazQuxHelloWorld(int a,
2324
# int b);
24-
AlignAfterOpenBracket: AlwaysBreak
25+
AlignAfterOpenBracket: BlockIndent
2526

2627
# Turn off LLVM default packing of ctor initializers.
2728
# This makes it easier to see which members were initialized and in what order.
2829
PackConstructorInitializers: CurrentLine
30+
31+
# up our limit to 120
32+
ColumnLimit: 120
33+
34+
# Custom Breaking rules
35+
BreakBeforeBraces: Custom
36+
BraceWrapping:
37+
AfterCaseLabel: false
38+
AfterClass: true
39+
AfterControlStatement: Never
40+
AfterEnum: true
41+
AfterFunction: true
42+
AfterNamespace: false
43+
AfterStruct: true
44+
AfterUnion: true
45+
AfterExternBlock: true
46+
BeforeCatch: false
47+
BeforeElse: false
48+
BeforeLambdaBody: false
49+
BeforeWhile: false
50+
51+
# no single line functions
52+
AllowShortFunctionsOnASingleLine: None

odin

Submodule odin updated 641 files

src/lib/synergy/gui/ActivationDialog.cpp

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ using namespace deskflow::gui;
3838
using namespace synergy::gui;
3939
using namespace synergy::license;
4040

41-
ActivationDialog::ActivationDialog(
42-
QWidget *parent, AppConfig &appConfig, LicenseHandler &licenseHandler)
41+
ActivationDialog::ActivationDialog(QWidget *parent, AppConfig &appConfig, LicenseHandler &licenseHandler)
4342
: QDialog(parent),
4443
m_ui(new Ui::ActivationDialog),
4544
m_pAppConfig(&appConfig),
46-
m_licenseHandler(licenseHandler) {
45+
m_licenseHandler(licenseHandler)
46+
{
4747

4848
m_ui->setupUi(this);
4949

@@ -56,7 +56,8 @@ ActivationDialog::ActivationDialog(
5656
}
5757
}
5858

59-
void ActivationDialog::refreshSerialKey() {
59+
void ActivationDialog::refreshSerialKey()
60+
{
6061

6162
const QString envSerialKey = qEnvironmentVariable("SYNERGY_TEST_SERIAL_KEY");
6263
if (!envSerialKey.isEmpty()) {
@@ -77,9 +78,13 @@ void ActivationDialog::refreshSerialKey() {
7778
}
7879
}
7980

80-
ActivationDialog::~ActivationDialog() { delete m_ui; }
81+
ActivationDialog::~ActivationDialog()
82+
{
83+
delete m_ui;
84+
}
8185

82-
void ActivationDialog::reject() {
86+
void ActivationDialog::reject()
87+
{
8388
// don't show the cancel confirmation dialog if they've already registered,
8489
// since it's not relevant to customers who are changing their serial key.
8590
const auto &license = m_licenseHandler.license();
@@ -95,7 +100,8 @@ void ActivationDialog::reject() {
95100
}
96101
}
97102

98-
void ActivationDialog::accept() {
103+
void ActivationDialog::accept()
104+
{
99105
using Result = LicenseHandler::SetSerialKeyResult;
100106
auto serialKey = m_ui->m_pTextEditSerialKey->toPlainText();
101107

@@ -114,84 +120,77 @@ void ActivationDialog::accept() {
114120
QDialog::accept();
115121
}
116122

117-
void ActivationDialog::showResultDialog(
118-
LicenseHandler::SetSerialKeyResult result) {
123+
void ActivationDialog::showResultDialog(LicenseHandler::SetSerialKeyResult result)
124+
{
119125
const QString title = "Activation";
120126

121127
switch (result) {
122128
using enum LicenseHandler::SetSerialKeyResult;
123129

124130
case kUnchanged:
125-
QMessageBox::information(
126-
this, title,
127-
"Heads up, the serial key you entered was the same as last time.");
131+
QMessageBox::information(this, title, "Heads up, the serial key you entered was the same as last time.");
128132
QDialog::accept();
129133
break;
130134

131135
case kInvalid:
132136
QMessageBox::critical(
133137
this, title,
134-
QString(
135-
"Invalid serial key. "
136-
R"(Please <a href="%1" style="color: %2">contact us</a> for help.)")
138+
QString("Invalid serial key. "
139+
R"(Please <a href="%1" style="color: %2">contact us</a> for help.)")
137140
.arg(kUrlContact)
138-
.arg(kColorSecondary));
141+
.arg(kColorSecondary)
142+
);
139143
break;
140144

141145
case kExpired:
142146
QMessageBox::warning(
143147
this, title,
144-
QString(
145-
"Sorry, that serial key has expired. "
146-
R"(Please <a href="%1" style="color: %2">renew</a> your license.)")
148+
QString("Sorry, that serial key has expired. "
149+
R"(Please <a href="%1" style="color: %2">renew</a> your license.)")
147150
.arg(kUrlPurchase)
148-
.arg(kColorSecondary));
151+
.arg(kColorSecondary)
152+
);
149153
break;
150154

151155
default:
152156
qFatal("unexpected change serial key result: %d", static_cast<int>(result));
153157
}
154158
}
155159

156-
void ActivationDialog::showSuccessDialog() {
160+
void ActivationDialog::showSuccessDialog()
161+
{
157162
const auto &license = m_licenseHandler.license();
158163

159164
QString title = "Activation successful";
160-
QString message = tr("<p>Thanks for activating %1.</p>")
161-
.arg(m_licenseHandler.productName());
165+
QString message = tr("<p>Thanks for activating %1.</p>").arg(m_licenseHandler.productName());
162166

163167
const auto tlsAvailable = m_licenseHandler.license().isTlsAvailable();
164168
if (tlsAvailable && m_pAppConfig->tlsEnabled()) {
165-
message +=
166-
"<p>To ensure that TLS encryption works correctly, "
167-
"please activate all of your computers with the same serial key.</p>";
169+
message += "<p>To ensure that TLS encryption works correctly, "
170+
"please activate all of your computers with the same serial key.</p>";
168171
}
169172

170173
if (license.isTimeLimited()) {
171174
auto daysLeft = license.daysLeft().count();
172175
if (license.isTrial()) {
173176
title = "Trial started";
174-
message += QString("Your trial will expire in %1 %2.")
175-
.arg(daysLeft)
176-
.arg((daysLeft == 1) ? "day" : "days");
177+
message += QString("Your trial will expire in %1 %2.").arg(daysLeft).arg((daysLeft == 1) ? "day" : "days");
177178
} else if (license.isSubscription()) {
178-
message += QString("Your license will expire in %1 %2.")
179-
.arg(daysLeft)
180-
.arg((daysLeft == 1) ? "day" : "days");
179+
message += QString("Your license will expire in %1 %2.").arg(daysLeft).arg((daysLeft == 1) ? "day" : "days");
181180
}
182181
}
183182

184183
QMessageBox::information(this, title, message);
185184
}
186185

187-
void ActivationDialog::showErrorDialog(const QString &message) {
188-
QString fullMessage =
189-
QString("<p>There was a problem activating Deskflow.</p>"
190-
R"(<p>Please <a href="%1" style="color: %2">contact us</a> )"
191-
"and provide the following information:</p>"
192-
"%3")
193-
.arg(kUrlContact)
194-
.arg(kColorSecondary)
195-
.arg(message);
186+
void ActivationDialog::showErrorDialog(const QString &message)
187+
{
188+
QString fullMessage = QString("<p>There was a problem activating Deskflow.</p>"
189+
R"(<p>Please <a href="%1" style="color: %2">contact us</a> )"
190+
"and provide the following information:</p>"
191+
"%3")
192+
.arg(kUrlContact)
193+
.arg(kColorSecondary)
194+
.arg(message);
196195
QMessageBox::critical(this, "Activation failed", fullMessage);
197196
}

src/lib/synergy/gui/ActivationDialog.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,20 @@ class ActivationDialog;
2727

2828
class AppConfig;
2929

30-
class ActivationDialog : public QDialog {
30+
class ActivationDialog : public QDialog
31+
{
3132
Q_OBJECT
3233

3334
public:
34-
ActivationDialog(
35-
QWidget *parent, AppConfig &appConfig, LicenseHandler &licenseHandler);
35+
ActivationDialog(QWidget *parent, AppConfig &appConfig, LicenseHandler &licenseHandler);
3636
~ActivationDialog() override;
3737

38-
class ActivationMessageError : public std::runtime_error {
38+
class ActivationMessageError : public std::runtime_error
39+
{
3940
public:
40-
ActivationMessageError()
41-
: std::runtime_error("could not show activation message") {}
41+
ActivationMessageError() : std::runtime_error("could not show activation message")
42+
{
43+
}
4244
};
4345

4446
public slots:

src/lib/synergy/gui/AppTime.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ namespace synergy::gui {
2626

2727
const auto kTestTimeEnvVar = "SYNERGY_TEST_START_TIME";
2828

29-
AppTime::AppTime() {
29+
AppTime::AppTime()
30+
{
3031
m_realStartTime = system_clock::now();
3132
if (qEnvironmentVariableIsSet(kTestTimeEnvVar)) {
3233
const auto testTime = qEnvironmentVariable(kTestTimeEnvVar).toLongLong();
@@ -35,9 +36,13 @@ AppTime::AppTime() {
3536
}
3637
}
3738

38-
bool AppTime::hasTestTime() const { return m_testStartTime.has_value(); }
39+
bool AppTime::hasTestTime() const
40+
{
41+
return m_testStartTime.has_value();
42+
}
3943

40-
time_point AppTime::now() {
44+
time_point AppTime::now()
45+
{
4146
if (m_testStartTime.has_value()) {
4247
const auto runtime = system_clock::now() - m_realStartTime;
4348
return time_point{m_testStartTime.value()} + runtime;

src/lib/synergy/gui/AppTime.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222

2323
namespace synergy::gui {
2424

25-
class AppTime {
25+
class AppTime
26+
{
2627
using time_point = std::chrono::system_clock::time_point;
2728

2829
public:

src/lib/synergy/gui/CancelActivationDialog.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121

2222
#include "QPushButton"
2323

24-
CancelActivationDialog::CancelActivationDialog(QWidget *parent)
25-
: QDialog(parent),
26-
ui(new Ui::CancelActivationDialog) {
24+
CancelActivationDialog::CancelActivationDialog(QWidget *parent) : QDialog(parent), ui(new Ui::CancelActivationDialog)
25+
{
2726
ui->setupUi(this);
2827

2928
ui->m_pButtonBox->button(QDialogButtonBox::Cancel)->setText("&Back");
3029
ui->m_pButtonBox->button(QDialogButtonBox::Ok)->setText("&Exit");
3130
}
3231

33-
CancelActivationDialog::~CancelActivationDialog() { delete ui; }
32+
CancelActivationDialog::~CancelActivationDialog()
33+
{
34+
delete ui;
35+
}

src/lib/synergy/gui/CancelActivationDialog.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ namespace Ui {
2323
class CancelActivationDialog;
2424
}
2525

26-
class CancelActivationDialog : public QDialog {
26+
class CancelActivationDialog : public QDialog
27+
{
2728
Q_OBJECT
2829

2930
public:

src/lib/synergy/gui/constants.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ const auto kLinkBuy = R"(<a href="%1" style="color: %2">Buy now</a>)";
3131
const auto kLinkRenew = R"(<a href="%1" style="color: %2">Renew now</a>)";
3232
const auto kLinkDownload = R"(<a href="%1" style="color: %2">Download now</a>)";
3333

34-
const auto kUrlPurchase =
35-
QString("%1/purchase?%2").arg(kUrlWebsite, kUrlSourceQuery);
36-
const auto kUrlPersonalUpgrade =
37-
QString("%1/purchase/upgrade?%2").arg(kUrlWebsite, kUrlSourceQuery);
38-
const auto kUrlContact =
39-
QString("%1/contact?%2").arg(kUrlWebsite, kUrlSourceQuery);
34+
const auto kUrlPurchase = QString("%1/purchase?%2").arg(kUrlWebsite, kUrlSourceQuery);
35+
const auto kUrlPersonalUpgrade = QString("%1/purchase/upgrade?%2").arg(kUrlWebsite, kUrlSourceQuery);
36+
const auto kUrlContact = QString("%1/contact?%2").arg(kUrlWebsite, kUrlSourceQuery);
4037

4138
} // namespace synergy::gui

src/lib/synergy/gui/dialogs/UpgradeDialog.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@
2222
#include <QtCore>
2323
#include <QtGui>
2424

25-
UpgradeDialog::UpgradeDialog(QWidget *parent) : QMessageBox(parent) {
25+
UpgradeDialog::UpgradeDialog(QWidget *parent) : QMessageBox(parent)
26+
{
2627
m_cancel = addButton("Cancel", QMessageBox::RejectRole);
2728
m_upgrade = addButton("Upgrade", QMessageBox::AcceptRole);
2829
}
2930

30-
void UpgradeDialog::showDialog(
31-
const QString &title, const QString &body, const QString &link) {
31+
void UpgradeDialog::showDialog(const QString &title, const QString &body, const QString &link)
32+
{
3233
setWindowTitle(title);
3334
setText(body);
3435
exec();

0 commit comments

Comments
 (0)