Mercurial > minori
view src/gui/dialog/settings/torrents.cc @ 187:9613d72b097e
*: multiple performance improvements
like marking `static const` when it makes sense...
date: change old stupid heap-based method to a structure which should
make copying the thing actually make a copy.
also many performance-based changes, like removing the std::tie
dependency and forward-declaring nlohmann json
*: replace every instance of QString::fromUtf8 to Strings::ToQString.
the main difference is that our function will always convert exactly
what is in the string, while some other times it would only convert
up to the nearest NUL byte
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Wed, 06 Dec 2023 13:43:54 -0500 |
| parents | 4eae379cb1ff |
| children | ff0061e75f0f |
line wrap: on
line source
#include "core/session.h" #include "core/strings.h" #include "gui/dialog/settings.h" #include <QLineEdit> #include <QGroupBox> #include <QLabel> #include <QSizePolicy> #include <QVBoxLayout> #include <algorithm> QWidget* SettingsPageTorrents::CreateGeneralWidget() { QWidget* result = new QWidget(this); result->setAutoFillBackground(true); result->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); QVBoxLayout* full_layout = new QVBoxLayout(result); { /* URLs */ QGroupBox* group = new QGroupBox(tr("URLs"), result); group->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); QVBoxLayout* group_layout = new QVBoxLayout(group); { /* Feed link */ QWidget* widget = new QWidget(group); QVBoxLayout* widget_layout = new QVBoxLayout(widget); { QLabel* sync_combo_box_label = new QLabel(tr("URL of the RSS feed to check:"), widget); widget_layout->addWidget(sync_combo_box_label); } { /* Username: this literally never gets used btw */ QLineEdit* lineedit = new QLineEdit(Strings::ToQString(feed_link), widget); connect(lineedit, &QLineEdit::editingFinished, this, [this, lineedit] { feed_link = Strings::ToUtf8String(lineedit->text()); }); widget_layout->addWidget(lineedit); } group_layout->addWidget(widget); } full_layout->addWidget(group); } full_layout->setSpacing(10); full_layout->addStretch(); return result; } void SettingsPageTorrents::SaveInfo() { session.config.torrents.feed_link = feed_link; } SettingsPageTorrents::SettingsPageTorrents(QWidget* parent) : SettingsPage(parent, tr("Torrents")) { feed_link = session.config.torrents.feed_link; AddTab(CreateGeneralWidget(), tr("General")); }
