diff options
m--------- | 3rd-party/SingleApplication/SingleApplication.git | 0 | ||||
-rw-r--r-- | doc/Development/git.asciidoc | 10 | ||||
-rw-r--r-- | lib/bookmarks/bookmarkmodel.h | 3 | ||||
-rw-r--r-- | lib/web/profilemanager.cpp | 16 | ||||
-rw-r--r-- | lib/web/profilemanager.h | 2 | ||||
-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 |
12 files changed, 36 insertions, 34 deletions
diff --git a/3rd-party/SingleApplication/SingleApplication.git b/3rd-party/SingleApplication/SingleApplication.git -Subproject 0db27016b0470b989f4fa114ae9dde5aa2a325f +Subproject c6bc2a3e52701d1a0282bd9e3755a6d01fa629d diff --git a/doc/Development/git.asciidoc b/doc/Development/git.asciidoc new file mode 100644 index 0000000..e9e8b61 --- /dev/null +++ b/doc/Development/git.asciidoc @@ -0,0 +1,10 @@ +== git + +=== Updating submodules +[source, sh] +---- +git submodule update --remote --merge + +# add to commit +git add 3rd-party/<submodule> +---- diff --git a/lib/bookmarks/bookmarkmodel.h b/lib/bookmarks/bookmarkmodel.h index ca6f004..28267aa 100644 --- a/lib/bookmarks/bookmarkmodel.h +++ b/lib/bookmarks/bookmarkmodel.h @@ -12,9 +12,6 @@ #include "bookmarkitem.h" #include <QAbstractItemModel> -/* TODO BookmarkModel: moving items internally instead of copying during drag-drop - */ - class BookmarkModel : public QAbstractItemModel { Q_OBJECT diff --git a/lib/web/profilemanager.cpp b/lib/web/profilemanager.cpp index d6c61a9..74ddc75 100644 --- a/lib/web/profilemanager.cpp +++ b/lib/web/profilemanager.cpp @@ -11,7 +11,7 @@ #include <QFileInfo> #include <QWebEngineSettings> -ProfileManager::ProfileManager(const QHash<QString, QString> &profileSection, const QString &defaultId, QObject *parent) +ProfileManager::ProfileManager(const QHash<QString, QString> &profileSection, QObject *parent) : QObject(parent) , defaults(profileSection) { @@ -28,22 +28,22 @@ WebProfile *ProfileManager::loadProfile(const QString &path) ptr->profile = new WebProfile(id, ptr->settings.value("name", id).toString(), nullptr); } Q_CHECK_PTR(ptr->profile); - connect(ptr->profile, &WebProfile::nameChanged, [this, id](const QString &name) { + connect(ptr->profile, &WebProfile::nameChanged, ptr->profile, [this, id](const QString &name) { this->m_profiles.at(id)->settings.setValue("name", name); }); ptr->profile->setSearch(ptr->settings.value("search", defaults.value("profile.search")).toString()); - connect(ptr->profile, &WebProfile::searchChanged, [this, id](const QString &url) { + connect(ptr->profile, &WebProfile::searchChanged, ptr->profile, [this, id](const QString &url) { this->m_profiles.at(id)->settings.setValue("search", url); }); ptr->profile->setHomepage(ptr->settings.value("homepage", defaults.value("profile.homepage")).toUrl()); - connect(ptr->profile, &WebProfile::homepageChanged, [this, id](const QUrl &url) { + connect(ptr->profile, &WebProfile::homepageChanged, ptr->profile, [this, id](const QUrl &url) { this->m_profiles.at(id)->settings.setValue("homepage", url); }); ptr->profile->setNewtab(ptr->settings.value("newtab", defaults.value("profile.newtab")).toUrl()); - connect(ptr->profile, &WebProfile::newtabChanged, [this, id](const QUrl &url) { + connect(ptr->profile, &WebProfile::newtabChanged, ptr->profile, [this, id](const QUrl &url) { this->m_profiles.at(id)->settings.setValue("newtab", url); }); @@ -55,7 +55,7 @@ WebProfile *ProfileManager::loadProfile(const QString &path) } } ptr->settings.endGroup(); // properties - connect(ptr->profile, &WebProfile::propertyChanged, [this, id](const QString &property, const QVariant &value) { + connect(ptr->profile, &WebProfile::propertyChanged, ptr->profile, [this, id](const QString &property, const QVariant &value) { this->m_profiles.at(id)->settings.setValue("properties/" + property, value); }); @@ -69,7 +69,7 @@ WebProfile *ProfileManager::loadProfile(const QString &path) } } ptr->settings.endGroup(); - connect(ptr->profile, &WebProfile::attributeChanged, [this, id](const QWebEngineSettings::WebAttribute attr, const bool value) { + connect(ptr->profile, &WebProfile::attributeChanged, ptr->profile, [this, id](const QWebEngineSettings::WebAttribute attr, const bool value) { this->m_profiles.at(id)->settings.setValue("attributes/" + QString::number(attr), value); }); @@ -91,7 +91,7 @@ QMenu *ProfileManager::createProfileMenu(std::function<void(WebProfile *)> callb for(const auto &m_profile : m_profiles) { WebProfile *profile = m_profile.second->profile; QAction *action = menu->addAction(profile->name()); - connect(action, &QAction::triggered, [profile, callback]() { + connect(action, &QAction::triggered, profile, [profile, callback]() { callback(profile); }); } diff --git a/lib/web/profilemanager.h b/lib/web/profilemanager.h index 9cd2cbd..5d751d2 100644 --- a/lib/web/profilemanager.h +++ b/lib/web/profilemanager.h @@ -25,7 +25,7 @@ class ProfileManager : public QObject { Q_OBJECT public: - explicit ProfileManager(const QHash<QString, QString> &profileSection, const QString &defaultId, QObject *parent = nullptr); + explicit ProfileManager(const QHash<QString, QString> &profileSection, QObject *parent); WebProfile *loadProfile(const QString &path); void deleteProfile(const QString &id); 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()); } |