From 06c640ce4b69fd2abe6df35cdb6a0387795e4220 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Mon, 16 Jan 2017 17:35:08 +0100 Subject: Added About dialog --- src/mainwindow.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1a52ee2..f97f8b0 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -50,22 +50,27 @@ MainWindow::MainWindow(Browser *instance, QUrl defaultUrl, QWidget *parent) : resize(settings.value("window/width", 800).toInt(), settings.value("window/height", 600).toInt()); // Browser menu - browserMenu = new QMenu(qApp->applicationName(), ui->menuBar); + QMenu *browserMenu = new QMenu(qApp->applicationName(), ui->menuBar); ui->menuBar->addMenu(browserMenu); browserMenu->addAction(tr("New Window"), this, SLOT(handleNewWindow()), QKeySequence(tr("Ctrl+N"))); browserMenu->addAction(tr("New Tab"), this, SLOT(createNewTab()), QKeySequence(tr("Ctrl+T"))); browserMenu->addSeparator(); + browserMenu->addAction(tr("About"), this, SLOT(about()), QKeySequence(tr("F1"))); browserMenu->addAction(tr("About Qt"), qApp, SLOT(aboutQt())); browserMenu->addAction(tr("Quit"), qApp, SLOT(quit()), QKeySequence(tr("Ctrl+Q"))); + // Tools menu + QMenu *toolsMenu = new QMenu(tr("Tools"), ui->menuBar); + ui->menuBar->addMenu(toolsMenu); + toolsMenu->addAction(tr("Downloads"), downloadManager, SLOT(show())); + // Profile menu QMenuBar *rightBar = new QMenuBar(ui->menuBar); profileMenu = new QMenu(tr("Profile: ") + profileName); rightBar->addMenu(profileMenu); ui->menuBar->setCornerWidget(rightBar); - profileMenu->addAction(tr("Edit profile"), this, SLOT(createProfileDialog())); - profileMenu->addAction(tr("Load profile"), this, SLOT(handleLoadProfile())); - profileMenu->addAction(tr("Downloads"), downloadManager, SLOT(show())); + profileMenu->addAction(tr("Edit profile"), this, SLOT(execProfileEditor())); + profileMenu->addAction(tr("Load profile"), this, SLOT(loadProfileGUI())); //profileMenu->addAction(tr("Settings")); //profileMenu->addAction(tr("Cookies")); @@ -107,6 +112,15 @@ void MainWindow::closeEvent(QCloseEvent *event) QMainWindow::closeEvent(event); } +void MainWindow::about() +{ + QMessageBox::about(this, tr("About"), tr("

smolbote

" + "

yet another Qute browser

" + "

Copyright (C) 2017 Xian Nox

" + "

This program comes with ABSOLUTELY NO WARRANTY. " + "This is free software, and you are welcome to redistribute it under the conditions set by the GNU GPLv3.

")); +} + void MainWindow::loadProfile(const QString &name) { if(profile) { @@ -126,7 +140,7 @@ void MainWindow::loadProfile(const QString &name) connect(profile, SIGNAL(downloadRequested(QWebEngineDownloadItem*)), downloadManager, SLOT(addDownload(QWebEngineDownloadItem*))); } -void MainWindow::handleLoadProfile() +void MainWindow::loadProfileGUI() { bool ok; QString name = QInputDialog::getText(this, tr("Load Profile"), tr("Enter Profile name"), QLineEdit::Normal, QString(""), &ok); @@ -169,7 +183,7 @@ void MainWindow::handleTitleUpdated(const QString &title) setWindowTitle(title + settings.value("window/title").toString()); } -void MainWindow::createProfileDialog() +void MainWindow::execProfileEditor() { ProfileDialog *dialog = new ProfileDialog(profile, this); dialog->exec(); -- cgit v1.2.1