From fb7b0588f2e95260578076aceb22a5644e81f8b6 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Mon, 28 Mar 2022 17:54:13 -0700 Subject: [PATCH] Set the default window size. --- src/BrowserView.ui | 10 ---------- src/ui.rc/browser_ui.rc | 8 ++++---- src/windows/BrowserWindow.cpp | 27 +++++++++++---------------- src/windows/BrowserWindow.h | 7 +++---- 4 files changed, 18 insertions(+), 34 deletions(-) diff --git a/src/BrowserView.ui b/src/BrowserView.ui index d78eb20..9d7a535 100644 --- a/src/BrowserView.ui +++ b/src/BrowserView.ui @@ -22,16 +22,6 @@ BrowserView - - - - 0 - 0 - 700 - 500 - - - diff --git a/src/ui.rc/browser_ui.rc b/src/ui.rc/browser_ui.rc index ec7729e..73bf318 100644 --- a/src/ui.rc/browser_ui.rc +++ b/src/ui.rc/browser_ui.rc @@ -62,10 +62,10 @@ Navigation Toolbar - - - - + + + + diff --git a/src/windows/BrowserWindow.cpp b/src/windows/BrowserWindow.cpp index d83dd69..77bb43b 100644 --- a/src/windows/BrowserWindow.cpp +++ b/src/windows/BrowserWindow.cpp @@ -46,9 +46,13 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow() KActionCollection *actionCollectionPointer = this->actionCollection(); // Add the standard actions. + QAction *backActionPointer = KStandardAction::back(this, SLOT(back()), actionCollectionPointer); + QAction *forwardActionPointer = KStandardAction::forward(this, SLOT(forward()), actionCollectionPointer); + KStandardAction::home(this, SLOT(home()), actionCollectionPointer); KStandardAction::openNew(this, SLOT(fileNew()), actionCollectionPointer); KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollectionPointer); KStandardAction::preferences(this, SLOT(settingsConfigure()), actionCollectionPointer); + KStandardAction::redisplay(this, SLOT(refresh()), actionCollectionPointer); // Add the custom actions. userAgentPrivacyBrowserActionPointer = actionCollectionPointer->addAction(QStringLiteral("user_agent_privacy_browser")); @@ -67,10 +71,6 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow() searchEngineBingActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_bing")); searchEngineYahooActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_yahoo")); searchEngineCustomActionPointer = actionCollectionPointer->addAction(QStringLiteral("search_engine_custom")); - backActionPointer = actionCollectionPointer->addAction(QStringLiteral("back")); - forwardActionPointer = actionCollectionPointer->addAction(QStringLiteral("forward")); - refreshActionPointer = actionCollectionPointer->addAction(QStringLiteral("refresh")); - homeActionPointer = actionCollectionPointer->addAction(QStringLiteral("home")); javaScriptActionPointer = actionCollectionPointer->addAction(QStringLiteral("javascript")); domainSettingsActionPointer = actionCollectionPointer->addAction(QStringLiteral("domain_settings")); @@ -126,18 +126,11 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow() searchEngineGoogleActionPointer->setText(i18nc("Search engine", "Google")); searchEngineBingActionPointer->setText(i18nc("Search engine", "Bing")); searchEngineYahooActionPointer->setText(i18nc("Search engine", "Yahoo")); - backActionPointer->setText(i18nc("Back button", "Back")); - forwardActionPointer->setText(i18nc("Forward button", "Forward")); - refreshActionPointer->setText(i18nc("Refresh button", "Refresh")); - homeActionPointer->setText(i18nc("Home button", "Home")); javaScriptActionPointer->setText(i18nc("JavaScript button", "JavaScript")); domainSettingsActionPointer->setText(i18nc("Domain Settings button", "Domain Settings")); // Set the action icons. - backActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("arrow-left"))); - forwardActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("arrow-right"))); - refreshActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); - homeActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("home"))); + //refreshActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh"))); domainSettingsActionPointer->setIcon(QIcon::fromTheme(QStringLiteral("network-server-symbolic"))); // Update the on-the-fly menus. @@ -153,10 +146,6 @@ BrowserWindow::BrowserWindow() : KXmlGuiWindow() connect(zoomFactorActionPointer, SIGNAL(triggered()), this, SLOT(getZoomFactorFromUser())); // Connect the URL toolbar actions. - connect(backActionPointer, SIGNAL(triggered()), this, SLOT(back())); - connect(forwardActionPointer, SIGNAL(triggered()), this, SLOT(forward())); - connect(refreshActionPointer, SIGNAL(triggered()), this, SLOT(refresh())); - connect(homeActionPointer, SIGNAL(triggered()), this, SLOT(home())); connect(javaScriptActionPointer, SIGNAL(triggered()), this, SLOT(toggleJavaScript())); connect(domainSettingsActionPointer, SIGNAL(triggered()), this, SLOT(openDomainSettings())); @@ -310,6 +299,12 @@ void BrowserWindow::toggleJavaScript() const browserViewPointer->toggleJavaScript(); } +QSize BrowserWindow::sizeHint() const +{ + // Return the default window size. + return QSize(1500, 1200); +} + void BrowserWindow::settingsConfigure() { // Check to make sure the dialog box isn't already displayed. diff --git a/src/windows/BrowserWindow.h b/src/windows/BrowserWindow.h index 7fa6050..4099d8d 100644 --- a/src/windows/BrowserWindow.h +++ b/src/windows/BrowserWindow.h @@ -39,6 +39,9 @@ public: // The default constructor. BrowserWindow(); + // The public functions. + QSize sizeHint() const override; + private Q_SLOTS: // The private slots. void back() const; @@ -62,14 +65,11 @@ private Q_SLOTS: private: // The private variables. - QAction *backActionPointer; BrowserView *browserViewPointer; KConfigDialog *configDialogPointer; QAction *domainSettingsActionPointer; QPalette domainSettingsPalette; double currentZoomFactor; - QAction *forwardActionPointer; - QAction *homeActionPointer; QAction *javaScriptActionPointer; QPalette noDomainSettingsPalette; QLabel *searchEngineLabelPointer; @@ -80,7 +80,6 @@ private: QAction *searchEngineBingActionPointer; QAction *searchEngineYahooActionPointer; QAction *searchEngineCustomActionPointer; - QAction *refreshActionPointer; QLabel *userAgentLabelPointer; QAction *userAgentPrivacyBrowserActionPointer; QAction *userAgentFirefoxLinuxActionPointer; -- 2.45.2