Mercurial > minori
diff src/gui/dialog/settings/library.cc @ 258:862d0d8619f6
*: HUUUGE changes
animia has been renamed to animone, so instead of thinking of a
health condition, you think of a beautiful flower :)
I've also edited some of the code for animone, but I have no idea
if it even works or not because I don't have a mac or windows
machine lying around. whoops!
... anyway, all of the changes divergent from Anisthesia are now
licensed under BSD. it's possible that I could even rewrite most
of the code to where I don't even have to keep the MIT license,
but that's thinking too far into the future
I've been slacking off on implementing the anime seasons page,
mostly out of laziness. I think I'd have to create another db file
specifically for the seasons
anyway, this code is being pushed *primarily* because the hard drive
it's on is failing! yay :)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 01 Apr 2024 02:43:44 -0400 |
parents | 4d461ef7d424 |
children | b1f4d1867ab1 |
line wrap: on
line diff
--- a/src/gui/dialog/settings/library.cc Sun Feb 18 16:02:14 2024 -0500 +++ b/src/gui/dialog/settings/library.cc Mon Apr 01 02:43:44 2024 -0400 @@ -2,19 +2,19 @@ #include "core/strings.h" #include "gui/dialog/settings.h" +#include <QCheckBox> +#include <QDir> +#include <QDropEvent> +#include <QFileDialog> +#include <QFileInfo> +#include <QGroupBox> +#include <QLabel> #include <QListWidget> #include <QListWidgetItem> -#include <QGroupBox> -#include <QCheckBox> -#include <QLabel> +#include <QMimeData> +#include <QPushButton> #include <QSizePolicy> #include <QVBoxLayout> -#include <QDir> -#include <QFileDialog> -#include <QFileInfo> -#include <QPushButton> -#include <QDropEvent> -#include <QMimeData> #include <algorithm> #include <iostream> @@ -24,13 +24,13 @@ } void DroppableListWidget::dragMoveEvent(QDragMoveEvent* event) { - if (event->mimeData()->hasUrls()) - event->acceptProposedAction(); + if (event->mimeData()->hasUrls()) + event->acceptProposedAction(); } void DroppableListWidget::dragEnterEvent(QDragEnterEvent* event) { - if (event->mimeData()->hasUrls()) - event->acceptProposedAction(); + if (event->mimeData()->hasUrls()) + event->acceptProposedAction(); } void DroppableListWidget::dropEvent(QDropEvent* event) { @@ -85,7 +85,7 @@ /* add icons as well soon */ } - connect(listwidget, &DroppableListWidget::FilesDropped, this, [this, listwidget](QStringList list){ + connect(listwidget, &DroppableListWidget::FilesDropped, this, [this, listwidget](QStringList list) { for (const auto& dir : list) { paths.insert(Strings::ToUtf8String(dir)); QListWidgetItem* item = new QListWidgetItem(listwidget); @@ -109,11 +109,10 @@ { QPushButton* button = new QPushButton(tr("Add new..."), widget); - connect(button, &QPushButton::clicked, this, [this, listwidget]{ - const QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), - QDir::homePath(), - QFileDialog::ShowDirsOnly - | QFileDialog::DontResolveSymlinks); + connect(button, &QPushButton::clicked, this, [this, listwidget] { + const QString dir = QFileDialog::getExistingDirectory( + this, tr("Open Directory"), QDir::homePath(), + QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); const std::string s_dir = Strings::ToUtf8String(dir); if (dir.isEmpty() || paths.count(s_dir)) return; @@ -129,12 +128,12 @@ { QPushButton* button = new QPushButton(tr("Remove"), widget); - connect(listwidget, &QListWidget::itemSelectionChanged, this, [button, listwidget]{ + connect(listwidget, &QListWidget::itemSelectionChanged, this, [button, listwidget] { QList<QListWidgetItem*> selection = listwidget->selectedItems(); button->setEnabled(selection.size() > 0); }); - connect(button, &QPushButton::clicked, this, [this, listwidget]{ + connect(button, &QPushButton::clicked, this, [this, listwidget] { QList<QListWidgetItem*> selection = listwidget->selectedItems(); for (const auto& item : selection) { paths.erase(Strings::ToUtf8String(item->text())); @@ -162,9 +161,8 @@ QCheckBox* checkbox = new QCheckBox(tr("Detect new files and folders under library folders"), group_box); checkbox->setCheckState(real_time_monitor ? Qt::Checked : Qt::Unchecked); - connect(checkbox, &QCheckBox::stateChanged, this, [this](int state) { - real_time_monitor = (state != Qt::Unchecked); - }); + connect(checkbox, &QCheckBox::stateChanged, this, + [this](int state) { real_time_monitor = (state != Qt::Unchecked); }); group_box_layout->addWidget(checkbox); } @@ -184,8 +182,7 @@ } SettingsPageLibrary::SettingsPageLibrary(QWidget* parent) - : SettingsPage(parent, tr("Library")), - paths(session.config.library.paths) { + : SettingsPage(parent, tr("Library")), paths(session.config.library.paths) { real_time_monitor = session.config.library.real_time_monitor; AddTab(CreateFoldersWidget(), tr("Folder")); }