diff options
Diffstat (limited to 'src/mainwindow')
-rw-r--r-- | src/mainwindow/mainwindow.cpp | 16 | ||||
-rw-r--r-- | src/mainwindow/mainwindow.h | 6 | ||||
-rw-r--r-- | src/mainwindow/menubar.cpp | 92 | ||||
-rw-r--r-- | src/mainwindow/widgets/searchform.cpp | 10 | ||||
-rw-r--r-- | src/mainwindow/widgets/searchform.h | 2 |
5 files changed, 63 insertions, 63 deletions
diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index 4ec79b1..64c149c 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -24,7 +24,7 @@ #include <QMessageBox> #include <QStatusBar> -MainWindow::MainWindow(const Session::MainWindow &data, QMenu *appMenu, QWidget *parent) +MainWindow::MainWindow(const Session::MainWindow &mainwindow_data, QMenu *appMenu, QWidget *parent) : QMainWindow(parent) { Configuration config; @@ -66,7 +66,7 @@ MainWindow::MainWindow(const Session::MainWindow &data, QMenu *appMenu, QWidget }); QMainWindow::addAction(searchAction); - for(const auto &s : data.subwindows) { + for(const auto &s : mainwindow_data.subwindows) { createSubWindow(s); } if(m_subwindows.isEmpty()) { @@ -115,19 +115,19 @@ void MainWindow::createTab(const QUrl &url) } } -void MainWindow::createTab(const Session::WebView &data) +void MainWindow::createTab(const Session::WebView &tab_data) { auto *w = qobject_cast<SubWindow *>(centralWidget()); if(w != nullptr) { - w->addTab(data); + w->addTab(tab_data); } } -SubWindow *MainWindow::createSubWindow(const Session::SubWindow &data) +SubWindow *MainWindow::createSubWindow(const Session::SubWindow &subwindow_data) { WebProfileManager profileManager; - auto *profile = profileManager.profile(data.profile); + auto *profile = profileManager.profile(subwindow_data.profile); if(profile == nullptr) { profile = WebProfile::defaultProfile(); } @@ -153,11 +153,11 @@ SubWindow *MainWindow::createSubWindow(const Session::SubWindow &data) } }); - if(data.tabs.count() == 0) { + if(subwindow_data.tabs.count() == 0) { w->addTab(profile->newtab()); return w; } - for(const auto &tab : data.tabs) { + for(const auto &tab : subwindow_data.tabs) { w->addTab(tab); } return w; diff --git a/src/mainwindow/mainwindow.h b/src/mainwindow/mainwindow.h index 31f5658..c5d573e 100644 --- a/src/mainwindow/mainwindow.h +++ b/src/mainwindow/mainwindow.h @@ -34,7 +34,7 @@ public: ToolsMenu }; - explicit MainWindow(const Session::MainWindow &data, QMenu *appMenu, QWidget *parent = nullptr); + explicit MainWindow(const Session::MainWindow &mainwindow_data, QMenu *appMenu, QWidget *parent = nullptr); MainWindow(const MainWindow &) = delete; ~MainWindow() = default; @@ -66,8 +66,8 @@ public: public slots: void createTab(const QUrl &url); - void createTab(const Session::WebView &data); - SubWindow *createSubWindow(const Session::SubWindow &data); + void createTab(const Session::WebView &tab_data); + SubWindow *createSubWindow(const Session::SubWindow &subwindow_data); void setCurrentSubWindow(SubWindow *subwindow); private slots: diff --git a/src/mainwindow/menubar.cpp b/src/mainwindow/menubar.cpp index f8979de..5fc039a 100644 --- a/src/mainwindow/menubar.cpp +++ b/src/mainwindow/menubar.cpp @@ -87,37 +87,37 @@ MenuBar::MenuBar(QMenu *appMenu, MainWindow *parent) conf.shortcut<QAction>(*actionDownloads, "shortcuts.window.downloads.show"); window->addSeparator(); - auto *actionNewWindow = window->addAction(tr("New Window"), browser, [browser]() { - const Session::MainWindow window; - browser->open({ window }, false); - }); - conf.shortcut<QAction>(*actionNewWindow, "shortcuts.window.newwindow"); + auto *actionNewWindow = window->addAction(tr("New Window"), browser, [browser]() { + const Session::MainWindow window_data; + browser->open({ window_data }, false); + }); + conf.shortcut<QAction>(*actionNewWindow, "shortcuts.window.newwindow"); - auto *actionNewSubwindow = window->addAction(tr("New Subwindow"), parent, [parent]() { - const Session::SubWindow session; - parent->createSubWindow(session); - }); - conf.shortcut<QAction>(*actionNewSubwindow, "shortcuts.window.newgroup"); + auto *actionNewSubwindow = window->addAction(tr("New Subwindow"), parent, [parent]() { + const Session::SubWindow session; + parent->createSubWindow(session); + }); + conf.shortcut<QAction>(*actionNewSubwindow, "shortcuts.window.newgroup"); - auto *actionCloseSubwindow = window->addAction(tr("Close Subwindow"), parent, [parent]() { - parent->currentSubWindow()->close(); - }); - conf.shortcut<QAction>(*actionCloseSubwindow, "shortcuts.subwindow.close"); + auto *actionCloseSubwindow = window->addAction(tr("Close Subwindow"), parent, [parent]() { + parent->currentSubWindow()->close(); + }); + conf.shortcut<QAction>(*actionCloseSubwindow, "shortcuts.subwindow.close"); - window->addSeparator()->setText(tr("Toolbars")); + window->addSeparator()->setText(tr("Toolbars")); - bool hasMovableToolbar = false; + bool hasMovableToolbar = false; - for(auto *toolbar : parent->findChildren<QToolBar *>()) { - auto *action = window->addAction(toolbar->windowTitle()); - action->setCheckable(true); - action->setChecked(toolbar->isVisible()); - connect(toolbar, &QToolBar::visibilityChanged, action, &QAction::setChecked); - connect(action, &QAction::triggered, toolbar, &QToolBar::setVisible); - conf.shortcut<QAction>(*action, qUtf8Printable(toolbar->objectName() + ".show")); + for(auto *toolbar : parent->findChildren<QToolBar *>()) { + auto *action = window->addAction(toolbar->windowTitle()); + action->setCheckable(true); + action->setChecked(toolbar->isVisible()); + connect(toolbar, &QToolBar::visibilityChanged, action, &QAction::setChecked); + connect(action, &QAction::triggered, toolbar, &QToolBar::setVisible); + conf.shortcut<QAction>(*action, qUtf8Printable(toolbar->objectName() + ".show")); - if(toolbar->isMovable()) - hasMovableToolbar = true; + if(toolbar->isMovable()) + hasMovableToolbar = true; } auto *lockAction = window->addAction(tr("Unlock toolbars")); @@ -169,27 +169,27 @@ MenuBar::MenuBar(QMenu *appMenu, MainWindow *parent) auto *actionLockClose = subwindow->addAction(tr("Prevent tab from closing"), parent, [parent](bool checked) { run_if(parent->currentSubWindow(), [checked](SubWindow *_subwindow, int currentIdx) { - auto data = _subwindow->tabData(currentIdx); - data.closeLocked = checked; - _subwindow->setTabData(data, currentIdx); + auto tab_data = _subwindow->tabData(currentIdx); + tab_data.closeLocked = checked; + _subwindow->setTabData(tab_data, currentIdx); }); }); actionLockClose->setCheckable(true); auto *actionLockRefresh = subwindow->addAction(tr("Prevent tab from refreshing"), parent, [parent](bool checked) { run_if(parent->currentSubWindow(), [checked](SubWindow *_subwindow, int currentIdx) { - auto data = _subwindow->tabData(currentIdx); - data.refreshLocked = checked; - _subwindow->setTabData(data, currentIdx); + auto tab_data = _subwindow->tabData(currentIdx); + tab_data.refreshLocked = checked; + _subwindow->setTabData(tab_data, currentIdx); }); }); actionLockRefresh->setCheckable(true); connect(subwindow, &QMenu::aboutToShow, subwindow, [=]() { run_if(parent->currentSubWindow(), [=](SubWindow *_subwindow, int currentIdx) { - auto data = _subwindow->tabData(currentIdx); - actionLockClose->setChecked(data.closeLocked); - actionLockRefresh->setChecked(data.refreshLocked); + auto tab_data = _subwindow->tabData(currentIdx); + actionLockClose->setChecked(tab_data.closeLocked); + actionLockRefresh->setChecked(tab_data.refreshLocked); }); }); @@ -235,8 +235,8 @@ MenuBar::MenuBar(QMenu *appMenu, MainWindow *parent) subwindow->addAction(tr("Close tabs to the left"), parent, [parent]() { run_if(parent->currentSubWindow(), [](SubWindow *_subwindow, int currentIdx) { for(int i = currentIdx - 1; i >= 0; i--) { - const auto data = _subwindow->tabData(i); - if(!data.closeLocked) + const auto tab_data = _subwindow->tabData(i); + if(!tab_data.closeLocked) _subwindow->closeTab(i); } }); @@ -244,8 +244,8 @@ MenuBar::MenuBar(QMenu *appMenu, MainWindow *parent) subwindow->addAction(tr("Close tabs to the right"), parent, [parent]() { run_if(parent->currentSubWindow(), [](SubWindow *_subwindow, int currentIdx) { for(int i = _subwindow->tabCount() - 1; i > currentIdx; i--) { - const auto data = _subwindow->tabData(i); - if(!data.closeLocked) + const auto tab_data = _subwindow->tabData(i); + if(!tab_data.closeLocked) _subwindow->closeTab(i); } }); @@ -254,8 +254,8 @@ MenuBar::MenuBar(QMenu *appMenu, MainWindow *parent) run_if(parent->currentSubWindow(), [](SubWindow *_subwindow, int currentIdx) { for(int i = _subwindow->tabCount() - 1; i >= 0; i--) { if(i != currentIdx) { - const auto data = _subwindow->tabData(i); - if(!data.closeLocked) + const auto tab_data = _subwindow->tabData(i); + if(!tab_data.closeLocked) _subwindow->closeTab(i); } } @@ -267,8 +267,8 @@ MenuBar::MenuBar(QMenu *appMenu, MainWindow *parent) subwindow->addAction(tr("Refresh tabs to the left"), parent, [parent]() { run_if(parent->currentSubWindow(), [](SubWindow *_subwindow, int currentIdx) { for(int i = 0; i < currentIdx; i++) { - const auto data = _subwindow->tabData(i); - if(!data.refreshLocked) + const auto tab_data = _subwindow->tabData(i); + if(!tab_data.refreshLocked) _subwindow->view(i)->triggerPageAction(QWebEnginePage::Reload); } }); @@ -276,8 +276,8 @@ MenuBar::MenuBar(QMenu *appMenu, MainWindow *parent) subwindow->addAction(tr("Refresh tabs to the right"), parent, [parent]() { run_if(parent->currentSubWindow(), [](SubWindow *_subwindow, int currentIdx) { for(int i = currentIdx + 1; i < _subwindow->tabCount(); i++) { - const auto data = _subwindow->tabData(i); - if(!data.refreshLocked) + const auto tab_data = _subwindow->tabData(i); + if(!tab_data.refreshLocked) _subwindow->view(i)->triggerPageAction(QWebEnginePage::Reload); } }); @@ -286,8 +286,8 @@ MenuBar::MenuBar(QMenu *appMenu, MainWindow *parent) run_if(parent->currentSubWindow(), [](SubWindow *_subwindow, int currentIdx) { for(int i = 0; i < _subwindow->tabCount(); i++) { if(i != currentIdx) { - const auto data = _subwindow->tabData(i); - if(!data.refreshLocked) + const auto tab_data = _subwindow->tabData(i); + if(!tab_data.refreshLocked) _subwindow->view(i)->triggerPageAction(QWebEnginePage::Reload); } } diff --git a/src/mainwindow/widgets/searchform.cpp b/src/mainwindow/widgets/searchform.cpp index 1519df2..e10933b 100644 --- a/src/mainwindow/widgets/searchform.cpp +++ b/src/mainwindow/widgets/searchform.cpp @@ -22,11 +22,11 @@ SearchForm::SearchForm(QWidget *parent) ui->result_label->setVisible(false); connect(ui->lineEdit, &QLineEdit::returnPressed, this, [this]() { - if(view) { + if(m_view) { QWebEnginePage::FindFlags searchFlags; searchFlags.setFlag(QWebEnginePage::FindCaseSensitively, ui->caseSensitivity_checkBox->isChecked()); searchFlags.setFlag(QWebEnginePage::FindBackward, ui->reverseSearch_checkBox->isChecked()); - view->findText(ui->lineEdit->text(), searchFlags, [this](bool found) { + m_view->findText(ui->lineEdit->text(), searchFlags, [this](bool found) { ui->result_label->setVisible(!found); }); } @@ -40,7 +40,7 @@ SearchForm::~SearchForm() void SearchForm::setView(QWebEngineView *view) { - this->view = view; + m_view = view; } void SearchForm::showEvent(QShowEvent *event) @@ -53,8 +53,8 @@ void SearchForm::showEvent(QShowEvent *event) void SearchForm::hideEvent(QHideEvent *event) { // clear highlighted text when hiding - if(view) { - view->findText(""); + if(m_view) { + m_view->findText(""); } event->accept(); } diff --git a/src/mainwindow/widgets/searchform.h b/src/mainwindow/widgets/searchform.h index 16effe9..285ed16 100644 --- a/src/mainwindow/widgets/searchform.h +++ b/src/mainwindow/widgets/searchform.h @@ -34,7 +34,7 @@ protected: private: Ui::SearchForm *ui; - QWebEngineView *view = nullptr; + QWebEngineView *m_view = nullptr; }; #endif // SMOLBOTE_SEARCHFORM_H |