diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/browser.cpp | 6 | ||||
-rw-r--r-- | src/browser.h | 2 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/mainwindow/mainwindow.cpp | 16 | ||||
-rw-r--r-- | src/mainwindow/widgets/navigationbar.cpp | 6 | ||||
-rw-r--r-- | src/util.cpp | 5 | ||||
-rw-r--r-- | src/util.h | 2 |
7 files changed, 17 insertions, 22 deletions
diff --git a/src/browser.cpp b/src/browser.cpp index 62fc729..7bf4adf 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -91,7 +91,7 @@ void Browser::registerPlugin(const Plugin &plugin) } } -void Browser::setup(const QString &defaultProfile) +void Browser::setup() { Q_ASSERT(m_config); @@ -111,7 +111,7 @@ void Browser::setup(const QString &defaultProfile) // cookie request filter // load profiles - m_profileManager = new ProfileManager(m_config->section("profile"), defaultProfile, this); + m_profileManager = new ProfileManager(m_config->section("profile"), this); for(const QString &profilePath : Util::files(m_config->value<QString>("profile.path").value(), { "*.profile" })) { this->loadProfile(profilePath); } @@ -171,7 +171,7 @@ void Browser::createSession(const QJsonObject &object) if(tabs.isEmpty()) window->addTab(profile->newtab()); else { - for(const QJsonValue &t : subwindow.value("tabs").toArray()) { + for(const auto &t : tabs) { const QJsonObject tab = t.toObject(); const QUrl url = QUrl::fromUserInput(tab.value("url").toString()); WebProfile *p = m_profileManager->profile(tab.value("profile").toString()); diff --git a/src/browser.h b/src/browser.h index c6186f6..b4352a7 100644 --- a/src/browser.h +++ b/src/browser.h @@ -45,7 +45,7 @@ public: void registerPlugin(const Plugin &plugin); - void setup(const QString &defaultProfile); + void setup(); QJsonObject session() const { return Session::session(m_windows); diff --git a/src/main.cpp b/src/main.cpp index 69389d0..9ae0dc1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -163,7 +163,7 @@ int main(int argc, char **argv) auto profile = config->value<QString>("profile.default"); app.setConfiguration(config); - app.setup(profile.value()); + app.setup(); for(const Plugin &plugin : plugins) { app.registerPlugin(plugin); diff --git a/src/mainwindow/mainwindow.cpp b/src/mainwindow/mainwindow.cpp index 8a33e23..b3a7722 100644 --- a/src/mainwindow/mainwindow.cpp +++ b/src/mainwindow/mainwindow.cpp @@ -89,16 +89,6 @@ MainWindow::MainWindow(const std::unique_ptr<Configuration> &config, QWidget *pa } show(); -#ifdef QT_DEBUG - { - auto *debugMenu = ui->menubar->addMenu(tr("Debug")); - - debugMenu->addAction(tr("Crash"), []() { - delete reinterpret_cast<QString*>(0xFEE1DEAD); - }); - }; -#endif - // connect smolbote menu { connect(ui->actionNewSubwindow, &QAction::triggered, this, [this, &config]() { @@ -293,7 +283,8 @@ void MainWindow::addAction(ActionLocation where, QAction *action) void MainWindow::addDockWidget(Qt::DockWidgetArea area, QWidget *widget) { QDockWidget *lastDock = nullptr; - for(QDockWidget *dock : findChildren<QDockWidget *>()) { + const auto docks = findChildren<QDockWidget *>(); + for(QDockWidget *dock : docks) { if(dockWidgetArea(dock) == area) lastDock = dock; } @@ -334,7 +325,8 @@ void MainWindow::createTab(const QUrl &url) const QVector<SubWindow *> MainWindow::subWindows() const { QVector<SubWindow *> list; - for(auto *w : mdiArea->subWindowList()) { + const auto subwindows = mdiArea->subWindowList(); + for(auto *w : subwindows) { auto *subwindow = qobject_cast<SubWindow *>(w); if(subwindow != nullptr) list.append(subwindow); diff --git a/src/mainwindow/widgets/navigationbar.cpp b/src/mainwindow/widgets/navigationbar.cpp index e179565..b49680d 100644 --- a/src/mainwindow/widgets/navigationbar.cpp +++ b/src/mainwindow/widgets/navigationbar.cpp @@ -36,7 +36,8 @@ NavigationBar::NavigationBar(const QHash<QString, QString> &conf, QWidget *paren auto *backMenu = new QMenu(this); connect(backMenu, &QMenu::aboutToShow, this, [this, backMenu]() { backMenu->clear(); - for(const QWebEngineHistoryItem &item : m_view->history()->backItems(10)) { + const auto history = m_view->history()->backItems(10); + for(const QWebEngineHistoryItem &item : history) { auto *action = backMenu->addAction(item.title()); connect(action, &QAction::triggered, this, [item, this]() { m_view->history()->goToItem(item); @@ -66,7 +67,8 @@ NavigationBar::NavigationBar(const QHash<QString, QString> &conf, QWidget *paren auto *forwardMenu = new QMenu(this); connect(forwardMenu, &QMenu::aboutToShow, this, [this, forwardMenu]() { forwardMenu->clear(); - for(const QWebEngineHistoryItem &item : m_view->history()->forwardItems(10)) { + const auto history = m_view->history()->forwardItems(10); + for(const QWebEngineHistoryItem &item : history) { auto *action = forwardMenu->addAction(item.title()); connect(action, &QAction::triggered, this, [item, this]() { m_view->history()->goToItem(item); diff --git a/src/util.cpp b/src/util.cpp index 5b1478b..a978838 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -12,7 +12,7 @@ #define ListSeparator QLatin1Literal(";") -QStringList Util::files(const QString &location, const QStringList &nameFilters) +const QStringList Util::files(const QString &location, const QStringList &nameFilters) { if(location.isEmpty()) return QStringList(); @@ -34,7 +34,8 @@ QStringList Util::files(const QString &location, const QStringList &nameFilters) // check if location is a folder if(info.isDir()) { - for(const QFileInfo &entryInfo : QDir(info.absoluteFilePath()).entryInfoList(nameFilters, QDir::Files | QDir::Readable, QDir::Time)) { + const auto entryList = QDir(info.absoluteFilePath()).entryInfoList(nameFilters, QDir::Files | QDir::Readable, QDir::Time); + for(const QFileInfo &entryInfo : entryList) { filelist.append(entryInfo.absoluteFilePath()); } } else if(info.isFile()) { @@ -13,7 +13,7 @@ namespace Util { -QStringList files(const QString &location, const QStringList &nameFilters = QStringList()); +const QStringList files(const QString &location, const QStringList &nameFilters = QStringList()); } |