aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-format108
-rw-r--r--astyle.rc4
-rw-r--r--lib/bookmarks/bookmarkitem.cpp2
-rw-r--r--lib/bookmarks/bookmarkitem.h8
-rw-r--r--lib/bookmarks/bookmarksmodel.cpp18
-rw-r--r--lib/bookmarks/bookmarksmodel.h3
-rw-r--r--lib/bookmarks/bookmarkswidget.cpp6
-rw-r--r--lib/bookmarks/bookmarkswidget.h10
-rw-r--r--lib/bookmarks/xbel.cpp1
-rw-r--r--lib/bookmarks/xbel.h2
-rw-r--r--lib/downloads/downloadswidget.cpp18
-rw-r--r--lib/downloads/downloadswidget.h3
-rw-r--r--lib/downloads/widgets/downloaditemwidget.cpp8
-rw-r--r--lib/downloads/widgets/downloaditemwidget.h5
-rw-r--r--lib/downloads/widgets/elidedlabel.h6
-rw-r--r--lib/navigation/navigationbutton.cpp16
-rw-r--r--lib/navigation/navigationbutton.h3
-rw-r--r--lib/navigation/urllineedit.cpp12
-rw-r--r--lib/navigation/urllineedit.h2
-rw-r--r--lib/settings/configuration.cpp54
-rw-r--r--lib/settings/configuration.h35
-rw-r--r--lib/settings/settingsdialog.cpp14
-rw-r--r--lib/settings/settingsdialog.h3
-rw-r--r--src/browser.cpp12
-rw-r--r--src/browser.h2
-rw-r--r--src/forms/aboutdialog.cpp12
-rw-r--r--src/forms/aboutdialog.h3
-rw-r--r--src/forms/cookiesform.cpp9
-rw-r--r--src/forms/cookiesform.h7
-rw-r--r--src/forms/profileview.cpp16
-rw-r--r--src/forms/profileview.h3
-rw-r--r--src/forms/searchform.cpp8
-rw-r--r--src/forms/searchform.h3
-rw-r--r--src/main.cpp12
-rw-r--r--src/mainwindow.cpp26
-rw-r--r--src/mainwindow.h9
-rw-r--r--src/singleapplication.cpp6
-rw-r--r--src/singleapplication.h1
-rw-r--r--src/webengine/urlinterceptor.cpp4
-rw-r--r--src/webengine/urlinterceptor.h3
-rw-r--r--src/webengine/webengineprofile.cpp72
-rw-r--r--src/webengine/webengineprofile.h2
-rw-r--r--src/webengine/webpage.cpp4
-rw-r--r--src/webengine/webview.cpp14
-rw-r--r--src/webengine/webview.h4
-rw-r--r--src/widgets/loadingbar.cpp6
-rw-r--r--src/widgets/mainwindowmenubar.cpp10
-rw-r--r--src/widgets/mainwindowtabbar.cpp12
-rw-r--r--src/widgets/mainwindowtabbar.h6
-rwxr-xr-xtools/hooks/pre-commit.rb6
50 files changed, 356 insertions, 257 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..64af425
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,108 @@
+---
+Language: Cpp
+# BasedOnStyle: WebKit
+AccessModifierOffset: -4
+AlignAfterOpenBracket: DontAlign
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Right
+AlignOperands: false
+AlignTrailingComments: false
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: false
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+ AfterClass: false
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: true
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: false
+ AfterUnion: false
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: false
+ SplitEmptyFunction: true
+ SplitEmptyRecord: true
+ SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: All
+BreakBeforeBraces: Linux
+BreakBeforeInheritanceComma: false
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: true
+BreakConstructorInitializers: BeforeComma
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: true
+ColumnLimit: 0
+CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: false
+DerivePointerAlignment: false
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: false
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
+IncludeCategories:
+ - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
+ Priority: 2
+ - Regex: '^(<|"(gtest|gmock|isl|json)/)'
+ Priority: 3
+ - Regex: '.*'
+ Priority: 1
+IncludeIsMainRegex: '(Test)?$'
+IndentCaseLabels: false
+IndentWidth: 4
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: Inner
+ObjCBlockIndentWidth: 4
+ObjCSpaceAfterProperty: true
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Right
+ReflowComments: true
+SortIncludes: true
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: Never
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInContainerLiterals: false
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 4
+UseTab: Never
+...
+
diff --git a/astyle.rc b/astyle.rc
deleted file mode 100644
index d0f745a..0000000
--- a/astyle.rc
+++ /dev/null
@@ -1,4 +0,0 @@
---style=otbs
---attach-namespaces
---attach-inlines
---indent=spaces=4
diff --git a/lib/bookmarks/bookmarkitem.cpp b/lib/bookmarks/bookmarkitem.cpp
index 14ad197..875ccc6 100644
--- a/lib/bookmarks/bookmarkitem.cpp
+++ b/lib/bookmarks/bookmarkitem.cpp
@@ -48,7 +48,7 @@ int BookmarkItem::childCount() const
int BookmarkItem::row() const
{
if(m_parentItem) {
- return m_parentItem->m_childItems.indexOf(const_cast<BookmarkItem*>(this));
+ return m_parentItem->m_childItems.indexOf(const_cast<BookmarkItem *>(this));
}
// no parent item, we are root
diff --git a/lib/bookmarks/bookmarkitem.h b/lib/bookmarks/bookmarkitem.h
index 839f10e..1b9223e 100644
--- a/lib/bookmarks/bookmarkitem.h
+++ b/lib/bookmarks/bookmarkitem.h
@@ -29,10 +29,12 @@ public:
int childIndex(BookmarkItem *item) const;
int childCount() const;
- BookmarkItemType type() const {
+ BookmarkItemType type() const
+ {
return m_type;
};
- int columnCount() const {
+ int columnCount() const
+ {
return 2;
};
@@ -47,7 +49,7 @@ public:
private:
BookmarkItemType m_type;
BookmarkItem *m_parentItem;
- QVector<BookmarkItem*> m_childItems;
+ QVector<BookmarkItem *> m_childItems;
};
#endif //BOOKMARKITEM_H
diff --git a/lib/bookmarks/bookmarksmodel.cpp b/lib/bookmarks/bookmarksmodel.cpp
index 757612e..7e0c35b 100644
--- a/lib/bookmarks/bookmarksmodel.cpp
+++ b/lib/bookmarks/bookmarksmodel.cpp
@@ -9,7 +9,8 @@
#include "bookmarksmodel.h"
#include <QStyle>
-BookmarksModel::BookmarksModel(QStyle *style, QObject *parent) : QAbstractItemModel(parent)
+BookmarksModel::BookmarksModel(QStyle *style, QObject *parent)
+ : QAbstractItemModel(parent)
{
folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirOpenIcon), QIcon::Normal, QIcon::On);
folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirClosedIcon), QIcon::Normal, QIcon::Off);
@@ -62,14 +63,14 @@ QModelIndex BookmarksModel::index(BookmarkItem *node, int column) const
QModelIndex BookmarksModel::index(int row, int column, const QModelIndex &parent) const
{
// invalid item requested
- if (!hasIndex(row, column, parent)) {
+ if(!hasIndex(row, column, parent)) {
return QModelIndex();
}
// index exists
BookmarkItem *parentItem;
if(parent.isValid()) {
- parentItem = static_cast<BookmarkItem*>(parent.internalPointer());
+ parentItem = static_cast<BookmarkItem *>(parent.internalPointer());
} else {
parentItem = m_rootItem;
}
@@ -87,7 +88,7 @@ QModelIndex BookmarksModel::parent(const QModelIndex &index) const
return QModelIndex();
}
- BookmarkItem *childItem = static_cast<BookmarkItem*>(index.internalPointer());
+ BookmarkItem *childItem = static_cast<BookmarkItem *>(index.internalPointer());
BookmarkItem *parentItem = childItem->parentItem();
if(parentItem == m_rootItem) {
@@ -107,7 +108,7 @@ int BookmarksModel::rowCount(const QModelIndex &parent) const
if(!parent.isValid()) {
parentItem = m_rootItem;
} else {
- parentItem = static_cast<BookmarkItem*>(parent.internalPointer());
+ parentItem = static_cast<BookmarkItem *>(parent.internalPointer());
}
return parentItem->childCount();
@@ -116,7 +117,7 @@ int BookmarksModel::rowCount(const QModelIndex &parent) const
int BookmarksModel::columnCount(const QModelIndex &parent) const
{
if(parent.isValid()) {
- return static_cast<BookmarkItem*>(parent.internalPointer())->columnCount();
+ return static_cast<BookmarkItem *>(parent.internalPointer())->columnCount();
} else {
return m_rootItem->columnCount();
}
@@ -125,12 +126,12 @@ int BookmarksModel::columnCount(const QModelIndex &parent) const
QVariant BookmarksModel::data(const QModelIndex &index, int role) const
{
// get data of invalid index?
- if (!index.isValid()) {
+ if(!index.isValid()) {
return QVariant();
}
const BookmarkItem *item = static_cast<BookmarkItem *>(index.internalPointer());
- switch (role) {
+ switch(role) {
case Qt::DisplayRole:
case Qt::EditRole:
if(index.column() == 0) {
@@ -200,6 +201,5 @@ QModelIndexList BookmarksModel::match(const QModelIndex &start, int role, const
}
}
-
return list;
}
diff --git a/lib/bookmarks/bookmarksmodel.h b/lib/bookmarks/bookmarksmodel.h
index 9d884fb..baf2ba9 100644
--- a/lib/bookmarks/bookmarksmodel.h
+++ b/lib/bookmarks/bookmarksmodel.h
@@ -6,9 +6,9 @@
* SPDX-License-Identifier: GPL-3.0
*/
+#include "bookmarkitem.h"
#include <QAbstractItemModel>
#include <QIcon>
-#include "bookmarkitem.h"
#ifndef BOOKMARKSMODEL_H
#define BOOKMARKSMODEL_H
@@ -46,7 +46,6 @@ private:
QIcon bookmarkIcon;
BookmarkItem *m_rootItem;
-
};
#endif //BOOKMARKSMODEL_H
diff --git a/lib/bookmarks/bookmarkswidget.cpp b/lib/bookmarks/bookmarkswidget.cpp
index daec3f4..8aafe37 100644
--- a/lib/bookmarks/bookmarkswidget.cpp
+++ b/lib/bookmarks/bookmarkswidget.cpp
@@ -10,9 +10,9 @@
#include "ui_bookmarksform.h"
#include <QUrl>
-BookmarksWidget::BookmarksWidget(const QString &path, QWidget *parent) :
- QWidget(parent),
- ui(new Ui::BookmarksDialog)
+BookmarksWidget::BookmarksWidget(const QString &path, QWidget *parent)
+ : QWidget(parent)
+ , ui(new Ui::BookmarksDialog)
{
// make sure this dialog does not get deleted on close
setAttribute(Qt::WA_DeleteOnClose, false);
diff --git a/lib/bookmarks/bookmarkswidget.h b/lib/bookmarks/bookmarkswidget.h
index cdc013e..f82a512 100644
--- a/lib/bookmarks/bookmarkswidget.h
+++ b/lib/bookmarks/bookmarkswidget.h
@@ -9,11 +9,12 @@
#ifndef BOOKMARKSDIALOG_H
#define BOOKMARKSDIALOG_H
-#include <QWidget>
-#include "xbel.h"
#include "bookmarksmodel.h"
+#include "xbel.h"
+#include <QWidget>
-namespace Ui {
+namespace Ui
+{
class BookmarksDialog;
}
@@ -23,7 +24,7 @@ class BookmarksWidget : public QWidget
public:
explicit BookmarksWidget(const QString &path, QWidget *parent = 0);
- ~BookmarksWidget() override ;
+ ~BookmarksWidget() override;
void save();
QAbstractItemModel *model() const;
@@ -31,7 +32,6 @@ public:
signals:
void openUrl(const QUrl &url);
-
private:
void expandNodes(BookmarkItem *node);
diff --git a/lib/bookmarks/xbel.cpp b/lib/bookmarks/xbel.cpp
index eeb019a..7a7632c 100644
--- a/lib/bookmarks/xbel.cpp
+++ b/lib/bookmarks/xbel.cpp
@@ -46,7 +46,6 @@ BookmarkItem *Xbel::read()
return root;
}
-
void Xbel::readChildElements(QXmlStreamReader &reader, BookmarkItem *parentItem)
{
while(reader.readNextStartElement()) {
diff --git a/lib/bookmarks/xbel.h b/lib/bookmarks/xbel.h
index 1c03b74..c425cc5 100644
--- a/lib/bookmarks/xbel.h
+++ b/lib/bookmarks/xbel.h
@@ -9,9 +9,9 @@
#ifndef XBELREADER_H
#define XBELREADER_H
+#include "bookmarkitem.h"
#include <QString>
#include <QXmlStreamReader>
-#include "bookmarkitem.h"
class Xbel
{
diff --git a/lib/downloads/downloadswidget.cpp b/lib/downloads/downloadswidget.cpp
index 1a5f268..b3bad67 100644
--- a/lib/downloads/downloadswidget.cpp
+++ b/lib/downloads/downloadswidget.cpp
@@ -9,14 +9,14 @@
#include "downloadswidget.h"
#include "ui_downloadsform.h"
-#include <QWebEngineDownloadItem>
+#include "widgets/downloaditemwidget.h"
#include <QFileDialog>
#include <QListWidget>
-#include "widgets/downloaditemwidget.h"
+#include <QWebEngineDownloadItem>
-DownloadsWidget::DownloadsWidget(const QString &downloadPath, QWidget *parent) :
- QDialog(parent),
- ui(new Ui::DownloadDialog)
+DownloadsWidget::DownloadsWidget(const QString &downloadPath, QWidget *parent)
+ : QDialog(parent)
+ , ui(new Ui::DownloadDialog)
{
// make sure this dialog does not get deleted on close
setAttribute(Qt::WA_DeleteOnClose, false);
@@ -27,13 +27,13 @@ DownloadsWidget::DownloadsWidget(const QString &downloadPath, QWidget *parent) :
m_downloadPath = downloadPath;
connect(ui->listWidget, &QListWidget::currentItemChanged, this, [this](QListWidgetItem *current, QListWidgetItem *previous) {
- DownloadItemWidget *currentWidget = qobject_cast<DownloadItemWidget*>(ui->listWidget->itemWidget(current));
+ DownloadItemWidget *currentWidget = qobject_cast<DownloadItemWidget *>(ui->listWidget->itemWidget(current));
currentWidget->showDetails();
currentWidget->setFixedWidth(ui->listWidget->viewport()->width());
currentWidget->adjustSize();
current->setSizeHint(currentWidget->size());
- DownloadItemWidget *previousWidget = qobject_cast<DownloadItemWidget*>(ui->listWidget->itemWidget(previous));
+ DownloadItemWidget *previousWidget = qobject_cast<DownloadItemWidget *>(ui->listWidget->itemWidget(previous));
if(previousWidget != nullptr) {
previousWidget->hideDetails();
previousWidget->setFixedWidth(ui->listWidget->viewport()->width());
@@ -53,8 +53,8 @@ void DownloadsWidget::addDownload(QWebEngineDownloadItem *item)
this->show();
QString filepath = QFileDialog::getSaveFileName(this,
- tr("Save"),
- m_downloadPath + "/" + QFileInfo(item->path()).fileName());
+ tr("Save"),
+ m_downloadPath + "/" + QFileInfo(item->path()).fileName());
if(filepath.isEmpty()) {
// user cancelled the save dialog
diff --git a/lib/downloads/downloadswidget.h b/lib/downloads/downloadswidget.h
index 8c9ea21..d724e08 100644
--- a/lib/downloads/downloadswidget.h
+++ b/lib/downloads/downloadswidget.h
@@ -11,7 +11,8 @@
#include <QDialog>
-namespace Ui {
+namespace Ui
+{
class DownloadDialog;
}
diff --git a/lib/downloads/widgets/downloaditemwidget.cpp b/lib/downloads/widgets/downloaditemwidget.cpp
index a51275e..6860c16 100644
--- a/lib/downloads/widgets/downloaditemwidget.cpp
+++ b/lib/downloads/widgets/downloaditemwidget.cpp
@@ -11,9 +11,9 @@
#include <QUrl>
-DownloadItemWidget::DownloadItemWidget(QWebEngineDownloadItem *item, QWidget *parent) :
- QWidget(parent),
- ui(new Ui::DownloadItemForm)
+DownloadItemWidget::DownloadItemWidget(QWebEngineDownloadItem *item, QWidget *parent)
+ : QWidget(parent)
+ , ui(new Ui::DownloadItemForm)
{
m_item = item;
@@ -68,7 +68,7 @@ QString DownloadItemWidget::sizeString(int size) const
void DownloadItemWidget::updateState(QWebEngineDownloadItem::DownloadState state)
{
- switch (state) {
+ switch(state) {
case QWebEngineDownloadItem::DownloadRequested:
ui->status_label->setText(tr("Requested"));
break;
diff --git a/lib/downloads/widgets/downloaditemwidget.h b/lib/downloads/widgets/downloaditemwidget.h
index c6246da..09a7370 100644
--- a/lib/downloads/widgets/downloaditemwidget.h
+++ b/lib/downloads/widgets/downloaditemwidget.h
@@ -9,10 +9,11 @@
#ifndef DOWNLOADITEMFORM_H
#define DOWNLOADITEMFORM_H
-#include <QWidget>
#include <QWebEngineDownloadItem>
+#include <QWidget>
-namespace Ui {
+namespace Ui
+{
class DownloadItemForm;
}
diff --git a/lib/downloads/widgets/elidedlabel.h b/lib/downloads/widgets/elidedlabel.h
index d0f6221..d6c06c5 100644
--- a/lib/downloads/widgets/elidedlabel.h
+++ b/lib/downloads/widgets/elidedlabel.h
@@ -67,10 +67,12 @@ public:
explicit ElidedLabel(QWidget *parent = nullptr);
void setContent(const QString &text);
- const QString & text() const {
+ const QString &text() const
+ {
return content;
}
- bool isElided() const {
+ bool isElided() const
+ {
return elided;
}
diff --git a/lib/navigation/navigationbutton.cpp b/lib/navigation/navigationbutton.cpp
index ecf7c81..577c291 100644
--- a/lib/navigation/navigationbutton.cpp
+++ b/lib/navigation/navigationbutton.cpp
@@ -11,13 +11,13 @@
#include <QStyle>
#include <QWebEngineHistory>
-NavigationButton::NavigationButton(Type type, QWidget *parent) :
- QToolButton(parent)
+NavigationButton::NavigationButton(Type type, QWidget *parent)
+ : QToolButton(parent)
{
m_type = type;
menu = new QMenu(this);
- switch (type) {
+ switch(type) {
case BackButton:
setIcon(style()->standardIcon(QStyle::SP_ArrowBack));
setMenu(menu);
@@ -37,10 +37,8 @@ NavigationButton::NavigationButton(Type type, QWidget *parent) :
}
connect(this, &NavigationButton::clicked, this, &NavigationButton::doAction);
-
}
-
void NavigationButton::setView(WebView *view)
{
disconnect(loadStartedConnection);
@@ -57,7 +55,7 @@ void NavigationButton::setView(WebView *view)
void NavigationButton::updateOnLoadStarted()
{
- switch (m_type) {
+ switch(m_type) {
case BackButton:
break;
case ForwardButton:
@@ -73,7 +71,7 @@ void NavigationButton::updateOnLoadStarted()
void NavigationButton::updateOnLoadFinished()
{
- switch (m_type) {
+ switch(m_type) {
case BackButton:
if(m_view->history()->canGoBack()) {
setEnabled(true);
@@ -99,7 +97,7 @@ void NavigationButton::updateOnLoadFinished()
void NavigationButton::doAction()
{
- switch (m_type) {
+ switch(m_type) {
case BackButton:
m_view->history()->back();
break;
@@ -120,7 +118,7 @@ void NavigationButton::prepareMenu()
menu->clear();
QList<QWebEngineHistoryItem> items;
- switch (m_type) {
+ switch(m_type) {
case BackButton:
items = m_view->history()->backItems(10);
break;
diff --git a/lib/navigation/navigationbutton.h b/lib/navigation/navigationbutton.h
index 7c76b9c..e0d358a 100644
--- a/lib/navigation/navigationbutton.h
+++ b/lib/navigation/navigationbutton.h
@@ -9,8 +9,8 @@
#ifndef NAVIGATIONBUTTON_H
#define NAVIGATIONBUTTON_H
-#include <QToolButton>
#include "../../src/webengine/webview.h"
+#include <QToolButton>
class QMenu;
@@ -18,7 +18,6 @@ class NavigationButton : public QToolButton
{
Q_OBJECT
public:
-
enum Type {
BackButton,
ForwardButton,
diff --git a/lib/navigation/urllineedit.cpp b/lib/navigation/urllineedit.cpp
index 85f443d..4c207a1 100644
--- a/lib/navigation/urllineedit.cpp
+++ b/lib/navigation/urllineedit.cpp
@@ -7,9 +7,9 @@
*/
#include "urllineedit.h"
-#include <QTimer>
#include <QMenu>
#include <QStyle>
+#include <QTimer>
#include <QWidgetAction>
// ssl menu
@@ -18,9 +18,9 @@
#include <QListView>
#include <QStringListModel>
-UrlLineEdit::UrlLineEdit(QWidget *parent) :
- QLineEdit(parent),
- m_listView(new QListView(this))
+UrlLineEdit::UrlLineEdit(QWidget *parent)
+ : QLineEdit(parent)
+ , m_listView(new QListView(this))
{
setPlaceholderText(tr("Enter address"));
@@ -66,7 +66,6 @@ UrlLineEdit::UrlLineEdit(QWidget *parent) :
}
this->clearFocus();
});
-
}
QAction *UrlLineEdit::pageAction()
@@ -145,7 +144,7 @@ void UrlLineEdit::keyPressEvent(QKeyEvent *event)
int count = m_listView->model()->rowCount();
QModelIndex currentIndex = m_listView->currentIndex();
- switch (key) {
+ switch(key) {
case Qt::Key_Down:
if(currentIndex.row() + 1 >= count) {
m_listView->setCurrentIndex(m_listView->model()->index(0, 0));
@@ -185,7 +184,6 @@ void UrlLineEdit::setTextFormat(const QTextLayout::FormatRange &format)
attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, format.start, format.length, format.format));
QInputMethodEvent ev(QString(), attributes);
event(&ev);
-
}
void UrlLineEdit::clearTextFormat()
diff --git a/lib/navigation/urllineedit.h b/lib/navigation/urllineedit.h
index a06ba1b..9ac0366 100644
--- a/lib/navigation/urllineedit.h
+++ b/lib/navigation/urllineedit.h
@@ -9,9 +9,9 @@
#ifndef URLLINEEDIT_H
#define URLLINEEDIT_H
+#include <QAction>
#include <QLineEdit>
#include <QTextLayout>
-#include <QAction>
class QAbstractItemModel;
class QMenu;
diff --git a/lib/settings/configuration.cpp b/lib/settings/configuration.cpp
index 1fa1fbf..06ee0bd 100644
--- a/lib/settings/configuration.cpp
+++ b/lib/settings/configuration.cpp
@@ -38,19 +38,19 @@ bool Configuration::readUserConfiguration(const std::string &path)
m_userCfgPath = path;
try {
m_userCfg->readFile(path.c_str());
- } catch (FileIOException) {
+ } catch(FileIOException) {
return false;
- } catch (ParseException) {
+ } catch(ParseException) {
return false;
}
- return true;
+ return true;
}
bool Configuration::parse(const std::string &contents)
{
try {
m_userCfg->readString(contents);
- } catch (ParseException) {
+ } catch(ParseException) {
return false;
}
return true;
@@ -61,7 +61,7 @@ bool Configuration::writeUserConfiguration(const std::string &path)
m_userCfgPath = path;
try {
m_userCfg->writeFile(m_userCfgPath.c_str());
- } catch (FileIOException) {
+ } catch(FileIOException) {
return false;
}
return true;
@@ -71,7 +71,7 @@ bool Configuration::writeIfNeeded()
{
try {
m_userCfg->writeFile(m_userCfgPath.c_str());
- } catch (FileIOException) {
+ } catch(FileIOException) {
return false;
}
return true;
@@ -81,13 +81,13 @@ bool Configuration::parseDefaultConfiguration(const std::string &contents)
{
try {
m_defaultCfg->readString(contents);
- } catch (ParseException) {
+ } catch(ParseException) {
return false;
}
return true;
}
-std::vector<std::string> Configuration::childrenSettings(const char* name)
+std::vector<std::string> Configuration::childrenSettings(const char *name)
{
std::vector<std::string> groupNames;
const Setting &root = m_userCfg->lookup(name);
@@ -101,7 +101,7 @@ std::vector<std::string> Configuration::childrenSettings(const char* name)
return groupNames;
}
-std::vector<std::string> Configuration::childrenGroups(const char* name)
+std::vector<std::string> Configuration::childrenGroups(const char *name)
{
std::vector<std::string> groupNames;
const Setting &root = m_userCfg->lookup(name);
@@ -118,7 +118,7 @@ void Configuration::resetValue(const char *path)
{
if(m_userCfg->exists(path)) {
Setting &v = m_userCfg->lookup(path);
- switch (v.getType()) {
+ switch(v.getType()) {
case Setting::TypeNone:
break;
case Setting::TypeInt:
@@ -146,8 +146,8 @@ void Configuration::resetValue(const char *path)
}
}
-template<typename T>
-std::optional<T> Configuration::value(const char* path) const
+template <typename T>
+std::optional<T> Configuration::value(const char *path) const
{
// if setting doesn't exist, give back a nullopt
if(!m_userCfg->exists(path)) {
@@ -160,7 +160,7 @@ std::optional<T> Configuration::value(const char* path) const
// cast depending on type
// type checks are done during compile time
- switch (setting.getType()) {
+ switch(setting.getType()) {
case Setting::TypeNone:
r = std::nullopt;
break;
@@ -201,7 +201,7 @@ std::optional<T> Configuration::value(const char* path) const
case Setting::TypeString:
// const char*, std::string
if constexpr(std::is_same<T, std::string>::value) {
- r = std::optional<std::string>(static_cast<const char*>(setting));
+ r = std::optional<std::string>(static_cast<const char *>(setting));
} else {
r = std::nullopt;
}
@@ -235,22 +235,22 @@ std::optional<T> Configuration::value(const char* path) const
}
// tell the compiler to export these functions, otherwise you get linking errors
-template std::optional<int> Configuration::value<int>(const char* path) const;
-template std::optional<unsigned int> Configuration::value<unsigned int>(const char* path) const;
-template std::optional<long> Configuration::value<long>(const char* path) const;
-template std::optional<unsigned long> Configuration::value<unsigned long>(const char* path) const;
+template std::optional<int> Configuration::value<int>(const char *path) const;
+template std::optional<unsigned int> Configuration::value<unsigned int>(const char *path) const;
+template std::optional<long> Configuration::value<long>(const char *path) const;
+template std::optional<unsigned long> Configuration::value<unsigned long>(const char *path) const;
-template std::optional<long long> Configuration::value<long long>(const char* path) const;
-template std::optional<unsigned long long> Configuration::value<unsigned long long>(const char* path) const;
+template std::optional<long long> Configuration::value<long long>(const char *path) const;
+template std::optional<unsigned long long> Configuration::value<unsigned long long>(const char *path) const;
-template std::optional<float> Configuration::value<float>(const char* path) const;
-template std::optional<double> Configuration::value<double>(const char* path) const;
+template std::optional<float> Configuration::value<float>(const char *path) const;
+template std::optional<double> Configuration::value<double>(const char *path) const;
-template std::optional<bool> Configuration::value<bool>(const char* path) const;
+template std::optional<bool> Configuration::value<bool>(const char *path) const;
-template std::optional<std::string> Configuration::value<std::string>(const char* path) const;
+template std::optional<std::string> Configuration::value<std::string>(const char *path) const;
-template<typename T>
+template <typename T>
bool Configuration::setValue(std::string path, const T &val)
{
if(m_userCfg->exists(path)) {
@@ -259,7 +259,7 @@ bool Configuration::setValue(std::string path, const T &val)
if constexpr(std::is_unsigned_v<T> && !std::is_same_v<T, bool>) {
setting = static_cast<typename std::make_signed_t<T>>(val);
} else if constexpr(std::is_same_v<T, std::string>) {
- switch (setting.getType()) {
+ switch(setting.getType()) {
case Setting::TypeNone:
break;
@@ -279,7 +279,7 @@ bool Configuration::setValue(std::string path, const T &val)
case Setting::TypeBoolean:
if(static_cast<std::string>(val) == "true") {
setting = true;
- } else if (static_cast<std::string>(val) == "false") {
+ } else if(static_cast<std::string>(val) == "false") {
setting = false;
}
break;
diff --git a/lib/settings/configuration.h b/lib/settings/configuration.h
index b258cb3..4fc614e 100644
--- a/lib/settings/configuration.h
+++ b/lib/settings/configuration.h
@@ -10,10 +10,11 @@
#define CONFIGURATION_H
#include <optional>
-#include <vector>
#include <string>
+#include <vector>
-namespace libconfig {
+namespace libconfig
+{
class Config;
class Setting;
}
@@ -34,12 +35,12 @@ public:
std::vector<std::string> childrenSettings(const char *name = "");
std::vector<std::string> childrenGroups(const char *name = "");
- void resetValue(const char* path);
+ void resetValue(const char *path);
- template<typename T>
- std::optional<T> value(const char* path) const;
+ template <typename T>
+ std::optional<T> value(const char *path) const;
- template<typename T>
+ template <typename T>
bool setValue(std::string path, const T &val);
private:
@@ -49,26 +50,26 @@ private:
};
// replace ~ with home
-std::string& patchHome(std::string &path, const std::string &home);
+std::string &patchHome(std::string &path, const std::string &home);
// instantiate functions
// this needs to be done because the implementation is in the cpp file
// Settings::value<>
-extern template std::optional<int> Configuration::value<int>(const char* path) const;
-extern template std::optional<unsigned int> Configuration::value<unsigned int>(const char* path) const;
-extern template std::optional<long> Configuration::value<long>(const char* path) const;
-extern template std::optional<unsigned long> Configuration::value<unsigned long>(const char* path) const;
+extern template std::optional<int> Configuration::value<int>(const char *path) const;
+extern template std::optional<unsigned int> Configuration::value<unsigned int>(const char *path) const;
+extern template std::optional<long> Configuration::value<long>(const char *path) const;
+extern template std::optional<unsigned long> Configuration::value<unsigned long>(const char *path) const;
-extern template std::optional<long long> Configuration::value<long long>(const char* path) const;
-extern template std::optional<unsigned long long> Configuration::value<unsigned long long>(const char* path) const;
+extern template std::optional<long long> Configuration::value<long long>(const char *path) const;
+extern template std::optional<unsigned long long> Configuration::value<unsigned long long>(const char *path) const;
-extern template std::optional<float> Configuration::value<float>(const char* path) const;
-extern template std::optional<double> Configuration::value<double>(const char* path) const;
+extern template std::optional<float> Configuration::value<float>(const char *path) const;
+extern template std::optional<double> Configuration::value<double>(const char *path) const;
-extern template std::optional<bool> Configuration::value<bool>(const char* path) const;
+extern template std::optional<bool> Configuration::value<bool>(const char *path) const;
-extern template std::optional<std::string> Configuration::value<std::string>(const char* path) const;
+extern template std::optional<std::string> Configuration::value<std::string>(const char *path) const;
// Settings::setValue<>
extern template bool Configuration::setValue<int>(std::string path, const int &val);
diff --git a/lib/settings/settingsdialog.cpp b/lib/settings/settingsdialog.cpp
index 478e372..97b5f44 100644
--- a/lib/settings/settingsdialog.cpp
+++ b/lib/settings/settingsdialog.cpp
@@ -7,19 +7,19 @@
*/
#include "settingsdialog.h"
-#include "ui_settingsdialog.h"
#include "configuration.h"
-#include <QScrollArea>
+#include "ui_settingsdialog.h"
#include <QFormLayout>
+#include <QGroupBox>
#include <QLineEdit>
+#include <QScrollArea>
#include <QToolButton>
-#include <QGroupBox>
inline QHBoxLayout *createEntry(Configuration *config, const std::string &path, QWidget *widget);
-SettingsDialog::SettingsDialog(std::shared_ptr<Configuration> &settings, QWidget *parent) :
- QDialog(parent),
- ui(new Ui::SettingsDialog)
+SettingsDialog::SettingsDialog(std::shared_ptr<Configuration> &settings, QWidget *parent)
+ : QDialog(parent)
+ , ui(new Ui::SettingsDialog)
{
ui->setupUi(this);
@@ -67,7 +67,7 @@ QWidget *widgetForGroup(std::shared_ptr<Configuration> &settings, const std::str
return widget;
}
-inline QHBoxLayout *createEntry(Configuration* config, const std::string &path, QWidget *widget)
+inline QHBoxLayout *createEntry(Configuration *config, const std::string &path, QWidget *widget)
{
QLineEdit *lineEdit = new QLineEdit(widget);
lineEdit->setText(QString::fromStdString(config->value<std::string>(path.c_str()).value()));
diff --git a/lib/settings/settingsdialog.h b/lib/settings/settingsdialog.h
index 74dd964..f77b822 100644
--- a/lib/settings/settingsdialog.h
+++ b/lib/settings/settingsdialog.h
@@ -12,7 +12,8 @@
#include <QDialog>
#include <memory>
-namespace Ui {
+namespace Ui
+{
class SettingsDialog;
}
diff --git a/src/browser.cpp b/src/browser.cpp
index aad80bb..bd1f841 100644
--- a/src/browser.cpp
+++ b/src/browser.cpp
@@ -7,14 +7,14 @@
*/
#include "browser.h"
-#include <bookmarks/bookmarkswidget.h>
-#include <downloads/downloadswidget.h>
-#include "webengine/urlinterceptor.h"
#include "mainwindow.h"
+#include "webengine/urlinterceptor.h"
#include <QDir>
+#include <bookmarks/bookmarkswidget.h>
+#include <downloads/downloadswidget.h>
-Browser::Browser(int &argc, char *argv[]) :
- SingleApplication(argc, argv)
+Browser::Browser(int &argc, char *argv[])
+ : SingleApplication(argc, argv)
{
setApplicationName("smolbote");
setWindowIcon(QIcon(":/icon.svg"));
@@ -43,7 +43,6 @@ void Browser::setConfiguration(std::shared_ptr<Configuration> &config)
// set default profile
m_defaultProfile = profile(QString::fromStdString(m_config->value<std::string>("browser.profile").value()));
-
}
MainWindow *Browser::createWindow()
@@ -124,4 +123,3 @@ QStringList Browser::profiles() const
{
return m_profiles.keys();
}
-
diff --git a/src/browser.h b/src/browser.h
index a193e61..1383c44 100644
--- a/src/browser.h
+++ b/src/browser.h
@@ -9,11 +9,11 @@
#ifndef BROWSER_H
#define BROWSER_H
+#include "settings/configuration.h"
#include "singleapplication.h"
#include "webengine/webengineprofile.h"
#include <QVector>
#include <memory>
-#include "settings/configuration.h"
class MainWindow;
class BookmarksWidget;
diff --git a/src/forms/aboutdialog.cpp b/src/forms/aboutdialog.cpp
index 0744a5f..e5dfc7d 100644
--- a/src/forms/aboutdialog.cpp
+++ b/src/forms/aboutdialog.cpp
@@ -12,7 +12,7 @@
constexpr const char *getCompiler()
{
- // clang also defines __GNUC__, so we need to check for clang first
+// clang also defines __GNUC__, so we need to check for clang first
#if defined(__clang__)
return "Clang " __clang_version__;
#elif defined(__GNUC__)
@@ -31,9 +31,9 @@ inline const QString getLongVersion()
#endif
}
-AboutDialog::AboutDialog(QWidget *parent) :
- QDialog(parent),
- ui(new Ui::AboutDialog)
+AboutDialog::AboutDialog(QWidget *parent)
+ : QDialog(parent)
+ , ui(new Ui::AboutDialog)
{
setAttribute(Qt::WA_DeleteOnClose, true);
ui->setupUi(this);
@@ -44,7 +44,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
aboutLabel->setWordWrap(true);
aboutLabel->setText(tr("<h2>smolbote %1</h2>"
"<p><i>yet another no-frills browser</i></p>")
- .arg(qApp->applicationVersion()));
+ .arg(qApp->applicationVersion()));
ui->toolBox->addItem(aboutLabel, tr("About"));
QLabel *licenseLabel = new QLabel(this);
@@ -72,7 +72,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
"<li>Qt %3</li>"
"<li>libconfig</li>"
"</ul></p>")
- .arg(getLongVersion(), getCompiler(), qVersion()));
+ .arg(getLongVersion(), getCompiler(), qVersion()));
ui->toolBox->addItem(libsLabel, tr("Details"));
}
diff --git a/src/forms/aboutdialog.h b/src/forms/aboutdialog.h
index 9f2189e..740df09 100644
--- a/src/forms/aboutdialog.h
+++ b/src/forms/aboutdialog.h
@@ -11,7 +11,8 @@
#include <QDialog>
-namespace Ui {
+namespace Ui
+{
class AboutDialog;
}
diff --git a/src/forms/cookiesform.cpp b/src/forms/cookiesform.cpp
index 94d1854..cf2bcb8 100644
--- a/src/forms/cookiesform.cpp
+++ b/src/forms/cookiesform.cpp
@@ -11,16 +11,16 @@
#include <QDateTime>
-CookiesForm::CookiesForm(QWebEngineCookieStore *store, QWidget *parent) :
- QWidget(parent),
- ui(new Ui::CookiesForm)
+CookiesForm::CookiesForm(QWebEngineCookieStore *store, QWidget *parent)
+ : QWidget(parent)
+ , ui(new Ui::CookiesForm)
{
setAttribute(Qt::WA_DeleteOnClose, false);
ui->setupUi(this);
ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
connect(store, SIGNAL(cookieAdded(QNetworkCookie)), this, SLOT(addCookie(QNetworkCookie)));
- connect(ui->treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(showDetails(QTreeWidgetItem*,QTreeWidgetItem*)));
+ connect(ui->treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(showDetails(QTreeWidgetItem *, QTreeWidgetItem *)));
}
CookiesForm::~CookiesForm()
@@ -57,7 +57,6 @@ void CookiesForm::addCookie(const QNetworkCookie &cookie)
item->setData(0, IsSecureRole, cookie.isSecure() ? tr("yes") : tr("no"));
item->setData(0, IsSessionCookieRole, cookie.isSessionCookie() ? tr("yes") : tr("no"));
item->setData(0, PathRole, cookie.path());
-
}
void CookiesForm::showDetails(QTreeWidgetItem *current, QTreeWidgetItem *previous)
diff --git a/src/forms/cookiesform.h b/src/forms/cookiesform.h
index 01c32ff..18c7698 100644
--- a/src/forms/cookiesform.h
+++ b/src/forms/cookiesform.h
@@ -9,11 +9,12 @@
#ifndef COOKIESFORM_H
#define COOKIESFORM_H
-#include <QWidget>
-#include <QWebEngineCookieStore>
#include <QTreeWidgetItem>
+#include <QWebEngineCookieStore>
+#include <QWidget>
-namespace Ui {
+namespace Ui
+{
class CookiesForm;
}
diff --git a/src/forms/profileview.cpp b/src/forms/profileview.cpp
index 7d3396f..3d85963 100644
--- a/src/forms/profileview.cpp
+++ b/src/forms/profileview.cpp
@@ -9,20 +9,20 @@
#include "profileview.h"
#include "ui_profileview.h"
+#include "forms/cookiesform.h"
+#include "webengine/webengineprofile.h"
+#include <QComboBox>
#include <QLineEdit>
#include <QPlainTextEdit>
-#include <QComboBox>
#include <QPushButton>
-#include "webengine/webengineprofile.h"
-#include "forms/cookiesform.h"
#include <QDialogButtonBox>
#include <QFormLayout>
-ProfileView::ProfileView(WebEngineProfile *profile, QWidget *parent) :
- QDialog(parent),
- ui(new Ui::ProfileView)
+ProfileView::ProfileView(WebEngineProfile *profile, QWidget *parent)
+ : QDialog(parent)
+ , ui(new Ui::ProfileView)
{
ui->setupUi(this);
setProfile(profile);
@@ -98,7 +98,7 @@ void ProfileView::updateProfile()
// http
m_profile->setHttpUserAgent(ui->userAgent->toPlainText());
m_profile->setHttpAcceptLanguage(ui->acceptLanguage->toPlainText());
- switch (ui->cacheType->currentIndex()) {
+ switch(ui->cacheType->currentIndex()) {
case 0:
m_profile->setHttpCacheType(QWebEngineProfile::MemoryHttpCache);
break;
@@ -114,7 +114,7 @@ void ProfileView::updateProfile()
m_profile->setHttpCacheMaximumSize(ui->cacheSize->text().toInt());
// policy
- switch (ui->cookiePolicy->currentIndex()) {
+ switch(ui->cookiePolicy->currentIndex()) {
case 0:
m_profile->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
break;
diff --git a/src/forms/profileview.h b/src/forms/profileview.h
index a2e42f2..bf44346 100644
--- a/src/forms/profileview.h
+++ b/src/forms/profileview.h
@@ -11,7 +11,8 @@
#include <QDialog>
-namespace Ui {
+namespace Ui
+{
class ProfileView;
}
diff --git a/src/forms/searchform.cpp b/src/forms/searchform.cpp
index b12ff80..42e5a1a 100644
--- a/src/forms/searchform.cpp
+++ b/src/forms/searchform.cpp
@@ -7,14 +7,14 @@
*/
#include "searchform.h"
-#include "ui_searchform.h"
#include "../mainwindow.h"
+#include "ui_searchform.h"
#include <settings/configuration.h>
-SearchForm::SearchForm(MainWindow *parentWindow, QWidget *parent) :
- QWidget(parent),
- ui(new Ui::SearchForm)
+SearchForm::SearchForm(MainWindow *parentWindow, QWidget *parent)
+ : QWidget(parent)
+ , ui(new Ui::SearchForm)
{
Q_CHECK_PTR(parentWindow);
diff --git a/src/forms/searchform.h b/src/forms/searchform.h
index 646d4d4..85ce11b 100644
--- a/src/forms/searchform.h
+++ b/src/forms/searchform.h
@@ -11,7 +11,8 @@
#include <QWidget>
-namespace Ui {
+namespace Ui
+{
class SearchForm;
}
diff --git a/src/main.cpp b/src/main.cpp
index b7bd311..57389bf 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -6,15 +6,15 @@
* SPDX-License-Identifier: GPL-3.0
*/
-#include <iostream>
-#include "version.h"
#include "browser.h"
+#include "mainwindow.h"
+#include "version.h"
#include <QCommandLineParser>
+#include <QDir>
#include <QFile>
#include <QFileInfo>
-#include <QDir>
#include <QStandardPaths>
-#include "mainwindow.h"
+#include <iostream>
// startup time measuring
#ifdef QT_DEBUG
@@ -79,7 +79,7 @@ int main(int argc, char *argv[])
parser.addVersionOption();
// user config, ~/.config/smolbote/smolbote.cfg or empty if there is none
- QCommandLineOption configOption({"c", "config"}, "Set configuration file.", "path");
+ QCommandLineOption configOption({ "c", "config" }, "Set configuration file.", "path");
configOption.setDefaultValue(QStandardPaths::locate(QStandardPaths::AppConfigLocation, "smolbote.cfg"));
parser.addOption(configOption);
@@ -96,7 +96,7 @@ int main(int argc, char *argv[])
QCommandLineOption generateUserConfigOption("generate-user-config", "Generate user configuration and exit.");
parser.addOption(generateUserConfigOption);
- QCommandLineOption profileOption({"p", "profile"}, "Use this profile.", "PROFILE");
+ QCommandLineOption profileOption({ "p", "profile" }, "Use this profile.", "PROFILE");
profileOption.setDefaultValue("");
parser.addOption(profileOption);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index b7c4a05..a2b9ff1 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -7,10 +7,10 @@
*/
#include "mainwindow.h"
+#include "forms/aboutdialog.h"
#include "ui_mainwindow.h"
#include "widgets/mainwindowmenubar.h"
#include <QMessageBox>
-#include "forms/aboutdialog.h"
#include <QDockWidget>
@@ -26,13 +26,13 @@
#include "forms/searchform.h"
-MainWindow::MainWindow(std::shared_ptr<Configuration> config, QWidget *parent) :
- QMainWindow(parent),
- ui(new Ui::MainWindow),
- tabBar(new MainWindowTabBar(config, this)),
- menuBar(new MainWindowMenuBar(config, this)),
- m_addressBar(new UrlLineEdit(this)),
- m_progressBar(new LoadingBar(this))
+MainWindow::MainWindow(std::shared_ptr<Configuration> config, QWidget *parent)
+ : QMainWindow(parent)
+ , ui(new Ui::MainWindow)
+ , tabBar(new MainWindowTabBar(config, this))
+ , menuBar(new MainWindowMenuBar(config, this))
+ , m_addressBar(new UrlLineEdit(this))
+ , m_progressBar(new LoadingBar(this))
{
Q_ASSERT(config);
m_config = config;
@@ -93,7 +93,7 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> config, QWidget *parent) :
url.replace("$term", t);
tabBar->currentView()->load(QUrl::fromUserInput(url));
});
- connect(tabBar, SIGNAL(currentTabChanged(WebView*)), this, SLOT(handleTabChanged(WebView*)));
+ connect(tabBar, SIGNAL(currentTabChanged(WebView *)), this, SLOT(handleTabChanged(WebView *)));
// loading bar
ui->statusBar->addPermanentWidget(m_progressBar);
@@ -124,7 +124,7 @@ MainWindow::~MainWindow()
{
// Release all dock widgets before deleting so we don't accidentally delete them
// Also fixes that annoying crash when closing
- QList<QDockWidget*> allDockWidgets = findChildren<QDockWidget*>();
+ QList<QDockWidget *> allDockWidgets = findChildren<QDockWidget *>();
for(QDockWidget *w : allDockWidgets) {
if(w->widget()) {
w->widget()->setParent(nullptr);
@@ -137,10 +137,10 @@ MainWindow::~MainWindow()
void MainWindow::addTabbedDock(Qt::DockWidgetArea area, QWidget *widget)
{
// get all dock widgets
- QList<QDockWidget*> allDockWidgets = findChildren<QDockWidget*>();
+ QList<QDockWidget *> allDockWidgets = findChildren<QDockWidget *>();
// make a list of widgets in the area we want
- QVector<QDockWidget*> areaDockWidgets;
+ QVector<QDockWidget *> areaDockWidgets;
for(QDockWidget *w : allDockWidgets) {
if(dockWidgetArea(w) == area) {
areaDockWidgets.append(w);
@@ -176,7 +176,7 @@ void MainWindow::newTab(const QUrl &url)
MainWindow *MainWindow::newWindow(const QUrl &url)
{
- Browser *instance = static_cast<Browser*>(qApp->instance());
+ Browser *instance = static_cast<Browser *>(qApp->instance());
return instance->createSession(m_profile->storageName(), true, QStringList(url.toString()));
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 2e6f510..c62ebe3 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -9,17 +9,18 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include <QMainWindow>
#include "webengine/webengineprofile.h"
-#include <QUrl>
-#include "widgets/mainwindowtabbar.h"
#include "widgets/loadingbar.h"
+#include "widgets/mainwindowtabbar.h"
+#include <QMainWindow>
+#include <QUrl>
#include "lib/navigation/navigationbutton.h"
#include <memory>
-namespace Ui {
+namespace Ui
+{
class MainWindow;
}
diff --git a/src/singleapplication.cpp b/src/singleapplication.cpp
index 4810d73..eb51d0c 100644
--- a/src/singleapplication.cpp
+++ b/src/singleapplication.cpp
@@ -7,11 +7,12 @@
*/
#include "singleapplication.h"
+#include <QDataStream>
#include <QLocalServer>
#include <QLocalSocket>
-#include <QDataStream>
-SingleApplication::SingleApplication(int &argc, char **argv) : QApplication(argc, argv)
+SingleApplication::SingleApplication(int &argc, char **argv)
+ : QApplication(argc, argv)
{
#ifdef Q_OS_UNIX
// could be a path such as "/tmp/foo"
@@ -65,7 +66,6 @@ bool SingleApplication::bindLocalSocket(const QString &name)
}
return true;
}
-
}
QString SingleApplication::serverName() const
diff --git a/src/singleapplication.h b/src/singleapplication.h
index a4ecb2e..8ebea12 100644
--- a/src/singleapplication.h
+++ b/src/singleapplication.h
@@ -17,7 +17,6 @@ class SingleApplication : public QApplication
Q_OBJECT
public:
-
explicit SingleApplication(int &argc, char **argv);
~SingleApplication();
diff --git a/src/webengine/urlinterceptor.cpp b/src/webengine/urlinterceptor.cpp
index b8d30cd..bb9bb5f 100644
--- a/src/webengine/urlinterceptor.cpp
+++ b/src/webengine/urlinterceptor.cpp
@@ -10,8 +10,8 @@
#include <QDir>
#include <QTextStream>
-UrlRequestInterceptor::UrlRequestInterceptor(const QString &path, QObject *parent) :
- QWebEngineUrlRequestInterceptor(parent)
+UrlRequestInterceptor::UrlRequestInterceptor(const QString &path, QObject *parent)
+ : QWebEngineUrlRequestInterceptor(parent)
{
#ifdef QT_DEBUG
qDebug("Reading request blocklist: %s", qUtf8Printable(path));
diff --git a/src/webengine/urlinterceptor.h b/src/webengine/urlinterceptor.h
index af0bf35..24936c3 100644
--- a/src/webengine/urlinterceptor.h
+++ b/src/webengine/urlinterceptor.h
@@ -15,7 +15,6 @@ class UrlRequestInterceptor : public QWebEngineUrlRequestInterceptor
{
Q_OBJECT
public:
-
struct HostRule {
bool isBlocking;
};
@@ -29,7 +28,7 @@ public slots:
int parseHostfile(const QString &filename);
private:
- QHash<QString, HostRule*> m_rules;
+ QHash<QString, HostRule *> m_rules;
};
#endif // URLREQUESTINTERCEPTOR_H
diff --git a/src/webengine/webengineprofile.cpp b/src/webengine/webengineprofile.cpp
index 2d98b3d..78f0b9a 100644
--- a/src/webengine/webengineprofile.cpp
+++ b/src/webengine/webengineprofile.cpp
@@ -7,12 +7,12 @@
*/
#include "webengineprofile.h"
+#include <QFileInfo>
#include <QSettings>
#include <QWebEngineSettings>
-#include <QFileInfo>
-WebEngineProfile::WebEngineProfile(QObject *parent) :
- QWebEngineProfile(parent)
+WebEngineProfile::WebEngineProfile(QObject *parent)
+ : QWebEngineProfile(parent)
{
m_name = tr("Off-the-record");
@@ -23,8 +23,8 @@ WebEngineProfile::WebEngineProfile(QObject *parent) :
// Off-the-record profiles have no persistent path
}
-WebEngineProfile::WebEngineProfile(const QString &name, const QString &path, QObject *parent) :
- QWebEngineProfile(name, parent)
+WebEngineProfile::WebEngineProfile(const QString &name, const QString &path, QObject *parent)
+ : QWebEngineProfile(name, parent)
{
m_name = name;
@@ -78,7 +78,7 @@ void WebEngineProfile::saveProfile()
config.beginGroup("http");
config.setValue("userAgent", httpUserAgent());
config.setValue("accept-lang", httpAcceptLanguage());
- switch (httpCacheType()) {
+ switch(httpCacheType()) {
case MemoryHttpCache:
config.setValue("cacheType", "memory");
break;
@@ -90,10 +90,10 @@ void WebEngineProfile::saveProfile()
break;
}
config.setValue("cacheSize", httpCacheMaximumSize());
- config.endGroup(); // http
+ config.endGroup(); // http
config.beginGroup("policy");
- switch (persistentCookiesPolicy()) {
+ switch(persistentCookiesPolicy()) {
case NoPersistentCookies:
config.setValue("cookies", "disabled");
break;
@@ -104,7 +104,7 @@ void WebEngineProfile::saveProfile()
config.setValue("cookies", "force");
break;
}
- config.endGroup(); // policy
+ config.endGroup(); // policy
QWebEngineSettings *s = settings();
config.beginGroup("attributes");
@@ -133,7 +133,7 @@ void WebEngineProfile::saveProfile()
config.setValue("printElementBackgrounds", s->testAttribute(QWebEngineSettings::PrintElementBackgrounds));
config.setValue("allowRunningInsecureContent", s->testAttribute(QWebEngineSettings::AllowRunningInsecureContent));
#endif
- config.endGroup(); // attributes
+ config.endGroup(); // attributes
config.sync();
}
@@ -170,7 +170,7 @@ WebEngineProfile *createProfile(const QString &name, const QString &path, QObjec
}
}
profile->setHttpCacheMaximumSize(config.value("cacheSize").toInt());
- config.endGroup(); // http
+ config.endGroup(); // http
config.beginGroup("policy");
{
@@ -183,59 +183,59 @@ WebEngineProfile *createProfile(const QString &name, const QString &path, QObjec
profile->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies);
}
}
- config.endGroup(); // policy
+ config.endGroup(); // policy
config.beginGroup("attributes");
QWebEngineSettings *s = profile->settings();
s->setAttribute(QWebEngineSettings::AutoLoadImages,
- config.value("autoLoadImages", s->testAttribute(QWebEngineSettings::AutoLoadImages)).toBool());
+ config.value("autoLoadImages", s->testAttribute(QWebEngineSettings::AutoLoadImages)).toBool());
s->setAttribute(QWebEngineSettings::JavascriptEnabled,
- config.value("javascriptEnabled", s->testAttribute(QWebEngineSettings::JavascriptEnabled)).toBool());
+ config.value("javascriptEnabled", s->testAttribute(QWebEngineSettings::JavascriptEnabled)).toBool());
s->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows,
- config.value("javascriptCanOpenWindows", s->testAttribute(QWebEngineSettings::JavascriptCanOpenWindows)).toBool());
+ config.value("javascriptCanOpenWindows", s->testAttribute(QWebEngineSettings::JavascriptCanOpenWindows)).toBool());
s->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard,
- config.value("javascriptCanAccessClipboard", s->testAttribute(QWebEngineSettings::JavascriptCanAccessClipboard)).toBool());
+ config.value("javascriptCanAccessClipboard", s->testAttribute(QWebEngineSettings::JavascriptCanAccessClipboard)).toBool());
s->setAttribute(QWebEngineSettings::LinksIncludedInFocusChain,
- config.value("linksIncludedInFocusChain", s->testAttribute(QWebEngineSettings::LinksIncludedInFocusChain)).toBool());
+ config.value("linksIncludedInFocusChain", s->testAttribute(QWebEngineSettings::LinksIncludedInFocusChain)).toBool());
s->setAttribute(QWebEngineSettings::LocalStorageEnabled,
- config.value("localStorageEnabled", s->testAttribute(QWebEngineSettings::LocalStorageEnabled)).toBool());
+ config.value("localStorageEnabled", s->testAttribute(QWebEngineSettings::LocalStorageEnabled)).toBool());
s->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls,
- config.value("localContentCanAccessRemoteUrls", s->testAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls)).toBool());
+ config.value("localContentCanAccessRemoteUrls", s->testAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls)).toBool());
s->setAttribute(QWebEngineSettings::XSSAuditingEnabled,
- config.value("xssAuditingEnabled", s->testAttribute(QWebEngineSettings::XSSAuditingEnabled)).toBool());
+ config.value("xssAuditingEnabled", s->testAttribute(QWebEngineSettings::XSSAuditingEnabled)).toBool());
s->setAttribute(QWebEngineSettings::SpatialNavigationEnabled,
- config.value("spatialNavigationEnabled", s->testAttribute(QWebEngineSettings::SpatialNavigationEnabled)).toBool());
+ config.value("spatialNavigationEnabled", s->testAttribute(QWebEngineSettings::SpatialNavigationEnabled)).toBool());
s->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls,
- config.value("localContentCanAccessFileUrls", s->testAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls)).toBool());
+ config.value("localContentCanAccessFileUrls", s->testAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls)).toBool());
s->setAttribute(QWebEngineSettings::HyperlinkAuditingEnabled,
- config.value("hyperlinkAuditingEnabled", s->testAttribute(QWebEngineSettings::HyperlinkAuditingEnabled)).toBool());
+ config.value("hyperlinkAuditingEnabled", s->testAttribute(QWebEngineSettings::HyperlinkAuditingEnabled)).toBool());
s->setAttribute(QWebEngineSettings::ScrollAnimatorEnabled,
- config.value("scrollAnimatorEnabled", s->testAttribute(QWebEngineSettings::ScrollAnimatorEnabled)).toBool());
+ config.value("scrollAnimatorEnabled", s->testAttribute(QWebEngineSettings::ScrollAnimatorEnabled)).toBool());
s->setAttribute(QWebEngineSettings::ErrorPageEnabled,
- config.value("errorPageEnabled", s->testAttribute(QWebEngineSettings::ErrorPageEnabled)).toBool());
+ config.value("errorPageEnabled", s->testAttribute(QWebEngineSettings::ErrorPageEnabled)).toBool());
s->setAttribute(QWebEngineSettings::PluginsEnabled,
- config.value("pluginsEnabled", s->testAttribute(QWebEngineSettings::PluginsEnabled)).toBool());
+ config.value("pluginsEnabled", s->testAttribute(QWebEngineSettings::PluginsEnabled)).toBool());
s->setAttribute(QWebEngineSettings::FullScreenSupportEnabled,
- config.value("fullscreenSupportEnabled", s->testAttribute(QWebEngineSettings::FullScreenSupportEnabled)).toBool());
+ config.value("fullscreenSupportEnabled", s->testAttribute(QWebEngineSettings::FullScreenSupportEnabled)).toBool());
s->setAttribute(QWebEngineSettings::ScreenCaptureEnabled,
- config.value("screenCaptureEnabled", s->testAttribute(QWebEngineSettings::ScreenCaptureEnabled)).toBool());
+ config.value("screenCaptureEnabled", s->testAttribute(QWebEngineSettings::ScreenCaptureEnabled)).toBool());
s->setAttribute(QWebEngineSettings::WebGLEnabled,
- config.value("webglEnabled", s->testAttribute(QWebEngineSettings::WebGLEnabled)).toBool());
+ config.value("webglEnabled", s->testAttribute(QWebEngineSettings::WebGLEnabled)).toBool());
s->setAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled,
- config.value("accelerated2dCanvasEnabled", s->testAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled)).toBool());
+ config.value("accelerated2dCanvasEnabled", s->testAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled)).toBool());
s->setAttribute(QWebEngineSettings::AutoLoadIconsForPage,
- config.value("autoLoadIconsForPage", s->testAttribute(QWebEngineSettings::AutoLoadIconsForPage)).toBool());
+ config.value("autoLoadIconsForPage", s->testAttribute(QWebEngineSettings::AutoLoadIconsForPage)).toBool());
s->setAttribute(QWebEngineSettings::TouchIconsEnabled,
- config.value("touchIconsEnabled", s->testAttribute(QWebEngineSettings::TouchIconsEnabled)).toBool());
+ config.value("touchIconsEnabled", s->testAttribute(QWebEngineSettings::TouchIconsEnabled)).toBool());
#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
s->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled,
- config.value("focusOnNavigationEnabled", s->testAttribute(QWebEngineSettings::FocusOnNavigationEnabled)).toBool());
+ config.value("focusOnNavigationEnabled", s->testAttribute(QWebEngineSettings::FocusOnNavigationEnabled)).toBool());
s->setAttribute(QWebEngineSettings::PrintElementBackgrounds,
- config.value("printElementBackgrounds", s->testAttribute(QWebEngineSettings::PrintElementBackgrounds)).toBool());
+ config.value("printElementBackgrounds", s->testAttribute(QWebEngineSettings::PrintElementBackgrounds)).toBool());
s->setAttribute(QWebEngineSettings::AllowRunningInsecureContent,
- config.value("allowRunningInsecureContent", s->testAttribute(QWebEngineSettings::AllowRunningInsecureContent)).toBool());
+ config.value("allowRunningInsecureContent", s->testAttribute(QWebEngineSettings::AllowRunningInsecureContent)).toBool());
#endif
- config.endGroup(); // attributes
+ config.endGroup(); // attributes
}
#ifdef QT_DEBUG
else {
diff --git a/src/webengine/webengineprofile.h b/src/webengine/webengineprofile.h
index 63a97a4..bcf21bc 100644
--- a/src/webengine/webengineprofile.h
+++ b/src/webengine/webengineprofile.h
@@ -9,8 +9,8 @@
#ifndef WEBENGINEPROFILE_H
#define WEBENGINEPROFILE_H
-#include <QWebEngineProfile>
#include <QUrl>
+#include <QWebEngineProfile>
class WebEngineProfile : public QWebEngineProfile
{
diff --git a/src/webengine/webpage.cpp b/src/webengine/webpage.cpp
index 96ae040..c8ad24b 100644
--- a/src/webengine/webpage.cpp
+++ b/src/webengine/webpage.cpp
@@ -10,8 +10,8 @@
#include <QWebEngineFullScreenRequest>
-WebPage::WebPage(QWebEngineProfile *profile, QObject *parent) :
- QWebEnginePage(profile, parent)
+WebPage::WebPage(QWebEngineProfile *profile, QObject *parent)
+ : QWebEnginePage(profile, parent)
{
connect(this, &WebPage::fullScreenRequested, this, [](QWebEngineFullScreenRequest request) {
request.accept();
diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp
index ee9b134..ea0ee26 100644
--- a/src/webengine/webview.cpp
+++ b/src/webengine/webview.cpp
@@ -13,18 +13,18 @@
#include <QClipboard>
// zoom widget
-#include <QWidgetAction>
-#include <QVBoxLayout>
#include <QLabel>
-#include <QToolButton>
#include <QSlider>
#include <QStyle>
+#include <QToolButton>
+#include <QVBoxLayout>
+#include <QWidgetAction>
// printer support
#include <QFileDialog>
+#include <QPrintDialog>
#include <QPrinter>
#include <QPrinterInfo>
-#include <QPrintDialog>
#include "mainwindow.h"
#include <QStatusBar>
@@ -32,8 +32,8 @@
// ssl errors
#include "lib/navigation/urllineedit.h"
-WebView::WebView(MainWindow *parentMainWindow, QWidget *parent) :
- QWebEngineView(parent)
+WebView::WebView(MainWindow *parentMainWindow, QWidget *parent)
+ : QWebEngineView(parent)
{
Q_CHECK_PTR(parentMainWindow);
m_parent = parentMainWindow;
@@ -140,7 +140,7 @@ void WebView::setPage(WebPage *page)
WebView *WebView::createWindow(QWebEnginePage::WebWindowType type)
{
WebView *view = new WebView(m_parent);
- switch (type) {
+ switch(type) {
case QWebEnginePage::WebBrowserWindow:
// a complete web browser window
m_parent->newWindow()->tabBar->addTab(view);
diff --git a/src/webengine/webview.h b/src/webengine/webview.h
index 9951630..18a1e02 100644
--- a/src/webengine/webview.h
+++ b/src/webengine/webview.h
@@ -9,9 +9,9 @@
#ifndef WEBVIEW_H
#define WEBVIEW_H
-#include <QWebEngineView>
-#include <QMenu>
#include "webpage.h"
+#include <QMenu>
+#include <QWebEngineView>
class MainWindow;
class WebView : public QWebEngineView
diff --git a/src/widgets/loadingbar.cpp b/src/widgets/loadingbar.cpp
index 5dde427..e72c5bb 100644
--- a/src/widgets/loadingbar.cpp
+++ b/src/widgets/loadingbar.cpp
@@ -7,11 +7,11 @@
*/
#include "loadingbar.h"
-#include <QWebEngineView>
#include <QTimer>
+#include <QWebEngineView>
-LoadingBar::LoadingBar(QWidget *parent) :
- QProgressBar(parent)
+LoadingBar::LoadingBar(QWidget *parent)
+ : QProgressBar(parent)
{
setMaximum(100);
}
diff --git a/src/widgets/mainwindowmenubar.cpp b/src/widgets/mainwindowmenubar.cpp
index ada3ad1..c0bea4f 100644
--- a/src/widgets/mainwindowmenubar.cpp
+++ b/src/widgets/mainwindowmenubar.cpp
@@ -7,17 +7,17 @@
*/
#include "mainwindowmenubar.h"
-#include <QApplication>
-#include <QInputDialog>
#include "forms/profileview.h"
#include "mainwindow.h"
+#include <QApplication>
+#include <QInputDialog>
#include <settings/configuration.h>
#include "browser.h"
#include "downloads/downloadswidget.h"
-MainWindowMenuBar::MainWindowMenuBar(std::shared_ptr<Configuration> config, MainWindow *parent) :
- QMenuBar(parent)
+MainWindowMenuBar::MainWindowMenuBar(std::shared_ptr<Configuration> config, MainWindow *parent)
+ : QMenuBar(parent)
{
Q_ASSERT(config);
Q_CHECK_PTR(parent);
@@ -93,5 +93,5 @@ void MainWindowMenuBar::setProfileName(const QString &name)
void MainWindowMenuBar::handleLoadProfile(const QString &name, MainWindow *window)
{
- window->setProfile(static_cast<Browser*>(qApp->instance())->profile(name));
+ window->setProfile(static_cast<Browser *>(qApp->instance())->profile(name));
}
diff --git a/src/widgets/mainwindowtabbar.cpp b/src/widgets/mainwindowtabbar.cpp
index da2cef3..5cf360d 100644
--- a/src/widgets/mainwindowtabbar.cpp
+++ b/src/widgets/mainwindowtabbar.cpp
@@ -8,13 +8,13 @@
#include "mainwindowtabbar.h"
#include <QContextMenuEvent>
-#include <settings/configuration.h>
#include <QShortcut>
+#include <settings/configuration.h>
#include "mainwindow.h"
-MainWindowTabBar::MainWindowTabBar(const std::shared_ptr<Configuration> &config, MainWindow *parent) :
- QTabBar(parent)
+MainWindowTabBar::MainWindowTabBar(const std::shared_ptr<Configuration> &config, MainWindow *parent)
+ : QTabBar(parent)
{
Q_CHECK_PTR(parent);
m_parent = parent;
@@ -37,13 +37,13 @@ MainWindowTabBar::MainWindowTabBar(const std::shared_ptr<Configuration> &config,
QShortcut *tabLeftShortcut = new QShortcut(parent);
tabLeftShortcut->setKey(QKeySequence(QString::fromStdString(config->value<std::string>("browser.shortcuts.tabLeft").value())));
connect(tabLeftShortcut, &QShortcut::activated, [this]() {
- this->setCurrentIndex(currentIndex()-1);
+ this->setCurrentIndex(currentIndex() - 1);
});
QShortcut *tabRightShortcut = new QShortcut(parent);
tabRightShortcut->setKey(QKeySequence(QString::fromStdString(config->value<std::string>("browser.shortcuts.tabRight").value())));
connect(tabRightShortcut, &QShortcut::activated, [this]() {
- this->setCurrentIndex(currentIndex()+1);
+ this->setCurrentIndex(currentIndex() + 1);
});
}
@@ -94,7 +94,7 @@ void MainWindowTabBar::contextMenuEvent(QContextMenuEvent *event)
}
QMenu menu(this);
- QAction* closeAction = menu.addAction(tr("Close tab"));
+ QAction *closeAction = menu.addAction(tr("Close tab"));
connect(closeAction, &QAction::triggered, this, [tabIndex, this]() {
removeTab(tabIndex);
});
diff --git a/src/widgets/mainwindowtabbar.h b/src/widgets/mainwindowtabbar.h
index d0ae9cb..845b908 100644
--- a/src/widgets/mainwindowtabbar.h
+++ b/src/widgets/mainwindowtabbar.h
@@ -9,9 +9,9 @@
#ifndef WEBVIEWTABBAR_H
#define WEBVIEWTABBAR_H
-#include <QTabBar>
-#include "webengine/webview.h"
#include "webengine/webengineprofile.h"
+#include "webengine/webview.h"
+#include <QTabBar>
#include <memory>
class Configuration;
@@ -46,7 +46,7 @@ private slots:
private:
// store all views in a vector since tabs can only store a QVariant, and that can't easily take a pointer
- QVector<WebView*> m_views;
+ QVector<WebView *> m_views;
MainWindow *m_parent;
};
diff --git a/tools/hooks/pre-commit.rb b/tools/hooks/pre-commit.rb
index c224a49..825a851 100755
--- a/tools/hooks/pre-commit.rb
+++ b/tools/hooks/pre-commit.rb
@@ -15,11 +15,5 @@ files.each { |name|
}
}
-puts 'Running astyle...'
-if not `astyle --dry-run --formatted --options=astyle.rc #{files.join(' ')}`.empty? then
- system "astyle --verbose --suffix=none --formatted --options=astyle.rc #{files.join(' ')}"
- result = 1
-end
-
puts "pre-commit exit(#{result})"
exit result