Browse Source

Added .clang-format

Aqua-sama 11 months ago
parent
commit
b984992fc9
Signed by: Aqua-sama <aqua@iserlohn-fortress.net> GPG Key ID: 5378B8349C1D5ADA
50 changed files with 356 additions and 257 deletions
  1. 108
    0
      .clang-format
  2. 0
    4
      astyle.rc
  3. 1
    1
      lib/bookmarks/bookmarkitem.cpp
  4. 5
    3
      lib/bookmarks/bookmarkitem.h
  5. 9
    9
      lib/bookmarks/bookmarksmodel.cpp
  6. 1
    2
      lib/bookmarks/bookmarksmodel.h
  7. 3
    3
      lib/bookmarks/bookmarkswidget.cpp
  8. 5
    5
      lib/bookmarks/bookmarkswidget.h
  9. 0
    1
      lib/bookmarks/xbel.cpp
  10. 1
    1
      lib/bookmarks/xbel.h
  11. 9
    9
      lib/downloads/downloadswidget.cpp
  12. 2
    1
      lib/downloads/downloadswidget.h
  13. 4
    4
      lib/downloads/widgets/downloaditemwidget.cpp
  14. 3
    2
      lib/downloads/widgets/downloaditemwidget.h
  15. 4
    2
      lib/downloads/widgets/elidedlabel.h
  16. 7
    9
      lib/navigation/navigationbutton.cpp
  17. 1
    2
      lib/navigation/navigationbutton.h
  18. 5
    7
      lib/navigation/urllineedit.cpp
  19. 1
    1
      lib/navigation/urllineedit.h
  20. 27
    27
      lib/settings/configuration.cpp
  21. 18
    17
      lib/settings/configuration.h
  22. 7
    7
      lib/settings/settingsdialog.cpp
  23. 2
    1
      lib/settings/settingsdialog.h
  24. 5
    7
      src/browser.cpp
  25. 1
    1
      src/browser.h
  26. 6
    6
      src/forms/aboutdialog.cpp
  27. 2
    1
      src/forms/aboutdialog.h
  28. 4
    5
      src/forms/cookiesform.cpp
  29. 4
    3
      src/forms/cookiesform.h
  30. 8
    8
      src/forms/profileview.cpp
  31. 2
    1
      src/forms/profileview.h
  32. 4
    4
      src/forms/searchform.cpp
  33. 2
    1
      src/forms/searchform.h
  34. 6
    6
      src/main.cpp
  35. 13
    13
      src/mainwindow.cpp
  36. 5
    4
      src/mainwindow.h
  37. 3
    3
      src/singleapplication.cpp
  38. 0
    1
      src/singleapplication.h
  39. 2
    2
      src/webengine/urlinterceptor.cpp
  40. 1
    2
      src/webengine/urlinterceptor.h
  41. 36
    36
      src/webengine/webengineprofile.cpp
  42. 1
    1
      src/webengine/webengineprofile.h
  43. 2
    2
      src/webengine/webpage.cpp
  44. 7
    7
      src/webengine/webview.cpp
  45. 2
    2
      src/webengine/webview.h
  46. 3
    3
      src/widgets/loadingbar.cpp
  47. 5
    5
      src/widgets/mainwindowmenubar.cpp
  48. 6
    6
      src/widgets/mainwindowtabbar.cpp
  49. 3
    3
      src/widgets/mainwindowtabbar.h
  50. 0
    6
      tools/hooks/pre-commit.rb

+ 108
- 0
.clang-format View File

@@ -0,0 +1,108 @@
1
+---
2
+Language:        Cpp
3
+# BasedOnStyle:  WebKit
4
+AccessModifierOffset: -4
5
+AlignAfterOpenBracket: DontAlign
6
+AlignConsecutiveAssignments: false
7
+AlignConsecutiveDeclarations: false
8
+AlignEscapedNewlines: Right
9
+AlignOperands:   false
10
+AlignTrailingComments: false
11
+AllowAllParametersOfDeclarationOnNextLine: true
12
+AllowShortBlocksOnASingleLine: false
13
+AllowShortCaseLabelsOnASingleLine: false
14
+AllowShortFunctionsOnASingleLine: All
15
+AllowShortIfStatementsOnASingleLine: false
16
+AllowShortLoopsOnASingleLine: false
17
+AlwaysBreakAfterDefinitionReturnType: None
18
+AlwaysBreakAfterReturnType: None
19
+AlwaysBreakBeforeMultilineStrings: false
20
+AlwaysBreakTemplateDeclarations: false
21
+BinPackArguments: true
22
+BinPackParameters: true
23
+BraceWrapping:   
24
+  AfterClass:      false
25
+  AfterControlStatement: false
26
+  AfterEnum:       false
27
+  AfterFunction:   true
28
+  AfterNamespace:  false
29
+  AfterObjCDeclaration: false
30
+  AfterStruct:     false
31
+  AfterUnion:      false
32
+  BeforeCatch:     false
33
+  BeforeElse:      false
34
+  IndentBraces:    false
35
+  SplitEmptyFunction: true
36
+  SplitEmptyRecord: true
37
+  SplitEmptyNamespace: true
38
+BreakBeforeBinaryOperators: All
39
+BreakBeforeBraces: Linux
40
+BreakBeforeInheritanceComma: false
41
+BreakBeforeTernaryOperators: true
42
+BreakConstructorInitializersBeforeComma: true
43
+BreakConstructorInitializers: BeforeComma
44
+BreakAfterJavaFieldAnnotations: false
45
+BreakStringLiterals: true
46
+ColumnLimit:     0
47
+CommentPragmas:  '^ IWYU pragma:'
48
+CompactNamespaces: false
49
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
50
+ConstructorInitializerIndentWidth: 4
51
+ContinuationIndentWidth: 4
52
+Cpp11BracedListStyle: false
53
+DerivePointerAlignment: false
54
+DisableFormat:   false
55
+ExperimentalAutoDetectBinPacking: false
56
+FixNamespaceComments: false
57
+ForEachMacros:   
58
+  - foreach
59
+  - Q_FOREACH
60
+  - BOOST_FOREACH
61
+IncludeCategories: 
62
+  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
63
+    Priority:        2
64
+  - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
65
+    Priority:        3
66
+  - Regex:           '.*'
67
+    Priority:        1
68
+IncludeIsMainRegex: '(Test)?$'
69
+IndentCaseLabels: false
70
+IndentWidth:     4
71
+IndentWrappedFunctionNames: false
72
+JavaScriptQuotes: Leave
73
+JavaScriptWrapImports: true
74
+KeepEmptyLinesAtTheStartOfBlocks: true
75
+MacroBlockBegin: ''
76
+MacroBlockEnd:   ''
77
+MaxEmptyLinesToKeep: 1
78
+NamespaceIndentation: Inner
79
+ObjCBlockIndentWidth: 4
80
+ObjCSpaceAfterProperty: true
81
+ObjCSpaceBeforeProtocolList: true
82
+PenaltyBreakAssignment: 2
83
+PenaltyBreakBeforeFirstCallParameter: 19
84
+PenaltyBreakComment: 300
85
+PenaltyBreakFirstLessLess: 120
86
+PenaltyBreakString: 1000
87
+PenaltyExcessCharacter: 1000000
88
+PenaltyReturnTypeOnItsOwnLine: 60
89
+PointerAlignment: Right
90
+ReflowComments:  true
91
+SortIncludes:    true
92
+SortUsingDeclarations: true
93
+SpaceAfterCStyleCast: false
94
+SpaceAfterTemplateKeyword: true
95
+SpaceBeforeAssignmentOperators: true
96
+SpaceBeforeParens: Never
97
+SpaceInEmptyParentheses: false
98
+SpacesBeforeTrailingComments: 1
99
+SpacesInAngles:  false
100
+SpacesInContainerLiterals: false
101
+SpacesInCStyleCastParentheses: false
102
+SpacesInParentheses: false
103
+SpacesInSquareBrackets: false
104
+Standard:        Cpp11
105
+TabWidth:        4
106
+UseTab:          Never
107
+...
108
+

+ 0
- 4
astyle.rc View File

@@ -1,4 +0,0 @@
1
---style=otbs
2
---attach-namespaces
3
---attach-inlines
4
---indent=spaces=4

+ 1
- 1
lib/bookmarks/bookmarkitem.cpp View File

@@ -48,7 +48,7 @@ int BookmarkItem::childCount() const
48 48
 int BookmarkItem::row() const
49 49
 {
50 50
     if(m_parentItem) {
51
-        return m_parentItem->m_childItems.indexOf(const_cast<BookmarkItem*>(this));
51
+        return m_parentItem->m_childItems.indexOf(const_cast<BookmarkItem *>(this));
52 52
     }
53 53
 
54 54
     // no parent item, we are root

+ 5
- 3
lib/bookmarks/bookmarkitem.h View File

@@ -29,10 +29,12 @@ public:
29 29
     int childIndex(BookmarkItem *item) const;
30 30
     int childCount() const;
31 31
 
32
-    BookmarkItemType type() const {
32
+    BookmarkItemType type() const
33
+    {
33 34
         return m_type;
34 35
     };
35
-    int columnCount() const {
36
+    int columnCount() const
37
+    {
36 38
         return 2;
37 39
     };
38 40
 
@@ -47,7 +49,7 @@ public:
47 49
 private:
48 50
     BookmarkItemType m_type;
49 51
     BookmarkItem *m_parentItem;
50
-    QVector<BookmarkItem*> m_childItems;
52
+    QVector<BookmarkItem *> m_childItems;
51 53
 };
52 54
 
53 55
 #endif //BOOKMARKITEM_H

+ 9
- 9
lib/bookmarks/bookmarksmodel.cpp View File

@@ -9,7 +9,8 @@
9 9
 #include "bookmarksmodel.h"
10 10
 #include <QStyle>
11 11
 
12
-BookmarksModel::BookmarksModel(QStyle *style, QObject *parent) : QAbstractItemModel(parent)
12
+BookmarksModel::BookmarksModel(QStyle *style, QObject *parent)
13
+    : QAbstractItemModel(parent)
13 14
 {
14 15
     folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirOpenIcon), QIcon::Normal, QIcon::On);
15 16
     folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirClosedIcon), QIcon::Normal, QIcon::Off);
