X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2Fmainview.cpp;h=25f3b4c5ea0d1b6f39de2439abea2bff200d58f3;hp=8749760773e6acdd9540a236855ad761d805a6e2;hb=196ae0c95c22cf78557d4f11be317aa7181c9af0;hpb=3d2e70c352736d809d6d0b705864ce17ffde68ae 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()); }