From: Soren Stoutner Date: Mon, 31 Jan 2022 23:41:10 +0000 (-0700) Subject: Create a home icon. X-Git-Tag: v0.1~66 X-Git-Url: https://gitweb.stoutner.com/?a=commitdiff_plain;h=196ae0c95c22cf78557d4f11be317aa7181c9af0;p=PrivacyBrowserPC.git Create a home icon. --- diff --git a/src/mainview.cpp b/src/mainview.cpp index 8749760..25f3b4c 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -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()); } diff --git a/src/mainview.h b/src/mainview.h index 5e5535f..76d0bba 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -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(); diff --git a/src/mainview.ui b/src/mainview.ui index 4865f6e..03b60b9 100644 --- a/src/mainview.ui +++ b/src/mainview.ui @@ -62,6 +62,7 @@ 0 + @@ -70,8 +71,8 @@ - 24 24 + 24 @@ -81,6 +82,7 @@ + @@ -89,8 +91,28 @@ + 24 24 + + + + + true + + + + + + + + + + + + + 24 + 24 @@ -100,12 +122,14 @@ + +