@@ -62,14 +63,14 @@ QModelIndex BookmarksModel::index(BookmarkItem *node, int column) const
62 63
 QModelIndex BookmarksModel::index(int row, int column, const QModelIndex &parent) const
63 64
 {
64 65
     // invalid item requested
65
-    if (!hasIndex(row, column, parent)) {
66
+    if(!hasIndex(row, column, parent)) {
66 67
         return QModelIndex();
67 68
     }
68 69
 
69 70
     // index exists
70 71
     BookmarkItem *parentItem;
71 72
     if(parent.isValid()) {
72
-        parentItem = static_cast<BookmarkItem*>(parent.internalPointer());
73
+        parentItem = static_cast<BookmarkItem *>(parent.internalPointer());
73 74
     } else {
74 75
         parentItem = m_rootItem;
75 76
     }
@@ -87,7 +88,7 @@ QModelIndex BookmarksModel::parent(const QModelIndex &index) const
87 88
         return QModelIndex();
88 89
     }
89 90
 
90
-    BookmarkItem *childItem = static_cast<BookmarkItem*>(index.internalPointer());
91
+    BookmarkItem *childItem = static_cast<BookmarkItem *>(index.internalPointer());
91 92
     BookmarkItem *parentItem = childItem->parentItem();
92 93
 
93 94
     if(parentItem == m_rootItem) {
@@ -107,7 +108,7 @@ int BookmarksModel::rowCount(const QModelIndex &parent) const
107 108
     if(!parent.isValid()) {
108 109
         parentItem = m_rootItem;
109 110
     } else {
110
-        parentItem = static_cast<BookmarkItem*>(parent.internalPointer());
111
+        parentItem = static_cast<BookmarkItem *>(parent.internalPointer());
111 112
     }
112 113
 
113 114
     return parentItem->childCount();
@@ -116,7 +117,7 @@ int BookmarksModel::rowCount(const QModelIndex &parent) const
116 117
 int BookmarksModel::columnCount(const QModelIndex &parent) const
117 118
 {
118 119
     if(parent.isValid()) {
119
-        return static_cast<BookmarkItem*>(parent.internalPointer())->columnCount();
120
+        return static_cast<BookmarkItem *>(parent.internalPointer())->columnCount();
120 121
     } else {
121 122
         return m_rootItem->columnCount();
122 123
     }
@@ -125,12 +126,12 @@ int BookmarksModel::columnCount(const QModelIndex &parent) const
125 126
 QVariant BookmarksModel::data(const QModelIndex &index, int role) const
126 127
 {
127 128
     // get data of invalid index?
128
-    if (!index.isValid()) {
129
+    if(!index.isValid()) {
129 130
         return QVariant();
130 131
     }
131 132
 
132 133
     const BookmarkItem *item = static_cast<BookmarkItem *>(index.internalPointer());
133
-    switch (role) {
134
+    switch(role) {
134 135
     case Qt::DisplayRole:
135 136
     case Qt::EditRole:
136 137
         if(index.column() == 0) {
@@ -200,6 +201,5 @@ QModelIndexList BookmarksModel::match(const QModelIndex &start, int role, const
200 201
         }
201 202
     }
202 203
 
203
-
204 204
     return list;
205 205
 }

+ 1
- 2
lib/bookmarks/bookmarksmodel.h View File

@@ -6,9 +6,9 @@
6 6
  * SPDX-License-Identifier: GPL-3.0
7 7
  */
8 8
 
9
+#include "bookmarkitem.h"
9 10
 #include <QAbstractItemModel>
10 11
 #include <QIcon>
11
-#include "bookmarkitem.h"
12 12
 
13 13
 #ifndef BOOKMARKSMODEL_H
14 14
 #define BOOKMARKSMODEL_H
@@ -46,7 +46,6 @@ private:
46 46
     QIcon bookmarkIcon;
47 47
 
48 48
     BookmarkItem *m_rootItem;
49
-
50 49
 };
51 50
 
52 51
 #endif //BOOKMARKSMODEL_H

+ 3
- 3
lib/bookmarks/bookmarkswidget.cpp View File

@@ -10,9 +10,9 @@
10 10
 #include "ui_bookmarksform.h"
11 11
 #include <QUrl>
12 12
 
13
-BookmarksWidget::BookmarksWidget(const QString &path, QWidget *parent) :
14
-    QWidget(parent),
15
-    ui(new Ui::BookmarksDialog)
13
+BookmarksWidget::BookmarksWidget(const QString &path, QWidget *parent)
14
+    : QWidget(parent)
15
+    , ui(new Ui::BookmarksDialog)
16 16
 {
17 17
     // make sure this dialog does not get deleted on close
18 18
     setAttribute(Qt::WA_DeleteOnClose, false);

+ 5
- 5
lib/bookmarks/bookmarkswidget.h View File

@@ -9,11 +9,12 @@
9 9
 #ifndef BOOKMARKSDIALOG_H
10 10
 #define BOOKMARKSDIALOG_H
11 11
 
12
-#include <QWidget>
13
-#include "xbel.h"
14 12
 #include "bookmarksmodel.h"
13
+#include "xbel.h"
14
+#include <QWidget>
15 15
 
16
-namespace Ui {
16
+namespace Ui
17
+{
17 18
 class BookmarksDialog;
18 19
 }
19 20
 
@@ -23,7 +24,7 @@ class BookmarksWidget : public QWidget
23 24
 
24 25
 public:
25 26
     explicit BookmarksWidget(const QString &path, QWidget *parent = 0);
26
-    ~BookmarksWidget() override ;
27
+    ~BookmarksWidget() override;
27 28
 
28 29
     void save();
29 30
     QAbstractItemModel *model() const;
@@ -31,7 +32,6 @@ public:
31 32
 signals:
32 33
     void openUrl(const QUrl &url);
33 34
 
34
-
35 35
 private:
36 36
     void expandNodes(BookmarkItem *node);
37 37
 

+ 0
- 1
lib/bookmarks/xbel.cpp View File

@@ -46,7 +46,6 @@ BookmarkItem *Xbel::read()
46 46
     return root;
47 47
 }
48 48
 
49
-
50 49
 void Xbel::readChildElements(QXmlStreamReader &reader, BookmarkItem *parentItem)
51 50
 {
52 51
     while(reader.readNextStartElement()) {

+ 1
- 1
lib/bookmarks/xbel.h View File

@@ -9,9 +9,9 @@
9 9
 #ifndef XBELREADER_H
10 10
 #define XBELREADER_H
11 11
 
12
+#include "bookmarkitem.h"
12 13
 #include <QString>
13 14
 #include <QXmlStreamReader>
14
-#include "bookmarkitem.h"
15 15
 
16 16
 class Xbel
17 17
 {

+ 9
- 9
lib/downloads/downloadswidget.cpp View File

@@ -9,14 +9,14 @@
9 9
 #include "downloadswidget.h"
10 10
 #include "ui_downloadsform.h"
11 11
 
12
-#include <QWebEngineDownloadItem>
12
+#include "widgets/downloaditemwidget.h"
13 13
 #include <QFileDialog>
14 14
 #include <QListWidget>
15
-#include "widgets/downloaditemwidget.h"
15
+#include <QWebEngineDownloadItem>
16 16
 
17
-DownloadsWidget::DownloadsWidget(const QString &downloadPath, QWidget *parent) :
18
-    QDialog(parent),
19
-    ui(new Ui::DownloadDialog)
17
+DownloadsWidget::DownloadsWidget(const QString &downloadPath, QWidget *parent)
18
+    : QDialog(parent)
19
+    , ui(new Ui::DownloadDialog)
20 20
 {
21 21
     // make sure this dialog does not get deleted on close
22 22
     setAttribute(Qt::WA_DeleteOnClose, false);
@@ -27,13 +27,13 @@ DownloadsWidget::DownloadsWidget(const QString &downloadPath, QWidget *parent) :
27 27
     m_downloadPath = downloadPath;
28 28
 
29 29
     connect(ui->listWidget, &QListWidget::currentItemChanged, this, [this](QListWidgetItem *current, QListWidgetItem *previous) {
30
-        DownloadItemWidget *currentWidget = qobject_cast<DownloadItemWidget*>(ui->listWidget->itemWidget(current));
30
+        DownloadItemWidget *currentWidget = qobject_cast<DownloadItemWidget *>(ui->listWidget->itemWidget(current));
31 31
         currentWidget->showDetails();
32 32
         currentWidget->setFixedWidth(ui->listWidget->viewport()->width());
33 33
         currentWidget->adjustSize();
34 34
         current->setSizeHint(currentWidget->size());
35 35
 
36
-        DownloadItemWidget *previousWidget = qobject_cast<DownloadItemWidget*>(ui->listWidget->itemWidget(previous));
36
+        DownloadItemWidget *previousWidget = qobject_cast<DownloadItemWidget *>(ui->listWidget->itemWidget(previous));
37 37
         if(previousWidget != nullptr) {
38 38
             previousWidget->hideDetails();
39 39
             previousWidget->setFixedWidth(ui->listWidget->viewport()->width());
@@ -53,8 +53,8 @@ void DownloadsWidget::addDownload(QWebEngineDownloadItem *item)
53 53
     this->show();
54 54
 
55 55
     QString filepath = QFileDialog::getSaveFileName(this,
56
-                       tr("Save"),
57
-                       m_downloadPath + "/" + QFileInfo(item->path()).fileName());
56
+        tr("Save"),
57
+        m_downloadPath + "/" + QFileInfo(item->path()).fileName());
58 58
 
59 59
     if(filepath.isEmpty()) {
60 60
         // user cancelled the save dialog

+ 2
- 1
lib/downloads/downloadswidget.h View File

@@ -11,7 +11,8 @@
11 11
 
12 12
 #include <QDialog>
13 13
 
14
-namespace Ui {
14
+namespace Ui
15
+{
15 16
 class DownloadDialog;
16 17
 }
17 18
 

+ 4
- 4
lib/downloads/widgets/downloaditemwidget.cpp View File

@@ -11,9 +11,9 @@
11 11
 
12 12
 #include <QUrl>
13 13
 
14
-DownloadItemWidget::DownloadItemWidget(QWebEngineDownloadItem *item, QWidget *parent) :
15
-    QWidget(parent),
16
-    ui(new Ui::DownloadItemForm)
14
+DownloadItemWidget::DownloadItemWidget(QWebEngineDownloadItem *item, QWidget *parent)
15
+    : QWidget(parent)
16
+    , ui(new Ui::DownloadItemForm)
17 17
 {
18 18
     m_item = item;
19 19
 
@@ -68,7 +68,7 @@ QString DownloadItemWidget::sizeString(int size) const
68 68
 
69 69
 void DownloadItemWidget::updateState(QWebEngineDownloadItem::DownloadState state)
70 70
 {
71
-    switch (state) {
71
+    switch(state) {
72 72
     case QWebEngineDownloadItem::DownloadRequested:
73 73
         ui->status_label->setText(tr("Requested"));
74 74
         break;

+ 3
- 2
lib/downloads/widgets/downloaditemwidget.h View File

@@ -9,10 +9,11 @@
9 9
 #ifndef DOWNLOADITEMFORM_H
10 10
 #define DOWNLOADITEMFORM_H
11 11
 
12
-#include <QWidget>
13 12
 #include <QWebEngineDownloadItem>
13
+#include <QWidget>
14 14
 
15
-namespace Ui {
15
+namespace Ui
16
+{
16 17
 class DownloadItemForm;
17 18
 }
18 19
 

+ 4
- 2
lib/downloads/widgets/elidedlabel.h View File

@@ -67,10 +67,12 @@ public:
67 67
     explicit ElidedLabel(QWidget *parent = nullptr);
68 68
 
69 69
     void setContent(const QString &text);
70
-    const QString & text() const {
70
+    const QString &text() const
71
+    {
71 72
         return content;
72 73
     }
73
-    bool isElided() const {
74
+    bool isElided() const
75
+    {
74 76
         return elided;
75 77
     }
76 78
 

+ 7
- 9
lib/navigation/navigationbutton.cpp View File

@@ -11,13 +11,13 @@
11 11
 #include <QStyle>
12 12
 #include <QWebEngineHistory>
13 13
 
14
-NavigationButton::NavigationButton(Type type, QWidget *parent) :
15
-    QToolButton(parent)
14
+NavigationButton::NavigationButton(Type type, QWidget *parent)
15
+    : QToolButton(parent)
16 16
 {
17 17
     m_type = type;
18 18
     menu = new QMenu(this);
19 19
 
20
-    switch (type) {
20
+    switch(type) {
21 21
     case BackButton:
22 22
         setIcon(style()->standardIcon(QStyle::SP_ArrowBack));
23 23
         setMenu(menu);
@@ -37,10 +37,8 @@ NavigationButton::NavigationButton(Type type, QWidget *parent) :
37 37
     }
38 38
 
39 39
     connect(this, &NavigationButton::clicked, this, &NavigationButton::doAction);
40
-
41 40
 }
42 41
 
43
-
44 42
 void NavigationButton::setView(WebView *view)
45 43
 {
46 44
     disconnect(loadStartedConnection);
@@ -57,7 +55,7 @@ void NavigationButton::setView(WebView *view)
57 55
 
58 56
 void NavigationButton::updateOnLoadStarted()
59 57
 {
60
-    switch (m_type) {
58
+    switch(m_type) {
61 59
     case BackButton:
62 60
         break;
63 61
     case ForwardButton:
@@ -73,7 +71,7 @@ void NavigationButton::updateOnLoadStarted()
73 71
 
74 72
 void NavigationButton::updateOnLoadFinished()
75 73
 {
76
-    switch (m_type) {
74
+    switch(m_type) {
77 75
     case BackButton:
78 76
         if(m_view->history()->canGoBack()) {
79 77
             setEnabled(true);
@@ -99,7 +97,7 @@ void NavigationButton::updateOnLoadFinished()
99 97
 
100 98
 void NavigationButton::doAction()
101 99
 {
102
-    switch (m_type) {
100
+    switch(m_type) {
103 101
     case BackButton:
104 102
         m_view->history()->back();
105 103
         break;
@@ -120,7 +118,7 @@ void NavigationButton::prepareMenu()
120 118
     menu->clear();
121 119
 
122 120
     QList<QWebEngineHistoryItem> items;
123
-    switch (m_type) {
121
+    switch(m_type) {
124 122
     case BackButton:
125 123
         items = m_view->history()->backItems(10);
126 124
         break;

+ 1
- 2
lib/navigation/navigationbutton.h View File

@@ -9,8 +9,8 @@
9 9
 #ifndef NAVIGATIONBUTTON_H
10 10
 #define NAVIGATIONBUTTON_H
11 11
 
12
-#include <QToolButton>
13 12
 #include "../../src/webengine/webview.h"
13
+#include <QToolButton>
14 14
 
15 15
 class QMenu;
16 16
 
@@ -18,7 +18,6 @@ class NavigationButton : public QToolButton
18 18
 {
19 19
     Q_OBJECT
20 20
 public:
21
-
22 21
     enum Type {
23 22
         BackButton,
24 23
         ForwardButton,

+ 5
- 7
lib/navigation/urllineedit.cpp View File

@@ -7,9 +7,9 @@
7 7
  */
8 8
 
9 9
 #include "urllineedit.h"
10
-#include <QTimer>
11 10
 #include <QMenu>
12 11
 #include <QStyle>
12
+#include <QTimer>
13 13
 #include <QWidgetAction>
14 14
 
15 15
 // ssl menu
@@ -18,9 +18,9 @@
18 18
 #include <QListView>
19 19
 #include <QStringListModel>
20 20
 
21
-UrlLineEdit::UrlLineEdit(QWidget *parent) :
22
-    QLineEdit(parent),
23
-    m_listView(new QListView(this))
21
+UrlLineEdit::UrlLineEdit(QWidget *parent)
22
+    : QLineEdit(parent)
23
+    , m_listView(new QListView(this))
24 24
 {
25 25
     setPlaceholderText(tr("Enter address"));
26 26
 
@@ -66,7 +66,6 @@ UrlLineEdit::UrlLineEdit(QWidget *parent) :
66 66
         }
67 67
         this->clearFocus();
68 68
     });
69
-
70 69
 }
71 70
 
72 71
 QAction *UrlLineEdit::pageAction()
@@ -145,7 +144,7 @@ void UrlLineEdit::keyPressEvent(QKeyEvent *event)
145 144
         int count = m_listView->model()->rowCount();
146 145
         QModelIndex currentIndex = m_listView->currentIndex();
147 146
 
148
-        switch (key) {
147
+        switch(key) {
149 148
         case Qt::Key_Down:
150 149
             if(currentIndex.row() + 1 >= count) {
151 150
                 m_listView->setCurrentIndex(m_listView->model()->index(0, 0));
@@ -185,7 +184,6 @@ void UrlLineEdit::setTextFormat(const QTextLayout::FormatRange &format)
185 184
     attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat, format.start, format.length, format.format));
186 185
     QInputMethodEvent ev(QString(), attributes);
187 186
     event(&ev);
188
-
189 187
 }
190 188
 
191 189
 void UrlLineEdit::clearTextFormat()

+ 1
- 1
lib/navigation/urllineedit.h View File

@@ -9,9 +9,9 @@
9 9
 #ifndef URLLINEEDIT_H
10 10
 #define URLLINEEDIT_H
11 11
 
12
+#include <QAction>
12 13
 #include <QLineEdit>
13 14
 #include <QTextLayout>
14
-#include <QAction>
15 15
 
16 16
 class QAbstractItemModel;
17 17
 class QMenu;

+ 27
- 27
lib/settings/configuration.cpp View File

@@ -38,19 +38,19 @@ bool Configuration::readUserConfiguration(const std::string &path)
38 38
     m_userCfgPath = path;
39 39
     try {
40 40
         m_userCfg->readFile(path.c_str());
41
-    } catch (FileIOException) {
41
+    } catch(FileIOException) {
42 42
         return false;
43
-    } catch (ParseException) {
43
+    } catch(ParseException) {
44 44
         return false;
45 45
     }
46
-    return  true;
46
+    return true;
47 47
 }
48 48
 
49 49
 bool Configuration::parse(const std::string &contents)
50 50
 {
51 51
     try {
52 52
         m_userCfg->readString(contents);
53
-    } catch (ParseException) {
53
+    } catch(ParseException) {
54 54
         return false;
55 55
     }
56 56
     return true;
@@ -61,7 +61,7 @@ bool Configuration::writeUserConfiguration(const std::string &path)
61 61
     m_userCfgPath = path;
62 62
     try {
63 63
         m_userCfg->writeFile(m_userCfgPath.c_str());
64
-    } catch (FileIOException) {
64
+    } catch(FileIOException) {
65 65
         return false;
66 66
     }
67 67
     return true;
@@ -71,7 +71,7 @@ bool Configuration::writeIfNeeded()
71 71
 {
72 72
     try {
73 73
         m_userCfg->writeFile(m_userCfgPath.c_str());
74
-    } catch (FileIOException) {
74
+    } catch(FileIOException) {
75 75
         return false;
76 76
     }
77 77
     return true;
@@ -81,13 +81,13 @@ bool Configuration::parseDefaultConfiguration(const std::string &contents)
81 81
 {
82 82
     try {
83 83
         m_defaultCfg->readString(contents);
84
-    } catch (ParseException) {
84
+    } catch(ParseException) {
85 85
         return false;
86 86
     }
87 87
     return true;
88 88
 }
89 89
 
90
-std::vector<std::string> Configuration::childrenSettings(const char* name)
90
+std::vector<std::string> Configuration::childrenSettings(const char *name)
91 91
 {
92 92
     std::vector<std::string> groupNames;
93 93
     const Setting &root = m_userCfg->lookup(name);
@@ -101,7 +101,7 @@ std::vector<std::string> Configuration::childrenSettings(const char* name)
101 101
     return groupNames;
102 102
 }
103 103
 
104
-std::vector<std::string> Configuration::childrenGroups(const char* name)
104
+std::vector<std::string> Configuration::childrenGroups(const char *name)
105 105
 {
106 106
     std::vector<std::string> groupNames;
107 107
     const Setting &root = m_userCfg->lookup(name);
@@ -118,7 +118,7 @@ void Configuration::resetValue(const char *path)
118 118
 {
119 119
     if(m_userCfg->exists(path)) {
120 120
         Setting &v = m_userCfg->lookup(path);
121
-        switch (v.getType()) {
121
+        switch(v.getType()) {
122 122
         case Setting::TypeNone:
123 123
             break;
124 124
         case Setting::TypeInt:
@@ -146,8 +146,8 @@ void Configuration::resetValue(const char *path)
146 146
     }
147 147
 }
148 148
 
149
-template<typename T>
150
-std::optional<T> Configuration::value(const char* path) const
149
+template <typename T>
150
+std::optional<T> Configuration::value(const char *path) const
151 151
 {
152 152
     // if setting doesn't exist, give back a nullopt
153 153
     if(!m_userCfg->exists(path)) {
@@ -160,7 +160,7 @@ std::optional<T> Configuration::value(const char* path) const
160 160
 
161 161
     // cast depending on type
162 162
     // type checks are done during compile time
163
-    switch (setting.getType()) {
163
+    switch(setting.getType()) {
164 164
     case Setting::TypeNone:
165 165
         r = std::nullopt;
166 166
         break;
@@ -201,7 +201,7 @@ std::optional<T> Configuration::value(const char* path) const
201 201
     case Setting::TypeString:
202 202
         // const char*, std::string
203 203
         if constexpr(std::is_same<T, std::string>::value) {
204
-            r = std::optional<std::string>(static_cast<const char*>(setting));
204
+            r = std::optional<std::string>(static_cast<const char *>(setting));
205 205
         } else {
206 206
             r = std::nullopt;
207 207
         }
@@ -235,22 +235,22 @@ std::optional<T> Configuration::value(const char* path) const
235 235
 }
236 236
 
237 237
 // tell the compiler to export these functions, otherwise you get linking errors
238
-template std::optional<int> Configuration::value<int>(const char* path) const;
239
-template std::optional<unsigned int> Configuration::value<unsigned int>(const char* path) const;
240
-template std::optional<long> Configuration::value<long>(const char* path) const;
241
-template std::optional<unsigned long> Configuration::value<unsigned long>(const char* path) const;
238
+template std::optional<int> Configuration::value<int>(const char *path) const;
239
+template std::optional<unsigned int> Configuration::value<unsigned int>(const char *path) const;
240
+template std::optional<long> Configuration::value<long>(const char *path) const;
241
+template std::optional<unsigned long> Configuration::value<unsigned long>(const char *path) const;
242 242
 
243
-template std::optional<long long> Configuration::value<long long>(const char* path) const;
244
-template std::optional<unsigned long long> Configuration::value<unsigned long long>(const char* path) const;
243
+template std::optional<long long> Configuration::value<long long>(const char *path) const;
244
+template std::optional<unsigned long long> Configuration::value<unsigned long long>(const char *path) const;
245 245
 
246
-template std::optional<float> Configuration::value<float>(const char* path) const;
247
-template std::optional<double> Configuration::value<double>(const char* path) const;
246
+template std::optional<float> Configuration::value<float>(const char *path) const;
247
+template std::optional<double> Configuration::value<double>(const char *path) const;
248 248
 
249
-template std::optional<bool> Configuration::value<bool>(const char* path) const;
249
+template std::optional<bool> Configuration::value<bool>(const char *path) const;
250 250
 
251
-template std::optional<std::string> Configuration::value<std::string>(const char* path) const;
251
+template std::optional<std::string> Configuration::value<std::string>(const char *path) const;
252 252
 
253
-template<typename T>
253
+template <typename T>
254 254
 bool Configuration::setValue(std::string path, const T &val)
255 255
 {
256 256
     if(m_userCfg->exists(path)) {
@@ -259,7 +259,7 @@ bool Configuration::setValue(std::string path, const T &val)
259 259
         if constexpr(std::is_unsigned_v<T> && !std::is_same_v<T, bool>) {
260 260
             setting = static_cast<typename std::make_signed_t<T>>(val);
261 261
         } else if constexpr(std::is_same_v<T, std::string>) {
262
-            switch (setting.getType()) {
262
+            switch(setting.getType()) {
263 263
             case Setting::TypeNone:
264 264
                 break;
265 265
 
@@ -279,7 +279,7 @@ bool Configuration::setValue(std::string path, const T &val)
279 279
             case Setting::TypeBoolean:
280 280
                 if(static_cast<std::string>(val) == "true") {
281 281
                     setting = true;
282
-                } else if (static_cast<std::string>(val) == "false") {
282
+                } else if(static_cast<std::string>(val) == "false") {
283 283
                     setting = false;
284 284
                 }
285 285
                 break;

+ 18
- 17
lib/settings/configuration.h View File

@@ -10,10 +10,11 @@
10 10
 #define CONFIGURATION_H
11 11
 
12 12
 #include <optional>
13
-#include <vector>
14 13
 #include <string>
14
+#include <vector>
15 15
 
16
-namespace libconfig {
16
+namespace libconfig
17
+{
17 18
 class Config;
18 19
 class Setting;
19 20
 }
@@ -34,12 +35,12 @@ public:
34 35
     std::vector<std::string> childrenSettings(const char *name = "");
35 36
     std::vector<std::string> childrenGroups(const char *name = "");
36 37
 
37
-    void resetValue(const char* path);
38
+    void resetValue(const char *path);
38 39
 
39
-    template<typename T>
40
-    std::optional<T> value(const char* path) const;
40
+    template <typename T>
41
+    std::optional<T> value(const char *path) const;
41 42
 
42
-    template<typename T>
43
+    template <typename T>
43 44
     bool setValue(std::string path, const T &val);
44 45
 
45 46
 private:
@@ -49,26 +50,26 @@ private:
49 50
 };
50 51
 
51 52
 // replace ~ with home
52
-std::string& patchHome(std::string &path, const std::string &home);
53
+std::string &patchHome(std::string &path, const std::string &home);
53 54
 
54 55
 // instantiate functions
55 56
 // this needs to be done because the implementation is in the cpp file
56 57
 
57 58
 // Settings::value<>
58
-extern template std::optional<int> Configuration::value<int>(const char* path) const;
59
-extern template std::optional<unsigned int> Configuration::value<unsigned int>(const char* path) const;
60
-extern template std::optional<long> Configuration::value<long>(const char* path) const;
61
-extern template std::optional<unsigned long> Configuration::value<unsigned long>(const char* path) const;
59
+extern template std::optional<int> Configuration::value<int>(const char *path) const;
60
+extern template std::optional<unsigned int> Configuration::value<unsigned int>(const char *path) const;
61
+extern template std::optional<long> Configuration::value<long>(const char *path) const;
62
+extern template std::optional<unsigned long> Configuration::value<unsigned long>(const char *path) const;
62 63
 
63
-extern template std::optional<long long> Configuration::value<long long>(const char* path) const;
64
-extern template std::optional<unsigned long long> Configuration::value<unsigned long long>(const char* path) const;
64
+extern template std::optional<long long> Configuration::value<long long>(const char *path) const;
65
+extern template std::optional<unsigned long long> Configuration::value<unsigned long long>(const char *path) const;
65 66
 
66
-extern template std::optional<float> Configuration::value<float>(const char* path) const;
67
-extern template std::optional<double> Configuration::value<double>(const char* path) const;
67
+extern template std::optional<float> Configuration::value<float>(const char *path) const;
68
+extern template std::optional<double> Configuration::value<double>(const char *path) const;
68 69
 
69
-extern template std::optional<bool> Configuration::value<bool>(const char* path) const;
70
+extern template std::optional<bool> Configuration::value<bool>(const char *path) const;
70 71
 
71
-extern template std::optional<std::string> Configuration::value<std::string>(const char* path) const;
72
+extern template std::optional<std::string> Configuration::value<std::string>(const char *path) const;
72 73
 
73 74
 // Settings::setValue<>
74 75
 extern template bool Configuration::setValue<int>(std::string path, const int &val);

+ 7
- 7
lib/settings/settingsdialog.cpp View File

@@ -7,19 +7,19 @@
7 7
  */
8 8
 
9 9
 #include "settingsdialog.h"
10
-#include "ui_settingsdialog.h"
11 10
 #include "configuration.h"
12
-#include <QScrollArea>
11
+#include "ui_settingsdialog.h"
13 12
 #include <QFormLayout>
13
+#include <QGroupBox>
14 14
 #include <QLineEdit>
15
+#include <QScrollArea>
15 16
 #include <QToolButton>
16
-#include <QGroupBox>
17 17
 
18 18
 inline QHBoxLayout *createEntry(Configuration *config, const std::string &path, QWidget *widget);
19 19
 
20
-SettingsDialog::SettingsDialog(std::shared_ptr<Configuration> &settings, QWidget *parent) :
21
-    QDialog(parent),
22
-    ui(new Ui::SettingsDialog)
20
+SettingsDialog::SettingsDialog(std::shared_ptr<Configuration> &settings, QWidget *parent)
21
+    : QDialog(parent)
22
+    , ui(new Ui::SettingsDialog)
23 23
 {
24 24
     ui->setupUi(this);
25 25
 
@@ -67,7 +67,7 @@ QWidget *widgetForGroup(std::shared_ptr<Configuration> &settings, const std::str
67 67
     return widget;
68 68
 }
69 69
 
70
-inline QHBoxLayout *createEntry(Configuration* config, const std::string &path, QWidget *widget)
70
+inline QHBoxLayout *createEntry(Configuration *config, const std::string &path, QWidget *widget)
71 71
 {
72 72
     QLineEdit *lineEdit = new QLineEdit(widget);
73 73
     lineEdit->setText(QString::fromStdString(config->value<std::string>(path.c_str()).value()));

+ 2
- 1
lib/settings/settingsdialog.h View File

@@ -12,7 +12,8 @@
12 12
 #include <QDialog>
13 13
 #include <memory>
14 14
 
15
-namespace Ui {
15
+namespace Ui
16
+{
16 17
 class SettingsDialog;
17 18
 }
18 19
 

+ 5
- 7
src/browser.cpp View File

@@ -7,14 +7,14 @@
7 7
  */
8 8
 
9 9
 #include "browser.h"
10
-#include <bookmarks/bookmarkswidget.h>
11
-#include <downloads/downloadswidget.h>
12
-#include "webengine/urlinterceptor.h"
13 10
 #include "mainwindow.h"
11
+#include "webengine/urlinterceptor.h"
14 12
 #include <QDir>
13
+#include <bookmarks/bookmarkswidget.h>
14
+#include <downloads/downloadswidget.h>
15 15
 
16
-Browser::Browser(int &argc, char *argv[]) :
17
-    SingleApplication(argc, argv)
16
+Browser::Browser(int &argc, char *argv[])
17
+    : SingleApplication(argc, argv)
18 18
 {
19 19
     setApplicationName("smolbote");
20 20
     setWindowIcon(QIcon(":/icon.svg"));
@@ -43,7 +43,6 @@ void Browser::setConfiguration(std::shared_ptr<Configuration> &config)
43 43
 
44 44
     // set default profile
45 45
     m_defaultProfile = profile(QString::fromStdString(m_config->value<std::string>("browser.profile").value()));
46
-
47 46
 }
48 47
 
49 48
 MainWindow *Browser::createWindow()
@@ -124,4 +123,3 @@ QStringList Browser::profiles() const
124 123
 {
125 124
     return m_profiles.keys();
126 125
 }
127
-

+ 1
- 1
src/browser.h View File

@@ -9,11 +9,11 @@
9 9
 #ifndef BROWSER_H
10 10
 #define BROWSER_H
11 11
 
12
+#include "settings/configuration.h"
12 13
 #include "singleapplication.h"
13 14
 #include "webengine/webengineprofile.h"
14 15
 #include <QVector>
15 16
 #include <memory>
16
-#include "settings/configuration.h"
17 17
 
18 18
 class MainWindow;
19 19
 class BookmarksWidget;

+ 6
- 6
src/forms/aboutdialog.cpp View File

@@ -12,7 +12,7 @@
12 12
 
13 13
 constexpr const char *getCompiler()
14 14
 {
15
-    // clang also defines __GNUC__, so we need to check for clang first
15
+// clang also defines __GNUC__, so we need to check for clang first
16 16
 #if defined(__clang__)
17 17
     return "Clang " __clang_version__;
18 18
 #elif defined(__GNUC__)
@@ -31,9 +31,9 @@ inline const QString getLongVersion()
31 31
 #endif
32 32
 }
33 33
 
34
-AboutDialog::AboutDialog(QWidget *parent) :
35
-    QDialog(parent),
36
-    ui(new Ui::AboutDialog)
34
+AboutDialog::AboutDialog(QWidget *parent)
35
+    : QDialog(parent)
36
+    , ui(new Ui::AboutDialog)
37 37
 {
38 38
     setAttribute(Qt::WA_DeleteOnClose, true);
39 39
     ui->setupUi(this);
@@ -44,7 +44,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
44 44
     aboutLabel->setWordWrap(true);
45 45
     aboutLabel->setText(tr("<h2>smolbote %1</h2>"
46 46
                            "<p><i>yet another no-frills browser</i></p>")
47
-                        .arg(qApp->applicationVersion()));
47
+                            .arg(qApp->applicationVersion()));
48 48
     ui->toolBox->addItem(aboutLabel, tr("About"));
49 49
 
50 50
     QLabel *licenseLabel = new QLabel(this);
@@ -72,7 +72,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
72 72
                           "<li>Qt %3</li>"
73 73
                           "<li>libconfig</li>"
74 74
                           "</ul></p>")
75
-                       .arg(getLongVersion(), getCompiler(), qVersion()));
75
+                           .arg(getLongVersion(), getCompiler(), qVersion()));
76 76
     ui->toolBox->addItem(libsLabel, tr("Details"));
77 77
 }
78 78
 

+ 2
- 1
src/forms/aboutdialog.h View File

@@ -11,7 +11,8 @@
11 11
 
12 12
 #include <QDialog>
13 13
 
14
-namespace Ui {
14
+namespace Ui
15
+{
15 16
 class AboutDialog;
16 17
 }
17 18
 

+ 4
- 5
src/forms/cookiesform.cpp View File

@@ -11,16 +11,16 @@
11 11
 
12 12
 #include <QDateTime>
13 13
 
14
-CookiesForm::CookiesForm(QWebEngineCookieStore *store, QWidget *parent) :
15
-    QWidget(parent),
16
-    ui(new Ui::CookiesForm)
14
+CookiesForm::CookiesForm(QWebEngineCookieStore *store, QWidget *parent)
15
+    : QWidget(parent)
16
+    , ui(new Ui::CookiesForm)
17 17
 {
18 18
     setAttribute(Qt::WA_DeleteOnClose, false);
19 19
     ui->setupUi(this);
20 20
     ui->treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
21 21
 
22 22
     connect(store, SIGNAL(cookieAdded(QNetworkCookie)), this, SLOT(addCookie(QNetworkCookie)));
23
-    connect(ui->treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(showDetails(QTreeWidgetItem*,QTreeWidgetItem*)));
23
+    connect(ui->treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(showDetails(QTreeWidgetItem *, QTreeWidgetItem *)));
24 24
 }
25 25
 
26 26
 CookiesForm::~CookiesForm()
@@ -57,7 +57,6 @@ void CookiesForm::addCookie(const QNetworkCookie &cookie)
57 57
     item->setData(0, IsSecureRole, cookie.isSecure() ? tr("yes") : tr("no"));
58 58
     item->setData(0, IsSessionCookieRole, cookie.isSessionCookie() ? tr("yes") : tr("no"));
59 59
     item->setData(0, PathRole, cookie.path());
60
-
61 60
 }
62 61
 
63 62
 void CookiesForm::showDetails(QTreeWidgetItem *current, QTreeWidgetItem *previous)

+ 4
- 3
src/forms/cookiesform.h View File

@@ -9,11 +9,12 @@
9 9
 #ifndef COOKIESFORM_H
10 10
 #define COOKIESFORM_H
11 11
 
12
-#include <QWidget>
13
-#include <QWebEngineCookieStore>
14 12
 #include <QTreeWidgetItem>
13
+#include <QWebEngineCookieStore>
14
+#include <QWidget>
15 15
 
16
-namespace Ui {
16
+namespace Ui
17
+{
17 18
 class CookiesForm;
18 19
 }
19 20
 

+ 8
- 8
src/forms/profileview.cpp View File

@@ -9,20 +9,20 @@
9 9
 #include "profileview.h"
10 10
 #include "ui_profileview.h"
11 11
 
12
+#include "forms/cookiesform.h"
13
+#include "webengine/webengineprofile.h"
14
+#include <QComboBox>
12 15
 #include <QLineEdit>
13 16
 #include <QPlainTextEdit>
14
-#include <QComboBox>
15 17
 #include <QPushButton>
16
-#include "webengine/webengineprofile.h"
17
-#include "forms/cookiesform.h"
18 18
 
19 19
 #include <QDialogButtonBox>
20 20
 
21 21
 #include <QFormLayout>
22 22
 
23
-ProfileView::ProfileView(WebEngineProfile *profile, QWidget *parent) :
24
-    QDialog(parent),
25
-    ui(new Ui::ProfileView)
23
+ProfileView::ProfileView(WebEngineProfile *profile, QWidget *parent)
24
+    : QDialog(parent)
25
+    , ui(new Ui::ProfileView)
26 26
 {
27 27
     ui->setupUi(this);
28 28
     setProfile(profile);
@@ -98,7 +98,7 @@ void ProfileView::updateProfile()
98 98
     // http
99 99
     m_profile->setHttpUserAgent(ui->userAgent->toPlainText());
100 100
     m_profile->setHttpAcceptLanguage(ui->acceptLanguage->toPlainText());
101
-    switch (ui->cacheType->currentIndex()) {
101
+    switch(ui->cacheType->currentIndex()) {
102 102
     case 0:
103 103
         m_profile->setHttpCacheType(QWebEngineProfile::MemoryHttpCache);
104 104
         break;
@@ -114,7 +114,7 @@ void ProfileView::updateProfile()
114 114
     m_profile->setHttpCacheMaximumSize(ui->cacheSize->text().toInt());
115 115
 
116 116
     // policy
117
-    switch (ui->cookiePolicy->currentIndex()) {
117
+    switch(ui->cookiePolicy->currentIndex()) {
118 118
     case 0:
119 119
         m_profile->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
120 120
         break;

+ 2
- 1
src/forms/profileview.h View File

@@ -11,7 +11,8 @@
11 11
 
12 12
 #include <QDialog>
13 13
 
14
-namespace Ui {
14
+namespace Ui
15
+{
15 16
 class ProfileView;
16 17
 }
17 18
 

+ 4
- 4
src/forms/searchform.cpp View File

@@ -7,14 +7,14 @@
7 7
  */
8 8
 
9 9
 #include "searchform.h"
10
-#include "ui_searchform.h"
11 10
 #include "../mainwindow.h"
11
+#include "ui_searchform.h"
12 12
 
13 13
 #include <settings/configuration.h>
14 14
 
15
-SearchForm::SearchForm(MainWindow *parentWindow, QWidget *parent) :
16
-    QWidget(parent),
17
-    ui(new Ui::SearchForm)
15
+SearchForm::SearchForm(MainWindow *parentWindow, QWidget *parent)
16
+    : QWidget(parent)
17
+    , ui(new Ui::SearchForm)
18 18
 {
19 19
     Q_CHECK_PTR(parentWindow);
20 20
 

+ 2
- 1
src/forms/searchform.h View File

@@ -11,7 +11,8 @@
11 11
 
12 12
 #include <QWidget>
13 13
 
14
-namespace Ui {
14
+namespace Ui
15
+{
15 16
 class SearchForm;
16 17
 }
17 18
 

+ 6
- 6
src/main.cpp View File

@@ -6,15 +6,15 @@
6 6
  * SPDX-License-Identifier: GPL-3.0
7 7
  */
8 8
 
9
-#include <iostream>
10
-#include "version.h"
11 9
 #include "browser.h"
10
+#include "mainwindow.h"
11
+#include "version.h"
12 12
 #include <QCommandLineParser>
13
+#include <QDir>
13 14
 #include <QFile>
14 15
 #include <QFileInfo>
15
-#include <QDir>
16 16
 #include <QStandardPaths>
17
-#include "mainwindow.h"
17
+#include <iostream>
18 18
 
19 19
 // startup time measuring
20 20
 #ifdef QT_DEBUG
@@ -79,7 +79,7 @@ int main(int argc, char *argv[])
79 79
     parser.addVersionOption();
80 80
 
81 81
     // user config, ~/.config/smolbote/smolbote.cfg or empty if there is none
82
-    QCommandLineOption configOption({"c", "config"}, "Set configuration file.", "path");
82
+    QCommandLineOption configOption({ "c", "config" }, "Set configuration file.", "path");
83 83
     configOption.setDefaultValue(QStandardPaths::locate(QStandardPaths::AppConfigLocation, "smolbote.cfg"));
84 84
     parser.addOption(configOption);
85 85
 
@@ -96,7 +96,7 @@ int main(int argc, char *argv[])
96 96
     QCommandLineOption generateUserConfigOption("generate-user-config", "Generate user configuration and exit.");
97 97
     parser.addOption(generateUserConfigOption);
98 98
 
99
-    QCommandLineOption profileOption({"p", "profile"}, "Use this profile.", "PROFILE");
99
+    QCommandLineOption profileOption({ "p", "profile" }, "Use this profile.", "PROFILE");
100 100
     profileOption.setDefaultValue("");
101 101
     parser.addOption(profileOption);
102 102
 

+ 13
- 13
src/mainwindow.cpp View File

@@ -7,10 +7,10 @@
7 7
  */
8 8
 
9 9
 #include "mainwindow.h"
10
+#include "forms/aboutdialog.h"
10 11
 #include "ui_mainwindow.h"
11 12
 #include "widgets/mainwindowmenubar.h"
12 13
 #include <QMessageBox>
13
-#include "forms/aboutdialog.h"
14 14
 
15 15
 #include <QDockWidget>
16 16
 
@@ -26,13 +26,13 @@
26 26
 
27 27
 #include "forms/searchform.h"
28 28
 
29
-MainWindow::MainWindow(std::shared_ptr<Configuration> config, QWidget *parent) :
30
-    QMainWindow(parent),
31
-    ui(new Ui::MainWindow),
32
-    tabBar(new MainWindowTabBar(config, this)),
33
-    menuBar(new MainWindowMenuBar(config, this)),
34
-    m_addressBar(new UrlLineEdit(this)),
35
-    m_progressBar(new LoadingBar(this))
29
+MainWindow::MainWindow(std::shared_ptr<Configuration> config, QWidget *parent)
30
+    : QMainWindow(parent)
31
+    , ui(new Ui::MainWindow)
32
+    , tabBar(new MainWindowTabBar(config, this))
33
+    , menuBar(new MainWindowMenuBar(config, this))
34
+    , m_addressBar(new UrlLineEdit(this))
35
+    , m_progressBar(new LoadingBar(this))
36 36
 {
37 37
     Q_ASSERT(config);
38 38
     m_config = config;
@@ -93,7 +93,7 @@ MainWindow::MainWindow(std::shared_ptr<Configuration> config, QWidget *parent) :
93 93
         url.replace("$term", t);
94 94
         tabBar->currentView()->load(QUrl::fromUserInput(url));
95 95
     });
96
-    connect(tabBar, SIGNAL(currentTabChanged(WebView*)), this, SLOT(handleTabChanged(WebView*)));
96
+    connect(tabBar, SIGNAL(currentTabChanged(WebView *)), this, SLOT(handleTabChanged(WebView *)));
97 97
 
98 98
     // loading bar
99 99
     ui->statusBar->addPermanentWidget(m_progressBar);
@@ -124,7 +124,7 @@ MainWindow::~MainWindow()
124 124
 {
125 125
     // Release all dock widgets before deleting so we don't accidentally delete them
126 126
     // Also fixes that annoying crash when closing
127
-    QList<QDockWidget*> allDockWidgets = findChildren<QDockWidget*>();
127
+    QList<QDockWidget *> allDockWidgets = findChildren<QDockWidget *>();
128 128
     for(QDockWidget *w : allDockWidgets) {
129 129
         if(w->widget()) {
130 130
             w->widget()->setParent(nullptr);
@@ -137,10 +137,10 @@ MainWindow::~MainWindow()
137 137
 void MainWindow::addTabbedDock(Qt::DockWidgetArea area, QWidget *widget)
138 138
 {
139 139
     // get all dock widgets
140
-    QList<QDockWidget*> allDockWidgets = findChildren<QDockWidget*>();
140
+    QList<QDockWidget *> allDockWidgets = findChildren<QDockWidget *>();
141 141
 
142 142
     // make a list of widgets in the area we want
143
-    QVector<QDockWidget*> areaDockWidgets;
143
+    QVector<QDockWidget *> areaDockWidgets;
144 144
     for(QDockWidget *w : allDockWidgets) {
145 145
         if(dockWidgetArea(w) == area) {
146 146
             areaDockWidgets.append(w);
@@ -176,7 +176,7 @@ void MainWindow::newTab(const QUrl &url)
176 176
 
177 177
 MainWindow *MainWindow::newWindow(const QUrl &url)
178 178
 {
179
-    Browser *instance = static_cast<Browser*>(qApp->instance());
179
+    Browser *instance = static_cast<Browser *>(qApp->instance());
180 180
     return instance->createSession(m_profile->storageName(), true, QStringList(url.toString()));
181 181
 }
182 182
 

+ 5
- 4
src/mainwindow.h View File

@@ -9,17 +9,18 @@
9 9
 #ifndef MAINWINDOW_H
10 10
 #define MAINWINDOW_H
11 11
 
12
-#include <QMainWindow>
13 12
 #include "webengine/webengineprofile.h"
14
-#include <QUrl>
15
-#include "widgets/mainwindowtabbar.h"
16 13
 #include "widgets/loadingbar.h"
14
+#include "widgets/mainwindowtabbar.h"
15
+#include <QMainWindow>
16
+#include <QUrl>
17 17
 
18 18
 #include "lib/navigation/navigationbutton.h"
19 19
 
20 20
 #include <memory>
21 21
 
22
-namespace Ui {
22
+namespace Ui
23
+{
23 24
 class MainWindow;
24 25
 }
25 26
 

+ 3
- 3
src/singleapplication.cpp View File

@@ -7,11 +7,12 @@
7 7
  */
8 8
 
9 9
 #include "singleapplication.h"
10
+#include <QDataStream>
10 11
 #include <QLocalServer>
11 12
 #include <QLocalSocket>
12
-#include <QDataStream>
13 13
 
14
-SingleApplication::SingleApplication(int &argc, char **argv) : QApplication(argc, argv)
14
+SingleApplication::SingleApplication(int &argc, char **argv)
15
+    : QApplication(argc, argv)
15 16
 {
16 17
 #ifdef Q_OS_UNIX
17 18
     // could be a path such as "/tmp/foo"
@@ -65,7 +66,6 @@ bool SingleApplication::bindLocalSocket(const QString &name)
65 66
         }
66 67
         return true;
67 68
     }
68
-
69 69
 }
70 70
 
71 71
 QString SingleApplication::serverName() const

+ 0
- 1
src/singleapplication.h View File

@@ -17,7 +17,6 @@ class SingleApplication : public QApplication
17 17
     Q_OBJECT
18 18
 
19 19
 public:
20
-
21 20
     explicit SingleApplication(int &argc, char **argv);
22 21
     ~SingleApplication();
23 22
 

+ 2
- 2
src/webengine/urlinterceptor.cpp View File

@@ -10,8 +10,8 @@
10 10
 #include <QDir>
11 11
 #include <QTextStream>
12 12
 
13
-UrlRequestInterceptor::UrlRequestInterceptor(const QString &path, QObject *parent) :
14
-    QWebEngineUrlRequestInterceptor(parent)
13
+UrlRequestInterceptor::UrlRequestInterceptor(const QString &path, QObject *parent)
14
+    : QWebEngineUrlRequestInterceptor(parent)
15 15
 {
16 16
 #ifdef QT_DEBUG
17 17
     qDebug("Reading request blocklist: %s", qUtf8Printable(path));

+ 1
- 2
src/webengine/urlinterceptor.h View File

@@ -15,7 +15,6 @@ class UrlRequestInterceptor : public QWebEngineUrlRequestInterceptor
15 15
 {
16 16
     Q_OBJECT
17 17
 public:
18
-
19 18
     struct HostRule {
20 19
         bool isBlocking;
21 20
     };
@@ -29,7 +28,7 @@ public slots:
29 28
     int parseHostfile(const QString &filename);
30 29
 
31 30
 private:
32
-    QHash<QString, HostRule*> m_rules;
31
+    QHash<QString, HostRule *> m_rules;
33 32
 };
34 33
 
35 34
 #endif // URLREQUESTINTERCEPTOR_H

+ 36
- 36
src/webengine/webengineprofile.cpp View File

@@ -7,12 +7,12 @@
7 7
  */
8 8
 
9 9
 #include "webengineprofile.h"
10
+#include <QFileInfo>
10 11
 #include <QSettings>
11 12
 #include <QWebEngineSettings>
12
-#include <QFileInfo>
13 13
 
14
-WebEngineProfile::WebEngineProfile(QObject *parent) :
15
-    QWebEngineProfile(parent)
14
+WebEngineProfile::WebEngineProfile(QObject *parent)
15
+    : QWebEngineProfile(parent)
16 16
 {
17 17
     m_name = tr("Off-the-record");
18 18
 
@@ -23,8 +23,8 @@ WebEngineProfile::WebEngineProfile(QObject *parent) :
23 23
     // Off-the-record profiles have no persistent path
24 24
 }
25 25
 
26
-WebEngineProfile::WebEngineProfile(const QString &name, const QString &path, QObject *parent) :
27
-    QWebEngineProfile(name, parent)
26
+WebEngineProfile::WebEngineProfile(const QString &name, const QString &path, QObject *parent)
27
+    : QWebEngineProfile(name, parent)
28 28
 {
29 29
     m_name = name;
30 30
 
@@ -78,7 +78,7 @@ void WebEngineProfile::saveProfile()
78 78
     config.beginGroup("http");
79 79
     config.setValue("userAgent", httpUserAgent());
80 80
     config.setValue("accept-lang", httpAcceptLanguage());
81
-    switch (httpCacheType()) {
81
+    switch(httpCacheType()) {
82 82
     case MemoryHttpCache:
83 83
         config.setValue("cacheType", "memory");
84 84
         break;
@@ -90,10 +90,10 @@ void WebEngineProfile::saveProfile()
90 90
         break;
91 91
     }
92 92
     config.setValue("cacheSize", httpCacheMaximumSize());
93
-    config.endGroup();  // http
93
+    config.endGroup(); // http
94 94
 
95 95
     config.beginGroup("policy");
96
-    switch (persistentCookiesPolicy()) {
96
+    switch(persistentCookiesPolicy()) {
97 97
     case NoPersistentCookies:
98 98
         config.setValue("cookies", "disabled");
99 99
         break;
@@ -104,7 +104,7 @@ void WebEngineProfile::saveProfile()
104 104
         config.setValue("cookies", "force");
105 105
         break;
106 106
     }
107
-    config.endGroup();  // policy
107
+    config.endGroup(); // policy
108 108
 
109 109
     QWebEngineSettings *s = settings();
110 110
     config.beginGroup("attributes");
@@ -133,7 +133,7 @@ void WebEngineProfile::saveProfile()
133 133
     config.setValue("printElementBackgrounds", s->testAttribute(QWebEngineSettings::PrintElementBackgrounds));
134 134
     config.setValue("allowRunningInsecureContent", s->testAttribute(QWebEngineSettings::AllowRunningInsecureContent));
135 135
 #endif
136
-    config.endGroup();  // attributes
136
+    config.endGroup(); // attributes
137 137
 
138 138
     config.sync();
139 139
 }
@@ -170,7 +170,7 @@ WebEngineProfile *createProfile(const QString &name, const QString &path, QObjec
170 170
             }
171 171
         }
172 172
         profile->setHttpCacheMaximumSize(config.value("cacheSize").toInt());
173
-        config.endGroup();  // http
173
+        config.endGroup(); // http
174 174
 
175 175
         config.beginGroup("policy");
176 176
         {
@@ -183,59 +183,59 @@ WebEngineProfile *createProfile(const QString &name, const QString &path, QObjec
183 183
                 profile->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies);
184 184
             }
185 185
         }
186
-        config.endGroup();  // policy
186
+        config.endGroup(); // policy
187 187
 
188 188
         config.beginGroup("attributes");
189 189
         QWebEngineSettings *s = profile->settings();
190 190
         s->setAttribute(QWebEngineSettings::AutoLoadImages,
191
-                        config.value("autoLoadImages", s->testAttribute(QWebEngineSettings::AutoLoadImages)).toBool());
191
+            config.value("autoLoadImages", s->testAttribute(QWebEngineSettings::AutoLoadImages)).toBool());
192 192
         s->setAttribute(QWebEngineSettings::JavascriptEnabled,
193
-                        config.value("javascriptEnabled", s->testAttribute(QWebEngineSettings::JavascriptEnabled)).toBool());
193
+            config.value("javascriptEnabled", s->testAttribute(QWebEngineSettings::JavascriptEnabled)).toBool());
194 194
         s->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows,
195
-                        config.value("javascriptCanOpenWindows", s->testAttribute(QWebEngineSettings::JavascriptCanOpenWindows)).toBool());
195
+            config.value("javascriptCanOpenWindows", s->testAttribute(QWebEngineSettings::JavascriptCanOpenWindows)).toBool());
196 196
         s->setAttribute(QWebEngineSettings::JavascriptCanAccessClipboard,
197
-                        config.value("javascriptCanAccessClipboard", s->testAttribute(QWebEngineSettings::JavascriptCanAccessClipboard)).toBool());
197
+            config.value("javascriptCanAccessClipboard", s->testAttribute(QWebEngineSettings::JavascriptCanAccessClipboard)).toBool());
198 198
         s->setAttribute(QWebEngineSettings::LinksIncludedInFocusChain,
199
-                        config.value("linksIncludedInFocusChain", s->testAttribute(QWebEngineSettings::LinksIncludedInFocusChain)).toBool());
199
+            config.value("linksIncludedInFocusChain", s->testAttribute(QWebEngineSettings::LinksIncludedInFocusChain)).toBool());
200 200
         s->setAttribute(QWebEngineSettings::LocalStorageEnabled,
201
-                        config.value("localStorageEnabled", s->testAttribute(QWebEngineSettings::LocalStorageEnabled)).toBool());
201
+            config.value("localStorageEnabled", s->testAttribute(QWebEngineSettings::LocalStorageEnabled)).toBool());
202 202
         s->setAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls,
203
-                        config.value("localContentCanAccessRemoteUrls", s->testAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls)).toBool());
203
+            config.value("localContentCanAccessRemoteUrls", s->testAttribute(QWebEngineSettings::LocalContentCanAccessRemoteUrls)).toBool());
204 204
         s->setAttribute(QWebEngineSettings::XSSAuditingEnabled,
205
-                        config.value("xssAuditingEnabled", s->testAttribute(QWebEngineSettings::XSSAuditingEnabled)).toBool());
205
+            config.value("xssAuditingEnabled", s->testAttribute(QWebEngineSettings::XSSAuditingEnabled)).toBool());
206 206
         s->setAttribute(QWebEngineSettings::SpatialNavigationEnabled,
207
-                        config.value("spatialNavigationEnabled", s->testAttribute(QWebEngineSettings::SpatialNavigationEnabled)).toBool());
207
+            config.value("spatialNavigationEnabled", s->testAttribute(QWebEngineSettings::SpatialNavigationEnabled)).toBool());
208 208
         s->setAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls,
209
-                        config.value("localContentCanAccessFileUrls", s->testAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls)).toBool());
209
+            config.value("localContentCanAccessFileUrls", s->testAttribute(QWebEngineSettings::LocalContentCanAccessFileUrls)).toBool());
210 210
         s->setAttribute(QWebEngineSettings::HyperlinkAuditingEnabled,
211
-                        config.value("hyperlinkAuditingEnabled", s->testAttribute(QWebEngineSettings::HyperlinkAuditingEnabled)).toBool());
211
+            config.value("hyperlinkAuditingEnabled", s->testAttribute(QWebEngineSettings::HyperlinkAuditingEnabled)).toBool());
212 212
         s->setAttribute(QWebEngineSettings::ScrollAnimatorEnabled,
213
-                        config.value("scrollAnimatorEnabled", s->testAttribute(QWebEngineSettings::ScrollAnimatorEnabled)).toBool());
213
+            config.value("scrollAnimatorEnabled", s->testAttribute(QWebEngineSettings::ScrollAnimatorEnabled)).toBool());
214 214
         s->setAttribute(QWebEngineSettings::ErrorPageEnabled,
215
-                        config.value("errorPageEnabled", s->testAttribute(QWebEngineSettings::ErrorPageEnabled)).toBool());
215
+            config.value("errorPageEnabled", s->testAttribute(QWebEngineSettings::ErrorPageEnabled)).toBool());
216 216
         s->setAttribute(QWebEngineSettings::PluginsEnabled,
217
-                        config.value("pluginsEnabled", s->testAttribute(QWebEngineSettings::PluginsEnabled)).toBool());
217
+            config.value("pluginsEnabled", s->testAttribute(QWebEngineSettings::PluginsEnabled)).toBool());
218 218
         s->setAttribute(QWebEngineSettings::FullScreenSupportEnabled,
219
-                        config.value("fullscreenSupportEnabled", s->testAttribute(QWebEngineSettings::FullScreenSupportEnabled)).toBool());
219
+            config.value("fullscreenSupportEnabled", s->testAttribute(QWebEngineSettings::FullScreenSupportEnabled)).toBool());
220 220
         s->setAttribute(QWebEngineSettings::ScreenCaptureEnabled,
221
-                        config.value("screenCaptureEnabled", s->testAttribute(QWebEngineSettings::ScreenCaptureEnabled)).toBool());
221
+            config.value("screenCaptureEnabled", s->testAttribute(QWebEngineSettings::ScreenCaptureEnabled)).toBool());
222 222
         s->setAttribute(QWebEngineSettings::WebGLEnabled,
223
-                        config.value("webglEnabled", s->testAttribute(QWebEngineSettings::WebGLEnabled)).toBool());
223
+            config.value("webglEnabled", s->testAttribute(QWebEngineSettings::WebGLEnabled)).toBool());
224 224
         s->setAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled,
225
-                        config.value("accelerated2dCanvasEnabled", s->testAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled)).toBool());
225
+            config.value("accelerated2dCanvasEnabled", s->testAttribute(QWebEngineSettings::Accelerated2dCanvasEnabled)).toBool());
226 226
         s->setAttribute(QWebEngineSettings::AutoLoadIconsForPage,
227
-                        config.value("autoLoadIconsForPage", s->testAttribute(QWebEngineSettings::AutoLoadIconsForPage)).toBool());
227
+            config.value("autoLoadIconsForPage", s->testAttribute(QWebEngineSettings::AutoLoadIconsForPage)).toBool());
228 228
         s->setAttribute(QWebEngineSettings::TouchIconsEnabled,
229
-                        config.value("touchIconsEnabled", s->testAttribute(QWebEngineSettings::TouchIconsEnabled)).toBool());
229
+            config.value("touchIconsEnabled", s->testAttribute(QWebEngineSettings::TouchIconsEnabled)).toBool());
230 230
 #if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0)
231 231
         s->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled,
232
-                        config.value("focusOnNavigationEnabled", s->testAttribute(QWebEngineSettings::FocusOnNavigationEnabled)).toBool());
232
+            config.value("focusOnNavigationEnabled", s->testAttribute(QWebEngineSettings::FocusOnNavigationEnabled)).toBool());
233 233
         s->setAttribute(QWebEngineSettings::PrintElementBackgrounds,
234
-                        config.value("printElementBackgrounds", s->testAttribute(QWebEngineSettings::PrintElementBackgrounds)).toBool());
234
+            config.value("printElementBackgrounds", s->testAttribute(QWebEngineSettings::PrintElementBackgrounds)).toBool());
235 235
         s->setAttribute(QWebEngineSettings::AllowRunningInsecureContent,
236
-                        config.value("allowRunningInsecureContent", s->testAttribute(QWebEngineSettings::AllowRunningInsecureContent)).toBool());
236
+            config.value("allowRunningInsecureContent", s->testAttribute(QWebEngineSettings::AllowRunningInsecureContent)).toBool());
237 237
 #endif
238
-        config.endGroup();  // attributes
238
+        config.endGroup(); // attributes
239 239
     }
240 240
 #ifdef QT_DEBUG
241 241
     else {

+ 1
- 1
src/webengine/webengineprofile.h View File

@@ -9,8 +9,8 @@
9 9
 #ifndef WEBENGINEPROFILE_H
10 10
 #define WEBENGINEPROFILE_H
11 11
 
12
-#include <QWebEngineProfile>
13 12
 #include <QUrl>
13
+#include <QWebEngineProfile>
14 14
 
15 15
 class WebEngineProfile : public QWebEngineProfile
16 16
 {

+ 2
- 2
src/webengine/webpage.cpp View File

@@ -10,8 +10,8 @@
10 10
 
11 11
 #include <QWebEngineFullScreenRequest>
12 12
 
13
-WebPage::WebPage(QWebEngineProfile *profile, QObject *parent) :
14
-    QWebEnginePage(profile, parent)
13
+WebPage::WebPage(QWebEngineProfile *profile, QObject *parent)
14
+    : QWebEnginePage(profile, parent)
15 15
 {
16 16
     connect(this, &WebPage::fullScreenRequested, this, [](QWebEngineFullScreenRequest request) {
17 17
         request.accept();

+ 7
- 7
src/webengine/webview.cpp View File

@@ -13,18 +13,18 @@
13 13
 #include <QClipboard>
14 14
 
15 15
 // zoom widget
16
-#include <QWidgetAction>
17
-#include <QVBoxLayout>
18 16
 #include <QLabel>
19
-#include <QToolButton>
20 17
 #include <QSlider>
21 18
 #include <QStyle>
19
+#include <QToolButton>
20
+#include <QVBoxLayout>
21
+#include <QWidgetAction>
22 22
 
23 23
 // printer support
24 24
 #include <QFileDialog>
25
+#include <QPrintDialog>
25 26
 #include <QPrinter>
26 27
 #include <QPrinterInfo>
27
-#include <QPrintDialog>
28 28
 
29 29
 #include "mainwindow.h"
30 30
 #include <QStatusBar>
@@ -32,8 +32,8 @@
32 32
 // ssl errors
33 33
 #include "lib/navigation/urllineedit.h"
34 34
 
35
-WebView::WebView(MainWindow *parentMainWindow, QWidget *parent) :
36
-    QWebEngineView(parent)
35
+WebView::WebView(MainWindow *parentMainWindow, QWidget *parent)
36
+    : QWebEngineView(parent)
37 37
 {
38 38
     Q_CHECK_PTR(parentMainWindow);
39 39
     m_parent = parentMainWindow;
@@ -140,7 +140,7 @@ void WebView::setPage(WebPage *page)
140 140
 WebView *WebView::createWindow(QWebEnginePage::WebWindowType type)
141 141
 {
142 142
     WebView *view = new WebView(m_parent);
143
-    switch (type) {
143
+    switch(type) {
144 144
     case QWebEnginePage::WebBrowserWindow:
145 145
         // a complete web browser window
146 146
         m_parent->newWindow()->tabBar->addTab(view);

+ 2
- 2
src/webengine/webview.h View File

@@ -9,9 +9,9 @@
9 9
 #ifndef WEBVIEW_H
10 10
 #define WEBVIEW_H
11 11
 
12
-#include <QWebEngineView>
13
-#include <QMenu>
14 12
 #include "webpage.h"
13
+#include <QMenu>
14
+#include <QWebEngineView>
15 15
 
16 16
 class MainWindow;
17 17
 class WebView : public QWebEngineView

+ 3
- 3
src/widgets/loadingbar.cpp View File

@@ -7,11 +7,11 @@
7 7
  */
8 8
 
9 9
 #include "loadingbar.h"
10
-#include <QWebEngineView>
11 10
 #include <QTimer>
11
+#include <QWebEngineView>
12 12
 
13
-LoadingBar::LoadingBar(QWidget *parent) :
14
-    QProgressBar(parent)
13
+LoadingBar::LoadingBar(QWidget *parent)
14
+    : QProgressBar(parent)
15 15
 {
16 16
     setMaximum(100);
17 17
 }

+ 5
- 5
src/widgets/mainwindowmenubar.cpp View File

@@ -7,17 +7,17 @@
7 7
  */
8 8
 
9 9
 #include "mainwindowmenubar.h"
10
-#include <QApplication>
11
-#include <QInputDialog>
12 10
 #include "forms/profileview.h"
13 11
 #include "mainwindow.h"
12
+#include <QApplication>
13
+#include <QInputDialog>
14 14
 #include <settings/configuration.h>
15 15
 
16 16
 #include "browser.h"
17 17
 #include "downloads/downloadswidget.h"
18 18
 
19
-MainWindowMenuBar::MainWindowMenuBar(std::shared_ptr<Configuration> config, MainWindow *parent) :
20
-    QMenuBar(parent)
19
+MainWindowMenuBar::MainWindowMenuBar(std::shared_ptr<Configuration> config, MainWindow *parent)
20
+    : QMenuBar(parent)
21 21
 {
22 22
     Q_ASSERT(config);
23 23
     Q_CHECK_PTR(parent);
@@ -93,5 +93,5 @@ void MainWindowMenuBar::setProfileName(const QString &name)
93 93
 
94 94
 void MainWindowMenuBar::handleLoadProfile(const QString &name, MainWindow *window)
95 95
 {
96
-    window->setProfile(static_cast<Browser*>(qApp->instance())->profile(name));
96
+    window->setProfile(static_cast<Browser *>(qApp->instance())->profile(name));
97 97
 }

+ 6
- 6
src/widgets/mainwindowtabbar.cpp View File

@@ -8,13 +8,13 @@
8 8
 
9 9
 #include "mainwindowtabbar.h"
10 10
 #include <QContextMenuEvent>
11
-#include <settings/configuration.h>
12 11
 #include <QShortcut>
12
+#include <settings/configuration.h>
13 13
 
14 14
 #include "mainwindow.h"
15 15
 
16
-MainWindowTabBar::MainWindowTabBar(const std::shared_ptr<Configuration> &config, MainWindow *parent) :
17
-    QTabBar(parent)
16
+MainWindowTabBar::MainWindowTabBar(const std::shared_ptr<Configuration> &config, MainWindow *parent)
17
+    : QTabBar(parent)
18 18
 {
19 19
     Q_CHECK_PTR(parent);
20 20
     m_parent = parent;
@@ -37,13 +37,13 @@ MainWindowTabBar::MainWindowTabBar(const std::shared_ptr<Configuration> &config,
37 37
     QShortcut *tabLeftShortcut = new QShortcut(parent);
38 38
     tabLeftShortcut->setKey(QKeySequence(QString::fromStdString(config->value<std::string>("browser.shortcuts.tabLeft").value())));
39 39
     connect(tabLeftShortcut, &QShortcut::activated, [this]() {
40
-        this->setCurrentIndex(currentIndex()-1);
40
+        this->setCurrentIndex(currentIndex() - 1);
41 41
     });
42 42
 
43 43
     QShortcut *tabRightShortcut = new QShortcut(parent);
44 44
     tabRightShortcut->setKey(QKeySequence(QString::fromStdString(config->value<std::string>("browser.shortcuts.tabRight").value())));
45 45
     connect(tabRightShortcut, &QShortcut::activated, [this]() {
46
-        this->setCurrentIndex(currentIndex()+1);
46
+        this->setCurrentIndex(currentIndex() + 1);
47 47
     });
48 48
 }
49 49
 
@@ -94,7 +94,7 @@ void MainWindowTabBar::contextMenuEvent(QContextMenuEvent *event)
94 94
     }
95 95
 
96 96
     QMenu menu(this);
97
-    QAction* closeAction = menu.addAction(tr("Close tab"));
97
+    QAction *closeAction = menu.addAction(tr("Close tab"));
98 98
     connect(closeAction, &QAction::triggered, this, [tabIndex, this]() {
99 99
         removeTab(tabIndex);
100 100
     });

+ 3
- 3
src/widgets/mainwindowtabbar.h View File

@@ -9,9 +9,9 @@
9 9
 #ifndef WEBVIEWTABBAR_H
10 10
 #define WEBVIEWTABBAR_H
11 11
 
12
-#include <QTabBar>
13
-#include "webengine/webview.h"
14 12
 #include "webengine/webengineprofile.h"
13
+#include "webengine/webview.h"
14
+#include <QTabBar>
15 15
 #include <memory>
16 16
 
17 17
 class Configuration;
@@ -46,7 +46,7 @@ private slots:
46 46
 
47 47
 private:
48 48
     // store all views in a vector since tabs can only store a QVariant, and that can't easily take a pointer
49
-    QVector<WebView*> m_views;
49
+    QVector<WebView *> m_views;
50 50
     MainWindow *m_parent;
51 51
 };
52 52
 

+ 0
- 6
tools/hooks/pre-commit.rb View File

@@ -15,11 +15,5 @@ files.each { |name|
15 15
     }
16 16
 }
17 17
 
18
-puts 'Running astyle...'
19
-if not `astyle --dry-run --formatted --options=astyle.rc #{files.join(' ')}`.empty? then
20
-    system "astyle --verbose --suffix=none --formatted --options=astyle.rc #{files.join(' ')}"
21
-    result = 1
22
-end
23
-
24 18
 puts "pre-commit exit(#{result})"
25 19
 exit result

Loading…
Cancel
Save