Skip to content

Commit

Permalink
Use KDE clang format style
Browse files Browse the repository at this point in the history
  • Loading branch information
alex1701c committed May 5, 2024
1 parent 56ea42b commit 2b1c57d
Show file tree
Hide file tree
Showing 16 changed files with 312 additions and 273 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})

include(QtVersionOption)
include(KDEInstallDirs)
include(KDEClangFormat)
include(KDECMakeSettings)
include(KDECompilerSettings NO_POLICY_SCOPE)
include(ECMDeprecationSettings)
Expand Down
2 changes: 1 addition & 1 deletion src/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ struct KWalletConfig {
constexpr static const auto ProxyPassword = "Krunner-QuickWebShortcuts-proxy_password";
};
#endif
#endif //QUICKWEBSHORTCUTS_CONFIG_H
#endif // QUICKWEBSHORTCUTS_CONFIG_H
20 changes: 12 additions & 8 deletions src/config/SearchEngineItem.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include "SearchEngineItem.h"
#include <QCheckBox>
#include <QFileDialog>
#include <QRegularExpression>
#include <QCheckBox>
#include "SearchEngineItem.h"

SearchEngineItem::SearchEngineItem(QWidget *parent) : QWidget(parent) {
SearchEngineItem::SearchEngineItem(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
connect(this->useRadioButton, &QRadioButton::clicked, this, &SearchEngineItem::changed);
connect(this->useRadioButton, &QRadioButton::clicked, this, &SearchEngineItem::itemSelected);
Expand All @@ -20,8 +22,10 @@ SearchEngineItem::SearchEngineItem(QWidget *parent) : QWidget(parent) {
connect(this->urlLineEdit, &QLineEdit::textChanged, this, &SearchEngineItem::extractNameFromUrl);
}

void SearchEngineItem::extractNameFromUrl() {
if (!this->nameLineEdit->text().isEmpty()) return;
void SearchEngineItem::extractNameFromUrl()
{
if (!this->nameLineEdit->text().isEmpty())
return;
QRegularExpression exp(QStringLiteral(R"(^(?:https?://)(www\.)?([^/]+)\.(?:\.?[\w]{2,})+/?)"));
if (this->urlLineEdit->text().contains(exp)) {
const auto regexMatch = exp.match(this->urlLineEdit->text());
Expand All @@ -33,9 +37,9 @@ void SearchEngineItem::extractNameFromUrl() {
}
}

void SearchEngineItem::iconPicker() {
const QString iconPath = QFileDialog::getOpenFileName(this, tr("Select Icon"), "",
tr("Images (.*.jpg *.jpeg *.png *.ico *.svg *.svgz)"));
void SearchEngineItem::iconPicker()
{
const QString iconPath = QFileDialog::getOpenFileName(this, tr("Select Icon"), "", tr("Images (.*.jpg *.jpeg *.png *.ico *.svg *.svgz)"));
if (!iconPath.isEmpty()) {
this->originalIcon = this->icon;
this->icon = iconPath;
Expand Down
12 changes: 8 additions & 4 deletions src/config/SearchEngineItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

#include <QWidget>

class SearchEngineItem : public QWidget, public Ui::SearchEngineItemUi {
Q_OBJECT
class SearchEngineItem : public QWidget, public Ui::SearchEngineItemUi
{
Q_OBJECT

public:
QString originalName, originalURL, originalIcon, icon;
Expand All @@ -18,7 +19,10 @@ Q_OBJECT

public Q_SLOTS:
void extractNameFromUrl();
void edited() { this->isEdited = true; }
void edited()
{
this->isEdited = true;
}
void iconPicker();

Q_SIGNALS:
Expand All @@ -27,4 +31,4 @@ public Q_SLOTS:
void deleteCurrentItem();
};

#endif //QUICKWEBSHORTCUTS_SEARCHENGINEITEM_H
#endif // QUICKWEBSHORTCUTS_SEARCHENGINEITEM_H
8 changes: 5 additions & 3 deletions src/config/api_language_utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
// Shorter syntax for macro
#define s(str) QStringLiteral(str)

void setBingLanguages(QComboBox *box) {
void setBingLanguages(QComboBox *box)
{
box->clear();
box->addItem(s("ar-sa (Arabic)"), s("ar-sa"));
box->addItem(s("da-dk (Danish)"), s("da-dk"));
Expand Down Expand Up @@ -51,7 +52,8 @@ void setBingLanguages(QComboBox *box) {
box->addItem(s("zh-tw (Traditional Chinese-Taiwan)"), s("zh-tw"));
}

void setGoogleLanguages(QComboBox *box) {
void setGoogleLanguages(QComboBox *box)
{
box->clear();
// https://sites.google.com/site/tomihasa/google-language-codes
box->addItem(s("Afrikaans"), s("af"));
Expand Down Expand Up @@ -205,4 +207,4 @@ void setGoogleLanguages(QComboBox *box) {
box->addItem(s("Zulu"), s("zu"));
}

#endif //QUICKWEBSHORTCUTS_API_LANGUAGE_UTILITY_H
#endif // QUICKWEBSHORTCUTS_API_LANGUAGE_UTILITY_H
Loading

0 comments on commit 2b1c57d

Please sign in to comment.