]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/commitdiff
Create a home icon.
authorSoren Stoutner <soren@stoutner.com>
Mon, 31 Jan 2022 23:41:10 +0000 (16:41 -0700)
committerSoren Stoutner <soren@stoutner.com>
Mon, 31 Jan 2022 23:41:10 +0000 (16:41 -0700)
src/mainview.cpp
src/mainview.h
src/mainview.ui

index 8749760773e6acdd9540a236855ad761d805a6e2..25f3b4c5ea0d1b6f39de2439abea2bff200d58f3 100644 (file)
@@ -41,6 +41,7 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     // Get handles for the views.
     backButtonPointer = mainViewUi.backButton;
     forwardButtonPointer = mainViewUi.forwardButton;
+    QPushButton *homeButtonPointer = mainViewUi.homeButton;
     urlLineEditPointer = mainViewUi.urlLineEdit;
     webEngineViewPointer = mainViewUi.webEngineView;
 
@@ -56,9 +57,10 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     connect(webEngineViewPointer, SIGNAL(loadProgress(int)), this, SLOT(updateInterface()));
     connect(webEngineViewPointer, SIGNAL(loadFinished(bool)), this, SLOT(updateInterface()));
 
-    // Setup the forward and back buttons.
+    // Setup the URL bar buttons.
     connect(backButtonPointer, SIGNAL(clicked()), webEngineViewPointer, SLOT(back()));
     connect(forwardButtonPointer, SIGNAL(clicked()), webEngineViewPointer, SLOT(forward()));
+    connect(homeButtonPointer, SIGNAL(clicked()), this, SLOT(goHome()));
 
     // Instantiate the mouse event pointer.
     MouseEventFilter *mouseEventFilterPointer = new MouseEventFilter(webEngineViewPointer);
@@ -75,6 +77,12 @@ MainView::MainView(QWidget *parent) : QWidget(parent)
     // Set the focus on the WebEngine view.
     webEngineViewPointer->setFocus();
 
+    // Load the homepage.
+    goHome();
+}
+
+void MainView::goHome()
+{
     // Load the homepage.  TODO.  Consider sanitizing the homepage input and adding things like protocols if they are missing.
     webEngineViewPointer->setUrl(Settings::homepage());
 }
index 5e5535fba43fb741a9ca5fecdc89ea454cc3a544..76d0bbad7d85584dda6d6a728d8e702da5d05b40 100644 (file)
@@ -38,6 +38,7 @@ signals:
 
 private Q_SLOTS:
     // Define the private slots.
+    void goHome();
     void loadUrl(const QString &urlFromUser);
     void pageLinkHovered(const QString &linkUrl);
     void updateInterface();
index 4865f6eacb46f2d6f8b0295f11c192e383ef7453..03b60b9cabc81883e8d8cf8e30cef200880b3740 100644 (file)
@@ -62,6 +62,7 @@
                         <number>0</number>
                     </property>
 
+                    <!-- The back button. -->
                     <item>
                         <widget class="QPushButton" name="backButton">
                             <property name="icon">
@@ -70,8 +71,8 @@
 
                             <property name="iconSize">
                                 <size>
-                                    <width>24</width>
                                     <height>24</height>
+                                    <width>24</width>
                                 </size>
                             </property>
 
@@ -81,6 +82,7 @@
                         </widget>
                     </item>
 
+                    <!-- The forward button. -->
                     <item>
                         <widget class="QPushButton" name="forwardButton">
                             <property name="icon">
 
                             <property name="iconSize">
                                 <size>
+                                    <height>24</height>
                                     <width>24</width>
+                                </size>
+                            </property>
+
+                            <property name="flat">
+                                <bool>true</bool>
+                            </property>
+                        </widget>
+                    </item>
+
+                    <!-- The home button. -->
+                    <item>
+                        <widget class="QPushButton" name="homeButton">
+                            <property name="icon">
+                                <iconset theme="home" />
+                            </property>
+
+                            <property name="iconSize">
+                                <size>
                                     <height>24</height>
+                                    <width>24</width>
                                 </size>
                             </property>
 
                         </widget>
                     </item>
 
+                    <!-- The URL line edit.-->
                     <item>
                         <widget class="KLineEdit" name="urlLineEdit" />
                     </item>
                 </layout>
             </item>
 
+            <!-- The WebEngine view. -->
             <item>
                 <widget class="QWebEngineView" name="webEngineView" />
             </item>