diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mainwindow.cpp | 26 | ||||
-rw-r--r-- | src/mainwindow.h | 9 |
2 files changed, 25 insertions, 10 deletions
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("<h3>smolbote</h3>" + "<p><i>yet another Qute browser</i></p>" + "<p>Copyright (C) 2017 Xian Nox</p>" + "<p>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.</p>")); +} + 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(); diff --git a/src/mainwindow.h b/src/mainwindow.h index f084b95..63ff93a 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -50,8 +50,11 @@ protected: void closeEvent(QCloseEvent *event) override; private slots: + void about(); + void loadProfile(const QString &name); - void handleLoadProfile(); + void loadProfileGUI(); + void execProfileEditor(); void handleNewWindow(const QUrl &url = QUrl("")); void handleTabChanged(QWebEngineView *view); @@ -59,8 +62,6 @@ private slots: void handleUrlUpdated(const QUrl &url); void handleTitleUpdated(const QString &title); - void createProfileDialog(); - private: Browser *browserInstance; DownloadDialog *downloadManager; @@ -69,7 +70,7 @@ private: // ui Ui::MainWindow *ui; - QMenu *browserMenu, *profileMenu; + QMenu *profileMenu; QToolBar *navigationToolBar, *tabToolBar; WebViewTabBar *tabBar; QLineEdit *urlLineEdit; |